mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Rename ParseSess::with_span_handler
as ParseSess::with_dcx
.
This commit is contained in:
parent
73bac456d4
commit
d1d0896c40
@ -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());
|
||||
|
@ -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]
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
|
@ -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 =
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user