Skip to content
/ rust Public
forked from rust-lang/rust

Commit a7fc463

Browse files
committed
Auto merge of rust-lang#138693 - matthiaskrgr:rollup-ejq8mwp, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang#136177 (clarify BufRead::{fill_buf, consume} docs) - rust-lang#138654 (Remove the regex dependency from coretests) - rust-lang#138655 (rustc-dev-guide sync) - rust-lang#138656 (Remove double nesting in post-merge workflow) - rust-lang#138658 (CI: mirror alpine and centos images to ghcr) - rust-lang#138659 (coverage: Don't store a body span in `FunctionCoverageInfo`) - rust-lang#138661 (Revert: Add *_value methods to proc_macro lib) - rust-lang#138670 (Remove existing AFIDT implementation) - rust-lang#138674 (Various codegen_llvm cleanups) - rust-lang#138684 (use then in docs for `fuse` to enhance readability) r? `@ghost` `@rustbot` modify labels: rollup
2 parents c4b38a5 + 3b7faca commit a7fc463

File tree

74 files changed

+517
-923
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+517
-923
lines changed

.github/workflows/ghcr.yml

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# Docker Hub has a rate limit, while ghcr.io doesn't.
66
# Those images are pushed to ghcr.io by this job.
77
#
8+
# While Docker Hub rate limit *shouldn't* be an issue on GitHub Actions,
9+
# it certainly is for AWS codebuild.
10+
#
811
# Note that authenticating to DockerHub or other registries isn't possible
912
# for PR jobs, because forks can't access secrets.
1013
# That's why we use ghcr.io: it has no rate limit and it doesn't require authentication.
@@ -54,6 +57,10 @@ jobs:
5457
"ubuntu:22.04"
5558
# Mirrored because used by all linux CI jobs, including mingw-check-tidy
5659
"moby/buildkit:buildx-stable-1"
60+
# Mirrored because used when CI is running inside a Docker container
61+
"alpine:3.4"
62+
# Mirrored because used by dist-x86_64-linux
63+
"centos:7"
5764
)
5865
5966
# Mirror each image from DockerHub to ghcr.io

.github/workflows/post-merge.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ jobs:
3535
3636
cd src/ci/citool
3737
38-
printf "*This is an experimental post-merge analysis report. You can ignore it.*\n\n" > output.log
39-
printf "<details>\n<summary>Post-merge report</summary>\n\n" >> output.log
38+
printf "<details>\n<summary>What is this?</summary>\n" >> output.log
39+
printf "This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.\n" >> output.log
40+
printf "</details>\n\n" >> output.log
4041
4142
cargo run --release post-merge-report ${PARENT_COMMIT} ${{ github.sha }} >> output.log
4243
43-
printf "</details>\n" >> output.log
44-
4544
cat output.log
4645
4746
gh pr comment ${HEAD_PR} -F output.log

Cargo.lock

-17
Original file line numberDiff line numberDiff line change
@@ -2082,13 +2082,6 @@ version = "0.7.4"
20822082
source = "registry+https://github.com/rust-lang/crates.io-index"
20832083
checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
20842084

2085-
[[package]]
2086-
name = "literal-escaper"
2087-
version = "0.0.0"
2088-
dependencies = [
2089-
"rustc-std-workspace-std 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
2090-
]
2091-
20922085
[[package]]
20932086
name = "lld-wrapper"
20942087
version = "0.1.0"
@@ -3155,12 +3148,6 @@ version = "1.0.1"
31553148
name = "rustc-std-workspace-std"
31563149
version = "1.0.1"
31573150

