Skip to content

Commit a743a54

Browse files
committed
Auto merge of rust-lang#140096 - jhpratt:rollup-0dqrcxa, r=jhpratt
Rollup of 11 pull requests Successful merges: - rust-lang#139795 (Clarify why SGX code specifies linkage/symbol names for certain statics) - rust-lang#139946 (fix missing word in comment) - rust-lang#139982 (SystemTime doc tweaks) - rust-lang#140009 (docs(LocalKey<T>): clarify that T's Drop shouldn't panic) - rust-lang#140021 (Don't ICE on pending obligations from deep normalization in a loop) - rust-lang#140036 (Advent of `tests/ui` (misc cleanups and improvements) [4/N]) - rust-lang#140047 (remove a couple clones) - rust-lang#140052 (Fix error when an intra doc link is trying to resolve an empty associated item) - rust-lang#140074 (rustdoc-json: Improve test for auto-trait impls) - rust-lang#140076 (jsondocck: Require command is at start of line) - rust-lang#140081 (Update `libc` to 0.2.172) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b8005bf + 4c5a95f commit a743a54

38 files changed

+311
-76
lines changed

Diff for: compiler/rustc_builtin_macros/src/autodiff.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -596,15 +596,14 @@ mod llvm_enzyme {
596596
}
597597
};
598598
let arg = ty.kind.is_simple_path().unwrap();
599-
let sl: Vec<Symbol> = vec![arg, kw::Default];
600-
let tmp = ecx.def_site_path(&sl);
599+
let tmp = ecx.def_site_path(&[arg, kw::Default]);
601600
let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
602601
let default_call_expr = ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);
603602
body.stmts.push(ecx.stmt_expr(default_call_expr));
604603
return body;
605604
}
606605

