Skip to content

Commit fcaf04e

Browse files
committed
Auto merge of rust-lang#113559 - matthiaskrgr:rollup-jrqyctc, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#113386 (style-guide: Expand example of combinable expressions to include arrays) - rust-lang#113523 (Reuse LLVMConstInBoundsGEP2) - rust-lang#113528 (Dynamically size sigaltstk in rustc) - rust-lang#113543 (Remove `rustc_llvm` from llvm-stamp nags) - rust-lang#113548 (Update books) - rust-lang#113551 (bootstrap: Don't print "Skipping" twice) - rust-lang#113556 (Don't use serde-derive in the rls shim) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1d4f5af + ad4f303 commit fcaf04e

File tree

17 files changed

+54
-39
lines changed

17 files changed

+54
-39
lines changed

Cargo.lock

-1
Original file line numberDiff line numberDiff line change
@@ -3021,7 +3021,6 @@ dependencies = [
30213021
name = "rls"
30223022
version = "2.0.0"
30233023
dependencies = [
3024-
"serde",
30253024
"serde_json",
30263025
]
30273026

compiler/rustc_codegen_llvm/src/common.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
290290
}
291291
};
292292
let llval = unsafe {
293-
llvm::LLVMRustConstInBoundsGEP2(
293+
llvm::LLVMConstInBoundsGEP2(
294294
self.type_i8(),
295295
self.const_bitcast(base_addr, self.type_i8p_ext(base_addr_space)),
296296
&self.const_usize(offset.bytes()),
@@ -320,7 +320,7 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
320320

321321
fn const_ptr_byte_offset(&self, base_addr: Self::Value, offset: abi::Size) -> Self::Value {
322322
unsafe {
323-
llvm::LLVMRustConstInBoundsGEP2(
323+
llvm::LLVMConstInBoundsGEP2(
324324
self.type_i8(),
325325
self.const_bitcast(base_addr, self.type_i8p()),
326326
&self.const_usize(offset.bytes()),

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ extern "C" {
11551155
pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
11561156

11571157
// Constant expressions
1158-
pub fn LLVMRustConstInBoundsGEP2<'a>(
1158+
pub fn LLVMConstInBoundsGEP2<'a>(
11591159
ty: &'a Type,
11601160
ConstantVal: &'a Value,
11611161
ConstantIndices: *const &'a Value,

compiler/rustc_driver_impl/src/lib.rs

+22-5
Original file line numberDiff line numberDiff line change
@@ -1453,13 +1453,13 @@ mod signal_handler {
14531453
/// When an error signal (such as SIGABRT or SIGSEGV) is delivered to the
14541454
/// process, print a stack trace and then exit.
14551455
pub(super) fn install() {
1456+
use std::alloc::{alloc, Layout};
1457+
14561458
unsafe {
1457-
const ALT_STACK_SIZE: usize = libc::MINSIGSTKSZ + 64 * 1024;
1459+
let alt_stack_size: usize = min_sigstack_size() + 64 * 1024;
14581460
let mut alt_stack: libc::stack_t = std::mem::zeroed();
1459-
alt_stack.ss_sp =
1460-
std::alloc::alloc(std::alloc::Layout::from_size_align(ALT_STACK_SIZE, 1).unwrap())
1461-
as *mut libc::c_void;
1462-
alt_stack.ss_size = ALT_STACK_SIZE;
1461+
alt_stack.ss_sp = alloc(Layout::from_size_align(alt_stack_size, 1).unwrap()).cast();
1462+
alt_stack.ss_size = alt_stack_size;
14631463
libc::sigaltstack(&alt_stack, std::ptr::null_mut());
14641464

14651465
let mut sa: libc::sigaction = std::mem::zeroed();
@@ -1469,6 +1469,23 @@ mod signal_handler {
14691469
libc::sigaction(libc::SIGSEGV, &sa, std::ptr::null_mut());
14701470
}
14711471
}
1472+
1473+
/// Modern kernels on modern hardware can have dynamic signal stack sizes.
1474+
#[cfg(any(target_os = "linux", target_os = "android"))]
1475+
fn min_sigstack_size() -> usize {
1476+
const AT_MINSIGSTKSZ: core::ffi::c_ulong = 51;
1477+
let dynamic_sigstksz = unsafe { libc::getauxval(AT_MINSIGSTKSZ) };
1478+
// If getauxval couldn't find the entry, it returns 0,
1479+
// so take the higher of the "constant" and auxval.
1480+
// This transparently supports older kernels which don't provide AT_MINSIGSTKSZ
1481+
libc::MINSIGSTKSZ.max(dynamic_sigstksz as _)
1482+
}
1483+
1484+
/// Not all OS support hardware where this is needed.
1485+
#[cfg(not(any(target_os = "linux", target_os = "android")))]
1486+
fn min_sigstack_size() -> usize {
1487+
libc::MINSIGSTKSZ
1488+
}
14721489
}
14731490

14741491
#[cfg(not(all(unix, any(target_env = "gnu", target_os = "macos"))))]

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

-11
Original file line numberDiff line numberDiff line change
@@ -1616,17 +1616,6 @@ extern "C" void LLVMRustSetLinkage(LLVMValueRef V,
16161616
LLVMSetLinkage(V, fromRust(RustLinkage));
16171617
}
16181618

1619-
// FIXME: replace with LLVMConstInBoundsGEP2 when bumped minimal version to llvm-14
1620-
extern "C" LLVMValueRef LLVMRustConstInBoundsGEP2(LLVMTypeRef Ty,
1621-
LLVMValueRef ConstantVal,
1622-
LLVMValueRef *ConstantIndices,
1623-
unsigned NumIndices) {
1624-
ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices),
1625-
NumIndices);
1626-
Constant *Val = unwrap<Constant>(ConstantVal);
1627-
return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList));
1628-
}
1629-
16301619
extern "C" bool LLVMRustConstIntGetZExtValue(LLVMValueRef CV, uint64_t *value) {
16311620
auto C = unwrap<llvm::ConstantInt>(CV);
16321621
if (C->getBitWidth() > 64)

src/bootstrap/builder.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::process::Command;
1313
use std::time::{Duration, Instant};
1414

1515
use crate::cache::{Cache, Interned, INTERNER};
16-
use crate::config::{SplitDebuginfo, TargetSelection};
16+
use crate::config::{DryRun, SplitDebuginfo, TargetSelection};
1717
use crate::doc;
1818
use crate::flags::{Color, Subcommand};
1919
use crate::install;
@@ -281,11 +281,15 @@ impl StepDescription {
281281

282282
fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool {
283283
if builder.config.exclude.iter().any(|e| pathset.has(&e, builder.kind)) {
284-
println!("Skipping {:?} because it is excluded", pathset);
284+
if !matches!(builder.config.dry_run, DryRun::SelfCheck) {
285+
println!("Skipping {:?} because it is excluded", pathset);
286+
}
285287
return true;
286288
}
287289

288-
if !builder.config.exclude.is_empty() {
290+
if !builder.config.exclude.is_empty()
291+
&& !matches!(builder.config.dry_run, DryRun::SelfCheck)
292+
{
289293
builder.verbose(&format!(
290294
"{:?} not skipped for {:?} -- not in {:?}",
291295
pathset, self.name, builder.config.exclude

src/doc/book

src/doc/style-guide/src/expressions.md

+10
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,16 @@ foo(|param| {
803803
action();
804804
foo(param)
805805
})
806+
807+
let x = combinable([
808+
an_expr,
809+
another_expr,
810+
]);
811+
812+
let arr = [combinable(
813+
an_expr,
814+
another_expr,
815+
)];
806816
```
807817

808818
Such behaviour should extend recursively, however, tools may choose to limit the

src/tools/rls/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ edition = "2021"
55
license = "Apache-2.0/MIT"
66

77
[dependencies]
8-
serde = { version = "1.0.143", features = ["derive"] }
98
serde_json = "1.0.83"

src/tools/rls/src/main.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! This is a small stub that replaces RLS to alert the user that RLS is no
44
//! longer available.
55
6-
use serde::Deserialize;
6+
use serde_json::Value;
77
use std::error::Error;
88
use std::io::BufRead;
99
use std::io::Write;
@@ -21,7 +21,6 @@ fn main() {
2121
}
2222
}
2323

24-
#[derive(Deserialize)]
2524
struct Message {
2625
method: Option<String>,
2726
}
@@ -88,8 +87,10 @@ fn read_message_raw<R: BufRead>(reader: &mut R) -> Result<String, Box<dyn Error>
8887

8988
fn read_message<R: BufRead>(reader: &mut R) -> Result<Message, Box<dyn Error>> {
9089
let m = read_message_raw(reader)?;
91-
match serde_json::from_str(&m) {
92-
Ok(m) => Ok(m),
90+
match serde_json::from_str::<Value>(&m) {
91+
Ok(message) => Ok(Message {
92+
method: message.get("method").and_then(|value| value.as_str().map(String::from)),
93+
}),
9394
Err(e) => Err(format!("failed to parse message {m}\n{e}").into()),
9495
}
9596
}

triagebot.toml

-4
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,6 @@ message = "This PR changes src/bootstrap/defaults/config.codegen.toml. If approp
486486

487487
[mentions."src/bootstrap/llvm.rs"]
488488
message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp."
489-
[mentions."compiler/rustc_llvm/build.rs"]
490-
message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp."
491-
[mentions."compiler/rustc_llvm/llvm-wrapper"]
492-
message = "This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp."
493489

494490
[mentions."tests/ui/deriving/deriving-all-codegen.stdout"]
495491
message = "Changes to the code generated for builtin derived traits."

0 commit comments

Comments
 (0)