Skip to content

Commit f6c30b3

Browse files
Add more
1 parent b97ff8e commit f6c30b3

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

compiler/rustc_hir_analysis/src/coherence/unsafety.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
2323
tcx.def_span(def_id),
2424
E0199,
2525
"implementing the trait `{}` is not unsafe",
26-
trait_ref.print_only_trait_path()
26+
trait_ref.print_trait_sugared()
2727
)
2828
.span_suggestion_verbose(
2929
item.span.with_hi(item.span.lo() + rustc_span::BytePos(7)),
@@ -40,13 +40,13 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
4040
tcx.def_span(def_id),
4141
E0200,
4242
"the trait `{}` requires an `unsafe impl` declaration",
43-
trait_ref.print_only_trait_path()
43+
trait_ref.print_trait_sugared()
4444
)
4545
.note(format!(
4646
"the trait `{}` enforces invariants that the compiler can't check. \
4747
Review the trait documentation and make sure this implementation \
4848
upholds those invariants before adding the `unsafe` keyword",
49-
trait_ref.print_only_trait_path()
49+
trait_ref.print_trait_sugared()
5050
))
5151
.span_suggestion_verbose(
5252
item.span.shrink_to_lo(),
@@ -69,7 +69,7 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
6969
"the trait `{}` enforces invariants that the compiler can't check. \
7070
Review the trait documentation and make sure this implementation \
7171
upholds those invariants before adding the `unsafe` keyword",
72-
trait_ref.print_only_trait_path()
72+
trait_ref.print_trait_sugared()
7373
))
7474
.span_suggestion_verbose(
7575
item.span.shrink_to_lo(),

compiler/rustc_hir_typeck/src/method/suggest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22992299
let msg = if preds.len() == 1 {
23002300
format!(
23012301
"an implementation of `{}` might be missing for `{}`",
2302-
preds[0].trait_ref.print_only_trait_path(),
2302+
preds[0].trait_ref.print_trait_sugared(),
23032303
preds[0].self_ty()
23042304
)
23052305
} else {

compiler/rustc_trait_selection/src/traits/coherence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ fn overlap<'tcx>(
245245
let trait_ref = infcx.resolve_vars_if_possible(trait_ref);
246246
format!(
247247
"of `{}` for `{}`",
248-
trait_ref.print_only_trait_path(),
248+
trait_ref.print_trait_sugared(),
249249
trait_ref.self_ty()
250250
)
251251
}

compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1854,7 +1854,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
18541854
let end = if candidates.len() <= 9 { candidates.len() } else { 8 };
18551855
err.help(format!(
18561856
"the following {other}types implement trait `{}`:{}{}",
1857-
trait_ref.print_only_trait_path(),
1857+
trait_ref.print_trait_sugared(),
18581858
candidates[..end].join(""),
18591859
if candidates.len() > 9 {
18601860
format!("\nand {} others", candidates.len() - 8)

compiler/rustc_trait_selection/src/traits/select/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'tcx> IntercrateAmbiguityCause<'tcx> {
7878
IntercrateAmbiguityCause::DownstreamCrate { trait_ref, self_ty } => {
7979
format!(
8080
"downstream crates may implement trait `{trait_desc}`{self_desc}",
81-
trait_desc = trait_ref.print_only_trait_path(),
81+
trait_desc = trait_ref.print_trait_sugared(),
8282
self_desc = if let Some(self_ty) = self_ty {
8383
format!(" for type `{self_ty}`")
8484
} else {
@@ -90,7 +90,7 @@ impl<'tcx> IntercrateAmbiguityCause<'tcx> {
9090
format!(
9191
"upstream crates may add a new impl of trait `{trait_desc}`{self_desc} \
9292
in future versions",
93-
trait_desc = trait_ref.print_only_trait_path(),
93+
trait_desc = trait_ref.print_trait_sugared(),
9494
self_desc = if let Some(self_ty) = self_ty {
9595
format!(" for type `{self_ty}`")
9696
} else {

compiler/rustc_trait_selection/src/traits/specialize/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ fn report_conflicting_impls<'tcx>(
412412
let msg = DelayDm(|| {
413413
format!(
414414
"conflicting implementations of trait `{}`{}{}",
415-
overlap.trait_ref.print_only_trait_path(),
415+
overlap.trait_ref.print_trait_sugared(),
416416
overlap.self_ty.map_or_else(String::new, |ty| format!(" for type `{ty}`")),
417417
match used_to_be_allowed {
418418
Some(FutureCompatOverlapErrorKind::Issue33140) => ": (E0119)",

0 commit comments

Comments
 (0)