You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reduce precedence of expressions that have an outer attr
Previously, `-Zunpretty=expanded` would expand this program as follows:
```rust
#![feature(stmt_expr_attributes)]
macro_rules! repro {
($e:expr) => {
#[allow(deprecated)] $e
};
}
#[derive(Default)]
struct Thing {
#[deprecated]
field: i32,
}
fn main() {
let thing = Thing::default();
let _ = repro!(thing).field;
}
```
```rs
#![feature(prelude_import)]
#![feature(stmt_expr_attributes)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
struct Thing {
#[deprecated]
field: i32,
}
#[automatically_derived]
impl ::core::default::Default for Thing {
#[inline]
fn default() -> Thing {
Thing { field: ::core::default::Default::default() }
}
}
fn main() {
let thing = Thing::default();
let _ = #[allow(deprecated)] thing.field;
}
```
This is not the correct expansion. The correct output would have `(#[allow(deprecated)] thing).field` with the attribute applying only to `thing`, not to `thing.field`.
0 commit comments