Skip to content

Commit 08b4256

Browse files
committed
Auto merge of rust-lang#138007 - jieyouxu:rollup-z897tqe, r=jieyouxu
Rollup of 10 pull requests Successful merges: - rust-lang#136581 (Retire the legacy `Makefile`-based `run-make` test infra) - rust-lang#136865 (Perform deeper compiletest path normalization for `$TEST_BUILD_DIR` to account for compare-mode/debugger cases, and normalize long type file filename hashes) - rust-lang#136975 (Look for `python3` first on MacOS, not `py`) - rust-lang#137240 (Slightly reformat `std::fs::remove_dir_all` error docs) - rust-lang#137303 (Remove `MaybeForgetReturn` suggestion) - rust-lang#137634 (Update `compiler-builtins` to 0.1.149) - rust-lang#137679 (Various coretests improvements) - rust-lang#137685 (self-contained linker: conservatively default to `-znostart-stop-gc`) - rust-lang#137850 (Stabilize `box_uninit_write`) - rust-lang#137947 (Do not install rustup on Rust for Linux job) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f9e0239 + 89c12e0 commit 08b4256

File tree

107 files changed

+255
-1090
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+255
-1090
lines changed

compiler/rustc_codegen_cranelift/patches/0029-stdlib-Disable-f16-and-f128-in-compiler-builtins.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ index 7165c3e48af..968552ad435 100644
1616

1717
[dependencies]
1818
core = { path = "../core", public = true }
19-
-compiler_builtins = { version = "=0.1.148", features = ['rustc-dep-of-std'] }
20-
+compiler_builtins = { version = "=0.1.148", features = ['rustc-dep-of-std', 'no-f16-f128'] }
19+
-compiler_builtins = { version = "=0.1.150", features = ['rustc-dep-of-std'] }
20+
+compiler_builtins = { version = "=0.1.150", features = ['rustc-dep-of-std', 'no-f16-f128'] }
2121

2222
[dev-dependencies]
2323
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }

compiler/rustc_codegen_ssa/src/back/link.rs

+26
Original file line numberDiff line numberDiff line change
@@ -3382,6 +3382,32 @@ fn add_lld_args(
33823382
// this, `wasm-component-ld`, which is overridden if this option is passed.
33833383
if !sess.target.is_like_wasm {
33843384
cmd.cc_arg("-fuse-ld=lld");
3385+
3386+
// GNU ld and LLD have opposite defaults on some section garbage-collection features. For
3387+
// example, the somewhat popular `linkme` crate and its dependents rely in practice on this
3388+
// difference: when using lld, they need `-z nostart-stop-gc` to prevent encapsulation
3389+
// symbols and sections from being garbage-collected.
3390+
//
3391+
// More information about all this can be found in:
3392+
// - https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order
3393+
// - https://lld.llvm.org/ELF/start-stop-gc
3394+
//
3395+
// So when using lld, we restore, for now, the traditional behavior to help migration, but
3396+
// will remove it in the future.
3397+
// Since this only disables an optimization, it shouldn't create issues, but is in theory
3398+
// slightly suboptimal. However, it:
3399+
// - doesn't have any visible impact on our benchmarks
3400+
// - reduces the need to disable lld for the crates that depend on this
3401+
//
3402+
// Note that lld can detect some cases where this difference is relied on, and emits a
3403+
// dedicated error to add this link arg. We could make use of this error to emit an FCW. As
3404+
// of writing this, we don't do it, because lld is already enabled by default on nightly
3405+
// without this mitigation: no working project would see the FCW, so we do this to help
3406+
// stabilization.
3407+
//
3408+
// FIXME: emit an FCW if linking fails due its absence, and then remove this link-arg in the
3409+
// future.
3410+
cmd.link_arg("-znostart-stop-gc");
33853411
}
33863412

33873413
if !flavor.is_gnu() {

compiler/rustc_errors/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ pub enum StashKey {
626626
MaybeFruTypo,
627627
CallAssocMethod,
628628
AssociatedTypeSuggestion,
629-
MaybeForgetReturn,
630629
/// Query cycle detected, stashing in favor of a better error.
631630
Cycle,
632631
UndeterminedMacroResolution,

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

-5
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
669669

670670
if !errors.is_empty() {
671671
self.adjust_fulfillment_errors_for_expr_obligation(&mut errors);
672-
let errors_causecode = errors
673-
.iter()
674-
.map(|e| (e.obligation.cause.span, e.root_obligation.cause.code().clone()))
675-
.collect::<Vec<_>>();
676672
self.err_ctxt().report_fulfillment_errors(errors);
677-
self.collect_unused_stmts_for_coerce_return_ty(errors_causecode);
678673
}
679674
}
680675

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+1-59
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use std::{fmt, iter, mem};
33
use itertools::Itertools;
44
use rustc_data_structures::fx::FxIndexSet;
55
use rustc_errors::codes::*;
6-
use rustc_errors::{
7-
Applicability, Diag, ErrorGuaranteed, MultiSpan, StashKey, a_or_an, listify, pluralize,
8-
};
6+
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, a_or_an, listify, pluralize};
97
use rustc_hir::def::{CtorOf, DefKind, Res};
108
use rustc_hir::def_id::DefId;
119
use rustc_hir::intravisit::Visitor;
@@ -2193,62 +2191,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21932191
}
21942192
}
21952193

