Skip to content

Commit 3c4f1d8

Browse files
committed
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.
1 parent ff40ad4 commit 3c4f1d8

File tree

23 files changed

+55
-56
lines changed

23 files changed

+55
-56
lines changed

compiler/rustc_ast_passes/src/show_span.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ struct ShowSpanVisitor<'a> {
3838
impl<'a> Visitor<'a> for ShowSpanVisitor<'a> {
3939
fn visit_expr(&mut self, e: &'a ast::Expr) {
4040
if let Mode::Expression = self.mode {
41-
self.dcx.emit_warning(errors::ShowSpan { span: e.span, msg: "expression" });
41+
self.dcx.emit_warn(errors::ShowSpan { span: e.span, msg: "expression" });
4242
}
4343
visit::walk_expr(self, e);
4444
}
4545

4646
fn visit_pat(&mut self, p: &'a ast::Pat) {
4747
if let Mode::Pattern = self.mode {
48-
self.dcx.emit_warning(errors::ShowSpan { span: p.span, msg: "pattern" });
48+
self.dcx.emit_warn(errors::ShowSpan { span: p.span, msg: "pattern" });
4949
}
5050
visit::walk_pat(self, p);
5151
}
5252

5353
fn visit_ty(&mut self, t: &'a ast::Ty) {
5454
if let Mode::Type = self.mode {
55-
self.dcx.emit_warning(errors::ShowSpan { span: t.span, msg: "type" });
55+
self.dcx.emit_warn(errors::ShowSpan { span: t.span, msg: "type" });
5656
}
5757
visit::walk_ty(self, t);
5858
}

compiler/rustc_attr/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ pub fn eval_condition(
621621
}
622622
};
623623
let Some(min_version) = parse_version(*min_version) else {
624-
dcx.emit_warning(session_diagnostics::UnknownVersionLiteral { span: *span });
624+
dcx.emit_warn(session_diagnostics::UnknownVersionLiteral { span: *span });
625625
return false;
626626
};
627627

compiler/rustc_codegen_gcc/src/gcc_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
5252
Some(c @ ('+' | '-')) => c,
5353
Some(_) => {
5454
if diagnostics {
55-
sess.dcx().emit_warning(UnknownCTargetFeaturePrefix { feature: s });
55+
sess.dcx().emit_warn(UnknownCTargetFeaturePrefix { feature: s });
5656
}
5757
return None;
5858
}
@@ -79,7 +79,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
7979
else {
8080
UnknownCTargetFeature { feature, rust_feature: PossibleFeature::None }
8181
};
82-
sess.dcx().emit_warning(unknown_feature);
82+
sess.dcx().emit_warn(unknown_feature);
8383
}
8484

