diff --git a/compiler/rustc_expand/src/tests.rs b/compiler/rustc_expand/src/tests.rs index 9c8a9233f567..8ceea575b634 100644 --- a/compiler/rustc_expand/src/tests.rs +++ b/compiler/rustc_expand/src/tests.rs @@ -57,7 +57,7 @@ where F: for<'a> FnOnce(&mut Parser<'a>) -> PResult<'a, T>, { let (handler, source_map, output) = create_test_handler(); - let ps = ParseSess::with_span_handler(handler, source_map); + let ps = ParseSess::with_dcx(handler, source_map); let mut p = string_to_parser(&ps, source_str.to_string()); let result = f(&mut p); assert!(result.is_ok()); diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 42db9d116bfd..b282d7de4ea0 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -227,10 +227,10 @@ impl ParseSess { let fallback_bundle = fallback_fluent_bundle(locale_resources, false); let sm = Lrc::new(SourceMap::new(file_path_mapping)); let handler = DiagCtxt::with_tty_emitter(Some(sm.clone()), fallback_bundle); - ParseSess::with_span_handler(handler, sm) + ParseSess::with_dcx(handler, sm) } - pub fn with_span_handler(handler: DiagCtxt, source_map: Lrc) -> Self { + pub fn with_dcx(handler: DiagCtxt, source_map: Lrc) -> Self { Self { dcx: handler, unstable_features: UnstableFeatures::from_environment(None), @@ -258,7 +258,7 @@ impl ParseSess { let fatal_handler = DiagCtxt::with_tty_emitter(None, fallback_bundle).disable_warnings(); let handler = DiagCtxt::with_emitter(Box::new(SilentEmitter { fatal_handler, fatal_note })) .disable_warnings(); - ParseSess::with_span_handler(handler, sm) + ParseSess::with_dcx(handler, sm) } #[inline] diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index fe66b483451d..e52e75e8c074 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1448,7 +1448,7 @@ pub fn build_session( None }; - let mut parse_sess = ParseSess::with_span_handler(span_diagnostic, source_map); + let mut parse_sess = ParseSess::with_dcx(span_diagnostic, source_map); parse_sess.assume_incomplete_release = sopts.unstable_opts.assume_incomplete_release; let host_triple = config::host_triple(); diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index c4000f099e50..58f71471855c 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -580,7 +580,7 @@ pub(crate) fn make_test( // FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser let handler = DiagCtxt::with_emitter(Box::new(emitter)).disable_warnings(); - let sess = ParseSess::with_span_handler(handler, sm); + let sess = ParseSess::with_dcx(handler, sm); let mut found_main = false; let mut found_extern_crate = crate_name.is_none(); @@ -755,7 +755,7 @@ fn check_if_attr_is_complete(source: &str, edition: Edition) -> bool { let emitter = EmitterWriter::new(Box::new(io::sink()), fallback_bundle); let handler = DiagCtxt::with_emitter(Box::new(emitter)).disable_warnings(); - let sess = ParseSess::with_span_handler(handler, sm); + let sess = ParseSess::with_dcx(handler, sm); let mut parser = match maybe_new_parser_from_source_str(&sess, filename, source.to_owned()) { Ok(p) => p, diff --git a/src/librustdoc/passes/lint/check_code_block_syntax.rs b/src/librustdoc/passes/lint/check_code_block_syntax.rs index a149ad8eef34..7274885284b2 100644 --- a/src/librustdoc/passes/lint/check_code_block_syntax.rs +++ b/src/librustdoc/passes/lint/check_code_block_syntax.rs @@ -44,7 +44,7 @@ fn check_rust_syntax( let sm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let handler = DiagCtxt::with_emitter(Box::new(emitter)).disable_warnings(); let source = dox[code_block.code].to_owned(); - let sess = ParseSess::with_span_handler(handler, sm); + let sess = ParseSess::with_dcx(handler, sm); let edition = code_block.lang_string.edition.unwrap_or_else(|| cx.tcx.sess.edition()); let expn_data = diff --git a/src/tools/clippy/clippy_lints/src/doc/needless_doctest_main.rs b/src/tools/clippy/clippy_lints/src/doc/needless_doctest_main.rs index ccd6f22146b9..b2ac39a8e9fa 100644 --- a/src/tools/clippy/clippy_lints/src/doc/needless_doctest_main.rs +++ b/src/tools/clippy/clippy_lints/src/doc/needless_doctest_main.rs @@ -46,9 +46,9 @@ pub fn check( rustc_errors::fallback_fluent_bundle(rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), false); let emitter = EmitterWriter::new(Box::new(io::sink()), fallback_bundle); let handler = DiagCtxt::with_emitter(Box::new(emitter)).disable_warnings(); - #[expect(clippy::arc_with_non_send_sync)] // `Lrc` is expected by with_span_handler + #[expect(clippy::arc_with_non_send_sync)] // `Lrc` is expected by with_dcx let sm = Lrc::new(SourceMap::new(FilePathMapping::empty())); - let sess = ParseSess::with_span_handler(handler, sm); + let sess = ParseSess::with_dcx(handler, sm); let mut parser = match maybe_new_parser_from_source_str(&sess, filename, code) { Ok(p) => p, diff --git a/src/tools/rustfmt/src/parse/session.rs b/src/tools/rustfmt/src/parse/session.rs index 102ec2317768..82e54b46f155 100644 --- a/src/tools/rustfmt/src/parse/session.rs +++ b/src/tools/rustfmt/src/parse/session.rs @@ -166,7 +166,7 @@ impl ParseSess { config.hide_parse_errors(), config.color(), ); - let parse_sess = RawParseSess::with_span_handler(handler, source_map); + let parse_sess = RawParseSess::with_dcx(handler, source_map); Ok(ParseSess { parse_sess,