Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
79b30d6
thread, grid, and block dim/idx can only return non-negative values
ZuseZ4 Dec 9, 2025
69c7a7e
Use a generic type to implement SIMD types in `core_arch::simd`
eduardosm Jan 1, 2026
dab5532
x86: avoid using `transmute` in some tests
eduardosm Jan 1, 2026
68701ff
arm_shared: avoid using `transmute` and `unsafe fn` in tests
eduardosm Jan 1, 2026
f9e6d4b
Merge pull request #1987 from eduardosm/generic-simd-type-avoid-unsaf…
sayantn Jan 5, 2026
d0204a3
remove `impl Neg` on s390x/powerpc vector types
folkertdev Jan 11, 2026
78952f6
Mark the neon intrinsics as inline(always).
JamieCunliffe Dec 9, 2025
5bf9ca7
stabilize `__jscvt`
folkertdev Jan 13, 2026
aaf31e7
Merge pull request #1973 from ZuseZ4/u32-threadidx
sayantn Jan 17, 2026
0d802f5
Merge pull request #1992 from folkertdev/remove-impl-neg
sayantn Jan 17, 2026
d251a38
Merge pull request #1974 from JamieCunliffe/inline-always-neon
sayantn Jan 20, 2026
bf7c1c2
test `vmulh_lane_f16` in intrinsic test
folkertdev Jan 21, 2026
b1ef655
use `simd_extract_dyn` for `extract`
folkertdev Jan 21, 2026
5829f21
Merge pull request #1997 from folkertdev/use-extract-dyn
sayantn Jan 22, 2026
cf08a11
s390x: add `nnp-assist` intrinsics
folkertdev Jan 17, 2026
84fc953
Merge pull request #1996 from folkertdev/s390x-nnp-assist
folkertdev Jan 22, 2026
5ec32b5
Merge pull request #1998 from folkertdev/test-vmulh_lane_f16
Amanieu Jan 22, 2026
464b309
Merge pull request #1993 from folkertdev/stabilize-jscvt
folkertdev Jan 24, 2026
a4f92e5
Prepare for merging from rust-lang/rust
invalid-email-address Jan 26, 2026
7168e5d
Merge ref '873d4682c7d2' from rust-lang/rust
invalid-email-address Jan 26, 2026
246399c
use `simd_splat`
folkertdev Jan 26, 2026
a45071b
Merge pull request #2002 from rust-lang/rustc-pull
folkertdev Jan 26, 2026
bf1c3f6
move `Types` from `with_api!` to `Server`
cyrgani Jan 26, 2026
5fef797
inline `Writer` and `Reader` type aliases
cyrgani Jan 26, 2026
f8d05b6
flatten the `api_tags` module
cyrgani Jan 26, 2026
d5328c5
introduce `MarkedX` type aliases
cyrgani Jan 26, 2026
356107e
remove some unneeded impls
cyrgani Jan 26, 2026
6e7a87c
merge `Mark` and `Unmark` traits
cyrgani Jan 26, 2026
0ef4c3a
use `simd_splat` for the `set1` functions
folkertdev Jan 26, 2026
f648ba2
Merge pull request #2003 from folkertdev/use-simd-splat
folkertdev Jan 26, 2026
fdad66a
enable `target_feature_inline_always` in `core` and `std`
folkertdev Jan 26, 2026
814d902
std: move time implementations to `sys` (preparation)
joboet Jan 15, 2026
29b16c0
std: move time implementations to `sys` (small platforms)
joboet Jan 15, 2026
5978e19
std: move time implementations to `sys` (VEX)
joboet Jan 15, 2026
bd754c7
std: move time implementations to `sys` (Solid)
joboet Jan 15, 2026
963f602
std: move time implementations to `sys` (UEFI)
joboet Jan 15, 2026
6cb343b
std: move time implementations to `sys` (Windows)
joboet Jan 15, 2026
05bbfa2
std: move time implementations to `sys` (UNIX)
joboet Jan 15, 2026
eec058e
std: move time implementations to `sys` (WASI/TEEOS)
joboet Jan 15, 2026
fe51f9d
std: move time implementations to `sys` (Hermit)
joboet Jan 15, 2026
5a98a51
hardcode some Windows constants in miri
joboet Jan 16, 2026
4039cef
Don't evaluate const blocks in constant promotion
dianne Dec 31, 2025
80102f3
Rollup merge of #151161 - joboet:move-pal-time, r=tgross35
JonathanBrouwer Jan 27, 2026
84bb764
Rollup merge of #151694 - cyrgani:more-pm-cleanup, r=petrochenkov
JonathanBrouwer Jan 27, 2026
7d11720
Rollup merge of #151711 - folkertdev:stdarch-sync-2026-01-26, r=folke…
JonathanBrouwer Jan 27, 2026
53fb684
Rollup merge of #150557 - dianne:no-const-block-eval-in-promotion, r=…
JonathanBrouwer Jan 27, 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
4 changes: 1 addition & 3 deletions compiler/rustc_expand/src/proc_macro_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,11 @@ impl<'a, 'b> Rustc<'a, 'b> {
}
}

