about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/clean/mod.rs4
-rw-r--r--src/librustdoc/config.rs34
-rw-r--r--src/librustdoc/core.rs8
-rw-r--r--src/librustdoc/externalfiles.rs2
-rw-r--r--src/librustdoc/html/render/context.rs3
-rw-r--r--src/librustdoc/lib.rs5
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs2
-rw-r--r--src/librustdoc/theme.rs2
-rw-r--r--src/tools/clippy/clippy_config/src/msrvs.rs2
-rw-r--r--src/tools/clippy/clippy_utils/src/attrs.rs2
-rw-r--r--src/tools/miri/src/diagnostics.rs6
11 files changed, 32 insertions, 38 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 4441060de98..9c0a8634990 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2995,13 +2995,13 @@ fn clean_use_statement_inner<'tcx>(
         visibility.is_accessible_from(parent_mod, cx.tcx) && !current_mod.is_top_level_module();
 
     if pub_underscore && let Some(ref inline) = inline_attr {
-        rustc_errors::struct_span_err!(
+        rustc_errors::struct_span_code_err!(
             cx.tcx.dcx(),
             inline.span(),
             E0780,
             "anonymous imports cannot be inlined"
         )
-        .span_label_mv(import.span, "anonymous import")
+        .with_span_label(import.span, "anonymous import")
         .emit();
     }
 
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 614a64d4020..3f7f9270b2d 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -421,7 +421,7 @@ impl Options {
             let paths = match theme::load_css_paths(content) {
                 Ok(p) => p,
                 Err(e) => {
-                    dcx.struct_err(e).emit();
+                    dcx.err(e);
                     return Err(1);
                 }
             };
@@ -452,10 +452,10 @@ impl Options {
         let input = PathBuf::from(if describe_lints {
             "" // dummy, this won't be used
         } else if matches.free.is_empty() {
-            dcx.struct_err("missing file operand").emit();
+            dcx.err("missing file operand");
             return Err(1);
         } else if matches.free.len() > 1 {
-            dcx.struct_err("too many file operands").emit();
+            dcx.err("too many file operands");
             return Err(1);
         } else {
             &matches.free[0]
@@ -467,7 +467,7 @@ impl Options {
         let extern_html_root_urls = match parse_extern_html_roots(matches) {
             Ok(ex) => ex,
             Err(err) => {
-                dcx.struct_err(err).emit();
+                dcx.err(err);
                 return Err(1);
             }
         };
@@ -534,7 +534,7 @@ impl Options {
         let output = matches.opt_str("output").map(|s| PathBuf::from(&s));
         let output = match (out_dir, output) {
             (Some(_), Some(_)) => {
-                dcx.struct_err("cannot use both 'out-dir' and 'output' at once").emit();
+                dcx.err("cannot use both 'out-dir' and 'output' at once");
                 return Err(1);
             }
             (Some(out_dir), None) => out_dir,
@@ -549,7 +549,7 @@ impl Options {
 
         if let Some(ref p) = extension_css {
             if !p.is_file() {
-                dcx.struct_err("option --extend-css argument must be a file").emit();
+                dcx.err("option --extend-css argument must be a file");
                 return Err(1);
             }
         }
@@ -567,7 +567,7 @@ impl Options {
             let paths = match theme::load_css_paths(content) {
                 Ok(p) => p,
                 Err(e) => {
-                    dcx.struct_err(e).emit();
+                    dcx.err(e);
                     return Err(1);
                 }
             };
@@ -577,26 +577,26 @@ impl Options {
             {
                 if !theme_file.is_file() {
                     dcx.struct_err(format!("invalid argument: \"{theme_s}\""))
-                        .help_mv("arguments to --theme must be files")
+                        .with_help("arguments to --theme must be files")
                         .emit();
                     return Err(1);
                 }
                 if theme_file.extension() != Some(OsStr::new("css")) {
                     dcx.struct_err(format!("invalid argument: \"{theme_s}\""))
-                        .help_mv("arguments to --theme must have a .css extension")
+                        .with_help("arguments to --theme must have a .css extension")
                         .emit();
                     return Err(1);
                 }
                 let (success, ret) = theme::test_theme_against(&theme_file, &paths, &dcx);
                 if !success {
-                    dcx.struct_err(format!("error loading theme file: \"{theme_s}\"")).emit();
+                    dcx.err(format!("error loading theme file: \"{theme_s}\""));
                     return Err(1);
                 } else if !ret.is_empty() {
                     dcx.struct_warn(format!(
                         "theme file \"{theme_s}\" is missing CSS rules from the default theme",
                     ))
-                    .warn_mv("the theme may appear incorrect when loaded")
-                    .help_mv(format!(
+                    .with_warn("the theme may appear incorrect when loaded")
+                    .with_help(format!(
                         "to see what rules are missing, call `rustdoc --check-theme \"{theme_s}\"`",
                     ))
                     .emit();
@@ -626,7 +626,7 @@ impl Options {
         match matches.opt_str("r").as_deref() {
             Some("rust") | None => {}
             Some(s) => {
-                dcx.struct_err(format!("unknown input format: {s}")).emit();
+                dcx.err(format!("unknown input format: {s}"));
                 return Err(1);
             }
         }
@@ -634,7 +634,7 @@ impl Options {
         let index_page = matches.opt_str("index-page").map(|s| PathBuf::from(&s));
         if let Some(ref index_page) = index_page {
             if !index_page.is_file() {
-                dcx.struct_err("option `--index-page` argument must be a file").emit();
+                dcx.err("option `--index-page` argument must be a file");
                 return Err(1);
             }
         }
@@ -646,7 +646,7 @@ impl Options {
         let crate_types = match parse_crate_types_from_list(matches.opt_strs("crate-type")) {
             Ok(types) => types,
             Err(e) => {
-                dcx.struct_err(format!("unknown crate type: {e}")).emit();
+                dcx.err(format!("unknown crate type: {e}"));
                 return Err(1);
             }
         };
@@ -664,7 +664,7 @@ impl Options {
                     out_fmt
                 }
                 Err(e) => {
-                    dcx.struct_err(e).emit();
+                    dcx.err(e);
                     return Err(1);
                 }
             },
@@ -809,7 +809,7 @@ fn check_deprecated_options(matches: &getopts::Matches, dcx: &rustc_errors::Diag
     for &flag in deprecated_flags.iter() {
         if matches.opt_present(flag) {
             dcx.struct_warn(format!("the `{flag}` flag is deprecated"))
-                .note_mv(
+                .with_note(
                     "see issue #44136 <https://github.com/rust-lang/rust/issues/44136> \
                     for more information",
                 )
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 40ea4346f93..fa72758c216 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -495,15 +495,15 @@ impl<'tcx> Visitor<'tcx> for EmitIgnoredResolutionErrors<'tcx> {
                     .intersperse("::")
                     .collect::<String>()
             );
-            rustc_errors::struct_span_err!(
+            rustc_errors::struct_span_code_err!(
                 self.tcx.dcx(),
                 path.span,
                 E0433,
                 "failed to resolve: {label}",
             )
-            .span_label_mv(path.span, label)
-            .note_mv("this error was originally ignored because you are running `rustdoc`")
-            .note_mv("try running again with `rustc` or `cargo check` and you may get a more detailed error")
+            .with_span_label(path.span, label)
+            .with_note("this error was originally ignored because you are running `rustdoc`")
+            .with_note("try running again with `rustc` or `cargo check` and you may get a more detailed error")
             .emit();
         }
         // We could have an outer resolution that succeeded,
diff --git a/src/librustdoc/externalfiles.rs b/src/librustdoc/externalfiles.rs
index 8bc0cdf3a95..57e82b877bf 100644
--- a/src/librustdoc/externalfiles.rs
+++ b/src/librustdoc/externalfiles.rs
@@ -96,7 +96,7 @@ pub(crate) fn load_string<P: AsRef<Path>>(
     match str::from_utf8(&contents) {
         Ok(s) => Ok(s.to_string()),
         Err(_) => {
-            dcx.struct_err(format!("error reading `{}`: not UTF-8", file_path.display())).emit();
+            dcx.err(format!("error reading `{}`: not UTF-8", file_path.display()));
             Err(LoadStringError::BadUtf8)
         }
     }
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index aad63f8578a..fc6f51e8272 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -757,8 +757,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
 
         // Flush pending errors.
         Rc::get_mut(&mut self.shared).unwrap().fs.close();
-        let nb_errors =
-            self.shared.errors.iter().map(|err| self.tcx().dcx().struct_err(err).emit()).count();
+        let nb_errors = self.shared.errors.iter().map(|err| self.tcx().dcx().err(err)).count();
         if nb_errors > 0 {
             Err(Error::new(io::Error::new(io::ErrorKind::Other, "I/O error"), ""))
         } else {
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index ad1838c53ad..d962beda4be 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -676,10 +676,7 @@ type MainResult = Result<(), ErrorGuaranteed>;
 fn wrap_return(dcx: &rustc_errors::DiagCtxt, res: Result<(), String>) -> MainResult {
     match res {
         Ok(()) => dcx.has_errors().map_or(Ok(()), Err),
-        Err(err) => {
-            let reported = dcx.struct_err(err).emit();
-            Err(reported)
-        }
+        Err(err) => Err(dcx.err(err)),
     }
 }
 
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 176494a3863..b843227d187 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -1228,7 +1228,7 @@ impl LinkCollector<'_, '_> {
             span,
             "linking to associated items of raw pointers is experimental",
         )
-        .note_mv("rustdoc does not allow disambiguating between `*const` and `*mut`, and pointers are unstable until it does")
+        .with_note("rustdoc does not allow disambiguating between `*const` and `*mut`, and pointers are unstable until it does")
         .emit();
     }
 
diff --git a/src/librustdoc/theme.rs b/src/librustdoc/theme.rs
index 98010b056c9..31d32e23f8e 100644
--- a/src/librustdoc/theme.rs
+++ b/src/librustdoc/theme.rs
@@ -244,7 +244,7 @@ pub(crate) fn test_theme_against<P: AsRef<Path>>(
     {
         Ok(c) => c,
         Err(e) => {
-            dcx.struct_err(e).emit();
+            dcx.err(e);
             return (false, vec![]);
         }
     };
diff --git a/src/tools/clippy/clippy_config/src/msrvs.rs b/src/tools/clippy/clippy_config/src/msrvs.rs
index 76f3663f04f..dae9f09ec00 100644
--- a/src/tools/clippy/clippy_config/src/msrvs.rs
+++ b/src/tools/clippy/clippy_config/src/msrvs.rs
@@ -109,7 +109,7 @@ impl Msrv {
             if let Some(duplicate) = msrv_attrs.last() {
                 sess.dcx()
                     .struct_span_err(duplicate.span, "`clippy::msrv` is defined multiple times")
-                    .span_note_mv(msrv_attr.span, "first definition found here")
+                    .with_span_note(msrv_attr.span, "first definition found here")
                     .emit();
             }
 
diff --git a/src/tools/clippy/clippy_utils/src/attrs.rs b/src/tools/clippy/clippy_utils/src/attrs.rs
index 19d38903ade..ad8619f0d3d 100644
--- a/src/tools/clippy/clippy_utils/src/attrs.rs
+++ b/src/tools/clippy/clippy_utils/src/attrs.rs
@@ -136,7 +136,7 @@ pub fn get_unique_attr<'a>(
         if let Some(duplicate) = unique_attr {
             sess.dcx()
                 .struct_span_err(attr.span, format!("`{name}` is defined multiple times"))
-                .span_note_mv(duplicate.span, "first definition found here")
+                .with_span_note(duplicate.span, "first definition found here")
                 .emit();
         } else {
             unique_attr = Some(attr);
diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs
index d3d4490f302..819d2018a15 100644
--- a/src/tools/miri/src/diagnostics.rs
+++ b/src/tools/miri/src/diagnostics.rs
@@ -499,14 +499,12 @@ pub fn report_msg<'tcx>(
         err.note(if extra_span { "BACKTRACE (of the first span):" } else { "BACKTRACE:" });
     }
 
-    let (mut err, handler) = err.into_diagnostic().unwrap();
-
     // Add backtrace
     for (idx, frame_info) in stacktrace.iter().enumerate() {
         let is_local = machine.is_local(frame_info);
         // No span for non-local frames and the first frame (which is the error site).
         if is_local && idx > 0 {
-            err.eager_subdiagnostic(handler, frame_info.as_note(machine.tcx));
+            err.eager_subdiagnostic(err.dcx, frame_info.as_note(machine.tcx));
         } else {
             let sm = sess.source_map();
             let span = sm.span_to_embeddable_string(frame_info.span);
@@ -514,7 +512,7 @@ pub fn report_msg<'tcx>(
         }
     }
 
-    handler.emit_diagnostic(err);
+    err.emit();
 }
 
 impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {