Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
99f5fb6
run replace-version-placeholder
cuviper Nov 9, 2026
325b278
bump stage0 to 1.101.0-beta.1
cuviper Nov 10, 2026
fcb99ab
update STAGE0_MISSING_TARGETS
cuviper Nov 10, 2026
db5c0c9
reformat with `cfg_select!` awareness
cuviper Nov 10, 2026
e2c096e
update `cfg(bootstrap)`
cuviper Nov 10, 2026
afc21ea
More bootstrap cleanup
cuviper Nov 11, 2026
4d789e7
Avoid `Hash::hash` when stable-hashing ExternAbi
Zalathar Nov 11, 2026
31f5000
Avoid `Hash::hash` when stable-hashing LangItem
Zalathar Nov 11, 2026
2a624c2
Avoid `Hash::hash` when stable-hashing DenseBitSet and BitMatrix
Zalathar Nov 11, 2026
b864cd3
Avoid `Hash::hash` when stable-hashing various types
Zalathar Nov 11, 2026
a7280a9
tests: Add regression test for infinite recursive dereference
hardikxk Nov 9, 2026
b0d1b2d
remove unused compiler utilities and types
TaKO8Ki Nov 11, 2026
ce09ca6
avoid redundant scans when extracting stage0 archives
TaKO8Ki Nov 11, 2026
b904030
miri: inline an unnecessary local
cuviper Nov 11, 2026
a6a7cca
feat: support nested functions with offload_kernel
xkevio Nov 11, 2026
5d01273
Rollup merge of #165778 - cuviper:bump-stage0, r=jieyouxu,Mark-Simula…
Zalathar Nov 12, 2026
3f6c7e3
Rollup merge of #163077 - xkevio:patch-1, r=ZuseZ4
Zalathar Nov 12, 2026
d428ea8
Rollup merge of #165578 - Zalathar:hash, r=adwinwhite
Zalathar Nov 12, 2026
d7e8478
Rollup merge of #165729 - hardikxk:tests/infinite-comp, r=adwinwhite
Zalathar Nov 12, 2026
e915eec
Rollup merge of #165819 - TaKO8Ki:avoid-stage0-archive-rescans, r=Mar…
Zalathar Nov 12, 2026
24bd397
Rollup merge of #165822 - TaKO8Ki:remove-unused-compiler-definitions,…
Zalathar Nov 12, 2026
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
22 changes: 18 additions & 4 deletions compiler/rustc_abi/src/extern_abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,33 @@ impl PartialEq for ExternAbi {

impl Eq for ExternAbi {}

impl ExternAbi {
/// Common implementation for `Hash` and `StableHash`.
fn stable_hash_inner(&self, hasher: &mut impl Hasher) {
// To avoid staging inconsistencies in stable hashing, we must not rely
// on any stdlib-provided or stdlib-derived impl of `Hash`.
// See <https://github.com/rust-lang/rust/issues/164734> for context.

// Hardcoded copy of the unstable `Hasher::write_str`, with an explicit terminator.
hasher.write(self.as_str().as_bytes());
hasher.write_u8(0xFF);

// double-assurance of a prefix breaker
hasher.write_u32(u32::from_be_bytes(*b"ABI\0"));
}
}

impl Hash for ExternAbi {
fn hash<H: Hasher>(&self, state: &mut H) {
self.as_str().hash(state);
// double-assurance of a prefix breaker
u32::from_be_bytes(*b"ABI\0").hash(state);
self.stable_hash_inner(state);
}
}

#[cfg(feature = "nightly")]
impl StableHash for ExternAbi {
#[inline]
fn stable_hash<Hcx: StableHashCtxt>(&self, _: &mut Hcx, hasher: &mut StableHasher) {
Hash::hash(self, hasher);
self.stable_hash_inner(hasher);
}
}

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// tidy-alphabetical-start
#![allow(clippy::mut_from_ref)] // Arena allocators are one place where this pattern is fine.
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(unwrap_infallible))]
#![cfg_attr(test, feature(test))]
#![deny(unsafe_op_in_unsafe_fn)]
#![doc(test(no_crate_inject, attr(deny(warnings))))]
Expand Down
9 changes: 1 addition & 8 deletions compiler/rustc_attr_ir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
//! * Functions called by the compiler itself.

