diff --git a/Cargo.lock b/Cargo.lock index 96eda77abb2..a1bbc1dca76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3021,7 +3021,6 @@ dependencies = [ name = "rls" version = "2.0.0" dependencies = [ - "serde", "serde_json", ] diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index a2db59bd6c4..4d879fbdcb7 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -290,7 +290,7 @@ fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: &'ll Type) -> } }; let llval = unsafe { - llvm::LLVMRustConstInBoundsGEP2( + llvm::LLVMConstInBoundsGEP2( self.type_i8(), self.const_bitcast(base_addr, self.type_i8p_ext(base_addr_space)), &self.const_usize(offset.bytes()), @@ -320,7 +320,7 @@ fn const_bitcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value { fn const_ptr_byte_offset(&self, base_addr: Self::Value, offset: abi::Size) -> Self::Value { unsafe { - llvm::LLVMRustConstInBoundsGEP2( + llvm::LLVMConstInBoundsGEP2( self.type_i8(), self.const_bitcast(base_addr, self.type_i8p()), &self.const_usize(offset.bytes()), diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 3ad546b61e9..e1dfc1b2dd6 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -1155,7 +1155,7 @@ pub fn LLVMConstArray<'a>( pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value; // Constant expressions - pub fn LLVMRustConstInBoundsGEP2<'a>( + pub fn LLVMConstInBoundsGEP2<'a>( ty: &'a Type, ConstantVal: &'a Value, ConstantIndices: *const &'a Value, diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 9352fe3147e..2e26ce111f0 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -1453,13 +1453,13 @@ extern "C" fn print_stack_trace(_: libc::c_int) { /// When an error signal (such as SIGABRT or SIGSEGV) is delivered to the /// process, print a stack trace and then exit. pub(super) fn install() { + use std::alloc::{alloc, Layout}; + unsafe { - const ALT_STACK_SIZE: usize = libc::MINSIGSTKSZ + 64 * 1024; + let alt_stack_size: usize = min_sigstack_size() + 64 * 1024; let mut alt_stack: libc::stack_t = std::mem::zeroed(); - alt_stack.ss_sp = - std::alloc::alloc(std::alloc::Layout::from_size_align(ALT_STACK_SIZE, 1).unwrap()) - as *mut libc::c_void; - alt_stack.ss_size = ALT_STACK_SIZE; + alt_stack.ss_sp = alloc(Layout::from_size_align(alt_stack_size, 1).unwrap()).cast(); + alt_stack.ss_size = alt_stack_size; libc::sigaltstack(&alt_stack, std::ptr::null_mut()); let mut sa: libc::sigaction = std::mem::zeroed(); @@ -1469,6 +1469,23 @@ pub(super) fn install() { libc::sigaction(libc::SIGSEGV, &sa, std::ptr::null_mut()); } } + + /// Modern kernels on modern hardware can have dynamic signal stack sizes. + #[cfg(any(target_os = "linux", target_os = "android"))] + fn min_sigstack_size() -> usize { + const AT_MINSIGSTKSZ: core::ffi::c_ulong = 51; + let dynamic_sigstksz = unsafe { libc::getauxval(AT_MINSIGSTKSZ) }; + // If getauxval couldn't find the entry, it returns 0, + // so take the higher of the "constant" and auxval. + // This transparently supports older kernels which don't provide AT_MINSIGSTKSZ + libc::MINSIGSTKSZ.max(dynamic_sigstksz as _) + } + + /// Not all OS support hardware where this is needed. + #[cfg(not(any(target_os = "linux", target_os = "android")))] + fn min_sigstack_size() -> usize { + libc::MINSIGSTKSZ + } } #[cfg(not(all(unix, any(target_env = "gnu", target_os = "macos"))))] diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index bb7510b3a53..ab5fa961b95 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1616,17 +1616,6 @@ extern "C" void LLVMRustSetLinkage(LLVMValueRef V, LLVMSetLinkage(V, fromRust(RustLinkage)); } -// FIXME: replace with LLVMConstInBoundsGEP2 when bumped minimal version to llvm-14 -extern "C" LLVMValueRef LLVMRustConstInBoundsGEP2(LLVMTypeRef Ty, - LLVMValueRef ConstantVal, - LLVMValueRef *ConstantIndices, - unsigned NumIndices) { - ArrayRef IdxList(unwrap(ConstantIndices, NumIndices), - NumIndices); - Constant *Val = unwrap(ConstantVal); - return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList)); -} - extern "C" bool LLVMRustConstIntGetZExtValue(LLVMValueRef CV, uint64_t *value) { auto C = unwrap(CV); if (C->getBitWidth() > 64) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index c9bd329d430..c0c749552e6 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -13,7 +13,7 @@ use std::time::{Duration, Instant}; use crate::cache::{Cache, Interned, INTERNER}; -use crate::config::{SplitDebuginfo, TargetSelection}; +use crate::config::{DryRun, SplitDebuginfo, TargetSelection}; use crate::doc; use crate::flags::{Color, Subcommand}; use crate::install; @@ -281,11 +281,15 @@ fn maybe_run(&self, builder: &Builder<'_>, pathsets: Vec) { fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool { if builder.config.exclude.iter().any(|e| pathset.has(&e, builder.kind)) { - println!("Skipping {:?} because it is excluded", pathset); + if !matches!(builder.config.dry_run, DryRun::SelfCheck) { + println!("Skipping {:?} because it is excluded", pathset); + } return true; } - if !builder.config.exclude.is_empty() { + if !builder.config.exclude.is_empty() + && !matches!(builder.config.dry_run, DryRun::SelfCheck) + { builder.verbose(&format!( "{:?} not skipped for {:?} -- not in {:?}", pathset, self.name, builder.config.exclude diff --git a/src/doc/book b/src/doc/book index 21cf840842b..668c64760b5 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 21cf840842bdf768a798869f06373c96c1cc5122 +Subproject commit 668c64760b5c7ea654facb4ba5fe9faddfda27cc diff --git a/src/doc/edition-guide b/src/doc/edition-guide index f63e578b92f..2751bdcef12 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit f63e578b92ff43e8cc38fcaa257b660f45c8a8c2 +Subproject commit 2751bdcef125468ea2ee006c11992cd1405aebe5 diff --git a/src/doc/embedded-book b/src/doc/embedded-book index f2aed2fe8e9..1e5556dd1b8 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit f2aed2fe8e9f55508c86ba3aa4b6789b18a08a22 +Subproject commit 1e5556dd1b864109985d5871616ae6b9164bcead diff --git a/src/doc/nomicon b/src/doc/nomicon index c369e4b4893..302b995bcb2 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit c369e4b489332f8721fbae630354fa83385d457d +Subproject commit 302b995bcb24b70fd883980fd174738c3a10b705 diff --git a/src/doc/reference b/src/doc/reference index 5ca365eac67..1ea0178266b 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 5ca365eac678cb0d41a20b3204546d6ed70c7171 +Subproject commit 1ea0178266b3f3f613b0fabdaf16a83961c99cdb diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 57636d69267..8a87926a985 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 57636d6926762861f34e030d52ca25a71e95e5bf +Subproject commit 8a87926a985ce32ca1fad1be4008ee161a0b91eb diff --git a/src/doc/rustc-dev-guide b/src/doc/rustc-dev-guide index 17fe3e94849..b5a12d95e32 160000 --- a/src/doc/rustc-dev-guide +++ b/src/doc/rustc-dev-guide @@ -1 +1 @@ -Subproject commit 17fe3e948498c50e208047a750f17d6a8d89669b +Subproject commit b5a12d95e32ae53791cc6ab44417774667ed2ac6 diff --git a/src/doc/style-guide/src/expressions.md b/src/doc/style-guide/src/expressions.md index 143161da6cf..40183063869 100644 --- a/src/doc/style-guide/src/expressions.md +++ b/src/doc/style-guide/src/expressions.md @@ -803,6 +803,16 @@ foo(|param| { action(); foo(param) }) + +let x = combinable([ + an_expr, + another_expr, +]); + +let arr = [combinable( + an_expr, + another_expr, +)]; ``` Such behaviour should extend recursively, however, tools may choose to limit the diff --git a/src/tools/rls/Cargo.toml b/src/tools/rls/Cargo.toml index b84647eb332..b7aa659c25a 100644 --- a/src/tools/rls/Cargo.toml +++ b/src/tools/rls/Cargo.toml @@ -5,5 +5,4 @@ edition = "2021" license = "Apache-2.0/MIT" [dependencies] -serde = { version = "1.0.143", features = ["derive"] } serde_json = "1.0.83" diff --git a/src/tools/rls/src/main.rs b/src/tools/rls/src/main.rs index f96f1325d96..d7be108e89c 100644 --- a/src/tools/rls/src/main.rs +++ b/src/tools/rls/src/main.rs @@ -3,7 +3,7 @@ //! This is a small stub that replaces RLS to alert the user that RLS is no //! longer available. -use serde::Deserialize; +use serde_json::Value; use std::error::Error; use std::io::BufRead; use std::io::Write; @@ -21,7 +21,6 @@ fn main() { } } -#[derive(Deserialize)] struct Message { method: Option, } @@ -88,8 +87,10 @@ fn read_message_raw(reader: &mut R) -> Result fn read_message(reader: &mut R) -> Result> { let m = read_message_raw(reader)?; - match serde_json::from_str(&m) { - Ok(m) => Ok(m), + match serde_json::from_str::(&m) { + Ok(message) => Ok(Message { + method: message.get("method").and_then(|value| value.as_str().map(String::from)), + }), Err(e) => Err(format!("failed to parse message {m}\n{e}").into()), } } diff --git a/triagebot.toml b/triagebot.toml index 13e6d3ebe60..da9d167bd3e 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -486,10 +486,6 @@ message = "This PR changes src/bootstrap/defaults/config.codegen.toml. If approp [mentions."src/bootstrap/llvm.rs"] message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp." -[mentions."compiler/rustc_llvm/build.rs"] -message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp." -[mentions."compiler/rustc_llvm/llvm-wrapper"] -message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp." [mentions."tests/ui/deriving/deriving-all-codegen.stdout"] message = "Changes to the code generated for builtin derived traits."