-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Replace macro backtraces with labeled local uses #35702
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Replace local backtrace with def-use, repair std macro spans
- Loading branch information
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,26 @@ | ||
| error: requires at least a format string argument | ||
| --> $DIR/bad-format-args.rs:12:5 | ||
| | | ||
| 12 | format!(); | ||
| | ^^^^^^^^^^ | ||
| | | ||
| = note: this error originates in a macro from the standard library | ||
|
|
||
| error: expected token: `,` | ||
| --> $DIR/bad-format-args.rs:13:5 | ||
| | | ||
| 13 | format!("" 1); | ||
| | ^^^^^^^^^^^^^^ | ||
| | | ||
| = note: this error originates in a macro from the standard library | ||
|
|
||
| error: expected token: `,` | ||
| --> $DIR/bad-format-args.rs:14:5 | ||
| | | ||
| 14 | format!("", 1 1); | ||
| | ^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: this error originates in a macro from the standard library | ||
|
|
||
| error: aborting due to 3 previous errors | ||
|
|
This file contains hidden or 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 hidden or 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,10 @@ | ||
| error: cannot apply unary operator `!` to type `&'static str` | ||
| --> $DIR/issue-28308.rs:12:5 | ||
| | | ||
| 12 | assert!("foo"); | ||
| | ^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: this error originates in a macro from the standard library | ||
|
|
||
| error: aborting due to previous error | ||
|
|
This file contains hidden or 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,13 @@ | ||
| // Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
| // file at the top-level directory of this distribution and at | ||
| // http://rust-lang.org/COPYRIGHT. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
| // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
| // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
| // option. This file may not be copied, modified, or distributed | ||
| // except according to those terms. | ||
|
|
||
| fn main() { | ||
| let x = vec![]; | ||
| } |
This file contains hidden or 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,11 @@ | ||
| error[E0282]: unable to infer enough type information about `_` | ||
| --> $DIR/repair_span_std_macros.rs:12:13 | ||
| | | ||
| 12 | let x = vec![]; | ||
| | ^^^^^^ cannot infer type for `_` | ||
| | | ||
| = note: type annotations or generic parameter binding required | ||
| = note: this error originates in a macro from the standard library | ||
|
|
||
| error: aborting due to previous error | ||
|
|
23 changes: 23 additions & 0 deletions
23
src/test/ui/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs
This file contains hidden or 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,23 @@ | ||
| // Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
| // file at the top-level directory of this distribution and at | ||
| // http://rust-lang.org/COPYRIGHT. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
| // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
| // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
| // option. This file may not be copied, modified, or distributed | ||
| // except according to those terms. | ||
|
|
||
| #![crate_type = "dylib"] | ||
|
|
||
| pub fn print(_args: std::fmt::Arguments) {} | ||
|
|
||
| #[macro_export] | ||
| macro_rules! myprint { | ||
| ($($arg:tt)*) => (print(format_args!($($arg)*))); | ||
| } | ||
|
|
||
| #[macro_export] | ||
| macro_rules! myprintln { | ||
| ($fmt:expr) => (myprint!(concat!($fmt, "\n"))); | ||
| } |
This file contains hidden or 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,17 @@ | ||
| // Copyright 2012 The Rust Project Developers. See the COPYRIGHT | ||
| // file at the top-level directory of this distribution and at | ||
| // http://rust-lang.org/COPYRIGHT. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
| // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
| // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
| // option. This file may not be copied, modified, or distributed | ||
| // except according to those terms. | ||
|
|
||
| // aux-build:extern_macro_crate.rs | ||
| #[macro_use(myprintln, myprint)] | ||
| extern crate extern_macro_crate; | ||
|
|
||
| fn main() { | ||
| myprintln!("{}"); //~ ERROR in this macro | ||
| } |
This file contains hidden or 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,10 @@ | ||
| error: invalid reference to argument `0` (no arguments given) | ||
| --> $DIR/main.rs:16:5 | ||
| | | ||
| 16 | myprintln!("{}"); //~ ERROR in this macro | ||
| | ^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: this error originates in a macro from the standard library | ||
|
|
||
| error: aborting due to previous error | ||
|
|
This file contains hidden or 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,13 @@ | ||
| // Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
| // file at the top-level directory of this distribution and at | ||
| // http://rust-lang.org/COPYRIGHT. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
| // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
| // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
| // option. This file may not be copied, modified, or distributed | ||
| // except according to those terms. | ||
|
|
||
| fn main() { | ||
| println!(3 + 4); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
&mut children.iter_mut()? Shouldn't just&mut childrenbe enough?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a little overkill?
&mut childrendoesn't compile:But I probably could drop the
&mutin front.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's... odd, since it works in a simpler example: https://is.gd/Ep6Unm.
Edit: Actually, children is already
&mut Vec<_>, so justfor child in childrenshould work, if I understand iterators correctly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also doesn't work...
Sticking with the one that does :)