summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_trait_selection/src/traits/specialize
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /compiler/rustc_trait_selection/src/traits/specialize
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/specialize')
-rw-r--r--compiler/rustc_trait_selection/src/traits/specialize/mod.rs43
1 files changed, 21 insertions, 22 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
index efab29743..71a88f5f0 100644
--- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
@@ -37,7 +37,7 @@ pub struct OverlapError<'tcx> {
pub with_impl: DefId,
pub trait_ref: ty::TraitRef<'tcx>,
pub self_ty: Option<Ty<'tcx>>,
- pub intercrate_ambiguity_causes: FxIndexSet<IntercrateAmbiguityCause>,
+ pub intercrate_ambiguity_causes: FxIndexSet<IntercrateAmbiguityCause<'tcx>>,
pub involves_placeholder: bool,
}
@@ -107,7 +107,7 @@ pub fn translate_args_with_cause<'tcx>(
param_env, source_impl, source_args, target_node
);
let source_trait_ref =
- infcx.tcx.impl_trait_ref(source_impl).unwrap().instantiate(infcx.tcx, &source_args);
+ infcx.tcx.impl_trait_ref(source_impl).unwrap().instantiate(infcx.tcx, source_args);
// translate the Self and Param parts of the substitution, since those
// vary across impls
@@ -197,25 +197,22 @@ fn fulfill_implication<'tcx>(
param_env, source_trait_ref, target_impl
);
- let source_trait_ref = match traits::fully_normalize(
- &infcx,
- ObligationCause::dummy(),
- param_env,
- source_trait_ref,
- ) {
- Ok(source_trait_ref) => source_trait_ref,
- Err(_errors) => {
- infcx.tcx.sess.delay_span_bug(
- infcx.tcx.def_span(source_impl),
- format!("failed to fully normalize {source_trait_ref}"),
- );
- source_trait_ref
- }
- };
+ let source_trait_ref =
+ match traits::fully_normalize(infcx, ObligationCause::dummy(), param_env, source_trait_ref)
+ {
+ Ok(source_trait_ref) => source_trait_ref,
+ Err(_errors) => {
+ infcx.tcx.sess.span_delayed_bug(
+ infcx.tcx.def_span(source_impl),
+ format!("failed to fully normalize {source_trait_ref}"),
+ );
+ source_trait_ref
+ }
+ };
let source_trait = ImplSubject::Trait(source_trait_ref);
- let selcx = &mut SelectionContext::new(&infcx);
+ let selcx = &mut SelectionContext::new(infcx);
let target_args = infcx.fresh_args_for_item(DUMMY_SP, target_impl);
let (target_trait, obligations) =
util::impl_subject_and_oblig(selcx, param_env, target_impl, target_args, error_cause);
@@ -415,7 +412,7 @@ fn report_conflicting_impls<'tcx>(
let msg = DelayDm(|| {
format!(
"conflicting implementations of trait `{}`{}{}",
- overlap.trait_ref.print_only_trait_path(),
+ overlap.trait_ref.print_trait_sugared(),
overlap.self_ty.map_or_else(String::new, |ty| format!(" for type `{ty}`")),
match used_to_be_allowed {
Some(FutureCompatOverlapErrorKind::Issue33140) => ": (E0119)",
@@ -434,7 +431,10 @@ fn report_conflicting_impls<'tcx>(
decorate(tcx, &overlap, impl_span, &mut err);
Some(err.emit())
} else {
- Some(tcx.sess.delay_span_bug(impl_span, "impl should have failed the orphan check"))
+ Some(
+ tcx.sess
+ .span_delayed_bug(impl_span, "impl should have failed the orphan check"),
+ )
};
sg.has_errored = reported;
}
@@ -445,12 +445,11 @@ fn report_conflicting_impls<'tcx>(
};
tcx.struct_span_lint_hir(
lint,
- tcx.hir().local_def_id_to_hir_id(impl_def_id),
+ tcx.local_def_id_to_hir_id(impl_def_id),
impl_span,
msg,
|err| {
decorate(tcx, &overlap, impl_span, err);
- err
},
);
}