Rollup merge of #105715 - estebank:unsatisfied-bounds-label, r=compiler-errors

Do not mention long types in E0599 label

The type is already mentioned in the main message and the list of unmet bounds.
This commit is contained in:
Matthias Krüger 2022-12-15 12:46:04 +01:00 committed by GitHub
commit cb9bcafe0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

View File

@ -893,7 +893,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} }
} }
} else { } else {
err.span_label(span, format!("{item_kind} cannot be called on `{ty_str}` due to unsatisfied trait bounds")); let ty_str = if ty_str.len() > 50 {
String::new()
} else {
format!("on `{ty_str}` ")
};
err.span_label(span, format!(
"{item_kind} cannot be called {ty_str}due to unsatisfied trait bounds"
));
} }
}; };

View File

@ -8,7 +8,7 @@ LL | pub struct Map<S, F> {
| doesn't satisfy `_: StreamExt` | doesn't satisfy `_: StreamExt`
... ...
LL | let filter = map.filterx(|x: &_| true); LL | let filter = map.filterx(|x: &_| true);
| ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>` due to unsatisfied trait bounds | ^^^^^^^ method cannot be called due to unsatisfied trait bounds
| |
note: the following trait bounds were not satisfied: note: the following trait bounds were not satisfied:
`&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>: Stream` `&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>: Stream`
@ -29,7 +29,7 @@ LL | pub struct Filter<S, F> {
| doesn't satisfy `_: StreamExt` | doesn't satisfy `_: StreamExt`
... ...
LL | let count = filter.countx(); LL | let count = filter.countx();
| ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>` due to unsatisfied trait bounds | ^^^^^^ method cannot be called due to unsatisfied trait bounds
| |
note: the following trait bounds were not satisfied: note: the following trait bounds were not satisfied:
`&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` `&'a mut &Filter<Map<Repeat, for<'a> fn(&'a u64) -> &'a u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream`

View File

@ -13,7 +13,7 @@ error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std:
--> $DIR/issue-31173.rs:12:10 --> $DIR/issue-31173.rs:12:10
| |
LL | .collect(); LL | .collect();
| ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>` due to unsatisfied trait bounds | ^^^^^^^ method cannot be called due to unsatisfied trait bounds
--> $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL --> $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL
| |
= note: doesn't satisfy `<_ as Iterator>::Item = &_` = note: doesn't satisfy `<_ as Iterator>::Item = &_`

View File

@ -17,7 +17,7 @@ error[E0599]: the method `count` exists for struct `Filter<Fuse<std::iter::Once<
--> $DIR/issue-36053-2.rs:7:55 --> $DIR/issue-36053-2.rs:7:55
| |
LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
| --------- ^^^^^ method cannot be called on `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>` due to unsatisfied trait bounds | --------- ^^^^^ method cannot be called due to unsatisfied trait bounds
| | | |
| doesn't satisfy `<_ as FnOnce<(&&str,)>>::Output = bool` | doesn't satisfy `<_ as FnOnce<(&&str,)>>::Output = bool`
| doesn't satisfy `_: FnMut<(&&str,)>` | doesn't satisfy `_: FnMut<(&&str,)>`