Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
bcdc0d3
fix: do not panic when inline call param usages in macro
A4-Tacks Aug 24, 2026
21b075e
Fix NamedTempFile issues on windows
Veykril Sep 26, 2026
43ab58d
fix: compute ref-match on undotted self
A4-Tacks Oct 7, 2026
fc8acab
fix: complete 'main' 'lib' module in sub module
A4-Tacks Oct 19, 2026
20986b6
Remove the 'sub' method from 'At' and migrate to 'sub_raw'
fallible-algebra Oct 14, 2026
35e265a
minor: 'pd' snippet use `$1` instead of multi `$0`
A4-Tacks Oct 19, 2026
c74c960
Merge pull request #23530 from A4-Tacks/snip-multi-end-tabstop
ChayimFriedman2 Oct 19, 2026
d37951b
minor: add '(' to item recover, improve fn missing name
A4-Tacks Oct 20, 2026
0142543
Update macro_expansion_tests
A4-Tacks Oct 20, 2026
f7b5e44
Bump smol_str to 0.3.7
A4-Tacks Oct 20, 2026
8876aa2
Merge pull request #23532 from A4-Tacks/bump-smolstr
ChayimFriedman2 Oct 20, 2026
0798f0e
Use `publish = false` for the `toolchain` crate
Kobzol Oct 20, 2026
3607d86
Merge pull request #23535 from Kobzol/toolchain-publish-false
ChayimFriedman2 Oct 20, 2026
9ff528a
Split `T!['(']` to sub recovery set
A4-Tacks Oct 20, 2026
6ddf120
Update smolstr CHANGELOG and publish
A4-Tacks Oct 20, 2026
1babbb6
fix: emit E0029 for range patterns with inferred invalid types
jgespiga Oct 18, 2026
4f33ef3
Merge pull request #23536 from A4-Tacks/smolstr-changelog
ChayimFriedman2 Oct 20, 2026
d777135
Merge pull request #23533 from jgespiga/range-pat-type-after-inference
ChayimFriedman2 Oct 20, 2026
abf49d4
fix: use absolute path in format_smolstr
A4-Tacks Oct 21, 2026
011b1bf
Merge pull request #23540 from A4-Tacks/format-smolstr-hygiene
ShoyuVanilla Oct 21, 2026
3329bbc
Merge pull request #23231 from A4-Tacks/inline-call-ref-in-macro
ShoyuVanilla Oct 21, 2026
869e987
minor: Fix fuzz CI
ShoyuVanilla Oct 21, 2026
a21ea85
Merge pull request #23542 from ShoyuVanilla/fuzz-fix
ShoyuVanilla Oct 21, 2026
cb04287
Use a NoSpan marker for region constraints without spans
ssenthilnathan3 Oct 21, 2026
a8227a0
Use the rustc-src lockfile when fetching metadata for the rustc works…
onlycs Oct 21, 2026
568f99f
Merge pull request #23296 from onlycs/rustc-src-lockfile-ancestors
ChayimFriedman2 Oct 21, 2026
cf68311
Merge pull request #23489 from A4-Tacks/ref-match-fly-self
ChayimFriedman2 Oct 21, 2026
f802ea3
Use base_db::all_crates
A4-Tacks Oct 22, 2026
f186d48
Merge pull request #23531 from A4-Tacks/fn-mis-name-recover
A4-Tacks Oct 22, 2026
839288e
Implement an automated sync for target feature implications
TechnoPorg Oct 6, 2026
fb6b777
Merge pull request #23484 from TechnoPorg/feat/automatic-feature-sync
ChayimFriedman2 Oct 22, 2026
4abad75
Merge pull request #23529 from A4-Tacks/comp-same-root-module
ChayimFriedman2 Oct 22, 2026
fb8c23e
Fix status message for clients not supporting `experimental/serverSta…
ChayimFriedman2 Oct 22, 2026
34f80ba
Merge pull request #23424 from Veykril/lukaswirth/push-tytzvqxknnyu
ChayimFriedman2 Oct 22, 2026
be4c857
Merge pull request #23552 from ChayimFriedman2/fix-status-msg
ChayimFriedman2 Oct 22, 2026
4d60702
fix: Fix `fetch_semantic` logic bug introduced in rust-lang/rust-anal…
martinboehme Oct 20, 2026
c4a7cdf
Remove `Default` impl for `SpanData`
nnethercote Sep 25, 2026
654b502
Merge pull request #23534 from martinboehme/fix-publish-semantic-diag…
ShoyuVanilla Oct 26, 2026
adfda59
Use the updated buffer length in UEFI locate_handles
yashaggarwal85d Oct 26, 2026
60196fa
uefi: roll back env changes when `start_image` fails
Web4everyone32 Oct 26, 2026
7b5a4b3
Remove unnecessary `Span::{data,data_untracked}` calls
nnethercote Oct 1, 2026
ecf1622
ref: remove redundant vec and duplicate indexing in find_noop_landing…
panstromek Oct 25, 2026
0ca3407
thread_local::guard: update comments a bit
RalfJung Oct 26, 2026
493f336
Rollup merge of #164955 - yashaggarwal85d:fix-uefi-locate-handles-len…
JonathanBrouwer Oct 26, 2026
88a5415
Rollup merge of #164958 - Web4everyone32:uefi-env-rollback-on-spawn-f…
JonathanBrouwer Oct 26, 2026
ee76cb7
Rollup merge of #164968 - RalfJung:thread-local-guard-comments, r=joboet
JonathanBrouwer Oct 26, 2026
406d90c
Rollup merge of #164303 - fallible-algebra:at-removal/remove-sub, r=lcnr
JonathanBrouwer Oct 26, 2026
814563b
Rollup merge of #164674 - ssenthilnathan3:abby-no-span, r=khyperia
JonathanBrouwer Oct 26, 2026
c9a9ce2
Rollup merge of #164934 - panstromek:cleanup-noop-landing-pads, r=han…
JonathanBrouwer Oct 26, 2026
c91fe27
Rollup merge of #164954 - nnethercote:less-SpanData-in-various-easy, …
JonathanBrouwer Oct 26, 2026
4923cbc
Rollup merge of #164970 - lnicola:sync-from-ra, r=lnicola
JonathanBrouwer Oct 26, 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
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ pub trait Emitter {
let Some(source_map) = self.source_map() else { return };
let should_hide = |span| {
source_map.is_imported(span) || {
let expn = span.data().ctxt.outer_expn_data();
let expn = span.ctxt().outer_expn_data();
expn.diagnostic_opaque && matches!(expn.kind, ExpnKind::Macro(MacroKind::Bang, _))
}
};
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_expand/src/proc_macro_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,24 +527,24 @@ impl server::Server for Rustc<'_, '_> {
.map_err(|_| String::from("failed to parse to literal"))?
.map_err(cancel_diags_into_string)?;

let first_span = parser.token.span.data();
let (first_span_lo, first_span_hi) = parser.token.span.lo_hi();
let minus_present = parser.eat(exp!(Minus));

let lit_span = parser.token.span.data();
let (lit_span_lo, lit_span_hi) = parser.token.span.lo_hi();
let tk::Literal(mut lit) = parser.token.kind else {
return Err("not a literal".to_string());
};

// Check no comment or whitespace surrounding the (possibly negative)
// literal, or more tokens after it.
if (lit_span.hi.0 - first_span.lo.0) as usize != s.len() {
if (lit_span_hi.0 - first_span_lo.0) as usize != s.len() {
return Err("comment or whitespace around literal".to_string());
}

if minus_present {
// If minus is present, check no comment or whitespace in between it
// and the literal token.
if first_span.hi.0 != lit_span.lo.0 {
if first_span_hi.0 != lit_span_lo.0 {
return Err("comment or whitespace after minus".to_string());
}

Expand Down
60 changes: 22 additions & 38 deletions compiler/rustc_infer/src/infer/at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl<'tcx> InferCtxt<'tcx> {
/// If possible, prefer the wrapper methods on `ObligationCtxt`,
/// `FnCtxt`, or `TypeChecker`.
pub fn sub_raw<T>(
self,
&self,
cause: &ObligationCause<'tcx>,
param_env: ParamEnv<'tcx>,
define_opaque_types: DefineOpaqueTypes,
Expand All @@ -181,7 +181,20 @@ impl<'tcx> InferCtxt<'tcx> {
where
T: ToTrace<'tcx>,
{
self.at(cause, param_env).sub(define_opaque_types, expected, actual)
if self.next_trait_solver {
NextSolverRelate::relate(self, param_env, expected, ty::Covariant, actual, cause.span)
.map(|goals| self.goals_to_obligations(cause, goals))
} else {
let mut op = TypeRelating::new(
self,
ToTrace::to_trace(cause, expected, actual),
param_env,
define_opaque_types,
ty::Covariant,
);
op.relate(expected, actual)?;
Ok(InferOk { value: (), obligations: op.into_obligations() })
}
}

/// Makes `expected == actual`.
Expand Down Expand Up @@ -288,41 +301,6 @@ pub trait ToTrace<'tcx>: Relate<TyCtxt<'tcx>> + Copy {
}

impl<'a, 'tcx> At<'a, 'tcx> {
/// Makes `expected <: actual`.
///
/// FIXME: To be removed in favor of the [`InferCtxt::sub_raw`] method instead.
pub fn sub<T>(
self,
define_opaque_types: DefineOpaqueTypes,
expected: T,
actual: T,
) -> InferResult<'tcx, ()>
where
T: ToTrace<'tcx>,
{
if self.infcx.next_trait_solver {
NextSolverRelate::relate(
self.infcx,
self.param_env,
expected,
ty::Covariant,
actual,
self.cause.span,
)
.map(|goals| self.goals_to_obligations(goals))
} else {
let mut op = TypeRelating::new(
self.infcx,
ToTrace::to_trace(self.cause, expected, actual),
self.param_env,
define_opaque_types,
ty::Covariant,
);
op.relate(expected, actual)?;
Ok(InferOk { value: (), obligations: op.into_obligations() })
}
}

/// Makes `expected == actual`.
///
/// FIXME: To be removed in favor of the [`InferCtxt::eq_raw`] method instead.
Expand Down Expand Up @@ -391,7 +369,13 @@ impl<'a, 'tcx> At<'a, 'tcx> {
T: ToTrace<'tcx>,
{
match variance {
ty::Covariant => self.sub(define_opaque_types, expected, actual),
ty::Covariant => self.infcx.sub_raw(
self.cause,
self.param_env,
define_opaque_types,
expected,
actual,
),
ty::Invariant => self.eq(define_opaque_types, expected, actual),
ty::Contravariant => self.infcx.sup_raw(
self.cause,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ impl<'tcx> InferCtxt<'tcx> {

self.enter_forall(predicate, |ty::SubtypePredicate { a_is_expected, a, b }| {
if a_is_expected {
Ok(self.at(cause, param_env).sub(DefineOpaqueTypes::Yes, a, b))
Ok(self.sub_raw(cause, param_env, DefineOpaqueTypes::Yes, a, b))
} else {
Ok(self.sup_raw(cause, param_env, DefineOpaqueTypes::Yes, b, a))
}
Expand Down
25 changes: 20 additions & 5 deletions compiler/rustc_infer/src/infer/relate/lattice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,30 @@ impl<'infcx, 'tcx> LatticeOp<'infcx, 'tcx> {
// relates `v` to `a` first, which may help us to avoid unnecessary
// type variable obligations. See caller for details.
fn relate_bound(&mut self, v: Ty<'tcx>, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, ()> {
let at = self.infcx.at(&self.trace.cause, self.param_env);
match self.kind {
LatticeOpKind::Glb => {
self.obligations.extend(at.sub(DefineOpaqueTypes::Yes, v, a)?.into_obligations());
self.obligations.extend(at.sub(DefineOpaqueTypes::Yes, v, b)?.into_obligations());
self.obligations.extend(
self.infcx
.sub_raw(&self.trace.cause, self.param_env, DefineOpaqueTypes::Yes, v, a)?
.into_obligations(),
);
self.obligations.extend(
self.infcx
.sub_raw(&self.trace.cause, self.param_env, DefineOpaqueTypes::Yes, v, b)?
.into_obligations(),
);
}
LatticeOpKind::Lub => {
self.obligations.extend(at.sub(DefineOpaqueTypes::Yes, a, v)?.into_obligations());
self.obligations.extend(at.sub(DefineOpaqueTypes::Yes, b, v)?.into_obligations());
self.obligations.extend(
self.infcx
.sub_raw(&self.trace.cause, self.param_env, DefineOpaqueTypes::Yes, a, v)?
.into_obligations(),
);
self.obligations.extend(
self.infcx
.sub_raw(&self.trace.cause, self.param_env, DefineOpaqueTypes::Yes, b, v)?
.into_obligations(),
);
}
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) {
if tracks_deps {
let _span = icx.tcx.source_span(def_id);
// Sanity check: relative span's parent must be an absolute span.
debug_assert_eq!(_span.data_untracked().parent, None);
debug_assert_eq!(_span.parent(), None);
}
}
})
Expand Down
12 changes: 3 additions & 9 deletions compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,9 @@ fn find_noop_landing_pads<'tcx>(

// This is a post-order traversal, so that if A post-dominates B
// then A will be visited before B.
let postorder: Vec<_> = traversal::postorder(body).map(|(bb, _)| bb).collect();
for bb in postorder {
let is_nop_landing_pad = RemoveNoopLandingPads.is_nop_landing_pad(
tcx,
&body.basic_blocks[bb],
body,
&nop_landing_pads,
extra,
);
for (bb, bb_data) in traversal::postorder(body) {
let is_nop_landing_pad =
RemoveNoopLandingPads.is_nop_landing_pad(tcx, bb_data, body, &nop_landing_pads, extra);
if is_nop_landing_pad {
nop_landing_pads.insert(bb);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_type_ir::outlives::{Component, push_outlives_components};
#[cfg(not(feature = "nightly"))]
use rustc_type_ir::region_constraint::TransitiveRelationBuilder;
use rustc_type_ir::region_constraint::{
And, Assumptions, LeafRegionConstraint, Or, eagerly_handle_placeholders_in_universe,
And, Assumptions, LeafRegionConstraint, NoSpan, Or, eagerly_handle_placeholders_in_universe,
};
use rustc_type_ir::{
AliasTy, Binder, ClauseKind, Const, InferCtxtLike, Interner, Region, TypeVisitable,
Expand Down Expand Up @@ -168,9 +168,9 @@ where
use Component::*;
use LeafRegionConstraint::*;
match c {
Region(c_r) => Or::new_leaf(RegionOutlives(*c_r, r, ())),
Region(c_r) => Or::new_leaf(RegionOutlives(*c_r, r, NoSpan)),
Placeholder(p) => {
Or::new_leaf(PlaceholderTyOutlives(Ty::new_placeholder(self.cx(), *p), r, ()))
Or::new_leaf(PlaceholderTyOutlives(Ty::new_placeholder(self.cx(), *p), r, NoSpan))
}
Alias(_, alias) => self.destructure_alias_outlives(*alias, r),
UnresolvedInferenceVariable(_) => {
Expand All @@ -194,11 +194,11 @@ where

let item_bounds =
rustc_type_ir::outlives::declared_bounds_from_definition(self.cx(), alias)
.map(|bound| And::new([RegionOutlives(bound, r, ())]));
.map(|bound| And::new([RegionOutlives(bound, r, NoSpan)]));
let item_bound_outlives = Or::new(item_bounds);

let where_clause_outlives =
Or::new_leaf(AliasTyOutlivesViaEnv(Binder::dummy((alias, r)), ()));
Or::new_leaf(AliasTyOutlivesViaEnv(Binder::dummy((alias, r)), NoSpan));

let mut components = Default::default();
rustc_type_ir::outlives::compute_alias_components_recursive(
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_next_trait_solver/src/solve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,12 @@ where
let ty::OutlivesClause(a, b) = goal.predicate;

if self.cx().assumptions_on_binders() {
use rustc_type_ir::region_constraint::{LeafRegionConstraint, RegionConstraint};
use rustc_type_ir::region_constraint::{
LeafRegionConstraint, NoSpan, RegionConstraint,
};

let constraint =
RegionConstraint::new_leaf(LeafRegionConstraint::RegionOutlives(a, b, ()));
RegionConstraint::new_leaf(LeafRegionConstraint::RegionOutlives(a, b, NoSpan));
self.register_solver_region_constraint(constraint);
} else {
self.register_region_outlives(a, b, VisibleForLeakCheck::Yes);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2370,7 +2370,7 @@ impl<'a> Parser<'a> {
let move_kw_span = self.prev_token.span;
// Check for `move async` and recover
if self.check_keyword(exp!(Async)) {
let move_async_span = self.token.span.with_lo(self.prev_token.span.data().lo);
let move_async_span = self.token.span.with_lo(self.prev_token.span.lo());
Err(self.dcx().create_err(crate::diagnostics::AsyncMoveOrderIncorrect {
span: move_async_span,
}))
Expand All @@ -2382,7 +2382,7 @@ impl<'a> Parser<'a> {
self.psess.gated_spans.gate(sym::ergonomic_clones, use_kw_span);
// Check for `use async` and recover
if self.check_keyword(exp!(Async)) {
let use_async_span = self.token.span.with_lo(self.prev_token.span.data().lo);
let use_async_span = self.token.span.with_lo(self.prev_token.span.lo());
Err(self.dcx().create_err(crate::diagnostics::AsyncUseOrderIncorrect {
span: use_async_span,
}))
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<'a> Parser<'a> {
}
}

let inject_use_span = post_attr_lo.data().with_hi(post_attr_lo.lo());
let inject_use_span = post_attr_lo.with_hi(post_attr_lo.lo());
let mod_spans = ModSpans { inner_span: lo.to(self.prev_token.span), inject_use_span };
Ok((attrs, items, mod_spans))
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ impl<'tcx> Resolver<'_, 'tcx> {
}

// A relative span's parent must be an absolute span.
debug_assert_eq!(span.data_untracked().parent, None);
debug_assert_eq!(span.parent(), None);
let _id = self.tcx.untracked().source_span.push(span);
debug_assert_eq!(_id, def_id);

Expand Down
20 changes: 7 additions & 13 deletions compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,12 +733,6 @@ impl SpanData {
}
}

impl Default for SpanData {
fn default() -> Self {
Self { lo: BytePos(0), hi: BytePos(0), ctxt: SyntaxContext::root(), parent: None }
}
}

impl Span {
#[inline]
pub fn lo(self) -> BytePos {
Expand Down Expand Up @@ -1279,7 +1273,7 @@ impl Span {

// Don't return something if it's marked with `#[diagnostic::opaque]`.
// This already accounts for `-Zmacro-backtrace`.
if within.data().ctxt.outer_expn_data().diagnostic_opaque {
if within.ctxt().outer_expn_data().diagnostic_opaque {
return None;
}

Expand Down Expand Up @@ -1420,9 +1414,9 @@ pub trait SpanEncoder: Encoder {

impl SpanEncoder for FileEncoder<'_> {
fn encode_span(&mut self, span: Span) {
let span = span.data();
span.lo.encode(self);
span.hi.encode(self);
let (lo, hi) = span.lo_hi();
lo.encode(self);
hi.encode(self);
}

fn encode_symbol(&mut self, sym: Symbol) {
Expand Down Expand Up @@ -1457,9 +1451,9 @@ impl SpanEncoder for FileEncoder<'_> {

impl SpanEncoder for MemEncoder {
fn encode_span(&mut self, span: Span) {
let span = span.data();
span.lo.encode(self);
span.hi.encode(self);
let (lo, hi) = span.lo_hi();
lo.encode(self);
hi.encode(self);
}

fn encode_symbol(&mut self, sym: Symbol) {
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_span/src/source_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,8 +943,7 @@ impl SourceMap {
/// Returns a new span representing just the first character of the given span.
pub fn start_point(&self, sp: Span) -> Span {
let width = {
let sp = sp.data();
let local_begin = self.lookup_byte_offset(sp.lo);
let local_begin = self.lookup_byte_offset(sp.lo());
let start_index = local_begin.pos.to_usize();
let src = local_begin.sf.external_src.read();

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_trait_selection/src/traits/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ where
actual: T,
) -> Result<(), TypeError<'tcx>> {
self.infcx
.at(cause, param_env)
.sub(DefineOpaqueTypes::Yes, expected, actual)
.sub_raw(cause, param_env, DefineOpaqueTypes::Yes, expected, actual)
.map(|infer_ok| self.register_infer_ok_obligations(infer_ok))
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_type_ir/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ TrivialTypeTraversalImpls! {
crate::UintTy,
crate::UniverseIndex,
crate::Variance,
crate::region_constraint::NoSpan,
crate::solve::BuiltinImplSource,
crate::solve::Certainty,
crate::solve::GoalSource,
Expand Down
Loading
Loading