]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lexical-scoping.rs
Rollup merge of #94586 - sunfishcode:sunfishcode/io-lifetimes-tests, r=davidtwco
[rust.git] / src / test / ui / lexical-scoping.rs
1 // run-pass
2 // Tests that items in subscopes can shadow type parameters and local variables (see issue #23880).
3
4 #![allow(unused)]
5 struct Foo<X> { x: Box<X> }
6 impl<Bar> Foo<Bar> {
7     fn foo(&self) {
8         type Bar = i32;
9         let _: Bar = 42;
10     }
11 }
12
13 fn main() {
14     let f = 1;
15     {
16         fn f() {}
17         f();
18     }
19 }