Rewrite check_pat_enum, split it into check_pat_tuple_struct and check_pat_path

Update definitions in def_map for associated types written in unqualified form (like `Self::Output`)
Cleanup finish_resolving_def_to_ty/resolve_ty_and_def_ufcs
Make VariantDef's available through constructor IDs
This commit is contained in:
Vadim Petrochenkov 2016-06-11 18:47:47 +03:00
parent eb32440d45
commit 2cdd9f1c97
17 changed files with 229 additions and 327 deletions

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(fn_traits)]
#![feature(unboxed_closures)]
#![feature(rustc_attrs)]

View file

@ -18,6 +18,7 @@
// revisions: ok oneuse transmute krisskross
#![feature(fn_traits)]
#![allow(dead_code, unused_variables)]
use std::marker::PhantomData;

View file

@ -31,12 +31,14 @@ fn main() {
Empty1 => () // Not an error, `Empty1` is interpreted as a new binding
}
match e3 {
E::Empty3 => () //~ ERROR `E::Empty3` does not name a tuple variant or a tuple struct
E::Empty3 => ()
//~^ ERROR `E::Empty3` does not name a unit variant, unit struct or a constant
}
match xe1 {
XEmpty1 => () // Not an error, `XEmpty1` is interpreted as a new binding
}
match xe3 {
XE::XEmpty3 => () //~ ERROR `XE::XEmpty3` does not name a tuple variant or a tuple struct
XE::XEmpty3 => ()
//~^ ERROR `XE::XEmpty3` does not name a unit variant, unit struct or a constant
}
}

View file

@ -18,7 +18,7 @@ struct S;
fn main() {
match Foo::Baz {
Foo::Bar => {}
//~^ ERROR `Foo::Bar` does not name a tuple variant or a tuple struct
//~^ ERROR `Foo::Bar` does not name a unit variant, unit struct or a constant
_ => {}
}

View file

@ -22,12 +22,13 @@ impl MyTrait for Foo {}
fn main() {
match 0u32 {
Foo::bar => {} //~ ERROR E0327
Foo::bar => {} //~ ERROR `Foo::bar` does not name a unit variant, unit struct or a constant
}
match 0u32 {
<Foo>::bar => {} //~ ERROR E0327
<Foo>::bar => {} //~ ERROR `bar` does not name a unit variant, unit struct or a constant
}
match 0u32 {
<Foo>::trait_bar => {} //~ ERROR E0327
<Foo>::trait_bar => {}
//~^ ERROR `trait_bar` does not name a unit variant, unit struct or a constant
}
}

View file

@ -27,7 +27,8 @@ impl S {
fn main() {
match 10 {
<S as Tr>::A::f::<u8> => {} //~ ERROR associated items in match patterns must be constants
<S as Tr>::A::f::<u8> => {}
//~^ ERROR `Tr::A::f<u8>` does not name a unit variant, unit struct or a constant
0 ... <S as Tr>::A::f::<u8> => {} //~ ERROR only char and numeric types are allowed in range
}
}