Skip to content

Commit 446ef14

Browse files
powerboat9philberty
authored andcommitted
Remove RichLocation typedef
gcc/rust/ChangeLog: * rust-location.h (typedef RichLocation): Remove. * expand/rust-macro-expand.cc: Replace RichLocation with rich_location. * hir/rust-ast-lower-base.cc: Likewise. * resolve/rust-ast-resolve-implitem.h: Likewise. * resolve/rust-ast-resolve-stmt.h: Likewise. * resolve/rust-ast-resolve-toplevel.h: Likewise. * rust-diagnostics.cc: Likewise. * rust-diagnostics.h: Likewise. * rust-session-manager.cc: Likewise. * typecheck/rust-casts.cc: Likewise. * typecheck/rust-coercion.cc: Likewise. * typecheck/rust-hir-inherent-impl-overlap.h: Likewise. * typecheck/rust-hir-path-probe.h: Likewise. * typecheck/rust-hir-trait-reference.cc: Likewise. * typecheck/rust-hir-type-check-expr.cc: Likewise. * typecheck/rust-hir-type-check-implitem.cc: Likewise. * typecheck/rust-hir-type-check-item.cc: Likewise. * typecheck/rust-hir-type-check-pattern.cc: Likewise. * typecheck/rust-tyty-cmp.h: Likewise. * typecheck/rust-tyty-subst.cc: Likewise. * typecheck/rust-tyty.cc: Likewise. * typecheck/rust-unify.cc: Likewise. Signed-off-by: Owen Avery <[email protected]>
1 parent d7f5c14 commit 446ef14

22 files changed

+102
-104
lines changed