impl server::Types for Rustc<'_, '_> {
impl server::Server for Rustc<'_, '_> {
type TokenStream = TokenStream;
type Span = Span;
type Symbol = Symbol;
}

impl server::Server for Rustc<'_, '_> {
fn globals(&mut self) -> ExpnGlobals<Self::Span> {
ExpnGlobals {
def_site: self.def_site,
Expand Down
39 changes: 35 additions & 4 deletions compiler/rustc_mir_transform/src/promote_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use rustc_const_eval::check_consts::{ConstCx, qualifs};
use rustc_data_structures::assert_matches;
use rustc_data_structures::fx::FxHashSet;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_index::{IndexSlice, IndexVec};
use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor};
use rustc_middle::mir::*;
Expand Down Expand Up @@ -329,6 +330,7 @@ impl<'tcx> Validator<'_, 'tcx> {
if let TempState::Defined { location: loc, .. } = self.temps[local]
&& let Left(statement) = self.body.stmt_at(loc)
&& let Some((_, Rvalue::Use(Operand::Constant(c)))) = statement.kind.as_assign()
&& self.should_evaluate_for_promotion_checks(c.const_)
&& let Some(idx) = c.const_.try_eval_target_usize(self.tcx, self.typing_env)
// Determine the type of the thing we are indexing.
&& let ty::Array(_, len) = place_base.ty(self.body, self.tcx).ty.kind()
Expand Down Expand Up @@ -484,7 +486,9 @@ impl<'tcx> Validator<'_, 'tcx> {
let sz = lhs_ty.primitive_size(self.tcx);
// Integer division: the RHS must be a non-zero const.
let rhs_val = match rhs {
Operand::Constant(c) => {
Operand::Constant(c)
if self.should_evaluate_for_promotion_checks(c.const_) =>
{
c.const_.try_eval_scalar_int(self.tcx, self.typing_env)
}
_ => None,
Expand All @@ -502,9 +506,14 @@ impl<'tcx> Validator<'_, 'tcx> {
// The RHS is -1 or unknown, so we have to be careful.
// But is the LHS int::MIN?
let lhs_val = match lhs {
Operand::Constant(c) => c
.const_
.try_eval_scalar_int(self.tcx, self.typing_env),
Operand::Constant(c)
if self.should_evaluate_for_promotion_checks(
c.const_,
) =>
{
c.const_
.try_eval_scalar_int(self.tcx, self.typing_env)
}
_ => None,
};
let lhs_min = sz.signed_int_min();
Expand Down Expand Up @@ -683,6 +692,28 @@ impl<'tcx> Validator<'_, 'tcx> {
// This passed all checks, so let's accept.
Ok(())
}

/// Can we try to evaluate a given constant at this point in compilation? Attempting to evaluate
/// a const block before borrow-checking will result in a query cycle (#150464).
fn should_evaluate_for_promotion_checks(&self, constant: Const<'tcx>) -> bool {
match constant {
// `Const::Ty` is always a `ConstKind::Param` right now and that can never be turned
// into a mir value for promotion
// FIXME(mgca): do we want uses of type_const to be normalized during promotion?
Const::Ty(..) => false,
Const::Val(..) => true,
// Evaluating a MIR constant requires borrow-checking it. For inline consts, as of
// #138499, this means borrow-checking its typeck root. Since borrow-checking the
// typeck root requires promoting its constants, trying to evaluate an inline const here
// will result in a query cycle. To avoid the cycle, we can't evaluate const blocks yet.
// Other kinds of unevaluated's can cause query cycles too when they arise from
// self-reference in user code; e.g. evaluating a constant can require evaluating a
// const function that uses that constant, again requiring evaluation of the constant.
// However, this form of cycle renders both the constant and function unusable in
// general, so we don't need to special-case it here.
Const::Unevaluated(uc, _) => self.tcx.def_kind(uc.def) != DefKind::InlineConst,
}
}
}

fn validate_candidates(
Expand Down
1 change: 1 addition & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
#![feature(staged_api)]
#![feature(stmt_expr_attributes)]
#![feature(strict_provenance_lints)]
#![feature(target_feature_inline_always)]
#![feature(trait_alias)]
#![feature(transparent_unions)]
#![feature(try_blocks)]
Expand Down
25 changes: 8 additions & 17 deletions library/proc_macro/src/bridge/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ impl Drop for TokenStream {
}

impl<S> Encode<S> for TokenStream {
fn encode(self, w: &mut Writer, s: &mut S) {
fn encode(self, w: &mut Buffer, s: &mut S) {
mem::ManuallyDrop::new(self).handle.encode(w, s);
}
}

impl<S> Encode<S> for &TokenStream {
fn encode(self, w: &mut Writer, s: &mut S) {
fn encode(self, w: &mut Buffer, s: &mut S) {
self.handle.encode(w, s);
}
}

impl<S> Decode<'_, '_, S> for TokenStream {
fn decode(r: &mut Reader<'_>, s: &mut S) -> Self {
fn decode(r: &mut &[u8], s: &mut S) -> Self {
TokenStream { handle: handle::Handle::decode(r, s) }
}
}
Expand All @@ -56,23 +56,17 @@ impl !Send for Span {}
impl !Sync for Span {}

impl<S> Encode<S> for Span {
fn encode(self, w: &mut Writer, s: &mut S) {
fn encode(self, w: &mut Buffer, s: &mut S) {
self.handle.encode(w, s);
}
}

impl<S> Decode<'_, '_, S> for Span {
fn decode(r: &mut Reader<'_>, s: &mut S) -> Self {
fn decode(r: &mut &[u8], s: &mut S) -> Self {
Span { handle: handle::Handle::decode(r, s) }
}
}

// FIXME(eddyb) generate these impls by pattern-matching on the
// names of methods - also could use the presence of `fn drop`
// to distinguish between 'owned and 'interned, above.
// Alternatively, special "modes" could be listed of types in with_api
// instead of pattern matching on methods, here and in server decl.

impl Clone for TokenStream {
fn clone(&self) -> Self {
Methods::ts_clone(self)
Expand Down Expand Up @@ -104,18 +98,15 @@ pub(crate) use super::symbol::Symbol;

macro_rules! define_client_side {
(
Methods {
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)*;)*
},
$($name:ident),* $(,)?
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)*;)*
) => {
impl Methods {
$(pub(crate) fn $method($($arg: $arg_ty),*) $(-> $ret_ty)? {
Bridge::with(|bridge| {
let mut buf = bridge.cached_buffer.take();

buf.clear();
api_tags::Method::$method.encode(&mut buf, &mut ());
ApiTags::$method.encode(&mut buf, &mut ());
$($arg.encode(&mut buf, &mut ());)*

buf = bridge.dispatch.call(buf);
Expand All @@ -130,7 +121,7 @@ macro_rules! define_client_side {
}
}
}
with_api!(self, self, define_client_side);
with_api!(self, define_client_side);

struct Bridge<'a> {
/// Reusable buffer (only `clear`-ed, never shrunk), primarily
Expand Down
Loading
Loading