Skip to content

Commit 0cae2f9

Browse files
committed
Auto merge of #146157 - Zalathar:rollup-0w8r7g6, r=Zalathar
Rollup of 9 pull requests Successful merges: - #145279 (Constify conversion traits (part 1)) - #145414 (unicode-table-generator refactors) - #145823 (editorconfig: don't use nonexistent syntax) - #145944 (std: Start supporting WASIp2 natively ) - #145961 (resolve: Avoid a regression from splitting prelude into two scopes) - #146032 (Explicity disable LSX feature for `loongarch64-unknown-none` target) - #146106 (fix(lexer): Only allow horizontal whitespace in frontmatter ) - #146112 (don't uppercase error messages) - #146154 (CI: rfl: move job forward to Linux v6.17-rc3 plus 2 commits) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 51ff895 + 546c8b2 commit 0cae2f9

File tree

132 files changed

+1024
-620
lines changed

Some content is hidden

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

132 files changed

+1024
-620
lines changed

.editorconfig

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@ root = true
88
end_of_line = lf
99
charset = utf-8
1010
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
indent_style = space
13+
indent_size = 4
1114

1215
# some tests need trailing whitespace in output snapshots
13-
[!tests/]
14-
trim_trailing_whitespace = true
16+
[tests/**]
17+
trim_trailing_whitespace = false
1518
# for actual source code files of test, we still don't want trailing whitespace
1619
[tests/**.{rs,js}]
1720
trim_trailing_whitespace = true
1821
# these specific source files need to have trailing whitespace.
1922
[tests/ui/{frontmatter/frontmatter-whitespace-3.rs,parser/shebang/shebang-space.rs}]
2023
trim_trailing_whitespace = false
2124

22-
[!src/llvm-project]
23-
indent_style = space
24-
indent_size = 4
25+
[src/llvm-project]
26+
indent_style = unset
27+
indent_size = unset
2528

2629
[*.rs]
2730
max_line_length = 100

compiler/rustc_attr_parsing/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ attr_parsing_unrecognized_repr_hint =
151151
attr_parsing_unstable_cfg_target_compact =
152152
compact `cfg(target(..))` is experimental and subject to change
153153
154-
attr_parsing_unstable_feature_bound_incompatible_stability = Item annotated with `#[unstable_feature_bound]` should not be stable
154+
attr_parsing_unstable_feature_bound_incompatible_stability = item annotated with `#[unstable_feature_bound]` should not be stable
155155
.help = If this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`
156156
157157
attr_parsing_unsupported_literal_cfg_boolean =

compiler/rustc_codegen_ssa/messages.ftl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ codegen_ssa_dynamic_linking_with_lto =
4040
.note = only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO
4141
4242
codegen_ssa_error_calling_dlltool =
43-
Error calling dlltool '{$dlltool_path}': {$error}
43+
error calling dlltool '{$dlltool_path}': {$error}
4444
4545
codegen_ssa_error_creating_import_library =
46-
Error creating import library for {$lib_name}: {$error}
46+
error creating import library for {$lib_name}: {$error}
4747
4848
codegen_ssa_error_creating_remark_dir = failed to create remark directory: {$error}
4949
5050
codegen_ssa_error_writing_def_file =
51-
Error writing .DEF file: {$error}
51+
error writing .DEF file: {$error}
5252
5353
codegen_ssa_expected_name_value_pair = expected name value pair
5454
@@ -264,9 +264,9 @@ codegen_ssa_shuffle_indices_evaluation = could not evaluate shuffle_indices at c
264264
265265
codegen_ssa_specify_libraries_to_link = use the `-l` flag to specify native libraries to link
266266
267-
codegen_ssa_static_library_native_artifacts = Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.
267+
codegen_ssa_static_library_native_artifacts = link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.
268268
269-
codegen_ssa_static_library_native_artifacts_to_file = Native artifacts to link against have been written to {$path}. The order and any duplication can be significant on some platforms.
269+
codegen_ssa_static_library_native_artifacts_to_file = native artifacts to link against have been written to {$path}. The order and any duplication can be significant on some platforms.
270270
271271
codegen_ssa_stripping_debug_info_failed = stripping debug info with `{$util}` failed: {$status}
272272
.note = {$output}
@@ -364,13 +364,13 @@ codegen_ssa_unable_to_run = unable to run `{$util}`: {$error}
364364
365365
codegen_ssa_unable_to_run_dsymutil = unable to run `dsymutil`: {$error}
366366
367-
codegen_ssa_unable_to_write_debugger_visualizer = Unable to write debugger visualizer file `{$path}`: {$error}
367+
codegen_ssa_unable_to_write_debugger_visualizer = unable to write debugger visualizer file `{$path}`: {$error}
368368
369369
codegen_ssa_unexpected_parameter_name = unexpected parameter name
370370
.label = expected `{$prefix_nops}` or `{$entry_nops}`
371371
372372
codegen_ssa_unknown_archive_kind =
373-
Don't know how to build archive of type: {$kind}
373+
don't know how to build archive of type: {$kind}
374374
375375
codegen_ssa_unknown_ctarget_feature =
376376
unknown and unstable feature specified for `-Ctarget-feature`: `{$feature}`

compiler/rustc_const_eval/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ const_eval_validation_failure =
457457
it is undefined behavior to use this value
458458
459459
const_eval_validation_failure_note =
460-
The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
460+
the rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
461461
462462
const_eval_validation_front_matter_invalid_value = constructing invalid value
463463
const_eval_validation_front_matter_invalid_value_with_path = constructing invalid value at {$path}

compiler/rustc_driver_impl/messages.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ driver_impl_ice_version = rustc {$version} running on {$triple}
1414
1515
driver_impl_rlink_corrupt_file = corrupt metadata encountered in `{$file}`
1616
17-
driver_impl_rlink_empty_version_number = The input does not contain version number
17+
driver_impl_rlink_empty_version_number = the input does not contain version number
1818
1919
driver_impl_rlink_encoding_version_mismatch = .rlink file was produced with encoding version `{$version_array}`, but the current version is `{$rlink_version}`
2020
@@ -24,6 +24,6 @@ driver_impl_rlink_rustc_version_mismatch = .rlink file was produced by rustc ver
2424
2525
driver_impl_rlink_unable_to_read = failed to read rlink file: `{$err}`
2626
27-
driver_impl_rlink_wrong_file_type = The input does not look like a .rlink file
27+
driver_impl_rlink_wrong_file_type = the input does not look like a .rlink file
2828
2929
driver_impl_unstable_feature_usage = cannot dump feature usage metrics: {$error}

compiler/rustc_lexer/src/lib.rs

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -331,24 +331,37 @@ pub fn is_whitespace(c: char) -> bool {
331331

332332
matches!(
333333
c,
334-
// Usual ASCII suspects
335-
'\u{0009}' // \t
336-
| '\u{000A}' // \n
334+
// End-of-line characters
335+
| '\u{000A}' // line feed (\n)
337336
| '\u{000B}' // vertical tab
338337
| '\u{000C}' // form feed
339-
| '\u{000D}' // \r
340-
| '\u{0020}' // space
341-
342-
// NEXT LINE from latin1
343-
| '\u{0085}'
338+
| '\u{000D}' // carriage return (\r)
339+
| '\u{0085}' // next line (from latin1)
340+
| '\u{2028}' // LINE SEPARATOR
341+
| '\u{2029}' // PARAGRAPH SEPARATOR
344342

345-
// Bidi markers
343+
// `Default_Ignorable_Code_Point` characters
346344
| '\u{200E}' // LEFT-TO-RIGHT MARK
347345
| '\u{200F}' // RIGHT-TO-LEFT MARK
348346

349-
// Dedicated whitespace characters from Unicode
350-
| '\u{2028}' // LINE SEPARATOR
351-
| '\u{2029}' // PARAGRAPH SEPARATOR
347+
// Horizontal space characters
348+
| '\u{0009}' // tab (\t)
349+
| '\u{0020}' // space
350+
)
351+
}
352+
353+
/// True if `c` is considered horizontal whitespace according to Rust language definition.
354+
pub fn is_horizontal_whitespace(c: char) -> bool {
355+
// This is Pattern_White_Space.
356+
//
357+
// Note that this set is stable (ie, it doesn't change with different
358+
// Unicode versions), so it's ok to just hard-code the values.
359+
360+
matches!(
361+
c,
362+
// Horizontal space characters
363+
'\u{0009}' // tab (\t)
364+
| '\u{0020}' // space
352365
)
353366
}
354367

@@ -538,7 +551,7 @@ impl Cursor<'_> {
538551
debug_assert!(length_opening >= 3);
539552

540553
// whitespace between the opening and the infostring.
541-
self.eat_while(|ch| ch != '\n' && is_whitespace(ch));
554+
self.eat_while(|ch| ch != '\n' && is_horizontal_whitespace(ch));
542555

543556
// copied from `eat_identifier`, but allows `-` and `.` in infostring to allow something like
544557
// `---Cargo.toml` as a valid opener
@@ -547,7 +560,7 @@ impl Cursor<'_> {
547560
self.eat_while(|c| is_id_continue(c) || c == '-' || c == '.');
548561
}
549562

550-
self.eat_while(|ch| ch != '\n' && is_whitespace(ch));
563+
self.eat_while(|ch| ch != '\n' && is_horizontal_whitespace(ch));
551564
let invalid_infostring = self.first() != '\n';
552565

553566
let mut found = false;
@@ -588,7 +601,7 @@ impl Cursor<'_> {
588601
// on a standalone line. Might be wrong.
589602
while let Some(closing) = rest.find("---") {
590603
let preceding_chars_start = rest[..closing].rfind("\n").map_or(0, |i| i + 1);
591-
if rest[preceding_chars_start..closing].chars().all(is_whitespace) {
604+
if rest[preceding_chars_start..closing].chars().all(is_horizontal_whitespace) {
592605
// candidate found
593606
potential_closing = Some(closing);
594607
break;

compiler/rustc_parse/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ parse_async_use_order_incorrect = the order of `use` and `async` is incorrect
5858
parse_at_dot_dot_in_struct_pattern = `@ ..` is not supported in struct patterns
5959
.suggestion = bind to each field separately or, if you don't need them, just remove `{$ident} @`
6060
61-
parse_at_in_struct_pattern = Unexpected `@` in struct pattern
61+
parse_at_in_struct_pattern = unexpected `@` in struct pattern
6262
.note = struct patterns use `field: pattern` syntax to bind to fields
6363
.help = consider replacing `new_name @ field_name` with `field_name: new_name` if that is what you intended
6464

compiler/rustc_parse/src/lexer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_ast::util::unicode::{TEXT_FLOW_CONTROL_CHARS, contains_text_flow_contr
66
use rustc_errors::codes::*;
77
use rustc_errors::{Applicability, Diag, DiagCtxtHandle, StashKey};
88
use rustc_lexer::{
9-
Base, Cursor, DocStyle, FrontmatterAllowed, LiteralKind, RawStrError, is_whitespace,
9+
Base, Cursor, DocStyle, FrontmatterAllowed, LiteralKind, RawStrError, is_horizontal_whitespace,
1010
};
1111
use rustc_literal_escaper::{EscapeError, Mode, check_for_errors};
1212
use rustc_session::lint::BuiltinLintDiag;
@@ -597,7 +597,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
597597

598598
let last_line_start = within.rfind('\n').map_or(0, |i| i + 1);
599599
let last_line = &within[last_line_start..];
600-
let last_line_trimmed = last_line.trim_start_matches(is_whitespace);
600+
let last_line_trimmed = last_line.trim_start_matches(is_horizontal_whitespace);
601601
let last_line_start_pos = frontmatter_opening_end_pos + BytePos(last_line_start as u32);
602602

603603
let frontmatter_span = self.mk_sp(frontmatter_opening_pos, self.pos);
@@ -640,7 +640,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
640640
});
641641
}
642642

643-
if !rest.trim_matches(is_whitespace).is_empty() {
643+
if !rest.trim_matches(is_horizontal_whitespace).is_empty() {
644644
let span = self.mk_sp(last_line_start_pos, self.pos);
645645
self.dcx().emit_err(errors::FrontmatterExtraCharactersAfterClose { span });
646646
}

compiler/rustc_query_system/messages.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ query_system_cycle_usage = cycle used when {$usage}
1818
query_system_increment_compilation = internal compiler error: encountered incremental compilation error with {$dep_node}
1919
.help = This is a known issue with the compiler. Run {$run_cmd} to allow your project to compile
2020
21-
query_system_increment_compilation_note1 = Please follow the instructions below to create a bug report with the provided information
22-
query_system_increment_compilation_note2 = See <https://github.com/rust-lang/rust/issues/84970> for more information
21+
query_system_increment_compilation_note1 = please follow the instructions below to create a bug report with the provided information
22+
query_system_increment_compilation_note2 = see <https://github.com/rust-lang/rust/issues/84970> for more information
2323
2424
query_system_overflow_note = query depth increased by {$depth} when {$desc}
2525

compiler/rustc_resolve/src/ident.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
422422
// to detect potential ambiguities.
423423
let mut innermost_result: Option<(NameBinding<'_>, Flags)> = None;
424424
let mut determinacy = Determinacy::Determined;
425+
let mut extern_prelude_item_binding = None;
426+
let mut extern_prelude_flag_binding = None;
425427
// Shadowed bindings don't need to be marked as used or non-speculatively loaded.
426428
macro finalize_scope() {
427429
if innermost_result.is_none() { finalize } else { None }
@@ -558,15 +560,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
558560
Scope::ExternPreludeItems => {
559561
// FIXME: use `finalize_scope` here.
560562
match this.reborrow().extern_prelude_get_item(ident, finalize.is_some()) {
561-
Some(binding) => Ok((binding, Flags::empty())),
563+
Some(binding) => {
564+
extern_prelude_item_binding = Some(binding);
565+
Ok((binding, Flags::empty()))
566+
}
562567
None => Err(Determinacy::determined(
563568
this.graph_root.unexpanded_invocations.borrow().is_empty(),
564569
)),
565570
}
566571
}
567572
Scope::ExternPreludeFlags => {
568573
match this.extern_prelude_get_flag(ident, finalize_scope!().is_some()) {
569-
Some(binding) => Ok((binding, Flags::empty())),
574+
Some(binding) => {
575+
extern_prelude_flag_binding = Some(binding);
576+
Ok((binding, Flags::empty()))
577+
}
570578
None => Err(Determinacy::Determined),
571579
}
572580
}
@@ -686,7 +694,16 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
686694
} else {
687695
None
688696
};
689-
if let Some(kind) = ambiguity_error_kind {
697+
// Skip ambiguity errors for extern flag bindings "overridden"
698+
// by extern item bindings.
699+
// FIXME: Remove with lang team approval.
700+
let issue_145575_hack = Some(binding)
701+
== extern_prelude_flag_binding
702+
&& extern_prelude_item_binding.is_some()
703+
&& extern_prelude_item_binding != Some(innermost_binding);
704+
if let Some(kind) = ambiguity_error_kind
705+
&& !issue_145575_hack
706+
{
690707
let misc = |f: Flags| {
691708
if f.contains(Flags::MISC_SUGGEST_CRATE) {
692709
AmbiguityErrorMisc::SuggestCrate

0 commit comments

Comments
 (0)