1
Fork 0

rustc_resolve: use the visitor model more, remove redundant repeated lookups.

This commit is contained in:
Eduard Burtescu 2015-02-05 09:19:07 +02:00
parent ffb8092ccf
commit 5809f8ae74
26 changed files with 334 additions and 721 deletions

View file

@ -35,55 +35,36 @@ pub fn check_path_args(tcx: &ty::ctxt,
if (flags & NO_REGIONS) != 0 { if (flags & NO_REGIONS) != 0 {
if path.segments.iter().any(|s| s.parameters.has_lifetimes()) { if path.segments.iter().any(|s| s.parameters.has_lifetimes()) {
span_err!(tcx.sess, path.span, E0110, span_err!(tcx.sess, path.span, E0110,
"region parameters are not allowed on this type"); "lifetime parameters are not allowed on this type");
} }
} }
} }
pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty) pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
-> Option<Ty<'tcx>> { -> Option<Ty<'tcx>> {
match ast_ty.node { if let ast::TyPath(ref path) = ast_ty.node {
ast::TyPath(ref path) => { let def = match tcx.def_map.borrow().get(&ast_ty.id) {
let a_def = match tcx.def_map.borrow().get(&ast_ty.id) { None => {
None => { tcx.sess.span_bug(ast_ty.span,
tcx.sess.span_bug(ast_ty.span, &format!("unbound path {}", path.repr(tcx)))
&format!("unbound path {}",
path.repr(tcx)))
}
Some(&d) => d
};
match a_def {
def::DefPrimTy(nty) => {
match nty {
ast::TyBool => {
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
Some(tcx.types.bool)
}
ast::TyChar => {
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
Some(tcx.types.char)
}
ast::TyInt(it) => {
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
Some(ty::mk_mach_int(tcx, it))
}
ast::TyUint(uit) => {
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
Some(ty::mk_mach_uint(tcx, uit))
}
ast::TyFloat(ft) => {
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
Some(ty::mk_mach_float(tcx, ft))
}
ast::TyStr => {
Some(ty::mk_str(tcx))
}
}
}
_ => None
} }
Some(&d) => d
};
if let def::DefPrimTy(nty) = def {
check_path_args(tcx, path, NO_TPS | NO_REGIONS);
Some(match nty {
ast::TyBool => tcx.types.bool,
ast::TyChar => tcx.types.char,
ast::TyInt(it) => ty::mk_mach_int(tcx, it),
ast::TyUint(uit) => ty::mk_mach_uint(tcx, uit),
ast::TyFloat(ft) => ty::mk_mach_float(tcx, ft),
ast::TyStr => ty::mk_str(tcx)
})
} else {
None
} }
_ => None } else {
None
} }
} }

View file

@ -456,9 +456,6 @@ impl tr for def::Def {
} }
def::DefStruct(did) => def::DefStruct(did.tr(dcx)), def::DefStruct(did) => def::DefStruct(did.tr(dcx)),
def::DefRegion(nid) => def::DefRegion(dcx.tr_id(nid)), def::DefRegion(nid) => def::DefRegion(dcx.tr_id(nid)),
def::DefTyParamBinder(nid) => {
def::DefTyParamBinder(dcx.tr_id(nid))
}
def::DefLabel(nid) => def::DefLabel(dcx.tr_id(nid)) def::DefLabel(nid) => def::DefLabel(dcx.tr_id(nid))
} }
} }

View file