gcc/rust/expand/rust-macro-expand.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ MacroExpander::expand_decl_macro (Location invoc_locus,
104104

105105
if (matched_rule == nullptr)
106106
{
107-
RichLocation r (line_table, invoc_locus);
107+
rich_location r (line_table, invoc_locus);
108108
r.add_range (rules_def.get_locus ());
109109
rust_error_at (r, "Failed to match any rule within macro");
110110
return AST::Fragment::create_error ();

gcc/rust/hir/rust-ast-lower-base.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ struct_field_name_exists (std::vector<HIR::StructField> &fields,
679679
new_field.get_field_name ().as_string ())
680680
== 0)
681681
{
682-
RichLocation r (line_table, new_field.get_locus ());
682+
rich_location r (line_table, new_field.get_locus ());
683683
r.add_range (field.get_locus ());
684684
rust_error_at (r, ErrorCode ("E0124"),
685685
"field %qs is already declared",

gcc/rust/resolve/rust-ast-resolve-implitem.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ResolveToplevelImplItem : public ResolverBase
5858
resolver->get_type_scope ().insert (
5959
path, type.get_node_id (), type.get_locus (), false, Rib::ItemType::Type,
6060
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
61-
RichLocation r (line_table, type.get_locus ());
61+
rich_location r (line_table, type.get_locus ());
6262
r.add_range (locus);
6363
rust_error_at (r, "redefined multiple times");
6464
});
@@ -74,7 +74,7 @@ class ResolveToplevelImplItem : public ResolverBase
7474
path, constant.get_node_id (), constant.get_locus (), false,
7575
Rib::ItemType::Const,
7676
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
77-
RichLocation r (line_table, constant.get_locus ());
77+
rich_location r (line_table, constant.get_locus ());
7878
r.add_range (locus);
7979
rust_error_at (r, "redefined multiple times");
8080
});
@@ -91,7 +91,7 @@ class ResolveToplevelImplItem : public ResolverBase
9191
path, function.get_node_id (), function.get_locus (), false,
9292
Rib::ItemType::Function,
9393
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
94-
RichLocation r (line_table, function.get_locus ());
94+
rich_location r (line_table, function.get_locus ());
9595
r.add_range (locus);
9696
rust_error_at (r, "redefined multiple times");
9797
});
@@ -107,7 +107,7 @@ class ResolveToplevelImplItem : public ResolverBase
107107
path, method.get_node_id (), method.get_locus (), false,
108108
Rib::ItemType::Function,
109109
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
110-
RichLocation r (line_table, method.get_locus ());
110+
rich_location r (line_table, method.get_locus ());
111111
r.add_range (locus);
112112
rust_error_at (r, "redefined multiple times");
113113
});
@@ -147,7 +147,7 @@ class ResolveTopLevelTraitItems : public ResolverBase
147147
path, function.get_node_id (), function.get_locus (), false,
148148
Rib::ItemType::Function,
149149
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
150-
RichLocation r (line_table, function.get_locus ());
150+
rich_location r (line_table, function.get_locus ());
151151
r.add_range (locus);
152152
rust_error_at (r, "redefined multiple times");
153153
});
@@ -167,7 +167,7 @@ class ResolveTopLevelTraitItems : public ResolverBase
167167
path, method.get_node_id (), method.get_locus (), false,
168168
Rib::ItemType::Function,
169169
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
170-
RichLocation r (line_table, method.get_locus ());
170+
rich_location r (line_table, method.get_locus ());
171171
r.add_range (locus);
172172
rust_error_at (r, "redefined multiple times");
173173
});
@@ -187,7 +187,7 @@ class ResolveTopLevelTraitItems : public ResolverBase
187187
path, constant.get_node_id (), constant.get_locus (), false,
188188
Rib::ItemType::Const,
189189
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
190-
RichLocation r (line_table, constant.get_locus ());
190+
rich_location r (line_table, constant.get_locus ());
191191
r.add_range (locus);
192192
rust_error_at (r, "redefined multiple times");
193193
});
@@ -205,7 +205,7 @@ class ResolveTopLevelTraitItems : public ResolverBase
205205
resolver->get_type_scope ().insert (
206206
path, type.get_node_id (), type.get_locus (), false, Rib::ItemType::Type,
207207
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
208-
RichLocation r (line_table, type.get_locus ());
208+
rich_location r (line_table, type.get_locus ());
209209
r.add_range (locus);
210210
rust_error_at (r, "redefined multiple times");
211211
});
@@ -245,7 +245,7 @@ class ResolveToplevelExternItem : public ResolverBase
245245
path, function.get_node_id (), function.get_locus (), false,
246246
Rib::ItemType::Function,
247247
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
248-
RichLocation r (line_table, function.get_locus ());
248+
rich_location r (line_table, function.get_locus ());
249249
r.add_range (locus);
250250
rust_error_at (r, "redefined multiple times");
251251
});
@@ -264,7 +264,7 @@ class ResolveToplevelExternItem : public ResolverBase
264264
path, item.get_node_id (), item.get_locus (), false,
265265
Rib::ItemType::Static,
266266
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
267-
RichLocation r (line_table, item.get_locus ());
267+
rich_location r (line_table, item.get_locus ());
268268
r.add_range (locus);
269269
rust_error_at (r, "redefined multiple times");
270270
});

