]> git.lizzy.rs Git - rust.git/blob - src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs
Merge commit '15c8d31392b9fbab3b3368b67acc4bbe5983115a' into cranelift-rebase
[rust.git] / src / test / ui / resolve / resolve-type-param-in-item-in-trait.rs
1 // Issue #14603: Check for references to type parameters from the
2 // outer scope (in this case, the trait) used on items in an inner
3 // scope (in this case, the enum).
4
5 trait TraitA<A> {
6     fn outer(&self) {
7         enum Foo<B> {
8             Variance(A)
9                 //~^ ERROR can't use generic parameters from outer function
10         }
11     }
12 }
13
14 trait TraitB<A> {
15     fn outer(&self) {
16         struct Foo<B>(A);
17                 //~^ ERROR can't use generic parameters from outer function
18     }
19 }
20
21 trait TraitC<A> {
22     fn outer(&self) {
23         struct Foo<B> { a: A }
24                 //~^ ERROR can't use generic parameters from outer function
25     }
26 }
27
28 trait TraitD<A> {
29     fn outer(&self) {
30         fn foo<B>(a: A) { }
31                 //~^ ERROR can't use generic parameters from outer function
32     }
33 }
34
35 fn main() { }