-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Show macro name in 'this error originates in macro' message #82069
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ LL | static A: usize = 0; | |
| ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | ||
| | ||
= note: required by `std::alloc::GlobalAlloc::alloc` | ||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated to this PR, but would it be possible to only show "run with -Z macro-backtrace" in nightly builds, the same way the compiler only suggests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For months I've thought of suggesting this but kept forgetting, so thanks for suggesting it! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be a very useful option for debugging macros, so I think it's good to make people aware of it. Unlike There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Aaron1011's observation is exactly the reason I didn't gate that suggestion on being in nightly. |
||
|
||
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied | ||
--> $DIR/not-an-allocator.rs:2:1 | ||
|
@@ -14,7 +14,7 @@ LL | static A: usize = 0; | |
| ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | ||
| | ||
= note: required by `std::alloc::GlobalAlloc::dealloc` | ||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied | ||
--> $DIR/not-an-allocator.rs:2:1 | ||
|
@@ -23,7 +23,7 @@ LL | static A: usize = 0; | |
| ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | ||
| | ||
= note: required by `std::alloc::GlobalAlloc::realloc` | ||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied | ||
--> $DIR/not-an-allocator.rs:2:1 | ||
|
@@ -32,7 +32,7 @@ LL | static A: usize = 0; | |
| ^^^^^^^^^^^^^^^^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | ||
| | ||
= note: required by `std::alloc::GlobalAlloc::alloc_zeroed` | ||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
|
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.
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.
I think the current output looks better - e.g. 'this error originates in the attribute macro
test
' vs 'this error originates in attribute macrotest
'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.
I'm not bothered either way :)
It seems like you have to rebless, but beyond that, r=me.