8585
if diagnostics {

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl CodegenBackend for GccCodegenBackend {
191191
#[cfg(feature="master")]
192192
gccjit::set_global_personality_function_name(b"rust_eh_personality\0");
193193
if sess.lto() == Lto::Thin {
194-
sess.dcx().emit_warning(LTONotSupported {});
194+
sess.dcx().emit_warn(LTONotSupported {});
195195
}
196196

197197
#[cfg(not(feature="master"))]

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ pub fn target_machine_factory(
245245
match sess.opts.debuginfo_compression {
246246
rustc_session::config::DebugInfoCompression::Zlib => {
247247
if !unsafe { LLVMRustLLVMHasZlibCompressionForDebugSymbols() } {
248-
sess.dcx().emit_warning(UnknownCompression { algorithm: "zlib" });
248+
sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
249249
}
250250
}
251251
rustc_session::config::DebugInfoCompression::Zstd => {
252252
if !unsafe { LLVMRustLLVMHasZstdCompressionForDebugSymbols() } {
253-
sess.dcx().emit_warning(UnknownCompression { algorithm: "zstd" });
253+
sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
254254
}
255255
}
256256
rustc_session::config::DebugInfoCompression::None => {}
@@ -457,7 +457,7 @@ unsafe extern "C" fn diagnostic_handler(info: &DiagnosticInfo, user: *mut c_void
457457
llvm::LLVMRustWriteDiagnosticInfoToString(diagnostic_ref, s)
458458
})
459459
.expect("non-UTF8 diagnostic");
460-
dcx.emit_warning(FromLlvmDiag { message });
460+
dcx.emit_warn(FromLlvmDiag { message });
461461
}
462462
llvm::diagnostic::Unsupported(diagnostic_ref) => {
463463
let message = llvm::build_string(|s| {

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
529529
Some(c @ ('+' | '-')) => c,
530530
Some(_) => {
531531
if diagnostics {
532-
sess.dcx().emit_warning(UnknownCTargetFeaturePrefix { feature: s });
532+
sess.dcx().emit_warn(UnknownCTargetFeaturePrefix { feature: s });
533533
}
534534
return None;
535535
}
@@ -557,12 +557,12 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
557557
} else {
558558
UnknownCTargetFeature { feature, rust_feature: PossibleFeature::None }
559559
};
560-
sess.dcx().emit_warning(unknown_feature);
560+
sess.dcx().emit_warn(unknown_feature);
561561
} else if feature_state
562562
.is_some_and(|(_name, feature_gate)| !feature_gate.is_stable())
563563
{
564564
// An unstable feature. Warn about using it.
565-
sess.dcx().emit_warning(UnstableCTargetFeature { feature });
565+
sess.dcx().emit_warn(UnstableCTargetFeature { feature });
566566
}
567567
}
568568

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ fn link_natively<'a>(
10161016
if !prog.status.success() {
10171017
let mut output = prog.stderr.clone();
10181018
output.extend_from_slice(&prog.stdout);
1019-
sess.dcx().emit_warning(errors::ProcessingDymutilFailed {
1019+
sess.dcx().emit_warn(errors::ProcessingDymutilFailed {
10201020
status: prog.status,
10211021
output: escape_string(&output),
10221022
});
@@ -1091,7 +1091,7 @@ fn strip_symbols_with_external_utility<'a>(
10911091
if !prog.status.success() {
10921092
let mut output = prog.stderr.clone();
10931093
output.extend_from_slice(&prog.stdout);
1094-
sess.dcx().emit_warning(errors::StrippingDebugInfoFailed {
1094+
sess.dcx().emit_warn(errors::StrippingDebugInfoFailed {
10951095
util,
10961096
status: prog.status,
10971097
output: escape_string(&output),
@@ -2406,7 +2406,7 @@ fn collect_natvis_visualizers(
24062406
visualizer_paths.push(visualizer_out_file);
24072407
}
24082408
Err(error) => {
2409-
sess.dcx().emit_warning(errors::UnableToWriteDebuggerVisualizer {
2409+
sess.dcx().emit_warn(errors::UnableToWriteDebuggerVisualizer {
24102410
path: visualizer_out_file,
24112411
error,
24122412
});

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,11 @@ impl<'a> Linker for GccLinker<'a> {
446446
// FIXME(81490): ld64 doesn't support these flags but macOS 11
447447
// has -needed-l{} / -needed_library {}
448448
// but we have no way to detect that here.
449-
self.sess.dcx().emit_warning(errors::Ld64UnimplementedModifier);
449+
self.sess.dcx().emit_warn(errors::Ld64UnimplementedModifier);
450450
} else if self.is_gnu && !self.sess.target.is_like_windows {
451451
self.linker_arg("--no-as-needed");
452452
} else {
453-
self.sess.dcx().emit_warning(errors::LinkerUnsupportedModifier);
453+
self.sess.dcx().emit_warn(errors::LinkerUnsupportedModifier);
454454
}
455455
}
456456
self.hint_dynamic();
@@ -504,7 +504,7 @@ impl<'a> Linker for GccLinker<'a> {
504504
// FIXME(81490): ld64 as of macOS 11 supports the -needed_framework
505505
// flag but we have no way to detect that here.
506506
// self.cmd.arg("-needed_framework").arg(framework);
507-
self.sess.dcx().emit_warning(errors::Ld64UnimplementedModifier);
507+
self.sess.dcx().emit_warn(errors::Ld64UnimplementedModifier);
508508
}
509509
self.cmd.arg("-framework").arg(framework);
510510
}
@@ -950,7 +950,7 @@ impl<'a> Linker for MsvcLinker<'a> {
950950
}
951951
}
952952
Err(error) => {
953-
self.sess.dcx().emit_warning(errors::NoNatvisDirectory { error });
953+
self.sess.dcx().emit_warn(errors::NoNatvisDirectory { error });
954954
}
955955
}
956956
}
@@ -1501,7 +1501,7 @@ impl<'a> Linker for L4Bender<'a> {
15011501

15021502
fn export_symbols(&mut self, _: &Path, _: CrateType, _: &[String]) {
15031503
// ToDo, not implemented, copy from GCC
1504-
self.sess.dcx().emit_warning(errors::L4BenderExportingSymbolsUnimplemented);
1504+
self.sess.dcx().emit_warn(errors::L4BenderExportingSymbolsUnimplemented);
15051505
return;
15061506
}
15071507

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,11 @@ fn produce_final_output_artifacts(
573573
if crate_output.outputs.contains_key(&output_type) {
574574
// 2) Multiple codegen units, with `--emit foo=some_name`. We have
575575
// no good solution for this case, so warn the user.
576-
sess.dcx().emit_warning(errors::IgnoringEmitPath { extension });
576+
sess.dcx().emit_warn(errors::IgnoringEmitPath { extension });
577577
} else if crate_output.single_output_file.is_some() {
578578
// 3) Multiple codegen units, with `-o some_name`. We have
579579
// no good solution for this case, so warn the user.
580-
sess.dcx().emit_warning(errors::IgnoringOutput { extension });
580+
sess.dcx().emit_warn(errors::IgnoringOutput { extension });
581581
} else {
582582
// 4) Multiple codegen units, but no explicit name. We
583583
// just leave the `foo.0.x` files in place.

compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
630630
// current number of evaluated terminators is a power of 2. The latter gives us a cheap
631631
// way to implement exponential backoff.
632632
let span = ecx.cur_span();
633-
ecx.tcx.dcx().emit_warning(LongRunningWarn { span, item_span: ecx.tcx.span });
633+
ecx.tcx.dcx().emit_warn(LongRunningWarn { span, item_span: ecx.tcx.span });
634634
}
635635
}
636636

0 commit comments

Comments
 (0)