2196-
pub(super) fn collect_unused_stmts_for_coerce_return_ty(
2197-
&self,
2198-
errors_causecode: Vec<(Span, ObligationCauseCode<'tcx>)>,
2199-
) {
2200-
for (span, code) in errors_causecode {
2201-
self.dcx().try_steal_modify_and_emit_err(span, StashKey::MaybeForgetReturn, |err| {
2202-
if let Some(fn_sig) = self.body_fn_sig()
2203-
&& let ObligationCauseCode::WhereClauseInExpr(_, _, binding_hir_id, ..) = code
2204-
&& !fn_sig.output().is_unit()
2205-
{
2206-
let mut block_num = 0;
2207-
let mut found_semi = false;
2208-
for (hir_id, node) in self.tcx.hir_parent_iter(binding_hir_id) {
2209-
// Don't proceed into parent bodies
2210-
if hir_id.owner != binding_hir_id.owner {
2211-
break;
2212-
}
2213-
match node {
2214-
hir::Node::Stmt(stmt) => {
2215-
if let hir::StmtKind::Semi(expr) = stmt.kind {
2216-
let expr_ty = self.typeck_results.borrow().expr_ty(expr);
2217-
let return_ty = fn_sig.output();
2218-
if !matches!(expr.kind, hir::ExprKind::Ret(..))
2219-
&& self.may_coerce(expr_ty, return_ty)
2220-
{
2221-
found_semi = true;
2222-
}
2223-
}
2224-
}
2225-
hir::Node::Block(_block) => {
2226-
if found_semi {
2227-
block_num += 1;
2228-
}
2229-
}
2230-
hir::Node::Item(item) => {
2231-
if let hir::ItemKind::Fn { .. } = item.kind {
2232-
break;
2233-
}
2234-
}
2235-
_ => {}
2236-
}
2237-
}
2238-
if block_num > 1 && found_semi {
2239-
err.span_suggestion_verbose(
2240-
// use the span of the *whole* expr
2241-
self.tcx.hir().span(binding_hir_id).shrink_to_lo(),
2242-
"you might have meant to return this to infer its type parameters",
2243-
"return ",
2244-
Applicability::MaybeIncorrect,
2245-
);
2246-
}
2247-
}
2248-
});
2249-
}
2250-
}
2251-
22522194
/// Given a vector of fulfillment errors, try to adjust the spans of the
22532195
/// errors to more accurately point at the cause of the failure.
22542196
///

compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::ops::ControlFlow;
22

3-
use rustc_errors::{
4-
Applicability, Diag, E0283, E0284, E0790, MultiSpan, StashKey, struct_span_code_err,
5-
};
3+
use rustc_errors::{Applicability, Diag, E0283, E0284, E0790, MultiSpan, struct_span_code_err};
64
use rustc_hir as hir;
75
use rustc_hir::LangItem;
86
use rustc_hir::def::{DefKind, Res};
@@ -197,7 +195,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
197195
// be ignoring the fact that we don't KNOW the type works
198196
// out. Though even that would probably be harmless, given that
199197
// we're only talking about builtin traits, which are known to be
200-
// inhabited. We used to check for `self.tcx.sess.has_errors()` to
198+
// inhabited. We used to check for `self.tainted_by_errors()` to
201199
// avoid inundating the user with unnecessary errors, but we now
202200
// check upstream for type errors and don't add the obligations to
203201
// begin with in those cases.
@@ -211,7 +209,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
211209
TypeAnnotationNeeded::E0282,
212210
false,
213211
);
214-
return err.stash(span, StashKey::MaybeForgetReturn).unwrap();
212+
return err.emit();
215213
}
216214
Some(e) => return e,
217215
}

