Files
rust/tests/ui/macros/macro-paren-span-diagnostic.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
429 B
Rust
Raw Normal View History

2025-07-01 02:46:47 +05:00
//! Check that error spans in parenthesized macro expressions point to the call site.
2025-07-01 02:46:47 +05:00
#[rustfmt::skip]
macro_rules! paren {
($e:expr) => (($e))
// ^^^^ do not highlight here
}
mod m {
pub struct S {
2025-07-01 02:46:47 +05:00
x: i32,
}
2025-07-01 02:46:47 +05:00
pub fn make() -> S {
S { x: 0 }
}
}
fn main() {
let s = m::make();
paren!(s.x); //~ ERROR field `x` of struct `S` is private
// ^^^ highlight here
}