Skip to content

Commit 0986358

Browse files
committed
Auto merge of rust-lang#124456 - matthiaskrgr:rollup-8bm3m6v, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#123248 (1.78 release notes) - rust-lang#123942 (`x vendor`) - rust-lang#124165 (add test for incremental ICE: slice-pattern-const.rs rust-lang#83085) - rust-lang#124242 (bootstrap: Describe build_steps modules) - rust-lang#124406 (Remove unused `[patch]` for clippy_lints) - rust-lang#124429 (bootstrap: Document `struct Builder` and its fields) - rust-lang#124447 (Unconditionally call `really_init` on GNU/Linux) r? `@ghost` `@rustbot` modify labels: rollup
2 parents aed2187 + be89760 commit 0986358

File tree

20 files changed

+562
-27
lines changed

20 files changed

+562
-27
lines changed

Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,3 @@ strip = true
112112
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
113113
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
114114
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
115-
116-
[patch."https://github.com/rust-lang/rust-clippy"]
117-
clippy_lints = { path = "src/tools/clippy/clippy_lints" }

RELEASES.md

+120
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,123 @@
1+
Version 1.78.0 (2024-05-02)
2+
==========================
3+
4+
<a id="1.78.0-Language"></a>
5+
6+
Language
7+
--------
8+
- [Stabilize `#[cfg(target_abi = ...)]`](https://github.com/rust-lang/rust/pull/119590/)
9+
- [Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute](https://github.com/rust-lang/rust/pull/119888/)
10+
- [Make async-fn-in-trait implementable with concrete signatures](https://github.com/rust-lang/rust/pull/120103/)
11+
- [Make matching on NaN a hard error, and remove the rest of `illegal_floating_point_literal_pattern`](https://github.com/rust-lang/rust/pull/116284/)
12+
- [static mut: allow mutable reference to arbitrary types, not just slices and arrays](https://github.com/rust-lang/rust/pull/117614/)
13+
- [Extend `invalid_reference_casting` to include references casting to bigger memory layout](https://github.com/rust-lang/rust/pull/118983/)
14+
- [Add `non_contiguous_range_endpoints` lint for singleton gaps after exclusive ranges](https://github.com/rust-lang/rust/pull/118879/)
15+
- [Add `wasm_c_abi` lint for use of older wasm-bindgen versions](https://github.com/rust-lang/rust/pull/117918/)
16+
This lint currently only works when using Cargo.
17+
- [Update `indirect_structural_match` and `pointer_structural_match` lints to match RFC](https://github.com/rust-lang/rust/pull/120423/)
18+
- [Make non-`PartialEq`-typed consts as patterns a hard error](https://github.com/rust-lang/rust/pull/120805/)
19+
- [Split `refining_impl_trait` lint into `_reachable`, `_internal` variants](https://github.com/rust-lang/rust/pull/121720/)
20+
- [Remove unnecessary type inference when using associated types inside of higher ranked `where`-bounds](https://github.com/rust-lang/rust/pull/119849)
21+
- [Weaken eager detection of cyclic types during type inference](https://github.com/rust-lang/rust/pull/119989)
22+
- [`trait Trait: Auto {}`: allow upcasting from `dyn Trait` to `dyn Auto`](https://github.com/rust-lang/rust/pull/119338)
23+
24+
<a id="1.78.0-Compiler"></a>
25+
26+
Compiler
27+
--------
28+
29+
- [Made `INVALID_DOC_ATTRIBUTES` lint deny by default](https://github.com/rust-lang/rust/pull/111505/)
30+
- [Increase accuracy of redundant `use` checking](https://github.com/rust-lang/rust/pull/117772/)
31+
- [Suggest moving definition if non-found macro_rules! is defined later](https://github.com/rust-lang/rust/pull/121130/)
32+
- [Lower transmutes from int to pointer type as gep on null](https://github.com/rust-lang/rust/pull/121282/)
33+
34+
Target changes:
35+
36+
- [Windows tier 1 targets now require at least Windows 10](https://github.com/rust-lang/rust/pull/115141/)
37+
- [Enable CMPXCHG16B, SSE3, SAHF/LAHF and 128-bit Atomics in tier 1 Windows](https://github.com/rust-lang/rust/pull/120820/)
38+
- [Add `wasm32-wasip1` tier 2 (without host tools) target](https://github.com/rust-lang/rust/pull/120468/)
39+
- [Add `wasm32-wasip2` tier 3 target](https://github.com/rust-lang/rust/pull/119616/)
40+
- [Rename `wasm32-wasi-preview1-threads` to `wasm32-wasip1-threads`](https://github.com/rust-lang/rust/pull/122170/)
41+
- [Add `arm64ec-pc-windows-msvc` tier 3 target](https://github.com/rust-lang/rust/pull/119199/)
42+
- [Add `armv8r-none-eabihf` tier 3 target for the Cortex-R52](https://github.com/rust-lang/rust/pull/110482/)
43+
- [Add `loongarch64-unknown-linux-musl` tier 3 target](https://github.com/rust-lang/rust/pull/121832/)
44+
45+
Refer to Rust's [platform support page][platform-support-doc]
46+
for more information on Rust's tiered platform support.
47+
48+
<a id="1.78.0-Libraries"></a>
49+
50+
Libraries
51+
---------
52+
53+
- [Bump Unicode to version 15.1.0, regenerate tables](https://github.com/rust-lang/rust/pull/120777/)
54+
- [Make align_offset, align_to well-behaved in all cases](https://github.com/rust-lang/rust/pull/121201/)
55+
- [PartialEq, PartialOrd: document expectations for transitive chains](https://github.com/rust-lang/rust/pull/115386/)
56+
- [Optimize away poison guards when std is built with panic=abort](https://github.com/rust-lang/rust/pull/100603/)
57+
- [Replace pthread `RwLock` with custom implementation](https://github.com/rust-lang/rust/pull/110211/)
58+
- [Implement unwind safety for Condvar on all platforms](https://github.com/rust-lang/rust/pull/121768/)
59+
- [Add ASCII fast-path for `char::is_grapheme_extended`](https://github.com/rust-lang/rust/pull/121138/)
60+
61+
<a id="1.78.0-Stabilized-APIs"></a>
62+
63+
Stabilized APIs
64+
---------------
65+
66+
- [`impl Read for &Stdin`](https://doc.rust-lang.org/stable/std/io/struct.Stdin.html#impl-Read-for-%26Stdin)
67+
- [Accept non `'static` lifetimes for several `std::error::Error` related implementations](https://github.com/rust-lang/rust/pull/113833/)
68+
- [Make `impl<Fd: AsFd>` impl take `?Sized`](https://github.com/rust-lang/rust/pull/114655/)
69+
- [`impl From<TryReserveError> for io::Error`](https://doc.rust-lang.org/stable/std/io/struct.Error.html#impl-From%3CTryReserveError%3E-for-Error)
70+
71+
These APIs are now stable in const contexts:
72+
73+
- [`Barrier::new()`](https://doc.rust-lang.org/stable/std/sync/struct.Barrier.html#method.new)
74+
75+
<a id="1.78.0-Cargo"></a>
76+
77+
Cargo
78+
-----
79+
80+
- [Stabilize lockfile v4](https://github.com/rust-lang/cargo/pull/12852/)
81+
- [Respect `rust-version` when generating lockfile](https://github.com/rust-lang/cargo/pull/12861/)
82+
- [Control `--charset` via auto-detecting config value](https://github.com/rust-lang/cargo/pull/13337/)
83+
- [Support `target.<triple>.rustdocflags` officially](https://github.com/rust-lang/cargo/pull/13197/)
84+
- [Stabilize global cache data tracking](https://github.com/rust-lang/cargo/pull/13492/)
85+
86+
<a id="1.78.0-Misc"></a>
87+
88+
Misc
89+
----
90+
91+
- [rustdoc: add `--test-builder-wrapper` arg to support wrappers such as RUSTC_WRAPPER when building doctests](https://github.com/rust-lang/rust/pull/114651/)
92+
93+
<a id="1.78.0-Compatibility-Notes"></a>
94+
95+
Compatibility Notes
96+
-------------------
97+
98+
- [Many unsafe precondition checks now run for user code with debug assertions enabled](https://github.com/rust-lang/rust/pull/120594/)
99+
This change helps users catch undefined behavior in their code, though the details of how much is checked are generally not stable.
100+
- [riscv only supports split_debuginfo=off for now](https://github.com/rust-lang/rust/pull/120518/)
101+
- [Consistently check bounds on hidden types of `impl Trait`](https://github.com/rust-lang/rust/pull/121679)
102+
- [Change equality of higher ranked types to not rely on subtyping](https://github.com/rust-lang/rust/pull/118247)
103+
- [When called, additionally check bounds on normalized function return type](https://github.com/rust-lang/rust/pull/118882)
104+
- [Expand coverage for `arithmetic_overflow` lint](https://github.com/rust-lang/rust/pull/119432/)
105+
106+
<a id="1.78.0-Internal-Changes"></a>
107+
108+
Internal Changes
109+
----------------
110+
111+
These changes do not affect any public interfaces of Rust, but they represent
112+
significant improvements to the performance or internals of rustc and related
113+
tools.
114+
115+
- [Update to LLVM 18](https://github.com/rust-lang/rust/pull/120055/)
116+
- [Build `rustc` with 1CGU on `x86_64-pc-windows-msvc`](https://github.com/rust-lang/rust/pull/112267/)
117+
- [Build `rustc` with 1CGU on `x86_64-apple-darwin`](https://github.com/rust-lang/rust/pull/112268/)
118+
- [Introduce `run-make` V2 infrastructure, a `run_make_support` library and port over 2 tests as example](https://github.com/rust-lang/rust/pull/113026/)
119+
- [Windows: Implement condvar, mutex and rwlock using futex](https://github.com/rust-lang/rust/pull/121956/)
120+
1121
Version 1.77.2 (2024-04-09)
2122
===========================
3123

library/std/src/sys/pal/unix/args.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,10 @@ mod imp {
9898
}
9999

100100
#[inline(always)]
101-
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
102-
// On Linux-GNU, we rely on `ARGV_INIT_ARRAY` below to initialize
103-
// `ARGC` and `ARGV`. But in Miri that does not actually happen so we
104-
// still initialize here.
105-
#[cfg(any(miri, not(all(target_os = "linux", target_env = "gnu"))))]
106-
really_init(_argc, _argv);
101+
pub unsafe fn init(argc: isize, argv: *const *const u8) {
102+
// on GNU/Linux if we are main then we will init argv and argc twice, it "duplicates work"
103+
// BUT edge-cases are real: only using .init_array can break most emulators, dlopen, etc.
104+
really_init(argc, argv);
107105
}
108106

109107
/// glibc passes argc, argv, and envp to functions in .init_array, as a non-standard extension.

src/bootstrap/bootstrap.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1035,14 +1035,8 @@ def check_vendored_status(self):
10351035
if self.use_vendored_sources:
10361036
vendor_dir = os.path.join(self.rust_root, 'vendor')
10371037
if not os.path.exists(vendor_dir):
1038-
sync_dirs = "--sync ./src/tools/cargo/Cargo.toml " \
1039-
"--sync ./src/tools/rust-analyzer/Cargo.toml " \
1040-
"--sync ./compiler/rustc_codegen_cranelift/Cargo.toml " \
1041-
"--sync ./compiler/rustc_codegen_gcc/Cargo.toml " \
1042-
"--sync ./src/bootstrap/Cargo.toml "
10431038
eprint('ERROR: vendoring required, but vendor directory does not exist.')
1044-
eprint(' Run `cargo vendor {}` to initialize the '
1045-
'vendor directory.'.format(sync_dirs))
1039+
eprint(' Run `x.py vendor` to initialize the vendor directory.')
10461040
eprint(' Alternatively, use the pre-vendored `rustc-src` dist component.')
10471041
eprint(' To get a stable/beta/nightly version, download it from: ')
10481042
eprint(' '

src/bootstrap/src/core/build_steps/clean.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Implementation of `make clean` in rustbuild.
1+
//! `./x.py clean`
22
//!
33
//! Responsible for cleaning out a build directory of all old and stale
44
//! artifacts to prepare for a fresh build. Currently doesn't remove the

src/bootstrap/src/core/build_steps/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ pub(crate) mod synthetic_targets;
1414
pub(crate) mod test;
1515
pub(crate) mod tool;
1616
pub(crate) mod toolstate;
17+
pub(crate) mod vendor;

src/bootstrap/src/core/build_steps/run.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! Build-and-run steps for in-repo tools
2+
//!
3+
//! A bit of a hodge-podge as e.g. if a tool's a test fixture it should be in `build_steps::test`.
4+
//! If it can be reached from `./x.py run` it can go here.
5+
16
use std::path::PathBuf;
27
use std::process::Command;
38

src/bootstrap/src/core/build_steps/setup.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//! First time setup of a dev environment
2+
//!
3+
//! These are build-and-run steps for `./x.py setup`, which allows quickly setting up the directory
4+
//! for modifying, building, and running the compiler and library. Running arbitrary configuration
5+
//! allows setting up things that cannot be simply captured inside the config.toml, in addition to
6+
//! leading people away from manually editing most of the config.toml values.
7+
18
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
29
use crate::t;
310
use crate::utils::change_tracker::CONFIG_CHANGE_HISTORY;
@@ -25,6 +32,8 @@ pub enum Profile {
2532
None,
2633
}
2734

35+
static PROFILE_DIR: &str = "src/bootstrap/defaults";
36+
2837
/// A list of historical hashes of `src/etc/rust_analyzer_settings.json`.
2938
/// New entries should be appended whenever this is updated so we can detect
3039
/// outdated vs. user-modified settings files.
@@ -41,7 +50,7 @@ static RUST_ANALYZER_SETTINGS: &str = include_str!("../../../../etc/rust_analyze
4150

4251
impl Profile {
4352
fn include_path(&self, src_path: &Path) -> PathBuf {
44-
PathBuf::from(format!("{}/src/bootstrap/defaults/config.{}.toml", src_path.display(), self))
53+
PathBuf::from(format!("{}/{PROFILE_DIR}/config.{}.toml", src_path.display(), self))
4554
}
4655

4756
pub fn all() -> impl Iterator<Item = Self> {
@@ -220,7 +229,7 @@ fn setup_config_toml(path: &PathBuf, profile: Profile, config: &Config) {
220229

221230
let latest_change_id = CONFIG_CHANGE_HISTORY.last().unwrap().change_id;
222231
let settings = format!(
223-
"# Includes one of the default files in src/bootstrap/defaults\n\
232+
"# Includes one of the default files in {PROFILE_DIR}\n\
224233
profile = \"{profile}\"\n\
225234
change-id = {latest_change_id}\n"
226235
);

src/bootstrap/src/core/build_steps/suggest.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Attempt to magically identify good tests to run
2+
13
#![cfg_attr(feature = "build-metrics", allow(unused))]
24

35
use clap::Parser;

src/bootstrap/src/core/build_steps/test.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//! Implementation of the test-related targets of the build system.
1+
//! Build-and-run steps for `./x.py test` test fixtures
22
//!
3-
//! This file implements the various regression test suites that we execute on
4-
//! our CI.
3+
//! `./x.py test` (aka [`Kind::Test`]) is currently allowed to reach build steps in other modules.
4+
//! However, this contains ~all test parts we expect people to be able to build and run locally.
55
66
use std::env;
77
use std::ffi::OsStr;

src/bootstrap/src/core/build_steps/toolstate.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//! [Toolstate] checks to keep tools building
2+
//!
3+
//! Reachable via `./x.py test` but mostly relevant for CI, since it isn't run locally by default.
4+
//!
5+
//! [Toolstate]: https://forge.rust-lang.org/infra/toolstate.html
6+
17
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
28
use crate::utils::helpers::t;
39
use serde_derive::{Deserialize, Serialize};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
2+
use std::path::PathBuf;
3+
use std::process::Command;
4+
5+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
6+
pub(crate) struct Vendor {
7+
sync_args: Vec<PathBuf>,
8+
versioned_dirs: bool,
9+
root_dir: PathBuf,
10+
}
11+
12+
impl Step for Vendor {
13+
type Output = ();
14+
const DEFAULT: bool = true;
15+
const ONLY_HOSTS: bool = true;
16+
17+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
18+
run.alias("placeholder").default_condition(true)
19+
}
20+
21+
fn make_run(run: RunConfig<'_>) {
22+
run.builder.ensure(Vendor {
23+
sync_args: run.builder.config.cmd.vendor_sync_args(),
24+
versioned_dirs: run.builder.config.cmd.vendor_versioned_dirs(),
25+
root_dir: run.builder.src.clone(),
26+
});
27+
}
28+
29+
fn run(self, builder: &Builder<'_>) -> Self::Output {
30+
let mut cmd = Command::new(&builder.initial_cargo);
31+
cmd.arg("vendor");
32+
33+
if self.versioned_dirs {
34+
cmd.arg("--versioned-dirs");
35+
}
36+
37+
// Sync these paths by default.
38+
for p in [
39+
"src/tools/cargo/Cargo.toml",
40+
"src/tools/rust-analyzer/Cargo.toml",
41+
"compiler/rustc_codegen_cranelift/Cargo.toml",
42+
"compiler/rustc_codegen_gcc/Cargo.toml",
43+
"src/bootstrap/Cargo.toml",
44+
] {
45+
cmd.arg("--sync").arg(builder.src.join(p));
46+
}
47+
48+
// Also sync explicitly requested paths.
49+
for sync_arg in self.sync_args {
50+
cmd.arg("--sync").arg(sync_arg);
51+
}
52+
53+
// Will read the libstd Cargo.toml
54+
// which uses the unstable `public-dependency` feature.
55+
cmd.env("RUSTC_BOOTSTRAP", "1");
56+
57+
cmd.current_dir(self.root_dir);
58+
59+
builder.run(&mut cmd);
60+
}
61+
}

src/bootstrap/src/core/builder.rs

+28-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ use std::sync::OnceLock;
1414
use std::time::{Duration, Instant};
1515

1616
use crate::core::build_steps::tool::{self, SourceType};
17-
use crate::core::build_steps::{check, clean, compile, dist, doc, install, run, setup, test};
18-
use crate::core::build_steps::{clippy, llvm};
17+
use crate::core::build_steps::{
18+
check, clean, clippy, compile, dist, doc, install, llvm, run, setup, test, vendor,
19+
};
1920
use crate::core::config::flags::{Color, Subcommand};
2021
use crate::core::config::{DryRun, SplitDebuginfo, TargetSelection};
2122
use crate::prepare_behaviour_dump_dir;
@@ -34,13 +35,34 @@ use once_cell::sync::Lazy;
3435
#[cfg(test)]
3536
mod tests;
3637

38+
/// Builds and performs different [`Self::kind`]s of stuff and actions, taking
39+
/// into account build configuration from e.g. config.toml.
3740
pub struct Builder<'a> {
41+
/// Build configuration from e.g. config.toml.
3842
pub build: &'a Build,
43+
44+
/// The stage to use. Either implicitly determined based on subcommand, or
45+
/// explicitly specified with `--stage N`. Normally this is the stage we
46+
/// use, but sometimes we want to run steps with a lower stage than this.
3947
pub top_stage: u32,
48+
49+
/// What to build or what action to perform.
4050
pub kind: Kind,
51+
52+
/// A cache of outputs of [`Step`]s so we can avoid running steps we already
53+
/// ran.
4154
cache: Cache,
55+
56+
/// A stack of [`Step`]s to run before we can run this builder. The output
57+
/// of steps is cached in [`Self::cache`].
4258
stack: RefCell<Vec<Box<dyn Any>>>,
59+
60+
/// The total amount of time we spent running [`Step`]s in [`Self::stack`].
4361
time_spent_on_dependencies: Cell<Duration>,
62+
63+
/// The paths passed on the command line. Used by steps to figure out what
64+
/// to do. For example: with `./x check foo bar` we get `paths=["foo",
65+
/// "bar"]`.
4466
pub paths: Vec<PathBuf>,
4567
}
4668

@@ -638,6 +660,7 @@ pub enum Kind {
638660
Run,
639661
Setup,
640662
Suggest,
663+
Vendor,
641664
}
642665

643666
impl Kind {
@@ -658,6 +681,7 @@ impl Kind {
658681
Kind::Run => "run",
659682
Kind::Setup => "setup",
660683
Kind::Suggest => "suggest",
684+
Kind::Vendor => "vendor",
661685
}
662686
}
663687

@@ -921,6 +945,7 @@ impl<'a> Builder<'a> {
921945
),
922946
Kind::Setup => describe!(setup::Profile, setup::Hook, setup::Link, setup::Vscode),
923947
Kind::Clean => describe!(clean::CleanAll, clean::Rustc, clean::Std),
948+
Kind::Vendor => describe!(vendor::Vendor),
924949
// special-cased in Build::build()
925950
Kind::Format | Kind::Suggest => vec![],
926951
}
@@ -993,6 +1018,7 @@ impl<'a> Builder<'a> {
9931018
Kind::Setup,
9941019
path.as_ref().map_or([].as_slice(), |path| std::slice::from_ref(path)),
9951020
),
1021+
Subcommand::Vendor { .. } => (Kind::Vendor, &paths[..]),
9961022
};
9971023

9981024
Self::new_internal(build, kind, paths.to_owned())

0 commit comments

Comments
 (0)