]> git.lizzy.rs Git - rust.git/commitdiff
syntax::codemap: Add static DUMMY_SP
authorklutzy <klutzytheklutzy@gmail.com>
Wed, 1 Jan 2014 06:53:22 +0000 (15:53 +0900)
committerklutzy <klutzytheklutzy@gmail.com>
Wed, 1 Jan 2014 10:51:35 +0000 (19:51 +0900)
It replaces `dummy_sp()`.

21 files changed:
src/librustc/front/std_inject.rs
src/librustc/front/test.rs
src/librustc/metadata/creader.rs
src/librustc/metadata/decoder.rs
src/librustc/middle/astencode.rs
src/librustc/middle/check_match.rs
src/librustc/middle/resolve.rs
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/typeck/infer/mod.rs
src/librustc/middle/typeck/infer/test.rs
src/librustdoc/doctree.rs
src/librustpkg/util.rs
src/libsyntax/codemap.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/transcribe.rs
src/libsyntax/parse/lexer.rs
src/libsyntax/print/pprust.rs

index 13bf867e06be11dfd99df31faf34aa9499e26c60..97ffc1490f5efe4a58e339e575fa1a0b7932ba26 100644 (file)
@@ -14,7 +14,7 @@
 use std::vec;
 use syntax::ast;
 use syntax::attr;
-use syntax::codemap::dummy_sp;
+use syntax::codemap::DUMMY_SP;
 use syntax::codemap;
 use syntax::fold::ast_fold;
 use syntax::fold;
@@ -47,7 +47,7 @@ fn no_prelude(attrs: &[ast::Attribute]) -> bool {
 fn spanned<T>(x: T) -> codemap::Spanned<T> {
     codemap::Spanned {
         node: x,
-        span: dummy_sp(),
+        span: DUMMY_SP,
     }
 }
 
@@ -66,7 +66,7 @@ fn fold_crate(&mut self, crate: ast::Crate) -> ast::Crate {
                                             ast::DUMMY_NODE_ID),
             attrs: ~[],
             vis: ast::private,
-            span: dummy_sp()
+            span: DUMMY_SP
         }];
 
         if use_uv(&crate) && !self.sess.building_library.get() {
@@ -77,7 +77,7 @@ fn fold_crate(&mut self, crate: ast::Crate) -> ast::Crate {
                                                 ast::DUMMY_NODE_ID),
                 attrs: ~[],
                 vis: ast::private,
-                span: dummy_sp()
+                span: DUMMY_SP
             });
             vis.push(ast::view_item {
                 node: ast::view_item_extern_mod(self.sess.ident_of("rustuv"),
@@ -86,7 +86,7 @@ fn fold_crate(&mut self, crate: ast::Crate) -> ast::Crate {
                                                 ast::DUMMY_NODE_ID),
                 attrs: ~[],
                 vis: ast::private,
-                span: dummy_sp()
+                span: DUMMY_SP
             });
         }
 
