about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2023-08-26 19:35:54 +0000
committerEsteban Küber <esteban@kuber.com.ar>2023-08-26 19:35:54 +0000
commitef11db803cd6aa8aea6ba501fea62f8c6601294c (patch)
tree96a271574bec961138203cb964c6ca5f280dbfda
parentb6494a7bb4dd5dfe0c772ef1ac7539ab5f535044 (diff)
downloadrust-ef11db803cd6aa8aea6ba501fea62f8c6601294c.tar.gz
rust-ef11db803cd6aa8aea6ba501fea62f8c6601294c.zip
Remove unnecessary `select_obligations_where_possible` and redundant errors
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs1
-rw-r--r--tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs1
-rw-r--r--tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr13
-rw-r--r--tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs1
-rw-r--r--tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr14
-rw-r--r--tests/ui/generic-associated-types/own-bound-span.rs4
-rw-r--r--tests/ui/generic-associated-types/own-bound-span.stderr16
-rw-r--r--tests/ui/issues/issue-66353.rs1
-rw-r--r--tests/ui/issues/issue-66353.stderr8
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_used.rs1
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_used.stderr30
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr13
12 files changed, 10 insertions, 93 deletions
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
index 45bf43efa83..823422fab14 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
@@ -322,7 +322,6 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
                 ty.kind()
             {
                 self.add_required_obligations_for_hir(span, *def_id, args, hir_id);
-                self.select_obligations_where_possible(|_| {});
             }
             self.normalize(span, ty)
         } else {
diff --git a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs
index 473a68833b6..3bd3f3a757c 100644
--- a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs
+++ b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs
@@ -9,7 +9,6 @@ trait Foo<T> {
 fn f<T:Foo<isize>>(t: &T) {
     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
 }
 
 fn main() { }
diff --git a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
index fc63f4b3e30..676d6353d98 100644
--- a/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
+++ b/tests/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
@@ -9,17 +9,6 @@ help: consider further restricting this bound
 LL | fn f<T:Foo<isize> + Foo<usize>>(t: &T) {
    |                   ++++++++++++
 
-error[E0277]: the trait bound `T: Foo<usize>` is not satisfied
-  --> $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
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs
index ffb45f4bc75..b127b3f6e1f 100644
--- a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs
+++ b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.rs
@@ -7,5 +7,4 @@ impl Trait for () {
 fn main() {
     let _: <() as Trait>::P<String, String>;
     //~^ ERROR the trait bound `String: Copy` is not satisfied
-    //~| ERROR the trait bound `String: Copy` is not satisfied
 }
diff --git a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr
index 7f3b75c0629..72a987b4a1d 100644
--- a/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr
+++ b/tests/ui/generic-associated-types/multiple-type-params-with-unmet-bounds.stderr
@@ -10,18 +10,6 @@ note: required by a bound in `Trait::P`
 LL |     type P<T: Copy, U: Copy>;
    |               ^^^^ required by this bound in `Trait::P`
 
-error[E0277]: the trait bound `String: Copy` is not satisfied
-  --> $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
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-associated-types/own-bound-span.rs b/tests/ui/generic-associated-types/own-bound-span.rs
index 72d0fd9897f..3699f7296f5 100644
--- a/tests/ui/generic-associated-types/own-bound-span.rs
+++ b/tests/ui/generic-associated-types/own-bound-span.rs
@@ -4,8 +4,6 @@ trait D {
     type P<T: Copy>;
     //~^ NOTE required by this 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 {
@@ -16,6 +14,4 @@ fn main() {
     let _: <S as D>::P<String>;
     //~^ ERROR the trait bound `String: Copy` is not satisfied
     //~| 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`
 }
diff --git a/tests/ui/generic-associated-types/own-bound-span.stderr b/tests/ui/generic-associated-types/own-bound-span.stderr
index 98bf55bc208..4a0566ca7b5 100644
--- a/tests/ui/generic-associated-types/own-bound-span.stderr
+++ b/tests/ui/generic-associated-types/own-bound-span.stderr
@@ -1,5 +1,5 @@
 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>;
    |                        ^^^^^^ 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>;
    |               ^^^^ required by this bound in `D::P`
 
-error[E0277]: the trait bound `String: Copy` is not satisfied
-  --> $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
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/issues/issue-66353.rs b/tests/ui/issues/issue-66353.rs
index 484a28e564b..d8abdd5206e 100644
--- a/tests/ui/issues/issue-66353.rs
+++ b/tests/ui/issues/issue-66353.rs
@@ -11,6 +11,5 @@ trait _A {
 fn main() {
     _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 `(): _Func<_>` is not satisfied
 }
diff --git a/tests/ui/issues/issue-66353.stderr b/tests/ui/issues/issue-66353.stderr
index 49eb013c1d8..71530f58220 100644
--- a/tests/ui/issues/issue-66353.stderr
+++ b/tests/ui/issues/issue-66353.stderr
@@ -4,12 +4,6 @@ error[E0277]: the trait bound `(): _A` is not satisfied
 LL |     _Func::< <() as _A>::AssocT >::func(());
    |               ^^ 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
   --> $DIR/issue-66353.rs:12:41
    |
@@ -18,6 +12,6 @@ LL |     _Func::< <() as _A>::AssocT >::func(());
    |     |
    |     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`.
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.rs b/tests/ui/object-safety/assoc_type_bounds_sized_used.rs
index f685a7f626f..cf5345b1c1d 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_used.rs
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.rs
@@ -12,7 +12,6 @@ fn bop<T: Bop + ?Sized>() {
     let _ = <T as Bop>::Bar::default();
     //~^ 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
 }
 
 fn main() {
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
index f551d657ab5..6b5bc360349 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
@@ -1,25 +1,3 @@
-error[E0277]: the size for values of type `T` cannot be known at compilation time
-  --> $DIR/assoc_type_bounds_sized_used.rs:12:14
-   |
-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[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
    |
@@ -35,12 +13,12 @@ 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
+  --> $DIR/assoc_type_bounds_sized_used.rs:12:14
    |
 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
+   |              ^ 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
@@ -57,7 +35,7 @@ LL + fn bop<T: Bop>() {
    |
 
 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>();
    |           ^^^^^^^ 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>() {
    |           ^^^ 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.
 For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
index 72ff11d586f..ad11c090f12 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
@@ -9,17 +9,6 @@ help: consider further restricting this bound
 LL | const fn foo<T: ~const Foo + Foo>() {
    |                            +++++
 
-error[E0277]: the trait bound `T: Foo` is not satisfied
-  --> $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
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0277`.