Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f0fd6f7
cleanup long shuffle mask literals
folkertdev Feb 18, 2026
c0c9d02
use `intrinsics::simd` for interleaving store
folkertdev Feb 18, 2026
e219383
use `intrinsics::simd` for interleaving store of `int64x1`
folkertdev Feb 18, 2026
afb890e
use `intrinsics::simd` for interleaving store of f16
folkertdev Feb 18, 2026
2b656f9
use `intrinsics::simd` for aarch64 interleaving `st`
folkertdev Feb 18, 2026
2b5ca1c
Merge pull request #2031 from folkertdev/cleanup-shuffle-masks
Amanieu Feb 18, 2026
a5ba794
x86: use `simd::intrinsics` for saturating packs
okaneco Feb 19, 2026
6fa33be
Use intrinsics for `sse41`
okaneco Feb 19, 2026
639b07e
Use intrinsics for `avx2`
okaneco Feb 19, 2026
c7ecbd5
Use intrinsics for `avx512bw`
okaneco Feb 19, 2026
1dc3d8c
Merge pull request #2033 from okaneco/saturating_packs
folkertdev Feb 19, 2026
22d10c5
x86: Followup to add const for pack intrinsics
okaneco Feb 20, 2026
17a4c8e
Add const to `sse41` intrinsics
okaneco Feb 20, 2026
4f881c4
Add const to `avx2` intrinsics
okaneco Feb 20, 2026
37bd99e
Add const to `avx512bw` intrinsics
okaneco Feb 20, 2026
ff558be
Merge pull request #2032 from folkertdev/interleaving-store
Amanieu Feb 21, 2026
47ef7f7
aarch64: cleanup of some long array literals
folkertdev Feb 23, 2026
ccc6e96
Merge pull request #2037 from folkertdev/lane-literal-cleanup
Amanieu Feb 23, 2026
f4cc7ee
Merge pull request #2035 from okaneco/const_packs
sayantn Feb 24, 2026
820ca48
Update Intel SDE version to 10.5
sayantn Feb 24, 2026
c66d49f
Merge pull request #2038 from sayantn/sde-update
folkertdev Feb 24, 2026
f01bcce
update to `resolver = 3`
folkertdev Feb 25, 2026
cb3046e
Add missing runtime test for _mm_comige_ss and fix _mm_comigt_ss test
ArunTamil21 Feb 25, 2026
bbdc754
Merge pull request #2039 from folkertdev/update-resolver
sayantn Feb 26, 2026
f981ffe
Remove _mm_comige_ss from skip list in x86-intel.rs
ArunTamil21 Feb 26, 2026
2fa37e7
aarch64: fix UB in non-power-of-two reads and writes
folkertdev Feb 26, 2026
d06233d
Merge pull request #2040 from ArunTamil21/add-test-mm-comige-ss
sayantn Feb 26, 2026
e00790e
Merge pull request #2042 from folkertdev/aarch64-non-power-of-two-rea…
sayantn Feb 27, 2026
a0ccef6
Add `impl_restriction` feature
CoCo-Japan-pan Feb 23, 2026
3232d99
Introduce `impl` restriction to AST
CoCo-Japan-pan Feb 23, 2026
f55f6b4
Parse `impl` restriction on trait definitions
CoCo-Japan-pan Feb 23, 2026
2b39bea
Handle ambiguity between `const unsafe fn` and `const unsafe impl(pat…
CoCo-Japan-pan Feb 23, 2026
65aef77
Pretty print `impl` restriction
CoCo-Japan-pan Feb 23, 2026
2a48c19
Discard `impl` restrictions during HIR lowering for now
CoCo-Japan-pan Feb 23, 2026
9bf2494
Add `eq_impl_restriction` to clippy_utils
CoCo-Japan-pan Feb 23, 2026
f40881d
rustfmt `impl` restriction
CoCo-Japan-pan Feb 23, 2026
26d4291
Add ui tests
CoCo-Japan-pan Feb 23, 2026
3dcefa3
Trait aliases cannot be `impl`-restricted
CoCo-Japan-pan Feb 23, 2026
7b34c00
Fix typo in test name
bjorn3 Feb 27, 2026
a192c61
Use CompiledModules inside CodegenResults
bjorn3 Feb 27, 2026
5aa980e
Replace CodegenResults with CompiledModules
bjorn3 Oct 23, 2025
158ac1a
Comments and docs: add missing periods to "ie."
DanielEScherzer Mar 3, 2026
1d678f6
Update call-llvm-intrinsics test for Rust 1.94.0 IR and multi-target CI
DeepeshWR Mar 2, 2026
083b5db
Make `rustc_with_all_queries!` pass query modifiers as named values
Zalathar Mar 3, 2026
8b1ebb3
Rollup merge of #153336 - folkertdev:stdarch-sync-2026-03-03, r=folke…
JonathanBrouwer Mar 3, 2026
bef489b
Rollup merge of #152943 - CoCo-Japan-pan:impl-restriction-parse, r=Ur…
JonathanBrouwer Mar 3, 2026
ee8e2df
Rollup merge of #153184 - bjorn3:split_crate_info_out_of_codegen_resu…
JonathanBrouwer Mar 3, 2026
0ce5963
Rollup merge of #153285 - DeepeshWR:codegen-llvm-sqrt-call-1.94, r=fo…
JonathanBrouwer Mar 3, 2026
f3f0469
Rollup merge of #153319 - DanielEScherzer:ie-dots, r=jhpratt
JonathanBrouwer Mar 3, 2026
d53a01c
Rollup merge of #153326 - Zalathar:query-modifiers, r=nnethercote
JonathanBrouwer Mar 3, 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
14 changes: 14 additions & 0 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3553,6 +3553,19 @@ impl VisibilityKind {
}
}

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub struct ImplRestriction {
pub kind: RestrictionKind,
pub span: Span,
pub tokens: Option<LazyAttrTokenStream>,
}

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub enum RestrictionKind {
Unrestricted,
Restricted { path: Box<Path>, id: NodeId, shorthand: bool },
}

/// Field definition in a struct, variant or union.
///
/// E.g., `bar: usize` as in `struct Foo { bar: usize }`.
Expand Down Expand Up @@ -3752,6 +3765,7 @@ pub struct Trait {
pub constness: Const,
pub safety: Safety,
pub is_auto: IsAuto,
pub impl_restriction: ImplRestriction,
pub ident: Ident,
pub generics: Generics,
#[visitable(extra = BoundKind::SuperTraits)]
Expand Down
20 changes: 16 additions & 4 deletions compiler/rustc_ast/src/ast_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use std::marker::PhantomData;
use crate::tokenstream::LazyAttrTokenStream;
use crate::{
Arm, AssocItem, AttrItem, AttrKind, AttrVec, Attribute, Block, Crate, Expr, ExprField,
FieldDef, ForeignItem, GenericParam, Item, NodeId, Param, Pat, PatField, Path, Stmt, StmtKind,
Ty, Variant, Visibility, WherePredicate,
FieldDef, ForeignItem, GenericParam, ImplRestriction, Item, NodeId, Param, Pat, PatField, Path,
Stmt, StmtKind, Ty, Variant, Visibility, WherePredicate,
};

/// A trait for AST nodes having an ID.
Expand Down Expand Up @@ -97,7 +97,19 @@ macro_rules! impl_has_tokens_none {
};
}

impl_has_tokens!(AssocItem, AttrItem, Block, Expr, ForeignItem, Item, Pat, Path, Ty, Visibility);
impl_has_tokens!(
AssocItem,
AttrItem,
Block,
Expr,
ForeignItem,
Item,
Pat,
Path,
Ty,
Visibility,
ImplRestriction
);
impl_has_tokens_none!(
Arm,
ExprField,
Expand Down Expand Up @@ -242,7 +254,7 @@ impl_has_attrs!(
Variant,
WherePredicate,
);
impl_has_attrs_none!(Attribute, AttrItem, Block, Pat, Path, Ty, Visibility);
impl_has_attrs_none!(Attribute, AttrItem, Block, Pat, Path, Ty, Visibility, ImplRestriction);

impl<T: HasAttrs> HasAttrs for Box<T> {
const SUPPORTS_CUSTOM_INNER_ATTRS: bool = T::SUPPORTS_CUSTOM_INNER_ATTRS;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ macro_rules! common_visitor_and_walkers {
RangeEnd,
RangeSyntax,
Recovered,
RestrictionKind,
Safety,
StaticItem,
StrLit,
Expand Down Expand Up @@ -595,6 +596,7 @@ macro_rules! common_visitor_and_walkers {
fn visit_poly_trait_ref(PolyTraitRef);
fn visit_precise_capturing_arg(PreciseCapturingArg);
fn visit_qself(QSelf);
fn visit_impl_restriction(ImplRestriction);
fn visit_trait_ref(TraitRef);
fn visit_ty_pat(TyPat);
fn visit_ty(Ty);
Expand Down Expand Up @@ -1117,6 +1119,7 @@ macro_rules! common_visitor_and_walkers {
pub fn walk_poly_trait_ref(PolyTraitRef);
pub fn walk_precise_capturing_arg(PreciseCapturingArg);
pub fn walk_qself(QSelf);
pub fn walk_impl_restriction(ImplRestriction);
pub fn walk_trait_ref(TraitRef);
pub fn walk_ty_pat(TyPat);
pub fn walk_ty(Ty);
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
constness,
is_auto,
safety,
// FIXME(impl_restrictions): lower to HIR
impl_restriction: _,
ident,
generics,
bounds,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
gate_all!(coroutines, "coroutine syntax is experimental");
gate_all!(const_block_items, "const block items are experimental");
gate_all!(final_associated_functions, "`final` on trait functions is experimental");
gate_all!(impl_restriction, "`impl` restrictions are experimental");

if !visitor.features.never_patterns() {
if let Some(spans) = spans.get(&sym::never_patterns) {
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_ast_pretty/src/pprust/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ pub fn vis_to_string(v: &ast::Visibility) -> String {
State::new().vis_to_string(v)
}

pub fn impl_restriction_to_string(r: &ast::ImplRestriction) -> String {
State::new().impl_restriction_to_string(r)
}

pub fn meta_list_item_to_string(li: &ast::MetaItemInner) -> String {
State::new().meta_list_item_to_string(li)
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
Self::to_string(|s| s.print_visibility(v))
}

fn impl_restriction_to_string(&self, r: &ast::ImplRestriction) -> String {
Self::to_string(|s| s.print_impl_restriction(r))
}

fn block_to_string(&self, blk: &ast::Block) -> String {
Self::to_string(|s| {
let (cb, ib) = s.head("");
Expand Down
16 changes: 16 additions & 0 deletions compiler/rustc_ast_pretty/src/pprust/state/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ impl<'a> State<'a> {
constness,
safety,
is_auto,
impl_restriction,
ident,
generics,
bounds,
Expand All @@ -375,6 +376,7 @@ impl<'a> State<'a> {
self.print_constness(*constness);
self.print_safety(*safety);
self.print_is_auto(*is_auto);
self.print_impl_restriction(impl_restriction);
self.word_nbsp("trait");
self.print_ident(*ident);
self.print_generic_params(&generics.params);
Expand Down Expand Up @@ -483,6 +485,20 @@ impl<'a> State<'a> {
}
}

pub(crate) fn print_impl_restriction(&mut self, impl_restriction: &ast::ImplRestriction) {
match &impl_restriction.kind {
ast::RestrictionKind::Restricted { path, shorthand, .. } => {
let path = Self::to_string(|s| s.print_path(path, false, 0));
if *shorthand {
self.word_nbsp(format!("impl({path})"))
} else {
self.word_nbsp(format!("impl(in {path})"))
}
}
ast::RestrictionKind::Unrestricted => {}
}
}

fn print_defaultness(&mut self, defaultness: ast::Defaultness) {
if let ast::Defaultness::Default(_) = defaultness {
self.word_nbsp("default");
Expand Down
25 changes: 4 additions & 21 deletions compiler/rustc_codegen_cranelift/src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use std::thread::JoinHandle;

use cranelift_object::{ObjectBuilder, ObjectModule};
use rustc_codegen_ssa::assert_module_sources::CguReuse;
use rustc_codegen_ssa::back::write::{CompiledModules, produce_final_output_artifacts};
use rustc_codegen_ssa::back::write::produce_final_output_artifacts;
use rustc_codegen_ssa::base::determine_cgu_reuse;
use rustc_codegen_ssa::{CodegenResults, CompiledModule, CrateInfo, ModuleKind};
use rustc_codegen_ssa::{CompiledModule, CompiledModules, ModuleKind};
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::sync::{IntoDynSyncSend, par_map};
Expand Down Expand Up @@ -54,7 +54,6 @@ impl<HCX> HashStable<HCX> for OngoingModuleCodegen {
pub(crate) struct OngoingCodegen {
modules: Vec<OngoingModuleCodegen>,
allocator_module: Option<CompiledModule>,
crate_info: CrateInfo,
concurrency_limiter: ConcurrencyLimiter,
}

Expand All @@ -63,7 +62,7 @@ impl OngoingCodegen {
self,
sess: &Session,
outputs: &OutputFilenames,
) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>) {
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
let mut work_products = FxIndexMap::default();
let mut modules = vec![];
let disable_incr_cache = disable_incr_cache();
Expand Down Expand Up @@ -126,15 +125,7 @@ impl OngoingCodegen {

produce_final_output_artifacts(sess, &compiled_modules, outputs);

(
CodegenResults {
crate_info: self.crate_info,

modules: compiled_modules.modules,
allocator_module: compiled_modules.allocator_module,
},
work_products,
)
(compiled_modules, work_products)
}
}

Expand Down Expand Up @@ -483,13 +474,6 @@ fn emit_allocator_module(tcx: TyCtxt<'_>) -> Option<CompiledModule> {
}

pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box<OngoingCodegen> {
// FIXME handle `-Ctarget-cpu=native`
let target_cpu = match tcx.sess.opts.cg.target_cpu {
Some(ref name) => name,
None => tcx.sess.target.cpu.as_ref(),
}
.to_owned();

let cgus = tcx.collect_and_partition_mono_items(()).codegen_units;

if tcx.dep_graph.is_fully_enabled() {
Expand Down Expand Up @@ -549,7 +533,6 @@ pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box<OngoingCodegen> {
Box::new(OngoingCodegen {
modules,
allocator_module,
crate_info: CrateInfo::new(tcx, target_cpu),
concurrency_limiter: concurrency_limiter.0,
})
}
13 changes: 7 additions & 6 deletions compiler/rustc_codegen_cranelift/src/driver/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ use crate::debuginfo::TypeDebugContext;
use crate::prelude::*;
use crate::unwind_module::UnwindModule;

fn create_jit_module(tcx: TyCtxt<'_>) -> (UnwindModule<JITModule>, Option<DebugContext>) {
let crate_info = CrateInfo::new(tcx, "dummy_target_cpu".to_string());

fn create_jit_module(
tcx: TyCtxt<'_>,
crate_info: &CrateInfo,
) -> (UnwindModule<JITModule>, Option<DebugContext>) {
let isa = crate::build_isa(tcx.sess, true);
let mut jit_builder = JITBuilder::with_isa(isa, cranelift_module::default_libcall_names());
crate::compiler_builtins::register_functions_for_jit(&mut jit_builder);
jit_builder.symbol_lookup_fn(dep_symbol_lookup_fn(tcx.sess, crate_info));
jit_builder.symbol_lookup_fn(dep_symbol_lookup_fn(tcx.sess, crate_info.clone()));
let mut jit_module = UnwindModule::new(JITModule::new(jit_builder), false);

let cx = DebugContext::new(tcx, jit_module.isa(), false, "dummy_cgu_name");
Expand All @@ -32,14 +33,14 @@ fn create_jit_module(tcx: TyCtxt<'_>) -> (UnwindModule<JITModule>, Option<DebugC
(jit_module, cx)
}

pub(crate) fn run_jit(tcx: TyCtxt<'_>, jit_args: Vec<String>) -> ! {
pub(crate) fn run_jit(tcx: TyCtxt<'_>, crate_info: &CrateInfo, jit_args: Vec<String>) -> ! {
if !tcx.crate_types().contains(&rustc_session::config::CrateType::Executable) {
tcx.dcx().fatal("can't jit non-executable crate");
}

let output_filenames = tcx.output_filenames(());
let should_write_ir = crate::pretty_clif::should_write_ir(tcx.sess);
let (mut jit_module, mut debug_context) = create_jit_module(tcx);
let (mut jit_module, mut debug_context) = create_jit_module(tcx, crate_info);
let mut cached_context = Context::new();

let cgus = tcx.collect_and_partition_mono_items(()).codegen_units;
Expand Down
17 changes: 13 additions & 4 deletions compiler/rustc_codegen_cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use std::sync::Arc;
use cranelift_codegen::isa::TargetIsa;
use cranelift_codegen::settings::{self, Configurable};
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::{CodegenResults, TargetConfig};
use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig};
use rustc_log::tracing::info;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_session::Session;
Expand Down Expand Up @@ -200,12 +200,21 @@ impl CodegenBackend for CraneliftCodegenBackend {
println!("Cranelift version: {}", cranelift_codegen::VERSION);
}

fn codegen_crate(&self, tcx: TyCtxt<'_>) -> Box<dyn Any> {
fn target_cpu(&self, sess: &Session) -> String {
// FIXME handle `-Ctarget-cpu=native`
match sess.opts.cg.target_cpu {
Some(ref name) => name,
None => sess.target.cpu.as_ref(),
}
.to_owned()
}

fn codegen_crate(&self, tcx: TyCtxt<'_>, _crate_info: &CrateInfo) -> Box<dyn Any> {
info!("codegen crate {}", tcx.crate_name(LOCAL_CRATE));
let config = self.config.get().unwrap();
if config.jit_mode {
#[cfg(feature = "jit")]
driver::jit::run_jit(tcx, config.jit_args.clone());
driver::jit::run_jit(tcx, _crate_info, config.jit_args.clone());

#[cfg(not(feature = "jit"))]
tcx.dcx().fatal("jit support was disabled when compiling rustc_codegen_cranelift");
Expand All @@ -219,7 +228,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
ongoing_codegen: Box<dyn Any>,
sess: &Session,
outputs: &OutputFilenames,
) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>) {
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
ongoing_codegen.downcast::<driver::aot::OngoingCodegen>().unwrap().join(sess, outputs)
}
}
Expand Down
13 changes: 7 additions & 6 deletions compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ use rustc_codegen_ssa::back::write::{
use rustc_codegen_ssa::base::codegen_crate;
use rustc_codegen_ssa::target_features::cfg_target_feature;
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, WriteBackendMethods};
use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen, TargetConfig};
use rustc_codegen_ssa::{CompiledModule, CompiledModules, CrateInfo, ModuleCodegen, TargetConfig};
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_data_structures::sync::IntoDynSyncSend;
Expand Down Expand Up @@ -287,19 +287,20 @@ impl CodegenBackend for GccCodegenBackend {
|tcx, ()| gcc_util::global_gcc_features(tcx.sess)
}

fn codegen_crate(&self, tcx: TyCtxt<'_>) -> Box<dyn Any> {
let target_cpu = target_cpu(tcx.sess);
let res = codegen_crate(self.clone(), tcx, target_cpu.to_string());
fn target_cpu(&self, sess: &Session) -> String {
target_cpu(sess).to_owned()
}

Box::new(res)
fn codegen_crate(&self, tcx: TyCtxt<'_>, crate_info: &CrateInfo) -> Box<dyn Any> {
Box::new(codegen_crate(self.clone(), tcx, crate_info))
}

fn join_codegen(
&self,
ongoing_codegen: Box<dyn Any>,
sess: &Session,
_outputs: &OutputFilenames,
) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>) {
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
ongoing_codegen
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<GccCodegenBackend>>()
.expect("Expected GccCodegenBackend's OngoingCodegen, found Box<Any>")
Expand Down
Loading
Loading