Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
cd22123
Merge ref 'caccb4d0368b' from rust-lang/rust
invalid-email-address Sep 25, 2025
b3e02c4
Merge pull request #20740 from rust-lang/rustc-pull
lnicola Sep 25, 2025
f454c1c
Merge pull request #20735 from itsjunetime/fix_scip_salsa
ShoyuVanilla Sep 25, 2025
24a3429
Merge pull request #20738 from jackh726/next-trait-solver-next4
ShoyuVanilla Sep 25, 2025
9e9d275
Merge pull request #20742 from A4-Tacks/unused-raw-var
ShoyuVanilla Sep 26, 2025
ddbdd0f
Merge pull request #20736 from A4-Tacks/fix-invert-if-let-chain
ShoyuVanilla Sep 26, 2025
810fa71
Merge pull request #20598 from A4-Tacks/let-chain-sup-conv-to-guarded…
ShoyuVanilla Sep 26, 2025
1db52c7
Merge pull request #20729 from A4-Tacks/const-param-kwd
ShoyuVanilla Sep 26, 2025
446f9be
Merge pull request #20604 from A4-Tacks/cfg-attr-comp
ShoyuVanilla Sep 26, 2025
ea9f0ec
Merge pull request #20611 from A4-Tacks/replace-arith-op-prec
ShoyuVanilla Sep 26, 2025
1c75955
Merge pull request #20599 from A4-Tacks/bang-de-morgan
ShoyuVanilla Sep 26, 2025
4b79b21
Support `#[rustc_align_static]` inside `thread_local!`
Jules-Bertholet Sep 10, 2025
1382aea
Merge pull request #19867 from Kivooeo/unsafegate
Veykril Sep 28, 2025
39263e4
Merge ref 'f957826bff7a' from rust-lang/rust
invalid-email-address Sep 29, 2025
625c081
Merge pull request #20761 from rust-lang/rustc-pull
lnicola Sep 29, 2025
fbe7539
Merge pull request #20760 from A4-Tacks/all-any-not-attr-comp
ShoyuVanilla Sep 29, 2025
f2b8554
Merge pull request #20745 from Oblarg/fix-negative-int-literals-in-ma…
ShoyuVanilla Sep 30, 2025
91e6fee
Auto merge of #147143 - estebank:verbose-ret-type, r=fee1-dead
bors Sep 30, 2025
d9b51b0
Fix memory leak in `os` impl
Jules-Bertholet Oct 1, 2025
48deda0
Auto merge of #147210 - lnicola:sync-from-ra, r=lnicola
bors Oct 1, 2025
9c5bbfc
Auto merge of #147055 - beepster4096:subtype_is_not_a_projection, r=lcnr
bors Oct 2, 2025
4a2ab93
Auto merge of #147138 - jackh726:split-canonical-bound, r=lcnr
bors Oct 2, 2025
dad2206
Rollup merge of #146281 - Jules-Bertholet:static-align-thread-local, …
matthiaskrgr Oct 2, 2025
7440034
Rollup merge of #146535 - joshtriplett:mbe-unsafe-attr, r=petrochenkov
matthiaskrgr Oct 2, 2025
5e728d6
Rollup merge of #146585 - hkBst:indexing-1, r=jdonszelmann
matthiaskrgr Oct 2, 2025
86759cd
Rollup merge of #147004 - estebank:ascription-in-pat, r=fee1-dead
matthiaskrgr Oct 2, 2025
c810581
Rollup merge of #147221 - Zalathar:incremental, r=lqd
matthiaskrgr Oct 2, 2025
c9925ec
Rollup merge of #147225 - daxpedda:wasm-u-u-atomics-threads, r=alexcr…
matthiaskrgr Oct 2, 2025
0fada73
Rollup merge of #147227 - edwloef:box_take, r=joboet
matthiaskrgr Oct 2, 2025
39be81b
Rollup merge of #147233 - GuillaumeGomez:citool-submodule-init, r=Kobzol
matthiaskrgr Oct 2, 2025
4dde929
Rollup merge of #147236 - rustbot:docs-update, r=ehuss
matthiaskrgr Oct 2, 2025
2dc5a03
Auto merge of #147261 - matthiaskrgr:rollup-yh3fgvc, r=matthiaskrgr
bors Oct 2, 2025
ab66f23
Auto merge of #147196 - LorrensP-2158466:same-res-ambiguity-test, r=p…
bors Oct 2, 2025
67ff7e0
Auto merge of #147231 - CrooseGit:dev/reucru01/extend_rustc_force_inl…
bors Oct 2, 2025
c60a3fc
Prepare for merging from rust-lang/rust
Oct 3, 2025
10879b0
Merge ref '3b8665c5ab3a' from rust-lang/rust
Oct 3, 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
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
42b384ec0dfcd528d99a4db0a337d9188a9eecaa
3b8665c5ab3aeced9b01672404c3764583e722ca
60 changes: 60 additions & 0 deletions tests/pass/static_align.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#![feature(static_align)]
#![deny(non_upper_case_globals)]

