Skip to content

Commit

Permalink
Only use ... instead of _ for type elision
Browse files Browse the repository at this point in the history
`_` might confuse people into believing that the type isn't known,
while `...` is not used anywhere else for types and is not valid
syntax, making it more likely to convey the right understanding.
  • Loading branch information
estebank committed Nov 18, 2022
1 parent 4ed1376 commit 3debf50
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
6 changes: 1 addition & 5 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1765,11 +1765,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
self.pretty_print_type(ty)
} else {
self.truncated = true;
if let ty::Adt(_, substs) = ty.kind() && substs.len() > 0 {
write!(self, "...")?;
} else {
write!(self, "_")?;
}
write!(self, "...")?;
Ok(self)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: reached the recursion limit while instantiating `<(&(&(_, _), _), _) as Foo>::recurse`
error: reached the recursion limit while instantiating `<(&(&(..., ...), ...), ...) as Foo>::recurse`
--> $DIR/issue-37311.rs:17:9
|
LL | (self, self).recurse();
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-67552.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut _>`
error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut ...>`
--> $DIR/issue-67552.rs:29:9
|
LL | rec(identity(&mut it))
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/recursion/issue-83150.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ error[E0275]: overflow evaluating the requirement `<std::ops::Range<u8> as Itera
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`)
= note: required for `Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:12:24: 12:27]>` to implement `Iterator`
= note: 64 redundant requirements hidden
= note: required for `&mut Map<&mut Map<&mut Map<_, _>, _>, _>` to implement `Iterator`
= note: required for `&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>` to implement `Iterator`
= note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-83150/issue-83150.long-type-hash.txt'

error: aborting due to previous error; 1 warning emitted
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/traits/issue-91949-hangs-on-recursion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ error[E0275]: overflow evaluating the requirement `(): Sized`
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "512"]` attribute to your crate (`issue_91949_hangs_on_recursion`)
= note: required for `std::iter::Empty<()>` to implement `Iterator`
= note: 171 redundant requirements hidden
= note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<..., _>>, _>>` to implement `Iterator`
= note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<..., ...>>, ...>>` to implement `Iterator`
= note: the full type name has been written to '$TEST_BUILD_DIR/traits/issue-91949-hangs-on-recursion/issue-91949-hangs-on-recursion.long-type-hash.txt'

error: aborting due to previous error; 1 warning emitted
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/type_length_limit.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((_, _, _), _, _), _, _), _, _)>>`
error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((..., ..., ...), ..., ...), ..., ...), ..., ...)>>`
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
LL | pub fn drop<T>(_x: T) {}
Expand Down

0 comments on commit 3debf50

Please sign in to comment.