use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::stable_hash::{StableHash, StableHashCtxt, StableHasher};
use rustc_macros::{BlobDecodable, Encodable, PrintAttribute, StableHash};
use rustc_span::def_id::DefId;
use rustc_span::{Symbol, kw, sym};
Expand Down Expand Up @@ -80,7 +79,7 @@ macro_rules! language_item_table {
$( $(#[$attr:meta])* $variant:ident, $module:ident :: $name:ident, $method:ident, $target:expr, $generics:expr; )*
) => {
/// A representation of all the valid lang items in Rust.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Encodable, BlobDecodable, PrintAttribute)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, StableHash, Encodable, BlobDecodable, PrintAttribute)]
pub enum LangItem {
$(
#[doc = concat!("The `", stringify!($name), "` lang item.")]
Expand Down Expand Up @@ -149,12 +148,6 @@ macro_rules! language_item_table {
}
}

impl StableHash for LangItem {
fn stable_hash<Hcx: StableHashCtxt>(&self, _: &mut Hcx, hasher: &mut StableHasher) {
::std::hash::Hash::hash(self, hasher);
}
}

language_item_table! {
// Variant name, Name, Getter method name, Target Generic requirements;
Sized, sym::sized, sized_trait, Target::Trait, GenericRequirement::Exact(0);
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_builtin_macros/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ mod autodiff {
}
}

#[derive(Diagnostic)]
#[diag("offload_kernel must be applied to function")]
pub(crate) struct OffloadKernelInvalidApplication {
#[primary_span]
pub(crate) span: Span,
}

#[derive(Diagnostic)]
#[diag("cannot concatenate {$lit_kind} literals")]
pub(crate) struct ConcatBytesInvalid {
Expand Down
56 changes: 42 additions & 14 deletions compiler/rustc_builtin_macros/src/offload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,26 @@ fn outer_normal_attr(normal: &Box<ast::NormalAttr>, id: ast::AttrId, span: Span)
fn extract_fn(
item: &Annotatable,
) -> Option<(ast::Visibility, ast::FnSig, Ident, ast::Generics, Option<Box<ast::Block>>)> {
match item {
Annotatable::Item(iitem) => match &iitem.kind {
ast::ItemKind::Fn(ast::Fn { sig, ident, generics, body, .. }) => {
Some((iitem.vis.clone(), sig.clone(), *ident, generics.clone(), body.clone()))
}
_ => None,
},
let fn_item_kind_and_vis = match item {
Annotatable::Item(iitem) => Some((&iitem.kind, &iitem.vis)),
Annotatable::Stmt(stmt) if let ast::StmtKind::Item(iitem) = &stmt.kind => {
Some((&iitem.kind, &iitem.vis))
}
_ => None,
};

if let Some((item_kind, visibility)) = fn_item_kind_and_vis
&& let ast::ItemKind::Fn(kind) = item_kind
{
Some((
visibility.clone(),
kind.sig.clone(),
kind.ident,
kind.generics.clone(),
kind.body.clone(),
))
} else {
None
}
}

Expand Down Expand Up @@ -68,7 +80,7 @@ pub(crate) fn expand_kernel(
let dcx = ecx.sess.dcx();

let Some((vis, sig, ident, generics, body)) = extract_fn(&item) else {
dcx.emit_err(diagnostics::AutoDiffInvalidApplication { span: item.span() });
dcx.emit_err(diagnostics::OffloadKernelInvalidApplication { span: item.span() });
return vec![item];
};

Expand Down Expand Up @@ -100,10 +112,19 @@ pub(crate) fn expand_kernel(
);

let device_item = {
let mut item =
let mut device_item_ecx =
ecx.item(span, thin_vec![rustc_offload_kernel.clone()], ast::ItemKind::Fn(device_fn));
item.vis = vis.clone();
Annotatable::Item(item)
device_item_ecx.vis = vis.clone();

match &item {
Annotatable::Item(_) => Annotatable::Item(device_item_ecx),
Annotatable::Stmt(_) => {
Annotatable::Stmt(Box::new(ecx.stmt_item(span, device_item_ecx)))
}
_ => {
unreachable!("item kind checked previously")
}
}
};

// unimplemented! body
Expand Down Expand Up @@ -150,13 +171,20 @@ pub(crate) fn expand_kernel(
let inline_never = outer_normal_attr(&inline_never_attr, new_id, span);

let host_item = {
let mut item = ecx.item(
let mut host_item_ecx = ecx.item(
span,
thin_vec![rustc_offload_kernel, inline_never],
ast::ItemKind::Fn(host_fn),
);
item.vis = vis;
Annotatable::Item(item)
host_item_ecx.vis = vis;

match &item {
Annotatable::Item(_) => Annotatable::Item(host_item_ecx),
Annotatable::Stmt(_) => Annotatable::Stmt(Box::new(ecx.stmt_item(span, host_item_ecx))),
_ => {
unreachable!("item kind checked previously")
}
}
};

if compile_for_device(ecx) { vec![device_item] } else { vec![host_item] }
Expand Down
27 changes: 0 additions & 27 deletions compiler/rustc_data_structures/src/binary_search_util/mod.rs

This file was deleted.

23 changes: 0 additions & 23 deletions compiler/rustc_data_structures/src/binary_search_util/tests.rs

This file was deleted.

12 changes: 10 additions & 2 deletions compiler/rustc_data_structures/src/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use std::hash::{Hash, Hasher};
use rustc_hashes::Hash64;
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};

use crate::stable_hash::{FromStableHash, StableHasherHash, impl_stable_traits_for_trivial_type};
use crate::stable_hash::{
FromStableHash, StableHash, StableHashCtxt, StableHasher, StableHasherHash,
};

#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -165,7 +167,13 @@ impl FromStableHash for Fingerprint {
}
}

impl_stable_traits_for_trivial_type!(Fingerprint);
impl StableHash for Fingerprint {
fn stable_hash<Hcx: StableHashCtxt>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
let &Fingerprint(a, b) = self;
a.stable_hash(hcx, hasher);
b.stable_hash(hcx, hasher);
}
}

impl<E: Encoder> Encodable<E> for Fingerprint {
#[inline]
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)]
#![cfg_attr(bootstrap, feature(ptr_alignment_type))]
#![cfg_attr(bootstrap, feature(unwrap_infallible))]
#![cfg_attr(test, feature(test))]
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(allocator_ext)]
Expand Down Expand Up @@ -53,7 +52,6 @@ pub use rustc_index::static_assert_size;
pub use {either, indexmap, smallvec, thin_vec};
pub mod aligned;
pub mod base_n;
pub mod binary_search_util;
pub mod fingerprint;
pub mod flat_map_in_place;
pub mod flock;
Expand Down
Loading
Loading