print const and type errors in braces not square brackets

This commit is contained in:
Boxy 2023-05-26 16:01:23 +01:00
parent 1221e43bdf
commit ad77bc8427
6 changed files with 11 additions and 11 deletions

View File

@ -1159,7 +1159,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
// those that do.
self.one_bound_for_assoc_type(
|| traits::supertraits(tcx, trait_ref),
trait_ref.print_only_trait_path(),
trait_ref.skip_binder().print_only_trait_name(),
binding.item_name,
path_span,
match binding.kind {

View File

@ -700,7 +700,7 @@ pub trait PrettyPrinter<'tcx>:
if verbose { p!(write("{:?}", infer_ty)) } else { p!(write("{}", infer_ty)) }
}
}
ty::Error(_) => p!("[type error]"),
ty::Error(_) => p!("{{type error}}"),
ty::Param(ref param_ty) => p!(print(param_ty)),
ty::Bound(debruijn, bound_ty) => match bound_ty.kind {
ty::BoundTyKind::Anon => debug_bound_var(&mut self, debruijn, bound_ty.var)?,
@ -1379,8 +1379,8 @@ pub trait PrettyPrinter<'tcx>:
},
// FIXME(generic_const_exprs):
// write out some legible representation of an abstract const?
ty::ConstKind::Expr(_) => p!("[const expr]"),
ty::ConstKind::Error(_) => p!("[const error]"),
ty::ConstKind::Expr(_) => p!("{{const expr}}"),
ty::ConstKind::Error(_) => p!("{{const error}}"),
};
Ok(self)
}

View File

@ -4,8 +4,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
LL | std::mem::transmute(v)
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `[[u32; H+1]; W]` (generic size [const expr])
= note: target type: `[[u32; W+1]; H]` (generic size [const expr])
= note: source type: `[[u32; H+1]; W]` (generic size {const expr})
= note: target type: `[[u32; W+1]; H]` (generic size {const expr})
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/transmute-fail.rs:16:5
@ -34,8 +34,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
LL | std::mem::transmute(v)
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `[[u32; H]; W]` (generic size [const expr])
= note: target type: `[u32; W * H * H]` (generic size [const expr])
= note: source type: `[[u32; H]; W]` (generic size {const expr})
= note: target type: `[u32; W * H * H]` (generic size {const expr})
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/transmute-fail.rs:30:5

View File

@ -2,7 +2,7 @@
trait One<A> { fn foo(&self) -> A; }
fn foo(_: &dyn One()) //~ ERROR associated type `Output` not found for `One<()>`
fn foo(_: &dyn One()) //~ ERROR associated type `Output` not found for `One`
{}
fn main() { }

View File

@ -1,4 +1,4 @@
error[E0220]: associated type `Output` not found for `One<()>`
error[E0220]: associated type `Output` not found for `One`
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:16
|
LL | fn foo(_: &dyn One())

View File

@ -12,7 +12,7 @@ note: trait defined here, with 3 generic parameters: `A`, `B`, `C`
LL | trait Three<A,B,C> { fn dummy(&self) -> (A,B,C); }
| ^^^^^ - - -
error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>`
error[E0220]: associated type `Output` not found for `Three`
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:16
|
LL | fn foo(_: &dyn Three())