Rename {create,emit}_warning as {create,emit}_warn.

For consistency with `warn`/`struct_warn`, and also `{create,emit}_err`,
all of which use an abbreviated form.
This commit is contained in:
Nicholas Nethercote 2024-01-04 11:28:14 +11:00
parent ff40ad4107
commit 3c4f1d85af
23 changed files with 55 additions and 56 deletions

View file

@ -38,21 +38,21 @@ struct ShowSpanVisitor<'a> {
impl<'a> Visitor<'a> for ShowSpanVisitor<'a> { impl<'a> Visitor<'a> for ShowSpanVisitor<'a> {
fn visit_expr(&mut self, e: &'a ast::Expr) { fn visit_expr(&mut self, e: &'a ast::Expr) {
if let Mode::Expression = self.mode { if let Mode::Expression = self.mode {
self.dcx.emit_warning(errors::ShowSpan { span: e.span, msg: "expression" }); self.dcx.emit_warn(errors::ShowSpan { span: e.span, msg: "expression" });
} }
visit::walk_expr(self, e); visit::walk_expr(self, e);
} }
fn visit_pat(&mut self, p: &'a ast::Pat) { fn visit_pat(&mut self, p: &'a ast::Pat) {
if let Mode::Pattern = self.mode { if let Mode::Pattern = self.mode {
self.dcx.emit_warning(errors::ShowSpan { span: p.span, msg: "pattern" }); self.dcx.emit_warn(errors::ShowSpan { span: p.span, msg: "pattern" });
} }
visit::walk_pat(self, p); visit::walk_pat(self, p);
} }
fn visit_ty(&mut self, t: &'a ast::Ty) { fn visit_ty(&mut self, t: &'a ast::Ty) {
if let Mode::Type = self.mode { if let Mode::Type = self.mode {
self.dcx.emit_warning(errors::ShowSpan { span: t.span, msg: "type" }); self.dcx.emit_warn(errors::ShowSpan { span: t.span, msg: "type" });
} }
visit::walk_ty(self, t); visit::walk_ty(self, t);
} }

View file

@ -621,7 +621,7 @@ pub fn eval_condition(
} }
}; };
let Some(min_version) = parse_version(*min_version) else { let Some(min_version) = parse_version(*min_version) else {
dcx.emit_warning(session_diagnostics::UnknownVersionLiteral { span: *span }); dcx.emit_warn(session_diagnostics::UnknownVersionLiteral { span: *span });
return false; return false;
}; };

View file

