forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#107041 - Nilstrieb:back-to-being-clueless-whe…
…ther-it-really-is-a-literal, r=compiler-errors Revert "Improve heuristics whether `format_args` string is a source literal" This reverts commit e6c02aa (from rust-lang#106195). Keeps the code improvements from the PR and the test (as a known-bug). Works around rust-lang#106408 while a proper fix is discussed more thoroughly in rust-lang#106505, as proposed by `@tmandry.` Reopens rust-lang#106191 r? compiler-errors
- Loading branch information
Showing
5 changed files
with
32 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// aux-build:format-string-proc-macro.rs | ||
// check-pass | ||
|
||
extern crate format_string_proc_macro; | ||
|
||
fn main() { | ||
let a = 0; | ||
format_string_proc_macro::capture_a_with_prepended_space_preserve_span!("{a}"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
// aux-build:format-string-proc-macro.rs | ||
// check-fail | ||
// known-bug: #106191 | ||
// unset-rustc-env:RUST_BACKTRACE | ||
// had to be reverted | ||
// error-pattern:internal compiler error | ||
// failure-status:101 | ||
// dont-check-compiler-stderr | ||
|
||
extern crate format_string_proc_macro; | ||
|
||
fn main() { | ||
format_string_proc_macro::respan_to_invalid_format_literal!("¡"); | ||
//~^ ERROR invalid format string: expected `'}'` but string was terminated | ||
format_args!(r#concat!("¡ {")); | ||
//~^ ERROR invalid format string: expected `'}'` but string was terminated | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,2 @@ | ||
error: invalid format string: expected `'}'` but string was terminated | ||
--> $DIR/respanned-literal-issue-106191.rs:6:65 | ||
| | ||
LL | format_string_proc_macro::respan_to_invalid_format_literal!("¡"); | ||
| ^^^ expected `'}'` in format string | ||
| | ||
= note: if you intended to print `{`, you can escape it using `{{` | ||
|
||
error: invalid format string: expected `'}'` but string was terminated | ||
--> $DIR/respanned-literal-issue-106191.rs:8:18 | ||
| | ||
LL | format_args!(r#concat!("¡ {")); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `'}'` in format string | ||
| | ||
= note: if you intended to print `{`, you can escape it using `{{` | ||
= note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
query stack during panic: | ||
end of query stack |