Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make error codes into strings #67086

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3855,7 +3855,10 @@ dependencies = [
"rustc_ast_pretty",
"rustc_attr",
"rustc_data_structures",
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad merge

"rustc_errors",
=======
>>>>>>> Update lock file
"rustc_feature",
"rustc_hir",
"rustc_index",
Expand Down Expand Up @@ -4005,9 +4008,12 @@ name = "rustc_plugin_impl"
version = "0.0.0"
dependencies = [
"rustc",
<<<<<<< HEAD
"rustc_errors",
"rustc_hir",
"rustc_lint",
=======
>>>>>>> Update lock file
"rustc_metadata",
"rustc_span",
"syntax",
Expand All @@ -4021,9 +4027,12 @@ dependencies = [
"rustc",
"rustc_attr",
"rustc_data_structures",
<<<<<<< HEAD
"rustc_errors",
"rustc_hir",
"rustc_span",
=======
>>>>>>> Update lock file
"rustc_typeck",
"syntax",
]
Expand Down Expand Up @@ -4696,6 +4705,58 @@ dependencies = [
"scoped-tls",
"serialize",
"smallvec 1.0.0",
<<<<<<< HEAD
=======
"syntax_pos",
]

[[package]]
name = "syntax_expand"
version = "0.0.0"
dependencies = [
"log",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_lexer",
"rustc_parse",
"serialize",
"smallvec 1.0.0",
"syntax",
"syntax_pos",
]

[[package]]
name = "syntax_ext"
version = "0.0.0"
dependencies = [
"fmt_macros",
"log",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_parse",
"rustc_target",
"smallvec 1.0.0",
"syntax",
"syntax_expand",
"syntax_pos",
]

[[package]]
name = "syntax_pos"
version = "0.0.0"
dependencies = [
"arena",
"cfg-if",
"log",
"rustc_data_structures",
"rustc_index",
"rustc_macros",
"scoped-tls",
"serialize",
"unicode-width",
>>>>>>> Update lock file
]

[[package]]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl<'tcx> ConstEvalErr<'tcx> {
}

pub fn struct_error<'tcx>(tcx: TyCtxtAt<'tcx>, msg: &str) -> DiagnosticBuilder<'tcx> {
struct_span_err!(tcx.sess, tcx.span, E0080, "{}", msg)
struct_span_err!(tcx.sess, tcx.span, "E0080", "{}", msg)
}

/// Packages the kind of error we got from the const code interpreter
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl<'tcx> TyCtxt<'tcx> {
let mut err = struct_span_err!(
self.sess,
span,
E0391,
"E0391",
"cycle detected when {}",
stack[0].query.describe(self)
);
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_ast_lowering/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let mut err = struct_span_err!(
self.sess,
await_span,
E0728,
"E0728",
"`await` is only allowed inside `async` functions and blocks"
);
err.span_label(await_span, "only allowed inside `async` functions and blocks");
Expand Down Expand Up @@ -692,7 +692,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
struct_span_err!(
self.sess,
fn_decl_span,
E0628,
"E0628",
"too many parameters for a generator (expected 0 or 1 parameters)"
)
.emit();
Expand All @@ -704,7 +704,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}
None => {
if movability == Movability::Static {
struct_span_err!(self.sess, fn_decl_span, E0697, "closures cannot be static")
struct_span_err!(self.sess, fn_decl_span, "E0697", "closures cannot be static")
.emit();
}
None
Expand Down Expand Up @@ -733,7 +733,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
struct_span_err!(
this.sess,
fn_decl_span,
E0708,
"E0708",
"`async` non-`move` closures with parameters are not currently supported",
)
.help(
Expand Down Expand Up @@ -946,7 +946,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
struct_span_err!(
self.sess,
span,
E0727,
"E0727",
"`async` generators are not yet supported"
)
.emit();
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast_lowering/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}

fn error_on_invalid_abi(&self, abi: StrLit) {
struct_span_err!(self.sess, abi.span, E0703, "invalid ABI: found `{}`", abi.symbol)
struct_span_err!(self.sess, abi.span, "E0703", "invalid ABI: found `{}`", abi.symbol)
.span_label(abi.span, "invalid ABI")
.help(&format!("valid ABIs: {}", abi::all_names().join(", ")))
.emit();
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_ast_lowering/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let mut err = struct_span_err!(
self.sess,
t.span,
E0562,
"E0562",
"`impl Trait` not allowed outside of {}",
allowed_in,
);
Expand Down Expand Up @@ -2532,7 +2532,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
),
};

let mut err = struct_span_err!(self.sess, span, E0637, "{}", msg,);
let mut err = struct_span_err!(self.sess, span, "E0637", "{}", msg,);
err.span_label(span, label);
err.emit();

Expand Down
24 changes: 12 additions & 12 deletions src/librustc_ast_passes/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl<'a> AstValidator<'a> {
}

let mut err =
struct_span_err!(self.session, vis.span, E0449, "unnecessary visibility qualifier");
struct_span_err!(self.session, vis.span, "E0449", "unnecessary visibility qualifier");
if vis.node.is_pub() {
err.span_label(vis.span, "`pub` not permitted here because it's implied");
}
Expand All @@ -229,7 +229,7 @@ impl<'a> AstValidator<'a> {
struct_span_err!(
self.session,
fn_span,
E0706,
"E0706",
"functions in traits cannot be declared `async`"
)
.span_label(span, "`async` because of this")
Expand All @@ -244,7 +244,7 @@ impl<'a> AstValidator<'a> {
struct_span_err!(
self.session,
span,
E0379,
"E0379",
"functions in traits cannot be declared const"
)
.span_label(span, "functions in traits cannot be const")
Expand Down Expand Up @@ -700,7 +700,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
struct_span_err!(
self.session,
expr.span,
E0472,
"E0472",
"asm! is unsupported on this target"
)
.emit();
Expand All @@ -719,7 +719,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
struct_span_err!(
self.session,
span,
E0561,
"E0561",
"patterns aren't allowed in function pointer types"
)
.emit();
Expand All @@ -734,7 +734,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
struct_span_err!(
self.session,
lifetime.ident.span,
E0226,
"E0226",
"only a single explicit lifetime bound is permitted"
)
.emit();
Expand All @@ -750,7 +750,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
struct_span_err!(
self.session,
ty.span,
E0667,
"E0667",
"`impl Trait` is not allowed in path parameters"
)
.emit();
Expand All @@ -760,7 +760,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
struct_span_err!(
self.session,
ty.span,
E0666,
"E0666",
"nested `impl Trait` is not allowed"
)
.span_label(outer_impl_trait_sp, "outer `impl Trait`")
Expand Down Expand Up @@ -854,7 +854,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
struct_span_err!(
self.session,
item.span,
E0197,
"E0197",
"inherent impls cannot be unsafe"
)
.span_label(span, "unsafe because of this")
Expand Down Expand Up @@ -910,7 +910,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
struct_span_err!(
self.session,
item.span,
E0567,
"E0567",
"auto traits cannot have generic parameters"
)
.emit();
Expand All @@ -919,7 +919,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
struct_span_err!(
self.session,
item.span,
E0568,
"E0568",
"auto traits cannot have super traits"
)
.emit();
Expand All @@ -928,7 +928,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
struct_span_err!(
self.session,
item.span,
E0380,
"E0380",
"auto traits cannot have methods or associated items"
)
.emit();
Expand Down
Loading