@ -52,7 +52,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
Some(c @ ('+' | '-')) => c, Some(c @ ('+' | '-')) => c,
Some(_) => { Some(_) => {
if diagnostics { if diagnostics {
sess.dcx().emit_warning(UnknownCTargetFeaturePrefix { feature: s }); sess.dcx().emit_warn(UnknownCTargetFeaturePrefix { feature: s });
} }
return None; return None;
} }
@ -79,7 +79,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
else { else {
UnknownCTargetFeature { feature, rust_feature: PossibleFeature::None } UnknownCTargetFeature { feature, rust_feature: PossibleFeature::None }
}; };
sess.dcx().emit_warning(unknown_feature); sess.dcx().emit_warn(unknown_feature);
} }
if diagnostics { if diagnostics {

View file

@ -191,7 +191,7 @@ impl CodegenBackend for GccCodegenBackend {
#[cfg(feature="master")] #[cfg(feature="master")]
gccjit::set_global_personality_function_name(b"rust_eh_personality\0"); gccjit::set_global_personality_function_name(b"rust_eh_personality\0");
if sess.lto() == Lto::Thin { if sess.lto() == Lto::Thin {
sess.dcx().emit_warning(LTONotSupported {}); sess.dcx().emit_warn(LTONotSupported {});
} }
#[cfg(not(feature="master"))] #[cfg(not(feature="master"))]

View file

@ -245,12 +245,12 @@ pub fn target_machine_factory(
match sess.opts.debuginfo_compression { match sess.opts.debuginfo_compression {
rustc_session::config::DebugInfoCompression::Zlib => { rustc_session::config::DebugInfoCompression::Zlib => {
if !unsafe { LLVMRustLLVMHasZlibCompressionForDebugSymbols() } { if !unsafe { LLVMRustLLVMHasZlibCompressionForDebugSymbols() } {
sess.dcx().emit_warning(UnknownCompression { algorithm: "zlib" }); sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
} }
} }
rustc_session::config::DebugInfoCompression::Zstd => { rustc_session::config::DebugInfoCompression::Zstd => {
if !unsafe { LLVMRustLLVMHasZstdCompressionForDebugSymbols() } { if !unsafe { LLVMRustLLVMHasZstdCompressionForDebugSymbols() } {
sess.dcx().emit_warning(UnknownCompression { algorithm: "zstd" }); sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
} }
} }
rustc_session::config::DebugInfoCompression::None => {} rustc_session::config::DebugInfoCompression::None => {}
@ -457,7 +457,7 @@ unsafe extern "C" fn diagnostic_handler(info: &DiagnosticInfo, user: *mut c_void
llvm::LLVMRustWriteDiagnosticInfoToString(diagnostic_ref, s) llvm::LLVMRustWriteDiagnosticInfoToString(diagnostic_ref, s)
}) })
.expect("non-UTF8 diagnostic"); .expect("non-UTF8 diagnostic");
dcx.emit_warning(FromLlvmDiag { message }); dcx.emit_warn(FromLlvmDiag { message });
} }
llvm::diagnostic::Unsupported(diagnostic_ref) => { llvm::diagnostic::Unsupported(diagnostic_ref) => {
let message = llvm::build_string(|s| { let message = llvm::build_string(|s| {

View file

@ -529,7 +529,7 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
Some(c @ ('+' | '-')) => c, Some(c @ ('+' | '-')) => c,
Some(_) => { Some(_) => {
if diagnostics { if diagnostics {
sess.dcx().emit_warning(UnknownCTargetFeaturePrefix { feature: s }); sess.dcx().emit_warn(UnknownCTargetFeaturePrefix { feature: s });
} }
return None; return None;
} }
@ -557,12 +557,12 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
} else { } else {
UnknownCTargetFeature { feature, rust_feature: PossibleFeature::None } UnknownCTargetFeature { feature, rust_feature: PossibleFeature::None }
}; };
sess.dcx().emit_warning(unknown_feature); sess.dcx().emit_warn(unknown_feature);
} else if feature_state } else if feature_state
.is_some_and(|(_name, feature_gate)| !feature_gate.is_stable()) .is_some_and(|(_name, feature_gate)| !feature_gate.is_stable())
{ {
// An unstable feature. Warn about using it. // An unstable feature. Warn about using it.
sess.dcx().emit_warning(UnstableCTargetFeature { feature }); sess.dcx().emit_warn(UnstableCTargetFeature { feature });
} }
} }

View file

@ -1016,7 +1016,7 @@ fn link_natively<'a>(
if !prog.status.success() { if !prog.status.success() {
let mut output = prog.stderr.clone(); let mut output = prog.stderr.clone();
output.extend_from_slice(&prog.stdout); output.extend_from_slice(&prog.stdout);
sess.dcx().emit_warning(errors::ProcessingDymutilFailed { sess.dcx().emit_warn(errors::ProcessingDymutilFailed {
status: prog.status, status: prog.status,
output: escape_string(&output), output: escape_string(&output),
}); });
@ -1091,7 +1091,7 @@ fn strip_symbols_with_external_utility<'a>(
if !prog.status.success() { if !prog.status.success() {
let mut output = prog.stderr.clone(); let mut output = prog.stderr.clone();
output.extend_from_slice(&prog.stdout); output.extend_from_slice(&prog.stdout);
sess.dcx().emit_warning(errors::StrippingDebugInfoFailed { sess.dcx().emit_warn(errors::StrippingDebugInfoFailed {
util, util,
status: prog.status, status: prog.status,
output: escape_string(&output), output: escape_string(&output),
@ -2406,7 +2406,7 @@ fn collect_natvis_visualizers(
visualizer_paths.push(visualizer_out_file); visualizer_paths.push(visualizer_out_file);
} }
Err(error) => { Err(error) => {
sess.dcx().emit_warning(errors::UnableToWriteDebuggerVisualizer { sess.dcx().emit_warn(errors::UnableToWriteDebuggerVisualizer {
path: visualizer_out_file, path: visualizer_out_file,
error, error,
}); });

View file

@ -446,11 +446,11 @@ impl<'a> Linker for GccLinker<'a> {
// FIXME(81490): ld64 doesn't support these flags but macOS 11 // FIXME(81490): ld64 doesn't support these flags but macOS 11
// has -needed-l{} / -needed_library {} // has -needed-l{} / -needed_library {}
// but we have no way to detect that here. // but we have no way to detect that here.
self.sess.dcx().emit_warning(errors::Ld64UnimplementedModifier); self.sess.dcx().emit_warn(errors::Ld64UnimplementedModifier);
} else if self.is_gnu && !self.sess.target.is_like_windows { } else if self.is_gnu && !self.sess.target.is_like_windows {
self.linker_arg("--no-as-needed"); self.linker_arg("--no-as-needed");
} else { } else {
self.sess.dcx().emit_warning(errors::LinkerUnsupportedModifier); self.sess.dcx().emit_warn(errors::LinkerUnsupportedModifier);
} }
} }
self.hint_dynamic(); self.hint_dynamic();
@ -504,7 +504,7 @@ impl<'a> Linker for GccLinker<'a> {
// FIXME(81490): ld64 as of macOS 11 supports the -needed_framework // FIXME(81490): ld64 as of macOS 11 supports the -needed_framework
// flag but we have no way to detect that here. // flag but we have no way to detect that here.
// self.cmd.arg("-needed_framework").arg(framework); // self.cmd.arg("-needed_framework").arg(framework);
self.sess.dcx().emit_warning(errors::Ld64UnimplementedModifier); self.sess.dcx().emit_warn(errors::Ld64UnimplementedModifier);
} }
self.cmd.arg("-framework").arg(framework); self.cmd.arg("-framework").arg(framework);
} }
@ -950,7 +950,7 @@ impl<'a> Linker for MsvcLinker<'a> {
} }
} }
Err(error) => { Err(error) => {
self.sess.dcx().emit_warning(errors::NoNatvisDirectory { error }); self.sess.dcx().emit_warn(errors::NoNatvisDirectory { error });
} }
} }
} }
@ -1501,7 +1501,7 @@ impl<'a> Linker for L4Bender<'a> {
fn export_symbols(&mut self, _: &Path, _: CrateType, _: &[String]) { fn export_symbols(&mut self, _: &Path, _: CrateType, _: &[String]) {
// ToDo, not implemented, copy from GCC // ToDo, not implemented, copy from GCC
self.sess.dcx().emit_warning(errors::L4BenderExportingSymbolsUnimplemented); self.sess.dcx().emit_warn(errors::L4BenderExportingSymbolsUnimplemented);
return; return;
} }

View file

@ -573,11 +573,11 @@ fn produce_final_output_artifacts(
if crate_output.outputs.contains_key(&output_type) { if crate_output.outputs.contains_key(&output_type) {
// 2) Multiple codegen units, with `--emit foo=some_name`. We have // 2) Multiple codegen units, with `--emit foo=some_name`. We have
// no good solution for this case, so warn the user. // no good solution for this case, so warn the user.
sess.dcx().emit_warning(errors::IgnoringEmitPath { extension }); sess.dcx().emit_warn(errors::IgnoringEmitPath { extension });
} else if crate_output.single_output_file.is_some() { } else if crate_output.single_output_file.is_some() {
// 3) Multiple codegen units, with `-o some_name`. We have // 3) Multiple codegen units, with `-o some_name`. We have
// no good solution for this case, so warn the user. // no good solution for this case, so warn the user.
sess.dcx().emit_warning(errors::IgnoringOutput { extension }); sess.dcx().emit_warn(errors::IgnoringOutput { extension });
} else { } else {
// 4) Multiple codegen units, but no explicit name. We // 4) Multiple codegen units, but no explicit name. We
// just leave the `foo.0.x` files in place. // just leave the `foo.0.x` files in place.

View file

@ -630,7 +630,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
// current number of evaluated terminators is a power of 2. The latter gives us a cheap // current number of evaluated terminators is a power of 2. The latter gives us a cheap
// way to implement exponential backoff. // way to implement exponential backoff.
let span = ecx.cur_span(); let span = ecx.cur_span();
ecx.tcx.dcx().emit_warning(LongRunningWarn { span, item_span: ecx.tcx.span }); ecx.tcx.dcx().emit_warn(LongRunningWarn { span, item_span: ecx.tcx.span });
} }
} }

