-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c654e4d
commit 78fb74a
Showing
40 changed files
with
281 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#![feature(associated_const_equality)] | ||
#![allow(unused)] | ||
|
||
pub trait Foo { | ||
const N: usize; | ||
} | ||
|
||
pub struct Bar; | ||
|
||
impl Foo for Bar { | ||
const N: usize = 3; | ||
} | ||
|
||
|
||
fn foo1<F: Foo<Z=3>>() {} | ||
//~^ ERROR associated type | ||
fn foo2<F: Foo<Z=usize>>() {} | ||
//~^ ERROR associated type | ||
fn foo3<F: Foo<Z=5>>() {} | ||
//~^ ERROR associated type | ||
|
||
fn main() { | ||
foo1::<Bar>(); | ||
foo2::<Bar>(); | ||
foo3::<Bar>(); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/associated-consts/assoc-const-eq-missing.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0220]: associated type `Z` not found for `Foo` | ||
--> $DIR/assoc-const-eq-missing.rs:15:16 | ||
| | ||
LL | fn foo1<F: Foo<Z=3>>() {} | ||
| ^ associated type `Z` not found | ||
|
||
error[E0220]: associated type `Z` not found for `Foo` | ||
--> $DIR/assoc-const-eq-missing.rs:17:16 | ||
| | ||
LL | fn foo2<F: Foo<Z=usize>>() {} | ||
| ^ associated type `Z` not found | ||
|
||
error[E0220]: associated type `Z` not found for `Foo` | ||
--> $DIR/assoc-const-eq-missing.rs:19:16 | ||
| | ||
LL | fn foo3<F: Foo<Z=5>>() {} | ||
| ^ associated type `Z` not found | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0220`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 16 additions & 4 deletions
20
src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
error: type/const mismatch in equality bind of associated field | ||
error: mismatch in bind of associated constant, got type | ||
--> $DIR/assoc-const-ty-mismatch.rs:23:15 | ||
| | ||
LL | fn foo<F: Foo<N=usize>>() {} | ||
| ^^^^^^^ type/const Mismatch | ||
| ^^^^^^^ | ||
| | ||
note: associated constant defined here does not match type | ||
--> $DIR/assoc-const-ty-mismatch.rs:5:3 | ||
| | ||
LL | const N: usize; | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: type/const mismatch in equality bind of associated field | ||
error: mismatch in bind of associated type, got const | ||
--> $DIR/assoc-const-ty-mismatch.rs:25:18 | ||
| | ||
LL | fn foo2<F: FooTy<T=3usize>>() {} | ||
| ^^^^^^^^ type/const Mismatch | ||
| ^^^^^^^^ | ||
| | ||
note: associated type defined here does not match const | ||
--> $DIR/assoc-const-ty-mismatch.rs:9:3 | ||
| | ||
LL | type T; | ||
| ^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
Oops, something went wrong.