mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Rollup merge of #122927 - gurry:122199-ice-unexpected-node-2, r=workingjubilee
Change an ICE regression test to use the original reproducer The ICE was fixed in PR https://github.com/rust-lang/rust/pull/122370, but the test used a different reproducer than the one originally reported. This PR changes it to the original one, giving us more confidence that the fix works. Fixes #122199
This commit is contained in:
commit
aaf5f3b53e
@ -1,11 +1,30 @@
|
||||
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 `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
|
||||
//~| 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!
|
||||
fn fnc(&self) {
|
||||
//~^ 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
|
||||
//~| 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!
|
||||
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!
|
||||
bar
|
||||
//~^ ERROR cannot find value `bar` in this scope
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,30 @@
|
||||
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
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| - first use of `N`
|
||||
...
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^ already used
|
||||
|
||||
error[E0425]: cannot find value `bar` in this scope
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:30
|
||||
|
|
||||
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
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | bar
|
||||
| ^^^ not found in this scope
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
|
||||
|
|
||||
@ -46,6 +67,84 @@ 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
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
help: if this is an object-safe trait, use `dyn`
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
help: if this is an object-safe trait, use `dyn`
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> dyn Trait {
|
||||
| +++
|
||||
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
help: if this is an object-safe trait, use `dyn`
|
||||
|
|
||||
LL | trait Trait<const N: dyn Trait = bar> {
|
||||
| +++
|
||||
|
||||
error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
...
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^ ...because method `fnc` has generic type parameters
|
||||
= help: consider moving `fnc` to another trait
|
||||
|
||||
error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
...
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^ ...because method `fnc` has generic type parameters
|
||||
= help: consider moving `fnc` to another trait
|
||||
|
||||
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:1:22
|
||||
|
|
||||
@ -54,7 +153,76 @@ LL | trait Trait<const N: Trait = bar> {
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
|
||||
error: aborting due to 4 previous errors; 1 warning emitted
|
||||
error: associated item referring to unboxed trait object for its own trait
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:44
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- in this trait
|
||||
...
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
help: you might have meant to use `Self` to refer to the implementing type
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Self {
|
||||
| ~~~~
|
||||
|
||||
Some errors have detailed explanations: E0391, E0425.
|
||||
For more information about an error, try `rustc --explain E0391`.
|
||||
warning: trait objects without an explicit `dyn` are deprecated
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21
|
||||
|
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^^^
|
||||
|
|
||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
help: if this is an object-safe trait, use `dyn`
|
||||
|
|
||||
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
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
...
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^ ...because method `fnc` has generic type parameters
|
||||
= help: consider moving `fnc` to another trait
|
||||
|
||||
error[E0038]: the trait `Trait` cannot be made into an object
|
||||
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | trait Trait<const N: Trait = bar> {
|
||||
| ----- this trait cannot be made into an object...
|
||||
...
|
||||
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
|
||||
| ^^^ ...because method `fnc` has generic type parameters
|
||||
= help: consider moving `fnc` to another 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
|
||||
|
|
||||
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
|
||||
|
||||
Some errors have detailed explanations: E0038, E0391, E0403, E0423, E0425.
|
||||
For more information about an error, try `rustc --explain E0038`.
|
||||
|
Loading…
Reference in New Issue
Block a user