Skip to content

Commit 52f3c71

Browse files
committedJul 18, 2024
Auto merge of #127898 - matthiaskrgr:rollup-lkkpoui, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #127077 (Make language around `ToOwned` for `BorrowedFd` more precise) - #127783 (Put the dots back in RTN pretty printing) - #127787 (Migrate `atomic-lock-free` to `rmake`) - #127810 (Rename `tcx` to `cx` in `rustc_type_ir`) - #127878 (Fix associated item removal suggestion) - #127886 (Accurate `use` rename suggestion span) - #127888 (More accurate span for type parameter suggestion) - #127889 (More accurate span for anonymous argument suggestion) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4bb2f27 + 77e5bbf commit 52f3c71

File tree

80 files changed

+550
-383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+550
-383
lines changed
 

‎compiler/rustc_borrowck/src/type_check/relate_tys.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> {
309309
}
310310

311311
impl<'bccx, 'tcx> TypeRelation<TyCtxt<'tcx>> for NllTypeRelating<'_, 'bccx, 'tcx> {
312-
fn tcx(&self) -> TyCtxt<'tcx> {
312+
fn cx(&self) -> TyCtxt<'tcx> {
313313
self.type_checker.infcx.tcx
314314
}
315315

@@ -370,7 +370,7 @@ impl<'bccx, 'tcx> TypeRelation<TyCtxt<'tcx>> for NllTypeRelating<'_, 'bccx, 'tcx
370370
// shouldn't ever fail. Instead, it unconditionally emits an
371371
// alias-relate goal.
372372
assert!(!self.type_checker.infcx.next_trait_solver());
373-
self.tcx().dcx().span_delayed_bug(
373+
self.cx().dcx().span_delayed_bug(
374374
self.span(),
375375
"failure to relate an opaque to itself should result in an error later on",
376376
);
@@ -540,7 +540,7 @@ impl<'bccx, 'tcx> PredicateEmittingRelation<InferCtxt<'tcx>> for NllTypeRelating
540540
&mut self,
541541
obligations: impl IntoIterator<Item: ty::Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>>,
542542
) {
543-
let tcx = self.tcx();
543+
let tcx = self.cx();
544544
let param_env = self.param_env();
545545
self.register_goals(
546546
obligations.into_iter().map(|to_pred| Goal::new(tcx, param_env, to_pred)),
@@ -559,7 +559,7 @@ impl<'bccx, 'tcx> PredicateEmittingRelation<InferCtxt<'tcx>> for NllTypeRelating
559559
.into_iter()
560560
.map(|goal| {
561561
Obligation::new(
562-
self.tcx(),
562+
self.cx(),
563563
ObligationCause::dummy_with_span(self.span()),
564564
goal.param_env,
565565
goal.predicate,

‎compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -1257,14 +1257,12 @@ pub fn prohibit_assoc_item_constraint(
12571257
};
12581258

12591259
// Now emit the suggestion
1260-
if let Ok(suggestion) = tcx.sess.source_map().span_to_snippet(removal_span) {
1261-
e.span_suggestion_verbose(
1262-
removal_span,
1263-
format!("consider removing this associated item {}", constraint.kind.descr()),
1264-
suggestion,
1265-
Applicability::MaybeIncorrect,
1266-
);
1267-
}
1260+
e.span_suggestion_verbose(
1261+
removal_span,
1262+
format!("consider removing this associated item {}", constraint.kind.descr()),
1263+
"",
1264+
Applicability::MaybeIncorrect,
1265+
);
12681266
};
12691267

12701268
// Suggest replacing the associated item binding with a generic argument.
@@ -1340,11 +1338,13 @@ pub fn prohibit_assoc_item_constraint(
13401338
format!("<{lifetimes}{type_with_constraints}>"),
13411339
)
13421340
};
1343-
let suggestions =
1344-
vec![param_decl, (constraint.span, format!("{}", matching_param.name))];
1341+
let suggestions = vec![
1342+
param_decl,
1343+
(constraint.span.with_lo(constraint.ident.span.hi()), String::new()),
1344+
];
13451345

13461346
err.multipart_suggestion_verbose(
1347-
format!("declare the type parameter right after the `impl` keyword"),
1347+
"declare the type parameter right after the `impl` keyword",
13481348
suggestions,
13491349
Applicability::MaybeIncorrect,
13501350
);

0 commit comments

Comments
 (0)