15

Github Show macro name in 'this error originates in macro' message by Aaron1011...

 4 years ago
source link: https://github.com/rust-lang/rust/pull/82069
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

This comment has been hidden.

@@ -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)

jyn514 on Feb 13

Member

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 #![feature] on nightly?

camelid on Feb 14

Member

For months I've thought of suggesting this but kept forgetting, so thanks for suggesting it!

Aaron1011 on Mar 4

Author

Member

This can be a very useful option for debugging macros, so I think it's good to make people aware of it. Unlike #![feature]s, this option is something can be enabled just for local testing, without requiring that anyone else use a nightly compiler.

estebank 25 days ago

Contributor

@Aaron1011's observation is exactly the reason I didn't gate that suggestion on being in nightly.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK