Skip to content

Commit 00be060

Browse files
committed
Teach typeck about auto trait
1 parent 1f4b630 commit 00be060

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/librustc/hir/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,8 +1742,8 @@ impl<'a> LoweringContext<'a> {
17421742
}
17431743
}
17441744

1745-
fn lower_is_auto(&mut self, u: IsAuto) -> hir::IsAuto {
1746-
match u {
1745+
fn lower_is_auto(&mut self, a: IsAuto) -> hir::IsAuto {
1746+
match a {
17471747
IsAuto::Yes => hir::IsAuto::Yes,
17481748
IsAuto::No => hir::IsAuto::No,
17491749
}

src/librustc_typeck/collect.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,14 @@ fn trait_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
730730
}
731731

732732
let def_path_hash = tcx.def_path_hash(def_id);
733-
let has_auto_impl = tcx.hir.trait_is_auto(def_id);
733+
let is_auto = match item.node {
734+
hir::ItemTrait(hir::IsAuto::Yes, ..) => true,
735+
_ => tcx.hir.trait_is_auto(def_id),
736+
};
734737
let def = ty::TraitDef::new(def_id,
735738
unsafety,
736739
paren_sugar,
737-
has_auto_impl,
740+
is_auto,
738741
def_path_hash);
739742
tcx.alloc_trait_def(def)
740743
}

0 commit comments

Comments
 (0)