rustc: desugar UFCS as much as possible during HIR lowering.

This commit is contained in:
Eduard Burtescu 2016-10-27 05:17:42 +03:00 committed by Eduard-Mihai Burtescu
parent 34d1352f0e
commit 16b5c2cfef
41 changed files with 637 additions and 486 deletions

View file

@ -23,5 +23,5 @@ impl S {
fn main() {
if let C1(..) = 0 {} //~ ERROR expected tuple struct/variant, found constant `C1`
if let S::C2(..) = 0 {}
//~^ ERROR expected tuple struct/variant, found associated constant `S::C2`
//~^ ERROR expected tuple struct/variant, found associated constant `<S>::C2`
}

View file

@ -22,13 +22,15 @@ impl MyTrait for Foo {}
fn main() {
match 0u32 {
Foo::bar => {} //~ ERROR expected unit struct/variant or constant, found method `Foo::bar`
Foo::bar => {}
//~^ ERROR expected unit struct/variant or constant, found method `<Foo>::bar`
}
match 0u32 {
<Foo>::bar => {} //~ ERROR expected unit struct/variant or constant, found method `bar`
<Foo>::bar => {}
//~^ ERROR expected unit struct/variant or constant, found method `<Foo>::bar`
}
match 0u32 {
<Foo>::trait_bar => {}
//~^ ERROR expected unit struct/variant or constant, found method `trait_bar`
//~^ ERROR expected unit struct/variant or constant, found method `<Foo>::trait_bar`
}
}

View file

@ -28,7 +28,7 @@ impl S {
fn main() {
match 10 {
<S as Tr>::A::f::<u8> => {}
//~^ ERROR expected unit struct/variant or constant, found method `Tr::A::f<u8>`
//~^ ERROR expected unit struct/variant or constant, found method `<<S as Tr>::A>::f<u8>`
0 ... <S as Tr>::A::f::<u8> => {} //~ ERROR only char and numeric types are allowed in range
}
}

View file

@ -9,11 +9,11 @@
// except according to those terms.
pub trait Foo<A=Self> {
fn foo();
fn foo(&self);
}
pub trait Bar<X=usize, A=Self> {
fn foo();
fn foo(&self);
}
fn main() {

View file

@ -40,7 +40,7 @@ pub fn bar() ({
(($crate::fmt::format as
fn(std::fmt::Arguments<'_>) -> std::string::String {std::fmt::format})(((::std::fmt::Arguments::new_v1
fn(std::fmt::Arguments<'_>) -> std::string::String {std::fmt::format})(((<::std::fmt::Arguments>::new_v1
as
fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments<'_>::new_v1})(({
static __STATIC_FMTSTR: