Closed
Description
I tried this code:
https://github.com/planetoryd/rust_bug_missing_field
#![feature(decl_macro)]
make_struct!(Uh);
macro make_struct ($id:ident) {
pub struct $id(pub i32);
}
fn main() {
let k = Uh(2);
println!("{}", k.0);
}
The equivalent code without macro works.
hash@hash-pc /s/e/missing_field (master)> cargo b
Compiling missing_field v0.1.0 (/space/experim/missing_field)
error[E0609]: no field `0` on type `Uh`
--> src/main.rs:11:22
|
11 | println!("{}", k.0);
| ^ help: a field with a similar name exists: `0`
For more information about this error, try `rustc --explain E0609`.
error: could not compile `missing_field` (bin "missing_field") due to previous error
warning: build failed, waiting for other jobs to finish...
Meta
rustc --version --verbose
:
rustc 1.75.0-nightly (e0d7ed1f4 2023-10-01)
binary: rustc
commit-hash: e0d7ed1f453fb54578cc96dfea859b0e7be15016
commit-date: 2023-10-01
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: **17.0.2**
Metadata
Metadata
Assignees
Labels
Area: Declarative macros 2.0 (#39412)Area: Messages for errors, warnings, and lintsArea: Macro hygieneDiagnostics: Confusing error or lint that should be reworked.Diagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.`#![feature(decl_macro)]`Relevant to the compiler team, which will review and decide on the PR/issue.