mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
migrate entry.rs to translateable diagnostics
This commit is contained in:
parent
96f92eab68
commit
b17ec43637
@ -495,3 +495,42 @@ passes_naked_functions_asm_options =
|
|||||||
passes_naked_functions_must_use_noreturn =
|
passes_naked_functions_must_use_noreturn =
|
||||||
asm in naked functions must use `noreturn` option
|
asm in naked functions must use `noreturn` option
|
||||||
.suggestion = consider specifying that the asm block is responsible for returning from the function
|
.suggestion = consider specifying that the asm block is responsible for returning from the function
|
||||||
|
|
||||||
|
passes_attr_only_on_main =
|
||||||
|
`{$attr}` attribute can only be used on `fn main()`
|
||||||
|
|
||||||
|
passes_attr_only_on_root_main =
|
||||||
|
`{$attr}` attribute can only be used on root `fn main()`
|
||||||
|
|
||||||
|
passes_attr_only_in_functions =
|
||||||
|
`{$attr}` attribute can only be used on functions
|
||||||
|
|
||||||
|
passes_multiple_rustc_main =
|
||||||
|
multiple functions with a `#[rustc_main]` attribute
|
||||||
|
.first = first `#[rustc_main]` function
|
||||||
|
.additional = additional `#[rustc_main]` function
|
||||||
|
|
||||||
|
passes_multiple_start_functions =
|
||||||
|
multiple `start` functions
|
||||||
|
.label = multiple `start` functions
|
||||||
|
.previous = previous `#[start]` function here
|
||||||
|
|
||||||
|
passes_extern_main =
|
||||||
|
the `main` function cannot be declared in an `extern` block
|
||||||
|
|
||||||
|
passes_unix_sigpipe_values =
|
||||||
|
valid values for `#[unix_sigpipe = "..."]` are `inherit`, `sig_ign`, or `sig_dfl`
|
||||||
|
|
||||||
|
passes_no_main_function =
|
||||||
|
`main` function not found in crate `{$crate_name}`
|
||||||
|
.here_is_main = here is a function named `main`
|
||||||
|
.one_or_more_possible_main = you have one or more functions named `main` not defined at the crate level
|
||||||
|
.consider_moving_main = consider moving the `main` function definitions
|
||||||
|
.main_must_be_defined_at_crate = the main function must be defined at the crate level{$has_filename ->
|
||||||
|
[true] {" "}(in `{$filename}`)
|
||||||
|
*[false] {""}
|
||||||
|
}
|
||||||
|
.consider_adding_main_to_file = consider adding a `main` function to `{$filename}`
|
||||||
|
.consider_adding_main_at_crate = consider adding a `main` function at the crate level
|
||||||
|
.teach_note = If you don't know the basics of Rust, you can go look to the Rust Book to get started: https://doc.rust-lang.org/book/
|
||||||
|
.non_function_main = non-function item at `crate::main` is found
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use rustc_ast::entry::EntryPointType;
|
use rustc_ast::entry::EntryPointType;
|
||||||
use rustc_errors::struct_span_err;
|
use rustc_errors::error_code;
|
||||||
use rustc_hir::def::DefKind;
|
use rustc_hir::def::DefKind;
|
||||||
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
|
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
|
||||||
use rustc_hir::{ItemId, Node, CRATE_HIR_ID};
|
use rustc_hir::{ItemId, Node, CRATE_HIR_ID};
|
||||||
@ -8,7 +8,12 @@ use rustc_middle::ty::{DefIdTree, TyCtxt};
|
|||||||
use rustc_session::config::{sigpipe, CrateType, EntryFnType};
|
use rustc_session::config::{sigpipe, CrateType, EntryFnType};
|
||||||
use rustc_session::parse::feature_err;
|
use rustc_session::parse::feature_err;
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
use rustc_span::{Span, Symbol, DUMMY_SP};
|
use rustc_span::{Span, Symbol};
|
||||||
|
|
||||||
|
use crate::errors::{
|
||||||
|
AttrOnlyInFunctions, AttrOnlyOnMain, AttrOnlyOnRootMain, ExternMain, MultipleRustcMain,
|
||||||
|
MultipleStartFunctions, NoMainErr, UnixSigpipeValues,
|
||||||
|
};
|
||||||
|
|
||||||
struct EntryContext<'tcx> {
|
struct EntryContext<'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
@ -71,14 +76,9 @@ fn entry_point_type(ctxt: &EntryContext<'_>, id: ItemId, at_root: bool) -> Entry
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn err_if_attr_found(ctxt: &EntryContext<'_>, id: ItemId, sym: Symbol, details: &str) {
|
fn attr_span_by_symbol(ctxt: &EntryContext<'_>, id: ItemId, sym: Symbol) -> Option<Span> {
|
||||||
let attrs = ctxt.tcx.hir().attrs(id.hir_id());
|
let attrs = ctxt.tcx.hir().attrs(id.hir_id());
|
||||||
if let Some(attr) = ctxt.tcx.sess.find_by_name(attrs, sym) {
|
ctxt.tcx.sess.find_by_name(attrs, sym).map(|attr| attr.span)
|
||||||
ctxt.tcx
|
|
||||||
.sess
|
|
||||||
.struct_span_err(attr.span, &format!("`{}` attribute {}", sym, details))
|
|
||||||
.emit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_item(id: ItemId, ctxt: &mut EntryContext<'_>) {
|
fn find_item(id: ItemId, ctxt: &mut EntryContext<'_>) {
|
||||||
@ -86,49 +86,47 @@ fn find_item(id: ItemId, ctxt: &mut EntryContext<'_>) {
|
|||||||
|
|
||||||
match entry_point_type(ctxt, id, at_root) {
|
match entry_point_type(ctxt, id, at_root) {
|
||||||
EntryPointType::None => {
|
EntryPointType::None => {
|
||||||
err_if_attr_found(ctxt, id, sym::unix_sigpipe, "can only be used on `fn main()`");
|
if let Some(span) = attr_span_by_symbol(ctxt, id, sym::unix_sigpipe) {
|
||||||
|
ctxt.tcx.sess.emit_err(AttrOnlyOnMain { span, attr: sym::unix_sigpipe });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ if !matches!(ctxt.tcx.def_kind(id.def_id), DefKind::Fn) => {
|
_ if !matches!(ctxt.tcx.def_kind(id.def_id), DefKind::Fn) => {
|
||||||
err_if_attr_found(ctxt, id, sym::start, "can only be used on functions");
|
for attr in [sym::start, sym::rustc_main] {
|
||||||
err_if_attr_found(ctxt, id, sym::rustc_main, "can only be used on functions");
|
if let Some(span) = attr_span_by_symbol(ctxt, id, attr) {
|
||||||
|
ctxt.tcx.sess.emit_err(AttrOnlyInFunctions { span, attr });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EntryPointType::MainNamed => (),
|
EntryPointType::MainNamed => (),
|
||||||
EntryPointType::OtherMain => {
|
EntryPointType::OtherMain => {
|
||||||
err_if_attr_found(ctxt, id, sym::unix_sigpipe, "can only be used on root `fn main()`");
|
if let Some(span) = attr_span_by_symbol(ctxt, id, sym::unix_sigpipe) {
|
||||||
|
ctxt.tcx.sess.emit_err(AttrOnlyOnRootMain { span, attr: sym::unix_sigpipe });
|
||||||
|
}
|
||||||
ctxt.non_main_fns.push(ctxt.tcx.def_span(id.def_id));
|
ctxt.non_main_fns.push(ctxt.tcx.def_span(id.def_id));
|
||||||
}
|
}
|
||||||
EntryPointType::RustcMainAttr => {
|
EntryPointType::RustcMainAttr => {
|
||||||
if ctxt.attr_main_fn.is_none() {
|
if ctxt.attr_main_fn.is_none() {
|
||||||
ctxt.attr_main_fn = Some((id.def_id.def_id, ctxt.tcx.def_span(id.def_id)));
|
ctxt.attr_main_fn = Some((id.def_id.def_id, ctxt.tcx.def_span(id.def_id)));
|
||||||
} else {
|
} else {
|
||||||
struct_span_err!(
|
ctxt.tcx.sess.emit_err(MultipleRustcMain {
|
||||||
ctxt.tcx.sess,
|
span: ctxt.tcx.def_span(id.def_id.to_def_id()),
|
||||||
ctxt.tcx.def_span(id.def_id.to_def_id()),
|
first: ctxt.attr_main_fn.unwrap().1,
|
||||||
E0137,
|
additional: ctxt.tcx.def_span(id.def_id.to_def_id()),
|
||||||
"multiple functions with a `#[rustc_main]` attribute"
|
});
|
||||||
)
|
|
||||||
.span_label(
|
|
||||||
ctxt.tcx.def_span(id.def_id.to_def_id()),
|
|
||||||
"additional `#[rustc_main]` function",
|
|
||||||
)
|
|
||||||
.span_label(ctxt.attr_main_fn.unwrap().1, "first `#[rustc_main]` function")
|
|
||||||
.emit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EntryPointType::Start => {
|
EntryPointType::Start => {
|
||||||
err_if_attr_found(ctxt, id, sym::unix_sigpipe, "can only be used on `fn main()`");
|
if let Some(span) = attr_span_by_symbol(ctxt, id, sym::unix_sigpipe) {
|
||||||
|
ctxt.tcx.sess.emit_err(AttrOnlyOnMain { span, attr: sym::unix_sigpipe });
|
||||||
|
}
|
||||||
if ctxt.start_fn.is_none() {
|
if ctxt.start_fn.is_none() {
|
||||||
ctxt.start_fn = Some((id.def_id.def_id, ctxt.tcx.def_span(id.def_id)));
|
ctxt.start_fn = Some((id.def_id.def_id, ctxt.tcx.def_span(id.def_id)));
|
||||||
} else {
|
} else {
|
||||||
struct_span_err!(
|
ctxt.tcx.sess.emit_err(MultipleStartFunctions {
|
||||||
ctxt.tcx.sess,
|
span: ctxt.tcx.def_span(id.def_id),
|
||||||
ctxt.tcx.def_span(id.def_id),
|
labeled: ctxt.tcx.def_span(id.def_id.to_def_id()),
|
||||||
E0138,
|
previous: ctxt.start_fn.unwrap().1,
|
||||||
"multiple `start` functions"
|
});
|
||||||
)
|
|
||||||
.span_label(ctxt.start_fn.unwrap().1, "previous `#[start]` function here")
|
|
||||||
.span_label(ctxt.tcx.def_span(id.def_id.to_def_id()), "multiple `start` functions")
|
|
||||||
.emit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,12 +142,7 @@ fn configure_main(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) -> Option<(DefId,
|
|||||||
if let Some(main_def) = tcx.resolutions(()).main_def && let Some(def_id) = main_def.opt_fn_def_id() {
|
if let Some(main_def) = tcx.resolutions(()).main_def && let Some(def_id) = main_def.opt_fn_def_id() {
|
||||||
// non-local main imports are handled below
|
// non-local main imports are handled below
|
||||||
if let Some(def_id) = def_id.as_local() && matches!(tcx.hir().find_by_def_id(def_id), Some(Node::ForeignItem(_))) {
|
if let Some(def_id) = def_id.as_local() && matches!(tcx.hir().find_by_def_id(def_id), Some(Node::ForeignItem(_))) {
|
||||||
tcx.sess
|
tcx.sess.emit_err(ExternMain { span: tcx.def_span(def_id) });
|
||||||
.struct_span_err(
|
|
||||||
tcx.def_span(def_id),
|
|
||||||
"the `main` function cannot be declared in an `extern` block",
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,12 +175,7 @@ fn sigpipe(tcx: TyCtxt<'_>, def_id: DefId) -> u8 {
|
|||||||
sigpipe::DEFAULT
|
sigpipe::DEFAULT
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess
|
tcx.sess.emit_err(UnixSigpipeValues { span: attr.span });
|
||||||
.struct_span_err(
|
|
||||||
attr.span,
|
|
||||||
"valid values for `#[unix_sigpipe = \"...\"]` are `inherit`, `sig_ign`, or `sig_dfl`",
|
|
||||||
)
|
|
||||||
.emit();
|
|
||||||
sigpipe::DEFAULT
|
sigpipe::DEFAULT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,52 +194,29 @@ fn no_main_err(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// There is no main function.
|
// There is no main function.
|
||||||
let mut err = struct_span_err!(
|
let mut has_filename = true;
|
||||||
tcx.sess,
|
let filename = tcx.sess.local_crate_source_file.clone().unwrap_or_else(|| {
|
||||||
DUMMY_SP,
|
has_filename = false;
|
||||||
E0601,
|
Default::default()
|
||||||
"`main` function not found in crate `{}`",
|
});
|
||||||
tcx.crate_name(LOCAL_CRATE)
|
let main_def_opt = tcx.resolutions(()).main_def;
|
||||||
);
|
let diagnostic_id = error_code!(E0601);
|
||||||
let filename = &tcx.sess.local_crate_source_file;
|
let add_teach_note = tcx.sess.teach(&diagnostic_id);
|
||||||
let note = if !visitor.non_main_fns.is_empty() {
|
|
||||||
for &span in &visitor.non_main_fns {
|
|
||||||
err.span_note(span, "here is a function named `main`");
|
|
||||||
}
|
|
||||||
err.note("you have one or more functions named `main` not defined at the crate level");
|
|
||||||
err.help("consider moving the `main` function definitions");
|
|
||||||
// There were some functions named `main` though. Try to give the user a hint.
|
|
||||||
format!(
|
|
||||||
"the main function must be defined at the crate level{}",
|
|
||||||
filename.as_ref().map(|f| format!(" (in `{}`)", f.display())).unwrap_or_default()
|
|
||||||
)
|
|
||||||
} else if let Some(filename) = filename {
|
|
||||||
format!("consider adding a `main` function to `{}`", filename.display())
|
|
||||||
} else {
|
|
||||||
String::from("consider adding a `main` function at the crate level")
|
|
||||||
};
|
|
||||||
// The file may be empty, which leads to the diagnostic machinery not emitting this
|
// The file may be empty, which leads to the diagnostic machinery not emitting this
|
||||||
// note. This is a relatively simple way to detect that case and emit a span-less
|
// note. This is a relatively simple way to detect that case and emit a span-less
|
||||||
// note instead.
|
// note instead.
|
||||||
if tcx.sess.source_map().lookup_line(sp.hi()).is_ok() {
|
let file_empty = !tcx.sess.source_map().lookup_line(sp.hi()).is_ok();
|
||||||
err.set_span(sp.shrink_to_hi());
|
|
||||||
err.span_label(sp.shrink_to_hi(), ¬e);
|
|
||||||
} else {
|
|
||||||
err.note(¬e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(main_def) = tcx.resolutions(()).main_def && main_def.opt_fn_def_id().is_none(){
|
tcx.sess.emit_err(NoMainErr {
|
||||||
// There is something at `crate::main`, but it is not a function definition.
|
sp,
|
||||||
err.span_label(main_def.span, "non-function item at `crate::main` is found");
|
crate_name: tcx.crate_name(LOCAL_CRATE),
|
||||||
}
|
has_filename,
|
||||||
|
filename,
|
||||||
if tcx.sess.teach(&err.get_code().unwrap()) {
|
file_empty,
|
||||||
err.note(
|
non_main_fns: visitor.non_main_fns.clone(),
|
||||||
"If you don't know the basics of Rust, you can go look to the Rust Book \
|
main_def_opt,
|
||||||
to get started: https://doc.rust-lang.org/book/",
|
add_teach_note,
|
||||||
);
|
});
|
||||||
}
|
|
||||||
err.emit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut Providers) {
|
pub fn provide(providers: &mut Providers) {
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
use std::{io::Error, path::Path};
|
use std::{
|
||||||
|
io::Error,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
};
|
||||||
|
|
||||||
use rustc_ast::Label;
|
use rustc_ast::Label;
|
||||||
use rustc_errors::{error_code, Applicability, ErrorGuaranteed, IntoDiagnostic, MultiSpan};
|
use rustc_errors::{error_code, Applicability, ErrorGuaranteed, IntoDiagnostic, MultiSpan};
|
||||||
use rustc_hir::{self as hir, ExprKind, Target};
|
use rustc_hir::{self as hir, ExprKind, Target};
|
||||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||||
use rustc_span::{Span, Symbol};
|
use rustc_middle::ty::MainDefinition;
|
||||||
|
use rustc_span::{Span, Symbol, DUMMY_SP};
|
||||||
|
|
||||||
#[derive(LintDiagnostic)]
|
#[derive(LintDiagnostic)]
|
||||||
#[diag(passes::outer_crate_level_attr)]
|
#[diag(passes::outer_crate_level_attr)]
|
||||||
@ -1063,3 +1067,127 @@ pub struct NakedFunctionsMustUseNoreturn {
|
|||||||
#[suggestion(code = ", options(noreturn)", applicability = "machine-applicable")]
|
#[suggestion(code = ", options(noreturn)", applicability = "machine-applicable")]
|
||||||
pub last_span: Span,
|
pub last_span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(passes::attr_only_on_main)]
|
||||||
|
pub struct AttrOnlyOnMain {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
pub attr: Symbol,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(passes::attr_only_on_root_main)]
|
||||||
|
pub struct AttrOnlyOnRootMain {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
pub attr: Symbol,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(passes::attr_only_in_functions)]
|
||||||
|
pub struct AttrOnlyInFunctions {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
pub attr: Symbol,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(passes::multiple_rustc_main, code = "E0137")]
|
||||||
|
pub struct MultipleRustcMain {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
#[label(passes::first)]
|
||||||
|
pub first: Span,
|
||||||
|
#[label(passes::additional)]
|
||||||
|
pub additional: Span,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(passes::multiple_start_functions, code = "E0138")]
|
||||||
|
pub struct MultipleStartFunctions {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
#[label]
|
||||||
|
pub labeled: Span,
|
||||||
|
#[label(passes::previous)]
|
||||||
|
pub previous: Span,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(passes::extern_main)]
|
||||||
|
pub struct ExternMain {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(passes::unix_sigpipe_values)]
|
||||||
|
pub struct UnixSigpipeValues {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
|
#[diag(passes::no_main_function, code = "E0601")]
|
||||||
|
pub struct NoMainFunction {
|
||||||
|
#[primary_span]
|
||||||
|
pub span: Span,
|
||||||
|
pub crate_name: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct NoMainErr {
|
||||||
|
pub sp: Span,
|
||||||
|
pub crate_name: Symbol,
|
||||||
|
pub has_filename: bool,
|
||||||
|
pub filename: PathBuf,
|
||||||
|
pub file_empty: bool,
|
||||||
|
pub non_main_fns: Vec<Span>,
|
||||||
|
pub main_def_opt: Option<MainDefinition>,
|
||||||
|
pub add_teach_note: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> IntoDiagnostic<'a> for NoMainErr {
|
||||||
|
fn into_diagnostic(
|
||||||
|
self,
|
||||||
|
handler: &'a rustc_errors::Handler,
|
||||||
|
) -> rustc_errors::DiagnosticBuilder<'a, ErrorGuaranteed> {
|
||||||
|
let mut diag = handler.struct_span_err_with_code(
|
||||||
|
DUMMY_SP,
|
||||||
|
rustc_errors::fluent::passes::no_main_function,
|
||||||
|
error_code!(E0601),
|
||||||
|
);
|
||||||
|
diag.set_arg("crate_name", self.crate_name);
|
||||||
|
diag.set_arg("filename", self.filename);
|
||||||
|
diag.set_arg("has_filename", self.has_filename);
|
||||||
|
let note = if !self.non_main_fns.is_empty() {
|
||||||
|
for &span in &self.non_main_fns {
|
||||||
|
diag.span_note(span, rustc_errors::fluent::passes::here_is_main);
|
||||||
|
}
|
||||||
|
diag.note(rustc_errors::fluent::passes::one_or_more_possible_main);
|
||||||
|
diag.help(rustc_errors::fluent::passes::consider_moving_main);
|
||||||
|
// There were some functions named `main` though. Try to give the user a hint.
|
||||||
|
rustc_errors::fluent::passes::main_must_be_defined_at_crate
|
||||||
|
} else if self.has_filename {
|
||||||
|
rustc_errors::fluent::passes::consider_adding_main_to_file
|
||||||
|
} else {
|
||||||
|
rustc_errors::fluent::passes::consider_adding_main_at_crate
|
||||||
|
};
|
||||||
|
if self.file_empty {
|
||||||
|
diag.note(note);
|
||||||
|
} else {
|
||||||
|
diag.set_span(self.sp.shrink_to_hi());
|
||||||
|
diag.span_label(self.sp.shrink_to_hi(), note);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(main_def) = self.main_def_opt && main_def.opt_fn_def_id().is_none(){
|
||||||
|
// There is something at `crate::main`, but it is not a function definition.
|
||||||
|
diag.span_label(main_def.span, rustc_errors::fluent::passes::non_function_main);
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.add_teach_note {
|
||||||
|
diag.note(rustc_errors::fluent::passes::teach_note);
|
||||||
|
}
|
||||||
|
diag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user