Tweak shortening logic to be less trigger happy
This commit is contained in:
parent
7674edeeba
commit
360c0a7a3e
4 changed files with 18 additions and 16 deletions
|
@ -2503,7 +2503,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
Some(match (exp_found.expected.unpack(), exp_found.found.unpack()) {
|
Some(match (exp_found.expected.unpack(), exp_found.found.unpack()) {
|
||||||
(ty::TermKind::Ty(expected), ty::TermKind::Ty(found)) => {
|
(ty::TermKind::Ty(expected), ty::TermKind::Ty(found)) => {
|
||||||
let (mut exp, mut fnd) = self.cmp(expected, found);
|
let (mut exp, mut fnd) = self.cmp(expected, found);
|
||||||
let len = self.tcx.sess().diagnostic_width().saturating_sub(20);
|
// Use the terminal width as the basis to determine when to compress the printed
|
||||||
|
// out type, but give ourselves some leeway to avoid ending up creating a file for
|
||||||
|
// a type that is somewhat shorter than the path we'd write to.
|
||||||
|
let len = self.tcx.sess().diagnostic_width() + 40;
|
||||||
let exp_s = exp.content();
|
let exp_s = exp.content();
|
||||||
let fnd_s = fnd.content();
|
let fnd_s = fnd.content();
|
||||||
let mut exp_p = None;
|
let mut exp_p = None;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --diagnostic-width=100
|
// compile-flags: --diagnostic-width=60
|
||||||
// normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
|
// normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
|
||||||
|
|
||||||
struct Atype<T, K>(T, K);
|
struct Atype<T, K>(T, K);
|
||||||
|
|
|
@ -8,35 +8,35 @@ LL | | Ctype<
|
||||||
LL | | Atype<
|
LL | | Atype<
|
||||||
... |
|
... |
|
||||||
LL | | i32
|
LL | | i32
|
||||||
LL | | > = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(...
|
LL | | > = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok...
|
||||||
| |_____-___^
|
| |_____-___^
|
||||||
| ||_____|
|
| ||_____|
|
||||||
| | expected due to this
|
| | expected due to this
|
||||||
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(...
|
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok...
|
||||||
LL | | Ok("")
|
LL | | Ok("")
|
||||||
LL | | ))))))))))))))))))))))))))))))
|
LL | | ))))))))))))))))))))))))))))))
|
||||||
LL | | ))))))))))))))))))))))))))))));
|
LL | | ))))))))))))))))))))))))))))));
|
||||||
| |___________________________________^ expected struct `Atype`, found enum `Result`
|
| |___________________________________^ expected struct `Atype`, found enum `Result`
|
||||||
|
|
|
|
||||||
= note: expected struct `Atype<Btype<Ctype<Atype<Btype<Ctype<..., ...>, ...>, ...>, ...>, ...>, ...>`
|
= note: expected struct `Atype<Btype<Ctype<..., ...>, ...>, ...>`
|
||||||
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||||
found enum `Result<Result<Result<Result<Result<..., ...>, ...>, ...>, ...>, ...>`
|
found enum `Result<Result<..., ...>, ...>`
|
||||||
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/long-E0308.rs:46:26
|
--> $DIR/long-E0308.rs:46:26
|
||||||
|
|
|
|
||||||
LL | ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok...
|
LL | ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O...
|
||||||
| __________________________^
|
| __________________________^
|
||||||
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O...
|
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(...
|
||||||
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
|
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
|
||||||
LL | | ))))))))))))))))))))))))))))))
|
LL | | ))))))))))))))))))))))))))))))
|
||||||
LL | | ))))))))))))))))))))))));
|
LL | | ))))))))))))))))))))))));
|
||||||
| |____________________________^ expected enum `Option`, found enum `Result`
|
| |____________________________^ expected enum `Option`, found enum `Result`
|
||||||
|
|
|
|
||||||
= note: expected enum `Option<Result<Option<Option<Option<Option<Option<Option<Option<...>>>>>>>, ...>>`
|
= note: expected enum `Option<Result<Option<Option<...>>, ...>>`
|
||||||
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||||
found enum `Result<Result<Result<Result<Result<..., ...>, ...>, ...>, ...>, ...>`
|
found enum `Result<Result<..., ...>, ...>`
|
||||||
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
|
@ -54,25 +54,25 @@ LL | | > = ();
|
||||||
| |_____|
|
| |_____|
|
||||||
| expected due to this
|
| expected due to this
|
||||||
|
|
|
|
||||||
= note: expected struct `Atype<Btype<Ctype<Atype<Btype<Ctype<..., ...>, ...>, ...>, ...>, ...>, ...>`
|
= note: expected struct `Atype<Btype<Ctype<..., ...>, ...>, ...>`
|
||||||
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||||
found unit type `()`
|
found unit type `()`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/long-E0308.rs:80:17
|
--> $DIR/long-E0308.rs:80:17
|
||||||
|
|
|
|
||||||
LL | let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(
|
LL | let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O...
|
||||||
| ____________--___^
|
| ____________--___^
|
||||||
| | |
|
| | |
|
||||||
| | expected due to this
|
| | expected due to this
|
||||||
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O...
|
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(...
|
||||||
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
|
LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
|
||||||
LL | | ))))))))))))))))))))))))))))))
|
LL | | ))))))))))))))))))))))))))))))
|
||||||
LL | | ))))))))))))))))))))))));
|
LL | | ))))))))))))))))))))))));
|
||||||
| |____________________________^ expected `()`, found enum `Result`
|
| |____________________________^ expected `()`, found enum `Result`
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found enum `Result<Result<Result<Result<Result<..., ...>, ...>, ...>, ...>, ...>`
|
found enum `Result<Result<..., ...>, ...>`
|
||||||
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
|
@ -5,8 +5,7 @@ LL | vec!['a'].iter().map(|c| c)
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Map`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Map`
|
||||||
|
|
|
|
||||||
= note: expected unit type `()`
|
= note: expected unit type `()`
|
||||||
found struct `Map<std::slice::Iter<'_, char>, ...>`
|
found struct `Map<std::slice::Iter<'_, char>, [closure@$DIR/return_type_containing_closure.rs:4:26: 4:29]>`
|
||||||
the full type name has been written to '$TEST_BUILD_DIR/typeck/return_type_containing_closure/return_type_containing_closure.long-type-hash.txt'
|
|
||||||
help: consider using a semicolon here
|
help: consider using a semicolon here
|
||||||
|
|
|
|
||||||
LL | vec!['a'].iter().map(|c| c);
|
LL | vec!['a'].iter().map(|c| c);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue