diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 07:52:43 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-18 16:06:21 +1100 |
| commit | d1d0896c401e3d07e14ed7a339a766bd0da71bd2 (patch) | |
| tree | 5433f7f9463fe88a7793077704bc3ae5856aa8cf | |
| parent | 73bac456d413378b25210731c64eccc52c2201f7 (diff) | |
| download | rust-d1d0896c401e3d07e14ed7a339a766bd0da71bd2.tar.gz rust-d1d0896c401e3d07e14ed7a339a766bd0da71bd2.zip | |
Rename `ParseSess::with_span_handler` as `ParseSess::with_dcx`.
| -rw-r--r-- | compiler/rustc_expand/src/tests.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/doctest.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/passes/lint/check_code_block_syntax.rs | 2 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/doc/needless_doctest_main.rs | 4 | ||||
| -rw-r--r-- | src/tools/rustfmt/src/parse/session.rs | 2 |
7 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_expand/src/tests.rs b/compiler/rustc_expand/src/tests.rs index 9c8a9233f56..8ceea575b63 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 42db9d116bf..b282d7de4ea 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<SourceMap>) -> Self { + pub fn with_dcx(handler: DiagCtxt, source_map: Lrc<SourceMap>) -> 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 fe66b483451..e52e75e8c07 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 c4000f099e5..58f71471855 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 a149ad8eef3..7274885284b 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 ccd6f22146b..b2ac39a8e9f 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 102ec231776..82e54b46f15 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, |
