Skip to content

Commit ac888e8

Browse files
committed
Auto merge of rust-lang#85022 - JohnTitor:rollup-2q4706v, r=JohnTitor
Rollup of 9 pull requests Successful merges: - rust-lang#84779 (Add support for --test-args to cargotest) - rust-lang#84781 (Don't check bootstrap artifacts by default) - rust-lang#84787 (bump deps) - rust-lang#84815 (Update coverage docs and command line help) - rust-lang#84875 (Removes unneeded check of `#[no_coverage]` in mapgen) - rust-lang#84897 (Coverage instruments closure bodies in macros (not the macro body)) - rust-lang#84911 (Retry clang+llvm download) - rust-lang#84972 (CTFE inbounds-error-messages tweak) - rust-lang#84990 (Sort rustdoc-gui tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1773f14 + 87faf2e commit ac888e8

32 files changed

+689
-470
lines changed

Cargo.lock

+24-14
Original file line numberDiff line numberDiff line change
@@ -864,24 +864,24 @@ dependencies = [
864864

865865
[[package]]
866866
name = "curl"
867-
version = "0.4.34"
867+
version = "0.4.36"
868868
source = "registry+https://github.com/rust-lang/crates.io-index"
869-
checksum = "e268162af1a5fe89917ae25ba3b0a77c8da752bdc58e7dbb4f15b91fbd33756e"
869+
checksum = "d0bac9f84ca0977c4d9b8db998689de55b9e976656a6bc87fada2ca710d504c7"
870870
dependencies = [
871871
"curl-sys",
872872
"libc",
873873
"openssl-probe",
874874
"openssl-sys",
875875
"schannel",
876-
"socket2",
876+
"socket2 0.4.0",
877877
"winapi 0.3.9",
878878
]
879879

880880
[[package]]
881881
name = "curl-sys"
882-
version = "0.4.39+curl-7.74.0"
882+
version = "0.4.42+curl-7.76.0"
883883
source = "registry+https://github.com/rust-lang/crates.io-index"
884-
checksum = "07a8ce861e7b68a0b394e814d7ee9f1b2750ff8bd10372c6ad3bacc10e86f874"
884+
checksum = "4636d8d6109c842707018a104051436bffb8991ea20b2d1293db70b6e0ee4c7c"
885885
dependencies = [
886886
"cc",
887887
"libc",
@@ -2273,7 +2273,7 @@ version = "0.3.6"
22732273
source = "registry+https://github.com/rust-lang/crates.io-index"
22742274
checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
22752275
dependencies = [
2276-
"socket2",
2276+
"socket2 0.3.16",
22772277
"winapi 0.3.9",
22782278
]
22792279

@@ -2390,15 +2390,15 @@ dependencies = [
23902390

23912391
[[package]]
23922392
name = "openssl"
2393-
version = "0.10.30"
2393+
version = "0.10.33"
23942394
source = "registry+https://github.com/rust-lang/crates.io-index"
2395-
checksum = "8d575eff3665419f9b83678ff2815858ad9d11567e082f5ac1814baba4e2bcb4"
2395+
checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577"
23962396
dependencies = [
23972397
"bitflags",
2398-
"cfg-if 0.1.10",
2398+
"cfg-if 1.0.0",
23992399
"foreign-types",
2400-
"lazy_static",
24012400
"libc",
2401+
"once_cell",
24022402
"openssl-sys",
24032403
]
24042404

@@ -2410,18 +2410,18 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
24102410

24112411
[[package]]
24122412
name = "openssl-src"
2413-
version = "111.12.0+1.1.1h"
2413+
version = "111.15.0+1.1.1k"
24142414
source = "registry+https://github.com/rust-lang/crates.io-index"
2415-
checksum = "858a4132194f8570a7ee9eb8629e85b23cbc4565f2d4a162e87556e5956abf61"
2415+
checksum = "b1a5f6ae2ac04393b217ea9f700cd04fa9bf3d93fae2872069f3d15d908af70a"
24162416
dependencies = [
24172417
"cc",
24182418
]
24192419

24202420
[[package]]
24212421
name = "openssl-sys"
2422-
version = "0.9.58"
2422+
version = "0.9.61"
24232423
source = "registry+https://github.com/rust-lang/crates.io-index"
2424-
checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de"
2424+
checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f"
24252425
dependencies = [
24262426
"autocfg",
24272427
"cc",
@@ -4863,6 +4863,16 @@ dependencies = [
48634863
"winapi 0.3.9",
48644864
]
48654865

4866+
[[package]]
4867+
name = "socket2"
4868+
version = "0.4.0"
4869+
source = "registry+https://github.com/rust-lang/crates.io-index"
4870+
checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2"
4871+
dependencies = [
4872+
"libc",
4873+
"winapi 0.3.9",
4874+
]
4875+
48664876
[[package]]
48674877
name = "stable_deref_trait"
48684878
version = "1.2.0"

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_codegen_ssa::traits::{ConstMethods, CoverageInfoMethods};
88
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
99
use rustc_hir::def_id::{DefId, DefIdSet, LOCAL_CRATE};
1010
use rustc_llvm::RustString;
11-
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
1211
use rustc_middle::mir::coverage::CodeRegion;
1312
use rustc_span::Symbol;
1413

@@ -249,7 +248,7 @@ fn save_function_record(
249248
///
250249
/// We can find the unused functions (including generic functions) by the set difference of all MIR
251250
/// `DefId`s (`tcx` query `mir_keys`) minus the codegenned `DefId`s (`tcx` query
252-
/// `collect_and_partition_mono_items`).
251+
/// `codegened_and_inlined_items`).
253252
///
254253
/// *HOWEVER* the codegenned `DefId`s are partitioned across multiple `CodegenUnit`s (CGUs), and
255254
/// this function is processing a `function_coverage_map` for the functions (`Instance`/`DefId`)
@@ -281,11 +280,8 @@ fn add_unused_functions<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
281280

282281
let mut unused_def_ids_by_file: FxHashMap<Symbol, Vec<DefId>> = FxHashMap::default();
283282
for &non_codegenned_def_id in all_def_ids.difference(codegenned_def_ids) {
284-
let codegen_fn_attrs = tcx.codegen_fn_attrs(non_codegenned_def_id);
285-
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NO_COVERAGE) {
286-
continue;
287-
}
288-
// Make sure the non-codegenned (unused) function has a file_name
283+
// Make sure the non-codegenned (unused) function has at least one MIR
284+
// `Coverage` statement with a code region, and return its file name.
289285
if let Some(non_codegenned_file_name) = tcx.covered_file_name(non_codegenned_def_id) {
290286
let def_ids =
291287
unused_def_ids_by_file.entry(*non_codegenned_file_name).or_insert_with(Vec::new);

compiler/rustc_middle/src/mir/interpret/error.rs

+3
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
306306
ptr.alloc_id,
307307
allocation_size.bytes()
308308
),
309+
DanglingIntPointer(_, CheckInAllocMsg::InboundsTest) => {
310+
write!(f, "null pointer is not allowed for this operation")
311+
}
309312
DanglingIntPointer(i, msg) => {
310313
write!(f, "{} failed: 0x{:x} is not a valid pointer", msg, i)
311314
}

compiler/rustc_mir/src/interpret/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
526526
min_ptr,
527527
Size::from_bytes(size),
528528
None,
529-
CheckInAllocMsg::InboundsTest,
529+
CheckInAllocMsg::PointerArithmeticTest,
530530
)?;
531531
Ok(offset_ptr)
532532
}

compiler/rustc_mir/src/interpret/machine.rs

+1
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
369369
) -> InterpResult<'tcx, Pointer<Self::PointerTag>> {
370370
Err((if int == 0 {
371371
// This is UB, seriously.
372+
// (`DanglingIntPointer` with these exact arguments has special printing code.)
372373
err_ub!(DanglingIntPointer(0, CheckInAllocMsg::InboundsTest))
373374
} else {
374375
// This is just something we cannot support during const-eval.

compiler/rustc_mir/src/interpret/validity.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
330330
vtable,
331331
3 * self.ecx.tcx.data_layout.pointer_size, // drop, size, align
332332
Some(self.ecx.tcx.data_layout.pointer_align.abi),
333-
CheckInAllocMsg::InboundsTest,
333+
CheckInAllocMsg::InboundsTest, // will anyway be replaced by validity message
334334
),
335335
self.path,
336336
err_ub!(DanglingIntPointer(..)) |
@@ -416,7 +416,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
416416
place.ptr,
417417
size,
418418
Some(align),
419-
CheckInAllocMsg::InboundsTest,
419+
CheckInAllocMsg::InboundsTest, // will anyway be replaced by validity message
420420
),
421421
self.path,
422422
err_ub!(AlignmentCheckFailed { required, has }) =>

compiler/rustc_mir/src/transform/coverage/mod.rs

+24-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc_middle::mir::{
3232
use rustc_middle::ty::TyCtxt;
3333
use rustc_span::def_id::DefId;
3434
use rustc_span::source_map::SourceMap;
35-
use rustc_span::{CharPos, Pos, SourceFile, Span, Symbol};
35+
use rustc_span::{CharPos, ExpnKind, Pos, SourceFile, Span, Symbol};
3636

3737
/// A simple error message wrapper for `coverage::Error`s.
3838
#[derive(Debug)]
@@ -113,8 +113,29 @@ struct Instrumentor<'a, 'tcx> {
113113
impl<'a, 'tcx> Instrumentor<'a, 'tcx> {
114114
fn new(pass_name: &'a str, tcx: TyCtxt<'tcx>, mir_body: &'a mut mir::Body<'tcx>) -> Self {
115115
let source_map = tcx.sess.source_map();
116-
let (some_fn_sig, hir_body) = fn_sig_and_body(tcx, mir_body.source.def_id());
117-
let body_span = hir_body.value.span;
116+
let def_id = mir_body.source.def_id();
117+
let (some_fn_sig, hir_body) = fn_sig_and_body(tcx, def_id);
118+
119+
let mut body_span = hir_body.value.span;
120+
121+
if tcx.is_closure(def_id) {
122+
// If the MIR function is a closure, and if the closure body span
123+
// starts from a macro, but it's content is not in that macro, try
124+
// to find a non-macro callsite, and instrument the spans there
125+
// instead.
126+
loop {
127+
let expn_data = body_span.ctxt().outer_expn_data();
128+
if expn_data.is_root() {
129+
break;
130+
}
131+
if let ExpnKind::Macro(..) = expn_data.kind {
132+
body_span = expn_data.call_site;
133+
} else {
134+
break;
135+
}
136+
}
137+
}
138+
118139
let source_file = source_map.lookup_source_file(body_span.lo());
119140
let fn_sig_span = match some_fn_sig.filter(|fn_sig| {
120141
fn_sig.span.ctxt() == body_span.ctxt()

compiler/rustc_session/src/options.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1080,12 +1080,12 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
10801080
"gather statistics about the input (default: no)"),
10811081
instrument_coverage: Option<InstrumentCoverage> = (None, parse_instrument_coverage, [TRACKED],
10821082
"instrument the generated code to support LLVM source-based code coverage \
1083-
reports (note, the compiler build config must include `profiler = true`, \
1084-
and is mutually exclusive with `-C profile-generate`/`-C profile-use`); \
1085-
implies `-Z symbol-mangling-version=v0`; disables/overrides some Rust \
1086-
optimizations. Optional values are: `=all` (default coverage), \
1087-
`=except-unused-generics`, `=except-unused-functions`, or `=off` \
1088-
(default: instrument-coverage=off)"),
1083+
reports (note, the compiler build config must include `profiler = true`); \
1084+
implies `-Z symbol-mangling-version=v0`. Optional values are:
1085+
`=all` (implicit value)
1086+
`=except-unused-generics`
1087+
`=except-unused-functions`
1088+
`=off` (default)"),
10891089
instrument_mcount: bool = (false, parse_bool, [TRACKED],
10901090
"insert function instrument code for mcount-based tracing (default: no)"),
10911091
keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],

src/bootstrap/check.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl Step for CodegenBackend {
280280
}
281281

282282
macro_rules! tool_check_step {
283-
($name:ident, $path:literal, $($alias:literal, )* $source_type:path) => {
283+
($name:ident, $path:literal, $($alias:literal, )* $source_type:path $(, $default:literal )?) => {
284284
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
285285
pub struct $name {
286286
pub target: TargetSelection,
@@ -289,7 +289,7 @@ macro_rules! tool_check_step {
289289
impl Step for $name {
290290
type Output = ();
291291
const ONLY_HOSTS: bool = true;
292-
const DEFAULT: bool = true;
292+
const DEFAULT: bool = true $( && $default )?;
293293

294294
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
295295
run.paths(&[ $path, $($alias),* ])
@@ -368,7 +368,7 @@ tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InT
368368
// rejected.
369369
tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree);
370370

371-
tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree);
371+
tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false);
372372

373373
/// Cargo's output path for the standard library in a given stage, compiled
374374
/// by a particular compiler for the specified target.

src/bootstrap/test.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ impl Step for Cargotest {
183183
builder,
184184
cmd.arg(&cargo)
185185
.arg(&out_dir)
186+
.args(builder.config.cmd.test_args())
186187
.env("RUSTC", builder.rustc(compiler))
187188
.env("RUSTDOC", builder.rustdoc(compiler)),
188189
);
@@ -830,6 +831,7 @@ impl Step for RustdocGUI {
830831
command.arg("src/test/rustdoc-gui/lib.rs").arg("-o").arg(&out_dir);
831832
builder.run(&mut command);
832833

834+
let mut tests = Vec::new();
833835
for file in fs::read_dir("src/test/rustdoc-gui").unwrap() {
834836
let file = file.unwrap();
835837
let file_path = file.path();
@@ -838,13 +840,17 @@ impl Step for RustdocGUI {
838840
if !file_name.to_str().unwrap().ends_with(".goml") {
839841
continue;
840842
}
843+
tests.push(file_path);
844+
}
845+
tests.sort_unstable();
846+
for test in tests {
841847
let mut command = Command::new(&nodejs);
842848
command
843849
.arg("src/tools/rustdoc-gui/tester.js")
844850
.arg("--doc-folder")
845851
.arg(out_dir.join("test_docs"))
846852
.arg("--test-file")
847-
.arg(file_path);
853+
.arg(test);
848854
builder.run(&mut command);
849855
}
850856
} else {

src/ci/scripts/install-clang.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ if isMacOS; then
1818
bindir="$(xcode-select --print-path)/Toolchains/XcodeDefault.xctoolchain/usr/bin"
1919
else
2020
file="${MIRRORS_BASE}/clang%2Bllvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
21-
curl -f "${file}" | tar xJf -
21+
retry curl -f "${file}" -o "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
22+
tar xJf "clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin.tar.xz"
2223
bindir="$(pwd)/clang+llvm-${LLVM_VERSION}-x86_64-apple-darwin/bin"
2324
fi
2425

@@ -48,7 +49,8 @@ elif isWindows && [[ ${CUSTOM_MINGW-0} -ne 1 ]]; then
4849

4950
mkdir -p citools/clang-rust
5051
cd citools
51-
curl -f "${MIRRORS_BASE}/LLVM-${LLVM_VERSION}-win64.exe" -o "LLVM-${LLVM_VERSION}-win64.exe"
52+
retry curl -f "${MIRRORS_BASE}/LLVM-${LLVM_VERSION}-win64.exe" \
53+
-o "LLVM-${LLVM_VERSION}-win64.exe"
5254
7z x -oclang-rust/ "LLVM-${LLVM_VERSION}-win64.exe"
5355
ciCommandSetEnv RUST_CONFIGURE_ARGS \
5456
"${RUST_CONFIGURE_ARGS} --set llvm.clang-cl=$(pwd)/clang-rust/bin/clang-cl.exe"

0 commit comments

Comments
 (0)