@@ -121,7 +121,7 @@ fn fold_item(&mut self, item: @ast::item) -> SmallVector<@ast::item> {
 
     fn fold_mod(&mut self, module: &ast::_mod) -> ast::_mod {
         let prelude_path = ast::Path {
-            span: dummy_sp(),
+            span: DUMMY_SP,
             global: false,
             segments: ~[
                 ast::PathSegment {
@@ -143,7 +143,7 @@ fn fold_mod(&mut self, module: &ast::_mod) -> ast::_mod {
             node: ast::view_item_use(~[vp]),
             attrs: ~[],
             vis: ast::private,
-            span: dummy_sp(),
+            span: DUMMY_SP,
         };
 
         let vis = vec::append(~[vi2], module.view_items);
index 7b2697b1d28e9b8a961e14ac93edaca7a20c616c..2b104cde95ae7697444aa19cc5cb174d6decb66c 100644 (file)
@@ -19,7 +19,7 @@
 use syntax::ast_util::*;
 use syntax::attr::AttrMetaMethods;
 use syntax::attr;
-use syntax::codemap::{dummy_sp, Span, ExpnInfo, NameAndSpan, MacroAttribute};
+use syntax::codemap::{DUMMY_SP, Span, ExpnInfo, NameAndSpan, MacroAttribute};
 use syntax::codemap;
 use syntax::ext::base::ExtCtxt;
 use syntax::fold::ast_fold;
@@ -164,7 +164,7 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
     };
 
     cx.ext_cx.bt_push(ExpnInfo {
-        call_site: dummy_sp(),
+        call_site: DUMMY_SP,
         callee: NameAndSpan {
             name: @"test",
             format: MacroAttribute,
@@ -298,7 +298,7 @@ fn mk_std(cx: &TestCtxt) -> ast::view_item {
         node: vi,
         attrs: ~[],
         vis: ast::public,
-        span: dummy_sp()
+        span: DUMMY_SP
     }
 }
 
@@ -335,7 +335,7 @@ pub fn main() {
         id: ast::DUMMY_NODE_ID,
         node: item_,
         vis: ast::public,
-        span: dummy_sp(),
+        span: DUMMY_SP,
      };
 
     debug!("Synthetic test module:\n{}\n",
@@ -345,12 +345,12 @@ pub fn main() {
 }
 
 fn nospan<T>(t: T) -> codemap::Spanned<T> {
-    codemap::Spanned { node: t, span: dummy_sp() }
+    codemap::Spanned { node: t, span: DUMMY_SP }
 }
 
 fn path_node(ids: ~[ast::Ident]) -> ast::Path {
     ast::Path {
-        span: dummy_sp(),
+        span: DUMMY_SP,
         global: false,
         segments: ids.move_iter().map(|identifier| ast::PathSegment {
             identifier: identifier,
@@ -362,7 +362,7 @@ fn path_node(ids: ~[ast::Ident]) -> ast::Path {
 
 fn path_node_global(ids: ~[ast::Ident]) -> ast::Path {
     ast::Path {
-        span: dummy_sp(),
+        span: DUMMY_SP,
         global: true,
         segments: ids.move_iter().map(|identifier| ast::PathSegment {
             identifier: identifier,
@@ -403,13 +403,13 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
     let inner_expr = @ast::Expr {
         id: ast::DUMMY_NODE_ID,
         node: ast::ExprVec(descs, ast::MutImmutable),
-        span: dummy_sp(),
+        span: DUMMY_SP,
     };
 
     @ast::Expr {
         id: ast::DUMMY_NODE_ID,
         node: ast::ExprVstore(inner_expr, ast::ExprVstoreSlice),
-        span: dummy_sp(),
+        span: DUMMY_SP,
     }
 }
 
index 673caa04487c6f69aee1edf61c7dc2f453f8245d..33e407dec1a1044105873a00a5b28cb2ed2968f5 100644 (file)
@@ -21,7 +21,7 @@
 use syntax::abi;
 use syntax::attr;
 use syntax::attr::AttrMetaMethods;
-use syntax::codemap::{Span, dummy_sp};
+use syntax::codemap::{Span, DUMMY_SP};
 use syntax::diagnostic::SpanHandler;
 use syntax::parse::token;
 use syntax::parse::token::ident_interner;
@@ -346,7 +346,7 @@ fn resolve_crate_deps(e: &mut Env, cdata: &[u8]) -> cstore::cnum_map {
             // This is a new one so we've got to load it
             // FIXME (#2404): Need better error reporting than just a bogus
             // span.
-            let fake_span = dummy_sp();
+            let fake_span = DUMMY_SP;
             let local_cnum = resolve_crate(e, cname_str, cname_str, dep.vers,
                                            dep.hash, fake_span);
             cnum_map.insert(extrn_cnum, local_cnum);
index b4c19c771dc0aacb2c8e112a37e794f0b1ee9ffd..4e4ab981bf672b50c3498c9fc2ecf8c1bbc527f0 100644 (file)
@@ -1099,7 +1099,7 @@ fn get_attributes(md: ebml::Doc) -> ~[ast::Attribute] {
                         value: meta_item,
                         is_sugared_doc: false,
                     },
-                    span: codemap::dummy_sp()
+                    span: codemap::DUMMY_SP
                 });
             true
         });
index 90825289ac39f4f57581929904ecbf95157ff649..f413dfd2451ccd0bd0ec2aabd27e6f9b8f3b047d 100644 (file)
@@ -218,7 +218,7 @@ pub fn tr_intern_def_id(&self, did: ast::DefId) -> ast::DefId {
         ast::DefId { crate: ast::LOCAL_CRATE, node: self.tr_id(did.node) }
     }
     pub fn tr_span(&self, _span: Span) -> Span {
-        codemap::dummy_sp() // FIXME (#1972): handle span properly
+        codemap::DUMMY_SP // FIXME (#1972): handle span properly
     }
 }
 
index 35ac2190888a5b60e9218fe36a4f05d7b4ab7911..079c275026887d9f297b73f0e02bafb6afbceb9d 100644 (file)
@@ -23,7 +23,7 @@
 use std::vec;
 use syntax::ast::*;
 use syntax::ast_util::{unguarded_pat, walk_pat};
-use syntax::codemap::{Span, dummy_sp, Spanned};
+use syntax::codemap::{Span, DUMMY_SP, Spanned};
 use syntax::visit;
 use syntax::visit::{Visitor,fn_kind};
 
@@ -536,11 +536,11 @@ fn ctor_arity(cx: &MatchCheckCtxt, ctor: &ctor, ty: ty::t) -> uint {
 }
 
 fn wild() -> @Pat {
-    @Pat {id: 0, node: PatWild, span: dummy_sp()}
+    @Pat {id: 0, node: PatWild, span: DUMMY_SP}
 }
 
 fn wild_multi() -> @Pat {
-    @Pat {id: 0, node: PatWildMulti, span: dummy_sp()}
+    @Pat {id: 0, node: PatWildMulti, span: DUMMY_SP}
 }
 
 fn specialize(cx: &MatchCheckCtxt,
index 40934b985d346da1bee2f7e7b60ebc337e39d8e6..5de4de89b8e1e3564f563d8d1f8f633cb50eb698 100644 (file)
@@ -24,7 +24,7 @@
 use syntax::parse::token::{ident_interner, interner_get};
 use syntax::parse::token::special_idents;
 use syntax::print::pprust::path_to_str;
-use syntax::codemap::{Span, dummy_sp, Pos};
+use syntax::codemap::{Span, DUMMY_SP, Pos};
 use syntax::opt_vec::OptVec;
 use syntax::visit;
 use syntax::visit::Visitor;
@@ -1643,7 +1643,7 @@ fn handle_external_def(&mut self,
                                                   NormalModuleKind,
                                                   true,
                                                   is_public,
-                                                  dummy_sp());
+                                                  DUMMY_SP);
               }
             }
           }
@@ -1661,16 +1661,16 @@ fn handle_external_def(&mut self,
             // public.
             let is_public = vis != ast::private;
             if is_struct {
-                child_name_bindings.define_type(def, dummy_sp(), is_public);
+                child_name_bindings.define_type(def, DUMMY_SP, is_public);
                 self.structs.insert(variant_id);
             } else {
-                child_name_bindings.define_value(def, dummy_sp(), is_public);
+                child_name_bindings.define_value(def, DUMMY_SP, is_public);
             }
           }
           DefFn(..) | DefStaticMethod(..) | DefStatic(..) => {
             debug!("(building reduced graph for external \
                     crate) building value (fn/static) {}", final_ident);
-            child_name_bindings.define_value(def, dummy_sp(), is_public);
+            child_name_bindings.define_value(def, DUMMY_SP, is_public);
           }
           DefTrait(def_id) => {
               debug!("(building reduced graph for external \
@@ -1711,7 +1711,7 @@ trait method '{}'",
                   }
               }
 
-              child_name_bindings.define_type(def, dummy_sp(), is_public);
+              child_name_bindings.define_type(def, DUMMY_SP, is_public);
 
               // Define a module if necessary.
               let parent_link = self.get_parent_link(new_parent, ident);
@@ -1720,21 +1720,21 @@ trait method '{}'",
                                                   TraitModuleKind,
                                                   true,
                                                   is_public,
-                                                  dummy_sp())
+                                                  DUMMY_SP)
           }
           DefTy(_) => {
               debug!("(building reduced graph for external \
                       crate) building type {}", final_ident);
 
-              child_name_bindings.define_type(def, dummy_sp(), is_public);
+              child_name_bindings.define_type(def, DUMMY_SP, is_public);
           }
           DefStruct(def_id) => {
             debug!("(building reduced graph for external \
                     crate) building type and value for {}",
                    final_ident);
-            child_name_bindings.define_type(def, dummy_sp(), is_public);
+            child_name_bindings.define_type(def, DUMMY_SP, is_public);
             if csearch::get_struct_fields(self.session.cstore, def_id).len() == 0 {
-                child_name_bindings.define_value(def, dummy_sp(), is_public);
+                child_name_bindings.define_value(def, DUMMY_SP, is_public);
             }
             self.structs.insert(def_id);
           }
@@ -1782,7 +1782,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                             self.add_child(ident,
                                            ModuleReducedGraphParent(root),
                                            OverwriteDuplicates,
-                                           dummy_sp());
+                                           DUMMY_SP);
 
                         self.handle_external_def(def,
                                                  visibility,
@@ -1814,7 +1814,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                                         final_ident,
                                         ModuleReducedGraphParent(root),
                                         OverwriteDuplicates,
-                                        dummy_sp());
+                                        DUMMY_SP);
 
                                 // Process the static methods. First,
                                 // create the module.
@@ -1842,7 +1842,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                                             ImplModuleKind,
                                             true,
                                             true,
-                                            dummy_sp());
+                                            DUMMY_SP);
                                         type_module =
                                             child_name_bindings.
                                                 get_module();
@@ -1864,13 +1864,13 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
                                         self.add_child(ident,
                                                        new_parent,
                                                        OverwriteDuplicates,
-                                                       dummy_sp());
+                                                       DUMMY_SP);
                                     let def = DefFn(
                                         static_method_info.def_id,
                                         static_method_info.purity);
 
                                     method_name_bindings.define_value(
-                                        def, dummy_sp(),
+                                        def, DUMMY_SP,
                                         visibility == ast::public);
                                 }
                             }
