diff --git a/src/liblibc b/src/liblibc index 56444a4545b..2b4cd1016bd 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit 56444a4545bd71430d64b86b8a71714cfdbe9f5d +Subproject commit 2b4cd1016bdba92becb4f982a4dcb18fe6653bc4 diff --git a/src/librustc_allocator/expand.rs b/src/librustc_allocator/expand.rs index 951c2280f76..26a7f50b997 100644 --- a/src/librustc_allocator/expand.rs +++ b/src/librustc_allocator/expand.rs @@ -15,7 +15,7 @@ use syntax::ast::{Crate, Attribute, LitKind, StrStyle, ExprKind}; use syntax::ast::{Unsafety, Constness, Generics, Mutability, Ty, Mac, Arg}; use syntax::ast::{self, Ident, Item, ItemKind, TyKind, VisibilityKind, Expr}; use syntax::attr; -use syntax::codemap::dummy_spanned; +use syntax::codemap::{dummy_spanned, respan}; use syntax::codemap::{ExpnInfo, NameAndSpan, MacroAttribute}; use syntax::ext::base::ExtCtxt; use syntax::ext::base::Resolver; @@ -97,7 +97,7 @@ impl<'a> Folder for ExpandAllocatorDirectives<'a> { ]); let mut items = vec![ f.cx.item_extern_crate(f.span, f.alloc), - f.cx.item_use_simple(f.span, dummy_spanned(VisibilityKind::Inherited), super_path), + f.cx.item_use_simple(f.span, respan(f.span.empty(), VisibilityKind::Inherited), super_path), ]; for method in ALLOCATOR_METHODS { items.push(f.allocator_fn(method)); diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 3e5ba4851cd..c1340d0a28a 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -497,7 +497,7 @@ impl CrateStore for cstore::CStore { tokens: body.into(), legacy: def.legacy, }), - vis: codemap::dummy_spanned(ast::VisibilityKind::Inherited), + vis: codemap::respan(local_span.empty(), ast::VisibilityKind::Inherited), tokens: None, }) } diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index c9c905723b2..bf82b077423 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -43,7 +43,7 @@ use syntax::print::pprust::{ ty_to_string }; use syntax::ptr::P; -use syntax::codemap::{Spanned, DUMMY_SP, dummy_spanned}; +use syntax::codemap::{Spanned, DUMMY_SP, respan}; use syntax_pos::*; use {escape, generated_code, lower_attributes, PathCollector, SaveContext}; @@ -1134,6 +1134,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { fn process_trait_item(&mut self, trait_item: &'l ast::TraitItem, trait_id: DefId) { self.process_macro_use(trait_item.span); + let vis_span = trait_item.span.empty(); match trait_item.node { ast::TraitItemKind::Const(ref ty, ref expr) => { self.process_assoc_const( @@ -1143,7 +1144,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { &ty, expr.as_ref().map(|e| &**e), trait_id, - dummy_spanned(ast::VisibilityKind::Public), + respan(vis_span, ast::VisibilityKind::Public), &trait_item.attrs, ); } @@ -1154,7 +1155,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { trait_item.id, trait_item.ident, &trait_item.generics, - dummy_spanned(ast::VisibilityKind::Public), + respan(vis_span, ast::VisibilityKind::Public), trait_item.span, ); } diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 6eaeec99b17..dd27dea4f0d 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -235,7 +235,7 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, ty, expr, ), - vis: codemap::dummy_spanned(ast::VisibilityKind::Public), + vis: codemap::respan(span.empty(), ast::VisibilityKind::Public), span, tokens: None, }) diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 2de4643aef9..7681f55bd8c 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -987,7 +987,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { attrs, id: ast::DUMMY_NODE_ID, node, - vis: dummy_spanned(ast::VisibilityKind::Inherited), + vis: respan(span.empty(), ast::VisibilityKind::Inherited), span, tokens: None, }) @@ -1033,7 +1033,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { span: ty.span, ty, ident: None, - vis: dummy_spanned(ast::VisibilityKind::Inherited), + vis: respan(span.empty(), ast::VisibilityKind::Inherited), attrs: Vec::new(), id: ast::DUMMY_NODE_ID, } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 9c0a7e95166..d4d9dfb01da 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -238,7 +238,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { node: ast::ItemKind::Mod(krate.module), ident: keywords::Invalid.ident(), id: ast::DUMMY_NODE_ID, - vis: dummy_spanned(ast::VisibilityKind::Public), + vis: respan(krate.span.empty(), ast::VisibilityKind::Public), tokens: None, }))); diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index b4c005e77a3..7a024dbad88 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast::{self, Arg, Arm, Block, Expr, Item, Pat, Stmt, Ty}; -use codemap::dummy_spanned; +use codemap::respan; use syntax_pos::Span; use ext::base::ExtCtxt; use ext::base; @@ -858,7 +858,7 @@ fn expand_wrapper(cx: &ExtCtxt, let path = path.iter().map(|s| s.to_string()).collect(); let use_item = cx.item_use_glob( sp, - dummy_spanned(ast::VisibilityKind::Inherited), + respan(sp.empty(), ast::VisibilityKind::Inherited), ids_ext(path), ); cx.stmt_item(sp, use_item) diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 670492818a6..1a2025b073b 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -21,7 +21,7 @@ use ast::*; use ast; use syntax_pos::Span; -use codemap::{Spanned, respan, dummy_spanned}; +use codemap::{Spanned, respan}; use parse::token::{self, Token}; use ptr::P; use symbol::keywords; @@ -1018,7 +1018,7 @@ pub fn noop_fold_crate(Crate {module, attrs, span}: Crate, ident: keywords::Invalid.ident(), attrs, id: ast::DUMMY_NODE_ID, - vis: dummy_spanned(ast::VisibilityKind::Public), + vis: respan(span.empty(), ast::VisibilityKind::Public), span, node: ast::ItemKind::Mod(module), tokens: None, diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 5ab9a484eb7..d2ae9904143 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -932,7 +932,7 @@ mod tests { span: sp(15,21), recovered: false, })), - vis: codemap::dummy_spanned(ast::VisibilityKind::Inherited), + vis: codemap::respan(sp(0, 0), ast::VisibilityKind::Inherited), span: sp(0,21)}))); } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 34499839fb0..3dfe3c9e5b9 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1573,7 +1573,7 @@ impl<'a> State<'a> { ti.ident, ty, default.as_ref().map(|expr| &**expr), - &codemap::dummy_spanned(ast::VisibilityKind::Inherited), + &codemap::respan(ti.span.empty(), ast::VisibilityKind::Inherited), )?; } ast::TraitItemKind::Method(ref sig, ref body) => { @@ -1584,7 +1584,7 @@ impl<'a> State<'a> { ti.ident, &ti.generics, sig, - &codemap::dummy_spanned(ast::VisibilityKind::Inherited), + &codemap::respan(ti.span.empty(), ast::VisibilityKind::Inherited), )?; if let Some(ref body) = *body { self.nbsp()?; diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs index ab42cfeb66b..da24107f4c3 100644 --- a/src/libsyntax/std_inject.rs +++ b/src/libsyntax/std_inject.rs @@ -14,7 +14,7 @@ use std::cell::Cell; use ext::hygiene::{Mark, SyntaxContext}; use symbol::{Symbol, keywords}; use syntax_pos::{DUMMY_SP, Span}; -use codemap::{ExpnInfo, NameAndSpan, MacroAttribute, dummy_spanned}; +use codemap::{ExpnInfo, NameAndSpan, MacroAttribute, dummy_spanned, respan}; use ptr::P; use tokenstream::TokenStream; @@ -78,7 +78,7 @@ pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option TraitDef<'a> { id: ast::DUMMY_NODE_ID, span: self.span, ident, - vis: dummy_spanned(ast::VisibilityKind::Inherited), + vis: respan(self.span.empty(), ast::VisibilityKind::Inherited), defaultness: ast::Defaultness::Final, attrs: Vec::new(), generics: Generics::default(), @@ -977,7 +977,7 @@ impl<'a> MethodDef<'a> { attrs: self.attributes.clone(), generics: fn_generics, span: trait_.span, - vis: dummy_spanned(ast::VisibilityKind::Inherited), + vis: respan(trait_.span.empty(), ast::VisibilityKind::Inherited), defaultness: ast::Defaultness::Final, ident: method_ident, node: ast::ImplItemKind::Method(ast::MethodSig { diff --git a/src/libsyntax_ext/global_asm.rs b/src/libsyntax_ext/global_asm.rs index dd882d7abdf..9605f6b5c5a 100644 --- a/src/libsyntax_ext/global_asm.rs +++ b/src/libsyntax_ext/global_asm.rs @@ -19,7 +19,7 @@ /// therefore apply. use syntax::ast; -use syntax::codemap::dummy_spanned; +use syntax::codemap::respan; use syntax::ext::base; use syntax::ext::base::*; use syntax::feature_gate; @@ -60,7 +60,7 @@ pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt, asm, ctxt: cx.backtrace(), })), - vis: dummy_spanned(ast::VisibilityKind::Inherited), + vis: respan(sp.empty(), ast::VisibilityKind::Inherited), span: sp, tokens: None, }))) diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 294506625bc..f9e01b630ae 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -216,6 +216,12 @@ impl Span { self.data().with_ctxt(ctxt) } + /// Returns a new span representing an empty span at the beginning of this span + #[inline] + pub fn empty(self) -> Span { + span.with_hi(self.lo()) + } + /// Returns `self` if `self` is not the dummy span, and `other` otherwise. pub fn substitute_dummy(self, other: Span) -> Span { if self.source_equal(&DUMMY_SP) { other } else { self } diff --git a/src/tools/cargo b/src/tools/cargo index 1d6dfea44f9..91e36aa86c7 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 1d6dfea44f97199d5d5c177c7dadcde393eaff9a +Subproject commit 91e36aa86c7037de50642f2fec1cf47c3d18af02