about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/hir/lowering.rs40
-rw-r--r--src/librustc/hir/map/mod.rs2
-rw-r--r--src/librustc/hir/mod.rs12
-rw-r--r--src/librustc_resolve/lib.rs10
4 files changed, 26 insertions, 38 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index a849466abab..ad8da5a4350 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -168,7 +168,7 @@ pub trait Resolver {
         span: Span,
         crate_root: Option<&str>,
         components: &[&str],
-        params: Option<P<hir::PathParameters>>
+        params: Option<P<hir::GenericArgs>>,
         is_value: bool,
     ) -> hir::Path;
 }
@@ -1176,7 +1176,8 @@ impl<'a> LoweringContext<'a> {
                         // Set the name to `impl Bound1 + Bound2`
                         let exist_ty_name = Symbol::intern(&pprust::ty_to_string(t));
                         self.lower_existential_impl_trait(
-                            span, fn_def_id, exist_ty_name, |this| this.lower_bounds(bounds, itctx))
+                            span, fn_def_id, exist_ty_name,
+                            |this| this.lower_param_bounds(bounds, itctx))
                     }
                     ImplTraitContext::Universal(def_id) => {
                         let def_node_id = self.next_id().node_id;
@@ -1245,7 +1246,7 @@ impl<'a> LoweringContext<'a> {
         span: Span,
         fn_def_id: DefId,
         exist_ty_name: Name,
-        lower_bounds: impl FnOnce(&mut LoweringContext) -> hir::TyParamBounds,
+        lower_bounds: impl FnOnce(&mut LoweringContext) -> hir::GenericBounds,
     ) -> hir::Ty_ {
         // We need to manually repeat the code of `next_id` because the lowering
         // needs to happen while the owner_id is pointing to the item itself,
@@ -1970,15 +1971,15 @@ impl<'a> LoweringContext<'a> {
                 hir::intravisit::NestedVisitorMap::None
             }
 
-            fn visit_path_parameters(&mut self, span: Span, parameters: &'v hir::PathParameters) {
+            fn visit_generic_args(&mut self, span: Span, parameters: &'v hir::GenericArgs) {
                 // Don't collect elided lifetimes used inside of `Fn()` syntax.
                 if parameters.parenthesized {
                     let old_collect_elided_lifetimes = self.collect_elided_lifetimes;
                     self.collect_elided_lifetimes = false;
-                    hir::intravisit::walk_path_parameters(self, span, parameters);
+                    hir::intravisit::walk_generic_args(self, span, parameters);
                     self.collect_elided_lifetimes = old_collect_elided_lifetimes;
                 } else {
-                    hir::intravisit::walk_path_parameters(self, span, parameters);
+                    hir::intravisit::walk_generic_args(self, span, parameters);
                 }
             }
 
@@ -2013,11 +2014,12 @@ impl<'a> LoweringContext<'a> {
             }
 
             fn visit_generic_param(&mut self, param: &'v hir::GenericParam) {
-                // Record the introduction of 'a in `for<'a> ...`
-                if let hir::GenericParam::Lifetime(ref lt_def) = *param {
+                 // Record the introduction of 'a in `for<'a> ...`
+                if let hir::GenericParamKind::Lifetime { .. } = param.kind {
                     // Introduce lifetimes one at a time so that we can handle
                     // cases like `fn foo<'d>() -> impl for<'a, 'b: 'a, 'c: 'b + 'd>`
-                    self.currently_bound_lifetimes.push(lt_def.lifetime.name);
+                    let lt_name = hir::LifetimeName::Param(param.name);
+                    self.currently_bound_lifetimes.push(lt_name);
                 }
 
                 hir::intravisit::walk_generic_param(self, param);
@@ -2034,8 +2036,7 @@ impl<'a> LoweringContext<'a> {
                             return;
                         }
                     }
-                    name @ hir::LifetimeName::Fresh(_) => name,
-                    name @ hir::LifetimeName::Name(_) => name,
+                    hir::LifetimeName::Param(_) => lifetime.name,
                     hir::LifetimeName::Static => return,
                 };
 
@@ -2117,9 +2118,8 @@ impl<'a> LoweringContext<'a> {
             };
 
             // "<Output = T>"
-            let future_params = P(hir::PathParameters {
-                lifetimes: hir_vec![],
-                types: hir_vec![],
+            let future_params = P(hir::GenericArgs {
+                args: hir_vec![],
                 bindings: hir_vec![hir::TypeBinding {
                     name: Symbol::intern(FN_OUTPUT_NAME),
                     ty: output_ty,
@@ -2129,13 +2129,11 @@ impl<'a> LoweringContext<'a> {
                 parenthesized: false,
             });
 
-            let let future_path =
+            let future_path =
                 this.std_path(span, &["future", "Future"], Some(future_params), false);
 
-            // FIXME(cramertj) collect input lifetimes to function and add them to
-            // the output `impl Trait` type here.
             let mut bounds = vec![
-                hir::TyParamBound::TraitTyParamBound(
+                hir::GenericBound::Trait(
                     hir::PolyTraitRef {
                         trait_ref: hir::TraitRef {
                             path: future_path,
@@ -2149,7 +2147,7 @@ impl<'a> LoweringContext<'a> {
             ];
 
             if let Some((name, span)) = bound_lifetime {
-                bounds.push(hir::RegionTyParamBound(
+                bounds.push(hir::GenericBound::Outlives(
                     hir::Lifetime { id: this.next_id().node_id, name, span }));
             }
 
@@ -4366,7 +4364,7 @@ impl<'a> LoweringContext<'a> {
         &mut self,
         span: Span,
         components: &[&str],
-        params: Option<P<hir::PathParameters>>,
+        params: Option<P<hir::GenericArgs>>,
         attrs: ThinVec<Attribute>,
     ) -> hir::Expr {
         let path = self.std_path(span, components, params, true);
@@ -4545,7 +4543,7 @@ impl<'a> LoweringContext<'a> {
         &mut self,
         span: Span,
         components: &[&str],
-        params: Option<P<hir::PathParameters>>,
+        params: Option<P<hir::GenericArgs>>,
         is_value: bool
     ) -> hir::Path {
         self.resolver
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index 4ffe4f262ae..1e03381861b 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -174,7 +174,7 @@ impl<'hir> MapEntry<'hir> {
         match self {
             EntryItem(_, _, ref item) => {
                 match item.node {
-                    ItemFn(ref fn_decl, _, _, _, _, _) => Some(&fn_decl),
+                    ItemFn(ref fn_decl, _, _, _) => Some(&fn_decl),
                     _ => None,
                 }
             }
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index bd6bef29c29..b99a4a03de9 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -245,16 +245,6 @@ pub enum LifetimeName {
 }
 
 impl LifetimeName {
-    pub fn is_elided(self) -> bool {
-        match self {
-            LifetimeName::Implicit
-            | LifetimeName::Underscore => true,
-            LifetimeName::Fresh(_)
-            | LifetimeName::Static
-            | LifetimeName::Name(_) => false,
-        }
-    }
-
     pub fn name(&self) -> Name {
         use self::LifetimeName::*;
         match *self {
@@ -265,7 +255,7 @@ impl LifetimeName {
         }
     }
 
-    fn is_elided(&self) -> bool {
+    pub fn is_elided(&self) -> bool {
         use self::LifetimeName::*;
         match self {
             Implicit | Underscore => true,
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 822439752b5..792edf4d12b 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -55,7 +55,7 @@ use syntax::util::lev_distance::find_best_match_for_name;
 
 use syntax::visit::{self, FnKind, Visitor};
 use syntax::attr;
-use syntax::ast::{Arm, IsAsync, BindingMode, Block, Crate, Expr, ExprKind, FnHeader};
+use syntax::ast::{Arm, IsAsync, BindingMode, Block, Crate, Expr, ExprKind};
 use syntax::ast::{FnDecl, ForeignItem, ForeignItemKind, GenericParamKind, Generics};
 use syntax::ast::{Item, ItemKind, ImplItem, ImplItemKind};
 use syntax::ast::{Label, Local, Mutability, Pat, PatKind, Path};
@@ -1494,7 +1494,7 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> {
         span: Span,
         crate_root: Option<&str>,
         components: &[&str],
-        params: Option<hir::PathParameters>,
+        args: Option<P<hir::GenericArgs>>,
         is_value: bool
     ) -> hir::Path {
         let mut segments = iter::once(keywords::CrateRoot.name())
@@ -1504,11 +1504,11 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> {
                     .map(Symbol::intern)
             ).map(hir::PathSegment::from_name).collect::<Vec<_>>();
 
-        if let Some(parameters) = params {
-            let last_name = segments.last().unwrap().name;
+        if let Some(args) = args {
+            let name = segments.last().unwrap().name;
             *segments.last_mut().unwrap() = hir::PathSegment {
                 name,
-                parameters,
+                args: Some(args),
                 infer_types: true,
             };
         }