Skip to content

Commit d4ea2c4

Browse files
committed
Various cleanups
1 parent c53b763 commit d4ea2c4

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

src/librustc/hir/map/mod.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,6 @@ impl<'hir> Map<'hir> {
558558
pub fn ty_param_owner(&self, id: NodeId) -> NodeId {
559559
match self.get(id) {
560560
NodeItem(&Item { node: ItemTrait(..), .. }) => id,
561-
NodeItem(&Item {
562-
node: ItemExistential(ExistTy {
563-
impl_trait_fn: Some(did),
564-
..
565-
}), ..
566-
}) => self.def_index_to_node_id(did.index),
567561
NodeTyParam(_) => self.get_parent_node(id),
568562
_ => {
569563
bug!("ty_param_owner: {} not a type parameter",
@@ -774,7 +768,7 @@ impl<'hir> Map<'hir> {
774768

775769
/// Retrieve the NodeId for `id`'s parent item, or `id` itself if no
776770
/// parent item is in this map. The "parent item" is the closest parent node
777-
/// in the AST which is recorded by the map and is an item, either an item
771+
/// in the HIR which is recorded by the map and is an item, either an item
778772
/// in a module, trait, or impl.
779773
pub fn get_parent(&self, id: NodeId) -> NodeId {
780774
match self.walk_parent_nodes(id, |node| match *node {

src/librustc_mir/monomorphize/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
944944
hir::ItemTy(..) |
945945
hir::ItemTrait(..) |
946946
hir::ItemTraitAlias(..) |
947+
hir::ItemExistential(..) |
947948
hir::ItemMod(..) => {
948949
// Nothing to do, just keep recursing...
949950
}
@@ -958,7 +959,6 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
958959

959960
hir::ItemEnum(_, ref generics) |
960961
hir::ItemStruct(_, ref generics) |
961-
hir::ItemExistential(hir::ExistTy { ref generics, .. }) |
962962
hir::ItemUnion(_, ref generics) => {
963963
if generics.params.is_empty() {
964964
if self.mode == MonoItemCollectionMode::Eager {

src/librustc_typeck/collect.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
797797
}
798798
NodeItem(item) => {
799799
match item.node {
800-
ItemExistential(hir::ExistTy { impl_trait_fn: parent_did, .. }) => parent_did,
800+
ItemExistential(hir::ExistTy { impl_trait_fn, .. }) => impl_trait_fn,
801801
_ => None,
802802
}
803803
},
@@ -1353,8 +1353,6 @@ pub fn explicit_predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
13531353

13541354
let predicates = bounds.predicates(tcx, anon_ty);
13551355

1356-
debug!("explicit_predicates_of: predicates={:?}", predicates);
1357-
13581356
return ty::GenericPredicates {
13591357
parent: None,
13601358
predicates: predicates
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub trait FakeGenerator {
12+
type Yield;
13+
type Return;
14+
}
15+
16+
pub trait FakeFuture {
17+
type Output;
18+
}
19+
20+
pub fn future_from_generator<
21+
T: FakeGenerator<Yield = ()>
22+
>(x: T) -> impl FakeFuture<Output = T::Return> {
23+
GenFuture(x)
24+
}
25+
26+
struct GenFuture<T: FakeGenerator<Yield = ()>>(T);
27+
28+
impl<T: FakeGenerator<Yield = ()>> FakeFuture for GenFuture<T> {
29+
type Output = T::Return;
30+
}
31+
32+
fn main() {}

0 commit comments

Comments
 (0)