Skip to content

Commit c5f7c19

Browse files
End of error code spanning centralization
1 parent f52a87c commit c5f7c19

File tree

3 files changed

+430
-189
lines changed

3 files changed

+430
-189
lines changed

src/librustc_resolve/build_reduced_graph.rs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,13 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
208208
// Return an error here by looking up the namespace that
209209
// had the duplicate.
210210
let ns = ns.unwrap();
211-
resolve_err!(self, sp, E0428,
212-
"duplicate definition of {} `{}`",
213-
namespace_error_to_string(duplicate_type),
214-
token::get_name(name));
211+
::resolve_error(
212+
&::ResolutionError::DuplicateDefinition(
213+
self,
214+
sp,
215+
namespace_error_to_string(duplicate_type),
216+
&*token::get_name(name))
217+
);
215218
{
216219
let r = child.span_for_namespace(ns);
217220
if let Some(sp) = r {
@@ -304,9 +307,10 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
304307
full_path.segments.last().unwrap().identifier.name;
305308
if &token::get_name(source_name)[..] == "mod" ||
306309
&token::get_name(source_name)[..] == "self" {
307-
resolve_err!(self, view_path.span, E0429,
308-
"{}",
309-
"`self` imports are only allowed within a { } list");
310+
::resolve_error(&::ResolutionError::SelfImportsOnlyAllowedWithin(
311+
self,
312+
view_path.span)
313+
);
310314
}
311315

312316
let subclass = SingleImport(binding.name,
@@ -326,9 +330,11 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
326330
_ => None
327331
}).collect::<Vec<Span>>();
328332
if mod_spans.len() > 1 {
329-
resolve_err!(self, mod_spans[0], E0430,
330-
"{}",
331-
"`self` import can only appear once in the list");
333+
::resolve_error(
334+
&::ResolutionError::SelfImportCanOnlyAppearOnceInTheList(
335+
self,
336+
mod_spans[0])
337+
);
332338
for other_span in mod_spans.iter().skip(1) {
333339
self.session.span_note(*other_span,
334340
"another `self` import appears here");
@@ -343,10 +349,12 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
343349
let name = match module_path.last() {
344350
Some(name) => *name,
345351
None => {
346-
resolve_err!(self, source_item.span, E0431,
347-
"{}",
348-
"`self` import can only appear in an import list \
349-
with a non-empty prefix");
352+
::resolve_error(
353+
&::ResolutionError::
354+
SelfImportOnlyInImportListWithNonEmptyPrefix(
355+
self,
356+
source_item.span)
357+
);
350358
continue;
351359
}
352360
};

0 commit comments

Comments
 (0)