diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-06-15 23:51:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-15 23:51:54 +0200 |
| commit | 9f96120e668a56552130bc6a36bb1bb96172e382 (patch) | |
| tree | 9791662daa042cb1df2483134cdb787d4951e052 /compiler/rustc_codegen_llvm/src/errors.rs | |
| parent | 252a6dd40b01dbb9032689da47a37833b9ca08f7 (diff) | |
| parent | 3d8d5756635768883d0cc4555669d490f0eb756f (diff) | |
| download | rust-9f96120e668a56552130bc6a36bb1bb96172e382.tar.gz rust-9f96120e668a56552130bc6a36bb1bb96172e382.zip | |
Rollup merge of #134661 - dtolnay:prefixattr, r=fmease
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`.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