use std::cell::Cell;

// When a static uses `align(N)`, its address should be a multiple of `N`.

Expand All @@ -8,7 +11,64 @@ static FOO: u64 = 0;
#[rustc_align_static(512)]
static BAR: u64 = 0;

struct HasDrop(*const HasDrop);

impl Drop for HasDrop {
fn drop(&mut self) {
assert_eq!(core::ptr::from_mut(self).cast_const(), self.0);
}
}

thread_local! {
#[rustc_align_static(4096)]
static LOCAL: u64 = 0;

#[allow(unused_mut, reason = "test attribute handling")]
#[cfg_attr(true, rustc_align_static(4096))]
static CONST_LOCAL: u64 = const { 0 };

#[cfg_attr(any(true), cfg_attr(true, rustc_align_static(4096)))]
#[allow(unused_mut, reason = "test attribute handling")]
static HASDROP_LOCAL: Cell<HasDrop> = Cell::new(HasDrop(core::ptr::null()));

/// I love doc comments.
#[allow(unused_mut, reason = "test attribute handling")]
#[cfg_attr(all(),
cfg_attr(any(true),
cfg_attr(true, rustc_align_static(4096))))]
#[allow(unused_mut, reason = "test attribute handling")]
/// I love doc comments.
static HASDROP_CONST_LOCAL: Cell<HasDrop> = const { Cell::new(HasDrop(core::ptr::null())) };

#[cfg_attr(true,)]
#[cfg_attr(false,)]
#[cfg_attr(
true,
rustc_align_static(32),
cfg_attr(true, allow(non_upper_case_globals, reason = "test attribute handling")),
cfg_attr(false,)
)]
#[cfg_attr(false, rustc_align_static(0))]
static more_attr_testing: u64 = 0;
}

fn thread_local_ptr<T>(key: &'static std::thread::LocalKey<T>) -> *const T {
key.with(|local| core::ptr::from_ref::<T>(local))
}

fn main() {
assert!(core::ptr::from_ref(&FOO).addr().is_multiple_of(256));
assert!(core::ptr::from_ref(&BAR).addr().is_multiple_of(512));

assert!(thread_local_ptr(&LOCAL).addr().is_multiple_of(4096));
assert!(thread_local_ptr(&CONST_LOCAL).addr().is_multiple_of(4096));
assert!(thread_local_ptr(&HASDROP_LOCAL).addr().is_multiple_of(4096));
assert!(thread_local_ptr(&HASDROP_CONST_LOCAL).addr().is_multiple_of(4096));
assert!(thread_local_ptr(&more_attr_testing).addr().is_multiple_of(32));

// Test that address (and therefore alignment) is maintained during drop
let hasdrop_ptr = thread_local_ptr(&HASDROP_LOCAL);
core::mem::forget(HASDROP_LOCAL.replace(HasDrop(hasdrop_ptr.cast())));
let hasdrop_const_ptr = thread_local_ptr(&HASDROP_CONST_LOCAL);
core::mem::forget(HASDROP_CONST_LOCAL.replace(HasDrop(hasdrop_const_ptr.cast())));
}
8 changes: 8 additions & 0 deletions tests/pass/thread_local-panic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
thread_local! {
static LOCAL: u64 = panic!();

}

fn main() {
let _ = std::panic::catch_unwind(|| LOCAL.with(|_| {}));
}
5 changes: 5 additions & 0 deletions tests/pass/thread_local-panic.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

thread 'main' ($TID) panicked at tests/pass/thread_local-panic.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect