diff options
| author | leonardo.yvens <leoyvens@gmail.com> | 2017-10-12 11:18:55 -0300 |
|---|---|---|
| committer | leonardo.yvens <leoyvens@gmail.com> | 2017-11-03 16:13:20 -0200 |
| commit | 00be060daf3c38256e58360bfa591b8e22f60f7a (patch) | |
| tree | c475d3fbddbc2c4c71efaffa508f4d6d0210858a | |
| parent | 1f4b63089927f05d2171f2b3197d74ff26e42387 (diff) | |
| download | rust-00be060daf3c38256e58360bfa591b8e22f60f7a.tar.gz rust-00be060daf3c38256e58360bfa591b8e22f60f7a.zip | |
Teach typeck about `auto trait`
| -rw-r--r-- | src/librustc/hir/lowering.rs | 4 | ||||
| -rw-r--r-- | src/librustc_typeck/collect.rs | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 7214904887e..a69d41d1603 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -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, } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 72b40d87708..81447097428 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -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) } |
