Skip to content

Rollup of 11 pull requests #140096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8dc7732
Clarify why SGX code specifies linkage/symbol names for certain statics
Apr 14, 2025
abf401d
fix missing word in comment
mumbleskates Apr 17, 2025
88bd191
Point UNIX_EPOCH to associated constant in SystemTime docs
coolreader18 Apr 17, 2025
34573d6
Be more specific about the error in the SystemTime example
coolreader18 Apr 17, 2025
0d56e3e
LocalKey<T>: document that the dtor should not panic
ShE3py Apr 18, 2025
17b7d63
rtprintpanic: clarify that the error is aborting the process
ShE3py Apr 18, 2025
a86df23
tests: rework `amdgpu-require-explicit-cpu.rs`
jieyouxu Apr 19, 2025
40b7332
tests: adjust some `augmented-assignment*` tests
jieyouxu Apr 19, 2025
b47fe51
tests: adjust `tests/ui/auto-instantiate.rs`
jieyouxu Apr 19, 2025
47911eb
Don't ICE on pending obligations from deep normalization in a loop
compiler-errors Apr 18, 2025
ae4b6d6
Update docs for `AssocItems::filter_by_name_unhygienic`
GuillaumeGomez Apr 19, 2025
e0437ec
Fix error when an intra doc link is trying to resolve an empty associ…
GuillaumeGomez Apr 19, 2025
88a5e1e
Add regression test for #140026
GuillaumeGomez Apr 19, 2025
c7e976e
rustdoc-json: Improve test for auto-trait impls
aDotInTheVoid Apr 20, 2025
fd4a093
jsondocck: Require command is at start of line
aDotInTheVoid Apr 20, 2025
6ea0fe5
Update `libc` to 0.2.172 for std
Berrysoft Apr 20, 2025
de93239
remove a couple clones
matthiaskrgr Apr 19, 2025
d850e0d
Rollup merge of #139795 - jethrogb:jb/sgx-linkage-comments, r=joboet
jhpratt Apr 21, 2025
1d6e298
Rollup merge of #139946 - mumbleskates:any-fix-missing-word, r=jhpratt
jhpratt Apr 21, 2025
213f3d3
Rollup merge of #139982 - coolreader18:time-doc-tweak, r=jhpratt
jhpratt Apr 21, 2025
7431360
Rollup merge of #140009 - ShE3py:tls-abort, r=thomcc
jhpratt Apr 21, 2025
1499121
Rollup merge of #140021 - compiler-errors:no-deep-norm-ice, r=lcnr
jhpratt Apr 21, 2025
e4ca190
Rollup merge of #140036 - jieyouxu:ui-cleanup-4, r=compiler-errors
jhpratt Apr 21, 2025
8f27141
Rollup merge of #140047 - matthiaskrgr:clo, r=compiler-errors
jhpratt Apr 21, 2025
951d3ef
Rollup merge of #140052 - GuillaumeGomez:fix-140026, r=nnethercote
jhpratt Apr 21, 2025
064187b
Rollup merge of #140074 - aDotInTheVoid:auto-test, r=GuillaumeGomez
jhpratt Apr 21, 2025
adc0473
Rollup merge of #140076 - aDotInTheVoid:jsondocline, r=GuillaumeGomez
jhpratt Apr 21, 2025
4c5a95f
Rollup merge of #140081 - Berrysoft:update-libc-172, r=tgross35
jhpratt Apr 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions compiler/rustc_builtin_macros/src/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,15 +596,14 @@ mod llvm_enzyme {
}
};
let arg = ty.kind.is_simple_path().unwrap();
let sl: Vec<Symbol> = vec![arg, kw::Default];
let tmp = ecx.def_site_path(&sl);
let tmp = ecx.def_site_path(&[arg, kw::Default]);
let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
let default_call_expr = ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);
body.stmts.push(ecx.stmt_expr(default_call_expr));
return body;
}

