about summary refs log tree commit diff
path: root/tests/ui/wf
diff options
context:
space:
mode:
authorBoxy <supbscripter@gmail.com>2024-06-04 09:10:08 +0100
committerBoxy <supbscripter@gmail.com>2024-06-05 22:25:42 +0100
commitf74119a2e4a5c040c054ebee1ae2ccda828fd21f (patch)
treef74f411f1cd0b38b54711cd64b8c9f845050abc7 /tests/ui/wf
parent7fa98d0c01050ee8c39bfc644d1414f5a21a1f21 (diff)
downloadrust-f74119a2e4a5c040c054ebee1ae2ccda828fd21f.tar.gz
rust-f74119a2e4a5c040c054ebee1ae2ccda828fd21f.zip
Bless tests and handle tests/crashes
Diffstat (limited to 'tests/ui/wf')
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs27
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr44
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs16
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr93
4 files changed, 47 insertions, 133 deletions
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
index db155f4fa3c..3f43fbfc0cf 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
@@ -1,7 +1,6 @@
 trait Trait<const N: Trait = bar> {
     //~^ ERROR cannot find value `bar` in this scope
     //~| ERROR cycle detected when computing type of `Trait::N`
-    //~| ERROR cycle detected when computing type of `Trait::N`
     //~| ERROR the trait `Trait` cannot be made into an object
     //~| ERROR the trait `Trait` cannot be made into an object
     //~| ERROR the trait `Trait` cannot be made into an object
@@ -11,20 +10,20 @@ trait Trait<const N: Trait = bar> {
     //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
     //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
     fn fnc<const N: Trait = u32>(&self) -> Trait {
-    //~^ ERROR the name `N` is already used for a generic parameter in this item's generic parameters
-    //~| ERROR expected value, found builtin type `u32`
-    //~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-    //~| ERROR associated item referring to unboxed trait object for its own trait
-    //~| ERROR the trait `Trait` cannot be made into an object
-    //~| ERROR `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
-    //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
-    //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
-    //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
-    //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
-    //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
-    //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+        //~^ ERROR the name `N` is already used for a generic parameter in this item's generic parameters
+        //~| ERROR expected value, found builtin type `u32`
+        //~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+        //~| ERROR associated item referring to unboxed trait object for its own trait
+        //~| ERROR the trait `Trait` cannot be made into an object
+        //~| ERROR `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
+        //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
+        //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+        //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
+        //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+        //~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
+        //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
         bar
-    //~^ ERROR cannot find value `bar` in this scope
+        //~^ ERROR cannot find value `bar` in this scope
     }
 }
 
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
index cf985d9d1fd..f2456f99e62 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
@@ -1,5 +1,5 @@
 error[E0403]: the name `N` is already used for a generic parameter in this item's generic parameters
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:18
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:18
    |
 LL | trait Trait<const N: Trait = bar> {
    |                   - first use of `N`
@@ -14,13 +14,13 @@ LL | trait Trait<const N: Trait = bar> {
    |                              ^^^ not found in this scope
 
 error[E0423]: expected value, found builtin type `u32`
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:29
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:29
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |                             ^^^ not a value
 
 error[E0425]: cannot find value `bar` in this scope
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:26:9
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:25:9
    |
 LL |         bar
    |         ^^^ not found in this scope
@@ -53,28 +53,14 @@ LL | trait Trait<const N: Trait = bar> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
-error[E0391]: cycle detected when computing type of `Trait::N`
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
-   |
-LL | trait Trait<const N: Trait = bar> {
-   |             ^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: ...which immediately requires computing type of `Trait::N` again
-note: cycle used when computing explicit predicates of trait `Trait`
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:1
-   |
-LL | trait Trait<const N: Trait = bar> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
 error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:12
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:12
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |            ^^^^^^^^^^^^^^^^^^^^
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:21
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |                     ^^^^^
@@ -87,7 +73,7 @@ LL |     fn fnc<const N: dyn Trait = u32>(&self) -> Trait {
    |                     +++
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:44
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:44
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |                                            ^^^^^
@@ -120,7 +106,7 @@ LL | trait Trait<const N: Trait = bar> {
    |                      ^^^^^ `Trait` cannot be made into an object
    |
 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:8
    |
 LL | trait Trait<const N: Trait = bar> {
    |       ----- this trait cannot be made into an object...
@@ -136,7 +122,7 @@ LL | trait Trait<const N: Trait = bar> {
    |             ^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
    |
 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:8
    |
 LL | trait Trait<const N: Trait = bar> {
    |       ----- this trait cannot be made into an object...
@@ -154,7 +140,7 @@ LL | trait Trait<const N: Trait = bar> {
    = note: the only supported types are integers, `bool` and `char`
 
 error: associated item referring to unboxed trait object for its own trait
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:44
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:44
    |
 LL | trait Trait<const N: Trait = bar> {
    |       ----- in this trait
@@ -168,7 +154,7 @@ LL |     fn fnc<const N: Trait = u32>(&self) -> Self {
    |                                            ~~~~
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:21
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |                     ^^^^^
@@ -182,13 +168,13 @@ LL |     fn fnc<const N: dyn Trait = u32>(&self) -> Trait {
    |                     +++
 
 error[E0038]: the trait `Trait` cannot be made into an object
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:21
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |                     ^^^^^ `Trait` cannot be made into an object
    |
 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:8
    |
 LL | trait Trait<const N: Trait = bar> {
    |       ----- this trait cannot be made into an object...
@@ -204,7 +190,7 @@ LL | trait Trait<const N: Trait = bar> {
    |             ^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
    |
 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:8
    |
 LL | trait Trait<const N: Trait = bar> {
    |       ----- this trait cannot be made into an object...
@@ -215,14 +201,14 @@ LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:12:21
    |
 LL |     fn fnc<const N: Trait = u32>(&self) -> Trait {
    |                     ^^^^^
    |
    = note: the only supported types are integers, `bool` and `char`
 
-error: aborting due to 14 previous errors; 5 warnings emitted
+error: aborting due to 13 previous errors; 5 warnings emitted
 
 Some errors have detailed explanations: E0038, E0391, E0403, E0423, E0425.
 For more information about an error, try `rustc --explain E0038`.
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs
index 2995f26af4a..a953f1818c5 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs
@@ -1,15 +1,11 @@
 // Regression test for ICE #122989
 trait Foo<const N: Bar<2>> {
-//~^ WARN trait objects without an explicit `dyn` are deprecated
-//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
-//~| ERROR cycle detected when computing type of `Foo::N`
-//~| ERROR cycle detected when computing type of `Foo::N`
-//~| ERROR the trait `Foo` cannot be made into an object
-//~| ERROR the trait `Foo` cannot be made into an object
-//~| ERROR the trait `Foo` cannot be made into an object
-//~| ERROR `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter
-    fn func() {
-    }
+    //~^ WARN trait objects without an explicit `dyn` are deprecated
+    //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+    //~| ERROR cycle detected when computing type of `Foo::N`
+    //~| ERROR the trait `Foo` cannot be made into an object
+    //~| ERROR `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter
+    fn func() {}
 }
 
 trait Bar<const M: Foo<2>> {}
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr
index e6fdc440873..a0fd11de2dc 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr
@@ -13,7 +13,7 @@ LL | trait Foo<const N: dyn Bar<2>> {
    |                    +++
 
 warning: trait objects without an explicit `dyn` are deprecated
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:20
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:20
    |
 LL | trait Bar<const M: Foo<2>> {}
    |                    ^^^^^^
@@ -32,7 +32,7 @@ LL | trait Foo<const N: Bar<2>> {
    |           ^^^^^^^^^^^^^^^
    |
 note: ...which requires computing type of `Bar::M`...
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:11
    |
 LL | trait Bar<const M: Foo<2>> {}
    |           ^^^^^^^^^^^^^^^
@@ -44,26 +44,6 @@ LL | trait Foo<const N: Bar<2>> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
-error[E0391]: cycle detected when computing type of `Foo::N`
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11
-   |
-LL | trait Foo<const N: Bar<2>> {
-   |           ^^^^^^^^^^^^^^^
-   |
-note: ...which requires computing type of `Bar::M`...
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11
-   |
-LL | trait Bar<const M: Foo<2>> {}
-   |           ^^^^^^^^^^^^^^^
-   = note: ...which again requires computing type of `Foo::N`, completing the cycle
-note: cycle used when computing explicit predicates of trait `Foo`
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1
-   |
-LL | trait Foo<const N: Bar<2>> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
 error[E0038]: the trait `Foo` cannot be made into an object
   --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:24
    |
@@ -71,43 +51,20 @@ LL | trait Foo<const N: Bar<2>> {
    |                        ^ `Foo` cannot be made into an object
    |
 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8
-   |
-LL | trait Foo<const N: Bar<2>> {
-   |       --- this trait cannot be made into an object...
-...
-LL |     fn func() {
-   |        ^^^^ ...because associated function `func` has no `self` parameter
-help: consider turning `func` into a method by giving it a `&self` argument
-   |
-LL |     fn func(&self) {
-   |             +++++
-help: alternatively, consider constraining `func` so it does not apply to trait objects
-   |
-LL |     fn func() where Self: Sized {
-   |               +++++++++++++++++
-
-error[E0038]: the trait `Foo` cannot be made into an object
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11
-   |
-LL | trait Foo<const N: Bar<2>> {
-   |           ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
-   |
-note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:8:8
    |
 LL | trait Foo<const N: Bar<2>> {
    |       --- this trait cannot be made into an object...
 ...
-LL |     fn func() {
+LL |     fn func() {}
    |        ^^^^ ...because associated function `func` has no `self` parameter
 help: consider turning `func` into a method by giving it a `&self` argument
    |
-LL |     fn func(&self) {
+LL |     fn func(&self) {}
    |             +++++
 help: alternatively, consider constraining `func` so it does not apply to trait objects
    |
-LL |     fn func() where Self: Sized {
+LL |     fn func() where Self: Sized {}
    |               +++++++++++++++++
 
 error: `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter
@@ -119,61 +76,37 @@ LL | trait Foo<const N: Bar<2>> {
    = note: the only supported types are integers, `bool` and `char`
 
 error[E0038]: the trait `Foo` cannot be made into an object
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:11
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:11
    |
 LL | trait Bar<const M: Foo<2>> {}
    |           ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
    |
 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:8:8
    |
 LL | trait Foo<const N: Bar<2>> {
    |       --- this trait cannot be made into an object...
 ...
-LL |     fn func() {
+LL |     fn func() {}
    |        ^^^^ ...because associated function `func` has no `self` parameter
 help: consider turning `func` into a method by giving it a `&self` argument
    |
-LL |     fn func(&self) {
+LL |     fn func(&self) {}
    |             +++++
 help: alternatively, consider constraining `func` so it does not apply to trait objects
    |
-LL |     fn func() where Self: Sized {
+LL |     fn func() where Self: Sized {}
    |               +++++++++++++++++
 
 error: `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:15:20
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:20
    |
 LL | trait Bar<const M: Foo<2>> {}
    |                    ^^^^^^
    |
    = note: the only supported types are integers, `bool` and `char`
 
-error[E0038]: the trait `Foo` cannot be made into an object
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:11
-   |
-LL | trait Foo<const N: Bar<2>> {
-   |           ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
-   |
-note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-  --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:8
-   |
-LL | trait Foo<const N: Bar<2>> {
-   |       --- this trait cannot be made into an object...
-...
-LL |     fn func() {
-   |        ^^^^ ...because associated function `func` has no `self` parameter
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-help: consider turning `func` into a method by giving it a `&self` argument
-   |
-LL |     fn func(&self) {
-   |             +++++
-help: alternatively, consider constraining `func` so it does not apply to trait objects
-   |
-LL |     fn func() where Self: Sized {
-   |               +++++++++++++++++
-
-error: aborting due to 8 previous errors; 2 warnings emitted
+error: aborting due to 5 previous errors; 2 warnings emitted
 
 Some errors have detailed explanations: E0038, E0391.
 For more information about an error, try `rustc --explain E0038`.