]> git.proxmox.com Git - rustc.git/blame - src/test/ui/rust-2018/future-proofing-locals.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / rust-2018 / future-proofing-locals.rs
CommitLineData
13cf67c4
XL
1// edition:2018
2
69743fb6 3#![allow(non_camel_case_types)]
532ac7d7 4#![allow(unused_imports)]
13cf67c4
XL
5
6mod T {
7 pub struct U;
8}
9mod x {
10 pub struct y;
11}
12
13fn type_param<T>() {
14 use T as _; //~ ERROR imports cannot refer to type parameters
15 use T::U; //~ ERROR imports cannot refer to type parameters
16 use T::*; //~ ERROR imports cannot refer to type parameters
17}
18
19fn self_import<T>() {
69743fb6 20 use T; //~ ERROR imports cannot refer to type parameters
13cf67c4
XL
21}
22
23fn let_binding() {
24 let x = 10;
25
26 use x as _; //~ ERROR imports cannot refer to local variables
27 use x::y; // OK
28 use x::*; // OK
29}
30
31fn param_binding(x: u8) {
32 use x; //~ ERROR imports cannot refer to local variables
33}
34
35fn match_binding() {
36 match 0 {
37 x => {
38 use x; //~ ERROR imports cannot refer to local variables
39 }
40 }
41}
42
43fn nested<T>() {
44 let x = 10;
45
46 use {T as _, x}; //~ ERROR imports cannot refer to type parameters
47 //~| ERROR imports cannot refer to local variables
48}
49
50fn main() {}