@@ -5576,7 +5576,7 @@ fn check_for_item_unused_imports(&self, vi: &view_item) {
         // because this means that they were generated in some fashion by the
         // compiler and we don't need to consider them.
         if vi.vis == public { return }
-        if vi.span == dummy_sp() { return }
+        if vi.span == DUMMY_SP { return }
 
         match vi.node {
             view_item_extern_mod(..) => {} // ignore
index 949a4369f0b3cf1037102947081e11bc5e8c2b6f..d9ba2c68f436fbf2634189a20a0381bdbd6650f4 100644 (file)
 use syntax::ast::Ident;
 use syntax::ast_util::path_to_ident;
 use syntax::ast_util;
-use syntax::codemap::{Span, dummy_sp};
+use syntax::codemap::{Span, DUMMY_SP};
 
 // An option identifying a literal: either a unit-like struct or an
 // expression.
@@ -617,7 +617,7 @@ fn enter_opt<'r>(bcx: @Block,
     let _indenter = indenter();
 
     let tcx = bcx.tcx();
-    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: dummy_sp()};
+    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: DUMMY_SP};
     let mut i = 0;
     enter_match(bcx, tcx.def_map, m, col, val, |p| {
         let answer = match p.node {
@@ -758,7 +758,7 @@ fn enter_rec_or_struct<'r>(bcx: @Block,
            bcx.val_to_str(val));
     let _indenter = indenter();
 
-    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: dummy_sp()};
+    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: DUMMY_SP};
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatStruct(_, ref fpats, _) => {
@@ -793,7 +793,7 @@ fn enter_tup<'r>(bcx: @Block,
            bcx.val_to_str(val));
     let _indenter = indenter();
 
