about summary refs log tree commit diff
path: root/tests/ui/generics/generic-params-nested-fn-scope-error.rs
blob: eaf514da3376343a82cfdcc65746e9a22d576644 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Test that generic parameters from an outer function are not accessible
//! in nested functions.

fn foo<U>(v: Vec<U>) -> U {
    fn bar(w: [U]) -> U {
        //~^ ERROR can't use generic parameters from outer item
        //~| ERROR can't use generic parameters from outer item
        return w[0];
    }

    return bar(v);
}

fn main() {}