let mut exprs: P<ast::Expr> = primal_call.clone();
let mut exprs: P<ast::Expr> = primal_call;
let d_ret_ty = match d_sig.decl.output {
FnRetTy::Ty(ref ty) => ty.clone(),
FnRetTy::Default(span) => {
Expand All @@ -622,7 +621,7 @@ mod llvm_enzyme {
// type due to the Const return activity.
exprs = ecx.expr_call(new_decl_span, bb_call_expr, thin_vec![exprs]);
} else {
let q = QSelf { ty: d_ret_ty.clone(), path_span: span, position: 0 };
let q = QSelf { ty: d_ret_ty, path_span: span, position: 0 };
let y =
ExprKind::Path(Some(P(q)), ecx.path_ident(span, Ident::from_str("default")));
let default_call_expr = ecx.expr(span, y);
Expand All @@ -640,8 +639,7 @@ mod llvm_enzyme {
let mut exprs2 = thin_vec![exprs];
for arg in args.iter().skip(1) {
let arg = arg.kind.is_simple_path().unwrap();
let sl: Vec<Symbol> = vec![arg, kw::Default];
let tmp = ecx.def_site_path(&sl);
let tmp = ecx.def_site_path(&[arg, kw::Default]);
let default_call_expr = ecx.expr_path(ecx.path(span, tmp));
let default_call_expr =
ecx.expr_call(new_decl_span, default_call_expr, thin_vec![]);
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_middle/src/ty/assoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ impl AssocItems {
}

/// Returns an iterator over all associated items with the given name, ignoring hygiene.
///
/// Panics if `name.is_empty()` returns `true`.
pub fn filter_by_name_unhygienic(
&self,
name: Symbol,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/builder/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ fn build_scope_drops<'tcx>(
// path, then don't generate the drop. (We only take this into
// account for non-unwind paths so as not to disturb the
// caching mechanism.)
if scope.moved_locals.iter().any(|&o| o == local) {
if scope.moved_locals.contains(&local) {
continue;
}

Expand Down
10 changes: 9 additions & 1 deletion compiler/rustc_trait_selection/src/traits/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ impl<'tcx> At<'_, 'tcx> {
.into_value_registering_obligations(self.infcx, &mut *fulfill_cx);
let errors = fulfill_cx.select_all_or_error(self.infcx);
let value = self.infcx.resolve_vars_if_possible(value);
if errors.is_empty() { Ok(value) } else { Err(errors) }
if errors.is_empty() {
Ok(value)
} else {
// Drop pending obligations, since deep normalization may happen
// in a loop and we don't want to trigger the assertion on the next
// iteration due to pending ambiguous obligations we've left over.
let _ = fulfill_cx.collect_remaining_errors(self.infcx);
Err(errors)
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions library/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ dependencies = [

[[package]]
name = "libc"
version = "0.2.171"
version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,8 @@ impl hash::Hash for TypeId {
// (especially given the previous point about the lower 64 bits being
// high quality on their own).
// - It is correct to do so -- only hashing a subset of `self` is still
// with an `Eq` implementation that considers the entire value, as
// ours does.
// compatible with an `Eq` implementation that considers the entire
// value, as ours does.
self.t.1.hash(state);
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ miniz_oxide = { version = "0.8.0", optional = true, default-features = false }
addr2line = { version = "0.24.0", optional = true, default-features = false }

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

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ macro_rules! rtprintpanic {
macro_rules! rtabort {
($($t:tt)*) => {
{
rtprintpanic!("fatal runtime error: {}\n", format_args!($($t)*));
rtprintpanic!("fatal runtime error: {}, aborting\n", format_args!($($t)*));
crate::sys::abort_internal();
}
}
Expand Down
4 changes: 3 additions & 1 deletion library/std/src/sys/alloc/sgx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ use crate::sys::pal::waitqueue::SpinMutex;
// The current allocator here is the `dlmalloc` crate which we've got included
// in the rust-lang/rust repository as a submodule. The crate is a port of
// dlmalloc.c from C to Rust.
//
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx5alloc8DLMALLOCE")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys5alloc3sgx8DLMALLOCE")]
static DLMALLOC: SpinMutex<dlmalloc::Dlmalloc<Sgx>> =
SpinMutex::new(dlmalloc::Dlmalloc::new_with_allocator(Sgx {}));

Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/args/sgx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::sys::pal::abi::usercalls::raw::ByteBuffer;
use crate::sys_common::FromInner;
use crate::{fmt, slice};

// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx4args4ARGSE")]
static ARGS: AtomicUsize = AtomicUsize::new(0);
Expand Down
6 changes: 4 additions & 2 deletions library/std/src/sys/pal/sgx/abi/tls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ const USIZE_BITS: usize = 64;
const TLS_KEYS: usize = 128; // Same as POSIX minimum
const TLS_KEYS_BITSET_SIZE: usize = (TLS_KEYS + (USIZE_BITS - 1)) / USIZE_BITS;

// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_KEY_IN_USEE")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_KEY_IN_USEE")]
static TLS_KEY_IN_USE: SyncBitset = SYNC_BITSET_INIT;
macro_rules! dup {
((* $($exp:tt)*) $($val:tt)*) => (dup!( ($($exp)*) $($val)* $($val)* ));
(() $($val:tt)*) => ([$($val),*])
}
// Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
#[cfg_attr(test, linkage = "available_externally")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_DESTRUCTORE")]
#[unsafe(export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_DESTRUCTORE")]
static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = dup!((* * * * * * *) (AtomicUsize::new(0)));

unsafe extern "C" {
Expand Down
6 changes: 4 additions & 2 deletions library/std/src/sys/pal/sgx/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ pub fn current_exe() -> io::Result<PathBuf> {
unsupported()
}

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

Expand Down
3 changes: 2 additions & 1 deletion library/std/src/sys/pal/sgx/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ mod task_queue {
}
}

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

pub(super) fn lock() -> MutexGuard<'static, Vec<Task>> {
Expand Down
6 changes: 5 additions & 1 deletion library/std/src/thread/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ use crate::fmt;
///
/// Initialization is dynamically performed on the first call to a setter (e.g.
/// [`with`]) within a thread, and values that implement [`Drop`] get
/// destructed when a thread exits. Some caveats apply, which are explained below.
/// destructed when a thread exits. Some platform-specific caveats apply, which
/// are explained below.
/// Note that, should the destructor panics, the whole process will be [aborted].
///
/// A `LocalKey`'s initializer cannot recursively depend on itself. Using a
/// `LocalKey` in this way may cause panics, aborts or infinite recursion on
/// the first call to `with`.
///
/// [aborted]: crate::process::abort
///
/// # Single-thread Synchronization
///
/// Though there is no potential race with other threads, it is still possible to
Expand Down
5 changes: 3 additions & 2 deletions library/std/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ pub struct Instant(time::Instant);
/// println!("{}", elapsed.as_secs());
/// }
/// Err(e) => {
/// // an error occurred!
/// println!("Error: {e:?}");
/// // the system clock went backwards!
/// println!("Great Scott! {e:?}");
/// }
/// }
/// }
Expand Down Expand Up @@ -245,6 +245,7 @@ pub struct Instant(time::Instant);
/// > structure cannot represent the new point in time.
///
/// [`add`]: SystemTime::add
/// [`UNIX_EPOCH`]: SystemTime::UNIX_EPOCH
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[stable(feature = "time2", since = "1.8.0")]
pub struct SystemTime(time::SystemTime);
Expand Down
7 changes: 6 additions & 1 deletion src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ fn filter_assoc_items_by_name_and_namespace(
ident: Ident,
ns: Namespace,
) -> impl Iterator<Item = &ty::AssocItem> {
tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name).filter(move |item| {
let iter: Box<dyn Iterator<Item = &ty::AssocItem>> = if !ident.name.is_empty() {
Box::new(tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name))
} else {
Box::new([].iter())
};
iter.filter(move |item| {
item.namespace() == ns && tcx.hygienic_eq(ident, item.ident(tcx), assoc_items_of)
})
}
Expand Down
1 change: 1 addition & 0 deletions src/tools/jsondocck/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ impl CommandKind {
static LINE_PATTERN: LazyLock<Regex> = LazyLock::new(|| {
RegexBuilder::new(
r#"
^\s*
//@\s+
(?P<negated>!?)
(?P<cmd>[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

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

error: aborting due to 1 previous error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

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

error: aborting due to 1 previous error
Expand Down
13 changes: 0 additions & 13 deletions tests/crashes/133868.rs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/rustdoc-json/fns/return_type_alias.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Regression test for <https://github.com/rust-lang/rust/issues/104851>

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

//@ is "$.index[?(@.name=='demo')].inner.function.sig.output.resolved_path.id" $foo
Expand Down
6 changes: 4 additions & 2 deletions tests/rustdoc-json/impls/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ impl Foo {
// Testing spans, so all tests below code
//@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 1]"
//@ is "$.index[?(@.docs=='has span')].span.end" "[15, 2]"
// FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
// is "$.index[?(@.inner.impl.is_synthetic==true)].span" null
//@ is "$.index[?(@.docs=='has span')].inner.impl.is_synthetic" false
//@ is "$.index[?(@.inner.impl.is_synthetic==true)].span" null
//@ is "$.index[?(@.inner.impl.is_synthetic==true)].inner.impl.for.resolved_path.path" '"Foo"'
//@ is "$.index[?(@.inner.impl.is_synthetic==true)].inner.impl.trait.path" '"Bar"'
pub struct Foo;
8 changes: 8 additions & 0 deletions tests/rustdoc-ui/intra-doc/empty-associated-items.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This test ensures that an empty associated item will not crash rustdoc.
// This is a regression test for <https://github.com/rust-lang/rust/issues/140026>.

#[deny(rustdoc::broken_intra_doc_links)]

/// [`String::`]
//~^ ERROR
pub struct Foo;
14 changes: 14 additions & 0 deletions tests/rustdoc-ui/intra-doc/empty-associated-items.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: unresolved link to `String::`
--> $DIR/empty-associated-items.rs:6:7
|
LL | /// [`String::`]
| ^^^^^^^^ the struct `String` has no field or associated item named ``
|
note: the lint level is defined here
--> $DIR/empty-associated-items.rs:4:8
|
LL | #[deny(rustdoc::broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

18 changes: 0 additions & 18 deletions tests/ui/amdgpu-require-explicit-cpu.rs

This file was deleted.

13 changes: 0 additions & 13 deletions tests/ui/auto-instantiate.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Smoke test for overloaded compound assignments cross-crate.

//@ run-pass
//@ aux-build:augmented_assignments.rs

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! Check that overloaded compound assignment operators respect usual borrowck rules and emit
//! reasonable diagnostics.

use std::ops::AddAssign;

#[derive(Clone)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/augmented-assignments.rs:17:5
--> $DIR/augmented-assignments.rs:20:5
|
LL | let mut x = Int(1);
| ----- binding `x` declared here
Expand All @@ -10,7 +10,7 @@ LL | x;
| ^ move out of `x` occurs here

error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
--> $DIR/augmented-assignments.rs:24:5
--> $DIR/augmented-assignments.rs:27:5
|
LL | y
| ^ cannot borrow as mutable
Expand Down
Loading
Loading