Skip to content

Commit

Permalink
update for the generic param/arg merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jebrosen committed Jun 22, 2018
1 parent 43a7fe0 commit c5a24ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions core/codegen/src/decorators/derive_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::collections::HashMap;
use syntax::ext::base::{Annotatable, ExtCtxt};
use syntax::print::pprust::{stmt_to_string};
use syntax::ast::{ItemKind, Expr, MetaItem, Mutability, VariantData, Ident};
use syntax::ast::{StructField, GenericParam};
use syntax::ast::{StructField, GenericParam, GenericParamKind};
use syntax::codemap::Span;
use syntax::ext::build::AstBuilder;
use syntax::ptr::P;
Expand All @@ -27,11 +27,11 @@ fn struct_lifetime(ecx: &mut ExtCtxt, item: &Annotatable, sp: Span) -> Option<St
ItemKind::Struct(_, ref generics) => {
let mut lifetimes = generics.params.iter()
.filter_map(|p| match *p {
GenericParam::Lifetime(ref def) => Some(def),
GenericParam { ref ident, ref kind, .. } if *kind == GenericParamKind::Lifetime => Some(ident),
_ => None
});

let lifetime = lifetimes.next().map(|d| d.lifetime.ident.to_string());
let lifetime = lifetimes.next().map(|ident| ident.to_string());
if lifetimes.next().is_some() {
ecx.span_err(generics.span, "cannot have more than one \
lifetime parameter when deriving `FromForm`.");
Expand Down
6 changes: 3 additions & 3 deletions core/codegen/src/macros/uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt::Display;
use syntax::codemap::Span;
use syntax::ext::base::{DummyResult, ExtCtxt, MacEager, MacResult};
use syntax::tokenstream::{TokenStream, TokenTree};
use syntax::ast::{self, MacDelimiter, Ident};
use syntax::ast::{self, GenericArg, MacDelimiter, Ident};
use syntax::symbol::Symbol;
use syntax::parse::PResult;
use syntax::ext::build::AstBuilder;
Expand Down Expand Up @@ -132,8 +132,8 @@ pub fn uri_internal(

// path for call: <T as FromUriParam<_>>::from_uri_param
let idents = split_idents("rocket::http::uri::FromUriParam");
let generics = vec![ecx.ty(span, ast::TyKind::Infer)];
let trait_path = ecx.path_all(span, true, idents, vec![], generics, vec![]);
let generics = vec![GenericArg::Type(ecx.ty(span, ast::TyKind::Infer))];
let trait_path = ecx.path_all(span, true, idents, generics, vec![]);
let method = Ident::new(Symbol::intern("from_uri_param"), span);
let (qself, path) = ecx.qpath(ty.clone(), trait_path, method);

Expand Down

0 comments on commit c5a24ee

Please sign in to comment.