Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
65c1722
add CSE optimization tests for iterating over slice
is57primenumber Dec 16, 2025
eb101b1
Fix(lib/win/thread): Ensure `Sleep`'s usage passes over the requested…
PaulDance Dec 18, 2025
bc0cce1
ptr_aligment_type: add more APIs
GrigorenkoPV Nov 9, 2025
76438f0
Add codegen test for issue 138497
jamie-osec Aug 14, 2025
fdc7cfd
x86 soft-float feature: mark it as forbidden rather than unstable
RalfJung Jan 18, 2026
bed40af
std: avoid tearing `dbg!` prints
joboet Dec 10, 2025
f80c137
update `dbg!` clippy lint
joboet Dec 12, 2025
ee24f22
update UI tests
joboet Dec 13, 2025
764ac2b
relnotes: fix 1.93's `as_mut_array` methods
cuviper Jan 23, 2026
4b25ccd
Rename `DepKindStruct` to `DepKindVTable`
Zalathar Jan 24, 2026
23e5b69
Use rustc_proc_macro in rust-analyzer-proc-macro-srv
bjorn3 Jan 22, 2026
eec5320
Disable proc-macro-srv tests on stage 0
bjorn3 Jan 24, 2026
ef819e4
Remove a couple of unnecessary impls
bjorn3 Oct 3, 2025
dabae7e
Handle FreeFunctions outside with_api_handle_types
bjorn3 Oct 3, 2025
4dc28c5
Expand with_api_handle_types
bjorn3 Oct 3, 2025
2f44019
Move all bridge methods into a single type
bjorn3 Jan 22, 2026
9481890
Various simplifications after moving all bridge methods to a single type
bjorn3 Jan 22, 2026
8a119c3
Merge FreeFunctions trait into Server trait
bjorn3 Jan 22, 2026
d9ec1ae
Get rid of MarkedTypes
bjorn3 Oct 3, 2025
e8c48c6
Fix review comments
bjorn3 Jan 23, 2026
a06fdc1
Fix 'the the' typo in library/core/src/array/iter.rs
vinDelphini Jan 24, 2026
b651be2
Rollup merge of #145393 - clubby789:issue-138497, r=Mark-Simulacrum
matthiaskrgr Jan 25, 2026
2da5959
Rollup merge of #148764 - GrigorenkoPV:aligment_api, r=scottmcm
matthiaskrgr Jan 25, 2026
cc666ba
Rollup merge of #149869 - joboet:torn-dbg, r=Mark-Simulacrum
matthiaskrgr Jan 25, 2026
9dffb21
Rollup merge of #150065 - is57primenumber:add-slice-cse-test, r=Mark-…
matthiaskrgr Jan 25, 2026
3850473
Rollup merge of #150842 - PaulDance:patches/fix-win7-sleep, r=Mark-Si…
matthiaskrgr Jan 25, 2026
996992e
Rollup merge of #151505 - bjorn3:proc_macro_refactors, r=petrochenkov…
matthiaskrgr Jan 25, 2026
93d5b4f
Rollup merge of #151560 - cuviper:relnotes-as_mut_array, r=Mark-Simul…
matthiaskrgr Jan 25, 2026
17ba7f2
Rollup merge of #151317 - RalfJung:x86-soft-float, r=workingjubilee
matthiaskrgr Jan 25, 2026
119eea2
Rollup merge of #151577 - Zalathar:dep-kind-vtable, r=Kivooeo
matthiaskrgr Jan 25, 2026
d83f2eb
Rollup merge of #151620 - vinDelphini:fix-typo-library-core, r=joboet
matthiaskrgr Jan 25, 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: 2 additions & 2 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ Stabilized APIs
- [`<uN>::unchecked_shl`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shl)
- [`<uN>::unchecked_shr`](https://doc.rust-lang.org/stable/std/primitive.usize.html#method.unchecked_shr)
- [`<[T]>::as_array`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_array)
- [`<[T]>::as_array_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_mut_array)
- [`<[T]>::as_mut_array`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.as_mut_array)
- [`<*const [T]>::as_array`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_array)
- [`<*mut [T]>::as_array_mut`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_array)
- [`<*mut [T]>::as_mut_array`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_array)
- [`VecDeque::pop_front_if`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_front_if)
- [`VecDeque::pop_back_if`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.pop_back_if)
- [`Duration::from_nanos_u128`](https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.from_nanos_u128)
Expand Down
103 changes: 50 additions & 53 deletions compiler/rustc_expand/src/proc_macro_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,6 @@ impl ToInternal<rustc_errors::Level> for Level {
}
}

pub(crate) struct FreeFunctions;

pub(crate) struct Rustc<'a, 'b> {
ecx: &'a mut ExtCtxt<'b>,
def_site: Span,
Expand Down Expand Up @@ -461,13 +459,28 @@ impl<'a, 'b> Rustc<'a, 'b> {
}

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

impl server::FreeFunctions for Rustc<'_, '_> {
impl server::Server for Rustc<'_, '_> {
fn globals(&mut self) -> ExpnGlobals<Self::Span> {
ExpnGlobals {
def_site: self.def_site,
call_site: self.call_site,
mixed_site: self.mixed_site,
}
}

fn intern_symbol(string: &str) -> Self::Symbol {
Symbol::intern(string)
}

fn with_symbol_string(symbol: &Self::Symbol, f: impl FnOnce(&str)) {
f(symbol.as_str())
}

fn injected_env_var(&mut self, var: &str) -> Option<String> {
self.ecx.sess.opts.logical_env.get(var).cloned()
}
Expand Down Expand Up @@ -552,14 +565,20 @@ impl server::FreeFunctions for Rustc<'_, '_> {
}
diag.emit();
}
}

impl server::TokenStream for Rustc<'_, '_> {
fn is_empty(&mut self, stream: &Self::TokenStream) -> bool {
fn ts_drop(&mut self, stream: Self::TokenStream) {
drop(stream);
}

fn ts_clone(&mut self, stream: &Self::TokenStream) -> Self::TokenStream {
stream.clone()
}

fn ts_is_empty(&mut self, stream: &Self::TokenStream) -> bool {
stream.is_empty()
}

fn from_str(&mut self, src: &str) -> Self::TokenStream {
fn ts_from_str(&mut self, src: &str) -> Self::TokenStream {
unwrap_or_emit_fatal(source_str_to_stream(
self.psess(),
FileName::proc_macro_source_code(src),
Expand All @@ -568,11 +587,11 @@ impl server::TokenStream for Rustc<'_, '_> {
))
}

fn to_string(&mut self, stream: &Self::TokenStream) -> String {
fn ts_to_string(&mut self, stream: &Self::TokenStream) -> String {
pprust::tts_to_string(stream)
}

fn expand_expr(&mut self, stream: &Self::TokenStream) -> Result<Self::TokenStream, ()> {
fn ts_expand_expr(&mut self, stream: &Self::TokenStream) -> Result<Self::TokenStream, ()> {
// Parse the expression from our tokenstream.
let expr: PResult<'_, _> = try {
let mut p = Parser::new(self.psess(), stream.clone(), Some("proc_macro expand expr"));
Expand Down Expand Up @@ -633,14 +652,14 @@ impl server::TokenStream for Rustc<'_, '_> {
}
}

fn from_token_tree(
fn ts_from_token_tree(
&mut self,
tree: TokenTree<Self::TokenStream, Self::Span, Self::Symbol>,
) -> Self::TokenStream {
Self::TokenStream::new((tree, &mut *self).to_internal().into_iter().collect::<Vec<_>>())
}

fn concat_trees(
fn ts_concat_trees(
&mut self,
base: Option<Self::TokenStream>,
trees: Vec<TokenTree<Self::TokenStream, Self::Span, Self::Symbol>>,
Expand All @@ -654,7 +673,7 @@ impl server::TokenStream for Rustc<'_, '_> {
stream
}

fn concat_streams(
fn ts_concat_streams(
&mut self,
base: Option<Self::TokenStream>,
streams: Vec<Self::TokenStream>,
Expand All @@ -666,24 +685,22 @@ impl server::TokenStream for Rustc<'_, '_> {
stream
}

fn into_trees(
fn ts_into_trees(
&mut self,
stream: Self::TokenStream,
) -> Vec<TokenTree<Self::TokenStream, Self::Span, Self::Symbol>> {
FromInternal::from_internal((stream, self))
}
}

impl server::Span for Rustc<'_, '_> {
fn debug(&mut self, span: Self::Span) -> String {
fn span_debug(&mut self, span: Self::Span) -> String {
if self.ecx.ecfg.span_debug {
format!("{span:?}")
} else {
format!("{:?} bytes({}..{})", span.ctxt(), span.lo().0, span.hi().0)
}
}

fn file(&mut self, span: Self::Span) -> String {
fn span_file(&mut self, span: Self::Span) -> String {
self.psess()
.source_map()
.lookup_char_pos(span.lo())
Expand All @@ -693,7 +710,7 @@ impl server::Span for Rustc<'_, '_> {
.to_string()
}

fn local_file(&mut self, span: Self::Span) -> Option<String> {
fn span_local_file(&mut self, span: Self::Span) -> Option<String> {
self.psess()
.source_map()
.lookup_char_pos(span.lo())
Expand All @@ -708,41 +725,41 @@ impl server::Span for Rustc<'_, '_> {
})
}

fn parent(&mut self, span: Self::Span) -> Option<Self::Span> {
fn span_parent(&mut self, span: Self::Span) -> Option<Self::Span> {
span.parent_callsite()
}

fn source(&mut self, span: Self::Span) -> Self::Span {
fn span_source(&mut self, span: Self::Span) -> Self::Span {
span.source_callsite()
}

fn byte_range(&mut self, span: Self::Span) -> Range<usize> {
fn span_byte_range(&mut self, span: Self::Span) -> Range<usize> {
let source_map = self.psess().source_map();

let relative_start_pos = source_map.lookup_byte_offset(span.lo()).pos;
let relative_end_pos = source_map.lookup_byte_offset(span.hi()).pos;

Range { start: relative_start_pos.0 as usize, end: relative_end_pos.0 as usize }
}
fn start(&mut self, span: Self::Span) -> Self::Span {
fn span_start(&mut self, span: Self::Span) -> Self::Span {
span.shrink_to_lo()
}

fn end(&mut self, span: Self::Span) -> Self::Span {
fn span_end(&mut self, span: Self::Span) -> Self::Span {
span.shrink_to_hi()
}

fn line(&mut self, span: Self::Span) -> usize {
fn span_line(&mut self, span: Self::Span) -> usize {
let loc = self.psess().source_map().lookup_char_pos(span.lo());
loc.line
}

fn column(&mut self, span: Self::Span) -> usize {
fn span_column(&mut self, span: Self::Span) -> usize {
let loc = self.psess().source_map().lookup_char_pos(span.lo());
loc.col.to_usize() + 1
}

fn join(&mut self, first: Self::Span, second: Self::Span) -> Option<Self::Span> {
fn span_join(&mut self, first: Self::Span, second: Self::Span) -> Option<Self::Span> {
let self_loc = self.psess().source_map().lookup_char_pos(first.lo());
let other_loc = self.psess().source_map().lookup_char_pos(second.lo());

Expand All @@ -753,7 +770,7 @@ impl server::Span for Rustc<'_, '_> {
Some(first.to(second))
}

fn subspan(
fn span_subspan(
&mut self,
span: Self::Span,
start: Bound<usize>,
Expand Down Expand Up @@ -789,11 +806,11 @@ impl server::Span for Rustc<'_, '_> {
Some(span.with_lo(new_lo).with_hi(new_hi))
}

fn resolved_at(&mut self, span: Self::Span, at: Self::Span) -> Self::Span {
fn span_resolved_at(&mut self, span: Self::Span, at: Self::Span) -> Self::Span {
span.with_ctxt(at.ctxt())
}

fn source_text(&mut self, span: Self::Span) -> Option<String> {
fn span_source_text(&mut self, span: Self::Span) -> Option<String> {
self.psess().source_map().span_to_snippet(span).ok()
}

Expand Down Expand Up @@ -821,41 +838,21 @@ impl server::Span for Rustc<'_, '_> {
/// span from the metadata of `my_proc_macro` (which we have access to,
/// since we've loaded `my_proc_macro` from disk in order to execute it).
/// In this way, we have obtained a span pointing into `my_proc_macro`
fn save_span(&mut self, span: Self::Span) -> usize {
fn span_save_span(&mut self, span: Self::Span) -> usize {
self.psess().save_proc_macro_span(span)
}

fn recover_proc_macro_span(&mut self, id: usize) -> Self::Span {
fn span_recover_proc_macro_span(&mut self, id: usize) -> Self::Span {
let (resolver, krate, def_site) = (&*self.ecx.resolver, self.krate, self.def_site);
*self.rebased_spans.entry(id).or_insert_with(|| {
// FIXME: `SyntaxContext` for spans from proc macro crates is lost during encoding,
// replace it with a def-site context until we are encoding it properly.
resolver.get_proc_macro_quoted_span(krate, id).with_ctxt(def_site.ctxt())
})
}
}

impl server::Symbol for Rustc<'_, '_> {
fn normalize_and_validate_ident(&mut self, string: &str) -> Result<Self::Symbol, ()> {
fn symbol_normalize_and_validate_ident(&mut self, string: &str) -> Result<Self::Symbol, ()> {
let sym = nfc_normalize(string);
if rustc_lexer::is_ident(sym.as_str()) { Ok(sym) } else { Err(()) }
}
}

impl server::Server for Rustc<'_, '_> {
fn globals(&mut self) -> ExpnGlobals<Self::Span> {
ExpnGlobals {
def_site: self.def_site,
call_site: self.call_site,
mixed_site: self.mixed_site,
}
}

fn intern_symbol(string: &str) -> Self::Symbol {
Symbol::intern(string)
}

fn with_symbol_string(symbol: &Self::Symbol, f: impl FnOnce(&str)) {
f(symbol.as_str())
}
}
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn def_id_debug(def_id: rustc_hir::def_id::DefId, f: &mut fmt::Formatter<'_>) ->
pub fn dep_kind_debug(kind: DepKind, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
tls::with_opt(|opt_tcx| {
if let Some(tcx) = opt_tcx {
write!(f, "{}", tcx.dep_kind_info(kind).name)
write!(f, "{}", tcx.dep_kind_vtable(kind).name)
} else {
default_dep_kind_debug(kind, f)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>(
hir_arena,
untracked,
dep_graph,
rustc_query_impl::query_callbacks(arena),
rustc_query_impl::make_dep_kind_vtables(arena),
rustc_query_impl::query_system(
providers.queries,
providers.extern_queries,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ macro_rules! arena_types {
[decode] is_late_bound_map: rustc_data_structures::fx::FxIndexSet<rustc_hir::ItemLocalId>,
[decode] impl_source: rustc_middle::traits::ImplSource<'tcx, ()>,

[] dep_kind: rustc_middle::dep_graph::DepKindStruct<'tcx>,
[] dep_kind_vtable: rustc_middle::dep_graph::DepKindVTable<'tcx>,

[decode] trait_impl_trait_tys:
rustc_data_structures::unord::UnordMap<
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/dep_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub use rustc_query_system::dep_graph::{

pub type DepGraph = rustc_query_system::dep_graph::DepGraph<DepsType>;

pub type DepKindStruct<'tcx> = rustc_query_system::dep_graph::DepKindStruct<TyCtxt<'tcx>>;
pub type DepKindVTable<'tcx> = rustc_query_system::dep_graph::DepKindVTable<TyCtxt<'tcx>>;

pub struct DepsType;

Expand Down Expand Up @@ -79,8 +79,8 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
}

#[inline]
fn dep_kind_info(&self, dk: DepKind) -> &DepKindStruct<'tcx> {
&self.query_kinds[dk.as_usize()]
fn dep_kind_vtable(&self, dk: DepKind) -> &DepKindVTable<'tcx> {
&self.dep_kind_vtables[dk.as_usize()]
}

fn with_reduced_queries<T>(self, f: impl FnOnce() -> T) -> T {
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ use rustc_type_ir::{
use tracing::{debug, instrument};

use crate::arena::Arena;
use crate::dep_graph::{DepGraph, DepKindStruct};
use crate::dep_graph::{DepGraph, DepKindVTable};
use crate::infer::canonical::{CanonicalParamEnvCache, CanonicalVarKind, CanonicalVarKinds};
use crate::lint::lint_level;
use crate::metadata::ModChild;
Expand Down Expand Up @@ -1580,7 +1580,7 @@ pub struct GlobalCtxt<'tcx> {
untracked: Untracked,

pub query_system: QuerySystem<'tcx>,
pub(crate) query_kinds: &'tcx [DepKindStruct<'tcx>],
pub(crate) dep_kind_vtables: &'tcx [DepKindVTable<'tcx>],

// Internal caches for metadata decoding. No need to track deps on this.
pub ty_rcache: Lock<FxHashMap<ty::CReaderCacheKey, Ty<'tcx>>>,
Expand Down Expand Up @@ -1801,7 +1801,7 @@ impl<'tcx> TyCtxt<'tcx> {
hir_arena: &'tcx WorkerLocal<hir::Arena<'tcx>>,
untracked: Untracked,
dep_graph: DepGraph,
query_kinds: &'tcx [DepKindStruct<'tcx>],
dep_kind_vtables: &'tcx [DepKindVTable<'tcx>],
query_system: QuerySystem<'tcx>,
hooks: crate::hooks::Providers,
current_gcx: CurrentGcx,
Expand Down Expand Up @@ -1831,7 +1831,7 @@ impl<'tcx> TyCtxt<'tcx> {
consts: common_consts,
untracked,
query_system,
query_kinds,
dep_kind_vtables,
ty_rcache: Default::default(),
selection_cache: Default::default(),
evaluation_cache: Default::default(),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_query_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use rustc_data_structures::stable_hasher::HashStable;
use rustc_data_structures::sync::AtomicU64;
use rustc_middle::arena::Arena;
use rustc_middle::dep_graph::{self, DepKind, DepKindStruct, DepNodeIndex};
use rustc_middle::dep_graph::{self, DepKind, DepKindVTable, DepNodeIndex};
use rustc_middle::query::erase::{Erase, erase, restore};
use rustc_middle::query::on_disk_cache::{CacheEncoder, EncodedDepNodeIndex, OnDiskCache};
use rustc_middle::query::plumbing::{DynamicQuery, QuerySystem, QuerySystemFns};
Expand Down
Loading
Loading