]> git.lizzy.rs Git - rust.git/blob - src/test/ui/self/self_type_keyword.rs
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
[rust.git] / src / test / ui / self / self_type_keyword.rs
1 // compile-flags: -Z continue-parse-after-error
2
3 mod foo {
4   struct Self;
5   //~^ ERROR expected identifier, found keyword `Self`
6 }
7
8 struct Bar<'Self>;
9 //~^ ERROR lifetimes cannot use keyword names
10 //~| ERROR parameter `'Self` is never used
11
12 struct Foo;
13
14 pub fn main() {
15     match 15 {
16         ref Self => (),
17         //~^ ERROR expected identifier, found keyword `Self`
18         mut Self => (),
19         //~^ ERROR expected identifier, found keyword `Self`
20         ref mut Self => (),
21         //~^ ERROR expected identifier, found keyword `Self`
22         Self!() => (),
23         //~^ ERROR cannot find macro `Self!` in this scope
24         Foo { Self } => (),
25         //~^ ERROR expected identifier, found keyword `Self`
26     }
27 }
28
29 mod m1 {
30     extern crate core as Self;
31     //~^ ERROR expected identifier, found keyword `Self`
32 }
33
34 mod m2 {
35     use std::option::Option as Self;
36     //~^ ERROR expected identifier, found keyword `Self`
37 }
38
39 mod m3 {
40     trait Self {}
41     //~^ ERROR expected identifier, found keyword `Self`
42 }