AST/HIR: Merge ObjectSum and PolyTraitRef

This commit is contained in:
Vadim Petrochenkov 2017-01-16 23:33:45 +03:00
parent 828404684b
commit 2efe865d22
22 changed files with 119 additions and 240 deletions

View file

@ -1,16 +0,0 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn foo(bar: i32+std::fmt::Display) {}
//~^ ERROR E0172
//~| NOTE expected a trait
fn main() {
}

View file

@ -17,12 +17,15 @@ struct Bar<'a> {
x: &'a Foo + 'a,
//~^ ERROR E0178
//~| NOTE expected a path
//~| ERROR at least one non-builtin trait is required for an object type
y: &'a mut Foo + 'a,
//~^ ERROR E0178
//~| NOTE expected a path
//~| ERROR at least one non-builtin trait is required for an object type
z: fn() -> Foo + 'a,
//~^ ERROR E0178
//~| NOTE expected a path
//~| ERROR at least one non-builtin trait is required for an object type
}
fn main() {

View file

@ -11,6 +11,6 @@
struct Foo;
fn foo(_x: Box<Foo + Send>) { } //~ ERROR expected a reference to a trait
fn foo(_x: Box<Foo + Send>) { } //~ ERROR expected trait, found struct `Foo`
fn main() { }

View file

@ -13,8 +13,10 @@ fn main() {
//~^ ERROR expected a path
//~| HELP try adding parentheses
//~| SUGGESTION let _: &(Copy + 'static);
//~| ERROR at least one non-builtin trait is required for an object type
let _: &'static Copy + 'static;
//~^ ERROR expected a path
//~| HELP try adding parentheses
//~| SUGGESTION let _: &'static (Copy + 'static);
//~| ERROR at least one non-builtin trait is required for an object type
}

View file

@ -16,10 +16,10 @@ trait Tr {
}
impl Tr for isize { }
fn foo<'a>(x: Box<Tr+ Sync + 'a>) -> Box<Tr+ Sync + 'a> { x }
fn foo<'a>(x: Box< Tr + Sync + 'a>) -> Box< Tr + Sync + 'a> { x }
fn main() {
let x: Box<Tr+ Sync>;
let x: Box< Tr + Sync>;
Box::new(1isize) as Box<Tr+ Sync>;
Box::new(1isize) as Box< Tr + Sync>;
}