Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c992245
refactor: Include table sizes in comment at top of `unicode_data.rs`
Kmeakin Aug 9, 2025
69e1974
refactor: Include size of case conversion tables
Kmeakin Aug 9, 2025
5d54ac5
refactor: rewrite `ranges_from_set`
Kmeakin Aug 10, 2025
30d1bc7
refactor: `generate_tests`
Kmeakin Aug 10, 2025
c3ce079
refactor: Add tests for case conversions
Kmeakin Aug 10, 2025
3b627b5
editorconfig: don't use nonexistant syntax
lolbinarycat Aug 24, 2025
aa27cca
Add a sanity check to bootstrap for wasm-component-ld
alexcrichton Aug 26, 2025
5d81f03
std: Start supporting WASIp2 natively
alexcrichton Aug 26, 2025
8930d3a
resolve: Avoid a regression from splitting prelude into two scopes
petrochenkov Aug 28, 2025
0b1bc65
Explicity disable LSX feature for `loongarch64-unknown-none` target
heiher Aug 30, 2025
1c64d3e
Constify conversion traits
clarfonthey Aug 11, 2025
b2962c3
test(lexer): Ensure frontmatter w/ crlf works
epage Aug 28, 2025
159be09
test(lexer): Ensure frontmatter can contain unicode whitespace
epage Aug 29, 2025
9304aa1
test(lexer): Ensure tabs are accepted for horizontal whitespace
epage Aug 29, 2025
428e413
docs(lexer): Organize and document whitespace by Pattern_White_Space
epage Aug 28, 2025
6f0da97
fix(lexer): Only allow horizontal whitespace in frontmatter
epage Aug 28, 2025
9bd8d17
don't uppercase error messages
scrabsha Sep 1, 2025
03bffa8
CI: rfl: move job forward to Linux v6.17-rc3 plus 2 commits
ojeda Sep 3, 2025
e97edb0
Rollup merge of #145279 - clarfonthey:const-convert-initial, r=tgross35
Zalathar Sep 3, 2025
4eb6212
Rollup merge of #145414 - Kmeakin:km/unicode-table-refactors, r=josht…
Zalathar Sep 3, 2025
867849d
Rollup merge of #145823 - lolbinarycat:editorconfig-fix, r=GuillaumeG…
Zalathar Sep 3, 2025
7744699
Rollup merge of #145944 - alexcrichton:native-wasip2, r=tgross35
Zalathar Sep 3, 2025
20280b1
Rollup merge of #145961 - petrochenkov:extprelregr, r=nnethercote
Zalathar Sep 3, 2025
24d59e3
Rollup merge of #146032 - heiher:loong64-none-no-lsx, r=lqd
Zalathar Sep 3, 2025
dd44c4c
Rollup merge of #146106 - epage:whitespace, r=fee1-dead
Zalathar Sep 3, 2025
63b91e2
Rollup merge of #146112 - scrabsha:push-utkysktvulto, r=WaffleLapkin
Zalathar Sep 3, 2025
546c8b2
Rollup merge of #146154 - ojeda:rfl, r=lqd
Zalathar Sep 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ root = true
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

