diff --git a/doc/book.toml b/doc/book.toml index c0c12474..18019e78 100644 --- a/doc/book.toml +++ b/doc/book.toml @@ -6,4 +6,4 @@ src = "src" title = "PL/Rust Guide" [preprocessor.variables.variables] -toolchain_ver = "1.70.0" +toolchain_ver = "1.71.1" diff --git a/doc/src/install-plrust-on-debian-ubuntu.md b/doc/src/install-plrust-on-debian-ubuntu.md index 363a16b1..f6a0c9ba 100644 --- a/doc/src/install-plrust-on-debian-ubuntu.md +++ b/doc/src/install-plrust-on-debian-ubuntu.md @@ -28,7 +28,7 @@ Where: Example: ``` -plrust-trusted-1.2.3_1.70.0-debian-pg15-amd64.deb +plrust-trusted-1.2.3_1.71.1-debian-pg15-amd64.deb ``` ## Preparing the environment diff --git a/plrust/build b/plrust/build index 0986902f..fabd4e1e 100755 --- a/plrust/build +++ b/plrust/build @@ -66,7 +66,7 @@ fi git pull git submodule update --init --recursive else - git clone https://github.com/tcdi/postgrestd.git --branch "rust-1.70.0" --recurse-submodules + git clone https://github.com/tcdi/postgrestd.git --branch "rust-1.71.1" --recurse-submodules cd ./postgrestd fi rm -f rust-toolchain.toml diff --git a/plrustc/build.sh b/plrustc/build.sh index dabc6aa8..de2adc8a 100755 --- a/plrustc/build.sh +++ b/plrustc/build.sh @@ -25,8 +25,8 @@ fi export RUSTC_BOOTSTRAP=1 version=$($RUSTC --version | cut -d ' ' -f 2) -if [ "$version" != "1.70.0" ]; then - echo "rustc ('$RUSTC') is not version 1.70.0" >&2 +if [ "$version" != "1.71.1" ]; then + echo "rustc ('$RUSTC') is not version 1.71.1" >&2 exit 1 fi diff --git a/plrustc/plrustc/src/main.rs b/plrustc/plrustc/src/main.rs index 8f6ab1a2..0ee799cf 100644 --- a/plrustc/plrustc/src/main.rs +++ b/plrustc/plrustc/src/main.rs @@ -11,7 +11,6 @@ extern crate rustc_middle; extern crate rustc_session; extern crate rustc_span; -use once_cell::sync::Lazy; use rustc_driver::Callbacks; use rustc_interface::interface; use rustc_session::config::ErrorOutputType; @@ -24,8 +23,6 @@ use std::path::Path; const PLRUSTC_USER_CRATE_NAME: &str = "PLRUSTC_USER_CRATE_NAME"; const PLRUSTC_USER_CRATE_ALLOWED_SOURCE_PATHS: &str = "PLRUSTC_USER_CRATE_ALLOWED_SOURCE_PATHS"; -const PLRUSTC_VERSION: &str = env!("CARGO_PKG_VERSION"); - mod lints; struct PlrustcCallbacks { @@ -51,62 +48,8 @@ impl Callbacks for PlrustcCallbacks { } } -// TODO: eventually we can replace this with: -// rustc_driver::install_ice_hook("https://github.com/tcdi/plrust/issues/new", |_| ()); -fn install_ice_hook() { - fn report_plrustc_ice(info: &std::panic::PanicInfo<'_>, bug_report_url: &str) { - // Invoke the default panic handler to print the message and (possibly) a back trace - (*PANIC_HOOK)(info); - // Separate output with an empty line - eprintln!(); - - let fallback_bundle = rustc_errors::fallback_fluent_bundle( - rustc_driver::DEFAULT_LOCALE_RESOURCES.into(), - false, - ); - let emitter = Box::new(rustc_errors::emitter::EmitterWriter::stderr( - rustc_errors::ColorConfig::Auto, - None, - None, - fallback_bundle, - false, - false, - None, - false, - false, - rustc_errors::TerminalUrl::No, - )); - let handler = rustc_errors::Handler::with_emitter(true, None, emitter); - - // Don't need to print anything extra for ExplicitBug - if !info.payload().is::() { - let mut d = rustc_errors::Diagnostic::new(rustc_errors::Level::Bug, "unexpected panic"); - handler.emit_diagnostic(&mut d); - } - handler.note_without_error("`plrustc` unexpectedly panicked. This is probably a bug."); - handler.note_without_error(&format!("Please file a bug report at <{bug_report_url}>")); - handler.note_without_error(&format!("plrustc version: {PLRUSTC_VERSION}")); - - // If backtraces are enabled, also print the query stack - let backtrace = std::env::var_os("RUST_BACKTRACE").map_or(false, |x| &x != "0"); - - let num_frames = if backtrace { None } else { Some(2) }; - - interface::try_print_query_stack(&handler, num_frames); - } - - type PanicCallback = Box) + Sync + Send + 'static>; - static PANIC_HOOK: Lazy = Lazy::new(|| { - let hook = std::panic::take_hook(); - let bug_report_url = "https://github.com/tcdi/plrust/issues/new"; - std::panic::set_hook(Box::new(|info| report_plrustc_ice(info, bug_report_url))); - hook - }); - Lazy::force(&PANIC_HOOK); -} - fn main() { - install_ice_hook(); + rustc_driver::install_ice_hook("https://github.com/tcdi/plrust/issues/new", |_| ()); rustc_driver::init_rustc_env_logger(); std::process::exit(rustc_driver::catch_with_exit_code(move || { let args = rustc_driver::args::arg_expand_all(&std::env::args().collect::>()); @@ -177,7 +120,7 @@ impl PlrustcConfig { let Some(allowed) = self.plrust_user_crate_allowed_source_paths.as_deref() else { early_error( ErrorOutputType::default(), - &format!( + format!( "if `{PLRUSTC_USER_CRATE_NAME}` is provided, \ then `{PLRUSTC_USER_CRATE_ALLOWED_SOURCE_PATHS}` should also be provided", ), @@ -189,14 +132,14 @@ impl PlrustcConfig { if !path.is_absolute() { early_error( ErrorOutputType::default(), - &format!("`{PLRUSTC_USER_CRATE_ALLOWED_SOURCE_PATHS}` contains relative path: {allowed:?}"), + format!("`{PLRUSTC_USER_CRATE_ALLOWED_SOURCE_PATHS}` contains relative path: {allowed:?}"), ); } let path = path.canonicalize().ok()?; let Some(pathstr) = path.to_str() else { early_error( ErrorOutputType::default(), - &format!("`{PLRUSTC_USER_CRATE_ALLOWED_SOURCE_PATHS}` contains non-UTF-8 path: {allowed:?}"), + format!("`{PLRUSTC_USER_CRATE_ALLOWED_SOURCE_PATHS}` contains non-UTF-8 path: {allowed:?}"), ); }; Some(pathstr.to_owned()) @@ -204,7 +147,7 @@ impl PlrustcConfig { if allowed_source_dirs.is_empty() { early_error( ErrorOutputType::default(), - &format!( + format!( "`{PLRUSTC_USER_CRATE_ALLOWED_SOURCE_PATHS}` was provided but contained no paths \ which exist: {allowed:?}", ), diff --git a/plrustc/plrustc/uitests/ice_hook.rs b/plrustc/plrustc/uitests/ice_hook.rs index bb61a771..bd552fdc 100644 --- a/plrustc/plrustc/uitests/ice_hook.rs +++ b/plrustc/plrustc/uitests/ice_hook.rs @@ -3,6 +3,7 @@ // normalize-stderr-test: "plrustc version: .*" -> "plrustc version: " // normalize-stderr-test: "force_ice.rs:\d*:\d*" -> "force_ice.rs" // normalize-stderr-test: "(?ms)query stack during panic:\n.*end of query stack\n" -> "" +// normalize-stderr-test: "note: rustc .*? running on .*" -> "note: rustc running on " #![crate_type = "lib"] // The comments above are to clean up file/line/version numbers, backtrace info, // etc. We want to avoid ice_hook.stderr changing more than is needed. diff --git a/plrustc/plrustc/uitests/ice_hook.stderr b/plrustc/plrustc/uitests/ice_hook.stderr index 9e301268..02bca4f8 100644 --- a/plrustc/plrustc/uitests/ice_hook.stderr +++ b/plrustc/plrustc/uitests/ice_hook.stderr @@ -1,12 +1,13 @@ thread 'rustc' panicked at 'Here is your ICE', plrustc/src/lints/force_ice.rs note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -error: internal compiler error: unexpected panic +error: the compiler unexpectedly panicked. this is a bug. -note: `plrustc` unexpectedly panicked. This is probably a bug. +note: we would appreciate a bug report: https://github.com/tcdi/plrust/issues/new -note: Please file a bug report at +note: rustc running on -note: plrustc version: +note: compiler flags: -C prefer-dynamic -Z ui-testing -thread panicked while panicking. aborting. +query stack during panic: +thread panicked while processing panic. aborting. diff --git a/plrustc/plrustc/uitests/tuple_struct_self_pat_box.stderr b/plrustc/plrustc/uitests/tuple_struct_self_pat_box.stderr index 6fa567c3..90ffcbfa 100644 --- a/plrustc/plrustc/uitests/tuple_struct_self_pat_box.stderr +++ b/plrustc/plrustc/uitests/tuple_struct_self_pat_box.stderr @@ -1,10 +1,9 @@ -error: `Self` pattern on tuple struct used to access private field +error[E0603]: tuple struct constructor `std::boxed::Box` is private --> $DIR/tuple_struct_self_pat_box.rs:10:13 | LL | let Self(ptr, _) = self; | ^^^^^^^^^^^^ - | - = note: `-F plrust-tuple-struct-self-pattern` implied by `-F plrust-lints` error: aborting due to previous error +For more information about this error, try `rustc --explain E0603`. diff --git a/plrustc/plrustc/uitests/tuple_struct_self_pat_local_priv.stderr b/plrustc/plrustc/uitests/tuple_struct_self_pat_local_priv.stderr index 03e288e0..52b82ceb 100644 --- a/plrustc/plrustc/uitests/tuple_struct_self_pat_local_priv.stderr +++ b/plrustc/plrustc/uitests/tuple_struct_self_pat_local_priv.stderr @@ -1,10 +1,9 @@ -error: `Self` pattern on tuple struct used to access private field +error[E0603]: tuple struct constructor `my::Foo` is private --> $DIR/tuple_struct_self_pat_local_priv.rs:8:13 | LL | let Self(s) = self; | ^^^^^^^ - | - = note: `-F plrust-tuple-struct-self-pattern` implied by `-F plrust-lints` error: aborting due to previous error +For more information about this error, try `rustc --explain E0603`. diff --git a/plrustc/rust-toolchain.toml b/plrustc/rust-toolchain.toml index 443740e9..4c821928 100644 --- a/plrustc/rust-toolchain.toml +++ b/plrustc/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.70.0" +channel = "1.71.1" components = [ "rustfmt", "rust-src", "rustc-dev", "cargo", "llvm-tools" ] targets = [ ] profile = "minimal" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0722528e..3dd8fb79 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.70.0" +channel = "1.71.1" components = [ "rustfmt", "rust-src", "rustc-dev", "llvm-tools" ] targets = [ ] profile = "minimal"