disr_expr: v.node.disr_expr.as_ref().map(|e| lower_expr(lctx, e)),
},
span: v.span,
- })
+ }
}
- pub fn lower_path(lctx: &LoweringContext, p: &Path) -> hir::Path {
+ // Path segments are usually unhygienic, hygienic path segments can occur only in
+ // identifier-like paths originating from `ExprPath`.
+ // Make life simpler for rustc_resolve by renaming only such segments.
+ pub fn lower_path_full(lctx: &LoweringContext, p: &Path, maybe_hygienic: bool) -> hir::Path {
+ let maybe_hygienic = maybe_hygienic && !p.global && p.segments.len() == 1;
hir::Path {
global: p.global,
segments: p.segments
fn stmt_let(lctx: &LoweringContext,
sp: Span,
mutbl: bool,
- ident: Ident,
+ ident: hir::Ident,
ex: P<hir::Expr>,
attrs: ThinAttributes)
- -> P<hir::Stmt> {
+ -> hir::Stmt {
let pat = if mutbl {
pat_ident_binding_mode(lctx, sp, ident, hir::BindByValue(hir::MutMutable))
} else {
fn path_all(sp: Span,
global: bool,
- mut idents: Vec<Ident>,
+ mut idents: Vec<hir::Ident>,
lifetimes: Vec<hir::Lifetime>,
types: Vec<P<hir::Ty>>,
- bindings: Vec<P<hir::TypeBinding>>)
+ bindings: Vec<hir::TypeBinding>)
-> hir::Path {
let last_identifier = idents.pop().unwrap();
let mut segments: Vec<hir::PathSegment> = idents.into_iter()
use syntax::ast::{CRATE_NODE_ID, Ident, Name, NodeId, CrateNum, TyIs, TyI8, TyI16, TyI32, TyI64};
use syntax::ast::{TyUs, TyU8, TyU16, TyU32, TyU64, TyF64, TyF32};
use syntax::attr::AttrMetaMethods;
- use syntax::ext::mtwt;
use syntax::parse::token::{self, special_names, special_idents};
-use syntax::ptr::P;
use syntax::codemap::{self, Span, Pos};
use syntax::util::lev_distance::{lev_distance, max_suggestion_distance};