Skip to content

Commit 3d3acfe

Browse files
authored
Merge pull request #20 from dtolnay/assoc
Add ui test for use of associated type in signature
2 parents ab2ee50 + 111ebbf commit 3d3acfe

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/ui/associated-type.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use inherent::inherent;
2+
3+
pub trait Trait {
4+
type Assoc;
5+
fn f() -> Self::Assoc;
6+
}
7+
8+
pub struct Struct;
9+
10+
#[inherent]
11+
impl Trait for Struct {
12+
type Assoc = ();
13+
14+
// TODO: https://github.com/dtolnay/inherent/issues/15
15+
fn f() -> Self::Assoc {}
16+
}
17+
18+
fn main() {}

tests/ui/associated-type.stderr

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error[E0223]: ambiguous associated type
2+
--> tests/ui/associated-type.rs:15:15
3+
|
4+
15 | fn f() -> Self::Assoc {}
5+
| ^^^^^^^^^^^ help: use the fully-qualified path: `<Struct as Trait>::Assoc`

0 commit comments

Comments
 (0)