]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Replace Linemap::unknown_location with UNKNOWN_LOCATION
authorOwen Avery <powerboat9.gamer@gmail.com>
Mon, 3 Jul 2023 17:48:45 +0000 (13:48 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:49:35 +0000 (18:49 +0100)
gcc/rust/ChangeLog:

* rust-linemap.h (Linemap::unknown_location): Remove.
* ast/rust-ast.cc:
Replace Linemap::unknown_location with UNKNOWN_LOCATION.
* ast/rust-path.cc: Likewise.
* hir/tree/rust-hir.cc: Likewise.
* metadata/rust-imports.cc: Likewise.
* parse/rust-parse-impl.h: Likewise.
* parse/rust-parse.h: Likewise.
* rust-backend.h: Likewise.
* rust-diagnostics.cc: Likewise.
* rust-session-manager.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/ast/rust-ast.cc
gcc/rust/ast/rust-path.cc
gcc/rust/hir/tree/rust-hir.cc
gcc/rust/metadata/rust-imports.cc
gcc/rust/parse/rust-parse-impl.h
gcc/rust/parse/rust-parse.h
gcc/rust/rust-backend.h
gcc/rust/rust-diagnostics.cc
gcc/rust/rust-linemap.h
gcc/rust/rust-session-manager.cc
gcc/rust/typecheck/rust-tyty.cc

index 24e719c1e4a61bb9385ab025429107e0801040a5..1319b7de7bc9b09e7342f4100baf9674a6ee7f25 100644 (file)
@@ -3610,8 +3610,7 @@ AttributeParser::parse_meta_item_inner ()
        new MetaListPaths (ident, ident_locus, std::move (path_items)));
     }
 
-  rust_error_at (Linemap::unknown_location (),
-                "failed to parse any meta item inner");
+  rust_error_at (UNKNOWN_LOCATION, "failed to parse any meta item inner");
   return nullptr;
 }
 