3158-
[[package]]
3159-
name = "rustc-std-workspace-std"
3160-
version = "1.0.1"
3161-
source = "registry+https://github.com/rust-lang/crates.io-index"
3162-
checksum = "aba676a20abe46e5b0f1b0deae474aaaf31407e6c71147159890574599da04ef"
3163-
31643151
[[package]]
31653152
name = "rustc_abi"
31663153
version = "0.0.0"
@@ -3199,7 +3186,6 @@ name = "rustc_ast"
31993186
version = "0.0.0"
32003187
dependencies = [
32013188
"bitflags",
3202-
"literal-escaper",
32033189
"memchr",
32043190
"rustc_ast_ir",
32053191
"rustc_data_structures",
@@ -3909,7 +3895,6 @@ name = "rustc_lexer"
39093895
version = "0.0.0"
39103896
dependencies = [
39113897
"expect-test",
3912-
"literal-escaper",
39133898
"memchr",
39143899
"unicode-properties",
39153900
"unicode-xid",
@@ -4172,7 +4157,6 @@ name = "rustc_parse"
41724157
version = "0.0.0"
41734158
dependencies = [
41744159
"bitflags",
4175-
"literal-escaper",
41764160
"rustc_ast",
41774161
"rustc_ast_pretty",
41784162
"rustc_data_structures",
@@ -4195,7 +4179,6 @@ dependencies = [
41954179
name = "rustc_parse_format"
41964180
version = "0.0.0"
41974181
dependencies = [
4198-
"literal-escaper",
41994182
"rustc_index",
42004183
"rustc_lexer",
42014184
]

compiler/rustc_ast/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ edition = "2024"
66
[dependencies]
77
# tidy-alphabetical-start
88
bitflags = "2.4.1"
9-
literal-escaper = { path = "../../library/literal-escaper" }
109
memchr = "2.7.4"
1110
rustc_ast_ir = { path = "../rustc_ast_ir" }
1211
rustc_data_structures = { path = "../rustc_data_structures" }

compiler/rustc_ast/src/util/literal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::{ascii, fmt, str};
44

5-
use literal_escaper::{
5+
use rustc_lexer::unescape::{
66
MixedUnit, Mode, byte_from_char, unescape_byte, unescape_char, unescape_mixed, unescape_unicode,
77
};
88
use rustc_span::{Span, Symbol, kw, sym};

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,14 @@ fn fill_region_tables<'tcx>(
105105
ids_info: &'tcx CoverageIdsInfo,
106106
covfun: &mut CovfunRecord<'tcx>,
107107
) {
108-
// Currently a function's mappings must all be in the same file as its body span.
108+
// Currently a function's mappings must all be in the same file, so use the
109+
// first mapping's span to determine the file.
109110
let source_map = tcx.sess.source_map();
110-
let source_file = source_map.lookup_source_file(fn_cov_info.body_span.lo());
111+
let Some(first_span) = (try { fn_cov_info.mappings.first()?.span }) else {
112+
debug_assert!(false, "function has no mappings: {:?}", covfun.mangled_function_name);
113+
return;
114+
};
115+
let source_file = source_map.lookup_source_file(first_span.lo());
111116

112117
// Look up the global file ID for that file.
113118
let global_file_id = global_file_table.global_file_id_for_file(&source_file);
@@ -118,9 +123,8 @@ fn fill_region_tables<'tcx>(
118123
let ffi::Regions { code_regions, branch_regions, mcdc_branch_regions, mcdc_decision_regions } =
119124
&mut covfun.regions;
120125

121-
let make_cov_span = |span: Span| {
122-
spans::make_coverage_span(local_file_id, source_map, fn_cov_info, &source_file, span)
123-
};
126+
let make_cov_span =
127+
|span: Span| spans::make_coverage_span(local_file_id, source_map, &source_file, span);
124128
let discard_all = tcx.sess.coverage_discard_all_spans_in_codegen();
125129

126130
// For each counter/region pair in this function+file, convert it to a

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs

+7-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use rustc_middle::mir::coverage::FunctionCoverageInfo;
21
use rustc_span::source_map::SourceMap;
32
use rustc_span::{BytePos, Pos, SourceFile, Span};
43
use tracing::debug;
@@ -19,11 +18,10 @@ use crate::coverageinfo::mapgen::LocalFileId;
1918
pub(crate) fn make_coverage_span(
2019
file_id: LocalFileId,
2120
source_map: &SourceMap,
22-
fn_cov_info: &FunctionCoverageInfo,
2321
file: &SourceFile,
2422
span: Span,
2523
) -> Option<ffi::CoverageSpan> {
26-
let span = ensure_non_empty_span(source_map, fn_cov_info, span)?;
24+
let span = ensure_non_empty_span(source_map, span)?;
2725

2826
let lo = span.lo();
2927
let hi = span.hi();
@@ -55,36 +53,22 @@ pub(crate) fn make_coverage_span(
5553
})
5654
}
5755

58-
fn ensure_non_empty_span(
59-
source_map: &SourceMap,
60-
fn_cov_info: &FunctionCoverageInfo,
61-
span: Span,
62-
) -> Option<Span> {
56+
fn ensure_non_empty_span(source_map: &SourceMap, span: Span) -> Option<Span> {
6357
if !span.is_empty() {
6458
return Some(span);
6559
}
6660

67-
let lo = span.lo();
68-
let hi = span.hi();
69-
70-
// The span is empty, so try to expand it to cover an adjacent '{' or '}',
71-
// but only within the bounds of the body span.
72-
let try_next = hi < fn_cov_info.body_span.hi();
73-
let try_prev = fn_cov_info.body_span.lo() < lo;
74-
if !(try_next || try_prev) {
75-
return None;
76-
}
77-
61+
// The span is empty, so try to enlarge it to cover an adjacent '{' or '}'.
7862
source_map
7963
.span_to_source(span, |src, start, end| try {
8064
// Adjusting span endpoints by `BytePos(1)` is normally a bug,
8165
// but in this case we have specifically checked that the character
8266
// we're skipping over is one of two specific ASCII characters, so
8367
// adjusting by exactly 1 byte is correct.
84-
if try_next && src.as_bytes()[end] == b'{' {
85-
Some(span.with_hi(hi + BytePos(1)))
86-
} else if try_prev && src.as_bytes()[start - 1] == b'}' {
87-
Some(span.with_lo(lo - BytePos(1)))
68+
if src.as_bytes().get(end).copied() == Some(b'{') {
69+
Some(span.with_hi(span.hi() + BytePos(1)))
70+
} else if start > 0 && src.as_bytes()[start - 1] == b'}' {
71+
Some(span.with_lo(span.lo() - BytePos(1)))
8872
} else {
8973
None
9074
}

0 commit comments

Comments
 (0)