-    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: dummy_sp()};
+    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: DUMMY_SP};
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatTup(ref elts) => Some((*elts).clone()),
@@ -819,7 +819,7 @@ fn enter_tuple_struct<'r>(bcx: @Block,
            bcx.val_to_str(val));
     let _indenter = indenter();
 
-    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: dummy_sp()};
+    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: DUMMY_SP};
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatEnum(_, Some(ref elts)) => Some((*elts).clone()),
@@ -844,7 +844,7 @@ fn enter_box<'r>(bcx: @Block,
            bcx.val_to_str(val));
     let _indenter = indenter();
 
-    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: dummy_sp()};
+    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: DUMMY_SP};
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatBox(sub) => {
@@ -871,7 +871,7 @@ fn enter_uniq<'r>(bcx: @Block,
            bcx.val_to_str(val));
     let _indenter = indenter();
 
-    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: dummy_sp()};
+    let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: DUMMY_SP};
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatUniq(sub) => {
@@ -898,7 +898,7 @@ fn enter_region<'r>(bcx: @Block,
            bcx.val_to_str(val));
     let _indenter = indenter();
 
-    let dummy = @ast::Pat { id: 0, node: ast::PatWild, span: dummy_sp() };
+    let dummy = @ast::Pat { id: 0, node: ast::PatWild, span: DUMMY_SP };
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatRegion(sub) => {
@@ -1535,7 +1535,7 @@ fn compile_submatch_continue(mut bcx: @Block,
                                 vals.slice(col + 1u, vals.len()));
     let ccx = bcx.fcx.ccx;
     let mut pat_id = 0;
-    let mut pat_span = dummy_sp();
+    let mut pat_span = DUMMY_SP;
     for br in m.iter() {
         // Find a real id (we're adding placeholder wildcard patterns, but
         // each column is guaranteed to have at least one real pattern)
index 08d2c3f0caf5fc7d83aad6ec5538afc525f8f909..4f075c79dc8796d9d3e0d29962a6bec266454057 100644 (file)
@@ -2107,7 +2107,7 @@ pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
             ty: varg.ty(),
             pat: ast_util::ident_to_pat(
                 ccx.tcx.sess.next_node_id(),
-                codemap::dummy_sp(),
+                codemap::DUMMY_SP,
                 special_idents::arg),
             id: varg.id(),
         }
index 3e9aae4730e34cb6008f1c3fff0d93cd8df0d9e5..c00df5f165cb34f034f67b2840f8d1c0e8f335d2 100644 (file)
@@ -678,7 +678,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
     };
 
     // This can be the case for functions inlined from another crate
