Skip to content

Commit 1bb3546

Browse files
committed
Auto merge of #164974 - JonathanBrouwer:rollup-zHkdUDx, r=<try>
Rollup of 8 pull requests try-job: dist-various-1 try-job: test-various try-job: test-x86_64-gnu-aux try-job: test-x86_64-msvc-1 try-job: test-aarch64-apple-1 try-job: test-aarch64-apple-2 try-job: test-x86_64-mingw-1 try-job: test-i686-msvc try-job: test-armhf-gnu try-job: test-x86_64-gnu-llvm-22-3
2 parents aaf324d + c64aa73 commit 1bb3546

36 files changed

Lines changed: 1810 additions & 2064 deletions

File tree

‎compiler/rustc_errors/src/emitter.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ pub trait Emitter {
365365
let Some(source_map) = self.source_map() else { return };
366366
let should_hide = |span| {
367367
source_map.is_imported(span) || {
368-
let expn = span.data().ctxt.outer_expn_data();
368+
let expn = span.ctxt().outer_expn_data();
369369
expn.diagnostic_opaque && matches!(expn.kind, ExpnKind::Macro(MacroKind::Bang, _))
370370
}
371371
};

‎compiler/rustc_expand/src/proc_macro_server.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,24 +527,24 @@ impl server::Server for Rustc<'_, '_> {
527527
.map_err(|_| String::from("failed to parse to literal"))?
528528
.map_err(cancel_diags_into_string)?;
529529

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

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

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

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

‎compiler/rustc_infer/src/infer/at.rs‎

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'tcx> InferCtxt<'tcx> {
171171
/// If possible, prefer the wrapper methods on `ObligationCtxt`,
172172
/// `FnCtxt`, or `TypeChecker`.
173173
pub fn sub_raw<T>(
174-
self,
174+
&self,
175175
cause: &ObligationCause<'tcx>,
176176
param_env: ParamEnv<'tcx>,
177177
define_opaque_types: DefineOpaqueTypes,
@@ -181,7 +181,20 @@ impl<'tcx> InferCtxt<'tcx> {
181181
where
182182
T: ToTrace<'tcx>,
183183
{
184-
self.at(cause, param_env).sub(define_opaque_types, expected, actual)
184+
if self.next_trait_solver {
185+
NextSolverRelate::relate(self, param_env, expected, ty::Covariant, actual, cause.span)
186+
.map(|goals| self.goals_to_obligations(cause, goals))
187+
} else {
188+
let mut op = TypeRelating::new(
189+
self,
190+
ToTrace::to_trace(cause, expected, actual),
191+
param_env,
192+
define_opaque_types,
193+
ty::Covariant,
194+
);
195+
op.relate(expected, actual)?;
196+
Ok(InferOk { value: (), obligations: op.into_obligations() })
197+
}
185198
}
186199

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

290303
impl<'a, 'tcx> At<'a, 'tcx> {
291-
/// Makes `expected <: actual`.
292-
///
293-
/// FIXME: To be removed in favor of the [`InferCtxt::sub_raw`] method instead.
294-
pub fn sub<T>(
295-
self,
296-
define_opaque_types: DefineOpaqueTypes,
297-
expected: T,
298-
actual: T,
299-
) -> InferResult<'tcx, ()>
300-
where
301-
T: ToTrace<'tcx>,
302-
{
303-
if self.infcx.next_trait_solver {
304-
NextSolverRelate::relate(
305-
self.infcx,
306-
self.param_env,
307-
expected,
308-
ty::Covariant,
309-
actual,
310-
self.cause.span,
311-
)
312-
.map(|goals| self.goals_to_obligations(goals))
313-
} else {
314-
let mut op = TypeRelating::new(
315-
self.infcx,
316-
ToTrace::to_trace(self.cause, expected, actual),
317-
self.param_env,
318-
define_opaque_types,
319-
ty::Covariant,
320-
);
321-
op.relate(expected, actual)?;
322-
Ok(InferOk { value: (), obligations: op.into_obligations() })
323-
}
324-
}
325-
326304
/// Makes `expected == actual`.
327305
///
328306
/// FIXME: To be removed in favor of the [`InferCtxt::eq_raw`] method instead.
@@ -391,7 +369,13 @@ impl<'a, 'tcx> At<'a, 'tcx> {
391369
T: ToTrace<'tcx>,
392370
{
393371
match variance {
394-
ty::Covariant => self.sub(define_opaque_types, expected, actual),
372+
ty::Covariant => self.infcx.sub_raw(
373+
self.cause,
374+
self.param_env,
375+
define_opaque_types,
376+
expected,
377+
actual,
378+
),
395379
ty::Invariant => self.eq(define_opaque_types, expected, actual),
396380
ty::Contravariant => self.infcx.sup_raw(
397381
self.cause,

‎compiler/rustc_infer/src/infer/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ impl<'tcx> InferCtxt<'tcx> {
883883

884884
self.enter_forall(predicate, |ty::SubtypePredicate { a_is_expected, a, b }| {
885885
if a_is_expected {
886-
Ok(self.at(cause, param_env).sub(DefineOpaqueTypes::Yes, a, b))
886+
Ok(self.sub_raw(cause, param_env, DefineOpaqueTypes::Yes, a, b))
887887
} else {
888888
Ok(self.sup_raw(cause, param_env, DefineOpaqueTypes::Yes, b, a))
889889
}

‎compiler/rustc_infer/src/infer/relate/lattice.rs‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,30 @@ impl<'infcx, 'tcx> LatticeOp<'infcx, 'tcx> {
255255
// relates `v` to `a` first, which may help us to avoid unnecessary
256256
// type variable obligations. See caller for details.
257257
fn relate_bound(&mut self, v: Ty<'tcx>, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, ()> {
258-
let at = self.infcx.at(&self.trace.cause, self.param_env);
259258
match self.kind {
260259
LatticeOpKind::Glb => {
261-
self.obligations.extend(at.sub(DefineOpaqueTypes::Yes, v, a)?.into_obligations());
262-
self.obligations.extend(at.sub(DefineOpaqueTypes::Yes, v, b)?.into_obligations());
260+
self.obligations.extend(
261+
self.infcx
262+
.sub_raw(&self.trace.cause, self.param_env, DefineOpaqueTypes::Yes, v, a)?
263+
.into_obligations(),
264+
);
265+
self.obligations.extend(
266+
self.infcx
267+
.sub_raw(&self.trace.cause, self.param_env, DefineOpaqueTypes::Yes, v, b)?
268+
.into_obligations(),
269+
);
263270
}
264271
LatticeOpKind::Lub => {
265-
self.obligations.extend(at.sub(DefineOpaqueTypes::Yes, a, v)?.into_obligations());
266-
self.obligations.extend(at.sub(DefineOpaqueTypes::Yes, b, v)?.into_obligations());
272+
self.obligations.extend(
273+
self.infcx
274+
.sub_raw(&self.trace.cause, self.param_env, DefineOpaqueTypes::Yes, a, v)?
275+
.into_obligations(),
276+
);
277+
self.obligations.extend(
278+
self.infcx
279+
.sub_raw(&self.trace.cause, self.param_env, DefineOpaqueTypes::Yes, b, v)?
280+
.into_obligations(),
281+
);
267282
}
268283
}
269284
Ok(())

‎compiler/rustc_interface/src/callbacks.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) {
3030
if tracks_deps {
3131
let _span = icx.tcx.source_span(def_id);
3232
// Sanity check: relative span's parent must be an absolute span.
33-
debug_assert_eq!(_span.data_untracked().parent, None);
33+
debug_assert_eq!(_span.parent(), None);
3434
}
3535
}
3636
})

‎compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,9 @@ fn find_noop_landing_pads<'tcx>(
172172

173173
// This is a post-order traversal, so that if A post-dominates B
174174
// then A will be visited before B.
175-
let postorder: Vec<_> = traversal::postorder(body).map(|(bb, _)| bb).collect();
176-
for bb in postorder {
177-
let is_nop_landing_pad = RemoveNoopLandingPads.is_nop_landing_pad(
178-
tcx,
179-
&body.basic_blocks[bb],
180-
body,
181-
&nop_landing_pads,
182-
extra,
183-
);
175+
for (bb, bb_data) in traversal::postorder(body) {
176+
let is_nop_landing_pad =
177+
RemoveNoopLandingPads.is_nop_landing_pad(tcx, bb_data, body, &nop_landing_pads, extra);
184178
if is_nop_landing_pad {
185179
nop_landing_pads.insert(bb);
186180
}

‎compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_type_ir::outlives::{Component, push_outlives_components};
77
#[cfg(not(feature = "nightly"))]
88
use rustc_type_ir::region_constraint::TransitiveRelationBuilder;
99
use rustc_type_ir::region_constraint::{
10-
And, Assumptions, LeafRegionConstraint, Or, eagerly_handle_placeholders_in_universe,
10+
And, Assumptions, LeafRegionConstraint, NoSpan, Or, eagerly_handle_placeholders_in_universe,
1111
};
1212
use rustc_type_ir::{
1313
AliasTy, Binder, ClauseKind, Const, InferCtxtLike, Interner, Region, TypeVisitable,
@@ -168,9 +168,9 @@ where
168168
use Component::*;
169169
use LeafRegionConstraint::*;
170170
match c {
171-
Region(c_r) => Or::new_leaf(RegionOutlives(*c_r, r, ())),
171+
Region(c_r) => Or::new_leaf(RegionOutlives(*c_r, r, NoSpan)),
172172
Placeholder(p) => {
173-
Or::new_leaf(PlaceholderTyOutlives(Ty::new_placeholder(self.cx(), *p), r, ()))
173+
Or::new_leaf(PlaceholderTyOutlives(Ty::new_placeholder(self.cx(), *p), r, NoSpan))
174174
}
175175
Alias(_, alias) => self.destructure_alias_outlives(*alias, r),
176176
UnresolvedInferenceVariable(_) => {
@@ -194,11 +194,11 @@ where
194194

195195
let item_bounds =
196196
rustc_type_ir::outlives::declared_bounds_from_definition(self.cx(), alias)
197-
.map(|bound| And::new([RegionOutlives(bound, r, ())]));
197+
.map(|bound| And::new([RegionOutlives(bound, r, NoSpan)]));
198198
let item_bound_outlives = Or::new(item_bounds);
199199

200200
let where_clause_outlives =
201-
Or::new_leaf(AliasTyOutlivesViaEnv(Binder::dummy((alias, r)), ()));
201+
Or::new_leaf(AliasTyOutlivesViaEnv(Binder::dummy((alias, r)), NoSpan));
202202

203203
let mut components = Default::default();
204204
rustc_type_ir::outlives::compute_alias_components_recursive(

‎compiler/rustc_next_trait_solver/src/solve/mod.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,12 @@ where
155155
let ty::OutlivesClause(a, b) = goal.predicate;
156156

157157
if self.cx().assumptions_on_binders() {
158-
use rustc_type_ir::region_constraint::{LeafRegionConstraint, RegionConstraint};
158+
use rustc_type_ir::region_constraint::{
159+
LeafRegionConstraint, NoSpan, RegionConstraint,
160+
};
159161

160162
let constraint =
161-
RegionConstraint::new_leaf(LeafRegionConstraint::RegionOutlives(a, b, ()));
163+
RegionConstraint::new_leaf(LeafRegionConstraint::RegionOutlives(a, b, NoSpan));
162164
self.register_solver_region_constraint(constraint);
163165
} else {
164166
self.register_region_outlives(a, b, VisibleForLeakCheck::Yes);

‎compiler/rustc_parse/src/parser/expr.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,7 +2370,7 @@ impl<'a> Parser<'a> {
23702370
let move_kw_span = self.prev_token.span;
23712371
// Check for `move async` and recover
23722372
if self.check_keyword(exp!(Async)) {
2373-
let move_async_span = self.token.span.with_lo(self.prev_token.span.data().lo);
2373+
let move_async_span = self.token.span.with_lo(self.prev_token.span.lo());
23742374
Err(self.dcx().create_err(crate::diagnostics::AsyncMoveOrderIncorrect {
23752375
span: move_async_span,
23762376
}))
@@ -2382,7 +2382,7 @@ impl<'a> Parser<'a> {
23822382
self.psess.gated_spans.gate(sym::ergonomic_clones, use_kw_span);
23832383
// Check for `use async` and recover
23842384
if self.check_keyword(exp!(Async)) {
2385-
let use_async_span = self.token.span.with_lo(self.prev_token.span.data().lo);
2385+
let use_async_span = self.token.span.with_lo(self.prev_token.span.lo());
23862386
Err(self.dcx().create_err(crate::diagnostics::AsyncUseOrderIncorrect {
23872387
span: use_async_span,
23882388
}))

0 commit comments

Comments
 (0)