use syntax_pos::hygiene::ExpnId;
use syntax_pos::Span;
+use rustc_error_codes::*;
+
const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF;
pub struct LoweringContext<'a> {
| ItemKind::Union(_, ref generics)
| ItemKind::Enum(_, ref generics)
| ItemKind::TyAlias(_, ref generics)
- | ItemKind::OpaqueTy(_, ref generics)
| ItemKind::Trait(_, _, ref generics, ..) => {
let def_id = self.lctx.resolver.definitions().local_def_id(item.id);
let count = generics
&NodeMap::default(),
ImplTraitContext::disallowed(),
),
- unsafety: this.lower_unsafety(f.unsafety),
+ unsafety: f.unsafety,
abi: this.lower_abi(f.abi),
decl: this.lower_fn_decl(&f.decl, None, false, None),
param_names: this.lower_fn_params_to_names(&f.decl),
if let Ok(snippet) = self.sess.source_map().span_to_snippet(data.span) {
// Do not suggest going from `Trait()` to `Trait<>`
if data.inputs.len() > 0 {
- let split = snippet.find('(').unwrap();
- let trait_name = &snippet[0..split];
- let args = &snippet[split + 1 .. snippet.len() - 1];
- err.span_suggestion(
- data.span,
- "use angle brackets instead",
- format!("{}<{}>", trait_name, args),
- Applicability::MaybeIncorrect,
- );
+ if let Some(split) = snippet.find('(') {
+ let trait_name = &snippet[0..split];
+ let args = &snippet[split + 1 .. snippet.len() - 1];
+ err.span_suggestion(
+ data.span,
+ "use angle brackets instead",
+ format!("{}<{}>", trait_name, args),
+ Applicability::MaybeIncorrect,
+ );
+ }
}
};
err.emit();
}, ids)
}
- fn lower_mutability(&mut self, m: Mutability) -> hir::Mutability {
- match m {
- Mutability::Mutable => hir::MutMutable,
- Mutability::Immutable => hir::MutImmutable,
- }
- }
-
fn lower_fn_params_to_names(&mut self, decl: &FnDecl) -> hir::HirVec<Ident> {
// Skip the `...` (`CVarArgs`) trailing arguments from the AST,
// as they are not explicit in HIR/Ty function signatures.
fn lower_mt(&mut self, mt: &MutTy, itctx: ImplTraitContext<'_>) -> hir::MutTy {
hir::MutTy {
ty: self.lower_ty(&mt.ty, itctx),
- mutbl: self.lower_mutability(mt.mutbl),
+ mutbl: mt.mutbl,
}
}
}
PatKind::Box(ref inner) => hir::PatKind::Box(self.lower_pat(inner)),
PatKind::Ref(ref inner, mutbl) => {
- hir::PatKind::Ref(self.lower_pat(inner), self.lower_mutability(mutbl))
+ hir::PatKind::Ref(self.lower_pat(inner), mutbl)
}
PatKind::Range(ref e1, ref e2, Spanned { node: ref end, .. }) => hir::PatKind::Range(
P(self.lower_expr(e1)),