gcc/rust/resolve/rust-ast-resolve-stmt.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ResolveStmt : public ResolverBase
6060
path, constant.get_node_id (), constant.get_locus (), false,
6161
Rib::ItemType::Const,
6262
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
63-
RichLocation r (line_table, constant.get_locus ());
63+
rich_location r (line_table, constant.get_locus ());
6464
r.add_range (locus);
6565
rust_error_at (r, "redefined multiple times");
6666
});
@@ -95,7 +95,7 @@ class ResolveStmt : public ResolverBase
9595
path, struct_decl.get_node_id (), struct_decl.get_locus (), false,
9696
Rib::ItemType::Type,
9797
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
98-
RichLocation r (line_table, struct_decl.get_locus ());
98+
rich_location r (line_table, struct_decl.get_locus ());
9999
r.add_range (locus);
100100
rust_error_at (r, "redefined multiple times");
101101
});
@@ -128,7 +128,7 @@ class ResolveStmt : public ResolverBase
128128
path, enum_decl.get_node_id (), enum_decl.get_locus (), false,
129129
Rib::ItemType::Type,
130130
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
131-
RichLocation r (line_table, enum_decl.get_locus ());
131+
rich_location r (line_table, enum_decl.get_locus ());
132132
r.add_range (locus);
133133
rust_error_at (r, "redefined multiple times");
134134
});
@@ -160,7 +160,7 @@ class ResolveStmt : public ResolverBase
160160
resolver->get_type_scope ().insert (
161161
path, item.get_node_id (), item.get_locus (), false, Rib::ItemType::Type,
162162
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
163-
RichLocation r (line_table, item.get_locus ());
163+
rich_location r (line_table, item.get_locus ());
164164
r.add_range (locus);
165165
rust_error_at (r, "redefined multiple times");
166166
});
@@ -180,7 +180,7 @@ class ResolveStmt : public ResolverBase
180180
resolver->get_type_scope ().insert (
181181
path, item.get_node_id (), item.get_locus (), false, Rib::ItemType::Type,
182182
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
183-
RichLocation r (line_table, item.get_locus ());
183+
rich_location r (line_table, item.get_locus ());
184184
r.add_range (locus);
185185
rust_error_at (r, "redefined multiple times");
186186
});
@@ -206,7 +206,7 @@ class ResolveStmt : public ResolverBase
206206
resolver->get_type_scope ().insert (
207207
path, item.get_node_id (), item.get_locus (), false, Rib::ItemType::Type,
208208
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
209-
RichLocation r (line_table, item.get_locus ());
209+
rich_location r (line_table, item.get_locus ());
210210
r.add_range (locus);
211211
rust_error_at (r, "redefined multiple times");
212212
});
@@ -232,7 +232,7 @@ class ResolveStmt : public ResolverBase
232232
resolver->get_type_scope ().insert (
233233
path, item.get_node_id (), item.get_locus (), false, Rib::ItemType::Type,
234234
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
235-
RichLocation r (line_table, item.get_locus ());
235+
rich_location r (line_table, item.get_locus ());
236236
r.add_range (locus);
237237
rust_error_at (r, "redefined multiple times");
238238
});
@@ -253,7 +253,7 @@ class ResolveStmt : public ResolverBase
253253
path, struct_decl.get_node_id (), struct_decl.get_locus (), false,
254254
Rib::ItemType::Type,
255255
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
256-
RichLocation r (line_table, struct_decl.get_locus ());
256+
rich_location r (line_table, struct_decl.get_locus ());
257257
r.add_range (locus);
258258
rust_error_at (r, "redefined multiple times");
259259
});
@@ -291,7 +291,7 @@ class ResolveStmt : public ResolverBase
291291
path, union_decl.get_node_id (), union_decl.get_locus (), false,
292292
Rib::ItemType::Type,
293293
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
294-
RichLocation r (line_table, union_decl.get_locus ());
294+
rich_location r (line_table, union_decl.get_locus ());
295295
r.add_range (locus);
296296
rust_error_at (r, "redefined multiple times");
297297
});
@@ -327,7 +327,7 @@ class ResolveStmt : public ResolverBase
327327
path, function.get_node_id (), function.get_locus (), false,
328328
Rib::ItemType::Function,
329329
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
330-
RichLocation r (line_table, function.get_locus ());
330+
rich_location r (line_table, function.get_locus ());
331331
r.add_range (locus);
332332
rust_error_at (r, "redefined multiple times");
333333
});

