Open
Description
Code
macro_rules! blarg {
() => {
const A: u32 = const {
panic!()
};
const B: u32 = A + 1;
const C: u32 = B + 1;
const D: u32 = C + 1;
}
}
blarg!();
Current output
Compiling playground v0.0.1 (/playground)
error[E0080]: evaluation of `A::{constant#0}` failed
--> src/lib.rs:13:1
|
13 | blarg!();
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', src/lib.rs:13:1
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `blarg` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> src/lib.rs:3:24
|
3 | const A: u32 = const {
| ________________________^
4 | | panic!()
5 | | };
| |_________^
...
13 | blarg!();
| -------- in this macro invocation
|
= note: this note originates in the macro `blarg` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> src/lib.rs:7:24
|
7 | const B: u32 = A + 1;
| ^
...
13 | blarg!();
| -------- in this macro invocation
|
= note: this note originates in the macro `blarg` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> src/lib.rs:8:24
|
8 | const C: u32 = B + 1;
| ^
...
13 | blarg!();
| -------- in this macro invocation
|
= note: this note originates in the macro `blarg` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> src/lib.rs:9:24
|
9 | const D: u32 = C + 1;
| ^
...
13 | blarg!();
| -------- in this macro invocation
|
= note: this note originates in the macro `blarg` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0080`.
error: could not compile `playground` (lib) due to 1 previous error
Desired output
Compiling playground v0.0.1 (/playground)
error[E0080]: evaluation of `A::{constant#0}` failed
--> src/lib.rs:13:1
|
13 | blarg!();
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', src/lib.rs:13:1
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `blarg` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0080`.
error: could not compile `playground` (lib) due to 1 previous error
Rationale and extra context
playground link to repro: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f8bd0c35877ea97f896174c4543618cc
seems like a regression of this previous issue & fix: #110891
while working on a macro for rasn
, I tested the panic conditions for failure to parse the input literal, which I noticed produces a wall of note:
s that are utterly useless (especially given the fact that the macro is not expanded in the doctest so the error spans are just the same macro invocation over and over + a couple others, which makes finding the error very difficult:
error[E0080]: evaluation of `main::_doctest_main_src_macros_rs_193_0::SYS_DESCR::OID::{constant#0}::COMPONENTS::{constant#0}` failed
--> src/macros.rs:195:46
|
5 | const SYS_DESCR: &'static rasn::types::Oid = rasn::oid!(".3.3.6.1.2.1.2.2.1.3");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'the first OID arc must be <= 2', src/macros.rs:5:46
|
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `rasn::oid` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> src/macros.rs:195:46
|
5 | const SYS_DESCR: &'static rasn::types::Oid = rasn::oid!(".3.3.6.1.2.1.2.2.1.3");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this note originates in the macro `rasn::oid` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> src/macros.rs:195:46
|
5 | const SYS_DESCR: &'static rasn::types::Oid = rasn::oid!(".3.3.6.1.2.1.2.2.1.3");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this note originates in the macro `rasn::oid` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> src/macros.rs:195:46
|
5 | const SYS_DESCR: &'static rasn::types::Oid = rasn::oid!(".3.3.6.1.2.1.2.2.1.3");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this note originates in the macro `rasn::oid` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> src/macros.rs:195:46
|
5 | const SYS_DESCR: &'static rasn::types::Oid = rasn::oid!(".3.3.6.1.2.1.2.2.1.3");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this note originates in the macro `rasn::oid` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant encountered
--> src/macros.rs:196:12
|
6 | assert_eq!(SYS_DESCR, rasn::types::Oid::new(&[1, 3, 6, 1, 2, 1, 2, 2, 1, 3]).unwrap());
| ^^^^^^^^^
note: erroneous constant encountered
--> src/macros.rs:196:1
|
6 | assert_eq!(SYS_DESCR, rasn::types::Oid::new(&[1, 3, 6, 1, 2, 1, 2, 2, 1, 3]).unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
Other cases
Rust Version
rustc 1.85.0-beta.1 (e30eefff4 2025-01-08)
binary: rustc
commit-hash: e30eefff41038ceea427009023627d6d66b36715
commit-date: 2025-01-08
host: x86_64-unknown-linux-gnu
release: 1.85.0-beta.1
LLVM version: 19.1.6
Anything else?
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
&'static Oid
s librasn/rasn#404