Point at method call when it is the source of the bound error
This commit is contained in:
parent
ce486d538b
commit
2838b8e515
29 changed files with 93 additions and 161 deletions
|
@ -370,7 +370,11 @@ impl Diagnostic {
|
||||||
self.set_span(after);
|
self.set_span(after);
|
||||||
for span_label in before.span_labels() {
|
for span_label in before.span_labels() {
|
||||||
if let Some(label) = span_label.label {
|
if let Some(label) = span_label.label {
|
||||||
self.span.push_span_label(after, label);
|
if span_label.is_primary {
|
||||||
|
self.span.push_span_label(after, label);
|
||||||
|
} else {
|
||||||
|
self.span.push_span_label(span_label.span, label);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self
|
self
|
||||||
|
|
|
@ -3108,6 +3108,16 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
point_at_chain(expr);
|
point_at_chain(expr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let call_node = hir.find(call_hir_id);
|
||||||
|
if let Some(Node::Expr(hir::Expr {
|
||||||
|
kind: hir::ExprKind::MethodCall(path, rcvr, ..),
|
||||||
|
..
|
||||||
|
})) = call_node
|
||||||
|
{
|
||||||
|
if Some(rcvr.span) == err.span.primary_span() {
|
||||||
|
err.replace_span_with(path.ident.span);
|
||||||
|
}
|
||||||
|
}
|
||||||
if let Some(Node::Expr(hir::Expr {
|
if let Some(Node::Expr(hir::Expr {
|
||||||
kind:
|
kind:
|
||||||
hir::ExprKind::Call(hir::Expr { span, .. }, _)
|
hir::ExprKind::Call(hir::Expr { span, .. }, _)
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied
|
error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied
|
||||||
--> $DIR/issue-101020.rs:31:5
|
--> $DIR/issue-101020.rs:31:22
|
||||||
|
|
|
|
||||||
LL | (&mut EmptyIter).consume(());
|
LL | (&mut EmptyIter).consume(());
|
||||||
| ^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()`
|
||||||
| |
|
|
||||||
| the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()`
|
|
||||||
|
|
|
|
||||||
note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>`
|
note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>`
|
||||||
--> $DIR/issue-101020.rs:27:20
|
--> $DIR/issue-101020.rs:27:20
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `X: Ord` is not satisfied
|
error[E0277]: the trait bound `X: Ord` is not satisfied
|
||||||
--> $DIR/issue-20162.rs:5:5
|
--> $DIR/issue-20162.rs:5:7
|
||||||
|
|
|
|
||||||
LL | b.sort();
|
LL | b.sort();
|
||||||
| ^ ---- required by a bound introduced by this call
|
| ^^^^ the trait `Ord` is not implemented for `X`
|
||||||
| |
|
|
||||||
| the trait `Ord` is not implemented for `X`
|
|
||||||
|
|
|
|
||||||
note: required by a bound in `slice::<impl [T]>::sort`
|
note: required by a bound in `slice::<impl [T]>::sort`
|
||||||
--> $SRC_DIR/alloc/src/slice.rs:LL:COL
|
--> $SRC_DIR/alloc/src/slice.rs:LL:COL
|
||||||
|
|
|
@ -4,12 +4,11 @@ pub fn get_tok(it: &mut IntoIter<u8>) {
|
||||||
let mut found_e = false;
|
let mut found_e = false;
|
||||||
|
|
||||||
let temp: Vec<u8> = it
|
let temp: Vec<u8> = it
|
||||||
//~^ ERROR to be an iterator that yields `&_`, but it yields `u8`
|
|
||||||
.take_while(|&x| {
|
.take_while(|&x| {
|
||||||
found_e = true;
|
found_e = true;
|
||||||
false
|
false
|
||||||
})
|
})
|
||||||
.cloned()
|
.cloned() //~ ERROR to be an iterator that yields `&_`, but it yields `u8`
|
||||||
.collect(); //~ ERROR the method
|
.collect(); //~ ERROR the method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>` to be an iterator that yields `&_`, but it yields `u8`
|
error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>` to be an iterator that yields `&_`, but it yields `u8`
|
||||||
--> $DIR/issue-31173.rs:6:25
|
--> $DIR/issue-31173.rs:11:10
|
||||||
|
|
|
|
||||||
LL | let temp: Vec<u8> = it
|
LL | .cloned()
|
||||||
| _________________________^
|
| ^^^^^^ expected reference, found `u8`
|
||||||
LL | |
|
|
||||||
LL | | .take_while(|&x| {
|
|
||||||
LL | | found_e = true;
|
|
||||||
LL | | false
|
|
||||||
LL | | })
|
|
||||||
| |__________^ expected reference, found `u8`
|
|
||||||
LL | .cloned()
|
|
||||||
| ------ required by a bound introduced by this call
|
|
||||||
|
|
|
|
||||||
= note: expected reference `&_`
|
= note: expected reference `&_`
|
||||||
found type `u8`
|
found type `u8`
|
||||||
|
@ -20,11 +12,11 @@ note: required by a bound in `cloned`
|
||||||
LL | Self: Sized + Iterator<Item = &'a T>,
|
LL | Self: Sized + Iterator<Item = &'a T>,
|
||||||
| ^^^^^^^^^^^^ required by this bound in `Iterator::cloned`
|
| ^^^^^^^^^^^^ required by this bound in `Iterator::cloned`
|
||||||
|
|
||||||
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>`, but its trait bounds were not satisfied
|
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>`, but its trait bounds were not satisfied
|
||||||
--> $DIR/issue-31173.rs:13: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:8:21: 8:25]>>` due to unsatisfied trait bounds
|
| ^^^^^^^ 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
|
||||||
|
|
|
|
||||||
::: $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL
|
::: $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL
|
||||||
|
|
|
|
||||||
|
@ -37,10 +29,10 @@ LL | pub struct Cloned<I> {
|
||||||
| -------------------- doesn't satisfy `_: Iterator`
|
| -------------------- doesn't satisfy `_: Iterator`
|
||||||
|
|
|
|
||||||
= note: the following trait bounds were not satisfied:
|
= note: the following trait bounds were not satisfied:
|
||||||
`<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]> as Iterator>::Item = &_`
|
`<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]> as Iterator>::Item = &_`
|
||||||
which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator`
|
which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
|
||||||
`Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator`
|
`Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
|
||||||
which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator`
|
which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
|
error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
|
||||||
--> $DIR/issue-33941.rs:6:14
|
--> $DIR/issue-33941.rs:6:36
|
||||||
|
|
|
|
||||||
LL | for _ in HashMap::new().iter().cloned() {}
|
LL | for _ in HashMap::new().iter().cloned() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ ------ required by a bound introduced by this call
|
| ^^^^^^ expected reference, found tuple
|
||||||
| |
|
|
||||||
| expected reference, found tuple
|
|
||||||
|
|
|
|
||||||
= note: expected reference `&_`
|
= note: expected reference `&_`
|
||||||
found tuple `(&_, &_)`
|
found tuple `(&_, &_)`
|
||||||
|
|
|
@ -13,12 +13,10 @@ LL | let sr: Vec<(u32, _, _)> = vec![];
|
||||||
| +
|
| +
|
||||||
|
|
||||||
error[E0277]: a value of type `Vec<(u32, _, _)>` cannot be built from an iterator over elements of type `()`
|
error[E0277]: a value of type `Vec<(u32, _, _)>` cannot be built from an iterator over elements of type `()`
|
||||||
--> $DIR/issue-34334.rs:5:33
|
--> $DIR/issue-34334.rs:5:87
|
||||||
|
|
|
|
||||||
LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
|
LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>`
|
||||||
| |
|
|
||||||
| value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>`
|
= help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>`
|
||||||
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64`
|
error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64`
|
||||||
--> $DIR/issue-66923-show-error-for-correct-call.rs:8:24
|
--> $DIR/issue-66923-show-error-for-correct-call.rs:8:39
|
||||||
|
|
|
|
||||||
LL | let x2: Vec<f64> = x1.into_iter().collect();
|
LL | let x2: Vec<f64> = x1.into_iter().collect();
|
||||||
| ^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
||||||
| |
|
|
||||||
| value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
|
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
|
||||||
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
||||||
|
@ -22,12 +20,10 @@ LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
|
||||||
|
|
||||||
error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64`
|
error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64`
|
||||||
--> $DIR/issue-66923-show-error-for-correct-call.rs:12:14
|
--> $DIR/issue-66923-show-error-for-correct-call.rs:12:29
|
||||||
|
|
|
|
||||||
LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
|
LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
|
||||||
| ^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
||||||
| |
|
|
||||||
| value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
|
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
|
||||||
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
||||||
|
|
|
@ -3,5 +3,4 @@ fn main() {
|
||||||
//~^ ERROR an array of type `[u32; 10]` cannot be built directly from an iterator
|
//~^ ERROR an array of type `[u32; 10]` cannot be built directly from an iterator
|
||||||
//~| NOTE try collecting into a `Vec<{integer}>`, then using `.try_into()`
|
//~| NOTE try collecting into a `Vec<{integer}>`, then using `.try_into()`
|
||||||
//~| NOTE required by a bound in `collect`
|
//~| NOTE required by a bound in `collect`
|
||||||
//~| NOTE required by a bound introduced by this call
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: an array of type `[u32; 10]` cannot be built directly from an iterator
|
error[E0277]: an array of type `[u32; 10]` cannot be built directly from an iterator
|
||||||
--> $DIR/collect-into-array.rs:2:31
|
--> $DIR/collect-into-array.rs:2:39
|
||||||
|
|
|
|
||||||
LL | let whatever: [u32; 10] = (0..10).collect();
|
LL | let whatever: [u32; 10] = (0..10).collect();
|
||||||
| ^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ try collecting into a `Vec<{integer}>`, then using `.try_into()`
|
||||||
| |
|
|
||||||
| try collecting into a `Vec<{integer}>`, then using `.try_into()`
|
|
||||||
|
|
|
|
||||||
= help: the trait `FromIterator<{integer}>` is not implemented for `[u32; 10]`
|
= help: the trait `FromIterator<{integer}>` is not implemented for `[u32; 10]`
|
||||||
note: required by a bound in `collect`
|
note: required by a bound in `collect`
|
||||||
|
|
|
@ -13,6 +13,5 @@ fn main() {
|
||||||
//~| NOTE all local variables must have a statically known size
|
//~| NOTE all local variables must have a statically known size
|
||||||
//~| NOTE doesn't have a size known at compile-time
|
//~| NOTE doesn't have a size known at compile-time
|
||||||
//~| NOTE doesn't have a size known at compile-time
|
//~| NOTE doesn't have a size known at compile-time
|
||||||
//~| NOTE required by a bound introduced by this call
|
|
||||||
process_slice(&some_generated_vec);
|
process_slice(&some_generated_vec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,10 @@ LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
|
||||||
| ^ required by this bound in `Iterator::collect`
|
| ^ required by this bound in `Iterator::collect`
|
||||||
|
|
||||||
error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
|
error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
|
||||||
--> $DIR/collect-into-slice.rs:6:30
|
--> $DIR/collect-into-slice.rs:6:38
|
||||||
|
|
|
|
||||||
LL | let some_generated_vec = (0..10).collect();
|
LL | let some_generated_vec = (0..10).collect();
|
||||||
| ^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ try explicitly collecting into a `Vec<{integer}>`
|
||||||
| |
|
|
||||||
| try explicitly collecting into a `Vec<{integer}>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
|
= help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
|
||||||
note: required by a bound in `collect`
|
note: required by a bound in `collect`
|
||||||
|
|
|
@ -7,7 +7,7 @@ fn main() {
|
||||||
println!("{}", scores.sum::<i32>()); //~ ERROR E0277
|
println!("{}", scores.sum::<i32>()); //~ ERROR E0277
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
vec![0, 1] //~ ERROR E0277
|
vec![0, 1]
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| x * 2)
|
.map(|x| x * 2)
|
||||||
.map(|x| x as f64)
|
.map(|x| x as f64)
|
||||||
|
@ -15,17 +15,17 @@ fn main() {
|
||||||
.filter(|x| *x > 0)
|
.filter(|x| *x > 0)
|
||||||
.map(|x| { x + 1 })
|
.map(|x| { x + 1 })
|
||||||
.map(|x| { x; })
|
.map(|x| { x; })
|
||||||
.sum::<i32>(),
|
.sum::<i32>(), //~ ERROR E0277
|
||||||
);
|
);
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
vec![0, 1] //~ ERROR E0277
|
vec![0, 1]
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| x * 2)
|
.map(|x| x * 2)
|
||||||
.map(|x| x as f64)
|
.map(|x| x as f64)
|
||||||
.filter(|x| *x > 0.0)
|
.filter(|x| *x > 0.0)
|
||||||
.map(|x| { x + 1.0 })
|
.map(|x| { x + 1.0 })
|
||||||
.sum::<i32>(),
|
.sum::<i32>(), //~ ERROR E0277
|
||||||
);
|
);
|
||||||
println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>()); //~ ERROR E0277
|
println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>()); //~ ERROR E0277
|
||||||
println!("{}", vec![(), ()].iter().sum::<i32>()); //~ ERROR E0277
|
println!("{}", vec![(), ()].iter().sum::<i32>()); //~ ERROR E0277
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
|
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
|
||||||
--> $DIR/invalid-iterator-chain.rs:7:20
|
--> $DIR/invalid-iterator-chain.rs:7:27
|
||||||
|
|
|
|
||||||
LL | println!("{}", scores.sum::<i32>());
|
LL | println!("{}", scores.sum::<i32>());
|
||||||
| ^^^^^^ --- required by a bound introduced by this call
|
| ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
|
||||||
| |
|
|
||||||
| value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `Sum<()>` is not implemented for `i32`
|
= help: the trait `Sum<()>` is not implemented for `i32`
|
||||||
= help: the following other types implement trait `Sum<A>`:
|
= help: the following other types implement trait `Sum<A>`:
|
||||||
|
@ -29,18 +27,10 @@ LL | S: Sum<Self::Item>,
|
||||||
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
||||||
|
|
||||||
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
|
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
|
||||||
--> $DIR/invalid-iterator-chain.rs:10:9
|
--> $DIR/invalid-iterator-chain.rs:18:14
|
||||||
|
|
|
|
||||||
LL | / vec![0, 1]
|
LL | .sum::<i32>(),
|
||||||
LL | | .iter()
|
| ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
|
||||||
LL | | .map(|x| x * 2)
|
|
||||||
LL | | .map(|x| x as f64)
|
|
||||||
... |
|
|
||||||
LL | | .map(|x| { x + 1 })
|
|
||||||
LL | | .map(|x| { x; })
|
|
||||||
| |____________________________^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
|
|
||||||
LL | .sum::<i32>(),
|
|
||||||
| --- required by a bound introduced by this call
|
|
||||||
|
|
|
|
||||||
= help: the trait `Sum<()>` is not implemented for `i32`
|
= help: the trait `Sum<()>` is not implemented for `i32`
|
||||||
= help: the following other types implement trait `Sum<A>`:
|
= help: the following other types implement trait `Sum<A>`:
|
||||||
|
@ -72,17 +62,10 @@ LL | S: Sum<Self::Item>,
|
||||||
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
||||||
|
|
||||||
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64`
|
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64`
|
||||||
--> $DIR/invalid-iterator-chain.rs:22:9
|
--> $DIR/invalid-iterator-chain.rs:28:14
|
||||||
|
|
|
|
||||||
LL | / vec![0, 1]
|
LL | .sum::<i32>(),
|
||||||
LL | | .iter()
|
| ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=f64>`
|
||||||
LL | | .map(|x| x * 2)
|
|
||||||
LL | | .map(|x| x as f64)
|
|
||||||
LL | | .filter(|x| *x > 0.0)
|
|
||||||
LL | | .map(|x| { x + 1.0 })
|
|
||||||
| |_________________________________^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=f64>`
|
|
||||||
LL | .sum::<i32>(),
|
|
||||||
| --- required by a bound introduced by this call
|
|
||||||
|
|
|
|
||||||
= help: the trait `Sum<f64>` is not implemented for `i32`
|
= help: the trait `Sum<f64>` is not implemented for `i32`
|
||||||
= help: the following other types implement trait `Sum<A>`:
|
= help: the following other types implement trait `Sum<A>`:
|
||||||
|
@ -110,12 +93,10 @@ LL | S: Sum<Self::Item>,
|
||||||
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
||||||
|
|
||||||
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
|
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
|
||||||
--> $DIR/invalid-iterator-chain.rs:30:20
|
--> $DIR/invalid-iterator-chain.rs:30:54
|
||||||
|
|
|
|
||||||
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
|
LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- required by a bound introduced by this call
|
| ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
|
||||||
| |
|
|
||||||
| value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `Sum<()>` is not implemented for `i32`
|
= help: the trait `Sum<()>` is not implemented for `i32`
|
||||||
= help: the following other types implement trait `Sum<A>`:
|
= help: the following other types implement trait `Sum<A>`:
|
||||||
|
@ -136,12 +117,10 @@ LL | S: Sum<Self::Item>,
|
||||||
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
||||||
|
|
||||||
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
|
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
|
||||||
--> $DIR/invalid-iterator-chain.rs:31:20
|
--> $DIR/invalid-iterator-chain.rs:31:40
|
||||||
|
|
|
|
||||||
LL | println!("{}", vec![(), ()].iter().sum::<i32>());
|
LL | println!("{}", vec![(), ()].iter().sum::<i32>());
|
||||||
| ^^^^^^^^^^^^^^^^^^^ --- required by a bound introduced by this call
|
| ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
|
||||||
| |
|
|
||||||
| value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `Sum<&()>` is not implemented for `i32`
|
= help: the trait `Sum<&()>` is not implemented for `i32`
|
||||||
= help: the following other types implement trait `Sum<A>`:
|
= help: the following other types implement trait `Sum<A>`:
|
||||||
|
@ -161,12 +140,10 @@ LL | S: Sum<Self::Item>,
|
||||||
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
||||||
|
|
||||||
error[E0277]: a value of type `Vec<i32>` cannot be built from an iterator over elements of type `()`
|
error[E0277]: a value of type `Vec<i32>` cannot be built from an iterator over elements of type `()`
|
||||||
--> $DIR/invalid-iterator-chain.rs:40:23
|
--> $DIR/invalid-iterator-chain.rs:40:25
|
||||||
|
|
|
|
||||||
LL | let g: Vec<i32> = f.collect();
|
LL | let g: Vec<i32> = f.collect();
|
||||||
| ^ ------- required by a bound introduced by this call
|
| ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
|
||||||
| |
|
|
||||||
| value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
|
= help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
|
||||||
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_`
|
error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_`
|
||||||
--> $DIR/branches.rs:19:9
|
--> $DIR/branches.rs:19:28
|
||||||
|
|
|
|
||||||
LL | std::iter::empty().collect()
|
LL | std::iter::empty().collect()
|
||||||
| ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>`
|
||||||
| |
|
|
||||||
| value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `FromIterator<_>` is not implemented for `Bar`
|
= help: the trait `FromIterator<_>` is not implemented for `Bar`
|
||||||
note: required by a bound in `collect`
|
note: required by a bound in `collect`
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: a value of type `Foo` cannot be built from an iterator over elements of type `_`
|
error[E0277]: a value of type `Foo` cannot be built from an iterator over elements of type `_`
|
||||||
--> $DIR/recursion4.rs:10:9
|
--> $DIR/recursion4.rs:10:28
|
||||||
|
|
|
|
||||||
LL | x = std::iter::empty().collect();
|
LL | x = std::iter::empty().collect();
|
||||||
| ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ value of type `Foo` cannot be built from `std::iter::Iterator<Item=_>`
|
||||||
| |
|
|
||||||
| value of type `Foo` cannot be built from `std::iter::Iterator<Item=_>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `FromIterator<_>` is not implemented for `Foo`
|
= help: the trait `FromIterator<_>` is not implemented for `Foo`
|
||||||
note: required by a bound in `collect`
|
note: required by a bound in `collect`
|
||||||
|
@ -14,12 +12,10 @@ LL | fn collect<B: FromIterator<Self::Item>>(self) -> B
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::collect`
|
||||||
|
|
||||||
error[E0277]: a value of type `impl Debug` cannot be built from an iterator over elements of type `_`
|
error[E0277]: a value of type `impl Debug` cannot be built from an iterator over elements of type `_`
|
||||||
--> $DIR/recursion4.rs:19:9
|
--> $DIR/recursion4.rs:19:28
|
||||||
|
|
|
|
||||||
LL | x = std::iter::empty().collect();
|
LL | x = std::iter::empty().collect();
|
||||||
| ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ value of type `impl Debug` cannot be built from `std::iter::Iterator<Item=_>`
|
||||||
| |
|
|
||||||
| value of type `impl Debug` cannot be built from `std::iter::Iterator<Item=_>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `FromIterator<_>` is not implemented for `impl Debug`
|
= help: the trait `FromIterator<_>` is not implemented for `impl Debug`
|
||||||
note: required by a bound in `collect`
|
note: required by a bound in `collect`
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: `Foo` doesn't implement `Debug`
|
error[E0277]: `Foo` doesn't implement `Debug`
|
||||||
--> $DIR/method-help-unsatisfied-bound.rs:5:5
|
--> $DIR/method-help-unsatisfied-bound.rs:5:7
|
||||||
|
|
|
|
||||||
LL | a.unwrap();
|
LL | a.unwrap();
|
||||||
| ^ ------ required by a bound introduced by this call
|
| ^^^^^^ `Foo` cannot be formatted using `{:?}`
|
||||||
| |
|
|
||||||
| `Foo` cannot be formatted using `{:?}`
|
|
||||||
|
|
|
|
||||||
= help: the trait `Debug` is not implemented for `Foo`
|
= help: the trait `Debug` is not implemented for `Foo`
|
||||||
= note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo`
|
= note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo`
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`
|
error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`
|
||||||
--> $DIR/not-clone-closure.rs:11:17
|
--> $DIR/not-clone-closure.rs:11:23
|
||||||
|
|
|
|
||||||
LL | let hello = move || {
|
LL | let hello = move || {
|
||||||
| ------- within this `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`
|
| ------- within this `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`
|
||||||
...
|
...
|
||||||
LL | let hello = hello.clone();
|
LL | let hello = hello.clone();
|
||||||
| ^^^^^ ----- required by a bound introduced by this call
|
| ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S`
|
||||||
| |
|
|
||||||
| within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S`
|
|
||||||
|
|
|
|
||||||
note: required because it's used within this closure
|
note: required because it's used within this closure
|
||||||
--> $DIR/not-clone-closure.rs:7:17
|
--> $DIR/not-clone-closure.rs:7:17
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
|
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
|
||||||
--> $DIR/sum.rs:4:5
|
--> $DIR/sum.rs:4:25
|
||||||
|
|
|
|
||||||
LL | vec![(), ()].iter().sum::<i32>();
|
LL | vec![(), ()].iter().sum::<i32>();
|
||||||
| ^^^^^^^^^^^^^^^^^^^ --- required by a bound introduced by this call
|
| ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
|
||||||
| |
|
|
||||||
| value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `Sum<&()>` is not implemented for `i32`
|
= help: the trait `Sum<&()>` is not implemented for `i32`
|
||||||
= help: the following other types implement trait `Sum<A>`:
|
= help: the following other types implement trait `Sum<A>`:
|
||||||
|
@ -24,12 +22,10 @@ LL | S: Sum<Self::Item>,
|
||||||
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
| ^^^^^^^^^^^^^^^ required by this bound in `Iterator::sum`
|
||||||
|
|
||||||
error[E0277]: a value of type `i32` cannot be made by multiplying all elements of type `&()` from an iterator
|
error[E0277]: a value of type `i32` cannot be made by multiplying all elements of type `&()` from an iterator
|
||||||
--> $DIR/sum.rs:7:5
|
--> $DIR/sum.rs:7:25
|
||||||
|
|
|
|
||||||
LL | vec![(), ()].iter().product::<i32>();
|
LL | vec![(), ()].iter().product::<i32>();
|
||||||
| ^^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call
|
| ^^^^^^^ value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator<Item=&()>`
|
||||||
| |
|
|
||||||
| value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator<Item=&()>`
|
|
||||||
|
|
|
|
||||||
= help: the trait `Product<&()>` is not implemented for `i32`
|
= help: the trait `Product<&()>` is not implemented for `i32`
|
||||||
= help: the following other types implement trait `Product<A>`:
|
= help: the following other types implement trait `Product<A>`:
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied
|
error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied
|
||||||
--> $DIR/const-default-method-bodies.rs:24:5
|
--> $DIR/const-default-method-bodies.rs:24:18
|
||||||
|
|
|
|
||||||
LL | NonConstImpl.a();
|
LL | NonConstImpl.a();
|
||||||
| ^^^^^^^^^^^^ - required by a bound introduced by this call
|
| ^ the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl`
|
||||||
| |
|
|
||||||
| the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl`
|
|
||||||
|
|
|
|
||||||
note: the trait `ConstDefaultFn` is implemented for `NonConstImpl`, but that implementation is not `const`
|
note: the trait `ConstDefaultFn` is implemented for `NonConstImpl`, but that implementation is not `const`
|
||||||
--> $DIR/const-default-method-bodies.rs:24:5
|
--> $DIR/const-default-method-bodies.rs:24:5
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrait` is not satisfied
|
error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrait` is not satisfied
|
||||||
--> $DIR/cross-crate.rs:17:5
|
--> $DIR/cross-crate.rs:17:14
|
||||||
|
|
|
|
||||||
LL | NonConst.func();
|
LL | NonConst.func();
|
||||||
| ^^^^^^^^ ---- required by a bound introduced by this call
|
| ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
|
||||||
| |
|
|
||||||
| the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
|
|
||||||
|
|
|
|
||||||
note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const`
|
note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const`
|
||||||
--> $DIR/cross-crate.rs:17:5
|
--> $DIR/cross-crate.rs:17:5
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `cross_crate::NonConst: cross_crate::MyTrait` is not satisfied
|
error[E0277]: the trait bound `cross_crate::NonConst: cross_crate::MyTrait` is not satisfied
|
||||||
--> $DIR/cross-crate.rs:17:5
|
--> $DIR/cross-crate.rs:17:14
|
||||||
|
|
|
|
||||||
LL | NonConst.func();
|
LL | NonConst.func();
|
||||||
| ^^^^^^^^ ---- required by a bound introduced by this call
|
| ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
|
||||||
| |
|
|
||||||
| the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
|
|
||||||
|
|
|
|
||||||
note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const`
|
note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const`
|
||||||
--> $DIR/cross-crate.rs:17:5
|
--> $DIR/cross-crate.rs:17:5
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `(): ~const Tr` is not satisfied
|
error[E0277]: the trait bound `(): ~const Tr` is not satisfied
|
||||||
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:9
|
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12
|
||||||
|
|
|
|
||||||
LL | ().a()
|
LL | ().a()
|
||||||
| ^^ - required by a bound introduced by this call
|
| ^ the trait `~const Tr` is not implemented for `()`
|
||||||
| |
|
|
||||||
| the trait `~const Tr` is not implemented for `()`
|
|
||||||
|
|
|
|
||||||
note: the trait `Tr` is implemented for `()`, but that implementation is not `const`
|
note: the trait `Tr` is implemented for `()`, but that implementation is not `const`
|
||||||
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:9
|
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:9
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `T: ~const Foo` is not satisfied
|
error[E0277]: the trait bound `T: ~const Foo` is not satisfied
|
||||||
--> $DIR/super-traits-fail-2.rs:15:5
|
--> $DIR/super-traits-fail-2.rs:15:7
|
||||||
|
|
|
|
||||||
LL | x.a();
|
LL | x.a();
|
||||||
| ^ - required by a bound introduced by this call
|
| ^ the trait `~const Foo` is not implemented for `T`
|
||||||
| |
|
|
||||||
| the trait `~const Foo` is not implemented for `T`
|
|
||||||
|
|
|
|
||||||
note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
|
note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
|
||||||
--> $DIR/super-traits-fail-2.rs:15:5
|
--> $DIR/super-traits-fail-2.rs:15:5
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `T: ~const Foo` is not satisfied
|
error[E0277]: the trait bound `T: ~const Foo` is not satisfied
|
||||||
--> $DIR/super-traits-fail-2.rs:15:5
|
--> $DIR/super-traits-fail-2.rs:15:7
|
||||||
|
|
|
|
||||||
LL | x.a();
|
LL | x.a();
|
||||||
| ^ - required by a bound introduced by this call
|
| ^ the trait `~const Foo` is not implemented for `T`
|
||||||
| |
|
|
||||||
| the trait `~const Foo` is not implemented for `T`
|
|
||||||
|
|
|
|
||||||
note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
|
note: the trait `Foo` is implemented for `T`, but that implementation is not `const`
|
||||||
--> $DIR/super-traits-fail-2.rs:15:5
|
--> $DIR/super-traits-fail-2.rs:15:5
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied
|
error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied
|
||||||
--> $DIR/issue-71394-no-from-impl.rs:3:20
|
--> $DIR/issue-71394-no-from-impl.rs:3:25
|
||||||
|
|
|
|
||||||
LL | let _: &[i8] = data.into();
|
LL | let _: &[i8] = data.into();
|
||||||
| ^^^^ ---- required by a bound introduced by this call
|
| ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`
|
||||||
| |
|
|
||||||
| the trait `From<&[u8]>` is not implemented for `&[i8]`
|
|
||||||
|
|
|
|
||||||
= help: the following other types implement trait `From<T>`:
|
= help: the following other types implement trait `From<T>`:
|
||||||
<[T; LANES] as From<Simd<T, LANES>>>
|
<[T; LANES] as From<Simd<T, LANES>>>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `String: From<impl ToString>` is not satisfied
|
error[E0277]: the trait bound `String: From<impl ToString>` is not satisfied
|
||||||
--> $DIR/issue-97576.rs:8:18
|
--> $DIR/issue-97576.rs:8:22
|
||||||
|
|
|
|
||||||
LL | bar: bar.into(),
|
LL | bar: bar.into(),
|
||||||
| ^^^ ---- required by a bound introduced by this call
|
| ^^^^ the trait `From<impl ToString>` is not implemented for `String`
|
||||||
| |
|
|
||||||
| the trait `From<impl ToString>` is not implemented for `String`
|
|
||||||
|
|
|
|
||||||
= note: required for `impl ToString` to implement `Into<String>`
|
= note: required for `impl ToString` to implement `Into<String>`
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied
|
error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied
|
||||||
--> $DIR/issue-71659.rs:30:13
|
--> $DIR/issue-71659.rs:30:15
|
||||||
|
|
|
|
||||||
LL | let x = x.cast::<[i32]>();
|
LL | let x = x.cast::<[i32]>();
|
||||||
| ^ ---- required by a bound introduced by this call
|
| ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo`
|
||||||
| |
|
|
||||||
| the trait `CastTo<[i32]>` is not implemented for `dyn Foo`
|
|
||||||
|
|
|
|
||||||
note: required by a bound in `Cast::cast`
|
note: required by a bound in `Cast::cast`
|
||||||
--> $DIR/issue-71659.rs:19:15
|
--> $DIR/issue-71659.rs:19:15
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue