about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Schneider <github35764891676564198441@oli-obk.de>2018-06-13 09:11:23 +0200
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-06-13 09:11:23 +0200
commitd4ea2c43f5ef165b902a0ac709111db2be491c4c (patch)
treec3a13d297ee94154f997078d50f73dc682086b55
parentc53b76324cf41fa9c5116660ad73bc32de4d6c37 (diff)
downloadrust-d4ea2c43f5ef165b902a0ac709111db2be491c4c.tar.gz
rust-d4ea2c43f5ef165b902a0ac709111db2be491c4c.zip
Various cleanups
-rw-r--r--src/librustc/hir/map/mod.rs8
-rw-r--r--src/librustc_mir/monomorphize/collector.rs2
-rw-r--r--src/librustc_typeck/collect.rs4
-rw-r--r--src/test/run-pass/impl-trait/bounds_regression.rs32
4 files changed, 35 insertions, 11 deletions
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index 98b10f4e72f..9df55e52061 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -558,12 +558,6 @@ impl<'hir> Map<'hir> {
     pub fn ty_param_owner(&self, id: NodeId) -> NodeId {
         match self.get(id) {
             NodeItem(&Item { node: ItemTrait(..), .. }) => id,
-            NodeItem(&Item {
-                node: ItemExistential(ExistTy {
-                    impl_trait_fn: Some(did),
-                    ..
-                }), ..
-            }) => self.def_index_to_node_id(did.index),
             NodeTyParam(_) => self.get_parent_node(id),
             _ => {
                 bug!("ty_param_owner: {} not a type parameter",
@@ -774,7 +768,7 @@ impl<'hir> Map<'hir> {
 
     /// Retrieve the NodeId for `id`'s parent item, or `id` itself if no
     /// parent item is in this map. The "parent item" is the closest parent node
-    /// in the AST which is recorded by the map and is an item, either an item
+    /// in the HIR which is recorded by the map and is an item, either an item
     /// in a module, trait, or impl.
     pub fn get_parent(&self, id: NodeId) -> NodeId {
         match self.walk_parent_nodes(id, |node| match *node {
diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs
index c6b153632d5..1fb12172838 100644
--- a/src/librustc_mir/monomorphize/collector.rs
+++ b/src/librustc_mir/monomorphize/collector.rs
@@ -944,6 +944,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
             hir::ItemTy(..)          |
             hir::ItemTrait(..)       |
             hir::ItemTraitAlias(..)  |
+            hir::ItemExistential(..) |
             hir::ItemMod(..)         => {
                 // Nothing to do, just keep recursing...
             }
@@ -958,7 +959,6 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
 
             hir::ItemEnum(_, ref generics) |
             hir::ItemStruct(_, ref generics) |
-            hir::ItemExistential(hir::ExistTy { ref generics, .. }) |
             hir::ItemUnion(_, ref generics) => {
                 if generics.params.is_empty() {
                     if self.mode == MonoItemCollectionMode::Eager {
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 865758692b1..1b2b8dce6f0 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -797,7 +797,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         }
         NodeItem(item) => {
             match item.node {
-                ItemExistential(hir::ExistTy { impl_trait_fn: parent_did, .. }) => parent_did,
+                ItemExistential(hir::ExistTy { impl_trait_fn, .. }) => impl_trait_fn,
                 _ => None,
             }
         },
@@ -1353,8 +1353,6 @@ pub fn explicit_predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
                     let predicates = bounds.predicates(tcx, anon_ty);
 
-                    debug!("explicit_predicates_of: predicates={:?}", predicates);
-
                     return ty::GenericPredicates {
                         parent: None,
                         predicates: predicates
diff --git a/src/test/run-pass/impl-trait/bounds_regression.rs b/src/test/run-pass/impl-trait/bounds_regression.rs
new file mode 100644
index 00000000000..509fe93c417
--- /dev/null
+++ b/src/test/run-pass/impl-trait/bounds_regression.rs
@@ -0,0 +1,32 @@
+// Copyright 2018 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.
+
+pub trait FakeGenerator {
+    type Yield;
+    type Return;
+}
+
+pub trait FakeFuture {
+    type Output;
+}
+
+pub fn future_from_generator<
+    T: FakeGenerator<Yield = ()>
+>(x: T) -> impl FakeFuture<Output = T::Return> {
+    GenFuture(x)
+}
+
+struct GenFuture<T: FakeGenerator<Yield = ()>>(T);
+
+impl<T: FakeGenerator<Yield = ()>> FakeFuture for GenFuture<T> {
+    type Output = T::Return;
+}
+
+fn main() {}
\ No newline at end of file