Teach typeck about auto trait

This commit is contained in:
leonardo.yvens 2017-10-12 11:18:55 -03:00
parent 1f4b630899
commit 00be060daf
2 changed files with 7 additions and 4 deletions

View File

@ -1742,8 +1742,8 @@ impl<'a> LoweringContext<'a> {
}
}
fn lower_is_auto(&mut self, u: IsAuto) -> hir::IsAuto {
match u {
fn lower_is_auto(&mut self, a: IsAuto) -> hir::IsAuto {
match a {
IsAuto::Yes => hir::IsAuto::Yes,
IsAuto::No => hir::IsAuto::No,
}

View File

@ -730,11 +730,14 @@ fn trait_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
let def_path_hash = tcx.def_path_hash(def_id);
let has_auto_impl = tcx.hir.trait_is_auto(def_id);
let is_auto = match item.node {
hir::ItemTrait(hir::IsAuto::Yes, ..) => true,
_ => tcx.hir.trait_is_auto(def_id),
};
let def = ty::TraitDef::new(def_id,
unsafety,
paren_sugar,
has_auto_impl,
is_auto,
def_path_hash);
tcx.alloc_trait_def(def)
}