View file

@ -1429,7 +1429,7 @@ fn report_ice(
} }
Err(err) => { Err(err) => {
// The path ICE couldn't be written to disk, provide feedback to the user as to why. // The path ICE couldn't be written to disk, provide feedback to the user as to why.
dcx.emit_warning(session_diagnostics::IcePathError { dcx.emit_warn(session_diagnostics::IcePathError {
path: path.clone(), path: path.clone(),
error: err.to_string(), error: err.to_string(),
env_var: std::env::var_os("RUSTC_ICE") env_var: std::env::var_os("RUSTC_ICE")

View file

@ -1086,7 +1086,7 @@ impl DiagCtxt {
} }
#[track_caller] #[track_caller]
pub fn create_warning<'a>( pub fn create_warn<'a>(
&'a self, &'a self,
warning: impl IntoDiagnostic<'a, ()>, warning: impl IntoDiagnostic<'a, ()>,
) -> DiagnosticBuilder<'a, ()> { ) -> DiagnosticBuilder<'a, ()> {
@ -1094,8 +1094,8 @@ impl DiagCtxt {
} }
#[track_caller] #[track_caller]
pub fn emit_warning<'a>(&'a self, warning: impl IntoDiagnostic<'a, ()>) { pub fn emit_warn<'a>(&'a self, warning: impl IntoDiagnostic<'a, ()>) {
self.create_warning(warning).emit() self.create_warn(warning).emit()
} }
#[track_caller] #[track_caller]

View file

@ -273,7 +273,7 @@ pub(crate) fn prepare_session_directory(
debug!("successfully copied data from: {}", source_directory.display()); debug!("successfully copied data from: {}", source_directory.display());
if !allows_links { if !allows_links {
sess.dcx().emit_warning(errors::HardLinkFailed { path: &session_dir }); sess.dcx().emit_warn(errors::HardLinkFailed { path: &session_dir });
} }
sess.init_incr_comp_session(session_dir, directory_lock); sess.init_incr_comp_session(session_dir, directory_lock);
@ -288,7 +288,7 @@ pub(crate) fn prepare_session_directory(
// Try to remove the session directory we just allocated. We don't // Try to remove the session directory we just allocated. We don't
// know if there's any garbage in it from the failed copy action. // know if there's any garbage in it from the failed copy action.
if let Err(err) = safe_remove_dir_all(&session_dir) { if let Err(err) = safe_remove_dir_all(&session_dir) {
sess.dcx().emit_warning(errors::DeletePartial { path: &session_dir, err }); sess.dcx().emit_warn(errors::DeletePartial { path: &session_dir, err });
} }
delete_session_dir_lock_file(sess, &lock_file_path); delete_session_dir_lock_file(sess, &lock_file_path);
@ -322,7 +322,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Option<Svh>) {
); );
if let Err(err) = safe_remove_dir_all(&*incr_comp_session_dir) { if let Err(err) = safe_remove_dir_all(&*incr_comp_session_dir) {
sess.dcx().emit_warning(errors::DeleteFull { path: &incr_comp_session_dir, err }); sess.dcx().emit_warn(errors::DeleteFull { path: &incr_comp_session_dir, err });
} }
let lock_file_path = lock_file_path(&*incr_comp_session_dir); let lock_file_path = lock_file_path(&*incr_comp_session_dir);
@ -365,7 +365,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Option<Svh>) {
} }
Err(e) => { Err(e) => {
// Warn about the error. However, no need to abort compilation now. // Warn about the error. However, no need to abort compilation now.
sess.dcx().emit_warning(errors::Finalize { path: &incr_comp_session_dir, err: e }); sess.dcx().emit_warn(errors::Finalize { path: &incr_comp_session_dir, err: e });
debug!("finalize_session_directory() - error, marking as invalid"); debug!("finalize_session_directory() - error, marking as invalid");
// Drop the file lock, so we can garage collect // Drop the file lock, so we can garage collect
@ -500,7 +500,7 @@ fn lock_directory(
fn delete_session_dir_lock_file(sess: &Session, lock_file_path: &Path) { fn delete_session_dir_lock_file(sess: &Session, lock_file_path: &Path) {
if let Err(err) = safe_remove_file(lock_file_path) { if let Err(err) = safe_remove_file(lock_file_path) {
sess.dcx().emit_warning(errors::DeleteLock { path: lock_file_path, err }); sess.dcx().emit_warn(errors::DeleteLock { path: lock_file_path, err });
} }
} }
@ -724,7 +724,7 @@ pub(crate) fn garbage_collect_session_directories(sess: &Session) -> io::Result<
if !lock_file_to_session_dir.items().any(|(_, dir)| *dir == directory_name) { if !lock_file_to_session_dir.items().any(|(_, dir)| *dir == directory_name) {
let path = crate_directory.join(directory_name); let path = crate_directory.join(directory_name);
if let Err(err) = safe_remove_dir_all(&path) { if let Err(err) = safe_remove_dir_all(&path) {
sess.dcx().emit_warning(errors::InvalidGcFailed { path: &path, err }); sess.dcx().emit_warn(errors::InvalidGcFailed { path: &path, err });
} }
} }
} }
@ -830,7 +830,7 @@ pub(crate) fn garbage_collect_session_directories(sess: &Session) -> io::Result<
debug!("garbage_collect_session_directories() - deleting `{}`", path.display()); debug!("garbage_collect_session_directories() - deleting `{}`", path.display());
if let Err(err) = safe_remove_dir_all(&path) { if let Err(err) = safe_remove_dir_all(&path) {
sess.dcx().emit_warning(errors::FinalizedGcFailed { path: &path, err }); sess.dcx().emit_warn(errors::FinalizedGcFailed { path: &path, err });
} else { } else {
delete_session_dir_lock_file(sess, &lock_file_path(&path)); delete_session_dir_lock_file(sess, &lock_file_path(&path));
} }
@ -848,7 +848,7 @@ fn delete_old(sess: &Session, path: &Path) {
debug!("garbage_collect_session_directories() - deleting `{}`", path.display()); debug!("garbage_collect_session_directories() - deleting `{}`", path.display());
if let Err(err) = safe_remove_dir_all(path) { if let Err(err) = safe_remove_dir_all(path) {
sess.dcx().emit_warning(errors::SessionGcFailed { path: path, err }); sess.dcx().emit_warn(errors::SessionGcFailed { path: path, err });
} else { } else {
delete_session_dir_lock_file(sess, &lock_file_path(path)); delete_session_dir_lock_file(sess, &lock_file_path(path));
} }

View file

@ -51,7 +51,7 @@ impl<T: Default> LoadResult<T> {
match self { match self {
LoadResult::LoadDepGraph(path, err) => { LoadResult::LoadDepGraph(path, err) => {
sess.dcx().emit_warning(errors::LoadDepGraph { path, err }); sess.dcx().emit_warn(errors::LoadDepGraph { path, err });
Default::default() Default::default()
} }
LoadResult::DataOutOfDate => { LoadResult::DataOutOfDate => {

View file

@ -30,7 +30,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
let _ = saved_files.insert(ext.to_string(), file_name); let _ = saved_files.insert(ext.to_string(), file_name);
} }
Err(err) => { Err(err) => {
sess.dcx().emit_warning(errors::CopyWorkProductToCache { sess.dcx().emit_warn(errors::CopyWorkProductToCache {
from: path, from: path,
to: &path_in_incr_dir, to: &path_in_incr_dir,
err, err,
@ -50,7 +50,7 @@ pub(crate) fn delete_workproduct_files(sess: &Session, work_product: &WorkProduc
for (_, path) in work_product.saved_files.items().into_sorted_stable_ord() { for (_, path) in work_product.saved_files.items().into_sorted_stable_ord() {
let path = in_incr_comp_dir_sess(sess, path); let path = in_incr_comp_dir_sess(sess, path);
if let Err(err) = std_fs::remove_file(&path) { if let Err(err) = std_fs::remove_file(&path) {
sess.dcx().emit_warning(errors::DeleteWorkProduct { path: &path, err }); sess.dcx().emit_warn(errors::DeleteWorkProduct { path: &path, err });
} }
} }
} }

View file

@ -254,7 +254,7 @@ fn configure_and_expand(
} }
if is_proc_macro_crate && sess.panic_strategy() == PanicStrategy::Abort { if is_proc_macro_crate && sess.panic_strategy() == PanicStrategy::Abort {
sess.dcx().emit_warning(errors::ProcMacroCratePanicAbort); sess.dcx().emit_warn(errors::ProcMacroCratePanicAbort);
} }
sess.time("maybe_create_a_macro_crate", || { sess.time("maybe_create_a_macro_crate", || {

View file

@ -213,9 +213,8 @@ impl<'tcx> Queries<'tcx> {
// Some other attribute. // Some other attribute.
Some(_) => { Some(_) => {
tcx.dcx().emit_warning(RustcErrorUnexpectedAnnotation { tcx.dcx()
span: tcx.def_span(def_id), .emit_warn(RustcErrorUnexpectedAnnotation { span: tcx.def_span(def_id) });
});
} }
} }
} }

View file

@ -431,7 +431,7 @@ pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec<C
base.retain(|crate_type| { base.retain(|crate_type| {
if output::invalid_output_for_target(session, *crate_type) { if output::invalid_output_for_target(session, *crate_type) {
session.dcx().emit_warning(errors::UnsupportedCrateTypeForTarget { session.dcx().emit_warn(errors::UnsupportedCrateTypeForTarget {
crate_type: *crate_type, crate_type: *crate_type,
target_triple: &session.opts.target_triple, target_triple: &session.opts.target_triple,
}); });
@ -507,16 +507,16 @@ pub fn build_output_filenames(attrs: &[ast::Attribute], sess: &Session) -> Outpu
let unnamed_output_types = let unnamed_output_types =
sess.opts.output_types.values().filter(|a| a.is_none()).count(); sess.opts.output_types.values().filter(|a| a.is_none()).count();
let ofile = if unnamed_output_types > 1 { let ofile = if unnamed_output_types > 1 {
sess.dcx().emit_warning(errors::MultipleOutputTypesAdaption); sess.dcx().emit_warn(errors::MultipleOutputTypesAdaption);
None None
} else { } else {
if !sess.opts.cg.extra_filename.is_empty() { if !sess.opts.cg.extra_filename.is_empty() {
sess.dcx().emit_warning(errors::IgnoringExtraFilename); sess.dcx().emit_warn(errors::IgnoringExtraFilename);
} }
Some(out_file.clone()) Some(out_file.clone())
}; };
if sess.io.output_dir != None { if sess.io.output_dir != None {
sess.dcx().emit_warning(errors::IgnoringOutDir); sess.dcx().emit_warn(errors::IgnoringOutDir);
} }
let out_filestem = let out_filestem =

View file

@ -1093,7 +1093,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
MonoItemCollectionMode::Eager MonoItemCollectionMode::Eager
} else { } else {
if mode != "lazy" { if mode != "lazy" {
tcx.dcx().emit_warning(UnknownCguCollectionMode { mode }); tcx.dcx().emit_warn(UnknownCguCollectionMode { mode });
} }
MonoItemCollectionMode::Lazy MonoItemCollectionMode::Lazy

View file

@ -264,14 +264,14 @@ pub(crate) fn emit_unescape_error(
} }
EscapeError::UnskippedWhitespaceWarning => { EscapeError::UnskippedWhitespaceWarning => {
let (c, char_span) = last_char(); let (c, char_span) = last_char();
dcx.emit_warning(UnescapeError::UnskippedWhitespace { dcx.emit_warn(UnescapeError::UnskippedWhitespace {
span: err_span, span: err_span,
ch: escaped_char(c), ch: escaped_char(c),
char_span, char_span,
}); });
} }
EscapeError::MultipleSkippedLinesWarning => { EscapeError::MultipleSkippedLinesWarning => {
dcx.emit_warning(UnescapeError::MultipleSkippedLinesWarning(err_span)); dcx.emit_warn(UnescapeError::MultipleSkippedLinesWarning(err_span));
} }
} }
} }

View file

@ -2150,7 +2150,7 @@ impl<'a> Parser<'a> {
if [sym::i32, sym::u32, sym::isize, sym::usize].contains(&suffix) { if [sym::i32, sym::u32, sym::isize, sym::usize].contains(&suffix) {
// #59553: warn instead of reject out of hand to allow the fix to percolate // #59553: warn instead of reject out of hand to allow the fix to percolate
// through the ecosystem when people fix their macros // through the ecosystem when people fix their macros
self.dcx().emit_warning(errors::InvalidLiteralSuffixOnTupleIndex { self.dcx().emit_warn(errors::InvalidLiteralSuffixOnTupleIndex {
span, span,
suffix, suffix,
exception: Some(()), exception: Some(()),

View file

@ -122,7 +122,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
// corresponding feature gate. This encourages nightly users to use feature gates when // corresponding feature gate. This encourages nightly users to use feature gates when
// possible. // possible.
None if tcx.sess.opts.unstable_opts.unleash_the_miri_inside_of_you => { None if tcx.sess.opts.unstable_opts.unleash_the_miri_inside_of_you => {
tcx.dcx().emit_warning(SkippingConstChecks { span }); tcx.dcx().emit_warn(SkippingConstChecks { span });
return; return;
} }

View file

@ -263,7 +263,7 @@ impl Session {
if !unleashed_features.is_empty() { if !unleashed_features.is_empty() {
let mut must_err = false; let mut must_err = false;
// Create a diagnostic pointing at where things got unleashed. // Create a diagnostic pointing at where things got unleashed.
self.dcx().emit_warning(errors::SkippingConstChecks { self.dcx().emit_warn(errors::SkippingConstChecks {
unleashed_features: unleashed_features unleashed_features: unleashed_features
.iter() .iter()
.map(|(span, gate)| { .map(|(span, gate)| {
@ -574,7 +574,7 @@ impl Session {
// We only call `msg` in case we can actually emit warnings. // We only call `msg` in case we can actually emit warnings.
// Otherwise, this could cause a `good_path_delayed_bug` to // Otherwise, this could cause a `good_path_delayed_bug` to
// trigger (issue #79546). // trigger (issue #79546).
self.dcx().emit_warning(errors::OptimisationFuelExhausted { msg: msg() }); self.dcx().emit_warn(errors::OptimisationFuelExhausted { msg: msg() });
} }
fuel.out_of_fuel = true; fuel.out_of_fuel = true;
} else if fuel.remaining > 0 { } else if fuel.remaining > 0 {
@ -1129,7 +1129,7 @@ pub fn build_session(
match profiler { match profiler {
Ok(profiler) => Some(Arc::new(profiler)), Ok(profiler) => Some(Arc::new(profiler)),
Err(e) => { Err(e) => {
dcx.emit_warning(errors::FailedToCreateProfiler { err: e.to_string() }); dcx.emit_warn(errors::FailedToCreateProfiler { err: e.to_string() });
None None
} }
} }
@ -1341,7 +1341,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
if sess.opts.unstable_opts.stack_protector != StackProtector::None { if sess.opts.unstable_opts.stack_protector != StackProtector::None {
if !sess.target.options.supports_stack_protector { if !sess.target.options.supports_stack_protector {
sess.dcx().emit_warning(errors::StackProtectorNotSupportedForTarget { sess.dcx().emit_warn(errors::StackProtectorNotSupportedForTarget {
stack_protector: sess.opts.unstable_opts.stack_protector, stack_protector: sess.opts.unstable_opts.stack_protector,
target_triple: &sess.opts.target_triple, target_triple: &sess.opts.target_triple,
}); });