gcc/rust/resolve/rust-ast-resolve-toplevel.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ResolveTopLevel : public ResolverBase
5656
path, module.get_node_id (), module.get_locus (), false,
5757
Rib::ItemType::Module,
5858
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
59-
RichLocation r (line_table, module.get_locus ());
59+
rich_location r (line_table, module.get_locus ());
6060
r.add_range (locus);
6161
rust_error_at (r, "redefined multiple times");
6262
});
@@ -86,7 +86,7 @@ class ResolveTopLevel : public ResolverBase
8686
path, alias.get_node_id (), alias.get_locus (), false,
8787
Rib::ItemType::Type,
8888
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
89-
RichLocation r (line_table, alias.get_locus ());
89+
rich_location r (line_table, alias.get_locus ());
9090
r.add_range (locus);
9191
rust_error_at (r, "redefined multiple times");
9292
});
@@ -108,7 +108,7 @@ class ResolveTopLevel : public ResolverBase
108108
path, struct_decl.get_node_id (), struct_decl.get_locus (), false,
109109
Rib::ItemType::Type,
110110
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
111-
RichLocation r (line_table, struct_decl.get_locus ());
111+
rich_location r (line_table, struct_decl.get_locus ());
112112
r.add_range (locus);
113113
rust_error_at (r, "redefined multiple times");
114114
});
@@ -130,7 +130,7 @@ class ResolveTopLevel : public ResolverBase
130130
path, enum_decl.get_node_id (), enum_decl.get_locus (), false,
131131
Rib::ItemType::Type,
132132
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
133-
RichLocation r (line_table, enum_decl.get_locus ());
133+
rich_location r (line_table, enum_decl.get_locus ());
134134
r.add_range (locus);
135135
rust_error_at (r, "redefined multiple times");
136136
});
@@ -156,7 +156,7 @@ class ResolveTopLevel : public ResolverBase
156156
resolver->get_type_scope ().insert (
157157
path, item.get_node_id (), item.get_locus (), false, Rib::ItemType::Type,
158158
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
159-
RichLocation r (line_table, item.get_locus ());
159+
rich_location r (line_table, item.get_locus ());
160160
r.add_range (locus);
161161
rust_error_at (r, "redefined multiple times");
162162
});
@@ -178,7 +178,7 @@ class ResolveTopLevel : public ResolverBase
178178
resolver->get_type_scope ().insert (
179179
path, item.get_node_id (), item.get_locus (), false, Rib::ItemType::Type,
180180
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
181-
RichLocation r (line_table, item.get_locus ());
181+
rich_location r (line_table, item.get_locus ());
182182
r.add_range (locus);
183183
rust_error_at (r, "redefined multiple times");
184184
});
@@ -200,7 +200,7 @@ class ResolveTopLevel : public ResolverBase
200200
resolver->get_type_scope ().insert (
201201
path, item.get_node_id (), item.get_locus (), false, Rib::ItemType::Type,
202202
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
203-
RichLocation r (line_table, item.get_locus ());
203+
rich_location r (line_table, item.get_locus ());
204204
r.add_range (locus);
205205
rust_error_at (r, "redefined multiple times");
206206
});
@@ -222,7 +222,7 @@ class ResolveTopLevel : public ResolverBase
222222
resolver->get_type_scope ().insert (
223223
path, item.get_node_id (), item.get_locus (), false, Rib::ItemType::Type,
224224
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
225-
RichLocation r (line_table, item.get_locus ());
225+
rich_location r (line_table, item.get_locus ());
226226
r.add_range (locus);
227227
rust_error_at (r, "redefined multiple times");
228228
});
@@ -246,7 +246,7 @@ class ResolveTopLevel : public ResolverBase
246246
path, struct_decl.get_node_id (), struct_decl.get_locus (), false,
247247
Rib::ItemType::Type,
248248
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
249-
RichLocation r (line_table, struct_decl.get_locus ());
249+
rich_location r (line_table, struct_decl.get_locus ());
250250
r.add_range (locus);
251251
rust_error_at (r, "redefined multiple times");
252252
});
@@ -268,7 +268,7 @@ class ResolveTopLevel : public ResolverBase
268268
path, union_decl.get_node_id (), union_decl.get_locus (), false,
269269
Rib::ItemType::Type,
270270
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
271-
RichLocation r (line_table, union_decl.get_locus ());
271+
rich_location r (line_table, union_decl.get_locus ());
272272
r.add_range (locus);
273273
rust_error_at (r, "redefined multiple times");
274274
});
@@ -288,7 +288,7 @@ class ResolveTopLevel : public ResolverBase
288288
resolver->get_name_scope ().insert (
289289
path, var.get_node_id (), var.get_locus (), false, Rib::ItemType::Static,
290290
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
291-
RichLocation r (line_table, var.get_locus ());
291+
rich_location r (line_table, var.get_locus ());
292292
r.add_range (locus);
293293
rust_error_at (r, "redefined multiple times");
294294
});
@@ -309,7 +309,7 @@ class ResolveTopLevel : public ResolverBase
309309
path, constant.get_node_id (), constant.get_locus (), false,
310310
Rib::ItemType::Const,
311311
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
312-
RichLocation r (line_table, constant.get_locus ());
312+
rich_location r (line_table, constant.get_locus ());
313313
r.add_range (locus);
314314
rust_error_at (r, "redefined multiple times");
315315
});
@@ -331,7 +331,7 @@ class ResolveTopLevel : public ResolverBase
331331
path, function.get_node_id (), function.get_locus (), false,
332332
Rib::ItemType::Function,
333333
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
334-
RichLocation r (line_table, function.get_locus ());
334+
rich_location r (line_table, function.get_locus ());
335335
r.add_range (locus);
336336
rust_error_at (r, "redefined multiple times");
337337
});
@@ -375,7 +375,7 @@ class ResolveTopLevel : public ResolverBase
375375
impl_prefix, impl_block.get_node_id (), impl_block.get_locus (), false,
376376
Rib::ItemType::TraitImpl,
377377
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
378-
RichLocation r (line_table, impl_block.get_locus ());
378+
rich_location r (line_table, impl_block.get_locus ());
379379
r.add_range (locus);
380380
rust_error_at (r, "redefined multiple times");
381381
});
@@ -395,7 +395,7 @@ class ResolveTopLevel : public ResolverBase
395395
path, trait.get_node_id (), trait.get_locus (), false,
396396
Rib::ItemType::Trait,
397397
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
398-
RichLocation r (line_table, trait.get_locus ());
398+
rich_location r (line_table, trait.get_locus ());
399399
r.add_range (locus);
400400
rust_error_at (r, "redefined multiple times");
401401
});
@@ -471,7 +471,7 @@ class ResolveTopLevel : public ResolverBase
471471
decl, resolved_crate, extern_crate.get_locus (), false,
472472
Rib::ItemType::ExternCrate,
473473
[&] (const CanonicalPath &, NodeId, Location locus) -> void {
474-
RichLocation r (line_table, extern_crate.get_locus ());
474+
rich_location r (line_table, extern_crate.get_locus ());
475475
r.add_range (locus);
476476
rust_error_at (r, "redefined multiple times");
477477
});

