Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,14 @@ fn baz<T: Trait>() {
}

fn main() {}

fn test_ice_missing_bound<T>() {
foo::<{Option::Some::<u32>{0: <T as Trait>::ASSOC}}>();
//~^ ERROR the trait bound `T: Trait` is not satisfied
//~| ERROR the constant `Option::<u32>::Some(_)` is not of type `Foo`
}

fn test_underscore_inference() {
foo::<{ Option::Some::<u32> { 0: _ } }>();
//~^ ERROR the constant `Option::<u32>::Some(_)` is not of type `Foo`
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,41 @@ note: required by a const generic parameter in `foo`
LL | fn foo<const N: Foo>() {}
| ^^^^^^^^^^^^ required by this const generic parameter in `foo`

error: aborting due to 2 previous errors
error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/printing_valtrees_supports_non_values.rs:30:5
|
LL | foo::<{Option::Some::<u32>{0: <T as Trait>::ASSOC}}>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
|
help: consider restricting type parameter `T` with trait `Trait`
|
LL | fn test_ice_missing_bound<T: Trait>() {
| +++++++

error: the constant `Option::<u32>::Some(_)` is not of type `Foo`
--> $DIR/printing_valtrees_supports_non_values.rs:30:12
|
LL | foo::<{Option::Some::<u32>{0: <T as Trait>::ASSOC}}>();
| ^^^^^^^^^^^^^^^^^^^ expected `Foo`, found `Option<u32>`
|
note: required by a const generic parameter in `foo`
--> $DIR/printing_valtrees_supports_non_values.rs:15:8
|
LL | fn foo<const N: Foo>() {}
| ^^^^^^^^^^^^ required by this const generic parameter in `foo`

error: the constant `Option::<u32>::Some(_)` is not of type `Foo`
--> $DIR/printing_valtrees_supports_non_values.rs:36:13
|
LL | foo::<{ Option::Some::<u32> { 0: _ } }>();
| ^^^^^^^^^^^^^^^^^^^ expected `Foo`, found `Option<u32>`
|
note: required by a const generic parameter in `foo`
--> $DIR/printing_valtrees_supports_non_values.rs:15:8
|
LL | fn foo<const N: Foo>() {}
| ^^^^^^^^^^^^ required by this const generic parameter in `foo`

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0277`.
Loading