Merge remote-tracking branch 'origin/master' into yati_master
This commit is contained in:
@@ -97,7 +97,7 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
|
||||
},
|
||||
(&ExprIndex(ref la, ref li), &ExprIndex(ref ra, ref ri)) => self.eq_expr(la, ra) && self.eq_expr(li, ri),
|
||||
(&ExprIf(ref lc, ref lt, ref le), &ExprIf(ref rc, ref rt, ref re)) => {
|
||||
self.eq_expr(lc, rc) && self.eq_expr(&**lt, &**rt) && both(le, re, |l, r| self.eq_expr(l, r))
|
||||
self.eq_expr(lc, rc) && self.eq_expr(&**lt, &**rt) && both(le, re, |l, r| self.eq_expr(l, r))
|
||||
},
|
||||
(&ExprLit(ref l), &ExprLit(ref r)) => l.node == r.node,
|
||||
(&ExprLoop(ref lb, ref ll, ref lls), &ExprLoop(ref rb, ref rl, ref rls)) => {
|
||||
|
||||
@@ -372,6 +372,7 @@ fn print_item(cx: &LateContext, item: &hir::Item) {
|
||||
},
|
||||
hir::ItemMod(..) => println!("module"),
|
||||
hir::ItemForeignMod(ref fm) => println!("foreign module with abi: {}", fm.abi),
|
||||
hir::ItemGlobalAsm(ref asm) => println!("global asm: {:?}", asm),
|
||||
hir::ItemTy(..) => {
|
||||
println!("type alias for {:?}", cx.tcx.item_type(did));
|
||||
},
|
||||
|
||||
@@ -690,8 +690,10 @@ fn parse_attrs<F: FnMut(u64)>(sess: &Session, attrs: &[ast::Attribute], name: &'
|
||||
/// See also `is_direct_expn_of`.
|
||||
pub fn is_expn_of(mut span: Span, name: &str) -> Option<Span> {
|
||||
loop {
|
||||
let span_name_span = span.ctxt.outer()
|
||||
.expn_info().map(|ei| (ei.callee.name(), ei.call_site));
|
||||
let span_name_span = span.ctxt
|
||||
.outer()
|
||||
.expn_info()
|
||||
.map(|ei| (ei.callee.name(), ei.call_site));
|
||||
|
||||
match span_name_span {
|
||||
Some((mac_name, new_span)) if mac_name == name => return Some(new_span),
|
||||
@@ -709,8 +711,10 @@ pub fn is_expn_of(mut span: Span, name: &str) -> Option<Span> {
|
||||
/// `42` is considered expanded from `foo!` and `bar!` by `is_expn_of` but only `bar!` by
|
||||
/// `is_direct_expn_of`.
|
||||
pub fn is_direct_expn_of(span: Span, name: &str) -> Option<Span> {
|
||||
let span_name_span = span.ctxt.outer()
|
||||
.expn_info().map(|ei| (ei.callee.name(), ei.call_site));
|
||||
let span_name_span = span.ctxt
|
||||
.outer()
|
||||
.expn_info()
|
||||
.map(|ei| (ei.callee.name(), ei.call_site));
|
||||
|
||||
match span_name_span {
|
||||
Some((mac_name, new_span)) if mac_name == name => Some(new_span),
|
||||
@@ -900,7 +904,8 @@ pub fn opt_def_id(def: Def) -> Option<DefId> {
|
||||
Def::AssociatedConst(id) |
|
||||
Def::Local(id) |
|
||||
Def::Upvar(id, ..) |
|
||||
Def::Macro(id, _) => Some(id),
|
||||
Def::Macro(id, ..) |
|
||||
Def::GlobalAsm(id) => Some(id),
|
||||
|
||||
Def::Label(..) | Def::PrimTy(..) | Def::SelfTy(..) | Def::Err => None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user