gcc/rust/rust-diagnostics.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ rust_error_at (const Location location, const ErrorCode code, const char *fmt,
235235
}
236236

237237
void
238-
rust_be_error_at (const RichLocation &location, const ErrorCode code,
238+
rust_be_error_at (const rich_location &location, const ErrorCode code,
239239
const std::string &errmsg)
240240
{
241241
/* TODO: 'error_at' would like a non-'const' 'rich_location *'. */
@@ -247,7 +247,7 @@ rust_be_error_at (const RichLocation &location, const ErrorCode code,
247247
}
248248

249249
void
250-
rust_error_at (const RichLocation &location, const ErrorCode code,
250+
rust_error_at (const rich_location &location, const ErrorCode code,
251251
const char *fmt, ...)
252252
{
253253
va_list ap;
@@ -308,15 +308,15 @@ rust_inform (const Location location, const char *fmt, ...)
308308

309309
// Rich Locations
310310
void
311-
rust_be_error_at (const RichLocation &location, const std::string &errmsg)
311+
rust_be_error_at (const rich_location &location, const std::string &errmsg)
312312
{
313313
/* TODO: 'error_at' would like a non-'const' 'rich_location *'. */
314314
rich_location &gcc_loc = const_cast<rich_location &> (location);
315315
error_at (&gcc_loc, "%s", errmsg.c_str ());
316316
}
317317

318318
void
319-
rust_error_at (const RichLocation &location, const char *fmt, ...)
319+
rust_error_at (const rich_location &location, const char *fmt, ...)
320320
{
321321
va_list ap;
322322

0 commit comments

Comments
 (0)