-    if span == codemap::dummy_sp() {
+    if span == codemap::DUMMY_SP {
         return FunctionWithoutDebugInfo;
     }
 
@@ -797,7 +797,7 @@ fn get_function_signature(cx: &CrateContext,
                     }
                 };
 
-                signature.push(type_metadata(cx, return_type, codemap::dummy_sp()));
+                signature.push(type_metadata(cx, return_type, codemap::DUMMY_SP));
             }
         }
 
@@ -812,7 +812,7 @@ fn get_function_signature(cx: &CrateContext,
                 }
             };
 
-            signature.push(type_metadata(cx, arg_type, codemap::dummy_sp()));
+            signature.push(type_metadata(cx, arg_type, codemap::DUMMY_SP));
         }
 
         return create_DIArray(DIB(cx), signature);
@@ -856,7 +856,7 @@ fn get_template_parameters(cx: &CrateContext,
             if cx.sess.opts.extra_debuginfo {
                 let actual_self_type_metadata = type_metadata(cx,
                                                               actual_self_type,
-                                                              codemap::dummy_sp());
+                                                              codemap::DUMMY_SP);
 
                 let ident = special_idents::type_self;
 
@@ -897,7 +897,7 @@ fn get_template_parameters(cx: &CrateContext,
 
             // Again, only create type information if extra_debuginfo is enabled
             if cx.sess.opts.extra_debuginfo {
-                let actual_type_metadata = type_metadata(cx, actual_type, codemap::dummy_sp());
+                let actual_type_metadata = type_metadata(cx, actual_type, codemap::DUMMY_SP);
                 let param_metadata = token::ident_to_str(&ident).with_c_str(|name| {
                     unsafe {
                         llvm::LLVMDIBuilderCreateTemplateTypeParameter(
@@ -1271,7 +1271,7 @@ fn finalize(&self, cx: &CrateContext) -> DICompositeType {
                                               llvm_type,
                                               member_descriptions,
                                               file_metadata,
-                                              codemap::dummy_sp());
+                                              codemap::DUMMY_SP);
                 return metadata_stub;
             }
         }
@@ -1364,7 +1364,7 @@ fn create_member_descriptions(&self, cx: &CrateContext)
                                               variant_llvm_type,
                                               member_descriptions,
                                               self.file_metadata,
-                                              codemap::dummy_sp());
+                                              codemap::DUMMY_SP);
                 MemberDescription {
                     name: @"",
                     llvm_type: variant_llvm_type,
@@ -1419,12 +1419,12 @@ fn describe_variant(cx: &CrateContext,
                 cx.sess.span_warn(span,
                     format!("debuginfo::enum_metadata()::adt_struct_metadata() - Unexpected node \
                           type: {:?}. This is a bug.", node));
-                codemap::dummy_sp()
+                codemap::DUMMY_SP
             }
         }
     } else {
         // For definitions from other crates we have no location information available.
-        codemap::dummy_sp()
+        codemap::DUMMY_SP
     };
 
     let metadata_stub = create_struct_stub(cx,
@@ -1511,7 +1511,7 @@ fn prepare_enum_metadata(cx: &CrateContext,
         let discriminant_llvm_type = adt::ll_inttype(cx, inttype);
         let (discriminant_size, discriminant_align) = size_and_align_of(cx, discriminant_llvm_type);
         let discriminant_base_type_metadata = type_metadata(cx, adt::ty_of_inttype(inttype),
-                                                            codemap::dummy_sp());
+                                                            codemap::DUMMY_SP);
         enum_name.with_c_str(|enum_name| {
             unsafe {
                 llvm::LLVMDIBuilderCreateEnumerationType(
@@ -1773,13 +1773,13 @@ fn boxed_type_metadata(cx: &CrateContext,
 
     let int_type = ty::mk_int();
     let nil_pointer_type = ty::mk_nil_ptr(cx.tcx);
-    let nil_pointer_type_metadata = type_metadata(cx, nil_pointer_type, codemap::dummy_sp());
+    let nil_pointer_type_metadata = type_metadata(cx, nil_pointer_type, codemap::DUMMY_SP);
 
     let member_descriptions = [
         MemberDescription {
             name: @"refcnt",
             llvm_type: member_llvm_types[0],
-            type_metadata: type_metadata(cx, int_type, codemap::dummy_sp()),
+            type_metadata: type_metadata(cx, int_type, codemap::DUMMY_SP),
             offset: ComputedMemberOffset,
         },
         MemberDescription {
@@ -2086,14 +2086,14 @@ fn create_pointer_to_box_metadata(cx: &CrateContext,
         let content_type_metadata = type_metadata(
             cx,
             type_in_box,
-            codemap::dummy_sp());
+            codemap::DUMMY_SP);
 
         let box_metadata = boxed_type_metadata(
             cx,
             Some(content_type_name),
             content_llvm_type,
             content_type_metadata,
-            codemap::dummy_sp());
+            codemap::DUMMY_SP);
 
         pointer_type_metadata(cx, pointer_type, box_metadata)
     }
@@ -2294,13 +2294,13 @@ fn get_namespace_and_span_for_item(cx: &CrateContext,
                 cx.sess.span_warn(warning_span,
                     format!("debuginfo::get_namespace_and_span_for_item() \
                              - Unexpected node type: {:?}", *node));
-                codemap::dummy_sp()
+                codemap::DUMMY_SP
             }
         };
         definition_span
     } else {
         // For external items there is no span information
-        codemap::dummy_sp()
+        codemap::DUMMY_SP
     };
 
     (containing_scope, definition_span)
index 8a95f9d1bff3fdd72f6a0686e44f44317b2ed669..9b71da4f767f6c773604709a2beaa6585ea1f9d4 100644 (file)
@@ -326,7 +326,7 @@ pub fn can_mk_subty(cx: @InferCtxt, a: ty::t, b: ty::t) -> ures {
     indent(|| {
         cx.probe(|| {
             let trace = TypeTrace {
-                origin: Misc(codemap::dummy_sp()),
+                origin: Misc(codemap::DUMMY_SP),
                 values: Types(expected_found(true, a, b))
             };
             cx.sub(true, trace).tys(a, b)
@@ -418,7 +418,7 @@ pub fn can_mk_coercety(cx: @InferCtxt, a: ty::t, b: ty::t) -> ures {
     indent(|| {
         cx.probe(|| {
             let trace = TypeTrace {
-                origin: Misc(codemap::dummy_sp()),
+                origin: Misc(codemap::DUMMY_SP),
                 values: Types(expected_found(true, a, b))
             };
             Coerce(cx.combine_fields(true, trace)).tys(a, b)
@@ -927,7 +927,7 @@ pub fn span(&self) -> Span {
             BoundRegionInFnCall(a, _) => a,
             BoundRegionInFnType(a, _) => a,
             BoundRegionInTypeOrImpl(a) => a,
-            BoundRegionInCoherence => codemap::dummy_sp(),
+            BoundRegionInCoherence => codemap::DUMMY_SP,
         }
     }
 }
index a48e7b5d0f0e70feb9107e5856b35f10827c0794..f2ea3a320ee556040fe97275094c4c020fe66be0 100644 (file)
@@ -29,7 +29,7 @@
 use extra::getopts;
 use extra::getopts;
 use extra::oldmap::HashMap;
-use syntax::codemap::dummy_sp;
+use syntax::codemap::DUMMY_SP;
 use syntax::parse::parse_crate_from_source_str;
 use syntax::{ast, attr, parse};
 
@@ -221,9 +221,9 @@ pub fn t_rptr_static(&self) -> ty::t {
         ty::mk_imm_rptr(self.tcx, ty::ReStatic, self.t_int())
     }
 
-    pub fn lub() -> Lub { Lub(self.infcx.combine_fields(true, dummy_sp())) }
+    pub fn lub() -> Lub { Lub(self.infcx.combine_fields(true, DUMMY_SP)) }
 
-    pub fn glb() -> Glb { Glb(self.infcx.combine_fields(true, dummy_sp())) }
+    pub fn glb() -> Glb { Glb(self.infcx.combine_fields(true, DUMMY_SP)) }
 
     pub fn resolve_regions(exp_count: uint) {
         debug!("resolve_regions(%u)", exp_count);
index 399e73b008fba27c4d671b270279751a51e4909f..3bec73597607b77fd824fd87d557a66c60e11436 100644 (file)
@@ -40,7 +40,7 @@ pub fn new(name: Option<Ident>) -> Module {
             name       : name,
             id: 0,
             vis: ast::private,
-            where: syntax::codemap::dummy_sp(),
+            where: syntax::codemap::DUMMY_SP,
             attrs      : ~[],
             structs    : ~[],
             enums      : ~[],
index 87657f729f916c9fc3c28441459a8786ed85ee5b..a081c2a31afedf727fb57a1fc2df7e04431c718f 100644 (file)
@@ -19,7 +19,7 @@
 use rustc::driver::{driver, session};
 use extra::getopts::groups::getopts;
 use syntax::ast_util::*;
-use syntax::codemap::{dummy_sp, Spanned};
+use syntax::codemap::{DUMMY_SP, Spanned};
 use syntax::ext::base::ExtCtxt;
 use syntax::{ast, attr, codemap, diagnostic, fold, visit};
 use syntax::attr::AttrMetaMethods;
@@ -631,7 +631,7 @@ pub fn find_and_install_dependencies(context: &BuildContext,
 pub fn mk_string_lit(s: @str) -> ast::lit {
     Spanned {
         node: ast::lit_str(s, ast::CookedStr),
-        span: dummy_sp()
+        span: DUMMY_SP
     }
 }
 
index 0509760120a428ba2bcc176fd3b1e087a4d392f4..97d3db074bb00f3be24836771a573554747c4639 100644 (file)
@@ -90,6 +90,8 @@ pub struct Span {
     expn_info: Option<@ExpnInfo>
 }
 
+pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None };
+
 #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
 pub struct Spanned<T> {
     node: T,
@@ -112,7 +114,7 @@ fn encode(&self, s: &mut S) {
 
 impl<D:Decoder> Decodable<D> for Span {
     fn decode(_d: &mut D) -> Span {
-        dummy_sp()
+        DUMMY_SP
     }
 }
 
@@ -125,7 +127,7 @@ pub fn respan<T>(sp: Span, t: T) -> Spanned<T> {
 }
 
 pub fn dummy_spanned<T>(t: T) -> Spanned<T> {
-    respan(dummy_sp(), t)
+    respan(DUMMY_SP, t)
 }
 
 /* assuming that we're not in macro expansion */
@@ -133,11 +135,6 @@ pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span {
     Span {lo: lo, hi: hi, expn_info: None}
 }
 
-// make this a const, once the compiler supports it
-pub fn dummy_sp() -> Span { return mk_sp(BytePos(0), BytePos(0)); }
-
-
-
 /// A source code location used for error reporting
 pub struct Loc {
     /// Information about the original source
@@ -350,7 +347,7 @@ pub fn adjust_span(&self, sp: Span) -> Span {
 
     pub fn span_to_str(&self, sp: Span) -> ~str {
         let files = &*self.files;
-        if files.len() == 0 && sp == dummy_sp() {
+        if files.len() == 0 && sp == DUMMY_SP {
             return ~"no-location";
         }
 
index e5f20950412ac8045d4de4c96bd97082d01294b8..1a3513ab81c93b05710bffac8473674bdb83d552 100644 (file)
@@ -12,7 +12,7 @@
 use ast::{P, Ident};
 use ast;
 use ast_util;
-use codemap::{Span, respan, dummy_sp};
+use codemap::{Span, respan, DUMMY_SP};
 use ext::base::ExtCtxt;
 use ext::quote::rt::*;
 use fold::ast_fold;
@@ -321,7 +321,7 @@ fn ty_box(&self, span: Span,
 
     fn ty_option(&self, ty: P<ast::Ty>) -> P<ast::Ty> {
         self.ty_path(
-            self.path_all(dummy_sp(),
+            self.path_all(DUMMY_SP,
                           true,
                           ~[
                               self.ident_of("std"),
@@ -348,7 +348,7 @@ fn ty_nil(&self) -> P<ast::Ty> {
         P(ast::Ty {
             id: ast::DUMMY_NODE_ID,
             node: ast::ty_nil,
-            span: dummy_sp(),
+            span: DUMMY_SP,
         })
     }
 
@@ -361,13 +361,13 @@ fn typaram(&self, id: ast::Ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyP
     // incorrect code.
     fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[P<ast::Ty>] {
         opt_vec::take_vec(
-            ty_params.map(|p| self.ty_ident(dummy_sp(), p.ident)))
+            ty_params.map(|p| self.ty_ident(DUMMY_SP, p.ident)))
     }
 
     fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[P<ast::Ty>] {
         opt_vec::take_vec(
             ty_params.map(|p| self.ty_path(
-                self.path_global(dummy_sp(), ~[p.ident]), None)))
+                self.path_global(DUMMY_SP, ~[p.ident]), None)))
     }
 
     fn strip_bounds(&self, generics: &Generics) -> Generics {
index eb07353cda3d174c20a21fcad42c397c4ae6db35..be336128275f18af59aff79ce0413a97aafd8beb 100644 (file)
@@ -1279,12 +1279,12 @@ pub fn new_path_finder(paths: ~[ast::Path]) -> NewPathExprFinderContext {
     // make a MetaWord outer attribute with the given name
     fn make_dummy_attr(s: @str) -> ast::Attribute {
         Spanned {
-            span:codemap::dummy_sp(),
+            span:codemap::DUMMY_SP,
             node: Attribute_ {
                 style: AttrOuter,
                 value: @Spanned {
                     node: MetaWord(s),
-                    span: codemap::dummy_sp(),
+                    span: codemap::DUMMY_SP,
                 },
                 is_sugared_doc: false,
             }
index ae9bbdadf2cbd9ed4dc9ce3cd23f6c5874156eb2..05d402a2ba284c945b7ac3cb3fa5abe0641f0522 100644 (file)
@@ -11,7 +11,7 @@
 use ast::{Ident, matcher_, matcher, match_tok, match_nonterminal, match_seq};
 use ast::{tt_delim};
 use ast;
-use codemap::{Span, Spanned, dummy_sp};
+use codemap::{Span, Spanned, DUMMY_SP};
 use ext::base::{AnyMacro, ExtCtxt, MacResult, MRAny, MRDef, MacroDef};
 use ext::base::{NormalTT, SyntaxExpanderTTTrait};
 use ext::base;
@@ -109,7 +109,7 @@ fn generic_extension(cx: &ExtCtxt,
     }
 
     // Which arm's failure should we report? (the one furthest along)
-    let mut best_fail_spot = dummy_sp();
+    let mut best_fail_spot = DUMMY_SP;
     let mut best_fail_msg = ~"internal error: ran no matchers";
 
     let s_d = cx.parse_sess().span_diagnostic;
@@ -178,7 +178,7 @@ pub fn add_new_extension(cx: &mut ExtCtxt,
     fn ms(m: matcher_) -> matcher {
         Spanned {
             node: m.clone(),
-            span: dummy_sp()
+            span: DUMMY_SP
         }
     }
 
index fc7d3d2b40c08265e907779c9d19263bef841b42..cbce5fb16cbb54689a2ac1ae13d63e129409c4ed 100644 (file)
@@ -10,7 +10,7 @@
 
 use ast;
 use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,Ident};
-use codemap::{Span, dummy_sp};
+use codemap::{Span, DUMMY_SP};
 use diagnostic::SpanHandler;
 use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal};
 use parse::token::{EOF, INTERPOLATED, IDENT, Token, nt_ident};
@@ -66,7 +66,7 @@ pub fn new_tt_reader(sp_diag: @mut SpanHandler,
         repeat_len: ~[],
         /* dummy values, never read: */
         cur_tok: EOF,
-        cur_span: dummy_sp()
+        cur_span: DUMMY_SP
     };
     tt_next_token(r); /* get cur_tok and cur_span set up */
     return r;
index 8b7ef6d9cf8be4bc388162941963a4f0385fc496..2c3d03eefea17e9a831c24a2fff8df523edf2939 100644 (file)
@@ -81,7 +81,7 @@ pub fn new_low_level_string_reader(span_diagnostic: @mut SpanHandler,
         filemap: filemap,
         /* dummy values; not read */
         peek_tok: token::EOF,
-        peek_span: codemap::dummy_sp()
+        peek_span: codemap::DUMMY_SP
     };
     bump(r);
     return r;
index fa0d2d4765b6adc79dd882acf4fc43a3bd202c11..960e28ca84f8fc81658e4cd485933c059ec5c685 100644 (file)
@@ -2422,7 +2422,7 @@ fn test_fun_to_str() {
             inputs: ~[],
             output: ast::P(ast::Ty {id: 0,
                                     node: ast::ty_nil,
-                                    span: codemap::dummy_sp()}),
+                                    span: codemap::DUMMY_SP}),
             cf: ast::return_val,
             variadic: false
         };
@@ -2436,7 +2436,7 @@ fn test_fun_to_str() {
     fn test_variant_to_str() {
         let ident = token::str_to_ident("principal_skinner");
 
-        let var = codemap::respan(codemap::dummy_sp(), ast::variant_ {
+        let var = codemap::respan(codemap::DUMMY_SP, ast::variant_ {
             name: ident,
             attrs: ~[],
             // making this up as I go.... ?