Skip to content

Commit c035299

Browse files
committed
tests
1 parent 710192d commit c035299

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(const_generics)]
2+
#![allow(incomplete_features, unused_braces)]
3+
4+
trait Bar<T> {}
5+
impl<T> Bar<T> for [u8; {7}] {}
6+
7+
struct Foo<const N: usize> {}
8+
impl<const N: usize> Foo<N>
9+
where
10+
[u8; N]: Bar<[(); N]>,
11+
{
12+
fn foo() {}
13+
}
14+
15+
fn main() {
16+
Foo::foo();
17+
//~^ ERROR no function or associated item named `foo`
18+
// FIXME(const_generics): The above should not error
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0599]: no function or associated item named `foo` found for struct `Foo<{_: usize}>` in the current scope
2+
--> $DIR/issue-69654-run-pass.rs:16:10
3+
|
4+
LL | struct Foo<const N: usize> {}
5+
| -------------------------- function or associated item `foo` not found for this
6+
...
7+
LL | Foo::foo();
8+
| ^^^ function or associated item not found in `Foo<{_: usize}>`
9+
|
10+
= note: the method `foo` exists but the following trait bounds were not satisfied:
11+
`[u8; _]: Bar<[(); _]>`
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0599`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(const_generics)]
2+
#![allow(incomplete_features)]
3+
4+
trait Bar<T> {}
5+
impl<T> Bar<T> for [u8; T] {}
6+
//~^ ERROR expected value, found type parameter `T`
7+
8+
struct Foo<const N: usize> {}
9+
impl<const N: usize> Foo<N>
10+
where
11+
[u8; N]: Bar<[(); N]>,
12+
{
13+
fn foo() {}
14+
}
15+
16+
fn main() {
17+
Foo::foo();
18+
//~^ ERROR no function or associated item named `foo`
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0423]: expected value, found type parameter `T`
2+
--> $DIR/issue-69654.rs:5:25
3+
|
4+
LL | impl<T> Bar<T> for [u8; T] {}
5+
| ^ not a value
6+
7+
error[E0599]: no function or associated item named `foo` found for struct `Foo<{_: usize}>` in the current scope
8+
--> $DIR/issue-69654.rs:17:10
9+
|
10+
LL | struct Foo<const N: usize> {}
11+
| -------------------------- function or associated item `foo` not found for this
12+
...
13+
LL | Foo::foo();
14+
| ^^^ function or associated item not found in `Foo<{_: usize}>`
15+
|
16+
= note: the method `foo` exists but the following trait bounds were not satisfied:
17+
`[u8; _]: Bar<[(); _]>`
18+
19+
error: aborting due to 2 previous errors
20+
21+
Some errors have detailed explanations: E0423, E0599.
22+
For more information about an error, try `rustc --explain E0423`.

0 commit comments

Comments
 (0)