rust/src
León Orell Valerian Liehr b79d3b1ec1
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`.
2025-06-15 23:51:54 +02:00
..
bootstrap Rollup merge of #142459 - Shourya742:2025-06-11-remove-output-helper, r=Kobzol 2025-06-13 20:59:21 -07:00
build_helper Extract target no-std hack to build_helpers 2025-06-10 22:10:10 +08:00
ci Auto merge of #142483 - workingjubilee:rollup-8qnhueh, r=workingjubilee 2025-06-14 04:58:22 +00:00
doc Rollup merge of #133952 - bjorn3:remove_wasm_legacy_abi, r=alexcrichton 2025-06-15 23:51:53 +02:00
etc Rename build to host_target 2025-06-10 19:44:06 +02:00
gcc@04ce66d8c9 Update src/gcc submodule to 04ce66d8c918de9273bd7101638ad8724edf5e21 2025-05-14 18:02:02 +02:00
librustdoc Auto merge of #142335 - nnethercote:rustdoc-json-allocations, r=aDotInTheVoid 2025-06-14 23:21:16 +00:00
llvm-project@c1118fdbb3 Update to LLVM 20.1.5 2025-05-16 08:34:16 +08:00
rustc-std-workspace update rustc-std-workspace crates 2024-11-04 07:45:15 +01:00
rustdoc-json-types rustdoc-json-type: Depend on serde and serde_derive seperately 2025-06-03 21:17:33 +00:00
tools Rollup merge of #134661 - dtolnay:prefixattr, r=fmease 2025-06-15 23:51:54 +02:00
README.md
stage0 Bump master stage0 compiler 2025-05-27 20:36:00 +08:00
version bump version number to 1.89.0 2025-05-09 11:13:08 +02:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.