607-
let mut exprs: P<ast::Expr> = primal_call.clone();
606+
let mut exprs: P<ast::Expr> = primal_call;
608607
let d_ret_ty = match d_sig.decl.output {
609608
FnRetTy::Ty(ref ty) => ty.clone(),
610609
FnRetTy::Default(span) => {
@@ -622,7 +621,7 @@ mod llvm_enzyme {
622621
// type due to the Const return activity.
623622
exprs = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![exprs]);
624623
} else {
625-
let q = QSelf { ty: d_ret_ty.clone(), path_span: span, position: 0 };
624+
let q = QSelf { ty: d_ret_ty, path_span: span, position: 0 };
626625
let y =
627626
ExprKind::Path(Some(P(q)), ecx.path_ident(span, Ident::from_str("default")));
628627
let default_call_expr = ecx.expr(span, y);
@@ -640,8 +639,7 @@ mod llvm_enzyme {
640639
let mut exprs2 = thin_vec![exprs];
641640
for arg in args.iter().skip(1) {
642641
let arg = arg.kind.is_simple_path().unwrap();
643-
let sl: Vec<Symbol> = vec![arg, kw::Default];
644-
let tmp = ecx.def_site_path(&sl);
642+
let tmp = ecx.def_site_path(&[arg, kw::Default]);
645643
let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
646644
let default_call_expr =
647645
ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);

Diff for: compiler/rustc_middle/src/ty/assoc.rs

+2
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ impl AssocItems {
246246
}
247247

248248
/// Returns an iterator over all associated items with the given name, ignoring hygiene.
249+
///
250+
/// Panics if `name.is_empty()` returns `true`.
249251
pub fn filter_by_name_unhygienic(
250252
&self,
251253
name: Symbol,

Diff for: compiler/rustc_mir_build/src/builder/scope.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ fn build_scope_drops<'tcx>(
15301530
// path, then don't generate the drop. (We only take this into
15311531
// account for non-unwind paths so as not to disturb the
15321532
// caching mechanism.)
1533-
if scope.moved_locals.iter().any(|&o| o == local) {
1533+
if scope.moved_locals.contains(&local) {
15341534
continue;
15351535
}
15361536

Diff for: compiler/rustc_trait_selection/src/traits/normalize.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,15 @@ impl<'tcx> At<'_, 'tcx> {
7777
.into_value_registering_obligations(self.infcx, &mut *fulfill_cx);
7878
let errors = fulfill_cx.select_all_or_error(self.infcx);
7979
let value = self.infcx.resolve_vars_if_possible(value);
80-
if errors.is_empty() { Ok(value) } else { Err(errors) }
80+
if errors.is_empty() {
81+
Ok(value)
82+
} else {
83+
// Drop pending obligations, since deep normalization may happen
84+
// in a loop and we don't want to trigger the assertion on the next
85+
// iteration due to pending ambiguous obligations we've left over.
86+
let _ = fulfill_cx.collect_remaining_errors(self.infcx);
87+
Err(errors)
88+
}
8189
}
8290
}
8391
}

Diff for: library/Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ dependencies = [
157157

158158
[[package]]
159159
name = "libc"
160-
version = "0.2.171"
160+
version = "0.2.172"
161161
source = "registry+https://github.com/rust-lang/crates.io-index"
162-
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
162+
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
163163
dependencies = [
164164
"rustc-std-workspace-core",
165165
]

Diff for: library/core/src/any.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,8 @@ impl hash::Hash for TypeId {
772772
// (especially given the previous point about the lower 64 bits being
773773
// high quality on their own).
774774
// - It is correct to do so -- only hashing a subset of `self` is still
775-
// with an `Eq` implementation that considers the entire value, as
776-
// ours does.
775+
// compatible with an `Eq` implementation that considers the entire
776+
// value, as ours does.
777777
self.t.1.hash(state);
778778
}
779779
}

Diff for: library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ miniz_oxide = { version = "0.8.0", optional = true, default-features = false }
3535
addr2line = { version = "0.24.0", optional = true, default-features = false }
3636

3737
[target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies]
38-
libc = { version = "0.2.171", default-features = false, features = [
38+
libc = { version = "0.2.172", default-features = false, features = [
3939
'rustc-dep-of-std',
4040
], public = true }
4141

Diff for: library/std/src/rt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ macro_rules! rtprintpanic {
4646
macro_rules! rtabort {
4747
($($t:tt)*) => {
4848
{
49-
rtprintpanic!("fatal runtime error: {}\n", format_args!($($t)*));
49+
rtprintpanic!("fatal runtime error: {}, aborting\n", format_args!($($t)*));
5050
crate::sys::abort_internal();
5151
}
5252
}

Diff for: library/std/src/sys/alloc/sgx.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ use crate::sys::pal::waitqueue::SpinMutex;
1010
// The current allocator here is the `dlmalloc` crate which we've got included
1111
// in the rust-lang/rust repository as a submodule. The crate is a port of
1212
// dlmalloc.c from C to Rust.
13+
//
14+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
1315
#[cfg_attr(test, linkage = "available_externally")]
14-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx5alloc8DLMALLOCE")]
16+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys5alloc3sgx8DLMALLOCE")]
1517
static DLMALLOC: SpinMutex<dlmalloc::Dlmalloc<Sgx>> =
1618
SpinMutex::new(dlmalloc::Dlmalloc::new_with_allocator(Sgx {}));
1719

Diff for: library/std/src/sys/args/sgx.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::sys::pal::abi::usercalls::raw::ByteBuffer;
88
use crate::sys_common::FromInner;
99
use crate::{fmt, slice};
1010

11+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
1112
#[cfg_attr(test, linkage = "available_externally")]
1213
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx4args4ARGSE")]
1314
static ARGS: AtomicUsize = AtomicUsize::new(0);

Diff for: library/std/src/sys/pal/sgx/abi/tls/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ const USIZE_BITS: usize = 64;
1111
const TLS_KEYS: usize = 128; // Same as POSIX minimum
1212
const TLS_KEYS_BITSET_SIZE: usize = (TLS_KEYS + (USIZE_BITS - 1)) / USIZE_BITS;
1313

14+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
1415
#[cfg_attr(test, linkage = "available_externally")]
15-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_KEY_IN_USEE")]
16+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_KEY_IN_USEE")]
1617
static TLS_KEY_IN_USE: SyncBitset = SYNC_BITSET_INIT;
1718
macro_rules! dup {
1819
((* $($exp:tt)*) $($val:tt)*) => (dup!( ($($exp)*) $($val)* $($val)* ));
1920
(() $($val:tt)*) => ([$($val),*])
2021
}
22+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
2123
#[cfg_attr(test, linkage = "available_externally")]
22-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_DESTRUCTORE")]
24+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_DESTRUCTORE")]
2325
static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = dup!((* * * * * * *) (AtomicUsize::new(0)));
2426

2527
unsafe extern "C" {

Diff for: library/std/src/sys/pal/sgx/os.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ pub fn current_exe() -> io::Result<PathBuf> {
7373
unsupported()
7474
}
7575

76+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
7677
#[cfg_attr(test, linkage = "available_externally")]
77-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx2os3ENVE")]
78+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx2os3ENVE")]
7879
static ENV: AtomicUsize = AtomicUsize::new(0);
80+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
7981
#[cfg_attr(test, linkage = "available_externally")]
80-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx2os8ENV_INITE")]
82+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx2os8ENV_INITE")]
8183
static ENV_INIT: Once = Once::new();
8284
type EnvStore = Mutex<HashMap<OsString, OsString>>;
8385

Diff for: library/std/src/sys/pal/sgx/thread.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ mod task_queue {
4545
}
4646
}
4747

48+
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
4849
#[cfg_attr(test, linkage = "available_externally")]
49-
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx6thread10TASK_QUEUEE")]
50+
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx6thread10TASK_QUEUEE")]
5051
static TASK_QUEUE: Mutex<Vec<Task>> = Mutex::new(Vec::new());
5152

5253
pub(super) fn lock() -> MutexGuard<'static, Vec<Task>> {

Diff for: library/std/src/thread/local.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ use crate::fmt;
2222
///
2323
/// Initialization is dynamically performed on the first call to a setter (e.g.
2424
/// [`with`]) within a thread, and values that implement [`Drop`] get
25-
/// destructed when a thread exits. Some caveats apply, which are explained below.
25+
/// destructed when a thread exits. Some platform-specific caveats apply, which
26+
/// are explained below.
27+
/// Note that, should the destructor panics, the whole process will be [aborted].
2628
///
2729
/// A `LocalKey`'s initializer cannot recursively depend on itself. Using a
2830
/// `LocalKey` in this way may cause panics, aborts or infinite recursion on
2931
/// the first call to `with`.
3032
///
33+
/// [aborted]: crate::process::abort
34+
///
3135
/// # Single-thread Synchronization
3236
///
3337
/// Though there is no potential race with other threads, it is still possible to

Diff for: library/std/src/time.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ pub struct Instant(time::Instant);
205205
/// println!("{}", elapsed.as_secs());
206206
/// }
207207
/// Err(e) => {
208-
/// // an error occurred!
209-
/// println!("Error: {e:?}");
208+
/// // the system clock went backwards!
209+
/// println!("Great Scott! {e:?}");
210210
/// }
211211
/// }
212212
/// }
@@ -245,6 +245,7 @@ pub struct Instant(time::Instant);
245245
/// > structure cannot represent the new point in time.
246246
///
247247
/// [`add`]: SystemTime::add
248+
/// [`UNIX_EPOCH`]: SystemTime::UNIX_EPOCH
248249
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
249250
#[stable(feature = "time2", since = "1.8.0")]
250251
pub struct SystemTime(time::SystemTime);

Diff for: src/librustdoc/passes/collect_intra_doc_links.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ fn filter_assoc_items_by_name_and_namespace(
5959
ident: Ident,
6060
ns: Namespace,
6161
) -> impl Iterator<Item = &ty::AssocItem> {
62-
tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name).filter(move |item| {
62+
let iter: Box<dyn Iterator<Item = &ty::AssocItem>> = if !ident.name.is_empty() {
63+
Box::new(tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name))
64+
} else {
65+
Box::new([].iter())
66+
};
67+
iter.filter(move |item| {
6368
item.namespace() == ns && tcx.hygienic_eq(ident, item.ident(tcx), assoc_items_of)
6469
})
6570
}

Diff for: src/tools/jsondocck/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ impl CommandKind {
154154
static LINE_PATTERN: LazyLock<Regex> = LazyLock::new(|| {
155155
RegexBuilder::new(
156156
r#"
157+
^\s*
157158
//@\s+
158159
(?P<negated>!?)
159160
(?P<cmd>[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)

Diff for: src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
thread $NAME panicked at tests/fail/panic/tls_macro_const_drop_panic.rs:LL:CC:
33
ow
4-
fatal runtime error: thread local panicked on drop
4+
fatal runtime error: thread local panicked on drop, aborting
55
error: abnormal termination: the program aborted execution
66

77
error: aborting due to 1 previous error

Diff for: src/tools/miri/tests/fail/panic/tls_macro_drop_panic.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
thread $NAME panicked at tests/fail/panic/tls_macro_drop_panic.rs:LL:CC:
33
ow
4-
fatal runtime error: thread local panicked on drop
4+
fatal runtime error: thread local panicked on drop, aborting
55
error: abnormal termination: the program aborted execution
66

77
error: aborting due to 1 previous error

Diff for: tests/crashes/133868.rs

-13
This file was deleted.

Diff for: tests/rustdoc-json/fns/return_type_alias.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Regression test for <https://github.com/rust-lang/rust/issues/104851>
22

3-
///@ set foo = "$.index[?(@.name=='Foo')].id"
3+
//@ set foo = "$.index[?(@.name=='Foo')].id"
44
pub type Foo = i32;
55

66
//@ is "$.index[?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo

Diff for: tests/rustdoc-json/impls/auto.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ impl Foo {
1717
// Testing spans, so all tests below code
1818
//@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 1]"
1919
//@ is "$.index[?(@.docs=='has span')].span.end" "[15, 2]"
20-
// FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
21-
// is "$.index[?(@.inner.impl.is_synthetic==true)].span" null
20+
//@ is "$.index[?(@.docs=='has span')].inner.impl.is_synthetic" false
21+
//@ is "$.index[?(@.inner.impl.is_synthetic==true)].span" null
22+
//@ is "$.index[?(@.inner.impl.is_synthetic==true)].inner.impl.for.resolved_path.path" '"Foo"'
23+
//@ is "$.index[?(@.inner.impl.is_synthetic==true)].inner.impl.trait.path" '"Bar"'
2224
pub struct Foo;

Diff for: tests/rustdoc-ui/intra-doc/empty-associated-items.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This test ensures that an empty associated item will not crash rustdoc.
2+
// This is a regression test for <https://github.com/rust-lang/rust/issues/140026>.
3+
4+
#[deny(rustdoc::broken_intra_doc_links)]
5+
6+
/// [`String::`]
7+
//~^ ERROR
8+
pub struct Foo;
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: unresolved link to `String::`
2+
--> $DIR/empty-associated-items.rs:6:7
3+
|
4+
LL | /// [`String::`]
5+
| ^^^^^^^^ the struct `String` has no field or associated item named ``
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/empty-associated-items.rs:4:8
9+
|
10+
LL | #[deny(rustdoc::broken_intra_doc_links)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to 1 previous error
14+

Diff for: tests/ui/amdgpu-require-explicit-cpu.rs

-18
This file was deleted.

Diff for: tests/ui/auto-instantiate.rs

-13
This file was deleted.
File renamed without changes.

Diff for: tests/ui/augmented-assignments-feature-gate-cross.rs renamed to tests/ui/binop/augmented-assignments-cross-crate.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Smoke test for overloaded compound assignments cross-crate.
2+
13
//@ run-pass
24
//@ aux-build:augmented_assignments.rs
35

Diff for: tests/ui/augmented-assignments.rs renamed to tests/ui/borrowck/augmented-assignments.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Check that overloaded compound assignment operators respect usual borrowck rules and emit
2+
//! reasonable diagnostics.
3+
14
use std::ops::AddAssign;
25

36
#[derive(Clone)]

Diff for: tests/ui/augmented-assignments.stderr renamed to tests/ui/borrowck/augmented-assignments.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0505]: cannot move out of `x` because it is borrowed
2-
--> $DIR/augmented-assignments.rs:17:5
2+
--> $DIR/augmented-assignments.rs:20:5
33
|
44
LL | let mut x = Int(1);
55
| ----- binding `x` declared here
@@ -10,7 +10,7 @@ LL | x;
1010
| ^ move out of `x` occurs here
1111

1212
error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
13-
--> $DIR/augmented-assignments.rs:24:5
13+
--> $DIR/augmented-assignments.rs:27:5
1414
|
1515
LL | y
1616
| ^ cannot borrow as mutable

0 commit comments

Comments
 (0)