@@ -3905,7 +3904,7 @@ MetaListNameValueStr::check_cfg_predicate (const Session &session) const
        {
          /* HACK: convert vector platform-dependent size_type to string to
           * use in printf */
-         rust_error_at (Linemap::unknown_location (),
+         rust_error_at (UNKNOWN_LOCATION,
                         "cfg predicate could not be checked for "
                         "MetaListNameValueStr with ident of "
                         "'not' because there are '%s' elements, not '1'",
@@ -3917,7 +3916,7 @@ MetaListNameValueStr::check_cfg_predicate (const Session &session) const
     }
   else
     {
-      rust_error_at (Linemap::unknown_location (),
+      rust_error_at (UNKNOWN_LOCATION,
                     "cfg predicate could not be checked for "
                     "MetaListNameValueStr with ident of "
                     "'%s' - ident must be 'all' or 'any'",
@@ -3953,7 +3952,7 @@ MetaListPaths::check_cfg_predicate (const Session &session) const
        {
          // HACK: convert vector platform-dependent size_type to string to
          // use in printf
-         rust_error_at (Linemap::unknown_location (),
+         rust_error_at (UNKNOWN_LOCATION,
                         "cfg predicate could not be checked for MetaListPaths "
                         "with ident of 'not' "
                         "because there are '%s' elements, not '1'",
@@ -3965,7 +3964,7 @@ MetaListPaths::check_cfg_predicate (const Session &session) const
     }
   else
     {
-      rust_error_at (Linemap::unknown_location (),
+      rust_error_at (UNKNOWN_LOCATION,
                     "cfg predicate could not be checked for "
                     "MetaListNameValueStr with ident of "
                     "'%s' - ident must be 'all' or 'any'",
@@ -4008,7 +4007,7 @@ MetaItemSeq::check_cfg_predicate (const Session &session) const
        {
          /* HACK: convert vector platform-dependent size_type to string to
           * use in printf */
-         rust_error_at (Linemap::unknown_location (),
+         rust_error_at (UNKNOWN_LOCATION,
                         "cfg predicate could not be checked for MetaItemSeq "
                         "with ident of 'not' "
                         "because there are '%s' elements, not '1'",
@@ -4021,7 +4020,7 @@ MetaItemSeq::check_cfg_predicate (const Session &session) const
   else
     {
       rust_error_at (
-       Linemap::unknown_location (),
+       UNKNOWN_LOCATION,
        "cfg predicate could not be checked for MetaItemSeq with path of "
        "'%s' - path must be 'all' or 'any'",
        path.as_string ().c_str ());
index ee6a6fb482e2a161bf619b932ddf45b22ff3ec0b..7c6d7e1465861cc1639a1bdc65f2f9dad4aca2fb 100644 (file)
@@ -172,7 +172,7 @@ PathPattern::convert_to_simple_path (bool with_opening_scope_resolution) const
     }
 
   // kind of a HACK to get locus depending on opening scope resolution
-  Location locus = Linemap::unknown_location ();
+  Location locus = UNKNOWN_LOCATION;
   if (with_opening_scope_resolution)
     locus = simple_segments[0].get_locus () - 2; // minus 2 chars for ::
   else
index de1c82593f50753eee0348c84d63ab6e7916b4be..a84a741c68283e88a45d5ff4cc474d44a129b7fa 100644 (file)
@@ -2173,7 +2173,7 @@ PathPattern::convert_to_simple_path (bool with_opening_scope_resolution) const
     }
 
   // kind of a HACK to get locus depending on opening scope resolution
-  Location locus = Linemap::unknown_location ();
+  Location locus = UNKNOWN_LOCATION;
   if (with_opening_scope_resolution)
     {
       locus = simple_segments[0].get_locus () - 2; // minus 2 chars for ::
index 5894ec823a02021a8dc7c42729f5ac2bf0cd645b..a0d4123a64e14e12ec246588ba0d77cf1035c1b0 100644 (file)
@@ -375,7 +375,7 @@ Stream_from_file::Stream_from_file (int fd) : fd_ (fd), data_ ()
 {
   if (lseek (fd, 0, SEEK_SET) != 0)
     {
-      rust_fatal_error (Linemap::unknown_location (), "lseek failed: %m");
+      rust_fatal_error (UNKNOWN_LOCATION, "lseek failed: %m");
       this->set_saw_error ();
     }
 }
@@ -399,7 +399,7 @@ Stream_from_file::do_peek (size_t length, const char **bytes)
   if (got < 0)
     {
       if (!this->saw_error ())
-       rust_fatal_error (Linemap::unknown_location (), "read failed: %m");
+       rust_fatal_error (UNKNOWN_LOCATION, "read failed: %m");
       this->set_saw_error ();
       return false;
     }
@@ -407,7 +407,7 @@ Stream_from_file::do_peek (size_t length, const char **bytes)
   if (lseek (this->fd_, -got, SEEK_CUR) < 0)
     {
       if (!this->saw_error ())
-       rust_fatal_error (Linemap::unknown_location (), "lseek failed: %m");
+       rust_fatal_error (UNKNOWN_LOCATION, "lseek failed: %m");
       this->set_saw_error ();
       return false;
     }
@@ -427,7 +427,7 @@ Stream_from_file::do_advance (size_t skip)
   if (lseek (this->fd_, skip, SEEK_CUR) < 0)
     {
       if (!this->saw_error ())
-       rust_fatal_error (Linemap::unknown_location (), "lseek failed: %m");
+       rust_fatal_error (UNKNOWN_LOCATION, "lseek failed: %m");
       this->set_saw_error ();
     }
   if (!this->data_.empty ())
index 509d6657b5c85f7f3cc5a7f40e2313c9f285f186..c6a1d3047241af197a31c9068d5c56b241c79b94 100644 (file)
@@ -606,7 +606,7 @@ AST::SimplePath
 Parser<ManagedTokenSource>::parse_simple_path ()
 {
   bool has_opening_scope_resolution = false;
-  Location locus = Linemap::unknown_location ();
+  Location locus = UNKNOWN_LOCATION;
 
   // don't parse anything if not a path upfront
   if (!is_simple_path_segment (lexer.peek_token ()->get_id ())
@@ -628,7 +628,7 @@ Parser<ManagedTokenSource>::parse_simple_path ()
   AST::SimplePathSegment segment = parse_simple_path_segment ();
 
   // get location if not gotten already
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     locus = segment.get_locus ();
 
   std::vector<AST::SimplePathSegment> segments;
@@ -6764,7 +6764,7 @@ template <typename ManagedTokenSource>
 AST::PathInExpression
 Parser<ManagedTokenSource>::parse_path_in_expression ()
 {
-  Location locus = Linemap::unknown_location ();
+  Location locus = UNKNOWN_LOCATION;
   bool has_opening_scope_resolution = false;
   if (lexer.peek_token ()->get_id () == SCOPE_RESOLUTION)
     {
@@ -6778,7 +6778,7 @@ Parser<ManagedTokenSource>::parse_path_in_expression ()
   // create segment vector
   std::vector<AST::PathExprSegment> segments;
 
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
     }
@@ -6949,7 +6949,7 @@ Parser<ManagedTokenSource>::parse_qualified_path_type (
   Location locus = pratt_parsed_loc;
   /* TODO: should this actually be error? is there anywhere where this could
    * be valid? */
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
 
@@ -7381,7 +7381,7 @@ Parser<ManagedTokenSource>::parse_block_expr (AST::AttrVec outer_attrs,
                                              Location pratt_parsed_loc)
 {
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       if (!skip_token (LEFT_CURLY))
@@ -7685,7 +7685,7 @@ Parser<ManagedTokenSource>::parse_return_expr (AST::AttrVec outer_attrs,
                                               Location pratt_parsed_loc)
 {
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       skip_token (RETURN_TOK);
@@ -7710,7 +7710,7 @@ Parser<ManagedTokenSource>::parse_break_expr (AST::AttrVec outer_attrs,
                                              Location pratt_parsed_loc)
 {
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       skip_token (BREAK);
@@ -7741,7 +7741,7 @@ Parser<ManagedTokenSource>::parse_continue_expr (AST::AttrVec outer_attrs,
                                                 Location pratt_parsed_loc)
 {
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       skip_token (CONTINUE);
@@ -7792,7 +7792,7 @@ Parser<ManagedTokenSource>::parse_if_expr (AST::AttrVec outer_attrs,
 {
   // TODO: make having outer attributes an error?
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       if (!skip_token (IF))
@@ -7950,7 +7950,7 @@ Parser<ManagedTokenSource>::parse_if_let_expr (AST::AttrVec outer_attrs,
 {
   // TODO: make having outer attributes an error?
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       if (!skip_token (IF))
@@ -8136,7 +8136,7 @@ Parser<ManagedTokenSource>::parse_loop_expr (AST::AttrVec outer_attrs,
                                             Location pratt_parsed_loc)
 {
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       if (label.is_error ())
        locus = lexer.peek_token ()->get_locus ();
@@ -8180,7 +8180,7 @@ Parser<ManagedTokenSource>::parse_while_loop_expr (AST::AttrVec outer_attrs,
                                                   Location pratt_parsed_loc)
 {
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       if (label.is_error ())
        locus = lexer.peek_token ()->get_locus ();
@@ -8251,7 +8251,7 @@ std::unique_ptr<AST::WhileLetLoopExpr>
 Parser<ManagedTokenSource>::parse_while_let_loop_expr (AST::AttrVec outer_attrs,
                                                       AST::LoopLabel label)
 {
-  Location locus = Linemap::unknown_location ();
+  Location locus = UNKNOWN_LOCATION;
   if (label.is_error ())
     locus = lexer.peek_token ()->get_locus ();
   else
@@ -8325,7 +8325,7 @@ std::unique_ptr<AST::ForLoopExpr>
 Parser<ManagedTokenSource>::parse_for_loop_expr (AST::AttrVec outer_attrs,
                                                 AST::LoopLabel label)
 {
-  Location locus = Linemap::unknown_location ();
+  Location locus = UNKNOWN_LOCATION;
   if (label.is_error ())
     locus = lexer.peek_token ()->get_locus ();
   else
@@ -8456,7 +8456,7 @@ Parser<ManagedTokenSource>::parse_match_expr (AST::AttrVec outer_attrs,
                                              Location pratt_parsed_loc)
 {
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       skip_token (MATCH_TOK);
@@ -8742,7 +8742,7 @@ Parser<ManagedTokenSource>::parse_unsafe_block_expr (AST::AttrVec outer_attrs,
                                                     Location pratt_parsed_loc)
 {
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       skip_token (UNSAFE);
@@ -8773,7 +8773,7 @@ Parser<ManagedTokenSource>::parse_array_expr (AST::AttrVec outer_attrs,
                                              Location pratt_parsed_loc)
 {
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       skip_token (LEFT_SQUARE);
@@ -8959,7 +8959,7 @@ Parser<ManagedTokenSource>::parse_grouped_or_tuple_expr (
 {
   // adjustment to allow Pratt parsing to reuse function without copy-paste
   Location locus = pratt_parsed_loc;
-  if (locus == Linemap::unknown_location ())
+  if (locus == UNKNOWN_LOCATION)
     {
       locus = lexer.peek_token ()->get_locus ();
       skip_token (LEFT_PAREN);
@@ -10682,9 +10682,10 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
              std::unique_ptr<AST::RangePatternBound> upper_bound
                = parse_range_pattern_bound ();
 
-             return std::unique_ptr<AST::RangePattern> (new AST::RangePattern (
-               std::move (lower_bound), std::move (upper_bound),
-               Linemap::unknown_location (), has_ellipsis_syntax));
+             return std::unique_ptr<AST::RangePattern> (
+               new AST::RangePattern (std::move (lower_bound),
+                                      std::move (upper_bound),
+                                      UNKNOWN_LOCATION, has_ellipsis_syntax));
            }
          case EXCLAM:
            return parse_macro_invocation_partial (std::move (path),
@@ -11221,9 +11222,10 @@ Parser<ManagedTokenSource>::parse_ident_leading_pattern ()
        std::unique_ptr<AST::RangePatternBound> upper_bound
          = parse_range_pattern_bound ();
 
-       return std::unique_ptr<AST::RangePattern> (new AST::RangePattern (
-         std::move (lower_bound), std::move (upper_bound),
-         Linemap::unknown_location (), has_ellipsis_syntax));
+       return std::unique_ptr<AST::RangePattern> (
+         new AST::RangePattern (std::move (lower_bound),
+                                std::move (upper_bound), UNKNOWN_LOCATION,
+                                has_ellipsis_syntax));
       }
       case PATTERN_BIND: {
        // only allow on single-segment paths
index 1d49c956b5c0aae4e822cffd05704e8a05a449a4..21540a31cc3b0b9ba80040cc6d15d58dc3a1331e 100644 (file)
@@ -139,7 +139,7 @@ public:
 
   std::unique_ptr<AST::BlockExpr>
   parse_block_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                   Location pratt_parsed_loc = Linemap::unknown_location ());
+                   Location pratt_parsed_loc = UNKNOWN_LOCATION);
 
   std::unique_ptr<AST::Item> parse_item (bool called_from_statement);
   std::unique_ptr<AST::Pattern> parse_pattern ();
@@ -211,10 +211,9 @@ private:
   // first token parsed in the expression (the parsing of that first
   // token should be skipped).
   parse_qualified_path_in_expression (Location pratt_parsed_loc
-                                     = Linemap::unknown_location ());
-  AST::QualifiedPathType
-  parse_qualified_path_type (Location pratt_parsed_loc
-                            = Linemap::unknown_location ());
+                                     = UNKNOWN_LOCATION);
+  AST::QualifiedPathType parse_qualified_path_type (Location pratt_parsed_loc
+                                                   = UNKNOWN_LOCATION);
   AST::QualifiedPathInType parse_qualified_path_in_type ();
 
   // Token tree or macro related
@@ -566,19 +565,18 @@ private:
   // token should be skipped).
   std::unique_ptr<AST::IfExpr>
   parse_if_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                Location pratt_parsed_loc = Linemap::unknown_location ());
+                Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::IfLetExpr>
   parse_if_let_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                    Location pratt_parsed_loc = Linemap::unknown_location ());
+                    Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::LoopExpr>
   parse_loop_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
                   AST::LoopLabel label = AST::LoopLabel::error (),
-                  Location pratt_parsed_loc = Linemap::unknown_location ());
+                  Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::WhileLoopExpr>
   parse_while_loop_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
                         AST::LoopLabel label = AST::LoopLabel::error (),
-                        Location pratt_parsed_loc
-                        = Linemap::unknown_location ());
+                        Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::WhileLetLoopExpr>
   parse_while_let_loop_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
                             AST::LoopLabel label = AST::LoopLabel::error ());
@@ -587,7 +585,7 @@ private:
                       AST::LoopLabel label = AST::LoopLabel::error ());
   std::unique_ptr<AST::MatchExpr>
   parse_match_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                   Location pratt_parsed_loc = Linemap::unknown_location ());
+                   Location pratt_parsed_loc = UNKNOWN_LOCATION);
   AST::MatchArm parse_match_arm ();
   std::vector<std::unique_ptr<AST::Pattern> >
   parse_match_arm_patterns (TokenId end_token_id);
@@ -608,25 +606,22 @@ private:
   // token should be skipped).
   std::unique_ptr<AST::ReturnExpr>
   parse_return_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                    Location pratt_parsed_loc = Linemap::unknown_location ());
+                    Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::BreakExpr>
   parse_break_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                   Location pratt_parsed_loc = Linemap::unknown_location ());
+                   Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::ContinueExpr>
   parse_continue_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                      Location pratt_parsed_loc
-                      = Linemap::unknown_location ());
+                      Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::UnsafeBlockExpr>
   parse_unsafe_block_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                          Location pratt_parsed_loc
-                          = Linemap::unknown_location ());
+                          Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::ArrayExpr>
   parse_array_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                   Location pratt_parsed_loc = Linemap::unknown_location ());
+                   Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::ExprWithoutBlock>
   parse_grouped_or_tuple_expr (AST::AttrVec outer_attrs = AST::AttrVec (),
-                              Location pratt_parsed_loc
-                              = Linemap::unknown_location ());
+                              Location pratt_parsed_loc = UNKNOWN_LOCATION);
   std::unique_ptr<AST::StructExprField> parse_struct_expr_field ();
   bool will_be_expr_with_block ();
 
index ad497e40dc19f1d4c2a0214383e21798a39ccf92..179bda78f0f4179c08b5c1d452666697519abc28 100644 (file)
@@ -52,8 +52,7 @@ public:
     tree type;
     Location location;
 
-    typed_identifier ()
-      : name (), type (NULL_TREE), location (Linemap::unknown_location ())
+    typed_identifier () : name (), type (NULL_TREE), location (UNKNOWN_LOCATION)
     {}
 
     typed_identifier (const std::string &a_name, tree a_type,
index c6e709936ae04105843ac9c733080ff2e038ef94..6c745460e1611b755b8398742dfedf686812aeb1 100644 (file)
@@ -119,7 +119,7 @@ expand_message (const char *fmt, va_list ap)
   if (nwr == -1)
     {
       // memory allocation failed
-      rust_be_error_at (Linemap::unknown_location (),
+      rust_be_error_at (UNKNOWN_LOCATION,
                        "memory allocation failed in vasprintf");
       rust_assert (0);
     }
@@ -323,7 +323,7 @@ rust_debug_loc (const Location location, const char *fmt, ...)
   va_end (ap);
   if (nwr == -1)
     {
-      rust_be_error_at (Linemap::unknown_location (),
+      rust_be_error_at (UNKNOWN_LOCATION,
                        "memory allocation failed in vasprintf");
       rust_assert (0);
     }
index 50875d565ee76c94b9cf3a00fc8892cbd99c86cf..a91aa289bca97fc59446c1eebf84660b9c3f675e 100644 (file)
@@ -78,9 +78,6 @@ public:
   // Return the special Location used for predeclared identifiers.
   static Location predeclared_location () { return BUILTINS_LOCATION; }
 
-  // Return the special Location used when no location is known.
-  static Location unknown_location () { return UNKNOWN_LOCATION; }
-
   // Produce a human-readable description of a Location.
   static std::string location_to_string (Location loc)
   {
index e524bc3d0550214ec837e5ebbd4daf99cacca542..3b3781c2792c6e0d9b9c43dc08f0a0c779e17f6c 100644 (file)
@@ -488,8 +488,8 @@ Session::compile_crate (const char *filename)
       dump_lex_stream.open (kLexDumpFile);
       if (dump_lex_stream.fail ())
        {
-         rust_error_at (Linemap::unknown_location (),
-                        "cannot open %s:%m; ignored", kLexDumpFile);
+         rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
+                        kLexDumpFile);
        }
       auto stream = Optional<std::ofstream &>::some (dump_lex_stream);
       dump_lex_opt = std::move (stream);
@@ -499,7 +499,7 @@ Session::compile_crate (const char *filename)
 
   if (!lex.input_source_is_valid_utf8 ())
     {
-      rust_error_at (Linemap::unknown_location (),
+      rust_error_at (UNKNOWN_LOCATION,
                     "cannot read %s; stream did not contain valid UTF-8",
                     filename);
       return;
@@ -802,8 +802,7 @@ Session::injection (AST::Crate &crate)
       // create "extern crate" item with the name
       std::unique_ptr<AST::ExternCrate> extern_crate (
        new AST::ExternCrate (*it, AST::Visibility::create_error (),
-                             {std::move (attr)},
-                             Linemap::unknown_location ()));
+                             {std::move (attr)}, UNKNOWN_LOCATION));
 
       // insert at beginning
       // crate.items.insert (crate.items.begin (), std::move (extern_crate));
@@ -913,7 +912,7 @@ Session::dump_ast_pretty (AST::Crate &crate, bool expanded) const
 
   if (out.fail ())
     {
-      rust_error_at (Linemap::unknown_location (), "cannot open %s:%m; ignored",
+      rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
                     kASTDumpFile);
       return;
     }
@@ -930,7 +929,7 @@ Session::dump_hir (HIR::Crate &crate) const
   out.open (kHIRDumpFile);
   if (out.fail ())
     {
-      rust_error_at (Linemap::unknown_location (), "cannot open %s:%m; ignored",
+      rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
                     kHIRDumpFile);
       return;
     }
@@ -946,7 +945,7 @@ Session::dump_hir_pretty (HIR::Crate &crate) const
   out.open (kHIRPrettyDumpFile);
   if (out.fail ())
     {
-      rust_error_at (Linemap::unknown_location (), "cannot open %s:%m; ignored",
+      rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
                     kHIRPrettyDumpFile);
       return;
     }
@@ -1038,7 +1037,7 @@ TargetOptions::dump_target_options () const
   out.open (kTargetOptionsDumpFile);
   if (out.fail ())
     {
-      rust_error_at (Linemap::unknown_location (), "cannot open %s:%m; ignored",
+      rust_error_at (UNKNOWN_LOCATION, "cannot open %s:%m; ignored",
                     kTargetOptionsDumpFile);
       return;
     }
index 03d3b8d1087a27f3f6194a8320a351e7769ca930..94d765009e4a270f5e2fd4b326b67211470a6f38 100644 (file)
@@ -1454,8 +1454,7 @@ VariantDef::get_error_node ()
 {
   static VariantDef node
     = VariantDef (UNKNOWN_HIRID, UNKNOWN_DEFID, "",
-                 {Resolver::CanonicalPath::create_empty (),
-                  Linemap::unknown_location ()},
+                 {Resolver::CanonicalPath::create_empty (), UNKNOWN_LOCATION},
                  nullptr);
 
   return node;