library/Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ dependencies = [
6161

6262
[[package]]
6363
name = "compiler_builtins"
64-
version = "0.1.148"
64+
version = "0.1.150"
6565
source = "registry+https://github.com/rust-lang/crates.io-index"
66-
checksum = "26137996631d90d2727b905b480fdcf8c4479fdbce7afd7f8e3796d689b33cc2"
66+
checksum = "5c42734e0ccf0d9f953165770593a75306f0b24dda1aa03f115c70748726dbca"
6767
dependencies = [
6868
"cc",
6969
"rustc-std-workspace-core",

library/alloc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ edition = "2021"
1212

1313
[dependencies]
1414
core = { path = "../core", public = true }
15-
compiler_builtins = { version = "=0.1.148", features = ['rustc-dep-of-std'] }
15+
compiler_builtins = { version = "=0.1.150", features = ['rustc-dep-of-std'] }
1616

1717
[dev-dependencies]
1818
rand = { version = "0.9.0", default-features = false, features = ["alloc"] }

library/alloc/src/boxed.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,6 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
937937
/// # Examples
938938
///
939939
/// ```
940-
/// #![feature(box_uninit_write)]
941-
///
942940
/// let big_box = Box::<[usize; 1024]>::new_uninit();
943941
///
944942
/// let mut array = [0; 1024];
@@ -954,7 +952,7 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
954952
/// assert_eq!(*x, i);
955953
/// }
956954
/// ```
957-
#[unstable(feature = "box_uninit_write", issue = "129397")]
955+
#[stable(feature = "box_uninit_write", since = "CURRENT_RUSTC_VERSION")]
958956
#[inline]
959957
pub fn write(mut boxed: Self, value: T) -> Box<T, A> {
960958
unsafe {

library/alloc/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
#![feature(assert_matches)]
103103
#![feature(async_fn_traits)]
104104
#![feature(async_iterator)]
105-
#![feature(box_uninit_write)]
106105
#![feature(bstr)]
107106
#![feature(bstr_internals)]
108107
#![feature(char_max_len)]

library/coretests/tests/slice.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ use core::num::NonZero;
55
use core::ops::{Range, RangeInclusive};
66
use core::slice;
77

8-
use rand::seq::IndexedRandom;
9-
108
#[test]
119
fn test_position() {
1210
let b = [1, 2, 3, 5, 5];
@@ -1810,6 +1808,7 @@ fn select_nth_unstable() {
18101808
use core::cmp::Ordering::{Equal, Greater, Less};
18111809

18121810
use rand::Rng;
1811+
use rand::seq::IndexedRandom;
18131812

18141813
let mut rng = crate::test_rng();
18151814

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
1818
panic_unwind = { path = "../panic_unwind", optional = true }
1919
panic_abort = { path = "../panic_abort" }
2020
core = { path = "../core", public = true }
21-
compiler_builtins = { version = "=0.1.148" }
21+
compiler_builtins = { version = "=0.1.150" }
2222
unwind = { path = "../unwind" }
2323
hashbrown = { version = "0.15", default-features = false, features = [
2424
'rustc-dep-of-std',

library/std/src/fs.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -2857,9 +2857,11 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
28572857
///
28582858
/// See [`fs::remove_file`] and [`fs::remove_dir`].
28592859
///
2860-
/// `remove_dir_all` will fail if `remove_dir` or `remove_file` fail on any constituent paths, including the root `path`.
2861-
/// As a result, the directory you are deleting must exist, meaning that this function is not idempotent.
2862-
/// Additionally, `remove_dir_all` will also fail if the `path` is not a directory.
2860+
/// [`remove_dir_all`] will fail if [`remove_dir`] or [`remove_file`] fail on *any* constituent
2861+
/// paths, *including* the root `path`. Consequently,
2862+
///
2863+
/// - The directory you are deleting *must* exist, meaning that this function is *not idempotent*.
2864+
/// - [`remove_dir_all`] will fail if the `path` is *not* a directory.
28632865
///
28642866
/// Consider ignoring the error if validating the removal is not required for your use case.
28652867
///

0 commit comments

Comments
 (0)