Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly print cstr literals in proc_macro::Literal::to_string #116124

Merged
merged 2 commits into from
Sep 26, 2023

Conversation

WaffleLapkin
Copy link
Member

Previously we printed the contents of the string, rather than the actual string literal (e.g. the c string instead of c"the c string").

Fixes #112820
cc #105723

@WaffleLapkin WaffleLapkin added A-proc-macros Area: Procedural macros F-c_str_literals `#![feature(c_str_literals)]` labels Sep 24, 2023
@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2023

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 24, 2023
@WaffleLapkin WaffleLapkin changed the title Propetly print cstr literals in proc_macro::Literal::to_string Properly print cstr literals in proc_macro::Literal::to_string Sep 24, 2023
@compiler-errors
Copy link
Member

r? @compiler-errors @bors r+

Thanks @WaffleLapkin

@bors
Copy link
Contributor

bors commented Sep 24, 2023

📌 Commit 99a2fa1 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 24, 2023
@compiler-errors
Copy link
Member

cc @rust-lang/wg-macros since y'all mentioned wanting to be in the loop for libprocmacro-related changes, at least until there is auto-ping group for the WG.

@@ -1411,7 +1411,15 @@ impl Literal {
let hashes = get_hashes_str(n);
f(&["br", hashes, "\"", symbol, "\"", hashes, suffix])
}
_ => f(&[symbol, suffix]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

making macros exhaustively match ❤️

@bors
Copy link
Contributor

bors commented Sep 25, 2023

⌛ Testing commit 99a2fa1 with merge 04114cd...

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 25, 2023
…to-string, r=compiler-errors

Properly print cstr literals in `proc_macro::Literal::to_string`

Previously we printed the contents of the string, rather than the actual string literal (e.g. `the c string` instead of `c"the c string"`).

Fixes rust-lang#112820
cc rust-lang#105723
@bors
Copy link
Contributor

bors commented Sep 25, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 25, 2023
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-mingw failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [rustdoc] tests\rustdoc\normalize-assoc-item.rs stdout ----

error: rustdoc failed!
status: exit code: 0xc00000fd
command: PATH="C:\a\rust\rust\build\x86_64-pc-windows-gnu\stage2\bin;C:\a\rust\rust\build\x86_64-pc-windows-gnu\stage0-bootstrap-tools\x86_64-pc-windows-gnu\release\deps;C:\a\rust\rust\build\x86_64-pc-windows-gnu\stage0\bin;C:\a\rust\rust\ninja;C:\a\rust\rust\mingw64\bin;C:\hostedtoolcache\windows\Python\3.11.5\x64\Scripts;C:\hostedtoolcache\windows\Python\3.11.5\x64;C:\msys64\usr\bin;C:\a\rust\rust\sccache;C:\PROGRA~1\MongoDB\bin;C:\aliyun-cli;C:\vcpkg;C:\cf-cli;C:\Program Files (x86)\NSIS;C:\tools\zstd;C:\Program Files\Mercurial;C:\hostedtoolcache\windows\stack\2.11.1\x64;C:\cabal\bin;C:\ghcup\bin;C:\Program Files\dotnet;C:\mysql\bin;C:\Program Files\R\R-4.3.1\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.20.7\x64\bin;C:\hostedtoolcache\windows\Python\3.7.9\x64\Scripts;C:\hostedtoolcache\windows\Python\3.7.9\x64;C:\hostedtoolcache\windows\Ruby\2.5.9\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.382-5\x64\bin;C:\Program Files\ImageMagick-7.1.1-Q16-HDRI;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\Program Files\Eclipse Foundation\jdk-8.0.302.8-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\Chocolatey\bin;C:\Program Files\PowerShell\7;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.7\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI;C:\tools\php;C:\Program Files (x86)\sbt\bin;C:\SeleniumWebDrivers\ChromeDriver;C:\SeleniumWebDrivers\EdgeDriver;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Amazon\SessionManagerPlugin\bin;C:\Program Files\Amazon\AWSSAMCLI\bin;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files (x86)\Microsoft BizTalk Server;C:\Program Files\LLVM\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps" "C:\\a\\rust\\rust\\build\\x86_64-pc-windows-gnu\\stage2\\bin\\rustdoc.exe" "-L" "C:\\a\\rust\\rust\\build\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-L" "C:\\a\\rust\\rust\\build\\x86_64-pc-windows-gnu\\test\\rustdoc\\normalize-assoc-item\\auxiliary" "-o" "C:\\a\\rust\\rust\\build\\x86_64-pc-windows-gnu\\test\\rustdoc\\normalize-assoc-item" "--deny" "warnings" "C:\\a\\rust\\rust\\tests\\rustdoc\\normalize-assoc-item.rs" "-A" "internal_features" "-Znormalize-docs"
--- stderr -------------------------------

thread 'main' has overflowed its stack
------------------------------------------

Copy link
Member

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any idea why the CI is failing with thread 'main' has overflowed its stack?

@compiler-errors
Copy link
Member

Rustdoc overflowed on an unrelated test (tests\rustdoc\normalize-assoc-item.rs)

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2023
@bors
Copy link
Contributor

bors commented Sep 25, 2023

⌛ Testing commit 99a2fa1 with merge bdd5b6c...

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 25, 2023
…to-string, r=compiler-errors

Properly print cstr literals in `proc_macro::Literal::to_string`

Previously we printed the contents of the string, rather than the actual string literal (e.g. `the c string` instead of `c"the c string"`).

Fixes rust-lang#112820
cc rust-lang#105723
@bors
Copy link
Contributor

bors commented Sep 25, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 25, 2023
@compiler-errors
Copy link
Member

@bors treeclosed=100 some bug with jq :|

@compiler-errors
Copy link
Member

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2023
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 "NO_OVERFLOW_CHECKS": 1,
 "DIST_REQUIRE_ALL_TOOLS": 1
}
##[endgroup]
jq: error: Top-level program not given (try ".")
jq: 1 compile error
##[error]Process completed with exit code 3.
[command]/usr/local/bin/git version
git version 2.42.0
Copying '/Users/runner/.gitconfig' to '/Users/runner/work/_temp/0610f2d9-84cb-4c76-b398-59047692bbb6/.gitconfig'
Temporarily overriding HOME='/Users/runner/work/_temp/0610f2d9-84cb-4c76-b398-59047692bbb6' before making global git config changes

@compiler-errors
Copy link
Member

@bors treeclosed-

@WaffleLapkin
Copy link
Member Author

@compiler-errors does this need a rebase after #116147 or just @bors retry should be enough?

@compiler-errors
Copy link
Member

We're good

@bors retry

@bors
Copy link
Contributor

bors commented Sep 26, 2023

⌛ Testing commit 99a2fa1 with merge a6dce3b...

@bors
Copy link
Contributor

bors commented Sep 26, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing a6dce3b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 26, 2023
@bors bors merged commit a6dce3b into rust-lang:master Sep 26, 2023
11 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 26, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a6dce3b): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 630.902s -> 630.463s (-0.07%)
Artifact size: 317.18 MiB -> 317.25 MiB (0.02%)

@WaffleLapkin WaffleLapkin deleted the fix-proc-macro-literal-to-string branch November 19, 2023 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-proc-macros Area: Procedural macros F-c_str_literals `#![feature(c_str_literals)]` merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

c"…" literals are handled incorrectly by proc_macro::Literal
8 participants