mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Remove unnecessary select_obligations_where_possible
and redundant errors
This commit is contained in:
parent
b6494a7bb4
commit
ef11db803c
@ -322,7 +322,6 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
|
|||||||
ty.kind()
|
ty.kind()
|
||||||
{
|
{
|
||||||
self.add_required_obligations_for_hir(span, *def_id, args, hir_id);
|
self.add_required_obligations_for_hir(span, *def_id, args, hir_id);
|
||||||
self.select_obligations_where_possible(|_| {});
|
|
||||||
}
|
}
|
||||||
self.normalize(span, ty)
|
self.normalize(span, ty)
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,7 +9,6 @@ trait Foo<T> {
|
|||||||
fn f<T:Foo<isize>>(t: &T) {
|
fn f<T:Foo<isize>>(t: &T) {
|
||||||
let u: <T as Foo<usize>>::Bar = t.get_bar();
|
let u: <T as Foo<usize>>::Bar = t.get_bar();
|
||||||
//~^ ERROR the trait bound `T: Foo<usize>` is not satisfied
|
//~^ ERROR the trait bound `T: Foo<usize>` is not satisfied
|
||||||
//~| ERROR the trait bound `T: Foo<usize>` is not satisfied
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
@ -9,17 +9,6 @@ help: consider further restricting this bound
|
|||||||
LL | fn f<T:Foo<isize> + Foo<usize>>(t: &T) {
|
LL | fn f<T:Foo<isize> + Foo<usize>>(t: &T) {
|
||||||
| ++++++++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0277]: the trait bound `T: Foo<usize>` is not satisfied
|
error: aborting due to previous error
|
||||||
--> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:10:12
|
|
||||||
|
|
|
||||||
LL | let u: <T as Foo<usize>>::Bar = t.get_bar();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<usize>` is not implemented for `T`
|
|
||||||
|
|
|
||||||
help: consider further restricting this bound
|
|
||||||
|
|
|
||||||
LL | fn f<T:Foo<isize> + Foo<usize>>(t: &T) {
|
|
||||||
| ++++++++++++
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
@ -7,5 +7,4 @@ impl Trait for () {
|
|||||||
fn main() {
|
fn main() {
|
||||||
let _: <() as Trait>::P<String, String>;
|
let _: <() as Trait>::P<String, String>;
|
||||||
//~^ ERROR the trait bound `String: Copy` is not satisfied
|
//~^ ERROR the trait bound `String: Copy` is not satisfied
|
||||||
//~| ERROR the trait bound `String: Copy` is not satisfied
|
|
||||||
}
|
}
|
||||||
|
@ -10,18 +10,6 @@ note: required by a bound in `Trait::P`
|
|||||||
LL | type P<T: Copy, U: Copy>;
|
LL | type P<T: Copy, U: Copy>;
|
||||||
| ^^^^ required by this bound in `Trait::P`
|
| ^^^^ required by this bound in `Trait::P`
|
||||||
|
|
||||||
error[E0277]: the trait bound `String: Copy` is not satisfied
|
error: aborting due to previous error
|
||||||
--> $DIR/multiple-type-params-with-unmet-bounds.rs:8:12
|
|
||||||
|
|
|
||||||
LL | let _: <() as Trait>::P<String, String>;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
|
||||||
|
|
|
||||||
note: required by a bound in `Trait::P`
|
|
||||||
--> $DIR/multiple-type-params-with-unmet-bounds.rs:2:15
|
|
||||||
|
|
|
||||||
LL | type P<T: Copy, U: Copy>;
|
|
||||||
| ^^^^ required by this bound in `Trait::P`
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
@ -4,8 +4,6 @@ trait D {
|
|||||||
type P<T: Copy>;
|
type P<T: Copy>;
|
||||||
//~^ NOTE required by this bound in `D::P`
|
//~^ NOTE required by this bound in `D::P`
|
||||||
//~| NOTE required by a bound in `D::P`
|
//~| NOTE required by a bound in `D::P`
|
||||||
//~| NOTE required by this bound in `D::P`
|
|
||||||
//~| NOTE required by a bound in `D::P`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl D for S {
|
impl D for S {
|
||||||
@ -16,6 +14,4 @@ fn main() {
|
|||||||
let _: <S as D>::P<String>;
|
let _: <S as D>::P<String>;
|
||||||
//~^ ERROR the trait bound `String: Copy` is not satisfied
|
//~^ ERROR the trait bound `String: Copy` is not satisfied
|
||||||
//~| NOTE the trait `Copy` is not implemented for `String`
|
//~| NOTE the trait `Copy` is not implemented for `String`
|
||||||
//~| ERROR the trait bound `String: Copy` is not satisfied
|
|
||||||
//~| NOTE the trait `Copy` is not implemented for `String`
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0277]: the trait bound `String: Copy` is not satisfied
|
error[E0277]: the trait bound `String: Copy` is not satisfied
|
||||||
--> $DIR/own-bound-span.rs:16:24
|
--> $DIR/own-bound-span.rs:14:24
|
||||||
|
|
|
|
||||||
LL | let _: <S as D>::P<String>;
|
LL | let _: <S as D>::P<String>;
|
||||||
| ^^^^^^ the trait `Copy` is not implemented for `String`
|
| ^^^^^^ the trait `Copy` is not implemented for `String`
|
||||||
@ -10,18 +10,6 @@ note: required by a bound in `D::P`
|
|||||||
LL | type P<T: Copy>;
|
LL | type P<T: Copy>;
|
||||||
| ^^^^ required by this bound in `D::P`
|
| ^^^^ required by this bound in `D::P`
|
||||||
|
|
||||||
error[E0277]: the trait bound `String: Copy` is not satisfied
|
error: aborting due to previous error
|
||||||
--> $DIR/own-bound-span.rs:16:12
|
|
||||||
|
|
|
||||||
LL | let _: <S as D>::P<String>;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
|
|
||||||
|
|
|
||||||
note: required by a bound in `D::P`
|
|
||||||
--> $DIR/own-bound-span.rs:4:15
|
|
||||||
|
|
|
||||||
LL | type P<T: Copy>;
|
|
||||||
| ^^^^ required by this bound in `D::P`
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
@ -11,6 +11,5 @@ trait _A {
|
|||||||
fn main() {
|
fn main() {
|
||||||
_Func::< <() as _A>::AssocT >::func(());
|
_Func::< <() as _A>::AssocT >::func(());
|
||||||
//~^ ERROR the trait bound `(): _A` is not satisfied
|
//~^ ERROR the trait bound `(): _A` is not satisfied
|
||||||
//~| ERROR the trait bound `(): _A` is not satisfied
|
|
||||||
//~| ERROR the trait bound `(): _Func<_>` is not satisfied
|
//~| ERROR the trait bound `(): _Func<_>` is not satisfied
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,6 @@ error[E0277]: the trait bound `(): _A` is not satisfied
|
|||||||
LL | _Func::< <() as _A>::AssocT >::func(());
|
LL | _Func::< <() as _A>::AssocT >::func(());
|
||||||
| ^^ the trait `_A` is not implemented for `()`
|
| ^^ the trait `_A` is not implemented for `()`
|
||||||
|
|
||||||
error[E0277]: the trait bound `(): _A` is not satisfied
|
|
||||||
--> $DIR/issue-66353.rs:12:14
|
|
||||||
|
|
|
||||||
LL | _Func::< <() as _A>::AssocT >::func(());
|
|
||||||
| ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()`
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `(): _Func<_>` is not satisfied
|
error[E0277]: the trait bound `(): _Func<_>` is not satisfied
|
||||||
--> $DIR/issue-66353.rs:12:41
|
--> $DIR/issue-66353.rs:12:41
|
||||||
|
|
|
|
||||||
@ -18,6 +12,6 @@ LL | _Func::< <() as _A>::AssocT >::func(());
|
|||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
@ -12,7 +12,6 @@ fn bop<T: Bop + ?Sized>() {
|
|||||||
let _ = <T as Bop>::Bar::default();
|
let _ = <T as Bop>::Bar::default();
|
||||||
//~^ ERROR: trait bounds were not satisfied
|
//~^ ERROR: trait bounds were not satisfied
|
||||||
//~| ERROR: the size for values of type `T` cannot be known at compilation time
|
//~| ERROR: the size for values of type `T` cannot be known at compilation time
|
||||||
//~| ERROR: the size for values of type `T` cannot be known at compilation time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
error[E0599]: the function or associated item `default` exists for associated type `<T as Bop>::Bar`, but its trait bounds were not satisfied
|
||||||
|
--> $DIR/assoc_type_bounds_sized_used.rs:12:30
|
||||||
|
|
|
||||||
|
LL | let _ = <T as Bop>::Bar::default();
|
||||||
|
| ^^^^^^^ function or associated item cannot be called on `<T as Bop>::Bar` due to unsatisfied trait bounds
|
||||||
|
|
|
||||||
|
= note: the following trait bounds were not satisfied:
|
||||||
|
`T: Sized`
|
||||||
|
which is required by `<T as Bop>::Bar: Default`
|
||||||
|
help: consider restricting the type parameter to satisfy the trait bound
|
||||||
|
|
|
||||||
|
LL | fn bop<T: Bop + ?Sized>() where T: Sized {
|
||||||
|
| ++++++++++++++
|
||||||
|
|
||||||
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
||||||
--> $DIR/assoc_type_bounds_sized_used.rs:12:14
|
--> $DIR/assoc_type_bounds_sized_used.rs:12:14
|
||||||
|
|
|
|
||||||
@ -20,44 +34,8 @@ LL - fn bop<T: Bop + ?Sized>() {
|
|||||||
LL + fn bop<T: Bop>() {
|
LL + fn bop<T: Bop>() {
|
||||||
|
|
|
|
||||||
|
|
||||||
error[E0599]: the function or associated item `default` exists for associated type `<T as Bop>::Bar`, but its trait bounds were not satisfied
|
|
||||||
--> $DIR/assoc_type_bounds_sized_used.rs:12:30
|
|
||||||
|
|
|
||||||
LL | let _ = <T as Bop>::Bar::default();
|
|
||||||
| ^^^^^^^ function or associated item cannot be called on `<T as Bop>::Bar` due to unsatisfied trait bounds
|
|
||||||
|
|
|
||||||
= note: the following trait bounds were not satisfied:
|
|
||||||
`T: Sized`
|
|
||||||
which is required by `<T as Bop>::Bar: Default`
|
|
||||||
help: consider restricting the type parameter to satisfy the trait bound
|
|
||||||
|
|
|
||||||
LL | fn bop<T: Bop + ?Sized>() where T: Sized {
|
|
||||||
| ++++++++++++++
|
|
||||||
|
|
||||||
error[E0277]: the size for values of type `T` cannot be known at compilation time
|
|
||||||
--> $DIR/assoc_type_bounds_sized_used.rs:12:13
|
|
||||||
|
|
|
||||||
LL | fn bop<T: Bop + ?Sized>() {
|
|
||||||
| - this type parameter needs to be `Sized`
|
|
||||||
LL | let _ = <T as Bop>::Bar::default();
|
|
||||||
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
||||||
|
|
|
||||||
note: required by a bound in `Bop::Bar`
|
|
||||||
--> $DIR/assoc_type_bounds_sized_used.rs:8:15
|
|
||||||
|
|
|
||||||
LL | type Bar: Default
|
|
||||||
| --- required by a bound in this associated type
|
|
||||||
LL | where
|
|
||||||
LL | Self: Sized;
|
|
||||||
| ^^^^^ required by this bound in `Bop::Bar`
|
|
||||||
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
|
||||||
|
|
|
||||||
LL - fn bop<T: Bop + ?Sized>() {
|
|
||||||
LL + fn bop<T: Bop>() {
|
|
||||||
|
|
|
||||||
|
|
||||||
error[E0277]: the size for values of type `dyn Bop` cannot be known at compilation time
|
error[E0277]: the size for values of type `dyn Bop` cannot be known at compilation time
|
||||||
--> $DIR/assoc_type_bounds_sized_used.rs:19:11
|
--> $DIR/assoc_type_bounds_sized_used.rs:18:11
|
||||||
|
|
|
|
||||||
LL | bop::<dyn Bop>();
|
LL | bop::<dyn Bop>();
|
||||||
| ^^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^^ doesn't have a size known at compile-time
|
||||||
@ -69,7 +47,7 @@ note: required by a bound in `bop`
|
|||||||
LL | fn bop<T: Bop + ?Sized>() {
|
LL | fn bop<T: Bop + ?Sized>() {
|
||||||
| ^^^ required by this bound in `bop`
|
| ^^^ required by this bound in `bop`
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0277, E0599.
|
Some errors have detailed explanations: E0277, E0599.
|
||||||
For more information about an error, try `rustc --explain E0277`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
@ -9,17 +9,6 @@ help: consider further restricting this bound
|
|||||||
LL | const fn foo<T: ~const Foo + Foo>() {
|
LL | const fn foo<T: ~const Foo + Foo>() {
|
||||||
| +++++
|
| +++++
|
||||||
|
|
||||||
error[E0277]: the trait bound `T: Foo` is not satisfied
|
error: aborting due to previous error
|
||||||
--> $DIR/assoc-type-const-bound-usage.rs:12:5
|
|
||||||
|
|
|
||||||
LL | <T as Foo>::Assoc::foo();
|
|
||||||
| ^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
|
|
||||||
|
|
|
||||||
help: consider further restricting this bound
|
|
||||||
|
|
|
||||||
LL | const fn foo<T: ~const Foo + Foo>() {
|
|
||||||
| +++++
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
Loading…
Reference in New Issue
Block a user