Add more · rust-lang/rust@ecccf33 (original) (raw)
File tree
6 files changed
lines changed
- rustc_hir_analysis/src/coherence
- rustc_hir_typeck/src/method
- rustc_trait_selection/src/traits
6 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -23,7 +23,7 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) { | ||
23 | 23 | tcx.def_span(def_id), |
24 | 24 | E0199, |
25 | 25 | "implementing the trait `{}` is not unsafe", |
26 | - trait_ref.print_only_trait_path() | |
26 | + trait_ref.print_trait_sugared() | |
27 | 27 | ) |
28 | 28 | .span_suggestion_verbose( |
29 | 29 | 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) { | ||
40 | 40 | tcx.def_span(def_id), |
41 | 41 | E0200, |
42 | 42 | "the trait `{}` requires an `unsafe impl` declaration", |
43 | - trait_ref.print_only_trait_path() | |
43 | + trait_ref.print_trait_sugared() | |
44 | 44 | ) |
45 | 45 | .note(format!( |
46 | 46 | "the trait `{}` enforces invariants that the compiler can't check. \ |
47 | 47 | Review the trait documentation and make sure this implementation \ |
48 | 48 | upholds those invariants before adding the `unsafe` keyword", |
49 | - trait_ref.print_only_trait_path() | |
49 | + trait_ref.print_trait_sugared() | |
50 | 50 | )) |
51 | 51 | .span_suggestion_verbose( |
52 | 52 | item.span.shrink_to_lo(), |
@@ -69,7 +69,7 @@ pub(super) fn check_item(tcx: TyCtxt<'_>, def_id: LocalDefId) { | ||
69 | 69 | "the trait `{}` enforces invariants that the compiler can't check. \ |
70 | 70 | Review the trait documentation and make sure this implementation \ |
71 | 71 | upholds those invariants before adding the `unsafe` keyword", |
72 | - trait_ref.print_only_trait_path() | |
72 | + trait_ref.print_trait_sugared() | |
73 | 73 | )) |
74 | 74 | .span_suggestion_verbose( |
75 | 75 | item.span.shrink_to_lo(), |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2299,7 +2299,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | ||
2299 | 2299 | let msg = if preds.len() == 1 { |
2300 | 2300 | format!( |
2301 | 2301 | "an implementation of `{}` might be missing for `{}`", |
2302 | - preds[0].trait_ref.print_only_trait_path(), | |
2302 | + preds[0].trait_ref.print_trait_sugared(), | |
2303 | 2303 | preds[0].self_ty() |
2304 | 2304 | ) |
2305 | 2305 | } else { |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -245,7 +245,7 @@ fn overlap<'tcx>( | ||
245 | 245 | let trait_ref = infcx.resolve_vars_if_possible(trait_ref); |
246 | 246 | format!( |
247 | 247 | "of `{}` for `{}`", |
248 | - trait_ref.print_only_trait_path(), | |
248 | + trait_ref.print_trait_sugared(), | |
249 | 249 | trait_ref.self_ty() |
250 | 250 | ) |
251 | 251 | } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1854,7 +1854,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { | ||
1854 | 1854 | let end = if candidates.len() <= 9 { candidates.len() } else { 8 }; |
1855 | 1855 | err.help(format!( |
1856 | 1856 | "the following {other}types implement trait `{}`:{}{}", |
1857 | - trait_ref.print_only_trait_path(), | |
1857 | + trait_ref.print_trait_sugared(), | |
1858 | 1858 | candidates[..end].join(""), |
1859 | 1859 | if candidates.len() > 9 { |
1860 | 1860 | format!("\nand {} others", candidates.len() - 8) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -78,7 +78,7 @@ impl<'tcx> IntercrateAmbiguityCause<'tcx> { | ||
78 | 78 | IntercrateAmbiguityCause::DownstreamCrate { trait_ref, self_ty } => { |
79 | 79 | format!( |
80 | 80 | "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(), | |
82 | 82 | self_desc = if let Some(self_ty) = self_ty { |
83 | 83 | format!(" for type `{self_ty}`") |
84 | 84 | } else { |
@@ -90,7 +90,7 @@ impl<'tcx> IntercrateAmbiguityCause<'tcx> { | ||
90 | 90 | format!( |
91 | 91 | "upstream crates may add a new impl of trait `{trait_desc}`{self_desc} \ |
92 | 92 | in future versions", |
93 | - trait_desc = trait_ref.print_only_trait_path(), | |
93 | + trait_desc = trait_ref.print_trait_sugared(), | |
94 | 94 | self_desc = if let Some(self_ty) = self_ty { |
95 | 95 | format!(" for type `{self_ty}`") |
96 | 96 | } else { |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -412,7 +412,7 @@ fn report_conflicting_impls<'tcx>( | ||
412 | 412 | let msg = DelayDm(| |
413 | 413 | format!( |
414 | 414 | "conflicting implementations of trait `{}`{}{}", |
415 | - overlap.trait_ref.print_only_trait_path(), | |
415 | + overlap.trait_ref.print_trait_sugared(), | |
416 | 416 | overlap.self_ty.map_or_else(String::new, |ty |
417 | 417 | match used_to_be_allowed { |
418 | 418 | Some(FutureCompatOverlapErrorKind::Issue33140) => ": (E0119)", |