Skip to content

Commit c871d09

Browse files
committed
Auto merge of #149276 - matthiaskrgr:rollup-wlrpdrr, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #148234 (rustdoc: make mergeable crate info more usable) - #149201 (Add suggest alternatives for Out-of-range \x escapes) - #149208 ([rustdoc] Make more functions return `fmt::Result` and reduce number of `.unwrap()` calls) - #149252 (miri: use `tikv-jemalloc-sys` from sysroot) - #149255 (Use `let...else` consistently in user-facing diagnostics) - #149275 (Fix missing double-quote in `std::env::consts::OS` values) r? `@ghost` `@rustbot` modify labels: rollup
2 parents b64df9d + 5ec55d3 commit c871d09

Some content is hidden

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

44 files changed

+365
-142
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2486,7 +2486,6 @@ dependencies = [
24862486
"serde_json",
24872487
"smallvec",
24882488
"tempfile",
2489-
"tikv-jemalloc-sys",
24902489
"ui_test",
24912490
]
24922491

compiler/rustc_hir_analysis/src/check/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn resolve_block<'tcx>(
9999
for (i, statement) in blk.stmts.iter().enumerate() {
100100
match statement.kind {
101101
hir::StmtKind::Let(LetStmt { els: Some(els), .. }) => {
102-
// Let-else has a special lexical structure for variables.
102+
// let-else has a special lexical structure for variables.
103103
// First we take a checkpoint of the current scope context here.
104104
let mut prev_cx = visitor.cx;
105105

compiler/rustc_mir_build/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ mir_build_suggest_if_let = you might want to use `if let` to ignore the {$count
334334
*[other] variants that aren't
335335
} matched
336336
337-
mir_build_suggest_let_else = you might want to use `let else` to handle the {$count ->
337+
mir_build_suggest_let_else = you might want to use `let...else` to handle the {$count ->
338338
[one] variant that isn't
339339
*[other] variants that aren't
340340
} matched

compiler/rustc_parse/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,6 @@ parse_or_in_let_chain = `||` operators are not supported in let chain conditions
732732
733733
parse_or_pattern_not_allowed_in_fn_parameters = function parameters require top-level or-patterns in parentheses
734734
parse_or_pattern_not_allowed_in_let_binding = `let` bindings require top-level or-patterns in parentheses
735-
parse_out_of_range_hex_escape = out of range hex escape
736-
.label = must be a character in the range [\x00-\x7f]
737735
738736
parse_outer_attr_explanation = outer attributes, like `#[test]`, annotate the item following them
739737

compiler/rustc_parse/src/errors.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,12 +2455,6 @@ pub(crate) enum UnescapeError {
24552455
is_hex: bool,
24562456
ch: String,
24572457
},
2458-
#[diag(parse_out_of_range_hex_escape)]
2459-
OutOfRangeHexEscape(
2460-
#[primary_span]
2461-
#[label]
2462-
Span,
2463-
),
24642458
#[diag(parse_leading_underscore_unicode_escape)]
24652459
LeadingUnderscoreUnicodeEscape {
24662460
#[primary_span]

compiler/rustc_parse/src/lexer/unescape_error_reporting.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,24 @@ pub(crate) fn emit_unescape_error(
226226
err.emit()
227227
}
228228
EscapeError::OutOfRangeHexEscape => {
229-
dcx.emit_err(UnescapeError::OutOfRangeHexEscape(err_span))
229+
let mut err = dcx.struct_span_err(err_span, "out of range hex escape");
230+
err.span_label(err_span, "must be a character in the range [\\x00-\\x7f]");
231+
232+
let escape_str = &lit[range];
233+
if lit.len() <= 4
234+
&& escape_str.len() == 4
235+
&& escape_str.starts_with("\\x")
236+
&& let Ok(value) = u8::from_str_radix(&escape_str[2..4], 16)
237+
&& matches!(mode, Mode::Char | Mode::Str)
238+
{
239+
err.help(format!("if you want to write a byte literal, use `b'{}'`", escape_str));
240+
err.help(format!(
241+
"if you want to write a Unicode character, use `'\\u{{{:X}}}'`",
242+
value
243+
));
244+
}
245+
246+
err.emit()
230247
}
231248
EscapeError::LeadingUnderscoreUnicodeEscape => {
232249
let (c, span) = last_char();

compiler/rustc_parse/src/parser/stmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ impl<'a> Parser<'a> {
867867
if let_else || !if_let {
868868
err.span_suggestion_verbose(
869869
block_span.shrink_to_lo(),
870-
format!("{alternatively}you might have meant to use `let else`"),
870+
format!("{alternatively}you might have meant to use `let...else`"),
871871
"else ".to_string(),
872872
if let_else {
873873
Applicability::MachineApplicable

library/std/src/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ pub mod consts {
10971097
/// * `"nto"`
10981098
/// * `"redox"`
10991099
/// * `"solaris"`
1100-
/// * `"solid_asp3`
1100+
/// * `"solid_asp3"`
11011101
/// * `"vexos"`
11021102
/// * `"vita"`
11031103
/// * `"vxworks"`

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,11 @@ tool_rustc_extended!(Miri {
15671567
tool_name: "miri",
15681568
stable: false,
15691569
add_bins_to_sysroot: ["miri"],
1570+
add_features: |builder, target, features| {
1571+
if builder.config.jemalloc(target) {
1572+
features.push("jemalloc".to_string());
1573+
}
1574+
},
15701575
// Always compile also tests when building miri. Otherwise feature unification can cause rebuilds between building and testing miri.
15711576
cargo_args: &["--all-targets"],
15721577
});

src/doc/rustdoc/src/unstable-features.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,37 @@ themselves marked as unstable. To use any of these options, pass `-Z unstable-op
197197
the flag in question to Rustdoc on the command-line. To do this from Cargo, you can either use the
198198
`RUSTDOCFLAGS` environment variable or the `cargo rustdoc` command.
199199

200+
### `--merge`, `--parts-out-dir`, and `--include-parts-dir`
201+
202+
These options control how rustdoc handles files that combine data from multiple crates.
203+
204+
By default, they act like `--merge=shared` is set, and `--parts-out-dir` and `--include-parts-dir`
205+
are turned off. The `--merge=shared` mode causes rustdoc to load the existing data in the out-dir,
206+
combine the new crate data into it, and write the result. This is very easy to use in scripts that
207+
manually invoke rustdoc, but it's also slow, because it performs O(crates) work on
208+
every crate, meaning it performs O(crates<sup>2</sup>) work.
209+
210+
```console
211+
$ rustdoc crate1.rs --out-dir=doc
212+
$ cat doc/search.index/crateNames/*
213+
rd_("fcrate1")
214+
$ rustdoc crate2.rs --out-dir=doc
215+
$ cat doc/search.index/crateNames/*
216+
rd_("fcrate1fcrate2")
217+
```
218+
219+
To delay shared-data merging until the end of a build, so that you only have to perform O(crates)
220+
work, use `--merge=none` on every crate except the last one, which will use `--merge=finalize`.
221+
222+
```console
223+
$ rustdoc +nightly crate1.rs --merge=none --parts-out-dir=crate1.d -Zunstable-options
224+
$ cat doc/search.index/crateNames/*
225+
cat: 'doc/search.index/crateNames/*': No such file or directory
226+
$ rustdoc +nightly crate2.rs --merge=finalize --include-parts-dir=crate1.d -Zunstable-options
227+
$ cat doc/search.index/crateNames/*
228+
rd_("fcrate1fcrate2")
229+
```
230+
200231
### `--document-hidden-items`: Show items that are `#[doc(hidden)]`
201232
<span id="document-hidden-items"></span>
202233

0 commit comments

Comments
 (0)