From c28dc5a74d4c88e25c65c0bdec014efe02d42340 Mon Sep 17 00:00:00 2001 From: "Celina G. Val" Date: Wed, 20 Dec 2023 07:07:18 -0800 Subject: [PATCH] Update the rust toolchain to 2023-12-20 (#2961) Fixes needed due to renaming of a few items: - https://github.com/rust-lang/rust/pull/119063 --- kani-compiler/src/session.rs | 4 ++-- rust-toolchain.toml | 2 +- tools/bookrunner/librustdoc/doctest.rs | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kani-compiler/src/session.rs b/kani-compiler/src/session.rs index 87d25f1e8fc3..a1c3af20bb06 100644 --- a/kani-compiler/src/session.rs +++ b/kani-compiler/src/session.rs @@ -9,7 +9,7 @@ use rustc_errors::{ ColorConfig, Diagnostic, TerminalUrl, }; use rustc_session::config::ErrorOutputType; -use rustc_session::EarlyErrorHandler; +use rustc_session::EarlyDiagCtxt; use std::io::IsTerminal; use std::panic; use std::sync::LazyLock; @@ -71,7 +71,7 @@ pub fn init_session(args: &Arguments, json_hook: bool) { // Initialize the rustc logger using value from RUSTC_LOG. We keep the log control separate // because we cannot control the RUSTC log format unless if we match the exact tracing // version used by RUSTC. - let handler = EarlyErrorHandler::new(ErrorOutputType::default()); + let handler = EarlyDiagCtxt::new(ErrorOutputType::default()); rustc_driver::init_rustc_env_logger(&handler); // Install Kani panic hook. diff --git a/rust-toolchain.toml b/rust-toolchain.toml index af9f0d238cc5..fe2513be9b06 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,5 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 OR MIT [toolchain] -channel = "nightly-2023-12-18" +channel = "nightly-2023-12-20" components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"] diff --git a/tools/bookrunner/librustdoc/doctest.rs b/tools/bookrunner/librustdoc/doctest.rs index 734dacd093a6..01fc395046f2 100644 --- a/tools/bookrunner/librustdoc/doctest.rs +++ b/tools/bookrunner/librustdoc/doctest.rs @@ -66,7 +66,7 @@ pub fn make_test( let result = rustc_driver::catch_fatal_errors(|| { rustc_span::create_session_if_not_set_then(edition, |_| { use rustc_errors::emitter::{Emitter, EmitterWriter}; - use rustc_errors::Handler; + use rustc_errors::DiagCtxt; use rustc_parse::maybe_new_parser_from_source_str; use rustc_parse::parser::ForceCollect; use rustc_session::parse::ParseSess; @@ -88,8 +88,8 @@ pub fn make_test( let emitter = EmitterWriter::new(Box::new(io::sink()), fallback_bundle); // FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser - let handler = Handler::with_emitter(Box::new(emitter)); - let sess = ParseSess::with_span_handler(handler, sm); + let handler = DiagCtxt::with_emitter(Box::new(emitter)); + let sess = ParseSess::with_dcx(handler, sm); let mut found_main = false; let mut found_extern_crate = crate_name.is_none(); @@ -152,7 +152,7 @@ pub fn make_test( // handler. Any errors in the tests will be reported when the test file is compiled, // Note that we still need to cancel the errors above otherwise `DiagnosticBuilder` // will panic on drop. - sess.span_diagnostic.reset_err_count(); + sess.dcx.reset_err_count(); (found_main, found_extern_crate, found_macro) })