@ -54,7 +54,6 @@ pub enum Def {
/// - If it's an ExprPath referring to some tuple struct, then DefMap maps /// - If it's an ExprPath referring to some tuple struct, then DefMap maps
/// it to a def whose id is the StructDef.ctor_id. /// it to a def whose id is the StructDef.ctor_id.
DefStruct(ast::DefId), DefStruct(ast::DefId),
DefTyParamBinder(ast::NodeId), /* struct, impl or trait with ty params */
DefRegion(ast::NodeId), DefRegion(ast::NodeId),
DefLabel(ast::NodeId), DefLabel(ast::NodeId),
DefMethod(ast::DefId /* method */, Option<ast::DefId> /* trait */, MethodProvenance), DefMethod(ast::DefId /* method */, Option<ast::DefId> /* trait */, MethodProvenance),
@ -145,7 +144,6 @@ impl Def {
DefSelfTy(id) | DefSelfTy(id) |
DefUpvar(id, _) | DefUpvar(id, _) |
DefRegion(id) | DefRegion(id) |
DefTyParamBinder(id) |
DefLabel(id) => { DefLabel(id) => {
local_def(id) local_def(id)
} }

View file

@ -580,7 +580,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
} }
def::DefMod(_) | def::DefForeignMod(_) | def::DefUse(_) | def::DefMod(_) | def::DefForeignMod(_) | def::DefUse(_) |
def::DefTrait(_) | def::DefTy(..) | def::DefPrimTy(_) | def::DefTrait(_) | def::DefTy(..) | def::DefPrimTy(_) |
def::DefTyParam(..) | def::DefTyParamBinder(..) | def::DefRegion(_) | def::DefTyParam(..) | def::DefRegion(_) |
def::DefLabel(_) | def::DefSelfTy(..) | def::DefLabel(_) | def::DefSelfTy(..) |
def::DefAssociatedTy(..) | def::DefAssociatedPath(..)=> { def::DefAssociatedTy(..) | def::DefAssociatedPath(..)=> {
Ok(Rc::new(cmt_ { Ok(Rc::new(cmt_ {

View file

@ -23,10 +23,8 @@ use Namespace::{TypeNS, ValueNS};
use NameBindings; use NameBindings;
use ParentLink::{self, ModuleParentLink, BlockParentLink}; use ParentLink::{self, ModuleParentLink, BlockParentLink};
use Resolver; use Resolver;
use RibKind::*;
use Shadowable; use Shadowable;
use TypeNsDef; use TypeNsDef;
use TypeParameters::HasTypeParameters;
use self::DuplicateCheckingMode::*; use self::DuplicateCheckingMode::*;
use self::NamespaceError::*; use self::NamespaceError::*;
@ -34,7 +32,6 @@ use self::NamespaceError::*;
use rustc::metadata::csearch; use rustc::metadata::csearch;
use rustc::metadata::decoder::{DefLike, DlDef, DlField, DlImpl}; use rustc::metadata::decoder::{DefLike, DlDef, DlField, DlImpl};
use rustc::middle::def::*; use rustc::middle::def::*;
use rustc::middle::subst::FnSpace;
use syntax::ast::{Block, Crate}; use syntax::ast::{Block, Crate};
use syntax::ast::{DeclItem, DefId}; use syntax::ast::{DeclItem, DefId};
@ -773,12 +770,9 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
} }
/// Constructs the reduced graph for one foreign item. /// Constructs the reduced graph for one foreign item.
fn build_reduced_graph_for_foreign_item<F>(&mut self, fn build_reduced_graph_for_foreign_item(&mut self,
foreign_item: &ForeignItem, foreign_item: &ForeignItem,
parent: &Rc<Module>, parent: &Rc<Module>) {
f: F) where
F: FnOnce(&mut Resolver),
{
let name = foreign_item.ident.name; let name = foreign_item.ident.name;
let is_public = foreign_item.vis == ast::Public; let is_public = foreign_item.vis == ast::Public;
let modifiers = if is_public { PUBLIC } else { DefModifiers::empty() } | IMPORTABLE; let modifiers = if is_public { PUBLIC } else { DefModifiers::empty() } | IMPORTABLE;
@ -786,25 +780,15 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
self.add_child(name, parent, ForbidDuplicateValues, self.add_child(name, parent, ForbidDuplicateValues,
foreign_item.span); foreign_item.span);
match foreign_item.node { let def = match foreign_item.node {
ForeignItemFn(_, ref generics) => { ForeignItemFn(..) => {
let def = DefFn(local_def(foreign_item.id), false); DefFn(local_def(foreign_item.id), false)
name_bindings.define_value(def, foreign_item.span, modifiers);
self.with_type_parameter_rib(
HasTypeParameters(generics,
FnSpace,
foreign_item.id,
NormalRibKind),
f);
} }
ForeignItemStatic(_, m) => { ForeignItemStatic(_, m) => {
let def = DefStatic(local_def(foreign_item.id), m); DefStatic(local_def(foreign_item.id), m)
name_bindings.define_value(def, foreign_item.span, modifiers);
f(self.resolver)
} }
} };
name_bindings.define_value(def, foreign_item.span, modifiers);
} }
fn build_reduced_graph_for_block(&mut self, block: &Block, parent: &Rc<Module>) -> Rc<Module> { fn build_reduced_graph_for_block(&mut self, block: &Block, parent: &Rc<Module>) -> Rc<Module> {
@ -980,7 +964,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
} }
DefLocal(..) | DefPrimTy(..) | DefTyParam(..) | DefLocal(..) | DefPrimTy(..) | DefTyParam(..) |
DefUse(..) | DefUpvar(..) | DefRegion(..) | DefUse(..) | DefUpvar(..) | DefRegion(..) |
DefTyParamBinder(..) | DefLabel(..) | DefSelfTy(..) => { DefLabel(..) | DefSelfTy(..) => {
panic!("didn't expect `{:?}`", def); panic!("didn't expect `{:?}`", def);
} }
} }
@ -1241,16 +1225,7 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
} }
fn visit_foreign_item(&mut self, foreign_item: &ForeignItem) { fn visit_foreign_item(&mut self, foreign_item: &ForeignItem) {
let parent = &self.parent; self.builder.build_reduced_graph_for_foreign_item(foreign_item, &self.parent);
self.builder.build_reduced_graph_for_foreign_item(foreign_item,
parent,
|r| {
let mut v = BuildReducedGraphVisitor {
builder: GraphBuilder { resolver: r },
parent: parent.clone()
};
visit::walk_foreign_item(&mut v, foreign_item);
})
} }
fn visit_block(&mut self, block: &Block) { fn visit_block(&mut self, block: &Block) {

File diff suppressed because it is too large Load diff

View file

@ -250,7 +250,6 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
def::DefSelfTy(_) | def::DefSelfTy(_) |
def::DefRegion(_) | def::DefRegion(_) |
def::DefTyParamBinder(_) |
def::DefLabel(_) | def::DefLabel(_) |
def::DefStaticMethod(..) | def::DefStaticMethod(..) |
def::DefTyParam(..) | def::DefTyParam(..) |

View file

@ -209,9 +209,8 @@ fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr)
} }
def::DefMod(..) | def::DefForeignMod(..) | def::DefTrait(..) | def::DefMod(..) | def::DefForeignMod(..) | def::DefTrait(..) |
def::DefTy(..) | def::DefPrimTy(..) | def::DefAssociatedTy(..) | def::DefTy(..) | def::DefPrimTy(..) | def::DefAssociatedTy(..) |
def::DefUse(..) | def::DefTyParamBinder(..) | def::DefUse(..) | def::DefRegion(..) | def::DefLabel(..) |
def::DefRegion(..) | def::DefLabel(..) | def::DefTyParam(..) | def::DefTyParam(..) | def::DefSelfTy(..) | def::DefAssociatedPath(..) => {
def::DefSelfTy(..) | def::DefAssociatedPath(..) => {
bcx.tcx().sess.span_bug( bcx.tcx().sess.span_bug(
ref_expr.span, ref_expr.span,
&format!("cannot translate def {:?} \ &format!("cannot translate def {:?} \

View file

@ -4729,7 +4729,6 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
def::DefSelfTy(..) | def::DefSelfTy(..) |
def::DefStruct(..) | def::DefStruct(..) |
def::DefVariant(..) | def::DefVariant(..) |
def::DefTyParamBinder(..) |
def::DefTy(..) | def::DefTy(..) |
def::DefAssociatedTy(..) | def::DefAssociatedTy(..) |
def::DefAssociatedPath(..) | def::DefAssociatedPath(..) |

View file

@ -1344,8 +1344,6 @@ pub enum Type {
typarams: Option<Vec<TyParamBound>>, typarams: Option<Vec<TyParamBound>>,
did: ast::DefId, did: ast::DefId,
}, },
// I have no idea how to usefully use this.
TyParamBinder(ast::NodeId),
/// For parameterized types, so the consumer of the JSON don't go /// For parameterized types, so the consumer of the JSON don't go
/// looking for types which don't exist anywhere. /// looking for types which don't exist anywhere.
Generic(String), Generic(String),
@ -2416,7 +2414,6 @@ fn resolve_type(cx: &DocContext,
ast::TyFloat(ast::TyF64) => return Primitive(F64), ast::TyFloat(ast::TyF64) => return Primitive(F64),
}, },
def::DefTyParam(_, _, _, n) => return Generic(token::get_name(n).to_string()), def::DefTyParam(_, _, _, n) => return Generic(token::get_name(n).to_string()),
def::DefTyParamBinder(i) => return TyParamBinder(i),
_ => {} _ => {}
}; };
let did = register_def(&*cx, def); let did = register_def(&*cx, def);

View file

@ -454,9 +454,6 @@ fn tybounds(w: &mut fmt::Formatter,
impl fmt::Display for clean::Type { impl fmt::Display for clean::Type {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
clean::TyParamBinder(id) => {
f.write_str(&cache().typarams[ast_util::local_def(id)])
}
clean::Generic(ref name) => { clean::Generic(ref name) => {
f.write_str(name) f.write_str(name)
} }

View file

@ -70,7 +70,7 @@ pub fn expand_deriving_eq<F>(cx: &mut ExtCtxt,
generics: LifetimeBounds::empty(), generics: LifetimeBounds::empty(),
explicit_self: borrowed_explicit_self(), explicit_self: borrowed_explicit_self(),
args: vec!(borrowed_self()), args: vec!(borrowed_self()),
ret_ty: Literal(path!(bool)), ret_ty: Literal(path_local!(bool)),
attributes: attrs, attributes: attrs,
combine_substructure: combine_substructure(box |a, b, c| { combine_substructure: combine_substructure(box |a, b, c| {
$f(a, b, c) $f(a, b, c)

View file

@ -36,7 +36,7 @@ pub fn expand_deriving_ord<F>(cx: &mut ExtCtxt,
generics: LifetimeBounds::empty(), generics: LifetimeBounds::empty(),
explicit_self: borrowed_explicit_self(), explicit_self: borrowed_explicit_self(),
args: vec!(borrowed_self()), args: vec!(borrowed_self()),
ret_ty: Literal(path!(bool)), ret_ty: Literal(path_local!(bool)),
attributes: attrs, attributes: attrs,
combine_substructure: combine_substructure(box |cx, span, substr| { combine_substructure: combine_substructure(box |cx, span, substr| {
cs_op($op, $equal, cx, span, substr) cs_op($op, $equal, cx, span, substr)

View file

@ -30,6 +30,12 @@ macro_rules! path {
) )
} }
macro_rules! path_local {
($x:ident) => (
::ext::deriving::generic::ty::Path::new_local(stringify!($x))
)
}
macro_rules! pathvec_std { macro_rules! pathvec_std {
($cx:expr, $first:ident :: $($rest:ident)::+) => ( ($cx:expr, $first:ident :: $($rest:ident)::+) => (
if $cx.use_std { if $cx.use_std {

View file

@ -38,7 +38,7 @@ pub fn expand_deriving_from_primitive<F>(cx: &mut ExtCtxt,
name: "from_i64", name: "from_i64",
generics: LifetimeBounds::empty(), generics: LifetimeBounds::empty(),
explicit_self: None, explicit_self: None,
args: vec!(Literal(path!(i64))), args: vec!(Literal(path_local!(i64))),
ret_ty: Literal(Path::new_(pathvec_std!(cx, core::option::Option), ret_ty: Literal(Path::new_(pathvec_std!(cx, core::option::Option),
None, None,
vec!(box Self_), vec!(box Self_),
@ -53,7 +53,7 @@ pub fn expand_deriving_from_primitive<F>(cx: &mut ExtCtxt,
name: "from_u64", name: "from_u64",
generics: LifetimeBounds::empty(), generics: LifetimeBounds::empty(),
explicit_self: None, explicit_self: None,
args: vec!(Literal(path!(u64))), args: vec!(Literal(path_local!(u64))),
ret_ty: Literal(Path::new_(pathvec_std!(cx, core::option::Option), ret_ty: Literal(Path::new_(pathvec_std!(cx, core::option::Option),
None, None,
vec!(box Self_), vec!(box Self_),

View file

@ -24,7 +24,7 @@ extern "rust-intrinsic" {
// Unresolved bounds should still error. // Unresolved bounds should still error.
fn align_of<T: NoSuchTrait>() -> usize; fn align_of<T: NoSuchTrait>() -> usize;
//~^ ERROR attempt to bound type parameter with a nonexistent trait `NoSuchTrait` //~^ ERROR use of undeclared trait name `NoSuchTrait`
} }
fn main() {} fn main() {}

View file

@ -36,9 +36,6 @@ fn main() {
import(); //~ ERROR: unresolved import(); //~ ERROR: unresolved
foo::<A>(); //~ ERROR: undeclared foo::<A>(); //~ ERROR: undeclared
//~^ ERROR: undeclared
foo::<C>(); //~ ERROR: undeclared foo::<C>(); //~ ERROR: undeclared
//~^ ERROR: undeclared
foo::<D>(); //~ ERROR: undeclared foo::<D>(); //~ ERROR: undeclared
//~^ ERROR: undeclared
} }

View file

@ -14,7 +14,8 @@ enum Bar<T> { What }
fn foo<T>() { fn foo<T>() {
static a: Bar<T> = Bar::What; static a: Bar<T> = Bar::What;
//~^ ERROR: cannot use an outer type parameter in this context //~^ ERROR cannot use an outer type parameter in this context
//~| ERROR use of undeclared type name `T`
} }
fn main() { fn main() {

View file

@ -11,7 +11,9 @@
fn main() { fn main() {
let foo = 100; let foo = 100;
static y: isize = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant static y: isize = foo + 1;
//~^ ERROR attempt to use a non-constant value in a constant
//~| ERROR unresolved name `foo`
println!("{}", y); println!("{}", y);
} }

View file

@ -13,7 +13,9 @@ fn main() {
#[derive(Debug)] #[derive(Debug)]
enum Stuff { enum Stuff {
Bar = foo //~ ERROR attempt to use a non-constant value in a constant Bar = foo
//~^ ERROR attempt to use a non-constant value in a constant
//~| ERROR unresolved name `foo`
} }
println!("{}", Stuff::Bar); println!("{}", Stuff::Bar);

View file

@ -9,7 +9,9 @@
// except according to those terms. // except according to those terms.
fn f(x:isize) { fn f(x:isize) {
static child: isize = x + 1; //~ ERROR attempt to use a non-constant value in a constant static child: isize = x + 1;
//~^ ERROR attempt to use a non-constant value in a constant
//~| ERROR unresolved name `x`
} }
fn main() {} fn main() {}

View file

@ -17,6 +17,7 @@ impl PTrait for P {
fn getChildOption(&self) -> Option<Box<P>> { fn getChildOption(&self) -> Option<Box<P>> {
static childVal: Box<P> = self.child.get(); static childVal: Box<P> = self.child.get();
//~^ ERROR attempt to use a non-constant value in a constant //~^ ERROR attempt to use a non-constant value in a constant
//~| ERROR unresolved name `self`
panic!(); panic!();
} }
} }

View file

@ -18,11 +18,11 @@
mod foo { mod foo {
mod baz { mod baz {
struct Test; struct Test;
impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Add for Test {} //~ ERROR: use of undeclared trait
impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Clone for Test {} //~ ERROR: use of undeclared trait
impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Iterator for Test {} //~ ERROR: use of undeclared trait
impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait impl ToString for Test {} //~ ERROR: use of undeclared trait
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Writer for Test {} //~ ERROR: use of undeclared trait
fn foo() { fn foo() {
drop(2) //~ ERROR: unresolved name drop(2) //~ ERROR: unresolved name
@ -30,11 +30,11 @@ mod foo {
} }
struct Test; struct Test;
impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Add for Test {} //~ ERROR: use of undeclared trait
impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Clone for Test {} //~ ERROR: use of undeclared trait
impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Iterator for Test {} //~ ERROR: use of undeclared trait
impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait impl ToString for Test {} //~ ERROR: use of undeclared trait
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Writer for Test {} //~ ERROR: use of undeclared trait
fn foo() { fn foo() {
drop(2) //~ ERROR: unresolved name drop(2) //~ ERROR: unresolved name
@ -45,11 +45,11 @@ fn qux() {
#[no_implicit_prelude] #[no_implicit_prelude]
mod qux_inner { mod qux_inner {
struct Test; struct Test;
impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Add for Test {} //~ ERROR: use of undeclared trait
impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Clone for Test {} //~ ERROR: use of undeclared trait
impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Iterator for Test {} //~ ERROR: use of undeclared trait
impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait impl ToString for Test {} //~ ERROR: use of undeclared trait
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Writer for Test {} //~ ERROR: use of undeclared trait
fn foo() { fn foo() {
drop(2) //~ ERROR: unresolved name drop(2) //~ ERROR: unresolved name

View file

@ -17,11 +17,11 @@
// fail with the same error message). // fail with the same error message).
struct Test; struct Test;
impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Add for Test {} //~ ERROR: use of undeclared trait
impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Clone for Test {} //~ ERROR: use of undeclared trait
impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Iterator for Test {} //~ ERROR: use of undeclared trait
impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait impl ToString for Test {} //~ ERROR: use of undeclared trait
impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait impl Writer for Test {} //~ ERROR: use of undeclared trait
fn main() { fn main() {
drop(2) //~ ERROR: unresolved name drop(2) //~ ERROR: unresolved name

View file

@ -10,11 +10,11 @@
trait NewTrait : SomeNonExistentTrait {} trait NewTrait : SomeNonExistentTrait {}
//~^ ERROR attempt to derive a nonexistent trait `SomeNonExistentTrait` //~^ ERROR use of undeclared trait name `SomeNonExistentTrait`
impl SomeNonExistentTrait for isize {} impl SomeNonExistentTrait for isize {}
//~^ ERROR attempt to implement a nonexistent trait `SomeNonExistentTrait` //~^ ERROR use of undeclared trait name `SomeNonExistentTrait`
fn f<T:SomeNonExistentTrait>() {} fn f<T:SomeNonExistentTrait>() {}
//~^ ERROR attempt to bound type parameter with a nonexistent trait `SomeNonExistentTrait` //~^ ERROR use of undeclared trait name `SomeNonExistentTrait`

View file

@ -10,7 +10,7 @@
#![feature(unboxed_closures)] #![feature(unboxed_closures)]
fn f<F:Nonexist(isize) -> isize>(x: F) {} //~ ERROR nonexistent trait `Nonexist` fn f<F:Nonexist(isize) -> isize>(x: F) {} //~ ERROR undeclared trait name `Nonexist`
type Typedef = isize; type Typedef = isize;