# some tests need trailing whitespace in output snapshots
[!tests/]
trim_trailing_whitespace = true
[tests/**]
trim_trailing_whitespace = false
# for actual source code files of test, we still don't want trailing whitespace
[tests/**.{rs,js}]
trim_trailing_whitespace = true
# these specific source files need to have trailing whitespace.
[tests/ui/{frontmatter/frontmatter-whitespace-3.rs,parser/shebang/shebang-space.rs}]
trim_trailing_whitespace = false

[!src/llvm-project]
indent_style = space
indent_size = 4
[src/llvm-project]
indent_style = unset
indent_size = unset

[*.rs]
max_line_length = 100
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ attr_parsing_unrecognized_repr_hint =
attr_parsing_unstable_cfg_target_compact =
compact `cfg(target(..))` is experimental and subject to change
attr_parsing_unstable_feature_bound_incompatible_stability = Item annotated with `#[unstable_feature_bound]` should not be stable
attr_parsing_unstable_feature_bound_incompatible_stability = item annotated with `#[unstable_feature_bound]` should not be stable
.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]`
attr_parsing_unsupported_literal_cfg_boolean =
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_codegen_ssa/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ codegen_ssa_dynamic_linking_with_lto =
.note = only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO

codegen_ssa_error_calling_dlltool =
Error calling dlltool '{$dlltool_path}': {$error}
error calling dlltool '{$dlltool_path}': {$error}

codegen_ssa_error_creating_import_library =
Error creating import library for {$lib_name}: {$error}
error creating import library for {$lib_name}: {$error}

codegen_ssa_error_creating_remark_dir = failed to create remark directory: {$error}

codegen_ssa_error_writing_def_file =
Error writing .DEF file: {$error}
error writing .DEF file: {$error}

codegen_ssa_expected_name_value_pair = expected name value pair

Expand Down Expand Up @@ -264,9 +264,9 @@ codegen_ssa_shuffle_indices_evaluation = could not evaluate shuffle_indices at c

codegen_ssa_specify_libraries_to_link = use the `-l` flag to specify native libraries to link

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.
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.

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.
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.

codegen_ssa_stripping_debug_info_failed = stripping debug info with `{$util}` failed: {$status}
.note = {$output}
Expand Down Expand Up @@ -364,13 +364,13 @@ codegen_ssa_unable_to_run = unable to run `{$util}`: {$error}

codegen_ssa_unable_to_run_dsymutil = unable to run `dsymutil`: {$error}

codegen_ssa_unable_to_write_debugger_visualizer = Unable to write debugger visualizer file `{$path}`: {$error}
codegen_ssa_unable_to_write_debugger_visualizer = unable to write debugger visualizer file `{$path}`: {$error}

codegen_ssa_unexpected_parameter_name = unexpected parameter name
.label = expected `{$prefix_nops}` or `{$entry_nops}`

codegen_ssa_unknown_archive_kind =
Don't know how to build archive of type: {$kind}
don't know how to build archive of type: {$kind}

codegen_ssa_unknown_ctarget_feature =
unknown and unstable feature specified for `-Ctarget-feature`: `{$feature}`
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ const_eval_validation_failure =
it is undefined behavior to use this value
const_eval_validation_failure_note =
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.
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.
const_eval_validation_front_matter_invalid_value = constructing invalid value
const_eval_validation_front_matter_invalid_value_with_path = constructing invalid value at {$path}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_driver_impl/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ driver_impl_ice_version = rustc {$version} running on {$triple}

driver_impl_rlink_corrupt_file = corrupt metadata encountered in `{$file}`

driver_impl_rlink_empty_version_number = The input does not contain version number
driver_impl_rlink_empty_version_number = the input does not contain version number

driver_impl_rlink_encoding_version_mismatch = .rlink file was produced with encoding version `{$version_array}`, but the current version is `{$rlink_version}`

Expand All @@ -24,6 +24,6 @@ driver_impl_rlink_rustc_version_mismatch = .rlink file was produced by rustc ver

driver_impl_rlink_unable_to_read = failed to read rlink file: `{$err}`

driver_impl_rlink_wrong_file_type = The input does not look like a .rlink file
driver_impl_rlink_wrong_file_type = the input does not look like a .rlink file

driver_impl_unstable_feature_usage = cannot dump feature usage metrics: {$error}
43 changes: 28 additions & 15 deletions compiler/rustc_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,24 +331,37 @@ pub fn is_whitespace(c: char) -> bool {

matches!(
c,
// Usual ASCII suspects
'\u{0009}' // \t
| '\u{000A}' // \n
// End-of-line characters
| '\u{000A}' // line feed (\n)
| '\u{000B}' // vertical tab
| '\u{000C}' // form feed
| '\u{000D}' // \r
| '\u{0020}' // space

// NEXT LINE from latin1
| '\u{0085}'
| '\u{000D}' // carriage return (\r)
| '\u{0085}' // next line (from latin1)
| '\u{2028}' // LINE SEPARATOR
| '\u{2029}' // PARAGRAPH SEPARATOR

// Bidi markers
// `Default_Ignorable_Code_Point` characters
| '\u{200E}' // LEFT-TO-RIGHT MARK
| '\u{200F}' // RIGHT-TO-LEFT MARK

// Dedicated whitespace characters from Unicode
| '\u{2028}' // LINE SEPARATOR
| '\u{2029}' // PARAGRAPH SEPARATOR
// Horizontal space characters
| '\u{0009}' // tab (\t)
| '\u{0020}' // space
)
}

/// True if `c` is considered horizontal whitespace according to Rust language definition.
pub fn is_horizontal_whitespace(c: char) -> bool {
// This is Pattern_White_Space.
//
// Note that this set is stable (ie, it doesn't change with different
// Unicode versions), so it's ok to just hard-code the values.

matches!(
c,
// Horizontal space characters
'\u{0009}' // tab (\t)
| '\u{0020}' // space
)
}

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

// whitespace between the opening and the infostring.
self.eat_while(|ch| ch != '\n' && is_whitespace(ch));
self.eat_while(|ch| ch != '\n' && is_horizontal_whitespace(ch));

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

self.eat_while(|ch| ch != '\n' && is_whitespace(ch));
self.eat_while(|ch| ch != '\n' && is_horizontal_whitespace(ch));
let invalid_infostring = self.first() != '\n';

let mut found = false;
Expand Down Expand Up @@ -588,7 +601,7 @@ impl Cursor<'_> {
// on a standalone line. Might be wrong.
while let Some(closing) = rest.find("---") {
let preceding_chars_start = rest[..closing].rfind("\n").map_or(0, |i| i + 1);
if rest[preceding_chars_start..closing].chars().all(is_whitespace) {
if rest[preceding_chars_start..closing].chars().all(is_horizontal_whitespace) {
// candidate found
potential_closing = Some(closing);
break;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ parse_async_use_order_incorrect = the order of `use` and `async` is incorrect
parse_at_dot_dot_in_struct_pattern = `@ ..` is not supported in struct patterns
.suggestion = bind to each field separately or, if you don't need them, just remove `{$ident} @`
parse_at_in_struct_pattern = Unexpected `@` in struct pattern
parse_at_in_struct_pattern = unexpected `@` in struct pattern
.note = struct patterns use `field: pattern` syntax to bind to fields
.help = consider replacing `new_name @ field_name` with `field_name: new_name` if that is what you intended
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_parse/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_ast::util::unicode::{TEXT_FLOW_CONTROL_CHARS, contains_text_flow_contr
use rustc_errors::codes::*;
use rustc_errors::{Applicability, Diag, DiagCtxtHandle, StashKey};
use rustc_lexer::{
Base, Cursor, DocStyle, FrontmatterAllowed, LiteralKind, RawStrError, is_whitespace,
Base, Cursor, DocStyle, FrontmatterAllowed, LiteralKind, RawStrError, is_horizontal_whitespace,
};
use rustc_literal_escaper::{EscapeError, Mode, check_for_errors};
use rustc_session::lint::BuiltinLintDiag;
Expand Down Expand Up @@ -597,7 +597,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> {

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

let frontmatter_span = self.mk_sp(frontmatter_opening_pos, self.pos);
Expand Down Expand Up @@ -640,7 +640,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
});
}

if !rest.trim_matches(is_whitespace).is_empty() {
if !rest.trim_matches(is_horizontal_whitespace).is_empty() {
let span = self.mk_sp(last_line_start_pos, self.pos);
self.dcx().emit_err(errors::FrontmatterExtraCharactersAfterClose { span });
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_query_system/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ query_system_cycle_usage = cycle used when {$usage}
query_system_increment_compilation = internal compiler error: encountered incremental compilation error with {$dep_node}
.help = This is a known issue with the compiler. Run {$run_cmd} to allow your project to compile

query_system_increment_compilation_note1 = Please follow the instructions below to create a bug report with the provided information
query_system_increment_compilation_note2 = See <https://github.com/rust-lang/rust/issues/84970> for more information
query_system_increment_compilation_note1 = please follow the instructions below to create a bug report with the provided information
query_system_increment_compilation_note2 = see <https://github.com/rust-lang/rust/issues/84970> for more information

query_system_overflow_note = query depth increased by {$depth} when {$desc}

Expand Down
23 changes: 20 additions & 3 deletions compiler/rustc_resolve/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
// to detect potential ambiguities.
let mut innermost_result: Option<(NameBinding<'_>, Flags)> = None;
let mut determinacy = Determinacy::Determined;
let mut extern_prelude_item_binding = None;
let mut extern_prelude_flag_binding = None;
// Shadowed bindings don't need to be marked as used or non-speculatively loaded.
macro finalize_scope() {
if innermost_result.is_none() { finalize } else { None }
Expand Down Expand Up @@ -558,15 +560,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
Scope::ExternPreludeItems => {
// FIXME: use `finalize_scope` here.
match this.reborrow().extern_prelude_get_item(ident, finalize.is_some()) {
Some(binding) => Ok((binding, Flags::empty())),
Some(binding) => {
extern_prelude_item_binding = Some(binding);
Ok((binding, Flags::empty()))
}
None => Err(Determinacy::determined(
this.graph_root.unexpanded_invocations.borrow().is_empty(),
)),
}
}
Scope::ExternPreludeFlags => {
match this.extern_prelude_get_flag(ident, finalize_scope!().is_some()) {
Some(binding) => Ok((binding, Flags::empty())),
Some(binding) => {
extern_prelude_flag_binding = Some(binding);
Ok((binding, Flags::empty()))
}
None => Err(Determinacy::Determined),
}
}
Expand Down Expand Up @@ -686,7 +694,16 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
} else {
None
};
if let Some(kind) = ambiguity_error_kind {
// Skip ambiguity errors for extern flag bindings "overridden"
// by extern item bindings.
// FIXME: Remove with lang team approval.
let issue_145575_hack = Some(binding)
== extern_prelude_flag_binding
&& extern_prelude_item_binding.is_some()
&& extern_prelude_item_binding != Some(innermost_binding);
if let Some(kind) = ambiguity_error_kind
&& !issue_145575_hack
{
let misc = |f: Flags| {
if f.contains(Flags::MISC_SUGGEST_CRATE) {
AmbiguityErrorMisc::SuggestCrate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
arch: "loongarch64".into(),
options: TargetOptions {
cpu: "generic".into(),
features: "+f,+d".into(),
features: "+f,+d,-lsx".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
llvm_abiname: "lp64d".into(),
Expand Down
24 changes: 23 additions & 1 deletion library/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ dependencies = [
"rustc-demangle",
"std_detect",
"unwind",
"wasi",
"wasi 0.11.1+wasi-snapshot-preview1",
"wasi 0.14.3+wasi-0.2.4",
"windows-targets 0.0.0",
]

Expand Down Expand Up @@ -399,6 +400,17 @@ dependencies = [
"rustc-std-workspace-core",
]

[[package]]
name = "wasi"
version = "0.14.3+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a51ae83037bdd272a9e28ce236db8c07016dd0d50c27038b3f407533c030c95"
dependencies = [
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
"wit-bindgen",
]

[[package]]
name = "windows-sys"
version = "0.59.0"
Expand Down Expand Up @@ -475,3 +487,13 @@ name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"

[[package]]
name = "wit-bindgen"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814"
dependencies = [
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
]
15 changes: 11 additions & 4 deletions library/alloc/src/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ use crate::fmt;
use crate::string::String;

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl<'a, B: ?Sized> const Borrow<B> for Cow<'a, B>
where
B: ToOwned,
B::Owned: [const] Borrow<B>,
{
fn borrow(&self) -> &B {
&**self
Expand Down Expand Up @@ -326,9 +328,10 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<B: ?Sized + ToOwned> Deref for Cow<'_, B>
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl<B: ?Sized + ToOwned> const Deref for Cow<'_, B>
where
B::Owned: Borrow<B>,
B::Owned: [const] Borrow<B>,
{
type Target = B;

Expand Down Expand Up @@ -439,7 +442,11 @@ where
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + ToOwned> AsRef<T> for Cow<'_, T> {
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl<T: ?Sized + ToOwned> const AsRef<T> for Cow<'_, T>
where
T::Owned: [const] Borrow<T>,
{
fn as_ref(&self) -> &T {
self
}
Expand Down
6 changes: 4 additions & 2 deletions library/alloc/src/collections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,19 @@ pub use realalloc::collections::TryReserveErrorKind;
reason = "Uncertain how much info should be exposed",
issue = "48043"
)]
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
#[cfg(not(test))]
impl From<TryReserveErrorKind> for TryReserveError {
impl const From<TryReserveErrorKind> for TryReserveError {
#[inline]
fn from(kind: TryReserveErrorKind) -> Self {
Self { kind }
}
}

#[unstable(feature = "try_reserve_kind", reason = "new API", issue = "48043")]
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
#[cfg(not(test))]
impl From<LayoutError> for TryReserveErrorKind {
impl const From<LayoutError> for TryReserveErrorKind {
/// Always evaluates to [`TryReserveErrorKind::CapacityOverflow`].
#[inline]
fn from(_: LayoutError) -> Self {
Expand Down
Loading
Loading