Skip to content

Change ty and const error's pretty printing to be in braces #111991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/astconv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?,
Expand Down Expand Up @@ -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)
}
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/const-generics/transmute-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() { }
Original file line number Diff line number Diff line change
@@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down