From 7530fc140bf8f60d2829086f669aed0fcffaaa45 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Tue, 3 Nov 2026 22:19:23 -0800 Subject: [PATCH 01/34] Mark the compile unit for `-Zdebuginfo-for-profiling` With `-Zdebuginfo-for-profiling`, set `debugInfoForProfiling` on the `DICompileUnit`, as Clang does for `-fdebug-info-for-profiling` (`CGDebugInfo.cpp`). Before this change, the flag only added the discriminators pass, and the compile unit flag was always false. --- compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 1 + compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 1 + compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 5 +++-- tests/codegen-llvm/debuginfo-for-profiling.rs | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index 752cbc67d5637..585d0b20420a4 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1007,6 +1007,7 @@ pub(crate) fn build_compile_unit_di_node<'ll, 'tcx>( kind, 0, tcx.sess.opts.unstable_opts.split_dwarf_inlining, + tcx.sess.opts.unstable_opts.debuginfo_for_profiling, debug_name_table_kind, ); diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 9c2ab218a02ec..28e401bf79d97 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -2259,6 +2259,7 @@ unsafe extern "C" { kind: DebugEmissionKind, DWOId: u64, SplitDebugInlining: bool, + DebugInfoForProfiling: bool, DebugNameTableKind: DebugNameTableKind, ) -> &'a DIDescriptor; diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index b1d3b2131812d..d723d8aa97167 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1007,13 +1007,14 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateCompileUnit( const char *Producer, size_t ProducerLen, bool isOptimized, const char *Flags, unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen, LLVMRustDebugEmissionKind Kind, uint64_t DWOId, - bool SplitDebugInlining, LLVMRustDebugNameTableKind TableKind) { + bool SplitDebugInlining, bool DebugInfoForProfiling, + LLVMRustDebugNameTableKind TableKind) { auto *File = unwrapDI(FileRef); return wrap(unwrap(Builder)->createCompileUnit( Lang, File, StringRef(Producer, ProducerLen), isOptimized, Flags, RuntimeVer, StringRef(SplitName, SplitNameLen), fromRust(Kind), DWOId, - SplitDebugInlining, false, fromRust(TableKind))); + SplitDebugInlining, DebugInfoForProfiling, fromRust(TableKind))); } extern "C" LLVMMetadataRef diff --git a/tests/codegen-llvm/debuginfo-for-profiling.rs b/tests/codegen-llvm/debuginfo-for-profiling.rs index f7e401415ac7e..38d87d4b95712 100644 --- a/tests/codegen-llvm/debuginfo-for-profiling.rs +++ b/tests/codegen-llvm/debuginfo-for-profiling.rs @@ -1,6 +1,7 @@ // Verify that additional discriminators are emitted for profiling with `-Zdebuginfo-for-profiling`: // - 0 discriminators are emitted without the flag in the test below // - at least 1 discriminator is emitted with the flag in the test below +// - the compile unit has `debugInfoForProfiling: true` only with the flag // // //@ add-minicore @@ -8,6 +9,8 @@ //@ compile-flags: -Copt-level=2 -Cdebuginfo=line-tables-only //@ [DEBUGINFO] compile-flags: -Zdebuginfo-for-profiling // DEFAULT-NOT: discriminator +// DEFAULT-NOT: debugInfoForProfiling +// DEBUGINFO: !DICompileUnit({{.*}}debugInfoForProfiling: true // DEBUGINFO-COUNT-1: discriminator #![feature(no_core)] From 1a9e1762e264e14f90cb5b60c439fd2b8dbae9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Wed, 4 Nov 2026 23:05:20 +0100 Subject: [PATCH 02/34] Don't blindly say that a macro call doesn't expand to a certain fragment Just because the parser of a specific syntax fragment kind returns an `Err(_)` doesn't automatically mean that the problematic token sequence isn't "of" that fragment's kind. The token sequence might "almost" be of that kind (i.e., share a non-empty prefix) but simply contain a syntax error in it. On a side note, it's rather odd that the now removed `annotate_err_with_kind` only added the note "this macro call doesn't expand to a $fragkind" if the target fragment kind was *type* or *pat*, there are 20 kinds at the of writing. --- compiler/rustc_expand/src/expand.rs | 2 -- compiler/rustc_expand/src/mbe/diagnostics.rs | 16 ++-------------- .../early/macro_rules-braces.stderr | 4 ++-- .../min_const_generics/macro-fail-const.stderr | 10 ++-------- .../min_const_generics/macro-fail.stderr | 15 +++------------ .../derives/debug/nonsense-input-to-debug.stderr | 1 - .../field_representing_types/invalid.next.stderr | 15 +++------------ .../field_representing_types/invalid.old.stderr | 15 +++------------ tests/ui/macros/macro-interpolation.stderr | 5 +---- tests/ui/proc-macro/lifetimes.stderr | 5 +---- 10 files changed, 17 insertions(+), 71 deletions(-) diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index b9c1bb9545d2f..933d702150285 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -41,7 +41,6 @@ use crate::diagnostics::{ GlobDelegationTraitlessQpath, IncompleteParse, RecursionLimitReached, RemoveExprNotSupported, UnsupportedKeyValue, WrongFragmentKind, }; -use crate::mbe::diagnostics::annotate_err_with_kind; use crate::module::{ DirOwnership, ParsedExternalMod, mod_dir_path, mod_file_path_from_attr, parse_external_mod, }; @@ -1067,7 +1066,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> { if err.span.is_dummy() { err.span(span); } - annotate_err_with_kind(&mut err, kind, span); let guar = err.emit_err(); self.cx.macro_error_and_trace_macros_diag(); kind.dummy(span, guar) diff --git a/compiler/rustc_expand/src/mbe/diagnostics.rs b/compiler/rustc_expand/src/mbe/diagnostics.rs index c724857d572ec..281f55f8ec090 100644 --- a/compiler/rustc_expand/src/mbe/diagnostics.rs +++ b/compiler/rustc_expand/src/mbe/diagnostics.rs @@ -434,8 +434,8 @@ pub(super) fn emit_frag_parse_err( } } }, - _ => annotate_err_with_kind(&mut e, kind, site_span), - }; + _ => {} + } if parser.token.kind == token::Dollar { let dollar_span = parser.token.span; @@ -504,18 +504,6 @@ pub(super) fn emit_frag_parse_err( e.emit_err() } -pub(crate) fn annotate_err_with_kind(err: &mut Diag<'_>, kind: AstFragmentKind, span: Span) { - match kind { - AstFragmentKind::Ty => { - err.span_label(span, "this macro call doesn't expand to a type"); - } - AstFragmentKind::Pat => { - err.span_label(span, "this macro call doesn't expand to a pattern"); - } - _ => {} - }; -} - #[derive(Subdiagnostic)] enum ExplainDocComment { #[label( diff --git a/tests/ui/const-generics/early/macro_rules-braces.stderr b/tests/ui/const-generics/early/macro_rules-braces.stderr index 6cc9a67f194b7..98e905d71c04b 100644 --- a/tests/ui/const-generics/early/macro_rules-braces.stderr +++ b/tests/ui/const-generics/early/macro_rules-braces.stderr @@ -2,7 +2,7 @@ error: expressions must be enclosed in braces to be used as const generic argume --> $DIR/macro_rules-braces.rs:44:17 | LL | let _: baz!(m::P); - | -----^^^^- this macro call doesn't expand to a type + | ^^^^ | help: enclose the `const` expression in braces | @@ -13,7 +13,7 @@ error: expressions must be enclosed in braces to be used as const generic argume --> $DIR/macro_rules-braces.rs:64:17 | LL | let _: baz!(10 + 7); - | -----^^^^^^- this macro call doesn't expand to a type + | ^^^^^^ | help: enclose the `const` expression in braces | diff --git a/tests/ui/const-generics/min_const_generics/macro-fail-const.stderr b/tests/ui/const-generics/min_const_generics/macro-fail-const.stderr index 2fa529c750d10..2688675f3aa43 100644 --- a/tests/ui/const-generics/min_const_generics/macro-fail-const.stderr +++ b/tests/ui/const-generics/min_const_generics/macro-fail-const.stderr @@ -2,10 +2,7 @@ error: expected type, found `{` --> $DIR/macro-fail-const.rs:16:27 | LL | fn make_marker() -> impl Marker { - | ---------------------- - | | - | this macro call doesn't expand to a type - | in this macro invocation + | ---------------------- in this macro invocation ... LL | macro_rules! gimme_a_const { LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} @@ -15,10 +12,7 @@ error: expected type, found `{` --> $DIR/macro-fail-const.rs:16:27 | LL | Example:: - | ---------------------- - | | - | this macro call doesn't expand to a type - | in this macro invocation + | ---------------------- in this macro invocation ... LL | macro_rules! gimme_a_const { LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} diff --git a/tests/ui/const-generics/min_const_generics/macro-fail.stderr b/tests/ui/const-generics/min_const_generics/macro-fail.stderr index 23eeec7f6daa0..c190ceb40a82d 100644 --- a/tests/ui/const-generics/min_const_generics/macro-fail.stderr +++ b/tests/ui/const-generics/min_const_generics/macro-fail.stderr @@ -2,10 +2,7 @@ error: expected type, found `{` --> $DIR/macro-fail.rs:27:27 | LL | fn make_marker() -> impl Marker { - | ---------------------- - | | - | this macro call doesn't expand to a type - | in this macro invocation + | ---------------------- in this macro invocation ... LL | macro_rules! gimme_a_const { LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} @@ -15,10 +12,7 @@ error: expected type, found `{` --> $DIR/macro-fail.rs:27:27 | LL | Example:: - | ---------------------- - | | - | this macro call doesn't expand to a type - | in this macro invocation + | ---------------------- in this macro invocation ... LL | macro_rules! gimme_a_const { LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }} @@ -32,10 +26,7 @@ LL | () => {{ | ^ expected type ... LL | let _fail = Example::; - | ----------------- - | | - | this macro call doesn't expand to a type - | in this macro invocation + | ----------------- in this macro invocation error: unexpected end of macro invocation --> $DIR/macro-fail.rs:36:25 diff --git a/tests/ui/derives/debug/nonsense-input-to-debug.stderr b/tests/ui/derives/debug/nonsense-input-to-debug.stderr index 207d7b1969de5..ee35d5e624856 100644 --- a/tests/ui/derives/debug/nonsense-input-to-debug.stderr +++ b/tests/ui/derives/debug/nonsense-input-to-debug.stderr @@ -12,7 +12,6 @@ LL | should_be_vec_t: vec![T], | | | expected type | in this macro invocation - | this macro call doesn't expand to a type error[E0392]: type parameter `T` is never used --> $DIR/nonsense-input-to-debug.rs:5:17 diff --git a/tests/ui/field_representing_types/invalid.next.stderr b/tests/ui/field_representing_types/invalid.next.stderr index 82b2aa81451ab..3d6775fe8b376 100644 --- a/tests/ui/field_representing_types/invalid.next.stderr +++ b/tests/ui/field_representing_types/invalid.next.stderr @@ -37,10 +37,7 @@ error: `field_of` expects dot-separated field and variant names --> $DIR/invalid.rs:28:12 | LL | let _: field_of!(Enum, Variant..field); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | in this macro invocation - | this macro call doesn't expand to a type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation error: offset_of expects dot-separated field and variant names --> $DIR/invalid.rs:30:30 @@ -52,19 +49,13 @@ error: `field_of` expects dot-separated field and variant names --> $DIR/invalid.rs:30:12 | LL | let _: field_of!(Struct, [42]); - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | in this macro invocation - | this macro call doesn't expand to a type + | ^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation error: `field_of` only supports a single field or a variant with a field --> $DIR/invalid.rs:32:30 | LL | let _: field_of!(Struct, field1.field2.field3); - | ------------------^^^^^^-^^^^^^-^^^^^^- - | | - | in this macro invocation - | this macro call doesn't expand to a type + | ------------------^^^^^^-^^^^^^-^^^^^^- in this macro invocation error: aborting due to 8 previous errors diff --git a/tests/ui/field_representing_types/invalid.old.stderr b/tests/ui/field_representing_types/invalid.old.stderr index 82b2aa81451ab..3d6775fe8b376 100644 --- a/tests/ui/field_representing_types/invalid.old.stderr +++ b/tests/ui/field_representing_types/invalid.old.stderr @@ -37,10 +37,7 @@ error: `field_of` expects dot-separated field and variant names --> $DIR/invalid.rs:28:12 | LL | let _: field_of!(Enum, Variant..field); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | in this macro invocation - | this macro call doesn't expand to a type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation error: offset_of expects dot-separated field and variant names --> $DIR/invalid.rs:30:30 @@ -52,19 +49,13 @@ error: `field_of` expects dot-separated field and variant names --> $DIR/invalid.rs:30:12 | LL | let _: field_of!(Struct, [42]); - | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | in this macro invocation - | this macro call doesn't expand to a type + | ^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation error: `field_of` only supports a single field or a variant with a field --> $DIR/invalid.rs:32:30 | LL | let _: field_of!(Struct, field1.field2.field3); - | ------------------^^^^^^-^^^^^^-^^^^^^- - | | - | in this macro invocation - | this macro call doesn't expand to a type + | ------------------^^^^^^-^^^^^^-^^^^^^- in this macro invocation error: aborting due to 8 previous errors diff --git a/tests/ui/macros/macro-interpolation.stderr b/tests/ui/macros/macro-interpolation.stderr index 3dc6ef6132d2a..304e7311e2d4e 100644 --- a/tests/ui/macros/macro-interpolation.stderr +++ b/tests/ui/macros/macro-interpolation.stderr @@ -7,10 +7,7 @@ LL | <$type as $trait>::$name | ^^^^^^ expected identifier, found metavariable ... LL | let _: qpath!(ty, ::Owned); - | ----------------------------- - | | - | this macro call doesn't expand to a type - | in this macro invocation + | ----------------------------- in this macro invocation error: aborting due to 1 previous error diff --git a/tests/ui/proc-macro/lifetimes.stderr b/tests/ui/proc-macro/lifetimes.stderr index 315b4c5917243..aa5ef8559ced3 100644 --- a/tests/ui/proc-macro/lifetimes.stderr +++ b/tests/ui/proc-macro/lifetimes.stderr @@ -2,10 +2,7 @@ error: expected type, found `'` --> $DIR/lifetimes.rs:7:10 | LL | type A = single_quote_alone!(); - | ^^^^^^^^^^^^^^^^^^^^^ - | | - | expected type - | this macro call doesn't expand to a type + | ^^^^^^^^^^^^^^^^^^^^^ expected type | = note: this error originates in the macro `single_quote_alone` (in Nightly builds, run with -Z macro-backtrace for more info) From a7c41c15cf36bd3303727272b649404a6476be4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Thu, 3 Sep 2026 18:00:16 +0200 Subject: [PATCH 03/34] Turn `pattern_type` into a macro 2.0 that expands to `k#pattern_type(..)` This also means that it's now available under `core::pat` instead of `core` directly. This makes it consistent with the `std` re-export which is only available under `std::pat` and not under `std` directly. Moreover, drop library feature `pattern_type_macro` and demote language feature `pattern_types` to a library feature. This is nice because it means `std::pat::pattern_type` is no longer unnecessarily gated behind two (!) feature gates. --- compiler/rustc_ast_passes/src/feature_gate.rs | 3 - compiler/rustc_builtin_macros/src/lib.rs | 2 - .../rustc_builtin_macros/src/pattern_type.rs | 75 ------------------- .../example/mini_core.rs | 12 ++- .../example/mini_core_hello_world.rs | 10 +-- .../build_system/src/test.rs | 2 + .../rustc_codegen_gcc/example/mini_core.rs | 28 ++++--- compiler/rustc_data_structures/src/lib.rs | 2 +- compiler/rustc_feature/src/unstable.rs | 2 - compiler/rustc_index_macros/src/lib.rs | 2 +- compiler/rustc_parse/src/parser/ty.rs | 56 +++++++++++++- compiler/rustc_span/src/symbol.rs | 2 +- library/core/src/lib.rs | 5 +- library/core/src/num/niche_types.rs | 3 +- library/core/src/pat.rs | 12 ++- library/core/src/prelude/v1.rs | 4 +- library/core/src/ptr/non_null.rs | 2 +- library/std/src/lib.rs | 2 +- library/std/src/pat.rs | 2 +- .../clippy/tests/ui/eager_transmute.fixed | 2 +- src/tools/clippy/tests/ui/eager_transmute.rs | 2 +- src/tools/miri/tests/fail/validity/nonzero.rs | 2 +- src/tools/miri/tests/pass/pattern-types.rs | 2 +- tests/auxiliary/minicore.rs | 12 ++- tests/codegen-llvm/enum/enum-aggregate.rs | 2 +- tests/codegen-llvm/pattern_type_symbols.rs | 3 +- tests/debuginfo/msvc-pretty-enums.rs | 6 +- tests/mir-opt/dataflow-const-prop/enum.rs | 2 +- tests/mir-opt/gvn.rs | 2 +- tests/mir-opt/jump_threading.rs | 2 +- tests/mir-opt/pattern_types.rs | 1 - .../pattern-types-implementors.rs | 2 +- tests/ui/consts/const-eval/raw-bytes.rs | 2 +- tests/ui/consts/const-eval/ub-ref-ptr.rs | 2 +- tests/ui/enum-discriminant/ptr_niche.rs | 2 +- tests/ui/lint/clashing-extern-fn.rs | 2 +- tests/ui/lint/invalid_value.rs | 2 +- tests/ui/mir/ssa-analysis-regression-50041.rs | 2 +- tests/ui/pattern/overflowing-literals.rs | 1 - tests/ui/pattern/overflowing-literals.stderr | 8 +- tests/ui/print_type_sizes/niche-filling.rs | 2 +- .../pattern_types/assoc_const.default.stderr | 8 +- tests/ui/type/pattern_types/assoc_const.rs | 2 - tests/ui/type/pattern_types/bad_pat.rs | 3 +- tests/ui/type/pattern_types/bad_pat.stderr | 16 ++-- tests/ui/type/pattern_types/chars.rs | 1 - tests/ui/type/pattern_types/const_generics.rs | 2 +- tests/ui/type/pattern_types/derives.rs | 3 +- tests/ui/type/pattern_types/derives.stderr | 2 +- tests/ui/type/pattern_types/derives_fail.rs | 3 +- .../ui/type/pattern_types/derives_fail.stderr | 12 +-- ...eature-gate-pattern_types.disabled.stderr} | 32 ++++---- ...feature-gate-pattern_types.enabled.stderr} | 2 +- .../feature-gate-pattern_types.rs | 14 ++-- .../feature-gate-pattern_types2.rs | 12 --- tests/ui/type/pattern_types/free_const.rs | 1 - tests/ui/type/pattern_types/literals.rs | 1 - tests/ui/type/pattern_types/literals.stderr | 40 +++++----- tests/ui/type/pattern_types/matching.rs | 2 +- tests/ui/type/pattern_types/matching_fail.rs | 2 +- tests/ui/type/pattern_types/missing-is.rs | 2 +- tests/ui/type/pattern_types/nested.rs | 1 - tests/ui/type/pattern_types/nested.stderr | 26 +++---- tests/ui/type/pattern_types/non_null.rs | 2 +- tests/ui/type/pattern_types/or_patterns.rs | 8 +- .../ui/type/pattern_types/or_patterns.stderr | 16 ++-- .../type/pattern_types/or_patterns_invalid.rs | 10 +-- .../pattern_types/or_patterns_invalid.stderr | 8 +- .../pattern_types/pattern_type_mismatch.rs | 1 - .../pattern_type_mismatch.stderr | 8 +- tests/ui/type/pattern_types/range_patterns.rs | 2 - .../type/pattern_types/range_patterns.stderr | 24 +++--- .../range_patterns_inherent_impls.rs | 2 - .../range_patterns_inherent_impls.stderr | 4 +- .../range_patterns_trait_impls.rs | 2 - .../range_patterns_trait_impls2.rs | 2 - .../range_patterns_trait_impls2.stderr | 2 +- .../pattern_types/range_patterns_unusable.rs | 2 - .../range_patterns_unusable.stderr | 2 +- .../range_patterns_unusable_math.rs | 2 - .../range_patterns_unusable_math.stderr | 2 +- .../pattern_types/range_patterns_usage.rs | 2 - tests/ui/type/pattern_types/reverse_range.rs | 1 - .../type/pattern_types/reverse_range.stderr | 2 +- tests/ui/type/pattern_types/signed_ranges.rs | 1 - .../type/pattern_types/signed_ranges.stderr | 8 +- tests/ui/type/pattern_types/transmute.rs | 2 +- .../type/pattern_types/unimplemented_pat.rs | 2 +- tests/ui/type/pattern_types/unsize.rs | 2 +- tests/ui/type/pattern_types/validity.rs | 1 - tests/ui/type/pattern_types/validity.stderr | 16 ++-- tests/ui/unpretty/exhaustive.expanded.stdout | 3 +- tests/ui/unpretty/exhaustive.hir.stderr | 40 +++++----- tests/ui/unpretty/exhaustive.hir.stdout | 5 +- tests/ui/unpretty/exhaustive.rs | 3 +- 95 files changed, 281 insertions(+), 382 deletions(-) delete mode 100644 compiler/rustc_builtin_macros/src/pattern_type.rs rename tests/ui/type/pattern_types/{feature-gate-pattern_types.stderr => feature-gate-pattern_types.disabled.stderr} (64%) rename tests/ui/type/pattern_types/{feature-gate-pattern_types2.stderr => feature-gate-pattern_types.enabled.stderr} (81%) delete mode 100644 tests/ui/type/pattern_types/feature-gate-pattern_types2.rs diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 862d4736ca33c..02adcc2296610 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -241,9 +241,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { // Function pointers cannot be `const` self.check_late_bound_lifetime_defs(&fn_ptr_ty.generic_params); } - ast::TyKind::Pat(..) => { - gate!(self, pattern_types, ty.span, "pattern types are unstable"); - } ast::TyKind::View(..) => { gate!(self, view_types, ty.span, "view types are unstable"); } diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index aaaf67e34af4e..f801dc5917d8a 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -45,7 +45,6 @@ mod global_allocator; mod iter; mod log_syntax; mod offload; -mod pattern_type; mod rustdoc_skip_body; mod source_util; mod test; @@ -100,7 +99,6 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) { module_path: source_util::expand_mod, naked_asm: asm::expand_naked_asm, option_env: env::expand_option_env, - pattern_type: pattern_type::expand, std_panic: edition_panic::expand_panic, stringify: source_util::expand_stringify, test_binder_constraints: test_binder_constraints::expand, diff --git a/compiler/rustc_builtin_macros/src/pattern_type.rs b/compiler/rustc_builtin_macros/src/pattern_type.rs deleted file mode 100644 index 4d34ba963e4e8..0000000000000 --- a/compiler/rustc_builtin_macros/src/pattern_type.rs +++ /dev/null @@ -1,75 +0,0 @@ -use rustc_ast::tokenstream::TokenStream; -use rustc_ast::{AnonConst, DUMMY_NODE_ID, Ty, TyPat, TyPatKind, ast, token}; -use rustc_errors::PResult; -use rustc_expand::base::{self, DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult}; -use rustc_parse::exp; -use rustc_parse::parser::{CommaRecoveryMode, RecoverColon, RecoverComma}; -use rustc_span::Span; - -pub(crate) fn expand<'cx>( - cx: &'cx mut ExtCtxt<'_>, - sp: Span, - tts: TokenStream, -) -> MacroExpanderResult<'cx> { - let (ty, pat) = match parse_pat_ty(cx, tts) { - Ok(parsed) => parsed, - Err(err) => { - return ExpandResult::Ready(DummyResult::any(sp, err.emit_err())); - } - }; - - ExpandResult::Ready(base::MacEager::ty(cx.ty(sp, ast::TyKind::Pat(ty, pat)))) -} - -fn parse_pat_ty<'a>( - cx: &mut ExtCtxt<'a>, - stream: TokenStream, -) -> PResult<'a, (Box, Box)> { - let mut parser = cx.new_parser_from_tts(stream); - - let ty = parser.parse_ty()?; - parser.expect_keyword(exp!(Is))?; - - let start = parser.token.span; - let pat = if parser.eat(exp!(Bang)) { - parser.expect_keyword(exp!(Null))?; - ty_pat(TyPatKind::NotNull, start.to(parser.token.span)) - } else { - pat_to_ty_pat( - cx, - parser.parse_pat_no_top_guard( - None, - RecoverComma::No, - RecoverColon::No, - CommaRecoveryMode::EitherTupleOrPipe, - )?, - ) - }; - - if parser.token != token::Eof { - parser.unexpected()?; - } - - Ok((ty, Box::new(pat))) -} - -fn ty_pat(kind: TyPatKind, span: Span) -> TyPat { - TyPat { id: DUMMY_NODE_ID, kind, span } -} - -fn pat_to_ty_pat(cx: &mut ExtCtxt<'_>, pat: ast::Pat) -> TyPat { - let kind = match pat.kind { - ast::PatKind::Range(start, end, include_end) => TyPatKind::Range( - start.map(|value| Box::new(AnonConst { id: DUMMY_NODE_ID, value })), - end.map(|value| Box::new(AnonConst { id: DUMMY_NODE_ID, value })), - include_end, - ), - ast::PatKind::Or(variants) => { - TyPatKind::Or(variants.into_iter().map(|pat| pat_to_ty_pat(cx, pat)).collect()) - } - ast::PatKind::Err(guar) => TyPatKind::Err(guar), - ast::PatKind::Paren(p) => pat_to_ty_pat(cx, *p).kind, - _ => TyPatKind::Err(cx.dcx().span_err(pat.span, "pattern not supported in pattern types")), - }; - ty_pat(kind, pat.span) -} diff --git a/compiler/rustc_codegen_cranelift/example/mini_core.rs b/compiler/rustc_codegen_cranelift/example/mini_core.rs index d6d82a9d2af69..3c9f6bdddc129 100644 --- a/compiler/rustc_codegen_cranelift/example/mini_core.rs +++ b/compiler/rustc_codegen_cranelift/example/mini_core.rs @@ -6,9 +6,10 @@ extern_types, decl_macro, rustc_attrs, + allow_internal_unstable, + forced_keywords, rustc_private, transparent_unions, - pattern_types, auto_traits, freeze_impls )] @@ -591,12 +592,9 @@ pub trait Deref { fn deref(&self) -> &Self::Target; } -#[rustc_builtin_macro(pattern_type)] -#[macro_export] -macro_rules! pattern_type { - ($($arg:tt)*) => { - /* compiler built-in */ - }; +#[allow_internal_unstable(internal_syntax)] +pub macro pattern_type($($arg:tt)*) { + k#pattern_type($($arg)*) } impl CoerceUnsized for pattern_type!(*const T is !null) where diff --git a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs index c53ec2ec6710d..2db42f3bd5930 100644 --- a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs +++ b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs @@ -1,12 +1,4 @@ -#![feature( - no_core, - lang_items, - extern_types, - thread_local, - repr_simd, - pattern_types, - rustc_private -)] +#![feature(no_core, lang_items, extern_types, thread_local, repr_simd, rustc_private)] #![cfg_attr(not(any(jit, target_vendor = "apple", windows)), feature(linkage))] #![no_core] #![allow(dead_code, non_camel_case_types, internal_features)] diff --git a/compiler/rustc_codegen_gcc/build_system/src/test.rs b/compiler/rustc_codegen_gcc/build_system/src/test.rs index 79eae8afa1468..ed4cfca14f250 100644 --- a/compiler/rustc_codegen_gcc/build_system/src/test.rs +++ b/compiler/rustc_codegen_gcc/build_system/src/test.rs @@ -255,6 +255,8 @@ fn mini_tests(env: &Env, args: &TestArg) -> Result<(), String> { &"mini_core", &"--crate-type", &crate_types, + &"--edition", + &"2024", &"--target", &args.config_info.target_triple, ]); diff --git a/compiler/rustc_codegen_gcc/example/mini_core.rs b/compiler/rustc_codegen_gcc/example/mini_core.rs index 383fbfc678922..e5e8f6042e4a2 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core.rs @@ -6,10 +6,11 @@ extern_types, decl_macro, rustc_attrs, + allow_internal_unstable, + forced_keywords, transparent_unions, auto_traits, freeze_impls, - pattern_types, thread_local, rustc_private )] @@ -40,9 +41,9 @@ unsafe extern "C" { type VTable; } -#[no_mangle] +#[unsafe(no_mangle)] unsafe extern "C" fn _Unwind_Resume() { - intrinsics::unreachable(); + unsafe { intrinsics::unreachable(); } } #[lang = "pointee_sized"] @@ -607,12 +608,9 @@ impl Allocator for Global {} #[rustc_nonnull_optimization_guaranteed] pub struct NonNull(pub pattern_type!(*const T is !null)); -#[rustc_builtin_macro(pattern_type)] -#[macro_export] -macro_rules! pattern_type { - ($($arg:tt)*) => { - /* compiler built-in */ - }; +#[allow_internal_unstable(internal_syntax)] +pub macro pattern_type($($arg:tt)*) { + k#pattern_type($($arg)*) } impl CoerceUnsized for pattern_type!(*const T is !null) where @@ -703,11 +701,11 @@ pub mod intrinsics { #[rustc_intrinsic] pub const fn size_of() -> usize; #[rustc_intrinsic] - pub unsafe fn size_of_val(val: *const T) -> usize; + pub unsafe fn size_of_val(val: *const T) -> usize; #[rustc_intrinsic] pub const fn align_of() -> usize; #[rustc_intrinsic] - pub unsafe fn align_of_val(val: *const T) -> usize; + pub unsafe fn align_of_val(val: *const T) -> usize; #[rustc_intrinsic] pub unsafe fn copy(src: *const T, dst: *mut T, count: usize); #[rustc_intrinsic] @@ -715,7 +713,7 @@ pub mod intrinsics { #[rustc_intrinsic] pub unsafe fn ctlz_nonzero(x: T) -> u32; #[rustc_intrinsic] - pub const fn needs_drop() -> bool; + pub const fn needs_drop() -> bool; #[rustc_intrinsic] pub fn bitreverse(x: T) -> T; #[rustc_intrinsic] @@ -728,7 +726,7 @@ pub mod intrinsics { pub mod libc { #[link(name = "c")] - extern "C" { + unsafe extern "C" { pub fn puts(s: *const u8) -> i32; pub fn printf(format: *const i8, ...) -> i32; pub fn malloc(size: usize) -> *mut u8; @@ -783,7 +781,7 @@ impl Index for [T] { } } -extern "C" { +unsafe extern "C" { type VaListImpl; } @@ -824,7 +822,7 @@ struct PanicLocation { column: u32, } -#[no_mangle] +#[unsafe(no_mangle)] pub fn get_tls() -> u8 { #[thread_local] static A: u8 = 42; diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index c20ac042516af..2eccbbc4fb28b 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -10,6 +10,7 @@ #![allow(internal_features)] #![allow(rustc::default_hash_types)] #![allow(rustc::potential_query_instability)] +#![cfg_attr(bootstrap, feature(pattern_type_macro))] #![cfg_attr(bootstrap, feature(unwrap_infallible))] #![cfg_attr(test, feature(test))] #![deny(unsafe_op_in_unsafe_fn)] @@ -26,7 +27,6 @@ #![feature(min_specialization)] #![feature(negative_impls)] #![feature(nonzero_internals)] -#![feature(pattern_type_macro)] #![feature(pattern_types)] #![feature(ptr_alignment_type)] #![feature(rustc_attrs)] diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index ed2bf64263c67..bd203ccf6e218 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -318,8 +318,6 @@ declare_features! ( (internal, needs_panic_runtime, "1.10.0", Some(32837)), /// Allows using the `#![panic_runtime]` attribute. (internal, panic_runtime, "1.10.0", Some(32837)), - /// Allows using pattern types. - (internal, pattern_types, "1.79.0", Some(123646)), /// Allows `repr(simd)` and importing the various simd intrinsics. (internal, repr_simd, "1.4.0", Some(27731)), /// Allows using compiler's own crates. diff --git a/compiler/rustc_index_macros/src/lib.rs b/compiler/rustc_index_macros/src/lib.rs index b0bc40a9d8b1a..86681332ceb47 100644 --- a/compiler/rustc_index_macros/src/lib.rs +++ b/compiler/rustc_index_macros/src/lib.rs @@ -41,7 +41,7 @@ mod newtype; rustc_attrs, trusted_step, pattern_types, - pattern_type_macro, + pattern_type_macro, // cfg(bootstrap) FIXME: remove on bump structural_match, ) )] diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index b66d7310dbea5..029aab9e0e601 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -4,7 +4,7 @@ use rustc_ast::{ self as ast, BoundAsyncness, BoundConstness, BoundPolarity, DUMMY_NODE_ID, FnPtrTy, FnRetTy, GenericBound, GenericBounds, GenericParam, Generics, Lifetime, MacCall, Mutability, Path, Pinnedness, PolyTraitRef, PreciseCapturingArg, TraitBoundModifiers, TraitObjectSyntax, Ty, - TyKind, UnsafeBinderTy, + TyKind, TyPatKind, UnsafeBinderTy, }; use rustc_errors::{Applicability, Diag, E0516, PResult}; use rustc_span::{ErrorGuaranteed, Ident, Span, kw, sym}; @@ -423,6 +423,8 @@ impl<'a> Parser<'a> { self.parse_unsafe_binder_ty()? } else if self.eat_forced_keyword_noexpect(kw::FieldOf) { self.parse_ty_field_of(lo)? + } else if self.eat_forced_keyword_noexpect(kw::PatternType) { + self.parse_pat_ty(lo)? } else { let msg = format!("expected type, found {}", super::token_descr(&self.token)); let mut err = self.dcx().struct_span_err(lo, msg); @@ -826,7 +828,7 @@ impl<'a> Parser<'a> { Ok(TyKind::Err(guar)) } - pub(crate) fn parse_ty_field_of(&mut self, lo: Span) -> PResult<'a, TyKind> { + fn parse_ty_field_of(&mut self, lo: Span) -> PResult<'a, TyKind> { self.expect(exp!(OpenParen))?; let container = self.parse_ty()?; @@ -871,6 +873,56 @@ impl<'a> Parser<'a> { } } + fn parse_pat_ty(&mut self, lo: Span) -> PResult<'a, TyKind> { + self.expect(exp!(OpenParen))?; + + let ty = self.parse_ty()?; + self.expect_keyword(exp!(Is))?; + + let pat = if self.eat(exp!(Bang)) { + let lo = self.prev_token.span; + self.expect_keyword(exp!(Null))?; + Self::mk_ty_pat(TyPatKind::NotNull, lo.to(self.token.span)) + } else { + let pat = self.parse_pat_no_top_guard( + None, + super::RecoverComma::No, + super::RecoverColon::No, + super::CommaRecoveryMode::EitherTupleOrPipe, + )?; + self.pat_to_ty_pat(pat) + }; + + self.expect(exp!(CloseParen))?; + + self.psess.gated_spans.gate(sym::internal_syntax, lo.to(self.token.span)); + + Ok(TyKind::Pat(ty, Box::new(pat))) + } + + fn pat_to_ty_pat(&self, pat: ast::Pat) -> ast::TyPat { + let kind = match pat.kind { + ast::PatKind::Range(start, end, include_end) => TyPatKind::Range( + start.map(|value| Box::new(ast::AnonConst { id: DUMMY_NODE_ID, value })), + end.map(|value| Box::new(ast::AnonConst { id: DUMMY_NODE_ID, value })), + include_end, + ), + ast::PatKind::Or(variants) => { + TyPatKind::Or(variants.into_iter().map(|pat| self.pat_to_ty_pat(pat)).collect()) + } + ast::PatKind::Err(guar) => TyPatKind::Err(guar), + ast::PatKind::Paren(p) => self.pat_to_ty_pat(*p).kind, + _ => TyPatKind::Err( + self.dcx().span_err(pat.span, "pattern not supported in pattern types"), + ), + }; + Self::mk_ty_pat(kind, pat.span) + } + + fn mk_ty_pat(kind: TyPatKind, span: Span) -> ast::TyPat { + ast::TyPat { id: DUMMY_NODE_ID, kind, span } + } + /// Parses a function pointer type (`TyKind::FnPtr`). /// ```ignore (illustrative) /// [unsafe] [extern "ABI"] fn (S) -> T diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index a7f8e37687b18..6b5299d7eb1be 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -133,6 +133,7 @@ symbols! { FieldOf: "field_of", MacroRules: "macro_rules", OffsetOf: "offset_of", + PatternType: "pattern_type", Pin: "pin", Raw: "raw", Reuse: "reuse", @@ -1606,7 +1607,6 @@ symbols! { path, pattern_complexity_limit, pattern_parentheses, - pattern_type, pattern_type_range_trait, pattern_types, phantom_data, diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index e6520a0c348c9..00c7c3c824cfa 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -99,7 +99,7 @@ #![feature(io_const_error)] #![feature(offset_of_enum)] #![feature(panic_internals)] -#![feature(pattern_type_macro)] +#![feature(pattern_types)] #![feature(ub_checks)] // tidy-alphabetical-end // @@ -146,7 +146,6 @@ #![feature(must_not_suspend)] #![feature(negative_impls)] #![feature(no_core)] -#![feature(pattern_types)] #![feature(pin_macro_internals)] #![feature(prelude_import)] #![feature(register_tool)] @@ -314,7 +313,7 @@ pub mod option; pub mod os; pub mod panic; pub mod panicking; -#[unstable(feature = "pattern_type_macro", issue = "123646")] +#[unstable(feature = "pattern_types", issue = "123646")] pub mod pat; pub mod pin; #[unstable(feature = "abort_immediate", issue = "154601")] diff --git a/library/core/src/num/niche_types.rs b/library/core/src/num/niche_types.rs index 37037d8145fb0..6d3e59b05a2c3 100644 --- a/library/core/src/num/niche_types.rs +++ b/library/core/src/num/niche_types.rs @@ -5,9 +5,10 @@ )] use crate::cmp::Ordering; +use crate::fmt; use crate::hash::{Hash, Hasher}; use crate::marker::StructuralPartialEq; -use crate::{fmt, pattern_type}; +use crate::pat::pattern_type; macro_rules! define_valid_range_type { ($( diff --git a/library/core/src/pat.rs b/library/core/src/pat.rs index 0cf9f10fc8c28..1315c2a46d128 100644 --- a/library/core/src/pat.rs +++ b/library/core/src/pat.rs @@ -7,13 +7,11 @@ use crate::ops::{CoerceUnsized, DispatchFromDyn}; /// ```ignore (cannot test this from within core yet) /// type Positive = std::pat::pattern_type!(i32 is 1..); /// ``` -#[macro_export] -#[rustc_builtin_macro(pattern_type)] -#[unstable(feature = "pattern_type_macro", issue = "123646")] -macro_rules! pattern_type { - ($($arg:tt)*) => { - /* compiler built-in */ - }; +#[allow_internal_unstable(internal_syntax)] +#[unstable(feature = "pattern_types", issue = "123646")] +#[diagnostic::opaque] +pub macro pattern_type($( $arg:tt )*) { + k#pattern_type($( $arg )*) } /// A trait implemented for integer types and `char`. diff --git a/library/core/src/prelude/v1.rs b/library/core/src/prelude/v1.rs index f68d3e614c53f..d21fa351f5bce 100644 --- a/library/core/src/prelude/v1.rs +++ b/library/core/src/prelude/v1.rs @@ -104,9 +104,9 @@ pub use crate::const_format_args; #[doc(no_inline)] pub use crate::log_syntax; -#[unstable(feature = "pattern_type_macro", issue = "123646")] +#[unstable(feature = "pattern_types", issue = "123646")] #[doc(no_inline)] -pub use crate::pattern_type; +pub use crate::pat::pattern_type; #[unstable( feature = "trace_macros", diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index 7d444cc8698a5..cf23690992ef1 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -76,7 +76,7 @@ use crate::{fmt, hash, intrinsics, mem, ptr}; #[rustc_nonnull_optimization_guaranteed] #[lang = "non_null"] pub struct NonNull<#[rustc_assert_variance(covariant)] T: PointeeSized> { - pointer: crate::pattern_type!(*const T is !null), + pointer: crate::pat::pattern_type!(*const T is !null), } /// `NonNull` pointers are not `Send` because the data they reference may be aliased. diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 1f684c162496b..0c3d29324c9ae 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -641,7 +641,7 @@ pub mod num; #[allow(unreachable_pub)] pub mod os; pub mod panic; -#[unstable(feature = "pattern_type_macro", issue = "123646")] +#[unstable(feature = "pattern_types", issue = "123646")] pub mod pat; pub mod path; pub mod process; diff --git a/library/std/src/pat.rs b/library/std/src/pat.rs index aeddd84c2cb54..3d227b1903f33 100644 --- a/library/std/src/pat.rs +++ b/library/std/src/pat.rs @@ -1,3 +1,3 @@ //! Helper module for exporting the `pattern_type` macro -pub use core::pattern_type; +pub use core::pat::pattern_type; diff --git a/src/tools/clippy/tests/ui/eager_transmute.fixed b/src/tools/clippy/tests/ui/eager_transmute.fixed index a62b4ff7c75e5..30e741755d9b4 100644 --- a/src/tools/clippy/tests/ui/eager_transmute.fixed +++ b/src/tools/clippy/tests/ui/eager_transmute.fixed @@ -1,4 +1,4 @@ -#![feature(rustc_attrs, pattern_types, pattern_type_macro)] +#![feature(rustc_attrs, pattern_types)] #![warn(clippy::eager_transmute)] #![expect(clippy::missing_transmute_annotations, clippy::transmute_int_to_non_zero)] diff --git a/src/tools/clippy/tests/ui/eager_transmute.rs b/src/tools/clippy/tests/ui/eager_transmute.rs index cc6fbc2ebd37d..c9f4c19d8837d 100644 --- a/src/tools/clippy/tests/ui/eager_transmute.rs +++ b/src/tools/clippy/tests/ui/eager_transmute.rs @@ -1,4 +1,4 @@ -#![feature(rustc_attrs, pattern_types, pattern_type_macro)] +#![feature(rustc_attrs, pattern_types)] #![warn(clippy::eager_transmute)] #![expect(clippy::missing_transmute_annotations, clippy::transmute_int_to_non_zero)] diff --git a/src/tools/miri/tests/fail/validity/nonzero.rs b/src/tools/miri/tests/fail/validity/nonzero.rs index fba37ee170e3a..1e847c4792442 100644 --- a/src/tools/miri/tests/fail/validity/nonzero.rs +++ b/src/tools/miri/tests/fail/validity/nonzero.rs @@ -1,4 +1,4 @@ -#![feature(rustc_attrs, pattern_types, pattern_type_macro)] +#![feature(rustc_attrs, pattern_types)] #![allow(unused_attributes)] #[repr(transparent)] diff --git a/src/tools/miri/tests/pass/pattern-types.rs b/src/tools/miri/tests/pass/pattern-types.rs index 90fe0de546915..2422f79d25d88 100644 --- a/src/tools/miri/tests/pass/pattern-types.rs +++ b/src/tools/miri/tests/pass/pattern-types.rs @@ -1,4 +1,4 @@ -#![feature(pattern_types, pattern_type_macro, sized_hierarchy)] +#![feature(pattern_types, sized_hierarchy)] #![allow(dead_code)] use std::marker::PointeeSized; diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index e7e924f9ebc08..530a6496c39b5 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -23,11 +23,12 @@ intrinsics, lang_items, auto_traits, + forced_keywords, freeze_impls, negative_impls, - pattern_types, rustc_attrs, decl_macro, + allow_internal_unstable, f16, f16b, cfg_target_has_reliable_f16b, @@ -468,12 +469,9 @@ pub enum c_void { __variant2, } -#[rustc_builtin_macro(pattern_type)] -#[macro_export] -macro_rules! pattern_type { - ($($arg:tt)*) => { - /* compiler built-in */ - }; +#[allow_internal_unstable(internal_syntax)] +pub macro pattern_type($($arg:tt)*) { + k#pattern_type($($arg)*) } #[lang = "Ordering"] diff --git a/tests/codegen-llvm/enum/enum-aggregate.rs b/tests/codegen-llvm/enum/enum-aggregate.rs index 46a1a03e96371..1e359480ad6a6 100644 --- a/tests/codegen-llvm/enum/enum-aggregate.rs +++ b/tests/codegen-llvm/enum/enum-aggregate.rs @@ -2,7 +2,7 @@ //@ only-64bit #![crate_type = "lib"] -#![feature(pattern_types, pattern_type_macro)] +#![feature(pattern_types)] use std::cmp::Ordering; use std::num::NonZero; diff --git a/tests/codegen-llvm/pattern_type_symbols.rs b/tests/codegen-llvm/pattern_type_symbols.rs index a90262ff12d21..f20940780d84d 100644 --- a/tests/codegen-llvm/pattern_type_symbols.rs +++ b/tests/codegen-llvm/pattern_type_symbols.rs @@ -4,11 +4,10 @@ //@ compile-flags: -Csymbol-mangling-version=v0 -Copt-level=0 --crate-type=lib #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; -type NanoU32 = crate::pattern_type!(u32 is 0..=999_999_999); +type NanoU32 = pattern_type!(u32 is 0..=999_999_999); fn foo() {} diff --git a/tests/debuginfo/msvc-pretty-enums.rs b/tests/debuginfo/msvc-pretty-enums.rs index d418d8f0987e6..2ec127390ca75 100644 --- a/tests/debuginfo/msvc-pretty-enums.rs +++ b/tests/debuginfo/msvc-pretty-enums.rs @@ -232,7 +232,7 @@ //@ cdb-command: dx c_style_i128_d //@ cdb-check: c_style_i128_d : D [Type: enum2$] -#![feature(pattern_types, pattern_type_macro)] +#![feature(pattern_types)] use std::num::NonZero; @@ -271,9 +271,7 @@ enum NicheLayoutWithFields3 { } #[repr(transparent)] -struct Wrapping128( - std::pat::pattern_type!(i128 is -2..=1), -); +struct Wrapping128(std::pat::pattern_type!(i128 is -2..=1)); enum Wrapping128Niche { X(Wrapping128), diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs index 80553a3974881..454e2849597f1 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.rs +++ b/tests/mir-opt/dataflow-const-prop/enum.rs @@ -2,7 +2,7 @@ //@ compile-flags: -Zdump-mir-exclude-alloc-bytes // EMIT_MIR_FOR_EACH_BIT_WIDTH -#![feature(custom_mir, core_intrinsics, rustc_attrs, pattern_types, pattern_type_macro)] +#![feature(custom_mir, core_intrinsics, rustc_attrs, pattern_types)] use std::intrinsics::mir::*; diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index 2ce475f7401ac..366af8355c031 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -6,7 +6,7 @@ #![feature(rustc_attrs)] #![feature(custom_mir)] #![feature(core_intrinsics)] -#![feature(freeze, pattern_type_range_trait, const_trait_impl, pattern_types, pattern_type_macro)] +#![feature(freeze, pattern_type_range_trait, const_trait_impl, pattern_types)] #![allow(ambiguous_wide_pointer_comparisons)] #![allow(unconditional_panic)] #![allow(unnecessary_transmutes)] diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs index ae56921bb1d44..cdf49fb36bef4 100644 --- a/tests/mir-opt/jump_threading.rs +++ b/tests/mir-opt/jump_threading.rs @@ -2,7 +2,7 @@ //@ compile-flags: -Zmir-enable-passes=+Inline // EMIT_MIR_FOR_EACH_PANIC_STRATEGY -#![feature(try_trait_v2, pattern_type_macro, pattern_types)] +#![feature(try_trait_v2, pattern_types)] #![feature(custom_mir, core_intrinsics, rustc_attrs)] use std::intrinsics::mir::*; diff --git a/tests/mir-opt/pattern_types.rs b/tests/mir-opt/pattern_types.rs index dfa4c40d2dd7b..c714060619c16 100644 --- a/tests/mir-opt/pattern_types.rs +++ b/tests/mir-opt/pattern_types.rs @@ -1,5 +1,4 @@ #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/rustdoc-html/pattern-types-implementors.rs b/tests/rustdoc-html/pattern-types-implementors.rs index 2f49837b27e74..030b8b85f58dc 100644 --- a/tests/rustdoc-html/pattern-types-implementors.rs +++ b/tests/rustdoc-html/pattern-types-implementors.rs @@ -1,4 +1,4 @@ -#![feature(pattern_types, pattern_type_macro)] +#![feature(pattern_types)] #![crate_name = "pattern_types_implementors"] use std::pat::pattern_type; diff --git a/tests/ui/consts/const-eval/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs index c682a17b8decf..8d13b5513fb9f 100644 --- a/tests/ui/consts/const-eval/raw-bytes.rs +++ b/tests/ui/consts/const-eval/raw-bytes.rs @@ -4,7 +4,7 @@ // ignore-tidy-file-linelength #![allow(invalid_value, unnecessary_transmutes)] -#![feature(pattern_types, pattern_type_macro)] +#![feature(pattern_types)] #![feature(rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)] use std::mem; diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.rs b/tests/ui/consts/const-eval/ub-ref-ptr.rs index 9cd47e4b155e3..eadb7ccf1126c 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.rs +++ b/tests/ui/consts/const-eval/ub-ref-ptr.rs @@ -6,7 +6,7 @@ //@ normalize-stderr: "0x[0-9](\.\.|\])" -> "0x%$1" //@ normalize-stderr: "╾ALLOC\$ID╼\s+│.*╾.*╼" -> "╾ALLOC$$ID╼ │ ╾─╼" -#![feature(pattern_types, pattern_type_macro)] +#![feature(pattern_types)] #![allow(invalid_value)] use std::{mem, pat::pattern_type}; diff --git a/tests/ui/enum-discriminant/ptr_niche.rs b/tests/ui/enum-discriminant/ptr_niche.rs index 45dbe50248217..4390b69de0516 100644 --- a/tests/ui/enum-discriminant/ptr_niche.rs +++ b/tests/ui/enum-discriminant/ptr_niche.rs @@ -2,7 +2,7 @@ //! Check that we can codegen setting and getting discriminants, including non-null niches, //! for enums with a pointer-like ABI. This used to crash llvm. -#![feature(rustc_attrs, pattern_types, pattern_type_macro)] +#![feature(rustc_attrs, pattern_types)] use std::{ptr, mem, pat::pattern_type}; #[derive(Copy, Clone)] diff --git a/tests/ui/lint/clashing-extern-fn.rs b/tests/ui/lint/clashing-extern-fn.rs index e4477c9620221..195aab24899cf 100644 --- a/tests/ui/lint/clashing-extern-fn.rs +++ b/tests/ui/lint/clashing-extern-fn.rs @@ -1,7 +1,7 @@ //@ check-pass //@ aux-build:external_extern_fn.rs #![crate_type = "lib"] -#![feature(pattern_type_macro, pattern_types)] +#![feature(pattern_types)] mod redeclared_different_signature { mod a { extern "C" { diff --git a/tests/ui/lint/invalid_value.rs b/tests/ui/lint/invalid_value.rs index 301283853eb26..f76d988f44c68 100644 --- a/tests/ui/lint/invalid_value.rs +++ b/tests/ui/lint/invalid_value.rs @@ -2,7 +2,7 @@ // in a lint. #![allow(deprecated)] #![deny(invalid_value)] -#![feature(rustc_attrs, pattern_types, pattern_type_macro)] +#![feature(rustc_attrs, pattern_types)] use std::mem::{self, MaybeUninit}; use std::num::NonZero; diff --git a/tests/ui/mir/ssa-analysis-regression-50041.rs b/tests/ui/mir/ssa-analysis-regression-50041.rs index 28690624f63ec..37d78acc2c452 100644 --- a/tests/ui/mir/ssa-analysis-regression-50041.rs +++ b/tests/ui/mir/ssa-analysis-regression-50041.rs @@ -2,7 +2,7 @@ //@ compile-flags: -Z mir-opt-level=4 #![crate_type = "lib"] -#![feature(lang_items, pattern_type_macro, pattern_types)] +#![feature(lang_items, pattern_types)] #![no_std] struct NonNull(pattern_type!(*const T is !null)); diff --git a/tests/ui/pattern/overflowing-literals.rs b/tests/ui/pattern/overflowing-literals.rs index 13016d3f7d197..9e33d49963ee0 100644 --- a/tests/ui/pattern/overflowing-literals.rs +++ b/tests/ui/pattern/overflowing-literals.rs @@ -1,7 +1,6 @@ //! Check that overflowing literals are in patterns are rejected #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/pattern/overflowing-literals.stderr b/tests/ui/pattern/overflowing-literals.stderr index 8164b97fd4720..54525cf6cd9f8 100644 --- a/tests/ui/pattern/overflowing-literals.stderr +++ b/tests/ui/pattern/overflowing-literals.stderr @@ -1,5 +1,5 @@ error: literal out of range for `u8` - --> $DIR/overflowing-literals.rs:8:35 + --> $DIR/overflowing-literals.rs:7:35 | LL | type TooBig = pattern_type!(u8 is 500..); | ^^^ @@ -8,7 +8,7 @@ LL | type TooBig = pattern_type!(u8 is 500..); = note: `#[deny(overflowing_literals)]` on by default error: literal out of range for `i8` - --> $DIR/overflowing-literals.rs:10:37 + --> $DIR/overflowing-literals.rs:9:37 | LL | type TooSmall = pattern_type!(i8 is -500..); | ^^^^ @@ -17,7 +17,7 @@ LL | type TooSmall = pattern_type!(i8 is -500..); = help: consider using the type `i16` instead error: literal out of range for `i8` - --> $DIR/overflowing-literals.rs:12:41 + --> $DIR/overflowing-literals.rs:11:41 | LL | type TooBigSigned = pattern_type!(i8 is 200..); | ^^^ @@ -26,7 +26,7 @@ LL | type TooBigSigned = pattern_type!(i8 is 200..); = help: consider using the type `u8` instead error: literal out of range for `u8` - --> $DIR/overflowing-literals.rs:17:9 + --> $DIR/overflowing-literals.rs:16:9 | LL | 500 => {} | ^^^ diff --git a/tests/ui/print_type_sizes/niche-filling.rs b/tests/ui/print_type_sizes/niche-filling.rs index 2fcb1dfe3c8c2..ecd243cd01ba8 100644 --- a/tests/ui/print_type_sizes/niche-filling.rs +++ b/tests/ui/print_type_sizes/niche-filling.rs @@ -15,7 +15,7 @@ // ^-- needed because `--pass check` does not emit the output needed. // FIXME: consider using an attribute instead of side-effects. #![allow(dead_code)] -#![feature(rustc_attrs, pattern_types, pattern_type_macro)] +#![feature(rustc_attrs, pattern_types)] use std::num::NonZero; diff --git a/tests/ui/type/pattern_types/assoc_const.default.stderr b/tests/ui/type/pattern_types/assoc_const.default.stderr index 8b1184877af83..db79eaff48753 100644 --- a/tests/ui/type/pattern_types/assoc_const.default.stderr +++ b/tests/ui/type/pattern_types/assoc_const.default.stderr @@ -1,5 +1,5 @@ error: generic parameters may not be used in const operations - --> $DIR/assoc_const.rs:17:41 + --> $DIR/assoc_const.rs:15:41 | LL | fn foo(_: pattern_type!(u32 is ::START..=::END)) {} | ^ cannot perform const operation using `T` @@ -9,7 +9,7 @@ LL | fn foo(_: pattern_type!(u32 is ::START..=::END) = help: alternatively, you can use `#![feature(gca_const_items)]` and wrap the expression in the `gca!` macro error: generic parameters may not be used in const operations - --> $DIR/assoc_const.rs:17:61 + --> $DIR/assoc_const.rs:15:61 | LL | fn foo(_: pattern_type!(u32 is ::START..=::END)) {} | ^ cannot perform const operation using `T` @@ -19,7 +19,7 @@ LL | fn foo(_: pattern_type!(u32 is ::START..=::END) = help: alternatively, you can use `#![feature(gca_const_items)]` and wrap the expression in the `gca!` macro error: generic parameters may not be used in const operations - --> $DIR/assoc_const.rs:20:40 + --> $DIR/assoc_const.rs:18:40 | LL | fn bar(_: pattern_type!(u32 is T::START..=T::END)) {} | ^ cannot perform const operation using `T` @@ -29,7 +29,7 @@ LL | fn bar(_: pattern_type!(u32 is T::START..=T::END)) {} = help: alternatively, you can use `#![feature(gca_const_items)]` and wrap the expression in the `gca!` macro error: generic parameters may not be used in const operations - --> $DIR/assoc_const.rs:20:51 + --> $DIR/assoc_const.rs:18:51 | LL | fn bar(_: pattern_type!(u32 is T::START..=T::END)) {} | ^ cannot perform const operation using `T` diff --git a/tests/ui/type/pattern_types/assoc_const.rs b/tests/ui/type/pattern_types/assoc_const.rs index 90508801990e8..6b5de2042f5d0 100644 --- a/tests/ui/type/pattern_types/assoc_const.rs +++ b/tests/ui/type/pattern_types/assoc_const.rs @@ -1,7 +1,5 @@ #![feature(pattern_types)] -#![feature(pattern_type_macro)] #![cfg_attr(const_arg, feature(generic_const_exprs, generic_pattern_types))] -#![expect(incomplete_features)] // gate-test-generic_pattern_types line to the test file. //@ revisions: default const_arg diff --git a/tests/ui/type/pattern_types/bad_pat.rs b/tests/ui/type/pattern_types/bad_pat.rs index 7e2b4cb996f27..75c8169188011 100644 --- a/tests/ui/type/pattern_types/bad_pat.rs +++ b/tests/ui/type/pattern_types/bad_pat.rs @@ -1,5 +1,4 @@ #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; @@ -12,7 +11,7 @@ type Wild = pattern_type!(() is _); // FIXME: confusing diagnostic because `not` can be a binding type NonNull = pattern_type!(*const () is not null); -//~^ ERROR: expected one of `@` or `|`, found `null` +//~^ ERROR: expected one of //~| ERROR: pattern not supported in pattern types type NonNull2 = pattern_type!(*const () is !nil); diff --git a/tests/ui/type/pattern_types/bad_pat.stderr b/tests/ui/type/pattern_types/bad_pat.stderr index e72279542280c..07ced579c6512 100644 --- a/tests/ui/type/pattern_types/bad_pat.stderr +++ b/tests/ui/type/pattern_types/bad_pat.stderr @@ -1,5 +1,5 @@ error[E0586]: inclusive range with no end - --> $DIR/bad_pat.rs:6:43 + --> $DIR/bad_pat.rs:5:43 | LL | type NonNullU32_2 = pattern_type!(u32 is 1..=); | ^^^ @@ -12,7 +12,7 @@ LL + type NonNullU32_2 = pattern_type!(u32 is 1..); | error[E0586]: inclusive range with no end - --> $DIR/bad_pat.rs:8:40 + --> $DIR/bad_pat.rs:7:40 | LL | type Positive2 = pattern_type!(i32 is 0..=); | ^^^ @@ -25,25 +25,25 @@ LL + type Positive2 = pattern_type!(i32 is 0..); | error: pattern not supported in pattern types - --> $DIR/bad_pat.rs:10:33 + --> $DIR/bad_pat.rs:9:33 | LL | type Wild = pattern_type!(() is _); | ^ error: pattern not supported in pattern types - --> $DIR/bad_pat.rs:14:43 + --> $DIR/bad_pat.rs:13:43 | LL | type NonNull = pattern_type!(*const () is not null); | ^^^ -error: expected one of `@` or `|`, found `null` - --> $DIR/bad_pat.rs:14:47 +error: expected one of `)`, `@`, or `|`, found `null` + --> $DIR/bad_pat.rs:13:47 | LL | type NonNull = pattern_type!(*const () is not null); - | ^^^^ expected one of `@` or `|` + | ^^^^ expected one of `)`, `@`, or `|` error: expected `null`, found `nil` - --> $DIR/bad_pat.rs:18:45 + --> $DIR/bad_pat.rs:17:45 | LL | type NonNull2 = pattern_type!(*const () is !nil); | ^^^ expected `null` diff --git a/tests/ui/type/pattern_types/chars.rs b/tests/ui/type/pattern_types/chars.rs index 9073998b387b7..285c4f3abdf75 100644 --- a/tests/ui/type/pattern_types/chars.rs +++ b/tests/ui/type/pattern_types/chars.rs @@ -3,7 +3,6 @@ //@ check-pass #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/const_generics.rs b/tests/ui/type/pattern_types/const_generics.rs index f5eb90e94d4fd..aff5e72f2c9e8 100644 --- a/tests/ui/type/pattern_types/const_generics.rs +++ b/tests/ui/type/pattern_types/const_generics.rs @@ -3,7 +3,7 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(pattern_types, generic_pattern_types, pattern_type_macro)] +#![feature(pattern_types, generic_pattern_types)] #![expect(incomplete_features)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/derives.rs b/tests/ui/type/pattern_types/derives.rs index 12af19e5f7ea6..2a3d1164c9772 100644 --- a/tests/ui/type/pattern_types/derives.rs +++ b/tests/ui/type/pattern_types/derives.rs @@ -2,7 +2,6 @@ //! Exceptions are `Clone` and `Copy`, which have builtin impls for pattern types. #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; @@ -11,7 +10,7 @@ use std::pat::pattern_type; struct Nanoseconds(NanoI32); //~^ ERROR: binary operation `==` cannot be applied to type `pattern_type!(i32 is 0..=999999999)` -type NanoI32 = crate::pattern_type!(i32 is 0..=999_999_999); +type NanoI32 = pattern_type!(i32 is 0..=999_999_999); fn main() { let x = Nanoseconds(unsafe { std::mem::transmute(42) }); diff --git a/tests/ui/type/pattern_types/derives.stderr b/tests/ui/type/pattern_types/derives.stderr index 6fb0c0994082a..f196cec5a1dc5 100644 --- a/tests/ui/type/pattern_types/derives.stderr +++ b/tests/ui/type/pattern_types/derives.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `pattern_type!(i32 is 0..=999999999)` - --> $DIR/derives.rs:11:20 + --> $DIR/derives.rs:10:20 | LL | #[derive(Clone, Copy, PartialEq)] | --------- in this derive macro expansion diff --git a/tests/ui/type/pattern_types/derives_fail.rs b/tests/ui/type/pattern_types/derives_fail.rs index 8251fa9f38c0b..60b4eb06db901 100644 --- a/tests/ui/type/pattern_types/derives_fail.rs +++ b/tests/ui/type/pattern_types/derives_fail.rs @@ -2,7 +2,6 @@ //! Exceptions are `Clone` and `Copy`, which have bultin impls for pattern types. #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; @@ -16,7 +15,7 @@ struct Nanoseconds(NanoI32); //~| ERROR: the trait bound `pattern_type!(i32 is 0..=999999999): Default` is not satisfied //~| ERROR: `==` cannot be applied -type NanoI32 = crate::pattern_type!(i32 is 0..=999_999_999); +type NanoI32 = pattern_type!(i32 is 0..=999_999_999); fn main() { let x = Nanoseconds(unsafe { std::mem::transmute(42) }); diff --git a/tests/ui/type/pattern_types/derives_fail.stderr b/tests/ui/type/pattern_types/derives_fail.stderr index a6814d8cba2a0..ac194b9be8990 100644 --- a/tests/ui/type/pattern_types/derives_fail.stderr +++ b/tests/ui/type/pattern_types/derives_fail.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `pattern_type!(i32 is 0..=999999999)` - --> $DIR/derives_fail.rs:11:20 + --> $DIR/derives_fail.rs:10:20 | LL | #[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash, Default)] | --------- in this derive macro expansion @@ -8,7 +8,7 @@ LL | struct Nanoseconds(NanoI32); | ^^^^^^^ error[E0277]: the trait bound `pattern_type!(i32 is 0..=999999999): Eq` is not satisfied - --> $DIR/derives_fail.rs:11:20 + --> $DIR/derives_fail.rs:10:20 | LL | #[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash, Default)] | -- in this derive macro expansion @@ -20,7 +20,7 @@ note: required by a bound in `std::cmp::AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL error[E0277]: `pattern_type!(i32 is 0..=999999999)` doesn't implement `Debug` - --> $DIR/derives_fail.rs:11:20 + --> $DIR/derives_fail.rs:10:20 | LL | #[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash, Default)] | ----- in this derive macro expansion @@ -29,7 +29,7 @@ LL | struct Nanoseconds(NanoI32); | ^^^^^^^ the trait `Debug` is not implemented for `pattern_type!(i32 is 0..=999999999)` error[E0277]: the trait bound `pattern_type!(i32 is 0..=999999999): Ord` is not satisfied - --> $DIR/derives_fail.rs:11:20 + --> $DIR/derives_fail.rs:10:20 | LL | #[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash, Default)] | --- in this derive macro expansion @@ -38,7 +38,7 @@ LL | struct Nanoseconds(NanoI32); | ^^^^^^^ the trait `Ord` is not implemented for `pattern_type!(i32 is 0..=999999999)` error[E0277]: the trait bound `pattern_type!(i32 is 0..=999999999): Hash` is not satisfied - --> $DIR/derives_fail.rs:11:20 + --> $DIR/derives_fail.rs:10:20 | LL | #[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash, Default)] | ---- in this derive macro expansion @@ -47,7 +47,7 @@ LL | struct Nanoseconds(NanoI32); | ^^^^^^^ the trait `Hash` is not implemented for `pattern_type!(i32 is 0..=999999999)` error[E0277]: the trait bound `pattern_type!(i32 is 0..=999999999): Default` is not satisfied - --> $DIR/derives_fail.rs:11:20 + --> $DIR/derives_fail.rs:10:20 | LL | #[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash, Default)] | ------- in this derive macro expansion diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr b/tests/ui/type/pattern_types/feature-gate-pattern_types.disabled.stderr similarity index 64% rename from tests/ui/type/pattern_types/feature-gate-pattern_types.stderr rename to tests/ui/type/pattern_types/feature-gate-pattern_types.disabled.stderr index 12508bcb54a34..b03af26289efc 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.disabled.stderr @@ -1,55 +1,55 @@ -error[E0658]: use of unstable library feature `pattern_type_macro` - --> $DIR/feature-gate-pattern_types.rs:5:19 +error[E0658]: use of unstable library feature `pattern_types` + --> $DIR/feature-gate-pattern_types.rs:7:19 | LL | type NonNullU32 = pattern_type!(u32 is 1..); | ^^^^^^^^^^^^ | = note: see issue #123646 for more information - = help: add `#![feature(pattern_type_macro)]` to the crate attributes to enable + = help: add `#![feature(pattern_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature `pattern_type_macro` - --> $DIR/feature-gate-pattern_types.rs:7:16 +error[E0658]: use of unstable library feature `pattern_types` + --> $DIR/feature-gate-pattern_types.rs:9:16 | LL | type Percent = pattern_type!(u32 is 0..=100); | ^^^^^^^^^^^^ | = note: see issue #123646 for more information - = help: add `#![feature(pattern_type_macro)]` to the crate attributes to enable + = help: add `#![feature(pattern_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature `pattern_type_macro` - --> $DIR/feature-gate-pattern_types.rs:9:17 +error[E0658]: use of unstable library feature `pattern_types` + --> $DIR/feature-gate-pattern_types.rs:11:17 | LL | type Negative = pattern_type!(i32 is ..=0); | ^^^^^^^^^^^^ | = note: see issue #123646 for more information - = help: add `#![feature(pattern_type_macro)]` to the crate attributes to enable + = help: add `#![feature(pattern_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature `pattern_type_macro` - --> $DIR/feature-gate-pattern_types.rs:11:17 +error[E0658]: use of unstable library feature `pattern_types` + --> $DIR/feature-gate-pattern_types.rs:13:17 | LL | type Positive = pattern_type!(i32 is 0..); | ^^^^^^^^^^^^ | = note: see issue #123646 for more information - = help: add `#![feature(pattern_type_macro)]` to the crate attributes to enable + = help: add `#![feature(pattern_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature `pattern_type_macro` - --> $DIR/feature-gate-pattern_types.rs:13:15 +error[E0658]: use of unstable library feature `pattern_types` + --> $DIR/feature-gate-pattern_types.rs:15:15 | LL | type Always = pattern_type!(Option is Some(_)); | ^^^^^^^^^^^^ | = note: see issue #123646 for more information - = help: add `#![feature(pattern_type_macro)]` to the crate attributes to enable + = help: add `#![feature(pattern_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: pattern not supported in pattern types - --> $DIR/feature-gate-pattern_types.rs:13:44 + --> $DIR/feature-gate-pattern_types.rs:15:44 | LL | type Always = pattern_type!(Option is Some(_)); | ^^^^^^^ diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr b/tests/ui/type/pattern_types/feature-gate-pattern_types.enabled.stderr similarity index 81% rename from tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr rename to tests/ui/type/pattern_types/feature-gate-pattern_types.enabled.stderr index 81bf9dea0e2fd..c77bbd2756bf0 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.enabled.stderr @@ -1,5 +1,5 @@ error: pattern not supported in pattern types - --> $DIR/feature-gate-pattern_types2.rs:11:44 + --> $DIR/feature-gate-pattern_types.rs:15:44 | LL | type Always = pattern_type!(Option is Some(_)); | ^^^^^^^ diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs index a51741675bbd6..91241c00d56c9 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs @@ -1,15 +1,17 @@ +//@ revisions: disabled enabled //@ compile-flags: -Zno-analysis +#![cfg_attr(enabled, feature(pattern_types))] use std::pat::pattern_type; type NonNullU32 = pattern_type!(u32 is 1..); -//~^ ERROR use of unstable library feature `pattern_type_macro` +//[disabled]~^ ERROR use of unstable library feature `pattern_types` type Percent = pattern_type!(u32 is 0..=100); -//~^ ERROR use of unstable library feature `pattern_type_macro` +//[disabled]~^ ERROR use of unstable library feature `pattern_types` type Negative = pattern_type!(i32 is ..=0); -//~^ ERROR use of unstable library feature `pattern_type_macro` +//[disabled]~^ ERROR use of unstable library feature `pattern_types` type Positive = pattern_type!(i32 is 0..); -//~^ ERROR use of unstable library feature `pattern_type_macro` +//[disabled]~^ ERROR use of unstable library feature `pattern_types` type Always = pattern_type!(Option is Some(_)); -//~^ ERROR use of unstable library feature `pattern_type_macro` -//~| ERROR pattern not supported in pattern types +//[disabled]~^ ERROR use of unstable library feature `pattern_types` +//~^^ ERROR pattern not supported in pattern types diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs b/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs deleted file mode 100644 index c6b4b325fa35a..0000000000000 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ compile-flags: -Zno-analysis - -#![feature(pattern_type_macro)] - -use std::pat::pattern_type; - -type NonNullU32 = pattern_type!(u32 is 1..); -type Percent = pattern_type!(u32 is 0..=100); -type Negative = pattern_type!(i32 is ..=0); -type Positive = pattern_type!(i32 is 0..); -type Always = pattern_type!(Option is Some(_)); -//~^ ERROR: pattern not supported in pattern types diff --git a/tests/ui/type/pattern_types/free_const.rs b/tests/ui/type/pattern_types/free_const.rs index 2e29fce237970..96601622a352f 100644 --- a/tests/ui/type/pattern_types/free_const.rs +++ b/tests/ui/type/pattern_types/free_const.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/literals.rs b/tests/ui/type/pattern_types/literals.rs index 5ec15d1b6bd8e..407123ca8f7ef 100644 --- a/tests/ui/type/pattern_types/literals.rs +++ b/tests/ui/type/pattern_types/literals.rs @@ -1,7 +1,6 @@ //! Check where literals can be used to initialize pattern types and where not. #![feature(pattern_types, const_trait_impl, pattern_type_range_trait)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/literals.stderr b/tests/ui/type/pattern_types/literals.stderr index caf5667c8f314..f36c477126020 100644 --- a/tests/ui/type/pattern_types/literals.stderr +++ b/tests/ui/type/pattern_types/literals.stderr @@ -1,35 +1,35 @@ error[E0080]: evaluation panicked: exclusive range end at minimum value of type - --> $DIR/literals.rs:86:62 + --> $DIR/literals.rs:85:62 | LL | fn empty_range_at_base_type_min() -> pattern_type!(u32 is 0..0) { | ^ evaluation of `empty_range_at_base_type_min::{constant#1}` failed here error[E0080]: evaluation panicked: exclusive range end at minimum value of type - --> $DIR/literals.rs:91:63 + --> $DIR/literals.rs:90:63 | LL | fn empty_range_at_base_type_min2() -> pattern_type!(u32 is 0..0) { | ^ evaluation of `empty_range_at_base_type_min2::{constant#1}` failed here error[E0080]: evaluation panicked: exclusive range end at minimum value of type - --> $DIR/literals.rs:106:65 + --> $DIR/literals.rs:105:65 | LL | fn wraparound_range_at_base_ty_end() -> pattern_type!(u32 is 1..0) { | ^ evaluation of `wraparound_range_at_base_ty_end::{constant#1}` failed here error[E0080]: evaluation panicked: exclusive range end at minimum value of type - --> $DIR/literals.rs:111:66 + --> $DIR/literals.rs:110:66 | LL | fn wraparound_range_at_base_ty_end2() -> pattern_type!(u32 is 1..0) { | ^ evaluation of `wraparound_range_at_base_ty_end2::{constant#1}` failed here error[E0080]: evaluation panicked: exclusive range end at minimum value of type - --> $DIR/literals.rs:116:66 + --> $DIR/literals.rs:115:66 | LL | fn wraparound_range_at_base_ty_end3() -> pattern_type!(u32 is 1..0) { | ^ evaluation of `wraparound_range_at_base_ty_end3::{constant#1}` failed here error[E0308]: mismatched types - --> $DIR/literals.rs:9:5 + --> $DIR/literals.rs:8:5 | LL | fn out_of_range() -> pattern_type!(u32 is 1..) { | ------------------------- expected `pattern_type!(u32 is 1..)` because of return type @@ -40,19 +40,19 @@ LL | 0 found type `{integer}` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(u32 is 1..)` - --> $DIR/literals.rs:22:5 + --> $DIR/literals.rs:21:5 | LL | -3 | ^^ cannot apply unary operator `-` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is -5..=4)` - --> $DIR/literals.rs:27:5 + --> $DIR/literals.rs:26:5 | LL | -2 | ^^ cannot apply unary operator `-` error[E0308]: mismatched types - --> $DIR/literals.rs:36:5 + --> $DIR/literals.rs:35:5 | LL | fn negative_lit_at_range_start() -> pattern_type!(i8 is -5..5) { | -------------------------- expected `pattern_type!(i8 is -5..=4)` because of return type @@ -63,7 +63,7 @@ LL | -5 found type `{integer}` error[E0308]: mismatched types - --> $DIR/literals.rs:45:5 + --> $DIR/literals.rs:44:5 | LL | fn lit_one_beyond_range_end() -> pattern_type!(i8 is -5..5) { | -------------------------- expected `pattern_type!(i8 is -5..=4)` because of return type @@ -74,7 +74,7 @@ LL | 5 found type `{integer}` error[E0308]: mismatched types - --> $DIR/literals.rs:50:5 + --> $DIR/literals.rs:49:5 | LL | fn wrong_lit_kind() -> pattern_type!(u32 is 1..) { | ------------------------- expected `pattern_type!(u32 is 1..)` because of return type @@ -85,7 +85,7 @@ LL | '3' found type `char` error[E0308]: mismatched types - --> $DIR/literals.rs:55:5 + --> $DIR/literals.rs:54:5 | LL | fn char_lit_in_range() -> pattern_type!(char is 'a'..'z') { | ------------------------------- expected `pattern_type!(char is 'a'..='y')` because of return type @@ -96,7 +96,7 @@ LL | 'b' found type `char` error[E0308]: mismatched types - --> $DIR/literals.rs:60:5 + --> $DIR/literals.rs:59:5 | LL | fn char_lit_out_of_range() -> pattern_type!(char is 'a'..'z') { | ------------------------------- expected `pattern_type!(char is 'a'..='y')` because of return type @@ -107,7 +107,7 @@ LL | 'A' found type `char` error[E0308]: mismatched types - --> $DIR/literals.rs:73:5 + --> $DIR/literals.rs:72:5 | LL | fn lit_oob_single_element_range() -> pattern_type!(u32 is 0..=0) { | --------------------------- expected `pattern_type!(u32 is 0..=0)` because of return type @@ -118,7 +118,7 @@ LL | 1 found type `{integer}` error[E0308]: mismatched types - --> $DIR/literals.rs:78:5 + --> $DIR/literals.rs:77:5 | LL | fn lit_oob_single_element_range_exclusive() -> pattern_type!(u32 is 0..1) { | -------------------------- expected `pattern_type!(u32 is 0..=0)` because of return type @@ -131,7 +131,7 @@ LL | 1 error: pattern type ranges cannot wrap: 1..=0 error[E0308]: mismatched types - --> $DIR/literals.rs:97:5 + --> $DIR/literals.rs:96:5 | LL | fn empty_range() -> pattern_type!(u32 is 1..1) { | -------------------------- expected `pattern_type!(u32 is 1..=0)` because of return type @@ -142,7 +142,7 @@ LL | 0 found type `{integer}` error[E0308]: mismatched types - --> $DIR/literals.rs:102:5 + --> $DIR/literals.rs:101:5 | LL | fn empty_range2() -> pattern_type!(u32 is 1..1) { | -------------------------- expected `pattern_type!(u32 is 1..=0)` because of return type @@ -155,7 +155,7 @@ LL | 1 error: pattern type ranges cannot wrap: 2..=0 error[E0308]: mismatched types - --> $DIR/literals.rs:122:5 + --> $DIR/literals.rs:121:5 | LL | fn wraparound_range() -> pattern_type!(u32 is 2..1) { | -------------------------- expected `pattern_type!(u32 is 2..=0)` because of return type @@ -166,7 +166,7 @@ LL | 1 found type `{integer}` error[E0308]: mismatched types - --> $DIR/literals.rs:127:5 + --> $DIR/literals.rs:126:5 | LL | fn lit_in_wraparound_range() -> pattern_type!(u32 is 2..1) { | -------------------------- expected `pattern_type!(u32 is 2..=0)` because of return type @@ -177,7 +177,7 @@ LL | 0 found type `{integer}` error[E0308]: mismatched types - --> $DIR/literals.rs:132:5 + --> $DIR/literals.rs:131:5 | LL | fn lit_at_wraparound_range_start() -> pattern_type!(u32 is 2..1) { | -------------------------- expected `pattern_type!(u32 is 2..=0)` because of return type diff --git a/tests/ui/type/pattern_types/matching.rs b/tests/ui/type/pattern_types/matching.rs index 21f89b3b673be..1086baab876c1 100644 --- a/tests/ui/type/pattern_types/matching.rs +++ b/tests/ui/type/pattern_types/matching.rs @@ -1,4 +1,4 @@ -#![feature(pattern_types, pattern_type_macro, structural_match)] +#![feature(pattern_types, structural_match)] //@ check-pass //@ compile-flags: -Zvalidate-mir diff --git a/tests/ui/type/pattern_types/matching_fail.rs b/tests/ui/type/pattern_types/matching_fail.rs index 8e2c741e3e0ab..2a345635378a6 100644 --- a/tests/ui/type/pattern_types/matching_fail.rs +++ b/tests/ui/type/pattern_types/matching_fail.rs @@ -1,4 +1,4 @@ -#![feature(pattern_types, pattern_type_macro, structural_match)] +#![feature(pattern_types, structural_match)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/missing-is.rs b/tests/ui/type/pattern_types/missing-is.rs index 564b41649d899..619f37eb007e0 100644 --- a/tests/ui/type/pattern_types/missing-is.rs +++ b/tests/ui/type/pattern_types/missing-is.rs @@ -1,4 +1,4 @@ -#![feature(pattern_type_macro)] +#![feature(pattern_types)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/nested.rs b/tests/ui/type/pattern_types/nested.rs index bff83dd43902b..96fbfea9e5e6f 100644 --- a/tests/ui/type/pattern_types/nested.rs +++ b/tests/ui/type/pattern_types/nested.rs @@ -1,7 +1,6 @@ //! Check that pattern types can only have specific base types #![feature(pattern_types, const_trait_impl, pattern_type_range_trait)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/nested.stderr b/tests/ui/type/pattern_types/nested.stderr index 72f0ccc1bfb9f..f75405241ae9e 100644 --- a/tests/ui/type/pattern_types/nested.stderr +++ b/tests/ui/type/pattern_types/nested.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/nested.rs:10:63 + --> $DIR/nested.rs:9:63 | LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); | ------------------------- ^ expected `pattern_type!(u32 is 1..)`, found integer @@ -10,7 +10,7 @@ LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!( found type `{integer}` error[E0277]: `pattern_type!(u32 is 1..)` is not a valid base type for range patterns - --> $DIR/nested.rs:10:34 + --> $DIR/nested.rs:9:34 | LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ only integer types and `char` are supported @@ -28,7 +28,7 @@ LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!( and 5 others error[E0277]: `pattern_type!(i32 is 1..)` is not a valid base type for range patterns - --> $DIR/nested.rs:15:35 + --> $DIR/nested.rs:14:35 | LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ only integer types and `char` are supported @@ -46,13 +46,13 @@ LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = tod and 5 others error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i32 is 1..)` - --> $DIR/nested.rs:15:67 + --> $DIR/nested.rs:14:67 | LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); | ^^ cannot apply unary operator `-` error[E0277]: `pattern_type!(i32 is 1..)` is not a valid base type for range patterns - --> $DIR/nested.rs:19:35 + --> $DIR/nested.rs:18:35 | LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ only integer types and `char` are supported @@ -70,7 +70,7 @@ LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo! and 5 others error[E0308]: mismatched types - --> $DIR/nested.rs:19:66 + --> $DIR/nested.rs:18:66 | LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); | ^ @@ -81,7 +81,7 @@ LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo! = note: expected pattern type `pattern_type!(i32 is 1..)` found type `{integer}` help: the return type of this call is `{integer}` due to the type of the argument passed - --> $DIR/nested.rs:19:66 + --> $DIR/nested.rs:18:66 | LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); | ^ this argument influences the return type of `RangeSub` @@ -89,7 +89,7 @@ note: method defined here --> $SRC_DIR/core/src/pat.rs:LL:COL error[E0277]: `pattern_type!(i32 is 1..)` is not a valid base type for range patterns - --> $DIR/nested.rs:19:66 + --> $DIR/nested.rs:18:66 | LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); | ^ only integer types and `char` are supported @@ -107,7 +107,7 @@ LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo! and 5 others error[E0277]: `()` is not a valid base type for range patterns - --> $DIR/nested.rs:24:35 + --> $DIR/nested.rs:23:35 | LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); | ^^ only integer types and `char` are supported @@ -125,7 +125,7 @@ LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); and 5 others error[E0308]: mismatched types - --> $DIR/nested.rs:24:43 + --> $DIR/nested.rs:23:43 | LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); | ^ @@ -134,7 +134,7 @@ LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); | arguments to this function are incorrect | help: the return type of this call is `{integer}` due to the type of the argument passed - --> $DIR/nested.rs:24:43 + --> $DIR/nested.rs:23:43 | LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); | ^ this argument influences the return type of `RangeSub` @@ -142,7 +142,7 @@ note: method defined here --> $SRC_DIR/core/src/pat.rs:LL:COL error[E0277]: `()` is not a valid base type for range patterns - --> $DIR/nested.rs:24:43 + --> $DIR/nested.rs:23:43 | LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); | ^ only integer types and `char` are supported @@ -160,7 +160,7 @@ LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); and 5 others error[E0277]: `f32` is not a valid base type for range patterns - --> $DIR/nested.rs:29:49 + --> $DIR/nested.rs:28:49 | LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); | ^^^ only integer types and `char` are supported diff --git a/tests/ui/type/pattern_types/non_null.rs b/tests/ui/type/pattern_types/non_null.rs index e3c634da48b8e..5ce15eb5da319 100644 --- a/tests/ui/type/pattern_types/non_null.rs +++ b/tests/ui/type/pattern_types/non_null.rs @@ -3,7 +3,7 @@ //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" //@ only-64bit -#![feature(pattern_type_macro, pattern_types, rustc_attrs)] +#![feature(pattern_types, rustc_attrs)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/or_patterns.rs b/tests/ui/type/pattern_types/or_patterns.rs index d90f36983d0a0..e744025ddd673 100644 --- a/tests/ui/type/pattern_types/or_patterns.rs +++ b/tests/ui/type/pattern_types/or_patterns.rs @@ -2,13 +2,7 @@ //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" -#![feature( - pattern_type_macro, - pattern_types, - rustc_attrs, - const_trait_impl, - pattern_type_range_trait -)] +#![feature(pattern_types, rustc_attrs, const_trait_impl, pattern_type_range_trait)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/or_patterns.stderr b/tests/ui/type/pattern_types/or_patterns.stderr index ab757f7405eba..bda319b4be19b 100644 --- a/tests/ui/type/pattern_types/or_patterns.stderr +++ b/tests/ui/type/pattern_types/or_patterns.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/or_patterns.rs:26:24 + --> $DIR/or_patterns.rs:20:24 | LL | let _: NonNullI8 = 0; | --------- ^ expected `pattern_type!(i8 is (i8::MIN..=-1 | 1..))`, found integer @@ -10,31 +10,31 @@ LL | let _: NonNullI8 = 0; found type `{integer}` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-1 | 1..))` - --> $DIR/or_patterns.rs:28:24 + --> $DIR/or_patterns.rs:22:24 | LL | let _: NonNullI8 = -1; | ^^ cannot apply unary operator `-` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-1 | 1..))` - --> $DIR/or_patterns.rs:30:24 + --> $DIR/or_patterns.rs:24:24 | LL | let _: NonNullI8 = -128; | ^^^^ cannot apply unary operator `-` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-2 | 0..))` - --> $DIR/or_patterns.rs:37:26 + --> $DIR/or_patterns.rs:31:26 | LL | let _: NonNegOneI8 = -1; | ^^ cannot apply unary operator `-` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-2 | 0..))` - --> $DIR/or_patterns.rs:39:26 + --> $DIR/or_patterns.rs:33:26 | LL | let _: NonNegOneI8 = -2; | ^^ cannot apply unary operator `-` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-2 | 0..))` - --> $DIR/or_patterns.rs:41:26 + --> $DIR/or_patterns.rs:35:26 | LL | let _: NonNegOneI8 = -128; | ^^^^ cannot apply unary operator `-` @@ -69,7 +69,7 @@ error: layout_of(pattern_type!(i8 is (i8::MIN..=-1 | 1..))) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/or_patterns.rs:16:1 + --> $DIR/or_patterns.rs:10:1 | LL | type NonNullI8 = pattern_type!(i8 is ..0 | 1..); | ^^^^^^^^^^^^^^ @@ -104,7 +104,7 @@ error: layout_of(pattern_type!(i8 is (i8::MIN..=-2 | 0..))) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/or_patterns.rs:20:1 + --> $DIR/or_patterns.rs:14:1 | LL | type NonNegOneI8 = pattern_type!(i8 is ..-1 | 0..); | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type/pattern_types/or_patterns_invalid.rs b/tests/ui/type/pattern_types/or_patterns_invalid.rs index a99667c5412ce..e416d5d8ae45d 100644 --- a/tests/ui/type/pattern_types/or_patterns_invalid.rs +++ b/tests/ui/type/pattern_types/or_patterns_invalid.rs @@ -1,12 +1,6 @@ //! Demonstrate some use cases of or patterns -#![feature( - pattern_type_macro, - pattern_types, - rustc_attrs, - const_trait_impl, - pattern_type_range_trait -)] +#![feature(pattern_types, rustc_attrs, const_trait_impl, pattern_type_range_trait)] use std::pat::pattern_type; @@ -26,5 +20,5 @@ fn main() { //~? ERROR: allowed are two range patterns that are directly connected let not_simple_enough_for_mvp: pattern_type!(i8 is ..0 | 1..10 | 10..) = unsafe { std::mem::transmute(0) }; - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types } diff --git a/tests/ui/type/pattern_types/or_patterns_invalid.stderr b/tests/ui/type/pattern_types/or_patterns_invalid.stderr index a931b76b0d0be..669721dd0bab7 100644 --- a/tests/ui/type/pattern_types/or_patterns_invalid.stderr +++ b/tests/ui/type/pattern_types/or_patterns_invalid.stderr @@ -1,7 +1,7 @@ error: only non-overlapping pattern type ranges are allowed at present error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/or_patterns_invalid.rs:15:69 + --> $DIR/or_patterns_invalid.rs:9:69 | LL | let not_adjacent: pattern_type!(i8 is -127..0 | 1..) = unsafe { std::mem::transmute(0) }; | ^^^^^^^^^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL | let not_adjacent: pattern_type!(i8 is -127..0 | 1..) = unsafe { std::me error: one pattern needs to end at `i8::MAX`, but was 29 instead error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/or_patterns_invalid.rs:19:71 + --> $DIR/or_patterns_invalid.rs:13:71 | LL | let not_wrapping: pattern_type!(i8 is 10..20 | 20..30) = unsafe { std::mem::transmute(0) }; | ^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | let not_wrapping: pattern_type!(i8 is 10..20 | 20..30) = unsafe { std:: error: only signed integer base types are allowed for or-pattern pattern types at present error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/or_patterns_invalid.rs:23:65 + --> $DIR/or_patterns_invalid.rs:17:65 | LL | let not_signed: pattern_type!(u8 is 10.. | 0..5) = unsafe { std::mem::transmute(0) }; | ^^^^^^^^^^^^^^^^^^^ @@ -34,7 +34,7 @@ LL | let not_signed: pattern_type!(u8 is 10.. | 0..5) = unsafe { std::mem::t error: the only or-pattern types allowed are two range patterns that are directly connected at their overflow site error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/or_patterns_invalid.rs:28:18 + --> $DIR/or_patterns_invalid.rs:22:18 | LL | unsafe { std::mem::transmute(0) }; | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.rs b/tests/ui/type/pattern_types/pattern_type_mismatch.rs index 0c88f27d83686..30c368033b099 100644 --- a/tests/ui/type/pattern_types/pattern_type_mismatch.rs +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.rs @@ -1,7 +1,6 @@ //! Check that pattern types patterns must be of the type of the base type #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr index 129e4b5cdc7be..bfbee74897a1b 100644 --- a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/pattern_type_mismatch.rs:8:41 + --> $DIR/pattern_type_mismatch.rs:7:41 | LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | -- ^^^ expected `u8`, found `char` @@ -12,7 +12,7 @@ LL | const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); | + error[E0308]: mismatched types - --> $DIR/pattern_type_mismatch.rs:8:47 + --> $DIR/pattern_type_mismatch.rs:7:47 | LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | -- ^^^ expected `u8`, found `char` @@ -25,7 +25,7 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); | + error[E0308]: mismatched types - --> $DIR/pattern_type_mismatch.rs:12:43 + --> $DIR/pattern_type_mismatch.rs:11:43 | LL | const BAD_NESTING5: pattern_type!(char is 1..=1) = todo!(); | ---- ^ expected `char`, found `u8` @@ -33,7 +33,7 @@ LL | const BAD_NESTING5: pattern_type!(char is 1..=1) = todo!(); | the pattern must match the type error[E0308]: mismatched types - --> $DIR/pattern_type_mismatch.rs:12:47 + --> $DIR/pattern_type_mismatch.rs:11:47 | LL | const BAD_NESTING5: pattern_type!(char is 1..=1) = todo!(); | ---- ^ expected `char`, found `u8` diff --git a/tests/ui/type/pattern_types/range_patterns.rs b/tests/ui/type/pattern_types/range_patterns.rs index 1ad6469967cbc..5edf357299c98 100644 --- a/tests/ui/type/pattern_types/range_patterns.rs +++ b/tests/ui/type/pattern_types/range_patterns.rs @@ -1,6 +1,4 @@ #![feature(pattern_types, rustc_attrs, const_trait_impl, pattern_type_range_trait)] -#![feature(pattern_type_macro)] -#![allow(incomplete_features)] //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" diff --git a/tests/ui/type/pattern_types/range_patterns.stderr b/tests/ui/type/pattern_types/range_patterns.stderr index a1e085ffe44ff..5ed826fa66331 100644 --- a/tests/ui/type/pattern_types/range_patterns.stderr +++ b/tests/ui/type/pattern_types/range_patterns.stderr @@ -28,7 +28,7 @@ error: layout_of(NonZero) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:10:1 + --> $DIR/range_patterns.rs:8:1 | LL | type X = std::num::NonZeroU32; | ^^^^^^ @@ -63,7 +63,7 @@ error: layout_of(pattern_type!(u32 is 1..)) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:12:1 + --> $DIR/range_patterns.rs:10:1 | LL | type Y = pattern_type!(u32 is 1..); | ^^^^^^ @@ -130,7 +130,7 @@ error: layout_of(Option) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:14:1 + --> $DIR/range_patterns.rs:12:1 | LL | type Z = Option; | ^^^^^^ @@ -197,7 +197,7 @@ error: layout_of(Option>) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:16:1 + --> $DIR/range_patterns.rs:14:1 | LL | type A = Option; | ^^^^^^ @@ -232,7 +232,7 @@ error: layout_of(NonZeroU32New) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:18:1 + --> $DIR/range_patterns.rs:16:1 | LL | struct NonZeroU32New(pattern_type!(u32 is 1..)); | ^^^^^^^^^^^^^^^^^^^^ @@ -240,19 +240,19 @@ LL | struct NonZeroU32New(pattern_type!(u32 is 1..)); error: pattern type ranges cannot wrap: 1..=0 error: the type has an unknown layout - --> $DIR/range_patterns.rs:21:1 + --> $DIR/range_patterns.rs:19:1 | LL | type EMPTY = pattern_type!(u32 is 1..1); | ^^^^^^^^^^ error[E0080]: evaluation panicked: exclusive range end at minimum value of type - --> $DIR/range_patterns.rs:24:37 + --> $DIR/range_patterns.rs:22:37 | LL | type WRAP = pattern_type!(u32 is 1..0); | ^ evaluation of `WRAP::{constant#1}` failed here error: the type has an unknown layout - --> $DIR/range_patterns.rs:24:1 + --> $DIR/range_patterns.rs:22:1 | LL | type WRAP = pattern_type!(u32 is 1..0); | ^^^^^^^^^ @@ -260,7 +260,7 @@ LL | type WRAP = pattern_type!(u32 is 1..0); error: pattern type ranges cannot wrap: 5..=1 error: the type has an unknown layout - --> $DIR/range_patterns.rs:28:1 + --> $DIR/range_patterns.rs:26:1 | LL | type WRAP2 = pattern_type!(u32 is 5..2); | ^^^^^^^^^^ @@ -295,7 +295,7 @@ error: layout_of(pattern_type!(i8 is -10..=10)) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:31:1 + --> $DIR/range_patterns.rs:29:1 | LL | type SIGN = pattern_type!(i8 is -10..=10); | ^^^^^^^^^ @@ -330,7 +330,7 @@ error: layout_of(pattern_type!(i8 is i8::MIN..=0)) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:34:1 + --> $DIR/range_patterns.rs:32:1 | LL | type MIN = pattern_type!(i8 is -128..=0); | ^^^^^^^^ @@ -338,7 +338,7 @@ LL | type MIN = pattern_type!(i8 is -128..=0); error: pattern type ranges cannot wrap: 120..=-120 error: the type has an unknown layout - --> $DIR/range_patterns.rs:37:1 + --> $DIR/range_patterns.rs:35:1 | LL | type SignedWrap = pattern_type!(i8 is 120..=-120); | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/type/pattern_types/range_patterns_inherent_impls.rs b/tests/ui/type/pattern_types/range_patterns_inherent_impls.rs index fe8feda0934e2..14107463511f3 100644 --- a/tests/ui/type/pattern_types/range_patterns_inherent_impls.rs +++ b/tests/ui/type/pattern_types/range_patterns_inherent_impls.rs @@ -1,6 +1,4 @@ #![feature(pattern_types, rustc_attrs)] -#![feature(pattern_type_macro)] -#![allow(incomplete_features)] //! check that pattern types can have traits implemented for them if //! their base type is a local type. diff --git a/tests/ui/type/pattern_types/range_patterns_inherent_impls.stderr b/tests/ui/type/pattern_types/range_patterns_inherent_impls.stderr index ed2e4c0bd5f8c..f01510557588c 100644 --- a/tests/ui/type/pattern_types/range_patterns_inherent_impls.stderr +++ b/tests/ui/type/pattern_types/range_patterns_inherent_impls.stderr @@ -1,12 +1,12 @@ error[E0390]: cannot define inherent `impl` for primitive types outside of `core` - --> $DIR/range_patterns_inherent_impls.rs:12:1 + --> $DIR/range_patterns_inherent_impls.rs:10:1 | LL | impl Y { | ^^^^^^ | = help: consider moving this inherent impl into `core` if possible help: alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items - --> $DIR/range_patterns_inherent_impls.rs:14:5 + --> $DIR/range_patterns_inherent_impls.rs:12:5 | LL | fn foo() {} | ^^^^^^^^ diff --git a/tests/ui/type/pattern_types/range_patterns_trait_impls.rs b/tests/ui/type/pattern_types/range_patterns_trait_impls.rs index 1731cd470fe2c..e7c5479e43d0c 100644 --- a/tests/ui/type/pattern_types/range_patterns_trait_impls.rs +++ b/tests/ui/type/pattern_types/range_patterns_trait_impls.rs @@ -1,6 +1,4 @@ #![feature(pattern_types, rustc_attrs)] -#![feature(pattern_type_macro)] -#![allow(incomplete_features)] //! check that pattern types can have local traits //! implemented for them. diff --git a/tests/ui/type/pattern_types/range_patterns_trait_impls2.rs b/tests/ui/type/pattern_types/range_patterns_trait_impls2.rs index 90f80a2f34645..d367bd174f3ef 100644 --- a/tests/ui/type/pattern_types/range_patterns_trait_impls2.rs +++ b/tests/ui/type/pattern_types/range_patterns_trait_impls2.rs @@ -1,6 +1,4 @@ #![feature(pattern_types, rustc_attrs)] -#![feature(pattern_type_macro)] -#![allow(incomplete_features)] //! check that pattern types can have local traits //! implemented for them. diff --git a/tests/ui/type/pattern_types/range_patterns_trait_impls2.stderr b/tests/ui/type/pattern_types/range_patterns_trait_impls2.stderr index 4517c7e910f4e..2f372751277a2 100644 --- a/tests/ui/type/pattern_types/range_patterns_trait_impls2.stderr +++ b/tests/ui/type/pattern_types/range_patterns_trait_impls2.stderr @@ -1,5 +1,5 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/range_patterns_trait_impls2.rs:12:1 + --> $DIR/range_patterns_trait_impls2.rs:10:1 | LL | impl Eq for Y {} | ^^^^^^^^^^^^- diff --git a/tests/ui/type/pattern_types/range_patterns_unusable.rs b/tests/ui/type/pattern_types/range_patterns_unusable.rs index 98f13ca0bc0bb..d023541d12e48 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable.rs +++ b/tests/ui/type/pattern_types/range_patterns_unusable.rs @@ -1,6 +1,4 @@ #![feature(pattern_types, rustc_attrs)] -#![feature(pattern_type_macro)] -#![allow(incomplete_features)] //! Some practical niche checks. diff --git a/tests/ui/type/pattern_types/range_patterns_unusable.stderr b/tests/ui/type/pattern_types/range_patterns_unusable.stderr index 5c61f6347bbfc..15e83bfad5228 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable.stderr +++ b/tests/ui/type/pattern_types/range_patterns_unusable.stderr @@ -1,5 +1,5 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/range_patterns_unusable.rs:13:35 + --> $DIR/range_patterns_unusable.rs:11:35 | LL | let _: Option = unsafe { std::mem::transmute(z) }; | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type/pattern_types/range_patterns_unusable_math.rs b/tests/ui/type/pattern_types/range_patterns_unusable_math.rs index 71becd28d1cac..f44ac1e7be392 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable_math.rs +++ b/tests/ui/type/pattern_types/range_patterns_unusable_math.rs @@ -1,6 +1,4 @@ #![feature(pattern_types, rustc_attrs)] -#![feature(pattern_type_macro)] -#![allow(incomplete_features)] //! check that pattern types don't have an `Add` impl. diff --git a/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr b/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr index b55031dc3cf8b..5dab944cfe2de 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr +++ b/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr @@ -1,5 +1,5 @@ error[E0369]: cannot add `u32` to `pattern_type!(u32 is 1..)` - --> $DIR/range_patterns_unusable_math.rs:14:15 + --> $DIR/range_patterns_unusable_math.rs:12:15 | LL | let x = x + 1_u32; | - ^ ----- u32 diff --git a/tests/ui/type/pattern_types/range_patterns_usage.rs b/tests/ui/type/pattern_types/range_patterns_usage.rs index 0ecbdcaa0f7a3..5d09785e8faa8 100644 --- a/tests/ui/type/pattern_types/range_patterns_usage.rs +++ b/tests/ui/type/pattern_types/range_patterns_usage.rs @@ -1,6 +1,4 @@ #![feature(pattern_types, rustc_attrs)] -#![feature(pattern_type_macro)] -#![allow(incomplete_features)] //@ check-pass //! check that pattern types can actually be part of code that compiles successfully. diff --git a/tests/ui/type/pattern_types/reverse_range.rs b/tests/ui/type/pattern_types/reverse_range.rs index 34c931e4e965a..8d0fd8ca1b628 100644 --- a/tests/ui/type/pattern_types/reverse_range.rs +++ b/tests/ui/type/pattern_types/reverse_range.rs @@ -1,6 +1,5 @@ //! Check that the range start must be smaller than the range end #![feature(pattern_types, const_trait_impl, pattern_type_range_trait)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/reverse_range.stderr b/tests/ui/type/pattern_types/reverse_range.stderr index 6e6e34409a39e..bcaf19790ba38 100644 --- a/tests/ui/type/pattern_types/reverse_range.stderr +++ b/tests/ui/type/pattern_types/reverse_range.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation panicked: exclusive range end at minimum value of type - --> $DIR/reverse_range.rs:7:36 + --> $DIR/reverse_range.rs:6:36 | LL | const NONE: pattern_type!(u8 is 1..0) = unsafe { std::mem::transmute(3_u8) }; | ^ evaluation of `NONE::{constant#1}` failed here diff --git a/tests/ui/type/pattern_types/signed_ranges.rs b/tests/ui/type/pattern_types/signed_ranges.rs index 3725fbda7292a..e18c0299cbba6 100644 --- a/tests/ui/type/pattern_types/signed_ranges.rs +++ b/tests/ui/type/pattern_types/signed_ranges.rs @@ -1,5 +1,4 @@ #![feature(pattern_types)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/signed_ranges.stderr b/tests/ui/type/pattern_types/signed_ranges.stderr index 79bf8501b639f..66df48363af65 100644 --- a/tests/ui/type/pattern_types/signed_ranges.stderr +++ b/tests/ui/type/pattern_types/signed_ranges.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `u8: Neg` is not satisfied - --> $DIR/signed_ranges.rs:14:9 + --> $DIR/signed_ranges.rs:13:9 | LL | -10..253 => {} | ^^^ the trait `Neg` is not implemented for `u8` @@ -16,13 +16,13 @@ LL | -10..253 => {} and 12 others error[E0277]: the trait bound `char: Neg` is not satisfied - --> $DIR/signed_ranges.rs:20:9 + --> $DIR/signed_ranges.rs:19:9 | LL | -'\0'..'a' => {} | ^^^^^ the trait `Neg` is not implemented for `char` error[E0600]: cannot apply unary operator `-` to type `u32` - --> $DIR/signed_ranges.rs:6:34 + --> $DIR/signed_ranges.rs:5:34 | LL | type Sign = pattern_type!(u32 is -10..); | ^^^ cannot apply unary operator `-` @@ -30,7 +30,7 @@ LL | type Sign = pattern_type!(u32 is -10..); = note: unsigned values cannot be negated error[E0600]: cannot apply unary operator `-` to type `char` - --> $DIR/signed_ranges.rs:9:41 + --> $DIR/signed_ranges.rs:8:41 | LL | type SignedChar = pattern_type!(char is -'A'..); | ^^^^ cannot apply unary operator `-` diff --git a/tests/ui/type/pattern_types/transmute.rs b/tests/ui/type/pattern_types/transmute.rs index 4e686245f9375..77f99253543ca 100644 --- a/tests/ui/type/pattern_types/transmute.rs +++ b/tests/ui/type/pattern_types/transmute.rs @@ -1,7 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(pattern_types, pattern_type_macro, generic_pattern_types)] +#![feature(pattern_types, generic_pattern_types)] #![expect(incomplete_features)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/unimplemented_pat.rs b/tests/ui/type/pattern_types/unimplemented_pat.rs index 44851ec1a1049..7e57e1f7ff8d6 100644 --- a/tests/ui/type/pattern_types/unimplemented_pat.rs +++ b/tests/ui/type/pattern_types/unimplemented_pat.rs @@ -1,7 +1,7 @@ //! This test ensures we do not ICE for unimplemented //! patterns even if the feature gate is enabled. -#![feature(pattern_type_macro, pattern_types)] +#![feature(pattern_types)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/unsize.rs b/tests/ui/type/pattern_types/unsize.rs index 1020dd8c21544..18d9a52a9195e 100644 --- a/tests/ui/type/pattern_types/unsize.rs +++ b/tests/ui/type/pattern_types/unsize.rs @@ -2,7 +2,7 @@ //@ check-pass -#![feature(pattern_type_macro, pattern_types)] +#![feature(pattern_types)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/validity.rs b/tests/ui/type/pattern_types/validity.rs index f4c62dc6712e9..cbabe06c312ce 100644 --- a/tests/ui/type/pattern_types/validity.rs +++ b/tests/ui/type/pattern_types/validity.rs @@ -3,7 +3,6 @@ //@ normalize-stderr: "([[:xdigit:]]{2}\s){4,8}\s+│\s.{4,8}" -> "HEX_DUMP" #![feature(pattern_types, const_trait_impl, pattern_type_range_trait)] -#![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/validity.stderr b/tests/ui/type/pattern_types/validity.stderr index 7cfa6b3400a41..9ddc07ce89cee 100644 --- a/tests/ui/type/pattern_types/validity.stderr +++ b/tests/ui/type/pattern_types/validity.stderr @@ -1,5 +1,5 @@ error[E0080]: constructing invalid value of type pattern_type!(u32 is 1..): encountered 0, but expected something greater or equal to 1 - --> $DIR/validity.rs:10:1 + --> $DIR/validity.rs:9:1 | LL | const BAD: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -10,7 +10,7 @@ LL | const BAD: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) }; } error[E0080]: reading memory at ALLOC$ID[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory - --> $DIR/validity.rs:13:1 + --> $DIR/validity.rs:12:1 | LL | const BAD_UNINIT: pattern_type!(u32 is 1..) = | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_UNINIT` failed here @@ -20,7 +20,7 @@ LL | const BAD_UNINIT: pattern_type!(u32 is 1..) = } error[E0080]: unable to turn pointer into integer - --> $DIR/validity.rs:17:1 + --> $DIR/validity.rs:16:1 | LL | const BAD_PTR: pattern_type!(usize is 1..) = unsafe { std::mem::transmute(&42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_PTR` failed here @@ -29,7 +29,7 @@ LL | const BAD_PTR: pattern_type!(usize is 1..) = unsafe { std::mem::transmute(& = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: constructing invalid value of type (pattern_type!(u32 is 1..), u32): at .0, encountered 0, but expected something greater or equal to 1 - --> $DIR/validity.rs:20:1 + --> $DIR/validity.rs:19:1 | LL | const BAD_AGGREGATE: (pattern_type!(u32 is 1..), u32) = (unsafe { std::mem::transmute(0) }, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -40,7 +40,7 @@ LL | const BAD_AGGREGATE: (pattern_type!(u32 is 1..), u32) = (unsafe { std::mem: } error[E0080]: constructing invalid value of type Foo: at .0.0, encountered 0, but expected something greater or equal to 1 - --> $DIR/validity.rs:26:1 + --> $DIR/validity.rs:25:1 | LL | const BAD_FOO: Foo = Foo(Bar(unsafe { std::mem::transmute(0) })); | ^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -51,7 +51,7 @@ LL | const BAD_FOO: Foo = Foo(Bar(unsafe { std::mem::transmute(0) })); } error[E0080]: reading memory at ALLOC$ID[0x0..0x4], but memory is uninitialized at [0x0..0x4], and this operation requires initialized memory - --> $DIR/validity.rs:29:1 + --> $DIR/validity.rs:28:1 | LL | const CHAR_UNINIT: pattern_type!(char is 'A'..'Z') = | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `CHAR_UNINIT` failed here @@ -61,7 +61,7 @@ LL | const CHAR_UNINIT: pattern_type!(char is 'A'..'Z') = } error[E0080]: constructing invalid value of type pattern_type!(char is 'A'..='Y'): encountered 97, but expected something in the range 65..=89 - --> $DIR/validity.rs:33:1 + --> $DIR/validity.rs:32:1 | LL | const CHAR_OOB_PAT: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute('a') }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value @@ -72,7 +72,7 @@ LL | const CHAR_OOB_PAT: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::tr } error[E0080]: constructing invalid value of type pattern_type!(char is 'A'..='Y'): encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) - --> $DIR/validity.rs:36:1 + --> $DIR/validity.rs:35:1 | LL | const CHAR_OOB: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute(u32::MAX) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value diff --git a/tests/ui/unpretty/exhaustive.expanded.stdout b/tests/ui/unpretty/exhaustive.expanded.stdout index 3551d40dffbfc..0bd7aca6a007b 100644 --- a/tests/ui/unpretty/exhaustive.expanded.stdout +++ b/tests/ui/unpretty/exhaustive.expanded.stdout @@ -21,7 +21,6 @@ #![feature(more_qualified_paths)] #![feature(never_patterns)] #![feature(pattern_types)] -#![feature(pattern_type_macro)] #![feature(prelude_import)] #![feature(specialization)] #![feature(trace_macros)] @@ -632,7 +631,7 @@ mod types { /*! FIXME: todo */ } /// TyKind::Pat - fn ty_pat() { let _: u32 is const 1..; } + fn ty_pat() { let _: k#pattern_type(u32 is const 1..); } } mod visibilities { /// VisibilityKind::Public diff --git a/tests/ui/unpretty/exhaustive.hir.stderr b/tests/ui/unpretty/exhaustive.hir.stderr index 276bc5b5d2573..5ca4b080a95e5 100644 --- a/tests/ui/unpretty/exhaustive.hir.stderr +++ b/tests/ui/unpretty/exhaustive.hir.stderr @@ -1,17 +1,17 @@ error[E0697]: closures cannot be static - --> $DIR/exhaustive.rs:210:9 + --> $DIR/exhaustive.rs:209:9 | LL | static || value; | ^^^^^^^^^ error[E0697]: closures cannot be static - --> $DIR/exhaustive.rs:211:9 + --> $DIR/exhaustive.rs:210:9 | LL | static move || value; | ^^^^^^^^^^^^^^ error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/exhaustive.rs:240:13 + --> $DIR/exhaustive.rs:239:13 | LL | fn expr_await() { | --------------- this is not `async` @@ -20,19 +20,19 @@ LL | fut.await; | ^^^^^ only allowed inside `async` functions and blocks error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/exhaustive.rs:291:9 + --> $DIR/exhaustive.rs:290:9 | LL | _; | ^ `_` not allowed here error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:301:9 + --> $DIR/exhaustive.rs:300:9 | LL | x::(); | ^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:302:9 + --> $DIR/exhaustive.rs:301:9 | LL | x::(T, T) -> T; | ^^^^^^^^^^^^^^ only `Fn` traits may use parentheses @@ -44,31 +44,31 @@ LL + x:: -> T; | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:303:9 + --> $DIR/exhaustive.rs:302:9 | LL | crate::() -> ()::expressions::() -> ()::expr_path; | ^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:303:26 + --> $DIR/exhaustive.rs:302:26 | LL | crate::() -> ()::expressions::() -> ()::expr_path; | ^^^^^^^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:306:9 + --> $DIR/exhaustive.rs:305:9 | LL | core::()::marker::()::PhantomData; | ^^^^^^^^ only `Fn` traits may use parentheses error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:306:19 + --> $DIR/exhaustive.rs:305:19 | LL | core::()::marker::()::PhantomData; | ^^^^^^^^^^ only `Fn` traits may use parentheses error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks - --> $DIR/exhaustive.rs:393:9 + --> $DIR/exhaustive.rs:392:9 | LL | yield; | ^^^^^ @@ -79,7 +79,7 @@ LL | #[coroutine] fn expr_yield() { | ++++++++++++ error[E0703]: invalid ABI: found `C++` - --> $DIR/exhaustive.rs:473:23 + --> $DIR/exhaustive.rs:472:23 | LL | unsafe extern "C++" {} | ^^^^^ invalid ABI @@ -87,7 +87,7 @@ LL | unsafe extern "C++" {} = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions error: `..` patterns are not allowed here - --> $DIR/exhaustive.rs:675:13 + --> $DIR/exhaustive.rs:674:13 | LL | let ..; | ^^ @@ -95,13 +95,13 @@ LL | let ..; = note: only allowed in tuple, tuple struct, and slice patterns error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/exhaustive.rs:790:16 + --> $DIR/exhaustive.rs:789:16 | LL | let _: T() -> !; | ^^^^^^^^ only `Fn` traits may use parentheses error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:804:16 + --> $DIR/exhaustive.rs:803:16 | LL | let _: impl Send; | ^^^^^^^^^ @@ -112,7 +112,7 @@ LL | let _: impl Send; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:805:16 + --> $DIR/exhaustive.rs:804:16 | LL | let _: impl Send + 'static; | ^^^^^^^^^^^^^^^^^^^ @@ -123,7 +123,7 @@ LL | let _: impl Send + 'static; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:806:16 + --> $DIR/exhaustive.rs:805:16 | LL | let _: impl 'static + Send; | ^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | let _: impl 'static + Send; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:807:16 + --> $DIR/exhaustive.rs:806:16 | LL | let _: impl ?Sized; | ^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL | let _: impl ?Sized; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:808:16 + --> $DIR/exhaustive.rs:807:16 | LL | let _: impl [const] Clone; | ^^^^^^^^^^^^^^^^^^ @@ -156,7 +156,7 @@ LL | let _: impl [const] Clone; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0562]: `impl Trait` is not allowed in the type of variable bindings - --> $DIR/exhaustive.rs:809:16 + --> $DIR/exhaustive.rs:808:16 | LL | let _: impl for<'a> Send; | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unpretty/exhaustive.hir.stdout b/tests/ui/unpretty/exhaustive.hir.stdout index 6af4d3b5b81de..4726e9aa762e7 100644 --- a/tests/ui/unpretty/exhaustive.hir.stdout +++ b/tests/ui/unpretty/exhaustive.hir.stdout @@ -1,9 +1,8 @@ #![attr = Feature([auto_traits#0, internal_syntax#0, const_trait_impl#0, coroutines#0, decl_macro#0, deref_patterns#0, explicit_tail_calls#0, forced_keywords#0, gen_blocks#0, more_qualified_paths#0, never_patterns#0, -pattern_types#0, pattern_type_macro#0, prelude_import#0, specialization#0, -trace_macros#0, trait_alias#0, try_blocks#0, try_blocks_heterogeneous#0, -yeet_expr#0])] +pattern_types#0, prelude_import#0, specialization#0, trace_macros#0, +trait_alias#0, try_blocks#0, try_blocks_heterogeneous#0, yeet_expr#0])] #![attr = LintCheck([LintCheck {lint_name: LintName { tool: None, name: "incomplete_features" }, kind: Allow}, LintCheck {lint_name: LintName { tool: None, name: "unused_attributes" }, diff --git a/tests/ui/unpretty/exhaustive.rs b/tests/ui/unpretty/exhaustive.rs index 15f684fc3dd72..36cc724351a64 100644 --- a/tests/ui/unpretty/exhaustive.rs +++ b/tests/ui/unpretty/exhaustive.rs @@ -20,7 +20,6 @@ #![feature(more_qualified_paths)] #![feature(never_patterns)] #![feature(pattern_types)] -#![feature(pattern_type_macro)] #![feature(prelude_import)] #![feature(specialization)] #![feature(trace_macros)] @@ -846,7 +845,7 @@ mod types { /// TyKind::Pat fn ty_pat() { - let _: core::pattern_type!(u32 is 1..); + let _: pattern_type!(u32 is 1..); } } From 8f7bf49027808e4b050e193258c9eda39745ddf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Thu, 5 Nov 2026 00:49:56 +0100 Subject: [PATCH 04/34] Turn `view_type` into a macro 2.0 that expands to `k#view_type(...)` This also means that it's now available under `core::view` instead of `core` directly. This makes it consistent with the `std` re-export which is only available under `std::view` and not under `std` directly. Moreover, drop library feature `view_type_macro` and demote language feature `view_types` to a library feature. This is nice because it means `std::view::view_type` is no longer unnecessarily gated behind two (!) feature gates. --- compiler/rustc_ast_passes/src/feature_gate.rs | 4 -- compiler/rustc_ast_pretty/src/pprust/state.rs | 6 +++ compiler/rustc_ast_pretty/src/pprust/tests.rs | 2 +- compiler/rustc_builtin_macros/src/lib.rs | 2 - .../rustc_builtin_macros/src/view_type.rs | 47 ------------------- compiler/rustc_feature/src/unstable.rs | 2 - compiler/rustc_parse/src/parser/mod.rs | 4 +- compiler/rustc_parse/src/parser/ty.rs | 15 ++++++ compiler/rustc_span/src/symbol.rs | 2 +- library/core/src/lib.rs | 2 +- library/core/src/view.rs | 14 +++--- library/std/src/lib.rs | 2 +- library/std/src/view.rs | 2 +- tests/ui/view-types/auxiliary/hygiene.rs | 2 +- tests/ui/view-types/duplicate_field.rs | 3 +- tests/ui/view-types/duplicate_field.stderr | 8 ++-- .../ui/view-types/feature-gate-view-types.rs | 4 +- .../view-types/feature-gate-view-types.stderr | 8 ++-- tests/ui/view-types/hygiene.rs | 2 +- tests/ui/view-types/must-be-struct.rs | 3 +- tests/ui/view-types/must-be-struct.stderr | 6 +-- tests/ui/view-types/must-exist.rs | 3 +- tests/ui/view-types/must-exist.stderr | 4 +- tests/ui/view-types/must-restrict.rs | 2 +- tests/ui/view-types/syntax-errors.rs | 3 +- tests/ui/view-types/syntax-errors.stderr | 20 ++++---- tests/ui/view-types/tuple-structs.rs | 2 +- 27 files changed, 67 insertions(+), 107 deletions(-) delete mode 100644 compiler/rustc_builtin_macros/src/view_type.rs diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 02adcc2296610..89105722f6c8e 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -241,9 +241,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { // Function pointers cannot be `const` self.check_late_bound_lifetime_defs(&fn_ptr_ty.generic_params); } - ast::TyKind::View(..) => { - gate!(self, view_types, ty.span, "view types are unstable"); - } _ => {} } visit::walk_ty(self, ty) @@ -466,7 +463,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { gate_all!(unnamed_enum_variants, "unnamed enum variants are experimental"); gate_all!(unsafe_binders, "unsafe binder types are experimental"); gate_all!(unsafe_fields, "`unsafe` fields are experimental"); - gate_all!(view_types, "view types are experimental"); gate_all!(where_clause_attrs, "attributes in `where` clause are unstable"); gate_all!(yeet_expr, "`do yeet` expression is experimental"); // tidy-alphabetical-end diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index a5dbaf81376c1..36096cb09eb1b 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -1437,9 +1437,12 @@ impl<'a> State<'a> { self.word("..."); } ast::TyKind::Pat(ty, pat) => { + self.word("k#pattern_type"); + self.popen(); self.print_type(ty); self.word(" is "); self.print_ty_pat(pat); + self.pclose(); } ast::TyKind::FieldOf(ty, variant, field) => { self.word("k#field_of"); @@ -1459,8 +1462,11 @@ impl<'a> State<'a> { self.pclose(); } ast::TyKind::View(ty, fields) => { + self.word("k#view_type"); + self.popen(); self.print_type(ty); self.print_view(fields); + self.pclose(); } ast::TyKind::GcaMacro(expr) => { self.word_nbsp("core::gca!"); diff --git a/compiler/rustc_ast_pretty/src/pprust/tests.rs b/compiler/rustc_ast_pretty/src/pprust/tests.rs index 43bb68216d929..1a5a518ee41e0 100644 --- a/compiler/rustc_ast_pretty/src/pprust/tests.rs +++ b/compiler/rustc_ast_pretty/src/pprust/tests.rs @@ -80,6 +80,6 @@ fn test_field_view() { }; let ty_str = ty_to_string(&ty); - assert_eq!(ty_str, "(/*DUMMY*/).{ milhouse, apu }"); + assert_eq!(ty_str, "k#view_type((/*DUMMY*/).{ milhouse, apu })"); }); } diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index f801dc5917d8a..9a0e28609bf47 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -50,7 +50,6 @@ mod source_util; mod test; mod test_binder_constraints; mod trace_macros; -mod view_type; pub mod asm; pub mod cmdline_attrs; @@ -104,7 +103,6 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) { test_binder_constraints: test_binder_constraints::expand, trace_macros: trace_macros::expand_trace_macros, unreachable: edition_panic::expand_unreachable, - view_type: view_type::expand, // tidy-alphabetical-end } diff --git a/compiler/rustc_builtin_macros/src/view_type.rs b/compiler/rustc_builtin_macros/src/view_type.rs deleted file mode 100644 index 69bd8f2727fc3..0000000000000 --- a/compiler/rustc_builtin_macros/src/view_type.rs +++ /dev/null @@ -1,47 +0,0 @@ -use rustc_ast::token::TokenKind; -use rustc_ast::tokenstream::TokenStream; -use rustc_ast::{Ty, ast}; -use rustc_errors::PResult; -use rustc_expand::base::{self, DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult}; -use rustc_parse::parser::{ExpTokenPair, TokenType}; -use rustc_span::{Ident, Span}; -use thin_vec::ThinVec; - -pub(crate) fn expand<'cx>( - cx: &'cx mut ExtCtxt<'_>, - sp: Span, - tts: TokenStream, -) -> MacroExpanderResult<'cx> { - let (ty, pat) = match parse_view_ty(cx, tts) { - Ok(parsed) => parsed, - Err(err) => { - return ExpandResult::Ready(DummyResult::any(sp, err.emit_err())); - } - }; - - ExpandResult::Ready(base::MacEager::ty(cx.ty(sp, ast::TyKind::View(ty, pat)))) -} - -fn parse_view_ty<'a>( - cx: &mut ExtCtxt<'a>, - stream: TokenStream, -) -> PResult<'a, (Box, ThinVec)> { - let mut parser = cx.new_parser_from_tts(stream); - - let ty = parser.parse_ty()?; - - parser.expect(ExpTokenPair { tok: TokenKind::Dot, token_type: TokenType::Dot })?; - - let fields = match parser.parse_delim_comma_seq( - ExpTokenPair { tok: TokenKind::OpenBrace, token_type: TokenType::OpenBrace }, - ExpTokenPair { tok: TokenKind::CloseBrace, token_type: TokenType::CloseBrace }, - |p| p.parse_field_name(), - ) { - Ok((fields, _)) => fields, - Err(diag) => { - return Err(diag); - } - }; - - Ok((ty, fields)) -} diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index bd203ccf6e218..e8f7400af076e 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -778,8 +778,6 @@ declare_features! ( (internal, unsized_fn_params, "1.49.0", Some(48055)), /// Allows using the `#[used(linker)]` (or `#[used(compiler)]`) attribute. (unstable, used_with_arg, "1.60.0", Some(93798)), - /// Allows view types. - (unstable, view_types, "1.97.0", Some(155938)), /// Target features on wasm. (unstable, wasm_target_feature, "1.30.0", Some(150260)), /// Allows use of attributes in `where` clauses. diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index a89fd9b6298f3..10f4d73e3e4cd 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1101,7 +1101,7 @@ impl<'a> Parser<'a> { /// Parses a comma-separated sequence, including both delimiters. /// The function `f` must consume tokens until reaching the next separator or /// closing bracket. - pub fn parse_delim_comma_seq( + fn parse_delim_comma_seq( &mut self, open: ExpTokenPair, close: ExpTokenPair, @@ -1351,7 +1351,7 @@ impl<'a> Parser<'a> { /// ```enbf /// FieldName = IntLit | Ident /// ``` - pub fn parse_field_name(&mut self) -> PResult<'a, Ident> { + fn parse_field_name(&mut self) -> PResult<'a, Ident> { if let token::Literal(token::Lit { kind: token::Integer, symbol, suffix }) = self.token.kind { if let Some(suffix) = suffix { diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 029aab9e0e601..f09faad96e16a 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -425,6 +425,8 @@ impl<'a> Parser<'a> { self.parse_ty_field_of(lo)? } else if self.eat_forced_keyword_noexpect(kw::PatternType) { self.parse_pat_ty(lo)? + } else if self.eat_forced_keyword_noexpect(kw::ViewType) { + self.parse_view_ty(lo)? } else { let msg = format!("expected type, found {}", super::token_descr(&self.token)); let mut err = self.dcx().struct_span_err(lo, msg); @@ -923,6 +925,19 @@ impl<'a> Parser<'a> { ast::TyPat { id: DUMMY_NODE_ID, kind, span } } + fn parse_view_ty(&mut self, lo: Span) -> PResult<'a, ast::TyKind> { + self.expect(exp!(OpenParen))?; + let ty = self.parse_ty()?; + self.expect(exp!(Dot))?; + let (fields, _) = self + .parse_delim_comma_seq(exp!(OpenBrace), exp!(CloseBrace), |p| p.parse_field_name())?; + self.expect(exp!(CloseParen))?; + + self.psess.gated_spans.gate(sym::internal_syntax, lo.to(self.prev_token.span)); + + Ok(ast::TyKind::View(ty, fields)) + } + /// Parses a function pointer type (`TyKind::FnPtr`). /// ```ignore (illustrative) /// [unsafe] [extern "ABI"] fn (S) -> T diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 6b5299d7eb1be..99192f89c4d01 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -141,6 +141,7 @@ symbols! { TypeAscribe: "type_ascribe", Union: "union", UnwrapBinder: "unwrap_binder", + ViewType: "view_type", WrapBinder: "wrap_binder", Yeet: "yeet", // tidy-alphabetical-end @@ -2387,7 +2388,6 @@ symbols! { vgpr384, vgpr512, vgpr1024, - view_type, view_types, vis, visible_private_types, diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 00c7c3c824cfa..186f2ab1002db 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -350,7 +350,7 @@ mod bool; mod escape; mod tuple; mod unit; -#[unstable(feature = "view_type_macro", issue = "155938")] +#[unstable(feature = "view_types", issue = "155938")] pub mod view; #[stable(feature = "core_primitive", since = "1.43.0")] diff --git a/library/core/src/view.rs b/library/core/src/view.rs index 68eca3f3598d2..c68382b2effc9 100644 --- a/library/core/src/view.rs +++ b/library/core/src/view.rs @@ -2,7 +2,7 @@ /// Creates a view type. /// ``` -/// #![feature(view_types, view_type_macro)] +/// #![feature(view_types)] // /// struct Foo { /// bar: usize, @@ -11,11 +11,9 @@ /// /// type FooBar = std::view::view_type!(Foo.{ bar }); /// ``` -#[macro_export] -#[rustc_builtin_macro(view_type)] -#[unstable(feature = "view_type_macro", issue = "155938")] -macro_rules! view_type { - ($($arg:tt)*) => { - /* compiler built-in */ - }; +#[allow_internal_unstable(internal_syntax)] +#[unstable(feature = "view_types", issue = "155938")] +#[diagnostic::opaque] +pub macro view_type($($arg:tt)*) { + k#view_type($($arg)*) } diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 0c3d29324c9ae..6b0d32f3ba5f2 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -649,7 +649,7 @@ pub mod process; pub mod random; pub mod sync; pub mod time; -#[unstable(feature = "view_type_macro", issue = "155938")] +#[unstable(feature = "view_types", issue = "155938")] pub mod view; // Pull in `std_float` crate into std. The contents of diff --git a/library/std/src/view.rs b/library/std/src/view.rs index 5806cf27c2cc8..3e0e7d1d1038a 100644 --- a/library/std/src/view.rs +++ b/library/std/src/view.rs @@ -1,3 +1,3 @@ //! Helper module for exporting the `view_types` macro. -pub use core::view_type; +pub use core::view::view_type; diff --git a/tests/ui/view-types/auxiliary/hygiene.rs b/tests/ui/view-types/auxiliary/hygiene.rs index cf842b56e6970..3b022299733c9 100644 --- a/tests/ui/view-types/auxiliary/hygiene.rs +++ b/tests/ui/view-types/auxiliary/hygiene.rs @@ -1,6 +1,6 @@ //@ edition:2015 -#![feature(view_types, view_type_macro)] +#![feature(view_types)] pub use std::view::view_type; diff --git a/tests/ui/view-types/duplicate_field.rs b/tests/ui/view-types/duplicate_field.rs index b45580510b6cb..4b3e0ca0850e0 100644 --- a/tests/ui/view-types/duplicate_field.rs +++ b/tests/ui/view-types/duplicate_field.rs @@ -1,5 +1,4 @@ -#![feature(view_types, view_type_macro)] -#![allow(unused)] +#![feature(view_types)] use std::view::view_type; diff --git a/tests/ui/view-types/duplicate_field.stderr b/tests/ui/view-types/duplicate_field.stderr index f0162f6e0a67d..c974b0ead238a 100644 --- a/tests/ui/view-types/duplicate_field.stderr +++ b/tests/ui/view-types/duplicate_field.stderr @@ -1,5 +1,5 @@ error: field `bar` is already part of the view - --> $DIR/duplicate_field.rs:13:38 + --> $DIR/duplicate_field.rs:12:38 | LL | _foo: &mut view_type!(Foo.{ bar, bar }), | --- ^^^ @@ -7,7 +7,7 @@ LL | _foo: &mut view_type!(Foo.{ bar, bar }), | field `bar` is declared as viewed here error: field `0` is already part of the view - --> $DIR/duplicate_field.rs:15:38 + --> $DIR/duplicate_field.rs:14:38 | LL | _pair: &mut view_type!(Pair.{ 0, 0 }), | - ^ @@ -15,7 +15,7 @@ LL | _pair: &mut view_type!(Pair.{ 0, 0 }), | field `0` is declared as viewed here error: field `bar` is already part of the view - --> $DIR/duplicate_field.rs:21:44 + --> $DIR/duplicate_field.rs:20:44 | LL | fn f(self: &mut view_type!(Self.{ bar, bar })) {} | --- ^^^ @@ -23,7 +23,7 @@ LL | fn f(self: &mut view_type!(Self.{ bar, bar })) {} | field `bar` is declared as viewed here error: field `0` is already part of the view - --> $DIR/duplicate_field.rs:26:42 + --> $DIR/duplicate_field.rs:25:42 | LL | fn f(self: &mut view_type!(Self.{ 0, 0 })) {} | - ^ diff --git a/tests/ui/view-types/feature-gate-view-types.rs b/tests/ui/view-types/feature-gate-view-types.rs index 961f96e18bb99..d30c737c130c7 100644 --- a/tests/ui/view-types/feature-gate-view-types.rs +++ b/tests/ui/view-types/feature-gate-view-types.rs @@ -8,6 +8,6 @@ struct Foo { } type FooBar = view_type!(Foo.{ bar }); -//~^ ERROR use of unstable library feature `view_type_macro` +//~^ ERROR use of unstable library feature `view_types` type FooBaz = view_type!(Foo.{ baz }); -//~^ ERROR use of unstable library feature `view_type_macro` +//~^ ERROR use of unstable library feature `view_types` diff --git a/tests/ui/view-types/feature-gate-view-types.stderr b/tests/ui/view-types/feature-gate-view-types.stderr index 407bf343ca13b..bda3aebf2b744 100644 --- a/tests/ui/view-types/feature-gate-view-types.stderr +++ b/tests/ui/view-types/feature-gate-view-types.stderr @@ -1,21 +1,21 @@ -error[E0658]: use of unstable library feature `view_type_macro` +error[E0658]: use of unstable library feature `view_types` --> $DIR/feature-gate-view-types.rs:10:15 | LL | type FooBar = view_type!(Foo.{ bar }); | ^^^^^^^^^ | = note: see issue #155938 for more information - = help: add `#![feature(view_type_macro)]` to the crate attributes to enable + = help: add `#![feature(view_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature `view_type_macro` +error[E0658]: use of unstable library feature `view_types` --> $DIR/feature-gate-view-types.rs:12:15 | LL | type FooBaz = view_type!(Foo.{ baz }); | ^^^^^^^^^ | = note: see issue #155938 for more information - = help: add `#![feature(view_type_macro)]` to the crate attributes to enable + = help: add `#![feature(view_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 2 previous errors diff --git a/tests/ui/view-types/hygiene.rs b/tests/ui/view-types/hygiene.rs index 15a9f7f228f90..20d184e184697 100644 --- a/tests/ui/view-types/hygiene.rs +++ b/tests/ui/view-types/hygiene.rs @@ -1,7 +1,7 @@ //@ run-pass //@ aux-build: hygiene.rs -#![feature(view_types, view_type_macro, decl_macro)] +#![feature(view_types, decl_macro)] #![allow(unused)] extern crate hygiene; diff --git a/tests/ui/view-types/must-be-struct.rs b/tests/ui/view-types/must-be-struct.rs index fb30ef1234cc5..2ee8fb6430f13 100644 --- a/tests/ui/view-types/must-be-struct.rs +++ b/tests/ui/view-types/must-be-struct.rs @@ -1,5 +1,4 @@ -#![feature(view_types, view_type_macro)] -#![allow(unused)] +#![feature(view_types)] use std::view::view_type; diff --git a/tests/ui/view-types/must-be-struct.stderr b/tests/ui/view-types/must-be-struct.stderr index 3d47e4903af6c..51b6f0bec8ebe 100644 --- a/tests/ui/view-types/must-be-struct.stderr +++ b/tests/ui/view-types/must-be-struct.stderr @@ -1,17 +1,17 @@ error: only structs can be viewed - --> $DIR/must-be-struct.rs:11:9 + --> $DIR/must-be-struct.rs:10:9 | LL | fn f(_: view_type!(Foo.{})) {} | ^^^^^^^^^^^^^^^^^^ `Foo` is an enum, it cannot be viewed error: only structs can be viewed - --> $DIR/must-be-struct.rs:13:9 + --> $DIR/must-be-struct.rs:12:9 | LL | fn g(_: view_type!(u8.{})) {} | ^^^^^^^^^^^^^^^^^ type `u8` cannot be viewed error: only structs can be viewed - --> $DIR/must-be-struct.rs:15:9 + --> $DIR/must-be-struct.rs:14:9 | LL | fn h(_: view_type!(char.{})) {} | ^^^^^^^^^^^^^^^^^^^ type `char` cannot be viewed diff --git a/tests/ui/view-types/must-exist.rs b/tests/ui/view-types/must-exist.rs index efb43eb509e9c..da912c1ee9749 100644 --- a/tests/ui/view-types/must-exist.rs +++ b/tests/ui/view-types/must-exist.rs @@ -1,5 +1,4 @@ -#![feature(view_types, view_type_macro)] -#![allow(unused)] +#![feature(view_types)] use std::view::view_type; diff --git a/tests/ui/view-types/must-exist.stderr b/tests/ui/view-types/must-exist.stderr index a775ad84a7edf..d977f060754d2 100644 --- a/tests/ui/view-types/must-exist.stderr +++ b/tests/ui/view-types/must-exist.stderr @@ -1,11 +1,11 @@ error[E0609]: no field `bar` on type `S` - --> $DIR/must-exist.rs:10:24 + --> $DIR/must-exist.rs:9:24 | LL | fn f(_: view_type!(S.{ bar })) {} | ^^^ error[E0609]: no field `bar` on type `S` - --> $DIR/must-exist.rs:12:29 + --> $DIR/must-exist.rs:11:29 | LL | fn g(_: view_type!(S.{ foo, bar })) {} | ^^^ diff --git a/tests/ui/view-types/must-restrict.rs b/tests/ui/view-types/must-restrict.rs index c0e1f5115d27c..a523f07e9aadd 100644 --- a/tests/ui/view-types/must-restrict.rs +++ b/tests/ui/view-types/must-restrict.rs @@ -1,7 +1,7 @@ //@ known-bug: unknown //@ run-pass -#![feature(view_types, view_type_macro)] +#![feature(view_types)] #![allow(unused)] use std::view::view_type; diff --git a/tests/ui/view-types/syntax-errors.rs b/tests/ui/view-types/syntax-errors.rs index 18ccb859d549e..84bcb977827e0 100644 --- a/tests/ui/view-types/syntax-errors.rs +++ b/tests/ui/view-types/syntax-errors.rs @@ -1,5 +1,4 @@ -#![feature(view_types, view_type_macro)] -#![allow(unused)] +#![feature(view_types)] use std::view::view_type; diff --git a/tests/ui/view-types/syntax-errors.stderr b/tests/ui/view-types/syntax-errors.stderr index 1c1e5fdafae1a..479151b267e2e 100644 --- a/tests/ui/view-types/syntax-errors.stderr +++ b/tests/ui/view-types/syntax-errors.stderr @@ -1,17 +1,17 @@ error: expected identifier, found reserved identifier `_` - --> $DIR/syntax-errors.rs:12:49 + --> $DIR/syntax-errors.rs:11:49 | LL | fn not_a_field(self: &mut view_type!(Self.{ _ }), _: &mut view_type!(Foo.{ _ })) {} | ^ expected identifier, found reserved identifier error: expected identifier, found reserved identifier `_` - --> $DIR/syntax-errors.rs:12:80 + --> $DIR/syntax-errors.rs:11:80 | LL | fn not_a_field(self: &mut view_type!(Self.{ _ }), _: &mut view_type!(Foo.{ _ })) {} | ^ expected identifier, found reserved identifier error: expected identifier, found keyword `where` - --> $DIR/syntax-errors.rs:18:44 + --> $DIR/syntax-errors.rs:17:44 | LL | fn keyword(self: &mut view_type!(Foo.{ where }), _: &mut view_type!(Foo.{ for })) {} | ^^^^^ expected identifier, found keyword @@ -22,7 +22,7 @@ LL | fn keyword(self: &mut view_type!(Foo.{ r#where }), _: &mut view_type!(F | ++ error: expected identifier, found keyword `for` - --> $DIR/syntax-errors.rs:18:79 + --> $DIR/syntax-errors.rs:17:79 | LL | fn keyword(self: &mut view_type!(Foo.{ where }), _: &mut view_type!(Foo.{ for })) {} | ^^^ expected identifier, found keyword @@ -33,7 +33,7 @@ LL | fn keyword(self: &mut view_type!(Foo.{ where }), _: &mut view_type!(Foo | ++ error: expected one of `,` or `}`, found `baz` - --> $DIR/syntax-errors.rs:24:49 + --> $DIR/syntax-errors.rs:23:49 | LL | fn no_comma(self: &mut view_type!(Foo.{ bar baz }), _: &mut view_type!(Foo.{ bar baz })) {} | -^^^ expected one of `,` or `}` @@ -41,7 +41,7 @@ LL | fn no_comma(self: &mut view_type!(Foo.{ bar baz }), _: &mut view_type!( | help: missing `,` error: expected one of `,` or `}`, found `baz` - --> $DIR/syntax-errors.rs:24:86 + --> $DIR/syntax-errors.rs:23:86 | LL | fn no_comma(self: &mut view_type!(Foo.{ bar baz }), _: &mut view_type!(Foo.{ bar baz })) {} | -^^^ expected one of `,` or `}` @@ -49,25 +49,25 @@ LL | fn no_comma(self: &mut view_type!(Foo.{ bar baz }), _: &mut view_type!( | help: missing `,` error[E0609]: no field `_` on type `Foo` - --> $DIR/syntax-errors.rs:12:49 + --> $DIR/syntax-errors.rs:11:49 | LL | fn not_a_field(self: &mut view_type!(Self.{ _ }), _: &mut view_type!(Foo.{ _ })) {} | ^ error[E0609]: no field `_` on type `Foo` - --> $DIR/syntax-errors.rs:12:80 + --> $DIR/syntax-errors.rs:11:80 | LL | fn not_a_field(self: &mut view_type!(Self.{ _ }), _: &mut view_type!(Foo.{ _ })) {} | ^ error[E0609]: no field `r#where` on type `Foo` - --> $DIR/syntax-errors.rs:18:44 + --> $DIR/syntax-errors.rs:17:44 | LL | fn keyword(self: &mut view_type!(Foo.{ where }), _: &mut view_type!(Foo.{ for })) {} | ^^^^^ error[E0609]: no field `r#for` on type `Foo` - --> $DIR/syntax-errors.rs:18:79 + --> $DIR/syntax-errors.rs:17:79 | LL | fn keyword(self: &mut view_type!(Foo.{ where }), _: &mut view_type!(Foo.{ for })) {} | ^^^ diff --git a/tests/ui/view-types/tuple-structs.rs b/tests/ui/view-types/tuple-structs.rs index f0442d4e308fb..04dd222cef98d 100644 --- a/tests/ui/view-types/tuple-structs.rs +++ b/tests/ui/view-types/tuple-structs.rs @@ -1,6 +1,6 @@ //@ run-pass -#![feature(view_types, view_type_macro)] +#![feature(view_types)] #![allow(unused)] use std::view::view_type; From 44a7763b6610270a7523d5227a113f729d1fefa8 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Fri, 6 Nov 2026 23:27:30 +0000 Subject: [PATCH 05/34] Upgrade bundled musl to 1.2.6 This also includes these 3 patches for musl CVEs: - [CVE-2026-6042]: denial of service in iconv - [CVE-2026-6042]: qsort stack buffer overflow - [CVE-2026-107891]: integer overflow in regcomp The first two were already being applied to our build of musl 1.2.5, the third one is new. [CVE-2026-6042]: https://www.openwall.com/lists/musl/2026/04/03/2 [CVE-2026-40200]: https://www.openwall.com/lists/musl/2026/04/10/3 [CVE-2026-107891]: https://www.openwall.com/lists/musl/2026/10/21/1 --- .../targets/aarch64_be_unknown_linux_musl.rs | 2 +- .../targets/aarch64_unknown_linux_musl.rs | 2 +- .../targets/arm_unknown_linux_musleabi.rs | 2 +- .../targets/arm_unknown_linux_musleabihf.rs | 2 +- .../targets/armv5te_unknown_linux_musleabi.rs | 2 +- .../targets/armv7_unknown_linux_musleabi.rs | 2 +- .../targets/armv7_unknown_linux_musleabihf.rs | 2 +- .../targets/hexagon_unknown_linux_musl.rs | 2 +- .../spec/targets/i686_unknown_linux_musl.rs | 2 +- .../targets/loongarch64_unknown_linux_musl.rs | 2 +- .../spec/targets/mips64_openwrt_linux_musl.rs | 2 +- .../targets/mips64_unknown_linux_muslabi64.rs | 2 +- .../mips64el_unknown_linux_muslabi64.rs | 2 +- .../spec/targets/mips_unknown_linux_musl.rs | 2 +- .../spec/targets/mipsel_unknown_linux_musl.rs | 2 +- .../targets/powerpc64_unknown_linux_musl.rs | 2 +- .../targets/powerpc64le_unknown_linux_musl.rs | 2 +- .../targets/powerpc_unknown_linux_musl.rs | 2 +- .../targets/riscv32gc_unknown_linux_musl.rs | 2 +- .../targets/riscv64gc_unknown_linux_musl.rs | 2 +- .../spec/targets/s390x_unknown_linux_musl.rs | 2 +- .../thumbv7neon_unknown_linux_musleabihf.rs | 2 +- .../targets/x86_64_unikraft_linux_musl.rs | 2 +- .../spec/targets/x86_64_unknown_linux_musl.rs | 2 +- src/ci/docker/README.md | 18 +- .../dist-arm-linux-musl/Dockerfile | 2 - .../dist-i586-gnu-i586-i686-musl/Dockerfile | 1 + .../i586-linux-gnu.defconfig | 2 +- .../dist-loongarch64-linux/Dockerfile | 4 +- .../dist-loongarch64-musl/Dockerfile | 6 +- .../loongarch64-unknown-linux-musl.defconfig | 2 +- .../dist-powerpc64-linux-musl/Dockerfile | 4 +- .../powerpc64-unknown-linux-musl.defconfig | 2 +- .../dist-powerpc64le-linux-musl/Dockerfile | 4 +- .../powerpc64le-unknown-linux-musl.defconfig | 2 +- .../dist-riscv64-linux-musl/Dockerfile | 4 +- .../riscv64-unknown-linux-musl.defconfig | 2 +- .../host-x86_64/dist-various-1/Dockerfile | 1 + .../host-x86_64/dist-various-2/Dockerfile | 1 + .../host-x86_64/dist-x86_64-musl/Dockerfile | 2 - .../host-x86_64/test-various/Dockerfile | 2 - src/ci/docker/scripts/crosstool-ng-git.sh | 30 ---- src/ci/docker/scripts/crosstool-ng.sh | 10 +- .../docker/scripts/musl-cve-2026-107891.diff | 168 ++++++++++++++++++ src/ci/docker/scripts/musl-toolchain.sh | 17 +- src/ci/docker/scripts/musl.sh | 48 +---- src/doc/rustc/src/platform-support.md | 52 +++--- .../src/platform-support/loongarch-linux.md | 2 +- .../riscv64gc-unknown-linux-musl.md | 2 +- .../s390x-unknown-linux-musl.md | 2 +- 50 files changed, 273 insertions(+), 165 deletions(-) delete mode 100644 src/ci/docker/scripts/crosstool-ng-git.sh create mode 100644 src/ci/docker/scripts/musl-cve-2026-107891.diff diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs index d3bf641a747fa..5e9d64fc2040c 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64_be-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.5".into()), + description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs index 6ba5112342c3e..439baa41fb1f5 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("ARM64 Linux with musl 1.2.5".into()), + description: Some("ARM64 Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs index 5dce420428768..07e24361387ff 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv6 Linux with musl 1.2.5".into()), + description: Some("Armv6 Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs index 5b1d1e2a5a48e..005123340a2fe 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Armv6 Linux with musl 1.2.5, hardfloat".into()), + description: Some("Armv6 Linux with musl 1.2.6, hardfloat".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs index b5a31a9821e2b..d5dfcc0c9af7f 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv5TE Linux with musl 1.2.5".into()), + description: Some("Armv5TE Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs index 66e1eb1115e50..ef49c26587d95 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv7-A Linux with musl 1.2.5".into()), + description: Some("Armv7-A Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs index 39c45161082ab..462945c6a0898 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Armv7-A Linux with musl 1.2.5, hardfloat".into()), + description: Some("Armv7-A Linux with musl 1.2.6, hardfloat".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs index 92c477f53f8f3..37322eaae6d08 100644 --- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "hexagon-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("Hexagon Linux with musl 1.2.5".into()), + description: Some("Hexagon Linux with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs index 212c2b8db56da..28d57cf4a0e3e 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs @@ -33,7 +33,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("32-bit Linux with musl 1.2.5".into()), + description: Some("32-bit Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs index 4030152071303..73ce78392d472 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("LoongArch64 Linux (LP64D ABI) with musl 1.2.5".into()), + description: Some("LoongArch64 Linux (LP64D ABI) with musl 1.2.6".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs index ec91dbeb86ef9..d6cb6bb7003f1 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs @@ -14,7 +14,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 for OpenWrt Linux musl 1.2.5".into()), + description: Some("MIPS64 for OpenWrt Linux musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs index c83d371692e69..1dd1c9deeab3d 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 Linux, N64 ABI, musl 1.2.5".into()), + description: Some("MIPS64 Linux, N64 ABI, musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs index 5685e84f140a4..32ba090486e2b 100644 --- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64el-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 Linux, N64 ABI, musl 1.2.5".into()), + description: Some("MIPS64 Linux, N64 ABI, musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs index 7e3bebc60e9d3..fc9dfa35ade71 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mips-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS Linux with musl 1.2.5".into()), + description: Some("MIPS Linux with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs index c94f2fd87e589..c0151fd8e4fcf 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS (little endian) Linux with musl 1.2.5".into()), + description: Some("MIPS (little endian) Linux with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs index 474d20d2f0544..9464665774db8 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit PowerPC Linux with musl 1.2.5".into()), + description: Some("64-bit PowerPC Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs index 0060a41d79d08..77cb5cdb147ff 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64le-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit PowerPC Linux with musl 1.2.5, Little Endian".into()), + description: Some("64-bit PowerPC Linux with musl 1.2.6, Little Endian".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs index 7e494e065a048..eaef449e4fd19 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("PowerPC Linux with musl 1.2.5".into()), + description: Some("PowerPC Linux with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs index e5618ea6b20da..4f3942108f39f 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "riscv32-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("RISC-V Linux (kernel 5.4, musl 1.2.5)".into()), + description: Some("RISC-V Linux (kernel 5.4, musl 1.2.6)".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs index 088d4821042d8..883b6839c5e55 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("RISC-V Linux (kernel 4.20, musl 1.2.5)".into()), + description: Some("RISC-V Linux (kernel 4.20, musl 1.2.6)".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs index 5ff9f025ba1d9..422d80d8b1453 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "s390x-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("S390x Linux (kernel 3.2, musl 1.2.5)".into()), + description: Some("S390x Linux (kernel 3.2, musl 1.2.6)".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs index dc4f8987d5d24..1ae4daa6c9227 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.5".into()), + description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs index c5421f3e6b748..7e57145705ed9 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit Unikraft with musl 1.2.5".into()), + description: Some("64-bit Unikraft with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs index a664f22479913..bce0f174cde3d 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs @@ -23,7 +23,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit Linux with musl 1.2.5".into()), + description: Some("64-bit Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 167121a5a000c..d71c65f43e703 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -263,7 +263,7 @@ For targets: `loongarch64-unknown-linux-gnu` - Operating System > Linux kernel version = 5.19.16 - Binary utilities > Version of binutils = 2.46.1 - C-library > glibc version = 2.36 -- C compiler > gcc version = 16.1.0 +- C compiler > gcc version = 16.2.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `loongarch64-unknown-linux-musl.defconfig` @@ -278,8 +278,8 @@ For targets: `loongarch64-unknown-linux-musl` - Operating System > Target OS = linux - Operating System > Linux kernel version = 5.19.16 - Binary utilities > Version of binutils = 2.46.1 -- C-library > musl version = 1.2.5 -- C compiler > gcc version = 16.1.0 +- C-library > musl version = 1.2.6 +- C compiler > gcc version = 16.2.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `mips-linux-gnu.defconfig` @@ -408,8 +408,8 @@ For targets: `powerpc64-unknown-linux-musl` - Operating System > Target OS = linux - Operating System > Linux kernel version = 4.19 - Binary utilities > Version of binutils = 2.42 -- C-library > musl version = 1.2.5 -- C compiler > gcc version = 14.2.0 +- C-library > musl version = 1.2.6 +- C compiler > gcc version = 14.4.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `powerpc64le-unknown-linux-gnu.defconfig` @@ -426,7 +426,7 @@ For targets: `powerpc64le-unknown-linux-gnu` - Operating System > Linux kernel version = 3.10 - Binary utilities > Version of binutils = 2.42 - C-library > glibc version = 2.17 -- C compiler > gcc version = 14.2.0 +- C compiler > gcc version = 14.4.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `powerpc64le-unknown-linux-musl.defconfig` @@ -442,8 +442,8 @@ For targets: `powerpc64le-unknown-linux-musl` - Operating System > Target OS = linux - Operating System > Linux kernel version = 4.19 - Binary utilities > Version of binutils = 2.42 -- C-library > musl version = 1.2.5 -- C compiler > gcc version = 14.2.0 +- C-library > musl version = 1.2.6 +- C compiler > gcc version = 14.4.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `riscv64-unknown-linux-gnu.defconfig` @@ -474,7 +474,7 @@ For targets: `riscv64-unknown-linux-musl` - Operating System > Target OS = linux - Operating System > Linux kernel version = 4.20.17 - Binary utilities > Version of binutils = 2.40 -- C-library > musl version = 1.2.5 +- C-library > musl version = 1.2.6 - C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM diff --git a/src/ci/docker/host-x86_64/dist-arm-linux-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-arm-linux-musl/Dockerfile index a34b97d9b3b7a..99667d68ab7ad 100644 --- a/src/ci/docker/host-x86_64/dist-arm-linux-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-arm-linux-musl/Dockerfile @@ -6,8 +6,6 @@ RUN sh /scripts/cross-apt-packages.sh WORKDIR /build COPY scripts/musl-toolchain.sh /build/ -COPY scripts/musl-cve-2026-6042.diff /build/ -COPY scripts/musl-cve-2026-40200.diff /build/ # We need to mitigate rust-lang/rust#34978 when compiling musl itself as well RUN CFLAGS="-Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ CXXFLAGS="-Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile index 00506601c4319..682664136dc1d 100644 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile @@ -42,6 +42,7 @@ WORKDIR /build/ COPY scripts/musl.sh /build/ COPY scripts/musl-cve-2026-6042.diff /build/ COPY scripts/musl-cve-2026-40200.diff /build/ +COPY scripts/musl-cve-2026-107891.diff /build/ RUN CC=gcc CFLAGS="-m32 -Wa,-mrelax-relocations=no" \ CXX=g++ CXXFLAGS="-m32 -Wa,-mrelax-relocations=no" \ bash musl.sh i686 --target=i686 && \ diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig index ac9c40f77873e..78544ea69e89f 100644 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig +++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig @@ -15,4 +15,4 @@ CT_BINUTILS_EXTRA_CONFIG_ARRAY="--enable-compressed-debug-sections=none" CT_GLIBC_V_2_17=y CT_GCC_V_8=y CT_CC_LANG_CXX=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile index 06dc3db645205..a94b9dbc062d3 100644 --- a/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile @@ -12,9 +12,9 @@ RUN apt-get update && \ llvm-23 \ lld-23 -COPY scripts/crosstool-ng-git.sh /scripts/ +COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng-git.sh +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile index 65406baddc70a..203d93ce93a5b 100644 --- a/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile @@ -12,9 +12,11 @@ RUN apt-get update && \ llvm-23 \ lld-23 -COPY scripts/crosstool-ng-git.sh /scripts/ +COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng-git.sh +COPY scripts/musl-cve-2026-40200.diff /scripts/ +COPY scripts/musl-cve-2026-107891.diff /scripts/ +RUN sh /scripts/crosstool-ng.sh musl COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig b/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig index 07fed33600f29..4ca94af4d6a1e 100644 --- a/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig +++ b/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig @@ -14,7 +14,7 @@ CT_KERNEL_LINUX=y CT_LINUX_V_5_19=y CT_LINUX_VERSION="5.19.16" CT_LIBC_MUSL=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y CT_BINUTILS_V_2_46=y CT_GCC_V_16=y CT_CC_GCC_ENABLE_DEFAULT_PIE=y diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/Dockerfile index bfbad2c70de61..befe0be6a9d34 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/Dockerfile @@ -5,7 +5,9 @@ RUN sh /scripts/cross-apt-packages.sh COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng.sh +COPY scripts/musl-cve-2026-40200.diff /scripts/ +COPY scripts/musl-cve-2026-107891.diff /scripts/ +RUN sh /scripts/crosstool-ng.sh musl COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/powerpc64-unknown-linux-musl.defconfig b/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/powerpc64-unknown-linux-musl.defconfig index 6a9e38a8902a8..7a83ad57e5e61 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/powerpc64-unknown-linux-musl.defconfig +++ b/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/powerpc64-unknown-linux-musl.defconfig @@ -12,7 +12,7 @@ CT_KERNEL_LINUX=y CT_LINUX_V_4_19=y CT_LINUX_VERSION="4.19.325" CT_LIBC_MUSL=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y CT_BINUTILS_V_2_42=y CT_GCC_V_14=y CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/Dockerfile index 615f41028dbc0..69b86ee27860d 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/Dockerfile @@ -5,7 +5,9 @@ RUN sh /scripts/cross-apt-packages.sh COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng.sh +COPY scripts/musl-cve-2026-40200.diff /scripts/ +COPY scripts/musl-cve-2026-107891.diff /scripts/ +RUN sh /scripts/crosstool-ng.sh musl COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/powerpc64le-unknown-linux-musl.defconfig b/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/powerpc64le-unknown-linux-musl.defconfig index c141dbb00eaca..c3aab5574a6de 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/powerpc64le-unknown-linux-musl.defconfig +++ b/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/powerpc64le-unknown-linux-musl.defconfig @@ -13,7 +13,7 @@ CT_KERNEL_LINUX=y CT_LINUX_V_4_19=y CT_LINUX_VERSION="4.19.325" CT_LIBC_MUSL=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y CT_BINUTILS_V_2_42=y CT_GCC_V_14=y CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/Dockerfile index bb7537fc7d279..a497762acb9b7 100644 --- a/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/Dockerfile @@ -5,7 +5,9 @@ RUN sh /scripts/cross-apt-packages.sh COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng.sh +COPY scripts/musl-cve-2026-40200.diff /scripts/ +COPY scripts/musl-cve-2026-107891.diff /scripts/ +RUN sh /scripts/crosstool-ng.sh musl COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/riscv64-unknown-linux-musl.defconfig b/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/riscv64-unknown-linux-musl.defconfig index 435a2bea80d36..9dab511ab1e6d 100644 --- a/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/riscv64-unknown-linux-musl.defconfig +++ b/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/riscv64-unknown-linux-musl.defconfig @@ -11,6 +11,6 @@ CT_KERNEL_LINUX=y CT_LINUX_V_4_20=y CT_LIBC_MUSL=y CT_BINUTILS_V_2_40=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y CT_GCC_V_8=y CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile index 1d06128948aae..b9a4d1b46a34d 100644 --- a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile @@ -67,6 +67,7 @@ ENV STAGING_DIR=/tmp COPY scripts/musl.sh /build COPY scripts/musl-cve-2026-6042.diff /build/ COPY scripts/musl-cve-2026-40200.diff /build/ +COPY scripts/musl-cve-2026-107891.diff /build/ RUN env \ CC=arm-linux-gnueabi-gcc CFLAGS="-march=armv5te -marm -mfloat-abi=soft" \ CXX=arm-linux-gnueabi-g++ CXXFLAGS="-march=armv5te -marm -mfloat-abi=soft" \ diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile index 6be97366544cf..077213154310f 100644 --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -66,6 +66,7 @@ WORKDIR /build COPY scripts/musl.sh /build COPY scripts/musl-cve-2026-6042.diff /build/ COPY scripts/musl-cve-2026-40200.diff /build/ +COPY scripts/musl-cve-2026-107891.diff /build/ RUN env \ CC=arm-linux-gnueabi-gcc-9 CFLAGS="-march=armv7-a" \ CXX=arm-linux-gnueabi-g++-9 CXXFLAGS="-march=armv7-a" \ diff --git a/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile index aaca6b2bb9afa..68f914a81552d 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile @@ -25,8 +25,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /build/ COPY scripts/musl-toolchain.sh /build/ -COPY scripts/musl-cve-2026-6042.diff /build/ -COPY scripts/musl-cve-2026-40200.diff /build/ # We need to mitigate rust-lang/rust#34978 when compiling musl itself as well RUN CFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ CXXFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 3136e38da5a43..dc6ba8e592dcd 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -35,8 +35,6 @@ ENV PATH="/node/bin:${PATH}" WORKDIR /build/ COPY scripts/musl-toolchain.sh /build/ -COPY scripts/musl-cve-2026-6042.diff /build/ -COPY scripts/musl-cve-2026-40200.diff /build/ RUN bash musl-toolchain.sh x86_64 && rm -rf build WORKDIR / diff --git a/src/ci/docker/scripts/crosstool-ng-git.sh b/src/ci/docker/scripts/crosstool-ng-git.sh deleted file mode 100644 index faccd7dc9bbf5..0000000000000 --- a/src/ci/docker/scripts/crosstool-ng-git.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -set -ex - -# ignore-tidy-file-linelength - -URL=https://github.com/crosstool-ng/crosstool-ng -REV=27cd8380e72bb1cf3e7cf4a06a9cdbdc57df6f72 - -mkdir crosstool-ng -cd crosstool-ng -git init -git fetch --depth=1 ${URL} ${REV} -git reset --hard FETCH_HEAD - -# https://github.com/crosstool-ng/crosstool-ng/issues/1832 -# "download source of zlib is invalid now" -sed -e "s|zlib.net/'|zlib.net/fossils'|" -i packages/zlib/package.desc - -# FIXME(#158718): patch crosstools-ng known-good kernel artifact SHA256 -# checksums to the artifacts we mirror in `ci-mirrors`. -# See -# . -patch -p1 . patch -p1 = 1.2.7. + cp /scripts/musl-cve-2026-40200.diff packages/musl/1.2.6/0002-cve-2026-40200.patch + cp /scripts/musl-cve-2026-107891.diff packages/musl/1.2.6/0003-cve-2026-107891.patch +fi + ./bootstrap ./configure --prefix=/usr/local make -j$(nproc) diff --git a/src/ci/docker/scripts/musl-cve-2026-107891.diff b/src/ci/docker/scripts/musl-cve-2026-107891.diff new file mode 100644 index 0000000000000..2abae19db458c --- /dev/null +++ b/src/ci/docker/scripts/musl-cve-2026-107891.diff @@ -0,0 +1,168 @@ +>From 7813e9119eb5fe681b6750b8a033a0490bca0941 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Thu, 23 Apr 2026 21:22:18 +0000 +Subject: [PATCH] regex: avoid int overflow in regcomp + +regcomp has many int arith ops that may overflow. before tre_expand_ast +int values are limited by 2x the input length n, e.g.: + + input ERE int field max value + aaaaaaaaaaaa... position n + ()()()()()()... submatch_id n/2+1 + ()||||||||||... num_tags 2n-3 + +so overflow before expand requires large n (and a lot of memory). later +some values can become big due to repetitions: + + input ERE int field that overflows + (((a{255}){255}){255}){255} position + ((a|b*){255,}){255,} num_transitions + +num_transitions and memory use can be big without {k,} repetitions too: + + input ERE what max value + (a|a|a|a...|a)* num_transitions n^2/4 + (()|a|a|...|a)* sum tnfa tags > n^3/16 - n^2 + +so memory can run out quickly as n grows (with 31bit va space 1700 long +input is enough even without {k,}) about half is tnfa and half is ast +firstpos/lastpos data. but overflow can happen before allocations fail. + +fix early overflow by limiting n. the stack usage is in [n,11n] without +repetitions, usually 7n, so the stack limit got adjusted too. the limit +is such that almost all inputs that worked before still work. + +overflows during and after expand are fixed by explicit checks via a +check_add helper and xcalloc instead of xmalloc. +--- + src/regex/regcomp.c | 41 +++++++++++++++++++++++++++++++++++------ + 1 file changed, 35 insertions(+), 6 deletions(-) + +diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c +index b4b81968..a7115b12 100644 +--- a/src/regex/regcomp.c ++++ b/src/regex/regcomp.c +@@ -1680,6 +1680,12 @@ tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree, + AST to TNFA compilation routines. + */ + ++/* check if a+b overflows for a,b in [0,INT_MAX] */ ++static int check_add(unsigned a, unsigned b) ++{ ++ return a + b > INT_MAX; ++} ++ + typedef enum { + COPY_RECURSE, + COPY_SET_RESULT_PTR +@@ -1731,6 +1737,8 @@ tre_copy_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + /* XXX - e.g. [ab] has only one position but two + nodes, so we are creating holes in the state space + here. Not fatal, just wastes memory. */ ++ if (check_add(pos, *pos_add)) ++ return REG_ESPACE; + pos += *pos_add; + num_copied++; + } +@@ -1826,6 +1834,8 @@ tre_copy_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + break; + } + } ++ if (check_add(*pos_add, num_copied)) ++ return REG_ESPACE; + *pos_add += num_copied; + return status; + } +@@ -1870,6 +1880,8 @@ tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + tre_literal_t *lit= node->obj; + if (!IS_SPECIAL(lit) || IS_BACKREF(lit)) + { ++ if (check_add(lit->position, pos_add)) ++ return REG_ESPACE; + lit->position += pos_add; + if (lit->position > max_pos) + max_pos = lit->position; +@@ -1998,6 +2010,8 @@ tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + } + + iter_depth--; ++ if (check_add(pos_add_total, pos_add - pos_add_last)) ++ return REG_ESPACE; + pos_add_total += pos_add - pos_add_last; + if (iter_depth == 0) + pos_add = pos_add_total; +@@ -2010,6 +2024,8 @@ tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + } + } + ++ if (check_add(*position, pos_add_total)) ++ return REG_ESPACE; + *position += pos_add_total; + + /* `max_pos' should never be larger than `*position' if the above +@@ -2711,9 +2727,19 @@ regcomp(regex_t *restrict preg, const char *restrict regex, int cflags) + /* Parse context. */ + tre_parse_ctx_t parse_ctx; + ++ /* Limits: before tre_expand_ast, int values like position, subid or ++ * num_tags are bounded by 2x input length, used stack entries are ++ * bounded by 16x input length. input length is checked upfront to ++ * avoid overflows before expand. later, values that can grow big are ++ * bounds checked via check_add and xcalloc. */ ++ const int input_limit = 1024000; ++ const int stack_limit = 8*input_limit; ++ if (strnlen(regex, input_limit) >= input_limit) ++ return REG_ESPACE; ++ + /* Allocate a stack used throughout the compilation process for various + purposes. */ +- stack = tre_stack_new(512, 1024000, 128); ++ stack = tre_stack_new(512, stack_limit, 128); + if (!stack) + return REG_ESPACE; + /* Allocate a fast memory allocator. */ +@@ -2801,9 +2827,12 @@ regcomp(regex_t *restrict preg, const char *restrict regex, int cflags) + for example "a*" or "ab*". Figure out a simple way to detect + this possibility. */ + tmp_ast_l = tree; +- tmp_ast_r = tre_ast_new_literal(mem, 0, 0, parse_ctx.position++); ++ tmp_ast_r = tre_ast_new_literal(mem, 0, 0, parse_ctx.position); + if (tmp_ast_r == NULL) + ERROR_EXIT(REG_ESPACE); ++ if (check_add(parse_ctx.position, 1)) ++ ERROR_EXIT(REG_ESPACE); ++ parse_ctx.position++; + + tree = tre_ast_new_catenation(mem, tmp_ast_l, tmp_ast_r); + if (tree == NULL) +@@ -2813,22 +2842,22 @@ regcomp(regex_t *restrict preg, const char *restrict regex, int cflags) + if (errcode != REG_OK) + ERROR_EXIT(errcode); + +- counts = xmalloc(sizeof(int) * parse_ctx.position); ++ counts = xcalloc(sizeof(int), parse_ctx.position); + if (counts == NULL) + ERROR_EXIT(REG_ESPACE); + +- offs = xmalloc(sizeof(int) * parse_ctx.position); ++ offs = xcalloc(sizeof(int), parse_ctx.position); + if (offs == NULL) + ERROR_EXIT(REG_ESPACE); + +- for (i = 0; i < parse_ctx.position; i++) +- counts[i] = 0; + tre_ast_to_tnfa(tree, NULL, counts, NULL); + + add = 0; + for (i = 0; i < parse_ctx.position; i++) + { + offs[i] = add; ++ if (check_add(add, counts[i] + 1)) ++ ERROR_EXIT(REG_ESPACE); + add += counts[i] + 1; + counts[i] = 0; + } +-- +2.21.0 + + diff --git a/src/ci/docker/scripts/musl-toolchain.sh b/src/ci/docker/scripts/musl-toolchain.sh index 9e527e269360b..a9802211847e5 100644 --- a/src/ci/docker/scripts/musl-toolchain.sh +++ b/src/ci/docker/scripts/musl-toolchain.sh @@ -4,7 +4,7 @@ # # Versions of the toolchain components are configurable in `musl-cross-make/Makefile` and # musl unlike GLIBC is forward compatible so upgrading it shouldn't break old distributions. -# Right now we have: Binutils 2.31.1, GCC 9.2.0, musl 1.2.5. +# Right now we have: Binutils 2.44, GCC 9.4.0, musl 1.2.6. # ignore-tidy-file-linelength @@ -45,17 +45,12 @@ export CFLAGS="-fPIC -g1 $CFLAGS" git clone https://github.com/richfelker/musl-cross-make # -b v0.9.9 cd musl-cross-make -# A version that includes support for building musl 1.2.5 -git checkout 3635262e4524c991552789af6f36211a335a77b3 +# A version that includes musl 1.2.6 and patches for CVE-2026-6042, +# CVE-2026-40200, and CVE-2026-107891. +git checkout 5e8042e63de29f8473fc3b0b831a587ba284e1a8 -# Patch CVE-2026-6042: https://www.openwall.com/lists/oss-security/2026/04/09/19 -# Patch CVE-2026-40200: https://www.openwall.com/lists/musl/2026/04/10/3 -# These should be removed when musl-cross-make adds them, or we upgrade to musl >= 1.2.7. -cp /build/musl-cve-2026-6042.diff ./patches/musl-1.2.5/0003-cve-2026-6042.diff -cp /build/musl-cve-2026-40200.diff ./patches/musl-1.2.5/0004-cve-2026-40200.diff - -hide_output make -j$(nproc) TARGET=$TARGET MUSL_VER=1.2.5 LINUX_HEADERS_SITE=$LINUX_HEADERS_SITE LINUX_VER=$LINUX_VER -hide_output make install TARGET=$TARGET MUSL_VER=1.2.5 LINUX_HEADERS_SITE=$LINUX_HEADERS_SITE LINUX_VER=$LINUX_VER OUTPUT=$OUTPUT +hide_output make -j$(nproc) TARGET=$TARGET MUSL_VER=1.2.6 LINUX_HEADERS_SITE=$LINUX_HEADERS_SITE LINUX_VER=$LINUX_VER +hide_output make install TARGET=$TARGET MUSL_VER=1.2.6 LINUX_HEADERS_SITE=$LINUX_HEADERS_SITE LINUX_VER=$LINUX_VER OUTPUT=$OUTPUT cd - diff --git a/src/ci/docker/scripts/musl.sh b/src/ci/docker/scripts/musl.sh index 2402ec6ae34bf..738c45057b658 100644 --- a/src/ci/docker/scripts/musl.sh +++ b/src/ci/docker/scripts/musl.sh @@ -1,6 +1,4 @@ #!/bin/sh -# ignore-tidy-file-tab -# ignore-tidy-file-linelength set -ex hide_output() { @@ -27,52 +25,13 @@ shift # Apparently applying `-fPIC` everywhere allows them to link successfully. export CFLAGS="-fPIC $CFLAGS" -MUSL=musl-1.2.5 +MUSL=musl-1.2.6 # may have been downloaded in a previous run if [ ! -d $MUSL ]; then curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf - - # Apply patches for CVE-2025-26519. At the time of adding these patches no release containing them - # has been published by the musl project, so we just apply them directly on top of the version we - # were distributing already. The patches should be removed once we upgrade to musl >= 1.2.6. - # - # Advisory: https://www.openwall.com/lists/musl/2025/02/13/1 - # - # Patches applied: - # - https://www.openwall.com/lists/musl/2025/02/13/1/1 - # - https://www.openwall.com/lists/musl/2025/02/13/1/2 - # - patch -p1 -d $MUSL <= 93 || d >= 94) { - c += (0xa1-0x81); - d += 0xa1; -- if (c >= 93 || c>=0xc6-0x81 && d>0x52) -+ if (c > 0xc6-0x81 || c==0xc6-0x81 && d>0x52) - goto ilseq; - if (d-'A'<26) d = d-'A'; - else if (d-'a'<26) d = d-'a'+26; -EOF - patch -p1 -d $MUSL <4) goto ilseq; - *out += k; - *outb -= k; - break; -EOF - - # Apply patches for CVE-2026-6042 and CVE-2026-40200. + # Apply patches for CVE-2026-6042, CVE-2026-40200 and CVE-2026-107891. # # At the time of adding these patches no release containing them has been published by the musl # project, so we just apply them directly on top of the version we were distributing already. The @@ -86,6 +45,9 @@ EOF # Advisory: https://www.openwall.com/lists/musl/2026/04/10/3 # Patches: https://www.openwall.com/lists/musl/2026/04/10/3/1 patch -p1 -d $MUSL <"$MUSL_PATCH_DIR/musl-cve-2026-40200.diff" + # Advisory: https://www.openwall.com/lists/musl/2026/10/21/1 + # Patch: https://www.openwall.com/lists/musl/2026/10/21/1/1 + patch -p1 -d $MUSL <"$MUSL_PATCH_DIR/musl-cve-2026-107891.diff" fi cd $MUSL diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index f81a7a54a6b44..d880bff40ba6d 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -93,27 +93,27 @@ target | notes -------|------- [`aarch64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ARM64 MinGW (Windows 10+), LLVM ABI [`aarch64-unknown-freebsd`](platform-support/freebsd.md) | ARM64 FreeBSD -[`aarch64-unknown-linux-musl`](platform-support/aarch64-unknown-linux-musl.md) | ARM64 Linux with musl 1.2.5 +[`aarch64-unknown-linux-musl`](platform-support/aarch64-unknown-linux-musl.md) | ARM64 Linux with musl 1.2.6 [`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ARM64 OpenHarmony `arm-unknown-linux-gnueabi` | Armv6 Linux (kernel 3.2+, glibc 2.17) `arm-unknown-linux-gnueabihf` | Armv6 Linux, hardfloat (kernel 3.2+, glibc 2.17) [`armv7-unknown-linux-gnueabihf`](platform-support/armv7-unknown-linux-gnueabi.md) | Armv7-A Linux, hardfloat (kernel 3.2+, glibc 2.17) [`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | Armv7-A OpenHarmony [`loongarch64-unknown-linux-gnu`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, glibc 2.36), LSX required -[`loongarch64-unknown-linux-musl`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, musl 1.2.5), LSX required +[`loongarch64-unknown-linux-musl`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, musl 1.2.6), LSX required `powerpc-unknown-linux-gnu` | PowerPC Linux (kernel 3.2+, glibc 2.17) `powerpc64-unknown-linux-gnu` | PPC64 Linux (kernel 3.2+, glibc 2.17) -[`powerpc64-unknown-linux-musl`](platform-support/powerpc64-unknown-linux-musl.md) | PPC64 Linux (kernel 4.19+, musl 1.2.5) +[`powerpc64-unknown-linux-musl`](platform-support/powerpc64-unknown-linux-musl.md) | PPC64 Linux (kernel 4.19+, musl 1.2.6) [`powerpc64le-unknown-linux-gnu`](platform-support/powerpc64le-unknown-linux-gnu.md) | PPC64LE Linux (kernel 3.10+, glibc 2.17) -[`powerpc64le-unknown-linux-musl`](platform-support/powerpc64le-unknown-linux-musl.md) | PPC64LE Linux (kernel 4.19+, musl 1.2.5) +[`powerpc64le-unknown-linux-musl`](platform-support/powerpc64le-unknown-linux-musl.md) | PPC64LE Linux (kernel 4.19+, musl 1.2.6) [`riscv64gc-unknown-linux-gnu`](platform-support/riscv64gc-unknown-linux-gnu.md) | RISC-V Linux (kernel 4.20+, glibc 2.29) -[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20+, musl 1.2.5) +[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20+, musl 1.2.6) [`s390x-unknown-linux-gnu`](platform-support/s390x-unknown-linux-gnu.md) | S390x Linux (kernel 3.2+, glibc 2.17) [`x86_64-apple-darwin`](platform-support/apple-darwin.md) | 64-bit macOS (10.12+, Sierra+) [`x86_64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | 64-bit x86 MinGW (Windows 10+), LLVM ABI [`x86_64-unknown-freebsd`](platform-support/freebsd.md) | 64-bit x86 FreeBSD [`x86_64-unknown-illumos`](platform-support/illumos.md) | illumos -`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.5 +`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.6 [`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | x86_64 OpenHarmony [`x86_64-unknown-netbsd`](platform-support/netbsd.md) | NetBSD/amd64 [`x86_64-pc-solaris`](platform-support/solaris.md) | 64-bit x86 Solaris 11.4 @@ -164,15 +164,15 @@ target | std | notes [`aarch64-unknown-none-softfloat`](platform-support/aarch64-unknown-none.md) | * | Bare ARM64, softfloat [`aarch64-unknown-uefi`](platform-support/unknown-uefi.md) | ? | ARM64 UEFI [`arm-linux-androideabi`](platform-support/android.md) | ✓ | Armv6 Android -`arm-unknown-linux-musleabi` | ✓ | Armv6 Linux with musl 1.2.5 -`arm-unknown-linux-musleabihf` | ✓ | Armv6 Linux with musl 1.2.5, hardfloat +`arm-unknown-linux-musleabi` | ✓ | Armv6 Linux with musl 1.2.6 +`arm-unknown-linux-musleabihf` | ✓ | Armv6 Linux with musl 1.2.6, hardfloat [`arm64ec-pc-windows-msvc`](platform-support/arm64ec-pc-windows-msvc.md) | ✓ | Arm64EC Windows MSVC [`armv5te-unknown-linux-gnueabi`](platform-support/armv5te-unknown-linux-gnueabi.md) | ✓ | Armv5TE Linux (kernel 4.4+, glibc 2.23) -`armv5te-unknown-linux-musleabi` | ✓ | Armv5TE Linux with musl 1.2.5 +`armv5te-unknown-linux-musleabi` | ✓ | Armv5TE Linux with musl 1.2.6 [`armv7-linux-androideabi`](platform-support/android.md) | ✓ | Armv7-A Android [`armv7-unknown-linux-gnueabi`](platform-support/armv7-unknown-linux-gnueabi.md) | ✓ | Armv7-A Linux (kernel 4.15+, glibc 2.27) -`armv7-unknown-linux-musleabi` | ✓ | Armv7-A Linux with musl 1.2.5 -`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.5, hardfloat +`armv7-unknown-linux-musleabi` | ✓ | Armv7-A Linux with musl 1.2.6 +`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.6, hardfloat [`armv7a-none-eabi`](platform-support/armv7a-none-eabi.md) | * | Bare Armv7-A [`armv7a-none-eabihf`](platform-support/armv7a-none-eabi.md) | * | Bare Armv7-A, hardfloat [`armv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | Bare Armv7-R @@ -184,12 +184,12 @@ target | std | notes [`thumbv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | Thumb-mode Bare Armv7-R, hardfloat [`thumbv8r-none-eabihf`](platform-support/armv8r-none-eabihf.md) | * | Thumb-mode Bare Armv8-R, hardfloat `i586-unknown-linux-gnu` | ✓ | 32-bit Linux (kernel 3.2+, glibc 2.17, original Pentium) [^x86_32-floats-x87] -`i586-unknown-linux-musl` | ✓ | 32-bit Linux (musl 1.2.5, original Pentium) [^x86_32-floats-x87] +`i586-unknown-linux-musl` | ✓ | 32-bit Linux (musl 1.2.6, original Pentium) [^x86_32-floats-x87] [`i686-linux-android`](platform-support/android.md) | ✓ | 32-bit x86 Android ([Pentium 4 plus various extensions](https://developer.android.com/ndk/guides/abis.html#x86)) [^x86_32-floats-return-ABI] [`i686-pc-windows-gnu`](platform-support/windows-gnu.md) | ✓ | 32-bit MinGW (Windows 10+, Windows Server 2016+, Pentium 4) [^x86_32-floats-return-ABI] [^win32-msvc-alignment] [`i686-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ✓ | 32-bit x86 MinGW (Windows 10+, Pentium 4), LLVM ABI [^x86_32-floats-return-ABI] [`i686-unknown-freebsd`](platform-support/freebsd.md) | ✓ | 32-bit x86 FreeBSD (Pentium 4) [^x86_32-floats-return-ABI] -`i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.5 (Pentium 4) [^x86_32-floats-return-ABI] +`i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.6 (Pentium 4) [^x86_32-floats-return-ABI] [`i686-unknown-uefi`](platform-support/unknown-uefi.md) | ? | 32-bit UEFI (Pentium 4, softfloat) [^win32-msvc-alignment] [`loongarch32-unknown-none`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32D ABI) [`loongarch32-unknown-none-softfloat`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32S ABI) @@ -297,7 +297,7 @@ target | std | host | notes [`aarch64_be-unknown-hermit`](platform-support/hermit.md) | ✓ | | ARM64 Hermit (big-endian) `aarch64_be-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (big-endian) `aarch64_be-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (big-endian, ILP32 ABI) -[`aarch64_be-unknown-linux-musl`](platform-support/aarch64_be-unknown-linux-musl.md) | ✓ | ✓ | ARM64 Linux (big-endian) with musl-libc 1.2.5 +[`aarch64_be-unknown-linux-musl`](platform-support/aarch64_be-unknown-linux-musl.md) | ✓ | ✓ | ARM64 Linux (big-endian) with musl-libc 1.2.6 [`aarch64_be-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | ARM64 NetBSD (big-endian) [`aarch64_be-unknown-none-softfloat`](platform-support/aarch64_be-unknown-none-softfloat.md) | * | | Bare big-endian ARM64, softfloat [`amdgcn-amd-amdhsa`](platform-support/amdgcn-amd-amdhsa.md) | * | | `-Ctarget-cpu=gfx...` to specify [the AMD GPU] to compile for @@ -337,7 +337,7 @@ target | std | host | notes [`bpfel-unknown-none`](platform-support/bpf-unknown-none.md) | * | | BPF (little endian) [`csky-unknown-linux-gnuabiv2`](platform-support/csky-unknown-linux-gnuabiv2.md) | ✓ | | C-SKY abiv2 Linux (little endian) [`csky-unknown-linux-gnuabiv2hf`](platform-support/csky-unknown-linux-gnuabiv2.md) | ✓ | | C-SKY abiv2 Linux, hardfloat (little endian) -[`hexagon-unknown-linux-musl`](platform-support/hexagon-unknown-linux-musl.md) | ✓ | | Hexagon Linux with musl 1.2.5 +[`hexagon-unknown-linux-musl`](platform-support/hexagon-unknown-linux-musl.md) | ✓ | | Hexagon Linux with musl 1.2.6 [`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | | Bare Hexagon (v60+, HVX) [`hexagon-unknown-qurt`](platform-support/hexagon-unknown-qurt.md)| * | | Hexagon QuRT [`i386-apple-ios`](platform-support/apple-ios.md) | ✓ | | 32-bit x86 iOS (Penryn) [^x86_32-floats-return-ABI] @@ -360,17 +360,17 @@ target | std | host | notes [`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux [`m68k-unknown-none-elf`](platform-support/m68k-unknown-none-elf.md) | | | Motorola 680x0 `mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23) [^snan-inverted] -`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.5 [^snan-inverted] +`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.6 [^snan-inverted] `mips-unknown-linux-uclibc` | ✓ | | MIPS Linux with uClibc [^snan-inverted] -[`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.5 [^snan-inverted] +[`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.6 [^snan-inverted] `mips64-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] -[`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.5 [^snan-inverted] +[`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.6 [^snan-inverted] `mips64el-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 (little endian) Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] -`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.5 [^snan-inverted] +`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.6 [^snan-inverted] `mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP) [^snan-inverted] [`mipsel-sony-psx`](platform-support/mipsel-sony-psx.md) | * | | MIPS (LE) Sony PlayStation 1 (PSX) [^snan-inverted] [`mipsel-unknown-linux-gnu`](platform-support/mipsel-unknown-linux-gnu.md) | ✓ | ✓ | MIPS (little endian) Linux (kernel 4.4, glibc 2.23) [^snan-inverted] -`mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.5 [^snan-inverted] +`mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.6 [^snan-inverted] `mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc [^snan-inverted] [`mipsel-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | 32-bit MIPS (LE), requires mips32 cpu support [^snan-inverted] `mipsel-unknown-none` | * | | Bare MIPS (LE) softfloat [^snan-inverted] @@ -384,8 +384,8 @@ target | std | host | notes [`powerpc-unknown-freebsd`](platform-support/freebsd.md) | ? | | PowerPC FreeBSD [`powerpc-unknown-helenos`](platform-support/helenos.md) | ✓ | | PowerPC HelenOS [`powerpc-unknown-linux-gnuspe`](platform-support/powerpc-unknown-linux-gnuspe.md) | ✓ | | PowerPC SPE Linux -`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.5 -[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux with musl 1.2.5 +`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.6 +[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux with musl 1.2.6 [`powerpc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD 32-bit powerpc systems [`powerpc-unknown-openbsd`](platform-support/powerpc-unknown-openbsd.md) | * | | [`powerpc-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | @@ -402,7 +402,7 @@ target | std | host | notes [`riscv32em-unknown-none-elf`](platform-support/riscv32e-unknown-none-elf.md) | * | | Bare RISC-V (RV32EM ISA) [`riscv32emc-unknown-none-elf`](platform-support/riscv32e-unknown-none-elf.md) | * | | Bare RISC-V (RV32EMC ISA) `riscv32gc-unknown-linux-gnu` | ✓ | | RISC-V Linux (kernel 5.4, glibc 2.33) -`riscv32gc-unknown-linux-musl` | ? | | RISC-V Linux (kernel 5.4, musl 1.2.5) +`riscv32gc-unknown-linux-musl` | ? | | RISC-V Linux (kernel 5.4, musl 1.2.6) [`riscv32im-risc0-zkvm-elf`](platform-support/riscv32im-risc0-zkvm-elf.md) | ? | | RISC Zero's zero-knowledge Virtual Machine (RV32IM ISA) [`riscv32ima-unknown-none-elf`](platform-support/riscv32-unknown-none-elf.md) | * | | Bare RISC-V (RV32IMA ISA) [`riscv32imfc-unknown-none-elf`](platform-support/riscv32-unknown-none-elf.md) | * | | Bare RISC-V (RV32IMFC ISA, hardware single-float, no atomics) @@ -426,7 +426,7 @@ target | std | host | notes [`riscv64gc-unknown-redox`](platform-support/redox.md) | ✓ | | RISC-V 64bit Redox OS [`riscv64im-unknown-none-elf`](platform-support/riscv64-unknown-none-elf.md) | * | | Bare RISC-V (RV64IM ISA) [`riscv64imac-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX -[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.5) +[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.6) `sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux [`sparc-unknown-none-elf`](./platform-support/sparc-unknown-none-elf.md) | * | | Bare 32-bit SPARC V7+ [`sparc64-unknown-helenos`](platform-support/helenos.md) | ✓ | | sparc64 HelenOS @@ -444,7 +444,7 @@ target | std | host | notes [`thumbv7em-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX [`thumbv7em-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX, hardfloat [`thumbv7m-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7M with NuttX -`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.5 +`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.6 [`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Baseline with NuttX [`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX [`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX, hardfloat @@ -459,7 +459,7 @@ target | std | host | notes [`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 7.1 with default network stack (io-pkt) | [`x86_64-pc-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 7.1 with new network stack (io-sock) | [`x86_64-pc-qnx`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 8.0+ | -[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.5 +[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.6 `x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD `x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku [`x86_64-unknown-hermit`](platform-support/hermit.md) | ✓ | | x86_64 Hermit diff --git a/src/doc/rustc/src/platform-support/loongarch-linux.md b/src/doc/rustc/src/platform-support/loongarch-linux.md index 7817ce6138a04..358a720e7daf1 100644 --- a/src/doc/rustc/src/platform-support/loongarch-linux.md +++ b/src/doc/rustc/src/platform-support/loongarch-linux.md @@ -8,7 +8,7 @@ LoongArch is a RISC ISA developed by Loongson Technology Corporation Limited. | Target | Description | |--------|-------------| | `loongarch64-unknown-linux-gnu` | LoongArch64 Linux, LP64D ABI (kernel 5.19, glibc 2.36), LSX required | -| `loongarch64-unknown-linux-musl` | LoongArch64 Linux, LP64D ABI (kernel 5.19, musl 1.2.5), LSX required | +| `loongarch64-unknown-linux-musl` | LoongArch64 Linux, LP64D ABI (kernel 5.19, musl 1.2.6), LSX required | These support both native and cross builds, and have full support for `std`. diff --git a/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md index 12872b74b6820..6f8ca68c4504b 100644 --- a/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md +++ b/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md @@ -16,7 +16,7 @@ Linux musl libc RISC-V target using the *RV64I* base instruction set with the This target requires: * Linux Kernel version 4.20 or later -* musl libc 1.2.5 or later +* musl libc 1.2.6 or later ## Building the target diff --git a/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md index cb7d055154530..5306c391d80ad 100644 --- a/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md +++ b/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md @@ -14,7 +14,7 @@ IBM z/Architecture (s390x) targets (including IBM Z and LinuxONE) running Linux. This target requires: * Linux Kernel version 3.2 or later -* musl 1.2.5 or later +* musl 1.2.6 or later Code generated by the target uses the z/Architecture ISA assuming a minimum architecture level of z10 (Eighth Edition of the z/Architecture Principles From 9882511e4abf08c9e962143b47452f4bf8e76ecf Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Sat, 7 Nov 2026 10:32:52 +0000 Subject: [PATCH 06/34] Keep the minimum required musl version at 1.2.5 --- .../targets/aarch64_be_unknown_linux_musl.rs | 2 +- .../targets/aarch64_unknown_linux_musl.rs | 2 +- .../targets/arm_unknown_linux_musleabi.rs | 2 +- .../targets/arm_unknown_linux_musleabihf.rs | 2 +- .../targets/armv5te_unknown_linux_musleabi.rs | 2 +- .../targets/armv7_unknown_linux_musleabi.rs | 2 +- .../targets/armv7_unknown_linux_musleabihf.rs | 2 +- .../targets/hexagon_unknown_linux_musl.rs | 2 +- .../spec/targets/i686_unknown_linux_musl.rs | 2 +- .../targets/loongarch64_unknown_linux_musl.rs | 2 +- .../spec/targets/mips64_openwrt_linux_musl.rs | 2 +- .../targets/mips64_unknown_linux_muslabi64.rs | 2 +- .../mips64el_unknown_linux_muslabi64.rs | 2 +- .../spec/targets/mips_unknown_linux_musl.rs | 2 +- .../spec/targets/mipsel_unknown_linux_musl.rs | 2 +- .../targets/powerpc64_unknown_linux_musl.rs | 2 +- .../targets/powerpc64le_unknown_linux_musl.rs | 2 +- .../targets/powerpc_unknown_linux_musl.rs | 2 +- .../targets/riscv32gc_unknown_linux_musl.rs | 2 +- .../targets/riscv64gc_unknown_linux_musl.rs | 2 +- .../spec/targets/s390x_unknown_linux_musl.rs | 2 +- .../thumbv7neon_unknown_linux_musleabihf.rs | 2 +- .../targets/x86_64_unikraft_linux_musl.rs | 2 +- .../spec/targets/x86_64_unknown_linux_musl.rs | 2 +- src/doc/rustc/src/platform-support.md | 52 +++++++++---------- .../src/platform-support/loongarch-linux.md | 2 +- .../riscv64gc-unknown-linux-musl.md | 2 +- .../s390x-unknown-linux-musl.md | 2 +- 28 files changed, 53 insertions(+), 53 deletions(-) diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs index 5e9d64fc2040c..d3bf641a747fa 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64_be-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.6".into()), + description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs index 439baa41fb1f5..6ba5112342c3e 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("ARM64 Linux with musl 1.2.6".into()), + description: Some("ARM64 Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs index 07e24361387ff..5dce420428768 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv6 Linux with musl 1.2.6".into()), + description: Some("Armv6 Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs index 005123340a2fe..5b1d1e2a5a48e 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Armv6 Linux with musl 1.2.6, hardfloat".into()), + description: Some("Armv6 Linux with musl 1.2.5, hardfloat".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs index d5dfcc0c9af7f..b5a31a9821e2b 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv5TE Linux with musl 1.2.6".into()), + description: Some("Armv5TE Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs index ef49c26587d95..66e1eb1115e50 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv7-A Linux with musl 1.2.6".into()), + description: Some("Armv7-A Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs index 462945c6a0898..39c45161082ab 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Armv7-A Linux with musl 1.2.6, hardfloat".into()), + description: Some("Armv7-A Linux with musl 1.2.5, hardfloat".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs index 37322eaae6d08..92c477f53f8f3 100644 --- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "hexagon-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("Hexagon Linux with musl 1.2.6".into()), + description: Some("Hexagon Linux with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs index 28d57cf4a0e3e..212c2b8db56da 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs @@ -33,7 +33,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("32-bit Linux with musl 1.2.6".into()), + description: Some("32-bit Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs index 73ce78392d472..4030152071303 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("LoongArch64 Linux (LP64D ABI) with musl 1.2.6".into()), + description: Some("LoongArch64 Linux (LP64D ABI) with musl 1.2.5".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs index d6cb6bb7003f1..ec91dbeb86ef9 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs @@ -14,7 +14,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 for OpenWrt Linux musl 1.2.6".into()), + description: Some("MIPS64 for OpenWrt Linux musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs index 1dd1c9deeab3d..c83d371692e69 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 Linux, N64 ABI, musl 1.2.6".into()), + description: Some("MIPS64 Linux, N64 ABI, musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs index 32ba090486e2b..5685e84f140a4 100644 --- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64el-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 Linux, N64 ABI, musl 1.2.6".into()), + description: Some("MIPS64 Linux, N64 ABI, musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs index fc9dfa35ade71..7e3bebc60e9d3 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mips-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS Linux with musl 1.2.6".into()), + description: Some("MIPS Linux with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs index c0151fd8e4fcf..c94f2fd87e589 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS (little endian) Linux with musl 1.2.6".into()), + description: Some("MIPS (little endian) Linux with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs index 9464665774db8..474d20d2f0544 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit PowerPC Linux with musl 1.2.6".into()), + description: Some("64-bit PowerPC Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs index 77cb5cdb147ff..0060a41d79d08 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64le-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit PowerPC Linux with musl 1.2.6, Little Endian".into()), + description: Some("64-bit PowerPC Linux with musl 1.2.5, Little Endian".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs index eaef449e4fd19..7e494e065a048 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("PowerPC Linux with musl 1.2.6".into()), + description: Some("PowerPC Linux with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs index 4f3942108f39f..e5618ea6b20da 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "riscv32-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("RISC-V Linux (kernel 5.4, musl 1.2.6)".into()), + description: Some("RISC-V Linux (kernel 5.4, musl 1.2.5)".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs index 883b6839c5e55..088d4821042d8 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("RISC-V Linux (kernel 4.20, musl 1.2.6)".into()), + description: Some("RISC-V Linux (kernel 4.20, musl 1.2.5)".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs index 422d80d8b1453..5ff9f025ba1d9 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "s390x-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("S390x Linux (kernel 3.2, musl 1.2.6)".into()), + description: Some("S390x Linux (kernel 3.2, musl 1.2.5)".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs index 1ae4daa6c9227..dc4f8987d5d24 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.6".into()), + description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs index 7e57145705ed9..c5421f3e6b748 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit Unikraft with musl 1.2.6".into()), + description: Some("64-bit Unikraft with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs index bce0f174cde3d..a664f22479913 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs @@ -23,7 +23,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit Linux with musl 1.2.6".into()), + description: Some("64-bit Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index d880bff40ba6d..f81a7a54a6b44 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -93,27 +93,27 @@ target | notes -------|------- [`aarch64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ARM64 MinGW (Windows 10+), LLVM ABI [`aarch64-unknown-freebsd`](platform-support/freebsd.md) | ARM64 FreeBSD -[`aarch64-unknown-linux-musl`](platform-support/aarch64-unknown-linux-musl.md) | ARM64 Linux with musl 1.2.6 +[`aarch64-unknown-linux-musl`](platform-support/aarch64-unknown-linux-musl.md) | ARM64 Linux with musl 1.2.5 [`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ARM64 OpenHarmony `arm-unknown-linux-gnueabi` | Armv6 Linux (kernel 3.2+, glibc 2.17) `arm-unknown-linux-gnueabihf` | Armv6 Linux, hardfloat (kernel 3.2+, glibc 2.17) [`armv7-unknown-linux-gnueabihf`](platform-support/armv7-unknown-linux-gnueabi.md) | Armv7-A Linux, hardfloat (kernel 3.2+, glibc 2.17) [`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | Armv7-A OpenHarmony [`loongarch64-unknown-linux-gnu`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, glibc 2.36), LSX required -[`loongarch64-unknown-linux-musl`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, musl 1.2.6), LSX required +[`loongarch64-unknown-linux-musl`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, musl 1.2.5), LSX required `powerpc-unknown-linux-gnu` | PowerPC Linux (kernel 3.2+, glibc 2.17) `powerpc64-unknown-linux-gnu` | PPC64 Linux (kernel 3.2+, glibc 2.17) -[`powerpc64-unknown-linux-musl`](platform-support/powerpc64-unknown-linux-musl.md) | PPC64 Linux (kernel 4.19+, musl 1.2.6) +[`powerpc64-unknown-linux-musl`](platform-support/powerpc64-unknown-linux-musl.md) | PPC64 Linux (kernel 4.19+, musl 1.2.5) [`powerpc64le-unknown-linux-gnu`](platform-support/powerpc64le-unknown-linux-gnu.md) | PPC64LE Linux (kernel 3.10+, glibc 2.17) -[`powerpc64le-unknown-linux-musl`](platform-support/powerpc64le-unknown-linux-musl.md) | PPC64LE Linux (kernel 4.19+, musl 1.2.6) +[`powerpc64le-unknown-linux-musl`](platform-support/powerpc64le-unknown-linux-musl.md) | PPC64LE Linux (kernel 4.19+, musl 1.2.5) [`riscv64gc-unknown-linux-gnu`](platform-support/riscv64gc-unknown-linux-gnu.md) | RISC-V Linux (kernel 4.20+, glibc 2.29) -[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20+, musl 1.2.6) +[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20+, musl 1.2.5) [`s390x-unknown-linux-gnu`](platform-support/s390x-unknown-linux-gnu.md) | S390x Linux (kernel 3.2+, glibc 2.17) [`x86_64-apple-darwin`](platform-support/apple-darwin.md) | 64-bit macOS (10.12+, Sierra+) [`x86_64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | 64-bit x86 MinGW (Windows 10+), LLVM ABI [`x86_64-unknown-freebsd`](platform-support/freebsd.md) | 64-bit x86 FreeBSD [`x86_64-unknown-illumos`](platform-support/illumos.md) | illumos -`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.6 +`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.5 [`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | x86_64 OpenHarmony [`x86_64-unknown-netbsd`](platform-support/netbsd.md) | NetBSD/amd64 [`x86_64-pc-solaris`](platform-support/solaris.md) | 64-bit x86 Solaris 11.4 @@ -164,15 +164,15 @@ target | std | notes [`aarch64-unknown-none-softfloat`](platform-support/aarch64-unknown-none.md) | * | Bare ARM64, softfloat [`aarch64-unknown-uefi`](platform-support/unknown-uefi.md) | ? | ARM64 UEFI [`arm-linux-androideabi`](platform-support/android.md) | ✓ | Armv6 Android -`arm-unknown-linux-musleabi` | ✓ | Armv6 Linux with musl 1.2.6 -`arm-unknown-linux-musleabihf` | ✓ | Armv6 Linux with musl 1.2.6, hardfloat +`arm-unknown-linux-musleabi` | ✓ | Armv6 Linux with musl 1.2.5 +`arm-unknown-linux-musleabihf` | ✓ | Armv6 Linux with musl 1.2.5, hardfloat [`arm64ec-pc-windows-msvc`](platform-support/arm64ec-pc-windows-msvc.md) | ✓ | Arm64EC Windows MSVC [`armv5te-unknown-linux-gnueabi`](platform-support/armv5te-unknown-linux-gnueabi.md) | ✓ | Armv5TE Linux (kernel 4.4+, glibc 2.23) -`armv5te-unknown-linux-musleabi` | ✓ | Armv5TE Linux with musl 1.2.6 +`armv5te-unknown-linux-musleabi` | ✓ | Armv5TE Linux with musl 1.2.5 [`armv7-linux-androideabi`](platform-support/android.md) | ✓ | Armv7-A Android [`armv7-unknown-linux-gnueabi`](platform-support/armv7-unknown-linux-gnueabi.md) | ✓ | Armv7-A Linux (kernel 4.15+, glibc 2.27) -`armv7-unknown-linux-musleabi` | ✓ | Armv7-A Linux with musl 1.2.6 -`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.6, hardfloat +`armv7-unknown-linux-musleabi` | ✓ | Armv7-A Linux with musl 1.2.5 +`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.5, hardfloat [`armv7a-none-eabi`](platform-support/armv7a-none-eabi.md) | * | Bare Armv7-A [`armv7a-none-eabihf`](platform-support/armv7a-none-eabi.md) | * | Bare Armv7-A, hardfloat [`armv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | Bare Armv7-R @@ -184,12 +184,12 @@ target | std | notes [`thumbv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | Thumb-mode Bare Armv7-R, hardfloat [`thumbv8r-none-eabihf`](platform-support/armv8r-none-eabihf.md) | * | Thumb-mode Bare Armv8-R, hardfloat `i586-unknown-linux-gnu` | ✓ | 32-bit Linux (kernel 3.2+, glibc 2.17, original Pentium) [^x86_32-floats-x87] -`i586-unknown-linux-musl` | ✓ | 32-bit Linux (musl 1.2.6, original Pentium) [^x86_32-floats-x87] +`i586-unknown-linux-musl` | ✓ | 32-bit Linux (musl 1.2.5, original Pentium) [^x86_32-floats-x87] [`i686-linux-android`](platform-support/android.md) | ✓ | 32-bit x86 Android ([Pentium 4 plus various extensions](https://developer.android.com/ndk/guides/abis.html#x86)) [^x86_32-floats-return-ABI] [`i686-pc-windows-gnu`](platform-support/windows-gnu.md) | ✓ | 32-bit MinGW (Windows 10+, Windows Server 2016+, Pentium 4) [^x86_32-floats-return-ABI] [^win32-msvc-alignment] [`i686-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ✓ | 32-bit x86 MinGW (Windows 10+, Pentium 4), LLVM ABI [^x86_32-floats-return-ABI] [`i686-unknown-freebsd`](platform-support/freebsd.md) | ✓ | 32-bit x86 FreeBSD (Pentium 4) [^x86_32-floats-return-ABI] -`i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.6 (Pentium 4) [^x86_32-floats-return-ABI] +`i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.5 (Pentium 4) [^x86_32-floats-return-ABI] [`i686-unknown-uefi`](platform-support/unknown-uefi.md) | ? | 32-bit UEFI (Pentium 4, softfloat) [^win32-msvc-alignment] [`loongarch32-unknown-none`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32D ABI) [`loongarch32-unknown-none-softfloat`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32S ABI) @@ -297,7 +297,7 @@ target | std | host | notes [`aarch64_be-unknown-hermit`](platform-support/hermit.md) | ✓ | | ARM64 Hermit (big-endian) `aarch64_be-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (big-endian) `aarch64_be-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (big-endian, ILP32 ABI) -[`aarch64_be-unknown-linux-musl`](platform-support/aarch64_be-unknown-linux-musl.md) | ✓ | ✓ | ARM64 Linux (big-endian) with musl-libc 1.2.6 +[`aarch64_be-unknown-linux-musl`](platform-support/aarch64_be-unknown-linux-musl.md) | ✓ | ✓ | ARM64 Linux (big-endian) with musl-libc 1.2.5 [`aarch64_be-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | ARM64 NetBSD (big-endian) [`aarch64_be-unknown-none-softfloat`](platform-support/aarch64_be-unknown-none-softfloat.md) | * | | Bare big-endian ARM64, softfloat [`amdgcn-amd-amdhsa`](platform-support/amdgcn-amd-amdhsa.md) | * | | `-Ctarget-cpu=gfx...` to specify [the AMD GPU] to compile for @@ -337,7 +337,7 @@ target | std | host | notes [`bpfel-unknown-none`](platform-support/bpf-unknown-none.md) | * | | BPF (little endian) [`csky-unknown-linux-gnuabiv2`](platform-support/csky-unknown-linux-gnuabiv2.md) | ✓ | | C-SKY abiv2 Linux (little endian) [`csky-unknown-linux-gnuabiv2hf`](platform-support/csky-unknown-linux-gnuabiv2.md) | ✓ | | C-SKY abiv2 Linux, hardfloat (little endian) -[`hexagon-unknown-linux-musl`](platform-support/hexagon-unknown-linux-musl.md) | ✓ | | Hexagon Linux with musl 1.2.6 +[`hexagon-unknown-linux-musl`](platform-support/hexagon-unknown-linux-musl.md) | ✓ | | Hexagon Linux with musl 1.2.5 [`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | | Bare Hexagon (v60+, HVX) [`hexagon-unknown-qurt`](platform-support/hexagon-unknown-qurt.md)| * | | Hexagon QuRT [`i386-apple-ios`](platform-support/apple-ios.md) | ✓ | | 32-bit x86 iOS (Penryn) [^x86_32-floats-return-ABI] @@ -360,17 +360,17 @@ target | std | host | notes [`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux [`m68k-unknown-none-elf`](platform-support/m68k-unknown-none-elf.md) | | | Motorola 680x0 `mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23) [^snan-inverted] -`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.6 [^snan-inverted] +`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.5 [^snan-inverted] `mips-unknown-linux-uclibc` | ✓ | | MIPS Linux with uClibc [^snan-inverted] -[`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.6 [^snan-inverted] +[`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.5 [^snan-inverted] `mips64-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] -[`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.6 [^snan-inverted] +[`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.5 [^snan-inverted] `mips64el-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 (little endian) Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] -`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.6 [^snan-inverted] +`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.5 [^snan-inverted] `mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP) [^snan-inverted] [`mipsel-sony-psx`](platform-support/mipsel-sony-psx.md) | * | | MIPS (LE) Sony PlayStation 1 (PSX) [^snan-inverted] [`mipsel-unknown-linux-gnu`](platform-support/mipsel-unknown-linux-gnu.md) | ✓ | ✓ | MIPS (little endian) Linux (kernel 4.4, glibc 2.23) [^snan-inverted] -`mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.6 [^snan-inverted] +`mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.5 [^snan-inverted] `mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc [^snan-inverted] [`mipsel-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | 32-bit MIPS (LE), requires mips32 cpu support [^snan-inverted] `mipsel-unknown-none` | * | | Bare MIPS (LE) softfloat [^snan-inverted] @@ -384,8 +384,8 @@ target | std | host | notes [`powerpc-unknown-freebsd`](platform-support/freebsd.md) | ? | | PowerPC FreeBSD [`powerpc-unknown-helenos`](platform-support/helenos.md) | ✓ | | PowerPC HelenOS [`powerpc-unknown-linux-gnuspe`](platform-support/powerpc-unknown-linux-gnuspe.md) | ✓ | | PowerPC SPE Linux -`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.6 -[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux with musl 1.2.6 +`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.5 +[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux with musl 1.2.5 [`powerpc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD 32-bit powerpc systems [`powerpc-unknown-openbsd`](platform-support/powerpc-unknown-openbsd.md) | * | | [`powerpc-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | @@ -402,7 +402,7 @@ target | std | host | notes [`riscv32em-unknown-none-elf`](platform-support/riscv32e-unknown-none-elf.md) | * | | Bare RISC-V (RV32EM ISA) [`riscv32emc-unknown-none-elf`](platform-support/riscv32e-unknown-none-elf.md) | * | | Bare RISC-V (RV32EMC ISA) `riscv32gc-unknown-linux-gnu` | ✓ | | RISC-V Linux (kernel 5.4, glibc 2.33) -`riscv32gc-unknown-linux-musl` | ? | | RISC-V Linux (kernel 5.4, musl 1.2.6) +`riscv32gc-unknown-linux-musl` | ? | | RISC-V Linux (kernel 5.4, musl 1.2.5) [`riscv32im-risc0-zkvm-elf`](platform-support/riscv32im-risc0-zkvm-elf.md) | ? | | RISC Zero's zero-knowledge Virtual Machine (RV32IM ISA) [`riscv32ima-unknown-none-elf`](platform-support/riscv32-unknown-none-elf.md) | * | | Bare RISC-V (RV32IMA ISA) [`riscv32imfc-unknown-none-elf`](platform-support/riscv32-unknown-none-elf.md) | * | | Bare RISC-V (RV32IMFC ISA, hardware single-float, no atomics) @@ -426,7 +426,7 @@ target | std | host | notes [`riscv64gc-unknown-redox`](platform-support/redox.md) | ✓ | | RISC-V 64bit Redox OS [`riscv64im-unknown-none-elf`](platform-support/riscv64-unknown-none-elf.md) | * | | Bare RISC-V (RV64IM ISA) [`riscv64imac-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX -[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.6) +[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.5) `sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux [`sparc-unknown-none-elf`](./platform-support/sparc-unknown-none-elf.md) | * | | Bare 32-bit SPARC V7+ [`sparc64-unknown-helenos`](platform-support/helenos.md) | ✓ | | sparc64 HelenOS @@ -444,7 +444,7 @@ target | std | host | notes [`thumbv7em-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX [`thumbv7em-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX, hardfloat [`thumbv7m-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7M with NuttX -`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.6 +`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.5 [`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Baseline with NuttX [`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX [`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX, hardfloat @@ -459,7 +459,7 @@ target | std | host | notes [`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 7.1 with default network stack (io-pkt) | [`x86_64-pc-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 7.1 with new network stack (io-sock) | [`x86_64-pc-qnx`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 8.0+ | -[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.6 +[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.5 `x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD `x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku [`x86_64-unknown-hermit`](platform-support/hermit.md) | ✓ | | x86_64 Hermit diff --git a/src/doc/rustc/src/platform-support/loongarch-linux.md b/src/doc/rustc/src/platform-support/loongarch-linux.md index 358a720e7daf1..7817ce6138a04 100644 --- a/src/doc/rustc/src/platform-support/loongarch-linux.md +++ b/src/doc/rustc/src/platform-support/loongarch-linux.md @@ -8,7 +8,7 @@ LoongArch is a RISC ISA developed by Loongson Technology Corporation Limited. | Target | Description | |--------|-------------| | `loongarch64-unknown-linux-gnu` | LoongArch64 Linux, LP64D ABI (kernel 5.19, glibc 2.36), LSX required | -| `loongarch64-unknown-linux-musl` | LoongArch64 Linux, LP64D ABI (kernel 5.19, musl 1.2.6), LSX required | +| `loongarch64-unknown-linux-musl` | LoongArch64 Linux, LP64D ABI (kernel 5.19, musl 1.2.5), LSX required | These support both native and cross builds, and have full support for `std`. diff --git a/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md index 6f8ca68c4504b..12872b74b6820 100644 --- a/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md +++ b/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md @@ -16,7 +16,7 @@ Linux musl libc RISC-V target using the *RV64I* base instruction set with the This target requires: * Linux Kernel version 4.20 or later -* musl libc 1.2.6 or later +* musl libc 1.2.5 or later ## Building the target diff --git a/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md index 5306c391d80ad..cb7d055154530 100644 --- a/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md +++ b/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md @@ -14,7 +14,7 @@ IBM z/Architecture (s390x) targets (including IBM Z and LinuxONE) running Linux. This target requires: * Linux Kernel version 3.2 or later -* musl 1.2.6 or later +* musl 1.2.5 or later Code generated by the target uses the z/Architecture ISA assuming a minimum architecture level of z10 (Eighth Edition of the z/Architecture Principles From 48106d7c5db371158ca2e0ab06b0725dba7e861f Mon Sep 17 00:00:00 2001 From: Joseph Zhao Date: Sun, 8 Nov 2026 00:46:10 -0800 Subject: [PATCH 07/34] rename this -> ecx in intrinsics/x86 --- src/tools/miri/src/intrinsics/x86/avx.rs | 100 ++++++++++----------- src/tools/miri/src/intrinsics/x86/avx2.rs | 104 +++++++++++----------- src/tools/miri/src/intrinsics/x86/mod.rs | 56 ++++++------ src/tools/miri/src/intrinsics/x86/sse.rs | 54 +++++------ src/tools/miri/src/intrinsics/x86/sse2.rs | 104 +++++++++++----------- 5 files changed, 206 insertions(+), 212 deletions(-) diff --git a/src/tools/miri/src/intrinsics/x86/avx.rs b/src/tools/miri/src/intrinsics/x86/avx.rs index 89aa2e8ae0664..ee0a4abca468f 100644 --- a/src/tools/miri/src/intrinsics/x86/avx.rs +++ b/src/tools/miri/src/intrinsics/x86/avx.rs @@ -15,8 +15,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &[OpTy<'tcx>], dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, EmulateItemResult> { - let this = self.eval_context_mut(); - this.expect_target_feature_for_intrinsic(link_name, "avx")?; + let ecx = self.eval_context_mut(); + ecx.expect_target_feature_for_intrinsic(link_name, "avx")?; // Prefix should have already been checked. let unprefixed_name = link_name.as_str().strip_prefix("llvm.x86.avx.").unwrap(); @@ -27,7 +27,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // matches the IEEE min/max operations, while x86 has different // semantics. "min.ps.256" | "max.ps.256" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "min.ps.256" => FloatBinOp::Min, @@ -35,11 +35,11 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - bin_op_simd_float_all::(this, which, left, right, dest)?; + bin_op_simd_float_all::(ecx, which, left, right, dest)?; } // Used to implement _mm256_min_pd and _mm256_max_pd functions. "min.pd.256" | "max.pd.256" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "min.pd.256" => FloatBinOp::Min, @@ -47,26 +47,26 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - bin_op_simd_float_all::(this, which, left, right, dest)?; + bin_op_simd_float_all::(ecx, which, left, right, dest)?; } // Used to implement the _mm256_round_ps function. // Rounds the elements of `op` according to `rounding`. "round.ps.256" => { - let [op, rounding] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [op, rounding] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - round_all::(this, op, rounding, dest)?; + round_all::(ecx, op, rounding, dest)?; } // Used to implement the _mm256_round_pd function. // Rounds the elements of `op` according to `rounding`. "round.pd.256" => { - let [op, rounding] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [op, rounding] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - round_all::(this, op, rounding, dest)?; + round_all::(ecx, op, rounding, dest)?; } // Used to implement _mm256_{rcp,rsqrt}_ps functions. // Performs the operations on all components of `op`. "rcp.ps.256" | "rsqrt.ps.256" => { - let [op] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [op] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "rcp.ps.256" => FloatUnaryOp::Rcp, @@ -74,43 +74,43 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - unary_op_ps(this, which, op, dest)?; + unary_op_ps(ecx, which, op, dest)?; } // Used to implement the _mm256_dp_ps function. "dp.ps.256" => { - let [left, right, imm] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right, imm] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - conditional_dot_product(this, left, right, imm, dest)?; + conditional_dot_product(ecx, left, right, imm, dest)?; } // Used to implement the _mm256_cmp_ps function. // Performs a comparison operation on each component of `left` // and `right`. For each component, returns 0 if false or u32::MAX // if true. "cmp.ps.256" => { - let [left, right, imm] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right, imm] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = - FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?; + FloatBinOp::cmp_from_imm(ecx, ecx.read_scalar(imm)?.to_i8()?, link_name)?; - bin_op_simd_float_all::(this, which, left, right, dest)?; + bin_op_simd_float_all::(ecx, which, left, right, dest)?; } // Used to implement the _mm256_cmp_pd function. // Performs a comparison operation on each component of `left` // and `right`. For each component, returns 0 if false or u64::MAX // if true. "cmp.pd.256" => { - let [left, right, imm] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right, imm] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = - FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?; + FloatBinOp::cmp_from_imm(ecx, ecx.read_scalar(imm)?.to_i8()?, link_name)?; - bin_op_simd_float_all::(this, which, left, right, dest)?; + bin_op_simd_float_all::(ecx, which, left, right, dest)?; } // Used to implement the _mm256_cvtps_epi32, _mm256_cvttps_epi32, _mm256_cvtpd_epi32 // and _mm256_cvttpd_epi32 functions. // Converts packed f32/f64 to packed i32. "cvt.ps2dq.256" | "cvtt.ps2dq.256" | "cvt.pd2dq.256" | "cvtt.pd2dq.256" => { - let [op] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [op] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let rnd = match unprefixed_name { // "current SSE rounding mode", assume nearest @@ -120,7 +120,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - convert_float_to_int(this, op, rnd, dest)?; + convert_float_to_int(ecx, op, rnd, dest)?; } // Used to implement the _mm_permutevar_ps and _mm256_permutevar_ps functions. // Shuffles 32-bit floats from `data` using `control` as control. Each 128-bit @@ -128,30 +128,27 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // sequence of 4-element arrays, and we shuffle each of these arrays, where // `control` determines which element of the current `data` array is written. "vpermilvar.ps" | "vpermilvar.ps.256" => { - let [data, control] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [data, control] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (data, data_len) = this.project_to_simd(data)?; - let (control, control_len) = this.project_to_simd(control)?; - let (dest, dest_len) = this.project_to_simd(dest)?; + let (data, data_len) = ecx.project_to_simd(data)?; + let (control, control_len) = ecx.project_to_simd(control)?; + let (dest, dest_len) = ecx.project_to_simd(dest)?; assert_eq!(dest_len, data_len); assert_eq!(dest_len, control_len); for i in 0..dest_len { - let control = this.project_index(&control, i)?; + let control = ecx.project_index(&control, i)?; // Each 128-bit chunk is shuffled independently. Since each chunk contains // four 32-bit elements, only two bits from `control` are used. To read the // value from the current chunk, add the destination index truncated to a multiple // of 4. let chunk_base = i & !0b11; - let src_i = u64::from(this.read_scalar(&control)?.to_u32()? & 0b11) + let src_i = u64::from(ecx.read_scalar(&control)?.to_u32()? & 0b11) .strict_add(chunk_base); - this.copy_op( - &this.project_index(&data, src_i)?, - &this.project_index(&dest, i)?, - )?; + ecx.copy_op(&ecx.project_index(&data, src_i)?, &ecx.project_index(&dest, i)?)?; } } // Used to implement the _mm_permutevar_pd and _mm256_permutevar_pd functions. @@ -161,17 +158,17 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // where `right` determines which element of the current `left` array is // written. "vpermilvar.pd" | "vpermilvar.pd.256" => { - let [data, control] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [data, control] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (data, data_len) = this.project_to_simd(data)?; - let (control, control_len) = this.project_to_simd(control)?; - let (dest, dest_len) = this.project_to_simd(dest)?; + let (data, data_len) = ecx.project_to_simd(data)?; + let (control, control_len) = ecx.project_to_simd(control)?; + let (dest, dest_len) = ecx.project_to_simd(dest)?; assert_eq!(dest_len, data_len); assert_eq!(dest_len, control_len); for i in 0..dest_len { - let control = this.project_index(&control, i)?; + let control = ecx.project_index(&control, i)?; // Each 128-bit chunk is shuffled independently. Since each chunk contains // two 64-bit elements, only the second bit from `control` is used (yes, the @@ -179,12 +176,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // chunk, add the destination index truncated to a multiple of 2. let chunk_base = i & !1; let src_i = - ((this.read_scalar(&control)?.to_u64()? >> 1) & 1).strict_add(chunk_base); + ((ecx.read_scalar(&control)?.to_u64()? >> 1) & 1).strict_add(chunk_base); - this.copy_op( - &this.project_index(&data, src_i)?, - &this.project_index(&dest, i)?, - )?; + ecx.copy_op(&ecx.project_index(&data, src_i)?, &ecx.project_index(&dest, i)?)?; } } // Used to implement the _mm256_lddqu_si256 function. @@ -193,22 +187,22 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // the data crosses a cache line, but for Miri this is just a regular // unaligned read. "ldu.dq.256" => { - let [src_ptr] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - let src_ptr = this.read_pointer(src_ptr)?; - let dest = dest.force_mplace(this)?; + let [src_ptr] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + let src_ptr = ecx.read_pointer(src_ptr)?; + let dest = dest.force_mplace(ecx)?; // Unaligned copy, which is what we want. - this.mem_copy(src_ptr, dest.ptr(), dest.layout.size, /*nonoverlapping*/ true)?; + ecx.mem_copy(src_ptr, dest.ptr(), dest.layout.size, /*nonoverlapping*/ true)?; } // Used to implement the _mm256_testnzc_si256 function. // Tests `op & mask != 0 && op & mask != mask` "ptestnzc.256" => { - let [op, mask] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [op, mask] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (all_zero, masked_set) = test_bits_masked(this, op, mask)?; + let (all_zero, masked_set) = test_bits_masked(ecx, op, mask)?; let res = !all_zero && !masked_set; - this.write_scalar(Scalar::from_i32(res.into()), dest)?; + ecx.write_scalar(Scalar::from_i32(res.into()), dest)?; } // Used to implement the _mm256_testz_pd, _mm256_testc_pd, _mm256_testnzc_pd // _mm_testnzc_pd, _mm256_testz_ps, _mm256_testc_ps, _mm256_testnzc_ps and @@ -219,9 +213,9 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Return `direct` (testz), `negated` (testc) or `!direct & !negated` (testnzc) "vtestz.pd.256" | "vtestc.pd.256" | "vtestnzc.pd.256" | "vtestnzc.pd" | "vtestz.ps.256" | "vtestc.ps.256" | "vtestnzc.ps.256" | "vtestnzc.ps" => { - let [op, mask] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [op, mask] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (direct, negated) = test_high_bits_masked(this, op, mask)?; + let (direct, negated) = test_high_bits_masked(ecx, op, mask)?; let res = match unprefixed_name { "vtestz.pd.256" | "vtestz.ps.256" => direct, "vtestc.pd.256" | "vtestc.ps.256" => negated, @@ -230,7 +224,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - this.write_scalar(Scalar::from_i32(res.into()), dest)?; + ecx.write_scalar(Scalar::from_i32(res.into()), dest)?; } // Used to implement the `_mm256_zeroupper` and `_mm256_zeroall` functions. // These function clear out the upper 128 bits of all avx registers or @@ -241,7 +235,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // compiler, making these functions no-ops. // The only thing that needs to be ensured is the correct calling convention. - let [] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; } _ => return interp_ok(EmulateItemResult::NotSupported), } diff --git a/src/tools/miri/src/intrinsics/x86/avx2.rs b/src/tools/miri/src/intrinsics/x86/avx2.rs index 6b49b61138839..fe83e95f4c155 100644 --- a/src/tools/miri/src/intrinsics/x86/avx2.rs +++ b/src/tools/miri/src/intrinsics/x86/avx2.rs @@ -14,8 +14,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &[OpTy<'tcx>], dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, EmulateItemResult> { - let this = self.eval_context_mut(); - this.expect_target_feature_for_intrinsic(link_name, "avx2")?; + let ecx = self.eval_context_mut(); + ecx.expect_target_feature_for_intrinsic(link_name, "avx2")?; // Prefix should have already been checked. let unprefixed_name = link_name.as_str().strip_prefix("llvm.x86.avx2.").unwrap(); @@ -23,13 +23,13 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Used to implement the _mm256_avg_epu8 and _mm256_avg_epu16 functions. // Averages packed unsigned 8/16-bit integers in `left` and `right`. "pavg.b" | "pavg.w" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - pavg(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + pavg(ecx, left, right, dest)?; } // Used to implement the _mm256_mulhi_epi16 and _mm256_mulhi_epu16 functions. "pmulh.w" | "pmulhu.w" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - pmulh(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + pmulh(ecx, left, right, dest)?; } // Used to implement `_mm{,_mask}_{i32,i64}gather_{epi32,epi64,pd,ps}` functions // Gathers elements from `slice` using `offsets * scale` as indices. @@ -40,14 +40,14 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { | "gather.d.pd.256" | "gather.q.pd" | "gather.q.pd.256" | "gather.d.ps" | "gather.d.ps.256" | "gather.q.ps" | "gather.q.ps.256" => { let [src, slice, offsets, mask, scale] = - this.check_shim_sig_llvm_intrinsic(link_name, args)?; + ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; assert_eq!(dest.layout, src.layout); - let (src, _) = this.project_to_simd(src)?; - let (offsets, offsets_len) = this.project_to_simd(offsets)?; - let (mask, mask_len) = this.project_to_simd(mask)?; - let (dest, dest_len) = this.project_to_simd(dest)?; + let (src, _) = ecx.project_to_simd(src)?; + let (offsets, offsets_len) = ecx.project_to_simd(offsets)?; + let (mask, mask_len) = ecx.project_to_simd(mask)?; + let (dest, dest_len) = ecx.project_to_simd(dest)?; // There are cases like dest: i32x4, offsets: i64x2 // If dest has more elements than offset, extra dest elements are filled with zero. @@ -56,46 +56,46 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { assert_eq!(dest_len, mask_len); - let mask_item_size = mask.layout.field(this, 0).size; + let mask_item_size = mask.layout.field(ecx, 0).size; let high_bit_offset = mask_item_size.bits().strict_sub(1); - let scale = this.read_scalar(scale)?.to_i8()?; + let scale = ecx.read_scalar(scale)?.to_i8()?; if !matches!(scale, 1 | 2 | 4 | 8) { panic!("invalid gather scale {scale}"); } let scale = i64::from(scale); - let slice = this.read_pointer(slice)?; + let slice = ecx.read_pointer(slice)?; for i in 0..actual_len { - let mask = this.project_index(&mask, i)?; - let dest = this.project_index(&dest, i)?; + let mask = ecx.project_index(&mask, i)?; + let dest = ecx.project_index(&dest, i)?; - if this.read_scalar(&mask)?.to_uint(mask_item_size)? >> high_bit_offset != 0 { - let offset = this.project_index(&offsets, i)?; + if ecx.read_scalar(&mask)?.to_uint(mask_item_size)? >> high_bit_offset != 0 { + let offset = ecx.project_index(&offsets, i)?; let offset = - i64::try_from(this.read_scalar(&offset)?.to_int(offset.layout.size)?) + i64::try_from(ecx.read_scalar(&offset)?.to_int(offset.layout.size)?) .unwrap(); - let ptr = slice.wrapping_signed_offset(offset.strict_mul(scale), &this.tcx); + let ptr = slice.wrapping_signed_offset(offset.strict_mul(scale), &ecx.tcx); // Unaligned copy, which is what we want. - this.mem_copy( + ecx.mem_copy( ptr, dest.ptr(), dest.layout.size, /*nonoverlapping*/ true, )?; } else { - this.copy_op(&this.project_index(&src, i)?, &dest)?; + ecx.copy_op(&ecx.project_index(&src, i)?, &dest)?; } } for i in actual_len..dest_len { - let dest = this.project_index(&dest, i)?; - this.write_scalar(Scalar::from_int(0, dest.layout.size), &dest)?; + let dest = ecx.project_index(&dest, i)?; + ecx.write_scalar(Scalar::from_int(0, dest.layout.size), &dest)?; } } // Used to implement the _mm256_maddubs_epi16 function. "pmadd.ub.sw" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - pmaddbw(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + pmaddbw(ecx, left, right, dest)?; } // Used to implement the _mm256_mpsadbw_epu8 function. // Compute the sum of absolute differences of quadruplets of unsigned @@ -104,8 +104,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // offsets specified in `imm`. // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_mpsadbw_epu8 "mpsadbw" => { - let [left, right, imm] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - mpsadbw(this, left, right, imm, dest)?; + let [left, right, imm] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + mpsadbw(ecx, left, right, imm, dest)?; } // Used to implement the _mm256_mulhrs_epi16 function. // Multiplies packed 16-bit signed integer values, truncates the 32-bit @@ -114,53 +114,53 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // 1 and then taking the bits `1..=16`. // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_mulhrs_epi16 "pmul.hr.sw" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - pmulhrsw(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + pmulhrsw(ecx, left, right, dest)?; } // Used to implement the _mm256_packs_epi16 function. // Converts two 16-bit integer vectors to a single 8-bit integer // vector with signed saturation. "packsswb" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - packsswb(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + packsswb(ecx, left, right, dest)?; } // Used to implement the _mm256_packs_epi32 function. // Converts two 32-bit integer vectors to a single 16-bit integer // vector with signed saturation. "packssdw" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - packssdw(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + packssdw(ecx, left, right, dest)?; } // Used to implement the _mm256_packus_epi16 function. // Converts two 16-bit signed integer vectors to a single 8-bit // unsigned integer vector with saturation. "packuswb" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - packuswb(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + packuswb(ecx, left, right, dest)?; } // Used to implement the _mm256_packus_epi32 function. // Concatenates two 32-bit signed integer vectors and converts // the result to a 16-bit unsigned integer vector with saturation. "packusdw" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - packusdw(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + packusdw(ecx, left, right, dest)?; } // Used to implement _mm256_permutevar8x32_epi32 and _mm256_permutevar8x32_ps. "permd" | "permps" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - permute(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + permute(ecx, left, right, dest)?; } // Used to implement the _mm256_sad_epu8 function. "psad.bw" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - psadbw(this, left, right, dest)? + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + psadbw(ecx, left, right, dest)? } // Used to implement the _mm256_shuffle_epi8 intrinsic. // Shuffles bytes from `left` using `right` as pattern. // Each 128-bit block is shuffled independently. "pshuf.b" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - pshufb(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + pshufb(ecx, left, right, dest)?; } // Used to implement the _mm256_sign_epi{8,16,32} functions. // Negates elements from `left` when the corresponding element in @@ -168,8 +168,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // is written to the corresponding output element. // Basically, we multiply `left` with `right.signum()`. "psign.b" | "psign.w" | "psign.d" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - psign(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + psign(ecx, left, right, dest)?; } // Used to implement the _mm256_{sll,srl,sra}_epi{16,32,64} functions // (except _mm256_sra_epi64, which is not available in AVX2). @@ -181,7 +181,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // is copied to remaining bits. "psll.w" | "psrl.w" | "psra.w" | "psll.d" | "psrl.d" | "psra.d" | "psll.q" | "psrl.q" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "psll.w" | "psll.d" | "psll.q" => ShiftOp::Left, @@ -190,22 +190,22 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - shift_simd_by_scalar(this, left, right, which, dest)?; + shift_simd_by_scalar(ecx, left, right, which, dest)?; } // Used to implement the _mm256_madd_epi16 function. // Multiplies packed signed 16-bit integers in `left` and `right`, producing // intermediate signed 32-bit integers. Horizontally add adjacent pairs of // intermediate 32-bit integers, and pack the results in `dest`. "pmadd.wd" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - pmaddwd(this, left, right, dest)?; + pmaddwd(ecx, left, right, dest)?; } // Used to implement the _mm{,256}_{sllv,srlv,srav}_epi{32,64} functions // (except _mm{,256}_srav_epi64, which are not available in AVX2). "psllv.d" | "psllv.d.256" | "psllv.q" | "psllv.q.256" | "psrlv.d" | "psrlv.d.256" | "psrlv.q" | "psrlv.q.256" | "psrav.d" | "psrav.d.256" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "psllv.d" | "psllv.d.256" | "psllv.q" | "psllv.q.256" => ShiftOp::Left, @@ -214,7 +214,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - shift_simd_by_simd(this, left, right, which, dest)?; + shift_simd_by_simd(ecx, left, right, which, dest)?; } _ => return interp_ok(EmulateItemResult::NotSupported), diff --git a/src/tools/miri/src/intrinsics/x86/mod.rs b/src/tools/miri/src/intrinsics/x86/mod.rs index 0c82a70bf96ef..3d99eed671f58 100644 --- a/src/tools/miri/src/intrinsics/x86/mod.rs +++ b/src/tools/miri/src/intrinsics/x86/mod.rs @@ -31,7 +31,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &[OpTy<'tcx>], dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, EmulateItemResult> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); // Prefix should have already been checked. let unprefixed_name = link_name.as_str().strip_prefix("llvm.x86.").unwrap(); match unprefixed_name { @@ -41,20 +41,20 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/addcarry-u32-addcarry-u64.html // https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/subborrow-u32-subborrow-u64.html "addcarry.32" | "addcarry.64" | "subborrow.32" | "subborrow.64" => { - if unprefixed_name.ends_with("64") && this.tcx.sess.target.arch != Arch::X86_64 { + if unprefixed_name.ends_with("64") && ecx.tcx.sess.target.arch != Arch::X86_64 { return interp_ok(EmulateItemResult::NotSupported); } - let [cb_in, a, b] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [cb_in, a, b] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let op = if unprefixed_name.starts_with("add") { mir::BinOp::AddWithOverflow } else { mir::BinOp::SubWithOverflow }; - let (sum, cb_out) = carrying_add(this, cb_in, a, b, op)?; - this.write_scalar(cb_out, &this.project_field(dest, FieldIdx::ZERO)?)?; - this.write_immediate(*sum, &this.project_field(dest, FieldIdx::ONE)?)?; + let (sum, cb_out) = carrying_add(ecx, cb_in, a, b, op)?; + ecx.write_scalar(cb_out, &ecx.project_field(dest, FieldIdx::ZERO)?)?; + ecx.write_immediate(*sum, &ecx.project_field(dest, FieldIdx::ONE)?)?; } // Used to implement the `_mm_pause` function. @@ -63,87 +63,87 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // the instruction behaves like a no-op, so it is always safe to call the // intrinsic. "sse2.pause" => { - let [] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; // Only exhibit the spin-loop hint behavior when SSE2 is enabled. - if this.tcx.sess.internal_target_features.contains(&Symbol::intern("sse2")) { - this.yield_active_thread(); + if ecx.tcx.sess.internal_target_features.contains(&Symbol::intern("sse2")) { + ecx.yield_active_thread(); } } "pclmulqdq" | "pclmulqdq.256" | "pclmulqdq.512" => { let mut len = 2; // in units of 64bits - this.expect_target_feature_for_intrinsic(link_name, "pclmulqdq")?; + ecx.expect_target_feature_for_intrinsic(link_name, "pclmulqdq")?; if unprefixed_name.ends_with(".256") { - this.expect_target_feature_for_intrinsic(link_name, "vpclmulqdq")?; + ecx.expect_target_feature_for_intrinsic(link_name, "vpclmulqdq")?; len = 4; } else if unprefixed_name.ends_with(".512") { - this.expect_target_feature_for_intrinsic(link_name, "vpclmulqdq")?; - this.expect_target_feature_for_intrinsic(link_name, "avx512f")?; + ecx.expect_target_feature_for_intrinsic(link_name, "vpclmulqdq")?; + ecx.expect_target_feature_for_intrinsic(link_name, "avx512f")?; len = 8; } - let [left, right, imm] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right, imm] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - pclmulqdq(this, left, right, imm, dest, len)?; + pclmulqdq(ecx, left, right, imm, dest, len)?; } name if name.starts_with("bmi.") => { - return bmi::EvalContextExt::emulate_x86_bmi_intrinsic(this, link_name, args, dest); + return bmi::EvalContextExt::emulate_x86_bmi_intrinsic(ecx, link_name, args, dest); } // The GFNI extension does not get its own namespace. // Check for instruction names instead. name if name.starts_with("vgf2p8affine") || name.starts_with("vgf2p8mulb") => { return gfni::EvalContextExt::emulate_x86_gfni_intrinsic( - this, link_name, args, dest, + ecx, link_name, args, dest, ); } name if name.starts_with("sha") => { - return sha::EvalContextExt::emulate_x86_sha_intrinsic(this, link_name, args, dest); + return sha::EvalContextExt::emulate_x86_sha_intrinsic(ecx, link_name, args, dest); } name if name.starts_with("sse.") => { - return sse::EvalContextExt::emulate_x86_sse_intrinsic(this, link_name, args, dest); + return sse::EvalContextExt::emulate_x86_sse_intrinsic(ecx, link_name, args, dest); } name if name.starts_with("sse2.") => { return sse2::EvalContextExt::emulate_x86_sse2_intrinsic( - this, link_name, args, dest, + ecx, link_name, args, dest, ); } name if name.starts_with("sse3.") => { return sse3::EvalContextExt::emulate_x86_sse3_intrinsic( - this, link_name, args, dest, + ecx, link_name, args, dest, ); } name if name.starts_with("ssse3.") => { return ssse3::EvalContextExt::emulate_x86_ssse3_intrinsic( - this, link_name, args, dest, + ecx, link_name, args, dest, ); } name if name.starts_with("sse41.") => { return sse41::EvalContextExt::emulate_x86_sse41_intrinsic( - this, link_name, args, dest, + ecx, link_name, args, dest, ); } name if name.starts_with("sse42.") => { return sse42::EvalContextExt::emulate_x86_sse42_intrinsic( - this, link_name, args, dest, + ecx, link_name, args, dest, ); } name if name.starts_with("aesni.") => { return aesni::EvalContextExt::emulate_x86_aesni_intrinsic( - this, link_name, args, dest, + ecx, link_name, args, dest, ); } name if name.starts_with("avx.") => { - return avx::EvalContextExt::emulate_x86_avx_intrinsic(this, link_name, args, dest); + return avx::EvalContextExt::emulate_x86_avx_intrinsic(ecx, link_name, args, dest); } name if name.starts_with("avx2.") => { return avx2::EvalContextExt::emulate_x86_avx2_intrinsic( - this, link_name, args, dest, + ecx, link_name, args, dest, ); } name if name.starts_with("avx512.") => { return avx512::EvalContextExt::emulate_x86_avx512_intrinsic( - this, link_name, args, dest, + ecx, link_name, args, dest, ); } diff --git a/src/tools/miri/src/intrinsics/x86/sse.rs b/src/tools/miri/src/intrinsics/x86/sse.rs index 29d8f7ef53e48..09e36dd218204 100644 --- a/src/tools/miri/src/intrinsics/x86/sse.rs +++ b/src/tools/miri/src/intrinsics/x86/sse.rs @@ -15,8 +15,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &[OpTy<'tcx>], dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, EmulateItemResult> { - let this = self.eval_context_mut(); - this.expect_target_feature_for_intrinsic(link_name, "sse")?; + let ecx = self.eval_context_mut(); + ecx.expect_target_feature_for_intrinsic(link_name, "sse")?; // Prefix should have already been checked. let unprefixed_name = link_name.as_str().strip_prefix("llvm.x86.sse.").unwrap(); // All these intrinsics operate on 128-bit (f32x4) SIMD vectors unless stated otherwise. @@ -30,7 +30,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Performs the operations on the first component of `left` and // `right` and copies the remaining components from `left`. "min.ss" | "max.ss" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "min.ss" => FloatBinOp::Min, @@ -38,7 +38,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - bin_op_simd_float_first::(this, which, left, right, dest)?; + bin_op_simd_float_first::(ecx, which, left, right, dest)?; } // Used to implement _mm_min_ps and _mm_max_ps functions. // Note that the semantics are a bit different from Rust simd_min @@ -46,7 +46,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // matches the IEEE min/max operations, while x86 has different // semantics. "min.ps" | "max.ps" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "min.ps" => FloatBinOp::Min, @@ -54,13 +54,13 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - bin_op_simd_float_all::(this, which, left, right, dest)?; + bin_op_simd_float_all::(ecx, which, left, right, dest)?; } // Used to implement _mm_{rcp,rsqrt}_ss functions. // Performs the operations on the first component of `op` and // copies the remaining components from `op`. "rcp.ss" | "rsqrt.ss" => { - let [op] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [op] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "rcp.ss" => FloatUnaryOp::Rcp, @@ -68,12 +68,12 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - unary_op_ss(this, which, op, dest)?; + unary_op_ss(ecx, which, op, dest)?; } // Used to implement _mm_{sqrt,rcp,rsqrt}_ps functions. // Performs the operations on all components of `op`. "rcp.ps" | "rsqrt.ps" => { - let [op] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [op] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "rcp.ps" => FloatUnaryOp::Rcp, @@ -81,7 +81,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - unary_op_ps(this, which, op, dest)?; + unary_op_ps(ecx, which, op, dest)?; } // Used to implement the _mm_cmp*_ss functions. // Performs a comparison operation on the first component of `left` @@ -92,12 +92,12 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // _mm_cmp{eq,lt,le,gt,ge,neq,nlt,nle,ngt,nge,ord,unord}_ss are SSE functions // with hard-coded operations. "cmp.ss" => { - let [left, right, imm] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right, imm] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = - FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?; + FloatBinOp::cmp_from_imm(ecx, ecx.read_scalar(imm)?.to_i8()?, link_name)?; - bin_op_simd_float_first::(this, which, left, right, dest)?; + bin_op_simd_float_first::(ecx, which, left, right, dest)?; } // Used to implement the _mm_cmp*_ps functions. // Performs a comparison operation on each component of `left` @@ -108,12 +108,12 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // _mm_cmp{eq,lt,le,gt,ge,neq,nlt,nle,ngt,nge,ord,unord}_ps are SSE functions // with hard-coded operations. "cmp.ps" => { - let [left, right, imm] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right, imm] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = - FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?; + FloatBinOp::cmp_from_imm(ecx, ecx.read_scalar(imm)?.to_i8()?, link_name)?; - bin_op_simd_float_all::(this, which, left, right, dest)?; + bin_op_simd_float_all::(ecx, which, left, right, dest)?; } // Used to implement _mm_{,u}comi{eq,lt,le,gt,ge,neq}_ss functions. // Compares the first component of `left` and `right` and returns @@ -121,15 +121,15 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "comieq.ss" | "comilt.ss" | "comile.ss" | "comigt.ss" | "comige.ss" | "comineq.ss" | "ucomieq.ss" | "ucomilt.ss" | "ucomile.ss" | "ucomigt.ss" | "ucomige.ss" | "ucomineq.ss" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (left, left_len) = this.project_to_simd(left)?; - let (right, right_len) = this.project_to_simd(right)?; + let (left, left_len) = ecx.project_to_simd(left)?; + let (right, right_len) = ecx.project_to_simd(right)?; assert_eq!(left_len, right_len); - let left = this.read_scalar(&this.project_index(&left, 0)?)?.to_f32()?; - let right = this.read_scalar(&this.project_index(&right, 0)?)?.to_f32()?; + let left = ecx.read_scalar(&ecx.project_index(&left, 0)?)?.to_f32()?; + let right = ecx.read_scalar(&ecx.project_index(&right, 0)?)?.to_f32()?; // The difference between the com* and ucom* variants is signaling // of exceptions when either argument is a quiet NaN. We do not // support accessing the SSE status register from miri (or from Rust, @@ -143,16 +143,16 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "comineq.ss" | "ucomineq.ss" => left != right, _ => unreachable!(), }; - this.write_scalar(Scalar::from_i32(i32::from(res)), dest)?; + ecx.write_scalar(Scalar::from_i32(i32::from(res)), dest)?; } // Use to implement the _mm_cvtss_si32, _mm_cvttss_si32, // _mm_cvtss_si64 and _mm_cvttss_si64 functions. // Converts the first component of `op` from f32 to i32/i64. "cvtss2si" | "cvttss2si" | "cvtss2si64" | "cvttss2si64" => { - let [op] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (op, _) = this.project_to_simd(op)?; + let [op] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + let (op, _) = ecx.project_to_simd(op)?; - let op = this.read_immediate(&this.project_index(&op, 0)?)?; + let op = ecx.read_immediate(&ecx.project_index(&op, 0)?)?; let rnd = match unprefixed_name { // "current SSE rounding mode", assume nearest @@ -164,12 +164,12 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - let res = this.float_to_int_checked(&op, dest.layout, rnd)?.unwrap_or_else(|| { + let res = ecx.float_to_int_checked(&op, dest.layout, rnd)?.unwrap_or_else(|| { // Fallback to minimum according to SSE semantics. ImmTy::from_int(dest.layout.size.signed_int_min(), dest.layout) }); - this.write_immediate(*res, dest)?; + ecx.write_immediate(*res, dest)?; } _ => return interp_ok(EmulateItemResult::NotSupported), } diff --git a/src/tools/miri/src/intrinsics/x86/sse2.rs b/src/tools/miri/src/intrinsics/x86/sse2.rs index e3dcdf6c248c4..bfd92bfd74c9f 100644 --- a/src/tools/miri/src/intrinsics/x86/sse2.rs +++ b/src/tools/miri/src/intrinsics/x86/sse2.rs @@ -15,8 +15,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &[OpTy<'tcx>], dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, EmulateItemResult> { - let this = self.eval_context_mut(); - this.expect_target_feature_for_intrinsic(link_name, "sse2")?; + let ecx = self.eval_context_mut(); + ecx.expect_target_feature_for_intrinsic(link_name, "sse2")?; // Prefix should have already been checked. let unprefixed_name = link_name.as_str().strip_prefix("llvm.x86.sse2.").unwrap(); @@ -35,15 +35,15 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Used to implement the _mm_avg_epu8 and _mm_avg_epu16 functions. // Averages packed unsigned 8/16-bit integers in `left` and `right`. "pavg.b" | "pavg.w" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - pavg(this, left, right, dest)?; + pavg(ecx, left, right, dest)?; } // Used to implement the _mm_sad_epu8 function. "psad.bw" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - psadbw(this, left, right, dest)? + psadbw(ecx, left, right, dest)? } // Used to implement the _mm_{sll,srl,sra}_epi{16,32,64} functions // (except _mm_sra_epi64, which is not available in SSE2). @@ -55,7 +55,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // is copied to remaining bits. "psll.w" | "psrl.w" | "psra.w" | "psll.d" | "psrl.d" | "psra.d" | "psll.q" | "psrl.q" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "psll.w" | "psll.d" | "psll.q" => ShiftOp::Left, @@ -64,16 +64,16 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - shift_simd_by_scalar(this, left, right, which, dest)?; + shift_simd_by_scalar(ecx, left, right, which, dest)?; } // Used to implement the _mm_cvtps_epi32, _mm_cvttps_epi32, _mm_cvtpd_epi32 // and _mm_cvttpd_epi32 functions. // Converts packed f32/f64 to packed i32. "cvtps2dq" | "cvttps2dq" | "cvtpd2dq" | "cvttpd2dq" => { - let [op] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [op] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (op_len, _) = op.layout.ty.simd_size_and_type(*this.tcx); - let (dest_len, _) = dest.layout.ty.simd_size_and_type(*this.tcx); + let (op_len, _) = op.layout.ty.simd_size_and_type(*ecx.tcx); + let (dest_len, _) = dest.layout.ty.simd_size_and_type(*ecx.tcx); match unprefixed_name { "cvtps2dq" | "cvttps2dq" => { // f32x4 to i32x4 conversion @@ -101,31 +101,31 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - convert_float_to_int(this, op, rnd, dest)?; + convert_float_to_int(ecx, op, rnd, dest)?; } // Used to implement the _mm_packs_epi16 function. // Converts two 16-bit integer vectors to a single 8-bit integer // vector with signed saturation. "packsswb.128" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - packsswb(this, left, right, dest)?; + packsswb(ecx, left, right, dest)?; } // Used to implement the _mm_packus_epi16 function. // Converts two 16-bit signed integer vectors to a single 8-bit // unsigned integer vector with saturation. "packuswb.128" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - packuswb(this, left, right, dest)?; + packuswb(ecx, left, right, dest)?; } // Used to implement the _mm_packs_epi32 function. // Converts two 32-bit integer vectors to a single 16-bit integer // vector with signed saturation. "packssdw.128" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - packssdw(this, left, right, dest)?; + packssdw(ecx, left, right, dest)?; } // Used to implement _mm_min_sd and _mm_max_sd functions. // Note that the semantics are a bit different from Rust simd_min @@ -133,7 +133,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // matches the IEEE min/max operations, while x86 has different // semantics. "min.sd" | "max.sd" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "min.sd" => FloatBinOp::Min, @@ -141,7 +141,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - bin_op_simd_float_first::(this, which, left, right, dest)?; + bin_op_simd_float_first::(ecx, which, left, right, dest)?; } // Used to implement _mm_min_pd and _mm_max_pd functions. // Note that the semantics are a bit different from Rust simd_min @@ -149,7 +149,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // matches the IEEE min/max operations, while x86 has different // semantics. "min.pd" | "max.pd" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = match unprefixed_name { "min.pd" => FloatBinOp::Min, @@ -157,7 +157,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - bin_op_simd_float_all::(this, which, left, right, dest)?; + bin_op_simd_float_all::(ecx, which, left, right, dest)?; } // Used to implement the _mm_cmp*_sd functions. // Performs a comparison operation on the first component of `left` @@ -168,12 +168,12 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // _mm_cmp{eq,lt,le,gt,ge,neq,nlt,nle,ngt,nge,ord,unord}_sd are SSE2 functions // with hard-coded operations. "cmp.sd" => { - let [left, right, imm] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right, imm] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = - FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?; + FloatBinOp::cmp_from_imm(ecx, ecx.read_scalar(imm)?.to_i8()?, link_name)?; - bin_op_simd_float_first::(this, which, left, right, dest)?; + bin_op_simd_float_first::(ecx, which, left, right, dest)?; } // Used to implement the _mm_cmp*_pd functions. // Performs a comparison operation on each component of `left` @@ -184,12 +184,12 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // _mm_cmp{eq,lt,le,gt,ge,neq,nlt,nle,ngt,nge,ord,unord}_pd are SSE2 functions // with hard-coded operations. "cmp.pd" => { - let [left, right, imm] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right, imm] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; let which = - FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?; + FloatBinOp::cmp_from_imm(ecx, ecx.read_scalar(imm)?.to_i8()?, link_name)?; - bin_op_simd_float_all::(this, which, left, right, dest)?; + bin_op_simd_float_all::(ecx, which, left, right, dest)?; } // Used to implement _mm_{,u}comi{eq,lt,le,gt,ge,neq}_sd functions. // Compares the first component of `left` and `right` and returns @@ -197,15 +197,15 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "comieq.sd" | "comilt.sd" | "comile.sd" | "comigt.sd" | "comige.sd" | "comineq.sd" | "ucomieq.sd" | "ucomilt.sd" | "ucomile.sd" | "ucomigt.sd" | "ucomige.sd" | "ucomineq.sd" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (left, left_len) = this.project_to_simd(left)?; - let (right, right_len) = this.project_to_simd(right)?; + let (left, left_len) = ecx.project_to_simd(left)?; + let (right, right_len) = ecx.project_to_simd(right)?; assert_eq!(left_len, right_len); - let left = this.read_scalar(&this.project_index(&left, 0)?)?.to_f64()?; - let right = this.read_scalar(&this.project_index(&right, 0)?)?.to_f64()?; + let left = ecx.read_scalar(&ecx.project_index(&left, 0)?)?.to_f64()?; + let right = ecx.read_scalar(&ecx.project_index(&right, 0)?)?.to_f64()?; // The difference between the com* and ucom* variants is signaling // of exceptions when either argument is a quiet NaN. We do not // support accessing the SSE status register from miri (or from Rust, @@ -219,16 +219,16 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { "comineq.sd" | "ucomineq.sd" => left != right, _ => unreachable!(), }; - this.write_scalar(Scalar::from_i32(i32::from(res)), dest)?; + ecx.write_scalar(Scalar::from_i32(i32::from(res)), dest)?; } // Use to implement the _mm_cvtsd_si32, _mm_cvttsd_si32, // _mm_cvtsd_si64 and _mm_cvttsd_si64 functions. // Converts the first component of `op` from f64 to i32/i64. "cvtsd2si" | "cvttsd2si" | "cvtsd2si64" | "cvttsd2si64" => { - let [op] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (op, _) = this.project_to_simd(op)?; + let [op] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + let (op, _) = ecx.project_to_simd(op)?; - let op = this.read_immediate(&this.project_index(&op, 0)?)?; + let op = ecx.read_immediate(&ecx.project_index(&op, 0)?)?; let rnd = match unprefixed_name { // "current SSE rounding mode", assume nearest @@ -240,34 +240,34 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { _ => unreachable!(), }; - let res = this.float_to_int_checked(&op, dest.layout, rnd)?.unwrap_or_else(|| { + let res = ecx.float_to_int_checked(&op, dest.layout, rnd)?.unwrap_or_else(|| { // Fallback to minimum according to SSE semantics. ImmTy::from_int(dest.layout.size.signed_int_min(), dest.layout) }); - this.write_immediate(*res, dest)?; + ecx.write_immediate(*res, dest)?; } // Used to implement the _mm_cvtsd_ss function. // Converts the first f64 from `right` to f32 and copies the remaining // elements from `left` "cvtsd2ss" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; - let (left, left_len) = this.project_to_simd(left)?; - let (right, _) = this.project_to_simd(right)?; - let (dest, dest_len) = this.project_to_simd(dest)?; + let (left, left_len) = ecx.project_to_simd(left)?; + let (right, _) = ecx.project_to_simd(right)?; + let (dest, dest_len) = ecx.project_to_simd(dest)?; assert_eq!(dest_len, left_len); // Convert first element of `right` - let right0 = this.read_immediate(&this.project_index(&right, 0)?)?; - let dest0 = this.project_index(&dest, 0)?; - let res0 = this.float_to_float_or_int(&right0, dest0.layout)?; - this.write_immediate(*res0, &dest0)?; + let right0 = ecx.read_immediate(&ecx.project_index(&right, 0)?)?; + let dest0 = ecx.project_index(&dest, 0)?; + let res0 = ecx.float_to_float_or_int(&right0, dest0.layout)?; + ecx.write_immediate(*res0, &dest0)?; // Copy remaining from `left` for i in 1..dest_len { - this.copy_op(&this.project_index(&left, i)?, &this.project_index(&dest, i)?)?; + ecx.copy_op(&ecx.project_index(&left, i)?, &ecx.project_index(&dest, i)?)?; } } // Used to implement the _mm_madd_epi16 function. @@ -275,13 +275,13 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // intermediate signed 32-bit integers. Horizontally add adjacent pairs of // intermediate 32-bit integers, and pack the results in `dest`. "pmadd.wd" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - pmaddwd(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + pmaddwd(ecx, left, right, dest)?; } // Used to implement the _mm_mulhi_epi16 and _mm_mulhi_epu16 functions. "pmulh.w" | "pmulhu.w" => { - let [left, right] = this.check_shim_sig_llvm_intrinsic(link_name, args)?; - pmulh(this, left, right, dest)?; + let [left, right] = ecx.check_shim_sig_llvm_intrinsic(link_name, args)?; + pmulh(ecx, left, right, dest)?; } _ => return interp_ok(EmulateItemResult::NotSupported), } From ae4771bf58595d506bc0c829e976612264ac61fb Mon Sep 17 00:00:00 2001 From: Kaileshwar16 Date: Sun, 8 Nov 2026 16:27:29 +0530 Subject: [PATCH 08/34] Rename evaluation context bindings from this to ecx --- src/tools/miri/src/operator.rs | 32 ++++----- src/tools/miri/src/provenance_gc.rs | 8 +-- src/tools/miri/src/shims/alloc.rs | 96 +++++++++++++-------------- src/tools/miri/src/shims/backtrace.rs | 84 +++++++++++------------ 4 files changed, 110 insertions(+), 110 deletions(-) diff --git a/src/tools/miri/src/operator.rs b/src/tools/miri/src/operator.rs index f8afa78bc5bd1..2125c8bfbf98f 100644 --- a/src/tools/miri/src/operator.rs +++ b/src/tools/miri/src/operator.rs @@ -18,13 +18,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ) -> InterpResult<'tcx, ImmTy<'tcx>> { use rustc_middle::mir::BinOp::*; - let this = self.eval_context_ref(); + let ecx = self.eval_context_ref(); trace!("ptr_op: {:?} {:?} {:?}", *left, bin_op, *right); interp_ok(match bin_op { Eq | Ne | Lt | Le | Gt | Ge => { assert_eq!(left.layout.backend_repr, right.layout.backend_repr); // types can differ, e.g. fn ptrs with different `for` - let size = this.pointer_size(); + let size = ecx.pointer_size(); // Just compare the bits. ScalarPairs are compared lexicographically. // We thus always compare pairs and simply fill scalars up with 0. let left = match **left { @@ -46,34 +46,34 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { Ge => left >= right, _ => bug!(), }; - ImmTy::from_bool(res, *this.tcx) + ImmTy::from_bool(res, *ecx.tcx) } // Some more operations are possible with atomics. // The RHS must be `usize`. Add | Sub | BitOr | BitAnd | BitXor => { assert!(left.layout.ty.is_raw_ptr()); - assert_eq!(right.layout.ty, this.tcx.types.usize); - let ptr = left.to_scalar().to_pointer(this); + assert_eq!(right.layout.ty, ecx.tcx.types.usize); + let ptr = left.to_scalar().to_pointer(ecx); // We do the actual operation with usize-typed scalars. - let left = ImmTy::from_uint(ptr.addr().bytes(), this.machine.layouts.usize); - let result = this.binary_op(bin_op, &left, right)?; + let left = ImmTy::from_uint(ptr.addr().bytes(), ecx.machine.layouts.usize); + let result = ecx.binary_op(bin_op, &left, right)?; // Construct a new pointer with the provenance of `ptr` (the LHS). let result_ptr = Pointer::new( ptr.provenance, - Size::from_bytes(result.to_scalar().to_target_usize(this)?), + Size::from_bytes(result.to_scalar().to_target_usize(ecx)?), ); - ImmTy::from_scalar(Scalar::from_maybe_pointer(result_ptr, this), left.layout) + ImmTy::from_scalar(Scalar::from_maybe_pointer(result_ptr, ecx), left.layout) } - _ => span_bug!(this.cur_span(), "Invalid operator on pointers: {:?}", bin_op), + _ => span_bug!(ecx.cur_span(), "Invalid operator on pointers: {:?}", bin_op), }) } fn generate_nan, F2: Float>(&self, inputs: &[F1]) -> F2 { - let this = self.eval_context_ref(); - if !this.machine.float_nondet { + let ecx = self.eval_context_ref(); + if !ecx.machine.float_nondet { return F2::NAN; } @@ -90,7 +90,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { if f.is_nan() { Some(f) } else { None } } - let mut rand = this.machine.rng.borrow_mut(); + let mut rand = ecx.machine.rng.borrow_mut(); // Assemble an iterator of possible NaNs: preferred, quieting propagation, unchanged propagation. // On some targets there are more possibilities; for now we just generate those options that // are possible everywhere. @@ -117,12 +117,12 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } fn equal_float_min_max(&self, a: F, b: F) -> F { - let this = self.eval_context_ref(); - if !this.machine.float_nondet { + let ecx = self.eval_context_ref(); + if !ecx.machine.float_nondet { return a; } // Return one side non-deterministically. - let mut rand = this.machine.rng.borrow_mut(); + let mut rand = ecx.machine.rng.borrow_mut(); if rand.random() { a } else { b } } } diff --git a/src/tools/miri/src/provenance_gc.rs b/src/tools/miri/src/provenance_gc.rs index d1022bacd583d..c2e4188c904b8 100644 --- a/src/tools/miri/src/provenance_gc.rs +++ b/src/tools/miri/src/provenance_gc.rs @@ -263,12 +263,12 @@ fn remove_unreachable_allocs<'tcx>(ecx: &mut MiriInterpCx<'tcx>, allocs: FxHashS impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {} pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> { fn run_provenance_gc(&mut self) { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); // We collect all tags and AllocId from every part of the interpreter. let mut tags = FxHashSet::default(); let mut alloc_ids = FxHashSet::default(); - this.visit_provenance(&mut |id, tag| { + ecx.visit_provenance(&mut |id, tag| { if let Some(id) = id { alloc_ids.insert(id); } @@ -278,7 +278,7 @@ pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> { }); // Based on this, clean up the interpreter state. - remove_unreachable_tags(this, tags); - remove_unreachable_allocs(this, alloc_ids); + remove_unreachable_tags(ecx, tags); + remove_unreachable_allocs(ecx, alloc_ids); } } diff --git a/src/tools/miri/src/shims/alloc.rs b/src/tools/miri/src/shims/alloc.rs index aa45a6d9686a9..5976d70ce0e24 100644 --- a/src/tools/miri/src/shims/alloc.rs +++ b/src/tools/miri/src/shims/alloc.rs @@ -11,7 +11,7 @@ impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {} pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { /// Returns the alignment that `malloc` would guarantee for requests of the given size. fn malloc_align(&self, size: u64) -> Align { - let this = self.eval_context_ref(); + let ecx = self.eval_context_ref(); // The C standard says: "The pointer returned if the allocation succeeds is suitably aligned // so that it may be assigned to a pointer to any type of object with a fundamental // alignment requirement and size less than or equal to the size requested." @@ -19,8 +19,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // This is given by `alignof(max_align_t)`. The following list is taken from // `library/std/src/sys/alloc/mod.rs` (where this is called `MIN_ALIGN`) and should // be kept in sync. - let os = &this.tcx.sess.target.os; - let max_fundamental_align = match &this.tcx.sess.target.arch { + let os = &ecx.tcx.sess.target.os; + let max_fundamental_align = match &ecx.tcx.sess.target.arch { Arch::RiscV32 if matches!(os, Os::EspIdf | Os::Zkvm) => 4, Arch::Xtensa if matches!(os, Os::EspIdf) => 4, Arch::X86 @@ -87,11 +87,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { /// Check some basic requirements for this allocation request: /// non-zero size, power-of-two alignment. fn check_rust_alloc_request(&self, size: u64, align: u64) -> InterpResult<'tcx> { - let this = self.eval_context_ref(); + let ecx = self.eval_context_ref(); if size == 0 { throw_ub_format!("creating allocation with size 0"); } - if size > this.max_size_of_val().bytes() { + if size > ecx.max_size_of_val().bytes() { throw_ub_format!("creating an allocation larger than half the address space"); } if let Err(e) = Align::from_bytes(align) { @@ -119,20 +119,20 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &[OpTy<'tcx>], dest: &PlaceTy<'tcx>, ) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); match method { SpecialAllocatorMethod::Alloc | SpecialAllocatorMethod::AllocZeroed => { - let [size, align] = &this.check_shim_sig( + let [size, align] = &ecx.check_shim_sig( shim_sig!(extern "Rust" fn(usize, core::mem::Alignment) -> *()), (link_name, abi, args), )?; - let size = this.read_target_usize(size)?; - let align = this.read_target_usize(align)?; + let size = ecx.read_target_usize(size)?; + let align = ecx.read_target_usize(align)?; - this.check_rust_alloc_request(size, align)?; + ecx.check_rust_alloc_request(size, align)?; - let ptr = this.allocate_ptr( + let ptr = ecx.allocate_ptr( Size::from_bytes(size), Align::from_bytes(align).unwrap(), MiriMemoryKind::Rust.into(), @@ -143,39 +143,39 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { }, )?; - this.write_pointer(ptr, dest) + ecx.write_pointer(ptr, dest) } SpecialAllocatorMethod::Dealloc => { - let [ptr, old_size, align] = &this.check_shim_sig( + let [ptr, old_size, align] = &ecx.check_shim_sig( shim_sig!(extern "Rust" fn(*(), usize, core::mem::Alignment) -> ()), (link_name, abi, args), )?; - let ptr = this.read_pointer(ptr)?; - let old_size = this.read_target_usize(old_size)?; - let align = this.read_target_usize(align)?; + let ptr = ecx.read_pointer(ptr)?; + let old_size = ecx.read_target_usize(old_size)?; + let align = ecx.read_target_usize(align)?; // No need to check old_size/align; we anyway check that they match the allocation. - this.deallocate_ptr( + ecx.deallocate_ptr( ptr, Some((Size::from_bytes(old_size), Align::from_bytes(align).unwrap())), MiriMemoryKind::Rust.into(), ) } SpecialAllocatorMethod::Realloc => { - let [ptr, old_size, align, new_size] = &this.check_shim_sig( + let [ptr, old_size, align, new_size] = &ecx.check_shim_sig( shim_sig!(extern "Rust" fn(*(), usize, core::mem::Alignment, usize) -> *()), (link_name, abi, args), )?; - let ptr = this.read_pointer(ptr)?; - let old_size = this.read_target_usize(old_size)?; - let align = this.read_target_usize(align)?; - let new_size = this.read_target_usize(new_size)?; + let ptr = ecx.read_pointer(ptr)?; + let old_size = ecx.read_target_usize(old_size)?; + let align = ecx.read_target_usize(align)?; + let new_size = ecx.read_target_usize(new_size)?; // No need to check old_size; we anyway check that they match the allocation. - this.check_rust_alloc_request(new_size, align)?; + ecx.check_rust_alloc_request(new_size, align)?; let align = Align::from_bytes(align).unwrap(); - let new_ptr = this.reallocate_ptr( + let new_ptr = ecx.reallocate_ptr( ptr, Some((Size::from_bytes(old_size), align)), Size::from_bytes(new_size), @@ -183,16 +183,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { MiriMemoryKind::Rust.into(), AllocInit::Uninit, )?; - this.write_pointer(new_ptr, dest) + ecx.write_pointer(new_ptr, dest) } } } fn malloc(&mut self, size: u64, init: AllocInit) -> InterpResult<'tcx, Pointer> { - let this = self.eval_context_mut(); - let align = this.malloc_align(size); + let ecx = self.eval_context_mut(); + let align = ecx.malloc_align(size); let ptr = - this.allocate_ptr(Size::from_bytes(size), align, MiriMemoryKind::C.into(), init)?; + ecx.allocate_ptr(Size::from_bytes(size), align, MiriMemoryKind::C.into(), init)?; interp_ok(ptr.into()) } @@ -202,39 +202,39 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { align: &OpTy<'tcx>, size: &OpTy<'tcx>, ) -> InterpResult<'tcx, Scalar> { - let this = self.eval_context_mut(); - let memptr = this.deref_pointer(memptr)?; - let align = this.read_target_usize(align)?; - let size = this.read_target_usize(size)?; + let ecx = self.eval_context_mut(); + let memptr = ecx.deref_pointer(memptr)?; + let align = ecx.read_target_usize(align)?; + let size = ecx.read_target_usize(size)?; // Align must be power of 2, and also at least ptr-sized (POSIX rules). // But failure to adhere to this is not UB, it's an error condition. - if !align.is_power_of_two() || align < this.pointer_size().bytes() { - interp_ok(this.eval_libc("EINVAL")) + if !align.is_power_of_two() || align < ecx.pointer_size().bytes() { + interp_ok(ecx.eval_libc("EINVAL")) } else { - let ptr = this.allocate_ptr( + let ptr = ecx.allocate_ptr( Size::from_bytes(size), Align::from_bytes(align).unwrap(), MiriMemoryKind::C.into(), AllocInit::Uninit, )?; - this.write_pointer(ptr, &memptr)?; + ecx.write_pointer(ptr, &memptr)?; interp_ok(Scalar::from_i32(0)) } } fn free(&mut self, ptr: Pointer) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); - if !this.ptr_is_null(ptr)? { - this.deallocate_ptr(ptr, None, MiriMemoryKind::C.into())?; + let ecx = self.eval_context_mut(); + if !ecx.ptr_is_null(ptr)? { + ecx.deallocate_ptr(ptr, None, MiriMemoryKind::C.into())?; } interp_ok(()) } fn realloc(&mut self, old_ptr: Pointer, new_size: u64) -> InterpResult<'tcx, Pointer> { - let this = self.eval_context_mut(); - let new_align = this.malloc_align(new_size); - if this.ptr_is_null(old_ptr)? { + let ecx = self.eval_context_mut(); + let new_align = ecx.malloc_align(new_size); + if ecx.ptr_is_null(old_ptr)? { // Here we must behave like `malloc`. self.malloc(new_size, AllocInit::Uninit) } else { @@ -243,7 +243,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // throw_ub_format!("`realloc` with a size of zero"); } else { - let new_ptr = this.reallocate_ptr( + let new_ptr = ecx.reallocate_ptr( old_ptr, None, Size::from_bytes(new_size), @@ -261,9 +261,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { align: &OpTy<'tcx>, size: &OpTy<'tcx>, ) -> InterpResult<'tcx, Pointer> { - let this = self.eval_context_mut(); - let align = this.read_target_usize(align)?; - let size = this.read_target_usize(size)?; + let ecx = self.eval_context_mut(); + let align = ecx.read_target_usize(align)?; + let size = ecx.read_target_usize(size)?; // Alignment must be a power of 2, and "supported by the implementation". // We decide that "supported by the implementation" means that the @@ -285,8 +285,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // FreeBSD: https://man.freebsd.org/cgi/man.cgi?query=aligned_alloc&apropos=0&sektion=3&manpath=FreeBSD+9-current&format=html match size.checked_rem(align) { Some(0) if align.is_power_of_two() => { - let align = align.max(this.malloc_align(size).bytes()); - let ptr = this.allocate_ptr( + let align = align.max(ecx.malloc_align(size).bytes()); + let ptr = ecx.allocate_ptr( Size::from_bytes(size), Align::from_bytes(align).unwrap(), MiriMemoryKind::C.into(), diff --git a/src/tools/miri/src/shims/backtrace.rs b/src/tools/miri/src/shims/backtrace.rs index f7d369226704b..0dea1e812909d 100644 --- a/src/tools/miri/src/shims/backtrace.rs +++ b/src/tools/miri/src/shims/backtrace.rs @@ -14,18 +14,18 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &[OpTy<'tcx>], dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); - let [flags] = &this - .check_shim_sig(shim_sig!(extern "Rust" fn(u64) -> usize), (link_name, abi, args))?; + let ecx = self.eval_context_mut(); + let [flags] = + &ecx.check_shim_sig(shim_sig!(extern "Rust" fn(u64) -> usize), (link_name, abi, args))?; - let flags = this.read_scalar(flags)?.to_u64()?; + let flags = ecx.read_scalar(flags)?.to_u64()?; if flags != 0 { throw_unsup_format!("unknown `miri_backtrace_size` flags {}", flags); } - let frame_count = this.active_thread_stack().len(); + let frame_count = ecx.active_thread_stack().len(); - this.write_scalar(Scalar::from_target_usize(frame_count.to_u64(), this), dest) + ecx.write_scalar(Scalar::from_target_usize(frame_count.to_u64(), ecx), dest) } fn handle_miri_get_backtrace( @@ -34,16 +34,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { link_name: Symbol, args: &[OpTy<'tcx>], ) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); - let [flags, buf] = &this + let [flags, buf] = &ecx .check_shim_sig(shim_sig!(extern "Rust" fn(u64, **()) -> ()), (link_name, abi, args))?; - let flags = this.read_scalar(flags)?.to_u64()?; - let buf_place = this.deref_pointer(buf)?; + let flags = ecx.read_scalar(flags)?.to_u64()?; + let buf_place = ecx.deref_pointer(buf)?; let mut data = Vec::new(); - for frame in this.active_thread_stack().iter().rev() { + for frame in ecx.active_thread_stack().iter().rev() { // Match behavior of debuginfo (`FunctionCx::adjusted_span_and_dbg_scope`). let span = hygiene::walk_chain_collapsed(frame.current_span(), frame.body().span); data.push((frame.instance(), span.lo())); @@ -58,8 +58,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // to reconstruct the needed frame information in `handle_miri_resolve_frame`. // Note that we never actually read or write anything from/to this pointer - // all of the data is represented by the pointer value itself. - let fn_ptr = this.fn_ptr(FnVal::Instance(instance)); - fn_ptr.wrapping_offset(Size::from_bytes(pos.0), this) + let fn_ptr = ecx.fn_ptr(FnVal::Instance(instance)); + fn_ptr.wrapping_offset(Size::from_bytes(pos.0), ecx) }) .collect(); @@ -69,8 +69,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { } 1 => for (i, ptr) in ptrs.into_iter().enumerate() { - let op_place = this.project_c_array_field(&buf_place, i.to_u64())?; - this.write_pointer(ptr, &op_place)?; + let op_place = ecx.project_c_array_field(&buf_place, i.to_u64())?; + ecx.write_pointer(ptr, &op_place)?; }, _ => throw_unsup_format!("unknown `miri_get_backtrace` flags {}", flags), }; @@ -82,20 +82,20 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { &self, ptr: &OpTy<'tcx>, ) -> InterpResult<'tcx, (Instance<'tcx>, Loc, String, String)> { - let this = self.eval_context_ref(); + let ecx = self.eval_context_ref(); - let ptr = this.read_pointer(ptr)?; + let ptr = ecx.read_pointer(ptr)?; // Take apart the pointer, we need its pieces. The offset encodes the span. - let (alloc_id, offset, _prov) = this.ptr_get_alloc_id(ptr, 0)?; + let (alloc_id, offset, _prov) = ecx.ptr_get_alloc_id(ptr, 0)?; // This has to be an actual global fn ptr, not a dlsym function. - let Some(GlobalAlloc::Function { instance, .. }) = this.tcx.try_get_global_alloc(alloc_id) + let Some(GlobalAlloc::Function { instance, .. }) = ecx.tcx.try_get_global_alloc(alloc_id) else { throw_ub_format!("expected static function pointer, found {:?}", ptr); }; let lo = - this.tcx.sess.source_map().lookup_char_pos(BytePos(offset.bytes().try_into().unwrap())); + ecx.tcx.sess.source_map().lookup_char_pos(BytePos(offset.bytes().try_into().unwrap())); let name = instance.to_string(); let filename = lo.file.name.prefer_remapped_unconditionally().to_string(); @@ -110,22 +110,22 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &[OpTy<'tcx>], dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); // FIXME: not nice to read the type from std but we don't have a good way to construct the // type here and now. ADTs need a DefId. - let [ptr, flags] = &this.check_shim_sig( + let [ptr, flags] = &ecx.check_shim_sig( shim_sig!(extern "Rust" fn(*_, u64) -> std::backtrace_rs::backtrace::miri::MiriFrame), (link_name, abi, args), )?; - let flags = this.read_scalar(flags)?.to_u64()?; + let flags = ecx.read_scalar(flags)?.to_u64()?; - let (fn_instance, lo, name, filename) = this.resolve_frame_pointer(ptr)?; + let (fn_instance, lo, name, filename) = ecx.resolve_frame_pointer(ptr)?; // Reconstruct the original function pointer, // which we pass to user code. - let fn_ptr = this.fn_ptr(FnVal::Instance(fn_instance)); + let fn_ptr = ecx.fn_ptr(FnVal::Instance(fn_instance)); // `u32` is not enough to fit line/colno, which can be `usize`. It seems unlikely that a // file would have more than 2^32 lines or columns, but whatever, just default to 0. @@ -146,27 +146,27 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { throw_unsup_format!("miri_resolve_frame: v0 is not supported any more"); } 1 => { - this.write_scalar( - Scalar::from_target_usize(name.len().to_u64(), this), - &this.project_field(dest, FieldIdx::from_u32(0))?, + ecx.write_scalar( + Scalar::from_target_usize(name.len().to_u64(), ecx), + &ecx.project_field(dest, FieldIdx::from_u32(0))?, )?; - this.write_scalar( - Scalar::from_target_usize(filename.len().to_u64(), this), - &this.project_field(dest, FieldIdx::from_u32(1))?, + ecx.write_scalar( + Scalar::from_target_usize(filename.len().to_u64(), ecx), + &ecx.project_field(dest, FieldIdx::from_u32(1))?, )?; } _ => throw_unsup_format!("unknown `miri_resolve_frame` flags {}", flags), } - this.write_scalar( + ecx.write_scalar( Scalar::from_u32(lineno), - &this.project_field(dest, FieldIdx::from_u32(2))?, + &ecx.project_field(dest, FieldIdx::from_u32(2))?, )?; - this.write_scalar( + ecx.write_scalar( Scalar::from_u32(colno), - &this.project_field(dest, FieldIdx::from_u32(3))?, + &ecx.project_field(dest, FieldIdx::from_u32(3))?, )?; - this.write_pointer(fn_ptr, &this.project_field(dest, FieldIdx::from_u32(4))?)?; + ecx.write_pointer(fn_ptr, &ecx.project_field(dest, FieldIdx::from_u32(4))?)?; interp_ok(()) } @@ -177,22 +177,22 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { link_name: Symbol, args: &[OpTy<'tcx>], ) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); - let [ptr, flags, name_ptr, filename_ptr] = &this.check_shim_sig( + let [ptr, flags, name_ptr, filename_ptr] = &ecx.check_shim_sig( shim_sig!(extern "Rust" fn(*(), u64, *(), *()) -> ()), (link_name, abi, args), )?; - let flags = this.read_scalar(flags)?.to_u64()?; + let flags = ecx.read_scalar(flags)?.to_u64()?; if flags != 0 { throw_unsup_format!("unknown `miri_resolve_frame_names` flags {}", flags); } - let (_, _, name, filename) = this.resolve_frame_pointer(ptr)?; + let (_, _, name, filename) = ecx.resolve_frame_pointer(ptr)?; - this.write_bytes_ptr(this.read_pointer(name_ptr)?, name.bytes())?; - this.write_bytes_ptr(this.read_pointer(filename_ptr)?, filename.bytes())?; + ecx.write_bytes_ptr(ecx.read_pointer(name_ptr)?, name.bytes())?; + ecx.write_bytes_ptr(ecx.read_pointer(filename_ptr)?, filename.bytes())?; interp_ok(()) } From ad13cdfa5f8d7bbc85b523bf14ad090430ed7a8c Mon Sep 17 00:00:00 2001 From: malezjaa Date: Sun, 8 Nov 2026 15:28:58 +0100 Subject: [PATCH 09/34] fix NumScalableVectors::from_field_count --- compiler/rustc_abi/src/lib.rs | 8 ++++---- compiler/rustc_codegen_llvm/src/intrinsic.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 8e9f24e0feb82..cff90e454c0ca 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -1778,12 +1778,12 @@ impl NumScalableVectors { NumScalableVectors(1) } - // Returns `NumScalableVectors` for values of two through eight, which are a valid number of - // fields for a tuple of scalable vectors to have. `1` is a valid value of `NumScalableVectors` - // but not for a tuple which would have a field count. + /// Returns `NumScalableVectors` for values of two through eight, which are a valid number of + /// fields for a tuple of scalable vectors to have. `1` is a valid value of `NumScalableVectors` + /// but not for a tuple which would have a field count. pub fn from_field_count(count: usize) -> Option { match count { - 2..8 => Some(NumScalableVectors(count as u8)), + 2..=8 => Some(NumScalableVectors(count as u8)), _ => None, } } diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 594f4cbcf759d..a0fc49da6195e 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -744,7 +744,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { assert_matches!( self.layout_of(fn_args.type_at(0)).backend_repr, BackendRepr::SimdScalableVector { - number_of_vectors: NumScalableVectors(2 | 3 | 4 | 5 | 6 | 7 | 8), + number_of_vectors: NumScalableVectors(2..=8), .. } ); @@ -765,7 +765,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { assert_matches!( self.layout_of(fn_args.type_at(0)).backend_repr, BackendRepr::SimdScalableVector { - number_of_vectors: NumScalableVectors(2 | 3 | 4 | 5 | 6 | 7 | 8), + number_of_vectors: NumScalableVectors(2..=8), .. } ); From a79fce1e15f730bd1f43e5a9e1fd548dc0ec588c Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 23 Sep 2026 16:11:02 +0200 Subject: [PATCH 10/34] add `core::arch::{x86, x86_64}::x87_f80` --- compiler/rustc_abi/src/callconv/reg.rs | 11 +- compiler/rustc_abi/src/layout/ty.rs | 17 + compiler/rustc_abi/src/lib.rs | 28 +- compiler/rustc_attr_ir/src/lang_items.rs | 2 + .../rustc_codegen_cranelift/src/common.rs | 1 + compiler/rustc_codegen_gcc/src/builder.rs | 6 +- compiler/rustc_codegen_gcc/src/int.rs | 4 +- compiler/rustc_codegen_gcc/src/type_.rs | 6 + compiler/rustc_codegen_llvm/src/abi.rs | 2 + compiler/rustc_codegen_llvm/src/intrinsic.rs | 4 + compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 1 + compiler/rustc_codegen_llvm/src/type_.rs | 4 + compiler/rustc_codegen_llvm/src/type_of.rs | 7 +- compiler/rustc_codegen_llvm/src/va_arg.rs | 5 +- .../rustc_codegen_ssa/src/mir/naked_asm.rs | 1 + .../rustc_codegen_ssa/src/traits/type_.rs | 2 + compiler/rustc_middle/src/ty/layout.rs | 11 + compiler/rustc_public/src/abi.rs | 2 + .../src/unstable/convert/stable/abi.rs | 1 + compiler/rustc_span/src/symbol.rs | 2 + compiler/rustc_target/src/callconv/mips.rs | 2 +- compiler/rustc_target/src/callconv/mips64.rs | 6 +- compiler/rustc_target/src/callconv/sparc64.rs | 1 + compiler/rustc_target/src/callconv/x86.rs | 11 +- compiler/rustc_target/src/callconv/x86_64.rs | 69 +++- compiler/rustc_ty_utils/src/layout.rs | 25 ++ library/core/src/num/imp/mod.rs | 1 + library/core/src/num/imp/x87_f80.rs | 36 ++ library/stdarch/crates/core_arch/src/lib.rs | 1 + .../stdarch/crates/core_arch/src/x86/mod.rs | 73 +++++ tests/assembly-llvm/x87_f80.rs | 171 ++++++++++ tests/auxiliary/minicore.rs | 26 ++ tests/codegen-llvm/x86-abi/x87_f80.rs | 308 ++++++++++++++++++ 33 files changed, 820 insertions(+), 27 deletions(-) create mode 100644 library/core/src/num/imp/x87_f80.rs create mode 100644 tests/assembly-llvm/x87_f80.rs create mode 100644 tests/codegen-llvm/x86-abi/x87_f80.rs diff --git a/compiler/rustc_abi/src/callconv/reg.rs b/compiler/rustc_abi/src/callconv/reg.rs index 5c6715c43caa7..ca614ac168c36 100644 --- a/compiler/rustc_abi/src/callconv/reg.rs +++ b/compiler/rustc_abi/src/callconv/reg.rs @@ -27,9 +27,9 @@ impl RegKind { match primitive { Primitive::Int(..) | Primitive::Pointer(_) => RegKind::Integer, Primitive::Float(Float::PpcF128) => RegKind::PpcF128, - Primitive::Float(Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::F128) => { - RegKind::Float - } + Primitive::Float( + Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::X87F80 | Float::F128, + ) => RegKind::Float, } } } @@ -60,6 +60,7 @@ impl Reg { reg_ctor!(f16, Float, 16); reg_ctor!(f32, Float, 32); reg_ctor!(f64, Float, 64); + reg_ctor!(x87_f80, Float, 80); reg_ctor!(f128, Float, 128); /// A vector of the given size with an unknown (and irrelevant) element type. @@ -86,6 +87,10 @@ impl Reg { 16 => dl.f16_align, 32 => dl.f32_align, 64 => dl.f64_align, + // This alignment is not a multiple of 80 bits, but the alignment + // here is only used to align the alloca of a cast, and there the + // full alignment of x87_f80 should be used. + 80 => dl.x87_f80_align, 128 => dl.f128_align, _ => panic!("unsupported float: {self:?}"), }, diff --git a/compiler/rustc_abi/src/layout/ty.rs b/compiler/rustc_abi/src/layout/ty.rs index 64bc32ad7584a..4a8dabbf724df 100644 --- a/compiler/rustc_abi/src/layout/ty.rs +++ b/compiler/rustc_abi/src/layout/ty.rs @@ -122,6 +122,7 @@ pub trait TyAbiInterface<'a, C>: Sized + std::fmt::Debug + std::fmt::Display { fn is_unit(this: TyAndLayout<'a, Self>) -> bool; fn is_transparent(this: TyAndLayout<'a, Self>) -> bool; fn is_complex_number_lang_item(this: TyAndLayout<'a, Self>, cx: &C) -> bool; + fn is_x87_f80_lang_item(this: TyAndLayout<'a, Self>, cx: &C) -> bool; fn is_scalable_vector(this: TyAndLayout<'a, Self>) -> bool; /// See [`TyAndLayout::pass_indirectly_in_non_rustic_abis`] for details. fn is_pass_indirectly_in_non_rustic_abis_flag_set(this: TyAndLayout<'a, Self>) -> bool; @@ -232,6 +233,17 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { Ty::is_scalable_vector(self) } + /// Returns `true` if this type is the `x87_f80` lang item. + /// + /// Note that this function returns `false` for the `x87_f80_raw` lang item. + pub fn is_x87_f80(self, cx: &C) -> bool + where + Ty: TyAbiInterface<'a, C> + Copy, + { + // A 1-ZST is never x87_f80. + Ty::is_x87_f80_lang_item(self.peel_transparent_wrappers_from_non_1zst(cx), cx) + } + /// If this method returns `true`, then this type should always have a `PassMode` of /// `Indirect { mode: IndirectMode::Pointer, .. }` when being used as the argument type of a /// function with a non-Rustic ABI (this is true for structs annotated with the @@ -339,6 +351,10 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { let component = complex.field(cx, 0).peel_transparent_wrappers_from_non_1zst(cx); + if component.is_x87_f80(cx) { + return Some(Numeric::Float(Float::X87F80)); + } + let BackendRepr::Scalar(scalar) = component.backend_repr else { return None; }; @@ -353,6 +369,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { Primitive::Float( float @ (Float::F16 | Float::F32 | Float::F64 | Float::F128 | Float::PpcF128), ) => Some(Numeric::Float(float)), + Primitive::Float(Float::X87F80) => None, // x87_f80_raw has incorrect alignment. Primitive::Pointer(..) | Primitive::Float(Float::F16B) => None, } } diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 8e9f24e0feb82..1a88afe3782f2 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -327,6 +327,7 @@ pub struct TargetDataLayout { pub f16_align: Align, pub f32_align: Align, pub f64_align: Align, + pub x87_f80_align: Align, pub f128_align: Align, pub aggregate_align: Align, @@ -367,6 +368,7 @@ impl Default for TargetDataLayout { f16_align: align(16), f32_align: align(32), f64_align: align(64), + x87_f80_align: align(128), f128_align: align(128), aggregate_align: align(8), vector_align: vec![ @@ -510,6 +512,7 @@ impl TargetDataLayout { ["f16", a @ ..] => dl.f16_align = parse_align_seq(a, "f16")?, ["f32", a @ ..] => dl.f32_align = parse_align_seq(a, "f32")?, ["f64", a @ ..] => dl.f64_align = parse_align_seq(a, "f64")?, + ["f80", a @ ..] => dl.x87_f80_align = parse_align_seq(a, "f80")?, ["f128", a @ ..] => dl.f128_align = parse_align_seq(a, "f128")?, [p, s, a @ ..] if p.starts_with("p") => { let mut p = p.strip_prefix('p').unwrap(); @@ -1387,10 +1390,22 @@ pub enum Float { F16B, F32, F64, + /// `x87_f80`. This is not a builtin type in Rust (it is exposed as a lang item), + /// but it is a builtin type in LLVM so needs to be explicitly represented + /// in the backend. + /// + /// Here we define the 80-bit scalar value that corresponds to the `x87_f80_raw` lang item. + /// In `core::arch::{x86, x86_64}` this type is wrapped by the `x87_f80` lang item that adds + /// the proper alignment and bumps the size to either 12 or 16 bytes depending on the target. + /// + /// Only used on x86 and x86_64 targets. + X87F80, F128, /// `ppcf128`. This is not a builtin type in Rust (it is exposed as a lang item), /// but it is a builtin type in LLVM so needs to be explicitly represented /// in the backend. + /// + /// Only used on powerpc and powerpc64 targets. PpcF128, } @@ -1403,6 +1418,7 @@ impl Float { F16B => Size::from_bits(16), F32 => Size::from_bits(32), F64 => Size::from_bits(64), + X87F80 => Size::from_bits(80), F128 => Size::from_bits(128), PpcF128 => Size::from_bits(128), } @@ -1416,6 +1432,9 @@ impl Float { F16 | F16B => dl.f16_align, F32 => dl.f32_align, F64 => dl.f64_align, + // Use an alignment of 1 for x87_f80_raw, + // so that its size really is 80 bits in memory. + X87F80 => Align::ONE, F128 => dl.f128_align, PpcF128 => dl.f128_align, } @@ -1429,6 +1448,7 @@ impl Float { F16B => "f16b", F32 => "f32", F64 => "f64", + X87F80 => "x87_f80", F128 => "f128", PpcF128 => "ppcf128", } @@ -1439,7 +1459,7 @@ impl Float { match self { F16 | F32 | F64 | F128 => true, - F16B | PpcF128 => false, + F16B | X87F80 | PpcF128 => false, } } } @@ -1465,9 +1485,9 @@ impl Numeric { match self { Numeric::Int(_, _) => RegKind::Integer, Numeric::Float(Float::PpcF128) => RegKind::PpcF128, - Numeric::Float(Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::F128) => { - RegKind::Float - } + Numeric::Float( + Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::X87F80 | Float::F128, + ) => RegKind::Float, } } } diff --git a/compiler/rustc_attr_ir/src/lang_items.rs b/compiler/rustc_attr_ir/src/lang_items.rs index b576c5038404d..a09b0266f04ea 100644 --- a/compiler/rustc_attr_ir/src/lang_items.rs +++ b/compiler/rustc_attr_ir/src/lang_items.rs @@ -240,6 +240,8 @@ language_item_table! { Complex, sym::complex, complex, Target::Struct, GenericRequirement::Exact(1); PpcF128, sym::ppcf128, ppcf128, Target::Struct, GenericRequirement::None; + X87F80, sym::x87_f80, x87_f80, Target::Struct, GenericRequirement::None; + X87F80Raw, sym::x87_f80_raw, x87_f80_raw, Target::Struct, GenericRequirement::None; Deref, kw::Deref, deref_trait, Target::Trait, GenericRequirement::Exact(0); DerefMut, sym::deref_mut, deref_mut_trait, Target::Trait, GenericRequirement::Exact(0); diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs index d59fb0f93ed4f..dcd367a4ba97a 100644 --- a/compiler/rustc_codegen_cranelift/src/common.rs +++ b/compiler/rustc_codegen_cranelift/src/common.rs @@ -38,6 +38,7 @@ pub(crate) fn scalar_to_clif_type(tcx: TyCtxt<'_>, scalar: Scalar) -> Type { Float::F16B => bug!("f16b is not supported by the Cranelift codegen backend"), Float::F32 => types::F32, Float::F64 => types::F64, + Float::X87F80 => bug!("cranelift does not support x87 floats"), Float::F128 => types::F128, Float::PpcF128 => bug!("cranelift does not support powerpc"), }, diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 1f7436ff87853..531ff0da6922b 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -872,7 +872,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { ); return self.context.new_call(self.location, fmodf128, &[a, b]); } - Some(float @ (abi::Float::F16B | abi::Float::PpcF128)) => { + Some(float @ (abi::Float::F16B | abi::Float::X87F80 | abi::Float::PpcF128)) => { bug!("frem unsupported on {float:?}") } None => (), @@ -2022,7 +2022,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { abi::Float::F32 => bx.cx().const_u32(bits as u32), abi::Float::F64 => bx.cx().const_u64(bits as u64), abi::Float::F128 => bx.cx().const_u128(bits), - abi::Float::F16B | abi::Float::PpcF128 => { + abi::Float::F16B | abi::Float::X87F80 | abi::Float::PpcF128 => { bug!("unsupported float width {float_type:?}") } }; @@ -2033,7 +2033,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { abi::Float::F32 => compute_clamp_bounds::(signed, int_width), abi::Float::F64 => compute_clamp_bounds::(signed, int_width), abi::Float::F128 => compute_clamp_bounds::(signed, int_width), - abi::Float::F16B | abi::Float::PpcF128 => { + abi::Float::F16B | abi::Float::X87F80 | abi::Float::PpcF128 => { bug!("unsupported float width {float_type:?}") } }; diff --git a/compiler/rustc_codegen_gcc/src/int.rs b/compiler/rustc_codegen_gcc/src/int.rs index 097c248c70baa..bef1af78c6a7a 100644 --- a/compiler/rustc_codegen_gcc/src/int.rs +++ b/compiler/rustc_codegen_gcc/src/int.rs @@ -986,7 +986,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { Some(Float::F32) => "tisf", Some(Float::F64) => "tidf", Some(Float::F128) => "titf", - None | Some(Float::F16B | Float::PpcF128) => { + None | Some(Float::F16B | Float::X87F80 | Float::PpcF128) => { panic!("cannot cast a non-native integer to type {dest_typ:?}") } }; @@ -1037,7 +1037,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { Some(Float::F16 | Float::F32) => "sfti", Some(Float::F64) => "dfti", Some(Float::F128) => "tfti", - None | Some(Float::F16B | Float::PpcF128) => { + None | Some(Float::F16B | Float::X87F80 | Float::PpcF128) => { bug!("cannot cast a {value_type:?} to non-native integer") } }; diff --git a/compiler/rustc_codegen_gcc/src/type_.rs b/compiler/rustc_codegen_gcc/src/type_.rs index 6d815b9111600..bdebc9f467f56 100644 --- a/compiler/rustc_codegen_gcc/src/type_.rs +++ b/compiler/rustc_codegen_gcc/src/type_.rs @@ -304,6 +304,12 @@ impl<'gcc, 'tcx> BaseTypeCodegenMethods for CodegenCx<'gcc, 'tcx> { bug!("unsupported ppcf128 type") } + fn type_x87_f80(&self) -> Type<'gcc> { + // FIXME(x87_f80): The GCC gcc_jit_types enum (which CType is based on) does not + // have __float80. It does have long double but it may not correspond to x87 f80. + bug!("unsupported x87_f80 type") + } + fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> { self.context.new_function_pointer_type(None, return_type, params, false) } diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 6270ce19a69b5..42ec3fbbce657 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -144,6 +144,7 @@ impl LlvmType for Reg { 16 => cx.type_f16(), 32 => cx.type_f32(), 64 => cx.type_f64(), + 80 => cx.type_x87_f80(), 128 => cx.type_f128(), _ => bug!("unsupported float: {:?}", self), }, @@ -167,6 +168,7 @@ impl LlvmType for Reg { Float::F64 => cx.type_f64(), Float::F128 => cx.type_f128(), Float::PpcF128 => bug!("ppcf128 is not a valid vector element type"), + Float::X87F80 => bug!("x87_f80 is not a valid vector element type"), }, Primitive::Pointer(_) => cx.type_ptr(), }; diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 23065419f9f1d..7d22ca1290164 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -301,6 +301,10 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { Primitive::Float(Float::PpcF128) => { // Supported on powerpc and powerpc64 targets. } + Primitive::Float(Float::X87F80) => { + // FIXME(x87_f80) we should support this. + bug!("the va_arg intrinsic does not currently support `x87_f80`") + } } emit_va_arg(self, args[0], result_layout) diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 08a63c5b48bd7..a40334af68102 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -951,6 +951,7 @@ unsafe extern "C" { // Operations on non-IEEE real types pub(crate) fn LLVMBFloatTypeInContext<'ll>(C: Context<'ll>) -> Type<'ll>; + pub(crate) fn LLVMX86FP80TypeInContext<'ll>(C: Context<'ll>) -> Type<'ll>; pub(crate) fn LLVMPPCFP128TypeInContext<'ll>(C: Context<'ll>) -> Type<'ll>; // Operations on function types diff --git a/compiler/rustc_codegen_llvm/src/type_.rs b/compiler/rustc_codegen_llvm/src/type_.rs index dc36ef2b1536a..55c546538611b 100644 --- a/compiler/rustc_codegen_llvm/src/type_.rs +++ b/compiler/rustc_codegen_llvm/src/type_.rs @@ -229,6 +229,10 @@ impl<'ll, CX: Borrow>> BaseTypeCodegenMethods for GenericCx<'ll, CX> { unsafe { llvm::LLVMPPCFP128TypeInContext(self.llcx()) } } + fn type_x87_f80(&self) -> Type<'ll> { + unsafe { llvm::LLVMX86FP80TypeInContext(self.llcx()) } + } + fn type_func(&self, args: &[Type<'ll>], ret: Type<'ll>) -> Type<'ll> { unsafe { llvm::LLVMFunctionType(ret, args.as_ptr(), args.len() as c_uint, FALSE) } } diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs index b003c322640dd..509415baf7619 100644 --- a/compiler/rustc_codegen_llvm/src/type_of.rs +++ b/compiler/rustc_codegen_llvm/src/type_of.rs @@ -1,7 +1,7 @@ use std::fmt::Write; use rustc_abi::Primitive::{Float, Int, Pointer}; -use rustc_abi::{Align, BackendRepr, FieldsShape, Scalar, Size, Variants}; +use rustc_abi::{Align, BackendRepr, FieldsShape, Scalar, Size, TyAbiInterface, Variants}; use rustc_codegen_ssa::traits::*; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; @@ -46,6 +46,11 @@ fn uncached_llvm_type<'ll, 'tcx>( BackendRepr::Memory { .. } | BackendRepr::ScalarPair { .. } => {} } + // Map `core::arch::{x86, x86_64}::x87_f80` to LLVM's `x86_fp80`. + if Ty::is_x87_f80_lang_item(layout, cx) { + return cx.type_x87_f80(); + } + let name = match layout.ty.kind() { // FIXME(eddyb) producing readable type names for trait objects can result // in problematically distinct types due to HRTB and subtyping (see #47638). diff --git a/compiler/rustc_codegen_llvm/src/va_arg.rs b/compiler/rustc_codegen_llvm/src/va_arg.rs index bef94359fa2e5..7c2c20c2671e4 100644 --- a/compiler/rustc_codegen_llvm/src/va_arg.rs +++ b/compiler/rustc_codegen_llvm/src/va_arg.rs @@ -95,7 +95,7 @@ fn get_param_type_alignment<'ll, 'tcx>( Integer::I128 => return Align::EIGHT, }, Primitive::Float(float) => match float { - Float::F16 | Float::F16B | Float::F32 => unreachable!(), + Float::F16 | Float::F16B | Float::F32 | Float::X87F80 => unreachable!(), Float::F64 | Float::F128 => { /* fall through */ } Float::PpcF128 => { return if is_powerpc_softfloat_abi(&bx.cx.tcx.sess.target) { @@ -494,6 +494,9 @@ fn emit_s390x_va_arg<'ll, 'tcx>( Primitive::Float(Float::PpcF128) => { bug!("`ppcf128` use in varadics unsupported on s390x") } + Primitive::Float(Float::X87F80) => { + bug!("`x87_f80` use in varadics unsupported on s390x") + } }, _ => false, diff --git a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs index 691d573739364..06d385998a9dd 100644 --- a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs +++ b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs @@ -514,6 +514,7 @@ fn wasm_primitive(primitive: Primitive, ptr_type: &'static str) -> &'static str Float::F16B => bug!("`f16b` unsupported on wasm"), Float::F16 | Float::F32 => "f32", Float::F64 => "f64", + Float::X87F80 => bug!("`x87_f80` unsupported on wasm"), Float::F128 => "i64, i64", Float::PpcF128 => bug!("`ppcf128` unsupported on wasm"), }, diff --git a/compiler/rustc_codegen_ssa/src/traits/type_.rs b/compiler/rustc_codegen_ssa/src/traits/type_.rs index 549a58cd74ec5..c4e52fcd2c0ba 100644 --- a/compiler/rustc_codegen_ssa/src/traits/type_.rs +++ b/compiler/rustc_codegen_ssa/src/traits/type_.rs @@ -22,6 +22,7 @@ pub trait BaseTypeCodegenMethods: BackendTypes { fn type_f64(&self) -> Self::Type; fn type_f128(&self) -> Self::Type; fn type_ppcf128(&self) -> Self::Type; + fn type_x87_f80(&self) -> Self::Type; fn type_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::FunctionSignature; fn type_ptr(&self) -> Self::Type; @@ -79,6 +80,7 @@ pub trait DerivedTypeCodegenMethods<'tcx>: F16B => self.type_f16b(), F32 => self.type_f32(), F64 => self.type_f64(), + X87F80 => self.type_x87_f80(), F128 => self.type_f128(), PpcF128 => self.type_ppcf128(), } diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index ce1c36c5468a8..80bfbb5b551e0 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -144,6 +144,11 @@ impl abi::Float { ), F32 => tcx.types.f32, F64 => tcx.types.f64, + X87F80 => Ty::new_adt( + tcx, + tcx.adt_def(tcx.require_lang_item(LangItem::X87F80Raw, DUMMY_SP)), + ty::GenericArgs::empty(), + ), F128 => tcx.types.f128, PpcF128 => Ty::new_adt( tcx, @@ -1255,6 +1260,12 @@ where cx.tcx().is_lang_item(def.did(), LangItem::Complex) } + /// Is this type `core::arch::{x86, x86_64}::x87_f80`? + fn is_x87_f80_lang_item(this: TyAndLayout<'tcx>, cx: &C) -> bool { + let Some(def) = this.ty.ty_adt_def() else { return false }; + cx.tcx().is_lang_item(def.did(), LangItem::X87F80) + } + fn is_scalable_vector(this: TyAndLayout<'tcx>) -> bool { this.ty.is_scalable_vector() } diff --git a/compiler/rustc_public/src/abi.rs b/compiler/rustc_public/src/abi.rs index 70d48c3782b7d..d98c12d0fe9f9 100644 --- a/compiler/rustc_public/src/abi.rs +++ b/compiler/rustc_public/src/abi.rs @@ -538,6 +538,7 @@ pub enum FloatLength { F16B, F32, F64, + X87F80, F128, PpcF128, } @@ -560,6 +561,7 @@ impl FloatLength { FloatLength::F16 | FloatLength::F16B => 16, FloatLength::F32 => 32, FloatLength::F64 => 64, + FloatLength::X87F80 => 80, FloatLength::F128 => 128, FloatLength::PpcF128 => 128, } diff --git a/compiler/rustc_public/src/unstable/convert/stable/abi.rs b/compiler/rustc_public/src/unstable/convert/stable/abi.rs index 48489f5bbde96..93c9cc4aa38b1 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/abi.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/abi.rs @@ -510,6 +510,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Float { rustc_abi::Float::F16B => FloatLength::F16B, rustc_abi::Float::F32 => FloatLength::F32, rustc_abi::Float::F64 => FloatLength::F64, + rustc_abi::Float::X87F80 => FloatLength::X87F80, rustc_abi::Float::F128 => FloatLength::F128, rustc_abi::Float::PpcF128 => FloatLength::PpcF128, } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 2170f610f0939..b9d5cb2af6c33 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -2441,6 +2441,8 @@ symbols! { x86, x86_64, x86_amx_intrinsics, + x87_f80, + x87_f80_raw, x87_reg, x87_target_feature, xcoff, diff --git a/compiler/rustc_target/src/callconv/mips.rs b/compiler/rustc_target/src/callconv/mips.rs index 720d17d5dbf99..28ea8bd23163c 100644 --- a/compiler/rustc_target/src/callconv/mips.rs +++ b/compiler/rustc_target/src/callconv/mips.rs @@ -17,7 +17,7 @@ where Numeric::Int(Integer::I128, _) => false, Numeric::Float(Float::F32 | Float::F64) => true, Numeric::Float(Float::F16 | Float::F128) => false, - Numeric::Float(Float::F16B | Float::PpcF128) => bug!("unsupported on mips"), + Numeric::Float(Float::F16B | Float::X87F80 | Float::PpcF128) => bug!("unsupported on mips"), }; if let Some(component) = ret.layout.complex_number(cx) diff --git a/compiler/rustc_target/src/callconv/mips64.rs b/compiler/rustc_target/src/callconv/mips64.rs index 8c141bc7de616..1ef6403532232 100644 --- a/compiler/rustc_target/src/callconv/mips64.rs +++ b/compiler/rustc_target/src/callconv/mips64.rs @@ -36,6 +36,7 @@ where Float::F64 => Some(Reg::f64()), Float::F128 => Some(Reg::f128()), Float::F16B => unreachable!("`f16b` unsupported on mips64"), + Float::X87F80 => unreachable!("`x87_f80` unsupported on mips64"), Float::PpcF128 => unreachable!("`ppcf128` unsupported on mips64"), } } @@ -142,8 +143,9 @@ where match component { Numeric::Float(Float::F16B) => unreachable!("Complex is not C-compatible"), - Numeric::Float(Float::F16) => unreachable!("not supported on mips64"), - Numeric::Float(Float::PpcF128) => unreachable!("not supported on mips64"), + Numeric::Float(Float::F16 | Float::X87F80 | Float::PpcF128) => { + unreachable!("not supported on mips64") + } Numeric::Float(Float::F32 | Float::F64) => { // Only pass a Complex/Complex in FPRs when two argument slots are free. if curr_offset.bytes() / slot.bytes() + 2 <= NUM_ARG_SLOTS { diff --git a/compiler/rustc_target/src/callconv/sparc64.rs b/compiler/rustc_target/src/callconv/sparc64.rs index 00b9ef25e9fbc..0ef57cf54e449 100644 --- a/compiler/rustc_target/src/callconv/sparc64.rs +++ b/compiler/rustc_target/src/callconv/sparc64.rs @@ -59,6 +59,7 @@ fn classify<'a, Ty, C>( // Match LLVM by passing `f16` in integer registers. } Float::F16B => unreachable!("`f16b` unsupported on sparc64"), + Float::X87F80 => unreachable!("`x87_f80` unsupported on sparc64"), Float::PpcF128 => unreachable!("`ppcf128` unsupported on sparc64"), } } else { diff --git a/compiler/rustc_target/src/callconv/x86.rs b/compiler/rustc_target/src/callconv/x86.rs index d19f3f0db715b..e458458fbf256 100644 --- a/compiler/rustc_target/src/callconv/x86.rs +++ b/compiler/rustc_target/src/callconv/x86.rs @@ -55,6 +55,10 @@ where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, { + if ret.layout.is_x87_f80(cx) { + ret.cast_to(Reg::x87_f80()); + return; + } if ret.layout.is_aggregate() && ret.layout.is_sized() { // Returning a structure. Most often, this will use // a hidden first argument. On some platforms, though, @@ -107,7 +111,11 @@ where let align_4 = Align::from_bytes(4).unwrap(); let align_16 = Align::from_bytes(16).unwrap(); - if arg.layout.is_aggregate() { + if arg.layout.is_x87_f80(cx) { + // This branch and cast are not technically required, but it makes the IR more readable. + arg.cast_to(Reg::x87_f80()); + return; + } else if arg.layout.is_aggregate() { // We need to compute the alignment of the `byval` argument. The rules can be found in // `X86_32ABIInfo::getTypeStackAlignInBytes` in Clang's `TargetInfo.cpp`. Summarized // here, they are: @@ -232,6 +240,7 @@ pub(crate) fn fill_inregs<'a, Ty, C>( PassMode::Ignore | PassMode::Indirect { attrs: _, address_space: _, mode: _ } => { continue; } + PassMode::Cast { .. } if arg.layout.is_x87_f80(cx) => continue, PassMode::Direct(ref mut attrs) => attrs, PassMode::Pair(..) | PassMode::IndirectUnsized { attrs: _, meta_attrs: _ } diff --git a/compiler/rustc_target/src/callconv/x86_64.rs b/compiler/rustc_target/src/callconv/x86_64.rs index e495afc803b2d..5439d24a573fb 100644 --- a/compiler/rustc_target/src/callconv/x86_64.rs +++ b/compiler/rustc_target/src/callconv/x86_64.rs @@ -2,7 +2,7 @@ // https://github.com/jckarter/clay/blob/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/compiler/externals.cpp use rustc_abi::{ - BackendRepr, HasDataLayout, Primitive, Reg, RegKind, Size, TyAbiInterface, TyAndLayout, + BackendRepr, Float, HasDataLayout, Primitive, Reg, RegKind, Size, TyAbiInterface, TyAndLayout, Variants, }; @@ -10,13 +10,34 @@ use crate::callconv::{ArgAbi, CastTarget, FnAbi}; use crate::spec::HasTargetSpec; /// Classification of "eightbyte" components. -// N.B., the order of the variants is from general to specific, -// such that `unify(a, b)` is the "smaller" of `a` and `b`. +/// +/// N.B., the order of the variants is from general to specific, +/// such that `merge(a, b)` is the "smaller" of `a` and `b`, unless it is an error. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] enum Class { Int, Sse, SseUp, + X87, + X87Up, +} + +impl Class { + fn upper_half(self) -> Class { + match self { + Class::Sse | Class::SseUp => Class::SseUp, + Class::X87 | Class::X87Up => Class::X87Up, + Class::Int => Class::Int, + } + } + + fn merge(self, other: Self) -> Result { + match (self, other) { + (Class::X87 | Class::X87Up, Class::Sse | Class::SseUp) => Err(Memory), + (Class::Sse | Class::SseUp, Class::X87 | Class::X87Up) => Err(Memory), + _ => Ok(Ord::min(self, other)), + } + } } #[derive(Clone, Copy, Debug)] @@ -54,6 +75,7 @@ where let mut c = match layout.backend_repr { BackendRepr::Scalar(scalar) => match scalar.primitive() { Primitive::Int(..) | Primitive::Pointer(_) => Class::Int, + Primitive::Float(Float::X87F80) => Class::X87, Primitive::Float(_) => Class::Sse, }, @@ -85,13 +107,13 @@ where let first = (off.bytes() / 8) as usize; let last = ((off.bytes() + layout.size.bytes() - 1) / 8) as usize; for cls in &mut cls[first..=last] { - *cls = Some(cls.map_or(c, |old| old.min(c))); + *cls = match cls { + Some(old) => Some(Class::merge(*old, c)?), + None => Some(c), + }; - // Everything after the first Sse "eightbyte" - // component is the upper half of a register. - if c == Class::Sse { - c = Class::SseUp; - } + // Everything after the first "eightbyte" component is the upper half of a register. + c = c.upper_half(); } Ok(()) @@ -127,6 +149,17 @@ where } } + // If X87UP is not preceded by X87, the whole argument is passed in memory. + if let [Some(Class::X87Up), ..] = cls { + return Err(Memory); + } + + for [prev, curr] in cls[..n].array_windows() { + if *curr == Some(Class::X87Up) && *prev != Some(Class::X87) { + return Err(Memory); + } + } + Ok(cls) } @@ -153,6 +186,13 @@ fn reg_component(cls: &[Option], i: &mut usize, size: Size) -> Option { + let consumed = + 1 + cls[*i + 1..].iter().take_while(|&&c| c == Some(Class::X87Up)).count(); + assert_eq!(consumed, 2); + *i += consumed; + Some(Reg::x87_f80()) + } c => unreachable!("reg_component: unhandled class {:?}", c), } } @@ -193,10 +233,21 @@ where arg.make_indirect(); return; } + if is_arg && arg.layout.is_x87_f80(cx) { + // This branch and cast are not technically required, but it makes the IR more readable. + arg.cast_to(Reg::x87_f80()); + return; + } let mut cls_or_mem = classify_arg(cx, arg); if is_arg { if let Ok(cls) = cls_or_mem { + // An argument of class X87 is passed in memory. + if cls.contains(&Some(Class::X87)) { + std::assert_matches!(cls, [Some(Class::X87), Some(Class::X87Up), ..]); + cls_or_mem = Err(Memory); + } + let mut needed_int = 0; let mut needed_sse = 0; for c in cls { diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index 926314b2c5cf7..6404a062f2731 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -25,6 +25,7 @@ use rustc_middle::ty::{ use rustc_session::{DataTypeKind, FieldInfo, FieldKind, SizeKind, VariantInfo}; use rustc_span::{Symbol, bug, sym}; use rustc_structures::Limit; +use rustc_target::spec::{Arch, HasTargetSpec}; use tracing::{debug, instrument}; use crate::diagnostics::NonPrimitiveSimdType; @@ -823,13 +824,37 @@ fn layout_of_uncached<'tcx>( layout.backend_repr = BackendRepr::Scalar(bfloat); } + let arch = &tcx.target_spec().arch; + if tcx.is_lang_item(def.did(), LangItem::PpcF128) { + std::assert_matches!(arch, Arch::PowerPC | Arch::PowerPC64); + let ppcf128 = scalar_unit(Primitive::Float(abi::Float::PpcF128)); assert_eq!(layout.size, abi::Float::PpcF128.size()); layout.align = abi::Float::PpcF128.align(cx); layout.backend_repr = BackendRepr::Scalar(ppcf128); } + if tcx.is_lang_item(def.did(), LangItem::X87F80Raw) { + std::assert_matches!(arch, Arch::X86 | Arch::X86_64); + + // The lang item has no fields: give it a scalar layout. + return Ok(scalar(Primitive::Float(abi::Float::X87F80))); + } + + if tcx.is_lang_item(def.did(), LangItem::X87F80) { + std::assert_matches!(arch, Arch::X86 | Arch::X86_64); + + // A wrapper around `x87_f80_raw` that adds the target-specific alignment. + // It is an ordinary aggregate with trailing padding. + assert_eq!(layout.size, abi::Float::X87F80.size()); + layout.align = cx.data_layout().x87_f80_align; + layout.unadjusted_abi_align = layout.align; + layout.size = layout.size.align_to(layout.align); + layout.backend_repr = BackendRepr::Memory { sized: true }; + layout.largest_niche = None; + } + tcx.mk_layout(layout) } diff --git a/library/core/src/num/imp/mod.rs b/library/core/src/num/imp/mod.rs index e04f3cd93ba5f..843a800267ffb 100644 --- a/library/core/src/num/imp/mod.rs +++ b/library/core/src/num/imp/mod.rs @@ -13,6 +13,7 @@ pub mod fmt; // Public for core_arch. pub mod ppcf128; +pub mod x87_f80; pub(crate) mod int_bits; pub(crate) mod int_log10; diff --git a/library/core/src/num/imp/x87_f80.rs b/library/core/src/num/imp/x87_f80.rs new file mode 100644 index 0000000000000..4b9f07d1ba599 --- /dev/null +++ b/library/core/src/num/imp/x87_f80.rs @@ -0,0 +1,36 @@ +/// The raw x87 80-bit extended-precision floating-point type. +/// +/// This type has a size of 80 bits, and corresponds to the store size (what a load/store touches) +/// of x87_f80. This is different to what LLVM calls the alloc size, the number of bytes used to +/// calculate field offsets or the size of an alloca. +/// +/// The `x87_f80` wrapper type below corresponds to the alloc size: it applies the target-specific +/// alignment, raising the total size to 12 or 16. +/// +/// NOTE: this type should not be used anywhere except in the x87_f80 wrapper below. The backend +/// can handle it fine, but callconv calculation will likely panic. +#[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), lang = "x87_f80_raw")] +#[allow(non_camel_case_types)] +#[derive(Clone, Copy)] +struct x87_f80_raw {} + +/// The x87 80-bit extended-precision floating-point lang item. +/// +/// Here we define just the lang item, the public-facing type is defined +/// in core_arch. It transparently wraps this definition. +/// +/// This x87_f80 type should only be used on x86 and x86_64 targets, but is always defined +/// for the purpose of doc builds, specifically doc builds in the stdarch repo. +#[doc(hidden)] +#[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), lang = "x87_f80")] +#[unstable(feature = "num_internals", issue = "none")] +#[allow(non_camel_case_types, dead_code)] +#[derive(Clone, Copy)] +pub struct x87_f80(x87_f80_raw); + +#[unstable(feature = "num_internals", issue = "none")] +impl crate::fmt::Debug for x87_f80 { + fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + f.debug_tuple("x87_f80").finish() + } +} diff --git a/library/stdarch/crates/core_arch/src/lib.rs b/library/stdarch/crates/core_arch/src/lib.rs index c7e2d93b886a7..c2357eaab5aa0 100644 --- a/library/stdarch/crates/core_arch/src/lib.rs +++ b/library/stdarch/crates/core_arch/src/lib.rs @@ -46,6 +46,7 @@ any(target_arch = "powerpc", target_arch = "powerpc64"), feature(powerpc_ppcf128) )] +#![cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), feature(x87_f80))] #![cfg_attr( test, feature( diff --git a/library/stdarch/crates/core_arch/src/x86/mod.rs b/library/stdarch/crates/core_arch/src/x86/mod.rs index e6875a628fbf0..ca5551ca6c1e4 100644 --- a/library/stdarch/crates/core_arch/src/x86/mod.rs +++ b/library/stdarch/crates/core_arch/src/x86/mod.rs @@ -5,6 +5,79 @@ use crate::mem::transmute; #[macro_use] mod macros; +/// The x87 80-bit extended-precision floating-point type. +/// +/// FIXME: extend the documentation. +#[doc(alias = "long double")] +#[doc(alias = "x86_fp80")] +#[doc(alias = "__float80")] +#[unstable(feature = "x87_f80", issue = "163982")] +#[allow(non_camel_case_types)] +#[doc(cfg(any(target_arch = "x86", target_arch = "x86_64")))] +#[derive(Clone, Copy)] +#[repr(transparent)] +pub struct x87_f80(crate::num::imp::x87_f80::x87_f80); + +const _: () = assert!( + size_of::() + == cfg_select! { + target_arch = "x86" => cfg_select! { + target_vendor = "apple" => 16, + target_env = "msvc" => 16, + _ => 12, + }, + target_arch = "x86_64" => 16, + _ => size_of::(), // for doc builds + } +); + +const _: () = assert!( + align_of::() + == cfg_select! { + target_arch = "x86" => cfg_select! { + target_vendor = "apple" => 16, + target_env = "msvc" => 16, + _ => 4, + }, + target_arch = "x86_64" => 16, + _ => align_of::(), // for doc builds + } +); + +#[unstable(feature = "x87_f80", issue = "163982")] +impl crate::fmt::Debug for x87_f80 { + #[inline] + fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + let mut bytes = [0u8; 16]; + bytes[..10].copy_from_slice(&self.to_ne_bytes()); + write!(f, "x87_f80({:#022x})", u128::from_ne_bytes(bytes)) + } +} + +impl x87_f80 { + /// Returns the memory representation of this floating point number as a byte array in + /// native byte order. + #[unstable(feature = "x87_f80", issue = "163982")] + #[inline] + pub const fn to_ne_bytes(self) -> [u8; 10] { + // SAFETY: the first 10 bytes are initialized. + unsafe { (&raw const self).cast::<[u8; 10]>().read() } + } + + /// Creates a floating point value from its representation as a byte array in native endian. + #[unstable(feature = "x87_f80", issue = "163982")] + #[inline] + pub const fn from_ne_bytes(bytes: [u8; 10]) -> Self { + // SAFETY: we initialize the first 10 bytes, the remaining bytes remain uninitialized. + // That is exactly the layout of x87_f80. + unsafe { + let mut this = crate::mem::MaybeUninit::::uninit(); + this.as_mut_ptr().cast::<[u8; 10]>().write(bytes); + this.assume_init() + } + } +} + types! { #![stable(feature = "simd_x86", since = "1.27.0")] diff --git a/tests/assembly-llvm/x87_f80.rs b/tests/assembly-llvm/x87_f80.rs new file mode 100644 index 0000000000000..356ec2f410201 --- /dev/null +++ b/tests/assembly-llvm/x87_f80.rs @@ -0,0 +1,171 @@ +//@ add-minicore +//@ assembly-output: emit-asm +// +//@ revisions: X86 X86_64 DARWIN WIN64 WIN32 +//@ [X86] compile-flags: --target i686-unknown-linux-gnu +//@ [X86_64] compile-flags: --target x86_64-unknown-linux-gnu +//@ [DARWIN] compile-flags: --target i686-apple-darwin +//@ [WIN64] compile-flags: --target x86_64-pc-windows-gnu +//@ [WIN32] compile-flags: --target i686-pc-windows-gnu +//@ compile-flags: -Copt-level=3 --crate-type=lib +//@ needs-llvm-components: x86 + +#![feature(no_core)] +#![no_std] +#![no_core] + +extern crate minicore; +#[cfg(target_arch = "x86")] +use minicore::arch::x86::x87_f80; +#[cfg(target_arch = "x86_64")] +use minicore::arch::x86_64::x87_f80; + +// CHECK-LABEL: identity +// +// X86: .cfi_startproc +// X86-NEXT: fldt 4(%esp) +// X86-NEXT: retl +// +// X86_64: .cfi_startproc +// X86_64-NEXT: fldt 8(%rsp) +// X86_64-NEXT: retq +// +// DARWIN: .cfi_startproc +// DARWIN-NEXT: pushl %ebp +// DARWIN: movl %esp, %ebp +// DARWIN: fldt 8(%ebp) +// DARWIN-NEXT: popl %ebp +// DARWIN-NEXT: retl +// +// WIN64: movq %rcx, %rax +// WIN64-NEXT: movaps (%rdx), %xmm0 +// WIN64-NEXT: movaps %xmm0, (%rcx) +// WIN64-NEXT: retq +// +// WIN32: .cfi_startproc +// WIN32-NEXT: pushl %ebp +// WIN32: movl %esp, %ebp +// WIN32: fldt 8(%ebp) +// WIN32-NEXT: popl %ebp +// WIN32-NEXT: retl +#[unsafe(no_mangle)] +pub extern "C" fn identity(x: x87_f80) -> x87_f80 { + x +} + +// CHECK-LABEL: mixed +// +// X86: .cfi_startproc +// X86-NEXT: fldl 4(%esp) +// X86-NEXT: retl +// +// X86_64: .cfi_startproc +// X86_64-NEXT: movsd 8(%rsp), %xmm0 +// X86_64-NEXT: retq +// +// DARWIN: .cfi_startproc +// DARWIN-NEXT: pushl %ebp +// DARWIN: movl %esp, %ebp +// DARWIN: fldl 8(%ebp) +// DARWIN-NEXT: popl %ebp +// DARWIN-NEXT: retl +// +// WIN64: movsd (%rcx), %xmm0 +// WIN64-NEXT: retq +// +// WIN32: .cfi_startproc +// WIN32-NEXT: pushl %ebp +// WIN32: movl %esp, %ebp +// WIN32: fldl 8(%ebp) +// WIN32-NEXT: popl %ebp +// WIN32-NEXT: retl +#[unsafe(no_mangle)] +pub extern "C" fn mixed(value: Mixed) -> f64 { + value.a +} + +#[repr(C)] +struct Mixed { + a: f64, + b: x87_f80, +} + +// CHECK-LABEL: pair +// +// X86: .cfi_startproc +// X86-NEXT: fldt 16(%esp) +// X86-NEXT: retl +// +// X86_64: .cfi_startproc +// X86_64-NEXT: fldt 24(%rsp) +// X86_64-NEXT: retq +// +// DARWIN: .cfi_startproc +// DARWIN-NEXT: pushl %ebp +// DARWIN: movl %esp, %ebp +// DARWIN: fldt 24(%ebp) +// DARWIN-NEXT: popl %ebp +// DARWIN-NEXT: retl +// +// WIN64: movq %rcx, %rax +// WIN64-NEXT: movaps 16(%rdx), %xmm0 +// WIN64-NEXT: movaps %xmm0, (%rcx) +// WIN64-NEXT: retq +// +// WIN32: .cfi_startproc +// WIN32-NEXT: pushl %ebp +// WIN32: movl %esp, %ebp +// WIN32: fldt 20(%ebp) +// WIN32-NEXT: popl %ebp +// WIN32-NEXT: retl +#[unsafe(no_mangle)] +pub extern "C" fn pair(value: Pair) -> x87_f80 { + value.b +} + +#[repr(C)] +struct Pair { + a: x87_f80, + b: x87_f80, +} + +// CHECK-LABEL: quad +// +// X86: .cfi_startproc +// X86-NEXT: fldt 40(%esp) +// X86-NEXT: retl +// +// X86_64: .cfi_startproc +// X86_64-NEXT: fldt 56(%rsp) +// X86_64-NEXT: retq +// +// DARWIN: .cfi_startproc +// DARWIN-NEXT: pushl %ebp +// DARWIN: movl %esp, %ebp +// DARWIN: fldt 56(%ebp) +// DARWIN-NEXT: popl %ebp +// DARWIN-NEXT: retl +// +// WIN64: movq %rcx, %rax +// WIN64-NEXT: movaps 48(%rdx), %xmm0 +// WIN64-NEXT: movaps %xmm0, (%rcx) +// WIN64-NEXT: retq +// +// WIN32: .cfi_startproc +// WIN32-NEXT: pushl %ebp +// WIN32: movl %esp, %ebp +// WIN32: fldt 44(%ebp) +// WIN32-NEXT: popl %ebp +// WIN32-NEXT: retl +#[unsafe(no_mangle)] +pub extern "C" fn quad(value: Quad) -> x87_f80 { + value.d +} + +#[repr(C)] +struct Quad { + a: x87_f80, + b: x87_f80, + c: x87_f80, + d: x87_f80, +} diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index e7e924f9ebc08..3d7a325a5e61c 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -131,6 +131,32 @@ pub mod arch { impl crate::Copy for ppcf128 {} } + + #[cfg(target_arch = "x86")] + pub mod x86 { + // Public in minicore for testing purposes. + #[lang = "x87_f80_raw"] + pub struct x87_f80_raw {} + + #[lang = "x87_f80"] + pub struct x87_f80(x87_f80_raw); + + impl crate::Copy for x87_f80_raw {} + impl crate::Copy for x87_f80 {} + } + + #[cfg(target_arch = "x86_64")] + pub mod x86_64 { + // Public in minicore for testing purposes. + #[lang = "x87_f80_raw"] + pub struct x87_f80_raw {} + + #[lang = "x87_f80"] + pub struct x87_f80(x87_f80_raw); + + impl crate::Copy for x87_f80_raw {} + impl crate::Copy for x87_f80 {} + } } #[lang = "phantom_data"] diff --git a/tests/codegen-llvm/x86-abi/x87_f80.rs b/tests/codegen-llvm/x86-abi/x87_f80.rs new file mode 100644 index 0000000000000..ace21aa6e7ad3 --- /dev/null +++ b/tests/codegen-llvm/x86-abi/x87_f80.rs @@ -0,0 +1,308 @@ +//@ add-minicore +// +//@ revisions: X86 X86_64 DARWIN WIN64 WIN32 +//@ [X86] compile-flags: --target i686-unknown-linux-gnu +//@ [X86_64] compile-flags: --target x86_64-unknown-linux-gnu +//@ [DARWIN] compile-flags: --target i686-apple-darwin +//@ [WIN32] compile-flags: --target i686-pc-windows-gnu +//@ [WIN64] compile-flags: --target x86_64-pc-windows-gnu +//@ compile-flags: -Copt-level=3 --crate-type=lib -Zmerge-functions=disabled +//@ needs-llvm-components: x86 + +#![feature(no_core)] +#![no_std] +#![no_core] +#![allow(non_camel_case_types)] + +extern crate minicore; +#[cfg(target_arch = "x86")] +use minicore::arch::x86::{x87_f80, x87_f80_raw}; +#[cfg(target_arch = "x86_64")] +use minicore::arch::x86_64::{x87_f80, x87_f80_raw}; +use minicore::simd::f64x2; +use minicore::{Copy, MaybeUninit, mem}; + +// CHECK-LABEL: size_of_raw_array +#[unsafe(no_mangle)] +pub fn size_of_raw_array() -> usize { + // CHECK: ret {{i32|i64}} 20 + const { mem::size_of::<[x87_f80_raw; 2]>() } +} + +// CHECK-LABEL: raw_array_stride +// CHECK-SAME: dereferenceable(20) +#[unsafe(no_mangle)] +pub fn raw_array_stride(arr: &[x87_f80_raw; 2]) -> x87_f80_raw { + // CHECK: getelementptr inbounds nuw i8, ptr %arr, {{i32|i64}} 10 + let [_, b] = *arr; + b +} + +#[repr(C)] +struct Single { + a: x87_f80, +} + +#[repr(C)] +struct Pair { + a: x87_f80, + b: x87_f80, +} + +#[repr(C)] +struct Mixed { + a: f64, + b: x87_f80, +} + +// X86-LABEL: x86_fp80 @scalar_second(x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// X86_64-LABEL: x86_fp80 @scalar_second(x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// DARWIN-LABEL: x86_fp80 @scalar_second(x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// WIN64-LABEL: void @scalar_second(ptr {{.*}}sret([16 x i8]) {{.*}}, ptr {{.*}}, ptr {{.*}}) +// WIN32-LABEL: x86_fp80 @scalar_second(x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +#[unsafe(no_mangle)] +extern "C" fn scalar_second(_a: x87_f80, b: x87_f80) -> x87_f80 { + b +} + +// X86-LABEL: void @single(ptr {{.*}}sret([12 x i8]) align 4 {{.*}}, ptr {{.*}}byval([12 x i8]) align 4 {{.*}}) +// X86_64-LABEL: x86_fp80 @single(ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @single(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @single(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @single(ptr {{.*}}sret([12 x i8]) align 4 {{.*}}, ptr {{.*}}byval([12 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn single(x: Single) -> Single { + x +} + +// X86-LABEL: void @pair(ptr {{.*}}sret([24 x i8]) align 4 {{.*}}, ptr {{.*}}byval([24 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @pair(ptr {{.*}}sret([32 x i8]) align 16 {{.*}}, ptr {{.*}}byval([32 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @pair(ptr {{.*}}sret([32 x i8]) align 16 {{.*}}, ptr {{.*}}byval([32 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @pair(ptr {{.*}}sret([32 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @pair(ptr {{.*}}sret([24 x i8]) align 4 {{.*}}, ptr {{.*}}byval([24 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn pair(x: Pair) -> Pair { + x +} + +// Projecting an x87_f80 out of an aggregate used to ICE, because code asserted that +// a field has the same size as the scalar it contains. +// +// CHECK: @pair_first( +#[unsafe(no_mangle)] +fn pair_first(x: Pair) -> x87_f80 { + x.a +} + +// CHECK: @pair_second( +#[unsafe(no_mangle)] +fn pair_second(x: Pair) -> x87_f80 { + x.b +} + +// X86-LABEL: x86_fp80 @mixed(ptr {{.*}}byval([20 x i8]) align 4 {{.*}}) +// X86_64-LABEL: x86_fp80 @mixed(ptr {{.*}}byval([32 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: x86_fp80 @mixed(ptr {{.*}}byval([32 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @mixed(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: x86_fp80 @mixed(ptr {{.*}}byval([24 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn mixed(x: Mixed) -> x87_f80 { + x.b +} + +// X86-LABEL: x86_fp80 @many(x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// X86_64-LABEL: x86_fp80 @many(x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// DARWIN-LABEL: x86_fp80 @many(x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// WIN64-LABEL: void @many(ptr {{.*}}sret([16 x i8]) {{.*}} +// WIN32-LABEL: x86_fp80 @many(x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +#[unsafe(no_mangle)] +extern "C" fn many( + _a: x87_f80, + _b: x87_f80, + _c: x87_f80, + _d: x87_f80, + _e: x87_f80, + _f: x87_f80, + _g: x87_f80, + _h: x87_f80, + i: x87_f80, +) -> x87_f80 { + i +} + +/// Unions test the overlapping of X87 with SSE/INTEGER register classes. +/// +/// The ABI logic processes the fields in lexicographical order, so check +/// both the x87_f80 coming first and coming last. +#[repr(C)] +union X87Before { + a: x87_f80, + b: T, +} + +#[repr(C)] +union X87After { + b: T, + a: x87_f80, +} + +// X86-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([12 x i8]) align 4 {{.*}}, ptr {{.*}}byval([12 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn union_x87_with_f64(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([12 x i8]) align 4 {{.*}}, ptr {{.*}}byval([12 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn union_x87_with_u64(x: X87Before) -> X87Before { + x +} + +#[repr(C)] +struct F64F64(f64, f64); +impl Copy for F64F64 {} + +// X86-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_before_f64_f64(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_after_f64_f64(x: X87After) -> X87After { + x +} + +#[repr(C)] +struct U64F64(u64, f64); +impl Copy for U64F64 {} + +// X86-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_before_u64_f64(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_after_u64_f64(x: X87After) -> X87After { + x +} + +#[repr(C)] +struct U64U64(u64, u64); +impl Copy for U64U64 {} + +// X86-LABEL: void @x87_before_u64_u64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: { i64, i64 } @x87_before_u64_u64({ i64, i64 } {{.*}}) +// DARWIN-LABEL: void @x87_before_u64_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_before_u64_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_before_u64_u64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_before_u64_u64(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// WIN64-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_before_f64x2(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// WIN64-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_after_f64x2(x: X87After) -> X87After { + x +} + +// X86-LABEL: x86_fp80 @array_third( +// X86: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i32 24 +// X86-NEXT: load x86_fp80, ptr {{.*}}, align 4 +// +// X86_64-LABEL: x86_fp80 @array_third( +// X86_64: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i64 32 +// X86_64-NEXT: load x86_fp80, ptr {{.*}}, align 16 +// +// DARWIN-LABEL: x86_fp80 @array_third( +// DARWIN: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i32 32 +// DARWIN-NEXT: load x86_fp80, ptr {{.*}}, align 16 +// +// WIN64-LABEL: void @array_third(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}align 16 {{.*}}%xs) +// WIN64: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i64 32 +// WIN64-NEXT: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i64 16, i1 false) +// +// WIN32-LABEL: x86_fp80 @array_third( +// WIN32: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i32 24 +// WIN32-NEXT: load x86_fp80, ptr {{.*}}, align 4 +#[unsafe(no_mangle)] +extern "C" fn array_third(xs: &[x87_f80; 4]) -> x87_f80 { + let [_, _, c, _] = *xs; + c +} + +// CHECK-LABEL: @array_copy( +// X86: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i32 48, i1 false) +// X86_64: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i64 64, i1 false) +// DARWIN: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i32 64, i1 false) +// WIN64: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i64 64, i1 false) +// WIN32: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i32 48, i1 false) +#[unsafe(no_mangle)] +fn array_copy(xs: &[x87_f80; 4], ys: &mut [x87_f80; 4]) { + *ys = *xs; +} + +#[repr(transparent)] +struct TransparentWrapper(T); + +// X86-LABEL: x86_fp80 @transparent_struct(x86_fp80 returned %{{[0-9]+}}) +// X86_64-LABEL: x86_fp80 @transparent_struct(x86_fp80 returned %{{[0-9]+}}) +// DARWIN-LABEL: x86_fp80 @transparent_struct(x86_fp80 returned %{{[0-9]+}}) +// WIN64-LABEL: void @transparent_struct(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}align 16 {{.*}}) +// WIN32-LABEL: x86_fp80 @transparent_struct(x86_fp80 returned %{{[0-9]+}}) +#[unsafe(no_mangle)] +extern "C" fn transparent_struct(x: TransparentWrapper) -> TransparentWrapper { + x +} + +// X86-LABEL: x86_fp80 @transparent_union(x86_fp80 returned %{{[0-9]+}}) +// X86_64-LABEL: x86_fp80 @transparent_union(x86_fp80 returned %{{[0-9]+}}) +// DARWIN-LABEL: x86_fp80 @transparent_union(x86_fp80 returned %{{[0-9]+}}) +// WIN64-LABEL: void @transparent_union(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}align 16 {{.*}}) +// WIN32-LABEL: x86_fp80 @transparent_union(x86_fp80 returned %{{[0-9]+}}) +#[unsafe(no_mangle)] +extern "C" fn transparent_union(x: MaybeUninit) -> MaybeUninit { + x +} From 9da70e9cef701affbfcf09e250aad2020c2b62c2 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Mon, 2 Nov 2026 01:00:35 +0100 Subject: [PATCH 11/34] rename `Reg::align` and `Uniform::align` to `scratch_align` --- compiler/rustc_abi/src/callconv/reg.rs | 3 ++- compiler/rustc_target/src/callconv/mod.rs | 15 +++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_abi/src/callconv/reg.rs b/compiler/rustc_abi/src/callconv/reg.rs index ca614ac168c36..dda7a45f9c2b7 100644 --- a/compiler/rustc_abi/src/callconv/reg.rs +++ b/compiler/rustc_abi/src/callconv/reg.rs @@ -71,7 +71,8 @@ impl Reg { } impl Reg { - pub fn align(&self, cx: &C) -> Align { + /// Alignment used for the scratch space when this type is part of a `PassMode::Cast`. + pub fn scratch_align(&self, cx: &C) -> Align { let dl = cx.data_layout(); match self.kind { RegKind::Integer => match self.size.bits() { diff --git a/compiler/rustc_target/src/callconv/mod.rs b/compiler/rustc_target/src/callconv/mod.rs index 5dbee88b12f27..52a38f55b1fb3 100644 --- a/compiler/rustc_target/src/callconv/mod.rs +++ b/compiler/rustc_target/src/callconv/mod.rs @@ -260,8 +260,9 @@ impl From for Uniform { } impl Uniform { - pub fn align(&self, cx: &C) -> Align { - self.unit.align(cx) + /// Alignment used for the scratch space when this type is part of a `PassMode::Cast`. + pub fn scratch_align(&self, cx: &C) -> Align { + self.unit.scratch_align(cx) } /// Pass using one or more values of the given type, without requiring them to be consecutive. @@ -358,12 +359,10 @@ impl CastTarget { } pub fn align(&self, cx: &C) -> Align { - self.prefix - .iter() - .map(|reg| reg.align(cx)) - .fold(cx.data_layout().aggregate_align.max(self.rest.align(cx)), |acc, align| { - acc.max(align) - }) + self.prefix.iter().map(|reg| reg.scratch_align(cx)).fold( + cx.data_layout().aggregate_align.max(self.rest.scratch_align(cx)), + |acc, align| acc.max(align), + ) } /// Checks if these two `CastTarget` are equal enough to be considered "the same for all From 3592132ab2c7db6d62906ab633f54876495cb057 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Mon, 2 Nov 2026 00:51:44 +0100 Subject: [PATCH 12/34] use `type_padding_filler` for `x87_f80_raw` in arrays and structs --- compiler/rustc_codegen_llvm/src/type_of.rs | 30 +++++++++---- compiler/rustc_target/src/callconv/x86_64.rs | 14 +++--- tests/codegen-llvm/x86-abi/x87_f80.rs | 45 ++++++++++++++++++++ 3 files changed, 72 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs index 509415baf7619..d914998c75a43 100644 --- a/compiler/rustc_codegen_llvm/src/type_of.rs +++ b/compiler/rustc_codegen_llvm/src/type_of.rs @@ -1,7 +1,7 @@ use std::fmt::Write; -use rustc_abi::Primitive::{Float, Int, Pointer}; -use rustc_abi::{Align, BackendRepr, FieldsShape, Scalar, Size, TyAbiInterface, Variants}; +use rustc_abi::Primitive::{self, Float, Int, Pointer}; +use rustc_abi::{Align, BackendRepr, FieldsShape, Scalar, Size, Variants}; use rustc_codegen_ssa::traits::*; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; @@ -46,11 +46,6 @@ fn uncached_llvm_type<'ll, 'tcx>( BackendRepr::Memory { .. } | BackendRepr::ScalarPair { .. } => {} } - // Map `core::arch::{x86, x86_64}::x87_f80` to LLVM's `x86_fp80`. - if Ty::is_x87_f80_lang_item(layout, cx) { - return cx.type_x87_f80(); - } - let name = match layout.ty.kind() { // FIXME(eddyb) producing readable type names for trait objects can result // in problematically distinct types due to HRTB and subtyping (see #47638). @@ -90,7 +85,16 @@ fn uncached_llvm_type<'ll, 'tcx>( } } } - FieldsShape::Array { count, .. } => cx.type_array(layout.field(cx, 0).llvm_type(cx), count), + FieldsShape::Array { count, .. } => { + let element_ty = layout.field(cx, 0); + if let BackendRepr::Scalar(scalar) = element_ty.backend_repr + && scalar.primitive() == Primitive::Float(rustc_abi::Float::X87F80) + { + cx.type_padding_filler(element_ty.size * count, element_ty.align) + } else { + cx.type_array(element_ty.llvm_type(cx), count) + } + } FieldsShape::Arbitrary { .. } => match name { None => { let (llfields, packed) = struct_llfields(cx, layout); @@ -140,7 +144,15 @@ fn struct_llfields<'ll, 'tcx>( result.push(cx.type_padding_filler(padding, padding_align)); debug!(" padding before: {:?}", padding); } - result.push(field.llvm_type(cx)); + + if let BackendRepr::Scalar(scalar) = field.backend_repr + && scalar.primitive() == Primitive::Float(rustc_abi::Float::X87F80) + { + result.push(cx.type_padding_filler(field.size, field.align)); + } else { + result.push(field.llvm_type(cx)); + } + offset = target_offset + field.size; prev_effective_align = effective_field_align; } diff --git a/compiler/rustc_target/src/callconv/x86_64.rs b/compiler/rustc_target/src/callconv/x86_64.rs index 5439d24a573fb..26ee1c5d8f7b3 100644 --- a/compiler/rustc_target/src/callconv/x86_64.rs +++ b/compiler/rustc_target/src/callconv/x86_64.rs @@ -240,14 +240,12 @@ where } let mut cls_or_mem = classify_arg(cx, arg); - if is_arg { - if let Ok(cls) = cls_or_mem { - // An argument of class X87 is passed in memory. - if cls.contains(&Some(Class::X87)) { - std::assert_matches!(cls, [Some(Class::X87), Some(Class::X87Up), ..]); - cls_or_mem = Err(Memory); - } - + if is_arg && let Ok(cls) = cls_or_mem { + if cls.contains(&Some(Class::X87)) { + // An argument of class X87 is always passed in memory. + std::assert_matches!(cls, [Some(Class::X87), Some(Class::X87Up), ..]); + cls_or_mem = Err(Memory); + } else { let mut needed_int = 0; let mut needed_sse = 0; for c in cls { diff --git a/tests/codegen-llvm/x86-abi/x87_f80.rs b/tests/codegen-llvm/x86-abi/x87_f80.rs index ace21aa6e7ad3..7c5ee0676e442 100644 --- a/tests/codegen-llvm/x86-abi/x87_f80.rs +++ b/tests/codegen-llvm/x86-abi/x87_f80.rs @@ -2,10 +2,15 @@ // //@ revisions: X86 X86_64 DARWIN WIN64 WIN32 //@ [X86] compile-flags: --target i686-unknown-linux-gnu +//@ [X86] filecheck-flags: --check-prefix ALIGN4 //@ [X86_64] compile-flags: --target x86_64-unknown-linux-gnu +//@ [X86_64] filecheck-flags: --check-prefix ALIGN16 //@ [DARWIN] compile-flags: --target i686-apple-darwin +//@ [DARWIN] filecheck-flags: --check-prefix ALIGN16 //@ [WIN32] compile-flags: --target i686-pc-windows-gnu +//@ [WIN32] filecheck-flags: --check-prefix ALIGN4 //@ [WIN64] compile-flags: --target x86_64-pc-windows-gnu +//@ [WIN64] filecheck-flags: --check-prefix ALIGN16 //@ compile-flags: -Copt-level=3 --crate-type=lib -Zmerge-functions=disabled //@ needs-llvm-components: x86 @@ -22,6 +27,46 @@ use minicore::arch::x86_64::{x87_f80, x87_f80_raw}; use minicore::simd::f64x2; use minicore::{Copy, MaybeUninit, mem}; +#[repr(C)] +pub struct RawStruct(x87_f80_raw, u8); + +#[repr(C)] +pub struct WrappedStruct(x87_f80, u8); + +// CHECK: @RAW = external global [10 x i8] +// CHECK: @RAW_ARRAY = external global [30 x i8] +// CHECK: @RAW_STRUCT = external global [11 x i8] +#[allow(improper_ctypes)] +unsafe extern "C" { + static RAW: x87_f80_raw; + static RAW_ARRAY: [x87_f80_raw; 3]; + static RAW_STRUCT: RawStruct; +} + +#[unsafe(no_mangle)] +pub fn use_raw_statics() -> (&'static x87_f80_raw, &'static [x87_f80_raw; 3], &'static RawStruct) { + unsafe { (&RAW, &RAW_ARRAY, &RAW_STRUCT) } +} + +// ALIGN4: @WRAPPED = external global [12 x i8] +// ALIGN4: @WRAPPED_ARRAY = external global [36 x i8] +// ALIGN4: @WRAPPED_STRUCT = external global [16 x i8] +// +// ALIGN16: @WRAPPED = external global [16 x i8] +// ALIGN16: @WRAPPED_ARRAY = external global [48 x i8] +// ALIGN16: @WRAPPED_STRUCT = external global [32 x i8] +#[allow(improper_ctypes)] +unsafe extern "C" { + static WRAPPED: x87_f80; + static WRAPPED_ARRAY: [x87_f80; 3]; + static WRAPPED_STRUCT: WrappedStruct; +} + +#[unsafe(no_mangle)] +pub fn use_wrapped_statics() -> (&'static x87_f80, &'static [x87_f80; 3], &'static WrappedStruct) { + unsafe { (&WRAPPED, &WRAPPED_ARRAY, &WRAPPED_STRUCT) } +} + // CHECK-LABEL: size_of_raw_array #[unsafe(no_mangle)] pub fn size_of_raw_array() -> usize { From cc199fabecba87527f62907b1488b4ca88ea6741 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 4 Nov 2026 11:32:15 +0100 Subject: [PATCH 13/34] add assert that we never cast to `x87_f80` --- compiler/rustc_codegen_llvm/src/abi.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 42ec3fbbce657..d29fb14e5bd40 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -212,6 +212,10 @@ impl LlvmType for CastTarget { return rest_ll_unit; } + // The x87_f80 type has a store size of 10 bytes, but an allocation size of 12 or 16 + // bytes. Ensure we don't cast to it, because that could have unintened behavior. + assert!(rest_ll_unit != cx.type_x87_f80()); + return cx.type_array(rest_ll_unit, rest_count); } @@ -219,6 +223,11 @@ impl LlvmType for CastTarget { let prefix_args = self.prefix.iter().map(|reg| reg.llvm_type(cx)); let rest_args = (0..rest_count).map(|_| rest_ll_unit); let args: Vec<_> = prefix_args.chain(rest_args).collect(); + + // The x87_f80 type has a store size of 10 bytes, but an allocation size of 12 or 16 bytes. + // Ensure we don't cast to it, because that could have unintened behavior. + assert!(args.iter().all(|a| *a != cx.type_x87_f80())); + cx.type_struct(&args) } } From 802a33e67e71b83f057774cc65f68020d6e2be77 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 4 Nov 2026 11:55:40 +0100 Subject: [PATCH 14/34] adjust comments on backend type functions --- compiler/rustc_codegen_llvm/src/type_of.rs | 8 +++++--- compiler/rustc_codegen_ssa/src/traits/type_.rs | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs index d914998c75a43..190cbe32ac65b 100644 --- a/compiler/rustc_codegen_llvm/src/type_of.rs +++ b/compiler/rustc_codegen_llvm/src/type_of.rs @@ -209,12 +209,14 @@ pub(crate) trait LayoutLlvmExt<'tcx> { impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> { /// Gets the LLVM type corresponding to a Rust type, i.e., `rustc_middle::ty::Ty`. - /// The pointee type of the pointer in `PlaceRef` is always this type. - /// For sized types, it is also the right LLVM type for an `alloca` - /// containing a value of that type, and most immediates (except `bool`). + /// + /// For sized types, this is the in-memory type that is used for stores and loads. + /// The type used for immediates may be different, see [`Self::immediate_llvm_type`]. + /// /// Unsized types, however, are represented by a "minimal unit", e.g. /// `[T]` becomes `T`, while `str` and `Trait` turn into `i8` - this /// is useful for indexing slices, as `&[T]`'s data pointer is `T*`. + /// /// If the type is an unsized struct, the regular layout is generated, /// with the innermost trailing unsized field using the "minimal unit" /// of that field's type - this is useful for taking the address of diff --git a/compiler/rustc_codegen_ssa/src/traits/type_.rs b/compiler/rustc_codegen_ssa/src/traits/type_.rs index c4e52fcd2c0ba..11f3250ded648 100644 --- a/compiler/rustc_codegen_ssa/src/traits/type_.rs +++ b/compiler/rustc_codegen_ssa/src/traits/type_.rs @@ -123,8 +123,12 @@ impl<'tcx, T> DerivedTypeCodegenMethods<'tcx> for T where } pub trait LayoutTypeCodegenMethods<'tcx>: BackendTypes { - /// The backend type used for a rust type when it's in memory, - /// such as when it's stack-allocated or when it's being loaded or stored. + /// The backend type used for a Rust type when it is being loaded from or + /// stored to memory. + /// + /// Note that this type may be different from the type used for allocas. + /// For instance for x87_f80 the store size and allocation size is different, + /// so different types are used to represent it in memory versus on the stack. fn backend_type(&self, layout: TyAndLayout<'tcx>) -> Self::Type; fn cast_backend_type(&self, ty: &CastTarget) -> Self::Type; fn fn_decl_backend_type(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> Self::FunctionSignature; From 7274b42c8de374e93342decc539343d29fc7e9f5 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 5 Nov 2026 11:59:50 +0100 Subject: [PATCH 15/34] support x87_f80 in const eval's `try_visit_primitive` Without it, reads are reported as UB because the tracking of what bytes are initialized is incorect --- .../src/interpret/validity.rs | 12 +++++++ src/tools/miri/tests/pass/x87_f80.rs | 32 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/tools/miri/tests/pass/x87_f80.rs diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index 67fe133f147f3..43a05b617cfb9 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -16,6 +16,7 @@ use rustc_abi::{ WrappingRange, }; use rustc_ast::Mutability; +use rustc_attr_ir::LangItem; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; use rustc_middle::mir::interpret::{ @@ -902,6 +903,17 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> { } interp_ok(true) } + ty::Adt(adt_def, _) + if self.ecx.tcx.is_lang_item(adt_def.did(), LangItem::X87F80Raw) => + { + // The x87_f80_raw lang item is effectively a primitive. + self.read_scalar(value, ExpectedKind::Float)?; + if self.reset_provenance_and_padding { + self.ecx.clear_provenance(value)?; + self.add_data_range_place(value); + } + interp_ok(true) + } ty::RawPtr(pointee, ..) => { let ptr = self.read_immediate(value, ExpectedKind::RawPtr)?; if self.reset_provenance_and_padding { diff --git a/src/tools/miri/tests/pass/x87_f80.rs b/src/tools/miri/tests/pass/x87_f80.rs new file mode 100644 index 0000000000000..211a480796789 --- /dev/null +++ b/src/tools/miri/tests/pass/x87_f80.rs @@ -0,0 +1,32 @@ +//@only-target: x86_64 i686 +#![feature(x87_f80)] + +#[cfg(target_arch = "x86")] +use std::arch::x86::x87_f80; +#[cfg(target_arch = "x86_64")] +use std::arch::x86_64::x87_f80; + +static STATIC: x87_f80 = x87_f80::from_ne_bytes([0xAA; 10]); +static STATIC_AGGREGATE: (u8, x87_f80, i32) = (3, x87_f80::from_ne_bytes([0xBB; 10]), 4); +static STATIC_ARRAY: [x87_f80; 3] = [ + x87_f80::from_ne_bytes([0x11; 10]), + x87_f80::from_ne_bytes([0x22; 10]), + x87_f80::from_ne_bytes([0x33; 10]), +]; + +fn identity(x: x87_f80) -> x87_f80 { + x +} + +fn main() { + assert_eq!(STATIC.to_ne_bytes(), [0xAA; 10]); + assert_eq!(STATIC_AGGREGATE.1.to_ne_bytes(), [0xBB; 10]); + assert_eq!(STATIC_ARRAY[1].to_ne_bytes(), [0x22; 10]); + + let mut m = std::mem::MaybeUninit::::uninit(); + unsafe { m.as_mut_ptr().cast::<[u8; 10]>().write([0xCC; 10]) }; + let i = unsafe { m.assume_init() }; + assert_eq!(i.to_ne_bytes(), [0xCC; 10]); + + assert_eq!(identity(i).to_ne_bytes(), [0xCC; 10]); +} From bbcae618cfd33998cdf014ae32f451ecd57273b8 Mon Sep 17 00:00:00 2001 From: Joseph Zhao Date: Sun, 1 Nov 2026 08:37:00 -0800 Subject: [PATCH 16/34] fix ICE when reading as signed Co-authored-by: Ralf Jung --- .../miri/src/shims/unix/foreign_items.rs | 8 +++---- src/tools/miri/src/shims/unix/poll.rs | 9 ++++++-- src/tools/miri/src/shims/unix/socket.rs | 14 +++++------ .../miri/src/shims/unix/socket_address.rs | 23 +++++++++++++++++-- .../libc/getsockopt_buffer_too_small.rs | 4 +++- .../libc/getsockopt_buffer_too_small.stderr | 2 +- src/tools/miri/tests/pass-dep/libc/poll.rs | 10 ++++++++ src/tools/miri/tests/pass-dep/libc/sysconf.rs | 2 +- 8 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/tools/miri/src/shims/unix/foreign_items.rs b/src/tools/miri/src/shims/unix/foreign_items.rs index 314bb4ee878a6..4014060b11019 100644 --- a/src/tools/miri/src/shims/unix/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/foreign_items.rs @@ -16,6 +16,7 @@ use self::shims::unix::netbsd::foreign_items as netbsd; use self::shims::unix::solarish::foreign_items as solarish; use crate::shims::alloc::EvalContextExt as _; use crate::shims::cpu_affinity::EvalContextExt as _; +use crate::shims::files::FD_LIMIT; use crate::shims::unix::*; use crate::{shim_sig, *}; @@ -66,11 +67,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // 512 seems to be a reasonable default. The value is not critical, in // the sense that getpwuid_r takes and checks the buffer length. ("_SC_GETPW_R_SIZE_MAX", |_ecx| 512), - // Miri doesn't have a fixed limit on FDs, but we may be limited in terms of how - // many *host* FDs we can open. Just use some arbitrary, pretty big value; - // this can be adjusted if it causes problems. - // The spec imposes a minimum of `_POSIX_OPEN_MAX` (20). - ("_SC_OPEN_MAX", |_ecx| 2_i32.pow(16).into()), + // Never hand out FDs at or above `FD_LIMIT`. + ("_SC_OPEN_MAX", |_ecx| FD_LIMIT.into()), // Our hard-coded hostname is just 4 bytes so we don't need anything big here. ("_SC_HOST_NAME_MAX", |_ecx| 255), ]; diff --git a/src/tools/miri/src/shims/unix/poll.rs b/src/tools/miri/src/shims/unix/poll.rs index 92929a790bdec..14689ce6e84f4 100644 --- a/src/tools/miri/src/shims/unix/poll.rs +++ b/src/tools/miri/src/shims/unix/poll.rs @@ -4,7 +4,7 @@ use std::time::Duration; use rustc_target::spec::Os; -use crate::shims::files::FdNum; +use crate::shims::files::{FD_LIMIT, FdNum}; use crate::*; /// An interest into a file descriptor together with its @@ -32,8 +32,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ) -> InterpResult<'tcx> { let ecx = self.eval_context_mut(); - let nfds: u64 = ecx.read_scalar(nfds)?.to_int(nfds.layout.size)?.try_into().unwrap(); + let nfds: u64 = ecx.read_scalar(nfds)?.to_uint(nfds.layout.size)?.try_into().unwrap(); let timeout = ecx.read_scalar(timeout)?.to_i32()?; + + // Return `EINVAL`` if `nfds` is greater than `FD_LIMIT`. + if nfds > u64::try_from(FD_LIMIT).unwrap() { + return ecx.set_errno_and_return_neg1(LibcError("EINVAL"), dest); + } let fds_arr = ecx.deref_pointer(fds)?; // The provided interests indexed by the file descriptor they're for. diff --git a/src/tools/miri/src/shims/unix/socket.rs b/src/tools/miri/src/shims/unix/socket.rs index 6dc023be5a551..2bd32496c7494 100644 --- a/src/tools/miri/src/shims/unix/socket.rs +++ b/src/tools/miri/src/shims/unix/socket.rs @@ -724,9 +724,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let level = this.read_scalar(level)?.to_i32()?; let option_name = this.read_scalar(option_name)?.to_i32()?; let option_value_ptr = this.read_pointer(option_value)?; - let socklen_layout = this.libc_ty_layout("socklen_t"); - let option_len: u64 = - this.read_scalar(option_len)?.to_int(socklen_layout.size)?.try_into().unwrap(); + let Some(option_len) = this.read_socklen(option_len)? else { + return this.set_errno_and_return_neg1_i32(LibcError("EINVAL")); + }; // Check that the buffer has (at least) the given size. this.check_ptr_access( @@ -789,11 +789,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let socklen_layout = this.libc_ty_layout("socklen_t"); let option_len_ptr_mplace = this.ptr_to_mplace(option_len_ptr, socklen_layout); - let option_len: usize = this - .read_scalar(&option_len_ptr_mplace)? - .to_int(socklen_layout.size)? - .try_into() - .unwrap(); + let Some(option_len) = this.read_socklen(&option_len_ptr_mplace)? else { + return this.set_errno_and_return_neg1_i32(LibcError("EINVAL")); + }; // Check that the buffer has (at least) the given size. this.check_ptr_access( diff --git a/src/tools/miri/src/shims/unix/socket_address.rs b/src/tools/miri/src/shims/unix/socket_address.rs index 64ec52e2e52aa..9f7da9fdb5f07 100644 --- a/src/tools/miri/src/shims/unix/socket_address.rs +++ b/src/tools/miri/src/shims/unix/socket_address.rs @@ -122,6 +122,24 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { this.free_address_infos(res_ptr) } + /// Read a `socklen_t` value. Returns `None` if it does not fit into a `u64`, e.g. if it + /// is negative, which is possible on targets where `socklen_t` is signed. + fn read_socklen( + &self, + op: &impl Projectable<'tcx, Provenance>, + ) -> InterpResult<'tcx, Option> { + let ecx = self.eval_context_ref(); + + let layout = op.layout(); + let scalar = ecx.read_scalar(op)?; + let len = if layout.backend_repr.is_signed() { + u64::try_from(scalar.to_int(layout.size)?).ok() + } else { + u64::try_from(scalar.to_uint(layout.size)?).ok() + }; + interp_ok(len) + } + /// Attempt to turn an address and length operand into a standard library socket address. /// /// Returns an IO error should the address length not match the address family length. @@ -135,8 +153,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // We only support address lengths which can be stored in a u64 since the // size of a layout is also stored in a u64. - let address_len: u64 = - this.read_scalar(address_len)?.to_int(address_len.layout.size)?.try_into().unwrap(); + let Some(address_len) = this.read_socklen(address_len)? else { + return interp_ok(Err(LibcError("EINVAL"))); + }; let address = this.deref_pointer(address)?; // Ensure the pointer is actually dereferenceable for that length. diff --git a/src/tools/miri/tests/fail-dep/libc/getsockopt_buffer_too_small.rs b/src/tools/miri/tests/fail-dep/libc/getsockopt_buffer_too_small.rs index f9ba1d7517aae..f407aeeac08c7 100644 --- a/src/tools/miri/tests/fail-dep/libc/getsockopt_buffer_too_small.rs +++ b/src/tools/miri/tests/fail-dep/libc/getsockopt_buffer_too_small.rs @@ -6,8 +6,10 @@ fn main() { assert!(sockfd >= 0); // The buffer is large enough for the value, but the length claims it is much larger. + // Use the largest possible length; Miri used to ICE here because it read `socklen_t` + // as a signed integer. let mut val: libc::c_int = 0; - let mut len: libc::socklen_t = 1024; + let mut len = libc::socklen_t::MAX; unsafe { libc::getsockopt( //~^ERROR: memory access failed diff --git a/src/tools/miri/tests/fail-dep/libc/getsockopt_buffer_too_small.stderr b/src/tools/miri/tests/fail-dep/libc/getsockopt_buffer_too_small.stderr index ce3042e68f3a1..6ed807a649d83 100644 --- a/src/tools/miri/tests/fail-dep/libc/getsockopt_buffer_too_small.stderr +++ b/src/tools/miri/tests/fail-dep/libc/getsockopt_buffer_too_small.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: memory access failed: attempting to access 1024 bytes, but got ALLOC which is only 4 bytes from the end of the allocation +error: Undefined Behavior: memory access failed: attempting to access 4294967295 bytes, but got ALLOC which is only 4 bytes from the end of the allocation --> tests/fail-dep/libc/getsockopt_buffer_too_small.rs:LL:CC | LL | / libc::getsockopt( diff --git a/src/tools/miri/tests/pass-dep/libc/poll.rs b/src/tools/miri/tests/pass-dep/libc/poll.rs index bcc2d334beb9f..0d55129ee2d39 100644 --- a/src/tools/miri/tests/pass-dep/libc/poll.rs +++ b/src/tools/miri/tests/pass-dep/libc/poll.rs @@ -29,6 +29,7 @@ fn main() { test_poll_negative_fd_interest(); test_poll_invalid_non_negative_fd_interest(); test_poll_zero_timeout(); + test_poll_nfds_too_big(); test_readiness_event_after_poll_blocked(); test_poll_race(); } @@ -171,6 +172,15 @@ fn test_poll_zero_timeout() { assert!(before.elapsed() < Duration::from_millis(100)) } +/// Test that `poll` fails with EINVAL when `nfds` is larger than the open file limit. +/// Miri used to ICE here because it read `nfds` as a signed integer. +fn test_poll_nfds_too_big() { + let err = unsafe { + errno_result(libc::poll(std::ptr::null_mut(), libc::nfds_t::MAX, 0)).unwrap_err() + }; + assert_eq!(err.raw_os_error(), Some(libc::EINVAL)); +} + /// Before Miri would ICE when /// any file description readiness is updated after a `poll` invocation has /// blocked. diff --git a/src/tools/miri/tests/pass-dep/libc/sysconf.rs b/src/tools/miri/tests/pass-dep/libc/sysconf.rs index b832b3033b76e..68f01db3ed14a 100644 --- a/src/tools/miri/tests/pass-dep/libc/sysconf.rs +++ b/src/tools/miri/tests/pass-dep/libc/sysconf.rs @@ -10,7 +10,7 @@ fn test_sysconfbasic() { let gwmax = libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX); assert!(gwmax >= 512); let omax = libc::sysconf(libc::_SC_OPEN_MAX); - assert_eq!(omax, 65536); + assert_eq!(omax, 524288); } } From c07d3b3b6e1b39e9f5fc5ff4ba92a7ba8680b56f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Nov 2026 08:13:13 +0100 Subject: [PATCH 17/34] add test for closing the end of a socketpair that someone is blocked on --- .../libc/socketpair_block_read_twice.rs | 1 - .../libc/socketpair_block_write_twice.rs | 1 - .../socketpair_fd_closed_while_blocked.rs | 29 +++++++++++++ .../socketpair_fd_closed_while_blocked.stderr | 43 +++++++++++++++++++ .../miri/tests/pass-dep/libc/socketpair.rs | 4 +- 5 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 src/tools/miri/tests/fail-dep/libc/socketpair_fd_closed_while_blocked.rs create mode 100644 src/tools/miri/tests/fail-dep/libc/socketpair_fd_closed_while_blocked.stderr diff --git a/src/tools/miri/tests/fail-dep/libc/socketpair_block_read_twice.rs b/src/tools/miri/tests/fail-dep/libc/socketpair_block_read_twice.rs index 4b5c61ec88adc..63b4ad8928314 100644 --- a/src/tools/miri/tests/fail-dep/libc/socketpair_block_read_twice.rs +++ b/src/tools/miri/tests/fail-dep/libc/socketpair_block_read_twice.rs @@ -1,7 +1,6 @@ //@ignore-target: windows # No libc socketpair on Windows //@compile-flags: -Zmiri-deterministic-concurrency //@error-in-other-file: deadlock -//@require-annotations-for-level: error use std::thread; diff --git a/src/tools/miri/tests/fail-dep/libc/socketpair_block_write_twice.rs b/src/tools/miri/tests/fail-dep/libc/socketpair_block_write_twice.rs index 7b2de39c304d3..ff1214987e061 100644 --- a/src/tools/miri/tests/fail-dep/libc/socketpair_block_write_twice.rs +++ b/src/tools/miri/tests/fail-dep/libc/socketpair_block_write_twice.rs @@ -1,7 +1,6 @@ //@ignore-target: windows # No libc socketpair on Windows //@compile-flags: -Zmiri-deterministic-concurrency //@error-in-other-file: deadlock -//@require-annotations-for-level: error use std::thread; diff --git a/src/tools/miri/tests/fail-dep/libc/socketpair_fd_closed_while_blocked.rs b/src/tools/miri/tests/fail-dep/libc/socketpair_fd_closed_while_blocked.rs new file mode 100644 index 0000000000000..8892a3ecdd655 --- /dev/null +++ b/src/tools/miri/tests/fail-dep/libc/socketpair_fd_closed_while_blocked.rs @@ -0,0 +1,29 @@ +//@ignore-target: windows # No libc socketpair on Windows +//@compile-flags: -Zmiri-fixed-schedule +//@error-in-other-file: deadlock +//@error-in-other-file: deadlock + +use std::thread; + +#[path = "../../utils/libc.rs"] +mod libc_utils; +use libc_utils::*; + +/// Test that `close` unblocks reads on the other FD. +fn main() { + let mut fds = [-1, -1]; + errno_check(unsafe { libc::socketpair(libc::AF_UNIX, libc::SOCK_STREAM, 0, fds.as_mut_ptr()) }); + + let thread1 = thread::spawn(move || { + // This read will be blocked because the buffer is already full. + read_to_end(fds[0]).unwrap(); + }); + let thread2 = thread::spawn(move || { + thread::yield_now(); // thread1 should go first + // Close the FD thread1 is waiting on. This does NOT unblock thread1! + // (That matches the behavior on native Linux.) + errno_check(unsafe { libc::close(fds[0]) }); + }); + thread1.join().unwrap(); + thread2.join().unwrap(); +} diff --git a/src/tools/miri/tests/fail-dep/libc/socketpair_fd_closed_while_blocked.stderr b/src/tools/miri/tests/fail-dep/libc/socketpair_fd_closed_while_blocked.stderr new file mode 100644 index 0000000000000..79008f501f213 --- /dev/null +++ b/src/tools/miri/tests/fail-dep/libc/socketpair_fd_closed_while_blocked.stderr @@ -0,0 +1,43 @@ +error: the evaluated program deadlocked + --> RUSTLIB/std/src/sys/thread/PLATFORM.rs:LL:CC + | +LL | let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) }; + | ^ thread got stuck here + | + = note: this is on thread `main` + = note: stack backtrace: + 0: std::sys::thread::PLATFORM::Thread::join + at RUSTLIB/std/src/sys/thread/PLATFORM.rs:LL:CC + 1: std::thread::lifecycle::JoinInner::<'_, ()>::join + at RUSTLIB/std/src/thread/lifecycle.rs:LL:CC + 2: std::thread::JoinHandle::<()>::join + at RUSTLIB/std/src/thread/join_handle.rs:LL:CC + 3: main + at tests/fail-dep/libc/socketpair_fd_closed_while_blocked.rs:LL:CC + +error: the evaluated program deadlocked + --> tests/fail-dep/libc/../../utils/libc.rs:LL:CC + | +LL | let res = errno_result(unsafe { libc::read(fd, spare.as_mut_ptr().cast(), spare.len()) })?; + | ^ thread got stuck here + | + = note: this is on thread `unnamed-ID` + = note: stack backtrace: + 0: libc_utils::read_to_end + at tests/fail-dep/libc/../../utils/libc.rs:LL:CC + 1: main::{closure#0} + at tests/fail-dep/libc/socketpair_fd_closed_while_blocked.rs:LL:CC +note: the last function in that backtrace got called indirectly due to this code + --> tests/fail-dep/libc/socketpair_fd_closed_while_blocked.rs:LL:CC + | +LL | let thread1 = thread::spawn(move || { + | ___________________^ +LL | | // This read will be blocked because the buffer is already full. +LL | | read_to_end(fds[0]).unwrap(); +LL | | }); + | |______^ + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to 2 previous errors + diff --git a/src/tools/miri/tests/pass-dep/libc/socketpair.rs b/src/tools/miri/tests/pass-dep/libc/socketpair.rs index 0638beb2d6c22..a560bdfdc9c42 100644 --- a/src/tools/miri/tests/pass-dep/libc/socketpair.rs +++ b/src/tools/miri/tests/pass-dep/libc/socketpair.rs @@ -241,7 +241,7 @@ fn test_write_unblocked_by_other_socket_close() { write_all(fds[0], &arr1).unwrap(); let thread1 = thread::spawn(move || { - // The write below will be blocked because the buffer is already full. + // This write belo will be blocked because the buffer is already full. write_all(fds[0], b"abc").unwrap_err() }); let thread2 = thread::spawn(move || { @@ -262,7 +262,7 @@ fn test_read_unblocked_by_other_socket_close() { errno_check(unsafe { libc::socketpair(libc::AF_UNIX, libc::SOCK_STREAM, 0, fds.as_mut_ptr()) }); let thread1 = thread::spawn(move || { - // The write below will be blocked because the buffer is already full. + // This read will be blocked because the buffer is empty. read_to_end(fds[0]).unwrap() }); let thread2 = thread::spawn(move || { From 0edc67f33823ea1d00afedbc7740437396a1d78a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Nov 2026 08:53:10 +0100 Subject: [PATCH 18/34] syscall: return ENOSYS for unknown syscalls --- src/tools/miri/src/shims/unix/linux_like/syscall.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/tools/miri/src/shims/unix/linux_like/syscall.rs b/src/tools/miri/src/shims/unix/linux_like/syscall.rs index 88486f91e71c8..5535a129a7811 100644 --- a/src/tools/miri/src/shims/unix/linux_like/syscall.rs +++ b/src/tools/miri/src/shims/unix/linux_like/syscall.rs @@ -39,7 +39,6 @@ pub fn syscall<'tcx>( let sys_gettid = ecx.eval_libc("SYS_gettid").to_target_usize(ecx)?; let sys_accept4 = ecx.eval_libc("SYS_accept4").to_target_usize(ecx)?; let sys_copy_file_range = ecx.eval_libc("SYS_copy_file_range").to_target_usize(ecx)?; - let sys_splice = ecx.eval_libc("SYS_splice").to_target_usize(ecx)?; // FIXME: Do these all have direct tests (#3179)? match ecx.read_target_usize(&op)? { @@ -96,13 +95,11 @@ pub fn syscall<'tcx>( )?; ecx.linux_copy_file_range(fd_in, off_in, fd_out, off_out, len, flags, dest)?; } - num if num == sys_splice => { - // Force std to use a fallback path. + _ => { + // ENOSYS for unknown syscalls. That matches us returning null for all + // unknown weak symbols. ecx.set_errno_and_return_neg1(LibcError("ENOSYS"), dest)?; } - num => { - throw_unsup_format!("syscall: unsupported syscall number {num}"); - } }; interp_ok(()) From 462d762f9a5790dcdd5779bc587397f6f006bf20 Mon Sep 17 00:00:00 2001 From: darkraider01 Date: Mon, 9 Nov 2026 14:26:45 +0530 Subject: [PATCH 19/34] Rename evaluation context bindings in shims --- src/tools/miri/src/shims/env.rs | 24 +++--- src/tools/miri/src/shims/files.rs | 8 +- src/tools/miri/src/shims/math.rs | 92 +++++++++++----------- src/tools/miri/src/shims/native_lib/mod.rs | 50 ++++++------ src/tools/miri/src/shims/readiness.rs | 10 +-- 5 files changed, 91 insertions(+), 93 deletions(-) diff --git a/src/tools/miri/src/shims/env.rs b/src/tools/miri/src/shims/env.rs index cfc94abb68989..b85685d844ada 100644 --- a/src/tools/miri/src/shims/env.rs +++ b/src/tools/miri/src/shims/env.rs @@ -95,36 +95,36 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { /// Try to get an environment variable from the interpreted program's environment. This is /// useful for implementing shims which are documented to read from the environment. fn get_env_var(&mut self, name: &OsStr) -> InterpResult<'tcx, Option> { - let this = self.eval_context_ref(); - match &this.machine.env_vars { + let ecx = self.eval_context_ref(); + match &ecx.machine.env_vars { EnvVars::Uninit => interp_ok(None), - EnvVars::Unix(vars) => vars.get(this, name), + EnvVars::Unix(vars) => vars.get(ecx, name), EnvVars::Windows(vars) => vars.get(name), } } /// Get the process identifier. fn get_pid(&self) -> u32 { - let this = self.eval_context_ref(); - if this.machine.communicate() { std::process::id() } else { 1000 } + let ecx = self.eval_context_ref(); + if ecx.machine.communicate() { std::process::id() } else { 1000 } } /// Get an "OS" thread ID for any thread. fn get_tid(&self, thread: ThreadId) -> u32 { - let this = self.eval_context_ref(); - assert!(this.target_os_is_unix()); + let ecx = self.eval_context_ref(); + assert!(ecx.target_os_is_unix()); // On Linux, the main thread has PID == TID so we uphold this. For simplicity we do it // everywhere. That also ensures this ID is different from what is returned by // `pthread_self`. - this.get_pid().strict_add(thread.to_u32()) + ecx.get_pid().strict_add(thread.to_u32()) } /// Convert TID back to a `ThreadId`, or `None` if it is invalid or the thread has terminated. fn get_thread_id_from_linux_tid(&self, tid: u32) -> Option { - let this = self.eval_context_ref(); - assert_matches!(this.tcx.sess.target.os, Os::Linux | Os::Android); + let ecx = self.eval_context_ref(); + assert_matches!(ecx.tcx.sess.target.os, Os::Linux | Os::Android); // TID = PID + thread_index => index = TID - PID. - let id = tid.checked_sub(this.get_pid())?; - this.machine.threads.thread_id_try_from(id).ok() + let id = tid.checked_sub(ecx.get_pid())?; + ecx.machine.threads.thread_id_try_from(id).ok() } } diff --git a/src/tools/miri/src/shims/files.rs b/src/tools/miri/src/shims/files.rs index 5e344b3b266c1..b292565d449e8 100644 --- a/src/tools/miri/src/shims/files.rs +++ b/src/tools/miri/src/shims/files.rs @@ -732,7 +732,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { len: u64, read_cb: impl FnOnce(&mut [u8]) -> io::Result, ) -> InterpResult<'tcx, Result> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); let len = usize::saturating_cast_from(len); let mut bytes = vec![0; len]; @@ -742,7 +742,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // If reading to `bytes` did not fail, we write those bytes to the buffer. // Crucially, if fewer than `bytes.len()` bytes were read, only write // that much into the output buffer! - this.write_bytes_ptr(ptr, bytes[..read_size].iter().copied())?; + ecx.write_bytes_ptr(ptr, bytes[..read_size].iter().copied())?; interp_ok(Ok(read_size.to_u64())) } Err(e) => interp_ok(Err(IoError::HostError(e))), @@ -756,10 +756,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { len: u64, write_cb: impl FnOnce(&[u8]) -> io::Result, ) -> InterpResult<'tcx, Result> { - let this = self.eval_context_ref(); + let ecx = self.eval_context_ref(); let len = usize::saturating_cast_from(len); - let bytes = this.read_bytes_ptr_strip_provenance(ptr, Size::from_bytes(len))?; + let bytes = ecx.read_bytes_ptr_strip_provenance(ptr, Size::from_bytes(len))?; let result = write_cb(bytes); interp_ok(result.map_err(IoError::HostError).map(|written_size| written_size.to_u64())) } diff --git a/src/tools/miri/src/shims/math.rs b/src/tools/miri/src/shims/math.rs index f722d79c6e165..c72aeda67668a 100644 --- a/src/tools/miri/src/shims/math.rs +++ b/src/tools/miri/src/shims/math.rs @@ -15,7 +15,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &[OpTy<'tcx>], dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx, EmulateItemResult> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); // math functions (note that there are also intrinsics for some other functions) match link_name.as_str() { @@ -37,13 +37,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { | "erff" | "erfcf" => { - let [f] = &this.check_shim_sig( + let [f] = &ecx.check_shim_sig( shim_sig!(extern "C" fn(f32) -> f32), (link_name, abi, args), )?; - let f = this.read_scalar(f)?.to_f32()?; + let f = ecx.read_scalar(f)?.to_f32()?; - let res = math::fixed_float_value(this, link_name.as_str(), &[f]).unwrap_or_else(|| { + let res = math::fixed_float_value(ecx, link_name.as_str(), &[f]).unwrap_or_else(|| { // Using host floats (but it's fine, these operations do not have // guaranteed precision). let f_host = f.to_host(); @@ -68,14 +68,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let res = res.to_soft(); // Apply a relative error of 4ULP to introduce some non-determinism // simulating imprecise implementations and optimizations. - let res = math::apply_random_float_error_ulp(this, res, 4); + let res = math::apply_random_float_error_ulp(ecx, res, 4); // Clamp the result to the guaranteed range of this function according to the C standard, // if any. math::clamp_float_value(link_name.as_str(), res) }); - let res = this.adjust_nan(res, &[f]); - this.write_scalar(res, dest)?; + let res = ecx.adjust_nan(res, &[f]); + ecx.write_scalar(res, dest)?; } #[rustfmt::skip] | "_hypotf" @@ -83,14 +83,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { | "atan2f" | "fdimf" => { - let [f1, f2] = &this.check_shim_sig( + let [f1, f2] = &ecx.check_shim_sig( shim_sig!(extern "C" fn(f32, f32) -> f32), (link_name, abi, args), )?; - let f1 = this.read_scalar(f1)?.to_f32()?; - let f2 = this.read_scalar(f2)?.to_f32()?; + let f1 = ecx.read_scalar(f1)?.to_f32()?; + let f2 = ecx.read_scalar(f2)?.to_f32()?; - let res = math::fixed_float_value(this, link_name.as_str(), &[f1, f2]) + let res = math::fixed_float_value(ecx, link_name.as_str(), &[f1, f2]) .unwrap_or_else(|| { let res = match link_name.as_str() { // underscore case for windows, here and below @@ -104,14 +104,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { }; // Apply a relative error of 4ULP to introduce some non-determinism // simulating imprecise implementations and optimizations. - let res = math::apply_random_float_error_ulp(this, res, 4); + let res = math::apply_random_float_error_ulp(ecx, res, 4); // Clamp the result to the guaranteed range of this function according to the C standard, // if any. math::clamp_float_value(link_name.as_str(), res) }); - let res = this.adjust_nan(res, &[f1, f2]); - this.write_scalar(res, dest)?; + let res = ecx.adjust_nan(res, &[f1, f2]); + ecx.write_scalar(res, dest)?; } #[rustfmt::skip] | "cbrt" @@ -130,13 +130,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { | "erf" | "erfc" => { - let [f] = &this.check_shim_sig( + let [f] = &ecx.check_shim_sig( shim_sig!(extern "C" fn(f64) -> f64), (link_name, abi, args), )?; - let f = this.read_scalar(f)?.to_f64()?; + let f = ecx.read_scalar(f)?.to_f64()?; - let res = math::fixed_float_value(this, link_name.as_str(), &[f]).unwrap_or_else(|| { + let res = math::fixed_float_value(ecx, link_name.as_str(), &[f]).unwrap_or_else(|| { // Using host floats (but it's fine, these operations do not have // guaranteed precision). let f_host = f.to_host(); @@ -161,14 +161,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let res = res.to_soft(); // Apply a relative error of 4ULP to introduce some non-determinism // simulating imprecise implementations and optimizations. - let res = math::apply_random_float_error_ulp(this, res, 4); + let res = math::apply_random_float_error_ulp(ecx, res, 4); // Clamp the result to the guaranteed range of this function according to the C standard, // if any. math::clamp_float_value(link_name.as_str(), res) }); - let res = this.adjust_nan(res, &[f]); - this.write_scalar(res, dest)?; + let res = ecx.adjust_nan(res, &[f]); + ecx.write_scalar(res, dest)?; } #[rustfmt::skip] | "_hypot" @@ -176,14 +176,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { | "atan2" | "fdim" => { - let [f1, f2] = &this.check_shim_sig( + let [f1, f2] = &ecx.check_shim_sig( shim_sig!(extern "C" fn(f64, f64) -> f64), (link_name, abi, args), )?; - let f1 = this.read_scalar(f1)?.to_f64()?; - let f2 = this.read_scalar(f2)?.to_f64()?; + let f1 = ecx.read_scalar(f1)?.to_f64()?; + let f2 = ecx.read_scalar(f2)?.to_f64()?; - let res = math::fixed_float_value(this, link_name.as_str(), &[f1, f2]).unwrap_or_else(|| { + let res = math::fixed_float_value(ecx, link_name.as_str(), &[f1, f2]).unwrap_or_else(|| { let res = match link_name.as_str() { // underscore case for windows, here and below // (see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/floating-point-primitives?view=vs-2019) @@ -196,75 +196,75 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { }; // Apply a relative error of 4ULP to introduce some non-determinism // simulating imprecise implementations and optimizations. - let res = math::apply_random_float_error_ulp(this, res, 4); + let res = math::apply_random_float_error_ulp(ecx, res, 4); // Clamp the result to the guaranteed range of this function according to the C standard, // if any. math::clamp_float_value(link_name.as_str(), res) }); - let res = this.adjust_nan(res, &[f1, f2]); - this.write_scalar(res, dest)?; + let res = ecx.adjust_nan(res, &[f1, f2]); + ecx.write_scalar(res, dest)?; } #[rustfmt::skip] | "_ldexp" | "ldexp" | "scalbn" => { - let [x, exp] = &this.check_shim_sig( + let [x, exp] = &ecx.check_shim_sig( shim_sig!(extern "C" fn(f64, i32) -> f64), (link_name, abi, args), )?; // For radix-2 (binary) systems, `ldexp` and `scalbn` are the same. - let x = this.read_scalar(x)?.to_f64()?; - let exp = this.read_scalar(exp)?.to_i32()?; + let x = ecx.read_scalar(x)?.to_f64()?; + let exp = ecx.read_scalar(exp)?.to_i32()?; let res = x.scalbn(exp); - let res = this.adjust_nan(res, &[x]); - this.write_scalar(res, dest)?; + let res = ecx.adjust_nan(res, &[x]); + ecx.write_scalar(res, dest)?; } "lgammaf_r" => { - let [x, signp] = &this.check_shim_sig( + let [x, signp] = &ecx.check_shim_sig( shim_sig!(extern "C" fn(f32, *i32) -> f32), (link_name, abi, args), )?; - let x = this.read_scalar(x)?.to_f32()?; - let signp = this.deref_pointer(signp)?; + let x = ecx.read_scalar(x)?.to_f32()?; + let signp = ecx.deref_pointer(signp)?; // Using host floats (but it's fine, these operations do not have guaranteed precision). let (res, sign) = x.to_host().ln_gamma(); - this.write_int(sign, &signp)?; + ecx.write_int(sign, &signp)?; let res = res.to_soft(); // Apply a relative error of 4ULP to introduce some non-determinism // simulating imprecise implementations and optimizations. - let res = math::apply_random_float_error_ulp(this, res, 4); + let res = math::apply_random_float_error_ulp(ecx, res, 4); // Clamp the result to the guaranteed range of this function according to the C standard, // if any. let res = math::clamp_float_value(link_name.as_str(), res); - let res = this.adjust_nan(res, &[x]); - this.write_scalar(res, dest)?; + let res = ecx.adjust_nan(res, &[x]); + ecx.write_scalar(res, dest)?; } "lgamma_r" => { - let [x, signp] = &this.check_shim_sig( + let [x, signp] = &ecx.check_shim_sig( shim_sig!(extern "C" fn(f64, *i32) -> f64), (link_name, abi, args), )?; - let x = this.read_scalar(x)?.to_f64()?; - let signp = this.deref_pointer(signp)?; + let x = ecx.read_scalar(x)?.to_f64()?; + let signp = ecx.deref_pointer(signp)?; // Using host floats (but it's fine, these operations do not have guaranteed precision). let (res, sign) = x.to_host().ln_gamma(); - this.write_int(sign, &signp)?; + ecx.write_int(sign, &signp)?; let res = res.to_soft(); // Apply a relative error of 4ULP to introduce some non-determinism // simulating imprecise implementations and optimizations. - let res = math::apply_random_float_error_ulp(this, res, 4); + let res = math::apply_random_float_error_ulp(ecx, res, 4); // Clamp the result to the guaranteed range of this function according to the C standard, // if any. let res = math::clamp_float_value(link_name.as_str(), res); - let res = this.adjust_nan(res, &[x]); - this.write_scalar(res, dest)?; + let res = ecx.adjust_nan(res, &[x]); + ecx.write_scalar(res, dest)?; } _ => return interp_ok(EmulateItemResult::NotSupported), diff --git a/src/tools/miri/src/shims/native_lib/mod.rs b/src/tools/miri/src/shims/native_lib/mod.rs index 1dd113766d6ad..b671092ccaf32 100644 --- a/src/tools/miri/src/shims/native_lib/mod.rs +++ b/src/tools/miri/src/shims/native_lib/mod.rs @@ -99,15 +99,15 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { args: &mut [OwnedArg], ret: (FfiType, Size), ) -> InterpResult<'tcx, (Box<[u8]>, Option)> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); #[cfg(target_os = "linux")] - let alloc = this.machine.allocator.as_ref().unwrap().clone(); + let alloc = ecx.machine.allocator.as_ref().unwrap().clone(); #[cfg(not(target_os = "linux"))] // Placeholder value. let alloc = (); // Expose InterpCx for use by closure callbacks. - this.machine.native_lib_ecx_interchange.set(ptr::from_mut(this).expose_provenance()); + ecx.machine.native_lib_ecx_interchange.set(ptr::from_mut(ecx).expose_provenance()); let res = trace::Supervisor::do_ffi(&alloc, || { use libffi::middle::{Arg, Cif, Ret}; @@ -120,7 +120,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { ret.into() }); - this.machine.native_lib_ecx_interchange.set(0); + ecx.machine.native_lib_ecx_interchange.set(0); res } @@ -129,9 +129,9 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { /// if it exists. The function must be in one of the shared object files specified: /// we do *not* return pointers to functions in dependencies of libraries. fn get_func_ptr_explicitly_from_lib(&mut self, link_name: Symbol) -> Option { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); // Try getting the function from one of the shared libraries. - for (lib, lib_path) in &this.machine.native_lib { + for (lib, lib_path) in &ecx.machine.native_lib { let Ok(func): Result, _> = (unsafe { lib.get(link_name.as_str().as_bytes()) }) else { @@ -179,7 +179,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { /// ordered sequentially by when the accesses happened, and the sizes are /// assumed to be exact. fn tracing_apply_accesses(&mut self, events: MemEvents) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); for evt in events.acc_events { let evt_rg = evt.get_range(); @@ -188,11 +188,11 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { let mut rg = evt_rg.addr..evt_rg.end(); while let Some(curr) = rg.next() { let Some(alloc_id) = - this.alloc_id_from_addr(curr.to_u64(), rg.len().try_into().unwrap()) + ecx.alloc_id_from_addr(curr.to_u64(), rg.len().try_into().unwrap()) else { throw_ub_format!("Foreign code did an out-of-bounds access!") }; - let alloc = this.get_alloc_raw(alloc_id)?; + let alloc = ecx.get_alloc_raw(alloc_id)?; // The logical and physical address of the allocation coincide, so we can use // this instead of `addr_from_alloc_id`. let alloc_addr = alloc.get_bytes_unchecked_raw().addr(); @@ -211,17 +211,16 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { match evt { AccessEvent::Read(_) => { // If a provenance was read by the foreign code, expose it. - for (_prov_range, prov) in - alloc.provenance().get_range(overlap.into(), this) + for (_prov_range, prov) in alloc.provenance().get_range(overlap.into(), ecx) { - this.expose_provenance(prov)?; + ecx.expose_provenance(prov)?; } } AccessEvent::Write(_, certain) => { // Sometimes we aren't certain if a write happened, in which case we // only initialise that data if the allocation is mutable. if certain || alloc.mutability.is_mut() { - let (alloc, cx) = this.get_alloc_raw_mut(alloc_id)?; + let (alloc, cx) = ecx.get_alloc_raw_mut(alloc_id)?; alloc.process_native_write( &cx.tcx, Some(AllocRange { @@ -339,23 +338,23 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { } fn ffi_ret_to_mem(&mut self, v: Box<[u8]>, dest: &MPlaceTy<'tcx>) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); let len = v.len(); - this.write_bytes_ptr(dest.ptr(), v)?; + ecx.write_bytes_ptr(dest.ptr(), v)?; if len == 0 { return interp_ok(()); } // We have no idea which provenance these bytes have, so we reset it to wildcard. - let tcx = this.tcx; - let (alloc_id, offset, _) = this.ptr_try_get_alloc_id(dest.ptr(), 0).unwrap(); - let alloc = this.get_alloc_raw_mut(alloc_id)?.0; + let tcx = ecx.tcx; + let (alloc_id, offset, _) = ecx.ptr_try_get_alloc_id(dest.ptr(), 0).unwrap(); + let alloc = ecx.get_alloc_raw_mut(alloc_id)?.0; alloc.process_native_write(&tcx, Some(alloc_range(offset, dest.layout.size))); // Run the validation that would usually be part of `return`, also to reset // any provenance and padding that would not survive the return. - if MiriMachine::enforce_validity(this, dest.layout) { - this.validate_place( + if MiriMachine::enforce_validity(ecx, dest.layout) { + ecx.validate_place( &dest.clone().into(), - MiriMachine::enforce_validity_recursively(this, dest.layout), + MiriMachine::enforce_validity_recursively(ecx, dest.layout), /*reset_provenance_and_padding*/ true, )?; } @@ -369,7 +368,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { adt_def: ty::AdtDef<'tcx>, args: ty::GenericArgs<'tcx>, ) -> Result> { - let this = self.eval_context_ref(); + let ecx = self.eval_context_ref(); // TODO: unions, etc. if !adt_def.is_struct() { return Err(orig_ty); @@ -381,10 +380,9 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { let mut fields = vec![]; for field in &adt_def.non_enum_variant().fields { - let layout = this - .layout_of(field.ty(*this.tcx, args).skip_norm_wip()) - .map_err(|_err| orig_ty)?; - fields.push(this.ty_to_ffitype(layout)?); + let layout = + ecx.layout_of(field.ty(*ecx.tcx, args).skip_norm_wip()).map_err(|_err| orig_ty)?; + fields.push(ecx.ty_to_ffitype(layout)?); } Ok(FfiType::structure(fields)) diff --git a/src/tools/miri/src/shims/readiness.rs b/src/tools/miri/src/shims/readiness.rs index 71a47e9f52a6a..691c3f676284e 100644 --- a/src/tools/miri/src/shims/readiness.rs +++ b/src/tools/miri/src/shims/readiness.rs @@ -455,7 +455,7 @@ pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> { fd: DynFileDescriptionRef, flags: ReadinessUpdateFlags, ) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); let fd_id = fd.id(); let watched = fd.readiness_watched().unwrap(); @@ -463,7 +463,7 @@ pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> { // We capture a vector clock even if there is nobody watching, since someone might get // interested in the future and then synchronize with this event. // FIXME: currently we do this even if the readiness did not change! - this.release_clock(|clock| { + ecx.release_clock(|clock| { watched.ready_clock.borrow_mut().join(clock); })?; } @@ -479,7 +479,7 @@ pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> { let active_readiness = fd.readiness(); for watcher in watchers { - this.update_readiness( + ecx.update_readiness( &watcher, active_readiness, flags.contains(ReadinessUpdateFlags::FORCE_EDGE), @@ -515,7 +515,7 @@ pub trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> { &mut dyn FnMut(ReadinessInterestKey, &mut ReadinessInterest) -> InterpResult<'tcx>, ) -> InterpResult<'tcx>, ) -> InterpResult<'tcx> { - let this = self.eval_context_mut(); + let ecx = self.eval_context_mut(); let mut ready = watcher.ready.borrow_mut(); for_each_interest(&mut |key, interest| { let new_readiness = interest.relevant & active; @@ -544,7 +544,7 @@ pub trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> { && let Some(thread_id) = watcher.queue.borrow_mut().pop_front() { drop(ready); - this.unblock_thread(thread_id, BlockReason::Readiness)?; + ecx.unblock_thread(thread_id, BlockReason::Readiness)?; ready = watcher.ready.borrow_mut(); } interp_ok(()) From e7007d3aaaa6a6ca1bcd95f1f10c9411693a3628 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Nov 2026 11:22:26 +0100 Subject: [PATCH 20/34] interpret: ensure newly created unions have uninit in their padding --- .../rustc_const_eval/src/interpret/step.rs | 14 ++++++-- .../uninit/union-aggregate-init-padding.rs | 34 +++++++++++++++++++ .../union-aggregate-init-padding.stderr | 18 ++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.rs create mode 100644 src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.stderr diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index 25de62f948520..901f1f0655378 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -340,6 +340,16 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { if active_field_index.is_some() { assert_eq!(operands.len(), 1); } + // We generally rely on the `reset_provenance_and_padding` below to ensure that all padding + // is uninit. However, if we are creating a new union, everything outside the initialized + // field should be uninit -- but validity cannot know this as it cannot look into unions. So + // for unions we have to additionally reset everything before writing the fields. + // We skip this for non-unions for two reasons: (a) performance, and (b) to keep assignments + // where LHS and RHS overlap working for scalar types. + if dest.layout.ty.is_union() { + self.write_uninit(dest)?; + } + // Initialize the fields. for (field_index, operand) in operands.iter_enumerated() { let field_index = active_field_index.unwrap_or(field_index); let field_dest = self.project_field(&variant_dest, field_index)?; @@ -347,9 +357,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // We validate manually below so we don't have to do it here. self.copy_op_no_validate(&op, &field_dest, /*allow_transmute*/ false)?; } + // At the end, write the discriminant. self.write_discriminant(variant_index, dest)?; - // Validate that the entire thing is valid, and reset padding that might be in between the - // fields. + // Validate that the entire thing is valid, and reset padding. if M::enforce_validity(self, dest.layout()) { self.validate_place( dest, diff --git a/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.rs b/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.rs new file mode 100644 index 0000000000000..2751e978e9f09 --- /dev/null +++ b/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.rs @@ -0,0 +1,34 @@ +//! Ensure that initalizing an aggregate resets padding to uninit. +//! Regression test for . +#![feature(custom_mir, core_intrinsics)] +#![allow(internal_features, unused)] + +use std::intrinsics::mir::*; + +#[derive(Clone, Copy)] +union U { + a: u8, + b: u32, +} + +#[custom_mir(dialect = "runtime", phase = "optimized")] +fn f() -> u32 { + mir! { + let u: U; + let x: u32; + { + x = 0x01020304_u32; + u = U { b: x }; + // This creates a new union value where `a` is initialized and the remaining bytes + // remain uninitialized. That then gets stored into `u`. As a result, this assignment + // should reset the padding bytes of `U::a` in `u` to uninit. + u = U { a: 9_u8 }; + RET = CastTransmute::(u); //~ERROR: uninitialized + Return() + } + } +} + +fn main() { + f(); +} diff --git a/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.stderr b/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.stderr new file mode 100644 index 0000000000000..575bee4c3652b --- /dev/null +++ b/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.stderr @@ -0,0 +1,18 @@ +error: Undefined Behavior: constructing invalid value of type u32: encountered uninitialized memory, but expected an integer + --> tests/fail/uninit/union-aggregate-init-padding.rs:LL:CC + | +LL | RET = CastTransmute::(u); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here + | + = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior + = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information + = note: stack backtrace: + 0: f + at tests/fail/uninit/union-aggregate-init-padding.rs:LL:CC + 1: main + at tests/fail/uninit/union-aggregate-init-padding.rs:LL:CC + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to 1 previous error + From 98962a2dc5d60ad9d3a9d16153a4199c1185691d Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Nov 2026 19:44:23 +0100 Subject: [PATCH 21/34] statx: explain why we initialize these fields --- src/tools/miri/src/shims/unix/fs.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/miri/src/shims/unix/fs.rs b/src/tools/miri/src/shims/unix/fs.rs index 325be5526e1c2..5d7615b7473d3 100644 --- a/src/tools/miri/src/shims/unix/fs.rs +++ b/src/tools/miri/src/shims/unix/fs.rs @@ -1182,14 +1182,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { ("stx_mask", mask.into()), ("stx_mode", metadata.mode.into()), ("stx_blksize", metadata.blksize.unwrap_or(0).into()), - ("stx_attributes", 0), ("stx_nlink", metadata.nlink.unwrap_or(0).into()), ("stx_uid", metadata.uid.unwrap_or(0).into()), ("stx_gid", metadata.gid.unwrap_or(0).into()), ("stx_ino", metadata.ino.unwrap_or(0).into()), ("stx_size", metadata.size.into()), ("stx_blocks", metadata.blocks.unwrap_or(0).into()), + // These fields do not seem to have a bit in `mask`, they are "always present", + // so we make sure they get initialized. ("stx_attributes_mask", 0), + ("stx_attributes", 0), ("stx_rdev_major", 0), ("stx_rdev_minor", 0), ("stx_dev_major", 0), @@ -1230,6 +1232,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { &this.project_field_named(&statxbuf, "stx_mtime")?, )?; + // The remaining fields have a mask bit associated with them, a bit that we do not + // set. Therefore we also do not initialize them. + interp_ok(Scalar::from_i32(0)) } From 3cf3c878a2fb6e3667187622096d944190eda03a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 29 Oct 2026 10:31:31 +0100 Subject: [PATCH 22/34] std Miri testing: use skip_unsupported_miri_tests to control when tests should be skipped in Miri due to missing shims --- library/std/Cargo.toml | 2 ++ library/std/src/fs/tests.rs | 3 ++- library/std/src/net/socket_addr/tests.rs | 2 ++ library/std/src/net/tcp/tests.rs | 4 ++++ library/std/src/net/tests.rs | 1 + library/std/src/net/udp/tests.rs | 2 ++ library/std/src/os/darwin/fs/dirs.rs | 1 + library/std/src/os/fd/owned.rs | 2 +- library/std/src/os/net/linux_ext/tests.rs | 2 ++ library/std/src/os/unix/fs/tests.rs | 2 ++ library/std/src/os/unix/net/tests.rs | 2 ++ library/std/src/os/windows/fs/dirs.rs | 1 + library/std/src/process/tests.rs | 2 ++ library/std/src/sys/fs/windows/tests.rs | 2 ++ .../src/sys/net/connection/socket/tests.rs | 2 ++ library/std/src/sys/pal/unix/conf/tests.rs | 1 + .../src/sys/platform_version/darwin/tests.rs | 2 ++ .../std/src/sys/process/unix/common/tests.rs | 2 ++ .../std/src/sys/process/unix/pidfd/tests.rs | 2 ++ .../std/src/sys/process/unix/unix/tests.rs | 2 ++ library/std/src/sys/process/windows/tests.rs | 2 ++ library/std/tests/create_dir_all_bare.rs | 2 +- library/std/tests/env_modify.rs | 5 ++-- library/std/tests/pipe_subprocess.rs | 2 +- library/std/tests/process_spawning.rs | 2 +- library/std/tests/switch-stdout.rs | 2 +- library/std/tests/thread.rs | 2 +- library/std/tests/thread_local/tests.rs | 2 +- library/std/tests/win_delete_self.rs | 2 +- library/std/tests/windows_unix_socket.rs | 2 +- src/bootstrap/mk/Makefile.in | 23 +++++++------------ .../test-x86_64-gnu-miri/check-miri.sh | 5 ++-- .../miri/src/shims/windows/foreign_items.rs | 8 +++++++ src/tools/miri/tests/pass/shims/io.rs | 3 ++- 34 files changed, 71 insertions(+), 30 deletions(-) diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 2f21b78352abb..6248f3c79fb57 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -166,6 +166,8 @@ check-cfg = [ 'cfg(target_has_reliable_f16_math)', 'cfg(target_has_reliable_f128)', 'cfg(target_has_reliable_f128_math)', + # Controlling which tests we run in Miri. + 'cfg(skip_unsupported_miri_tests)', ] [lints.cargo] diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index 01977792b5751..82e1441e59462 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // fs API support in Miri is quite spotty + use rand::RngCore; use super::Dir; @@ -2567,7 +2569,6 @@ fn test_eq_windows_file_type() { /// Regression test for https://github.com/rust-lang/rust/issues/50619. #[test] #[cfg(target_os = "linux")] -#[cfg_attr(miri, ignore)] // Cannot spawn processes on Miri fn test_read_dir_infinite_loop() { use crate::io::ErrorKind; use crate::process::Command; diff --git a/library/std/src/net/socket_addr/tests.rs b/library/std/src/net/socket_addr/tests.rs index 2f3e3add5c22d..3eedb86b1650c 100644 --- a/library/std/src/net/socket_addr/tests.rs +++ b/library/std/src/net/socket_addr/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows + use crate::net::tests::{sa4, sa6, tsa}; use crate::net::*; diff --git a/library/std/src/net/tcp/tests.rs b/library/std/src/net/tcp/tests.rs index 9aeddff864918..de62bd66c5c74 100644 --- a/library/std/src/net/tcp/tests.rs +++ b/library/std/src/net/tcp/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows + use rand::Rng; use crate::io::prelude::*; @@ -898,6 +900,7 @@ fn ttl() { #[test] #[cfg_attr(target_env = "sgx", ignore)] #[cfg(any(target_family = "unix", target_os = "windows"))] +#[cfg(not(skip_unsupported_miri_tests))] // socket flag not supported by Miri fn hop_limit() { let hlim = 100; @@ -979,6 +982,7 @@ fn connect_timeout_valid() { // macOS with `EINVAL`; `write_all` should now transfer it via short sends. #[test] #[cfg(all(target_pointer_width = "64", unix))] +#[cfg(not(skip_unsupported_miri_tests))] // read-only mmap not supported by Miri fn write_buffer_larger_than_c_int_max() { const LEN: usize = crate::ffi::c_int::MAX as usize + 1; diff --git a/library/std/src/net/tests.rs b/library/std/src/net/tests.rs index 213c9a5a3e3a1..f07a7f6e8894a 100644 --- a/library/std/src/net/tests.rs +++ b/library/std/src/net/tests.rs @@ -88,6 +88,7 @@ impl Drop for ZeroedMmap { } #[test] +#[cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows fn hostname_smoketest() { // Just a smoke test to ensure it can be called. let name = crate::net::hostname(); diff --git a/library/std/src/net/udp/tests.rs b/library/std/src/net/udp/tests.rs index 6296e07044c55..f5dd0464f430b 100644 --- a/library/std/src/net/udp/tests.rs +++ b/library/std/src/net/udp/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // UDP sockets are not supported in Miri + use crate::io::ErrorKind; use crate::net::tests::{LOCALHOST_IP4, LOCALHOST_IP6, compare_ignore_zoneid}; use crate::net::*; diff --git a/library/std/src/os/darwin/fs/dirs.rs b/library/std/src/os/darwin/fs/dirs.rs index 6aaa910981b0b..d5d1449d9973b 100644 --- a/library/std/src/os/darwin/fs/dirs.rs +++ b/library/std/src/os/darwin/fs/dirs.rs @@ -291,6 +291,7 @@ mod sys { #[cfg(test)] #[cfg(target_vendor = "apple")] +#[cfg(not(skip_unsupported_miri_tests))] // macOS sysdir APIs are not supported in Miri mod tests { use super::*; diff --git a/library/std/src/os/fd/owned.rs b/library/std/src/os/fd/owned.rs index fa775a9373427..594de872a17de 100644 --- a/library/std/src/os/fd/owned.rs +++ b/library/std/src/os/fd/owned.rs @@ -94,7 +94,7 @@ impl BorrowedFd<'_> { /// Converts a `BorrowedFd` into a reference to a file-like type. /// - #[cfg_attr(all(unix, not(miri)), doc = "```")] + #[cfg_attr(unix, doc = "```")] #[cfg_attr(not(unix), doc = "```ignore (needs unix)")] /// # #![feature(fd_view)] /// # use std::fs::File; diff --git a/library/std/src/os/net/linux_ext/tests.rs b/library/std/src/os/net/linux_ext/tests.rs index a63524e63b6d8..e76cc1e44d7f5 100644 --- a/library/std/src/os/net/linux_ext/tests.rs +++ b/library/std/src/os/net/linux_ext/tests.rs @@ -1,4 +1,5 @@ #[test] +#[cfg(not(skip_unsupported_miri_tests))] // socket flag not supported by Miri fn quickack() { use crate::net::tests::LOCALHOST_IP4; use crate::net::{TcpListener, TcpStream}; @@ -28,6 +29,7 @@ fn quickack() { #[test] #[cfg(target_os = "linux")] +#[cfg(not(skip_unsupported_miri_tests))] // socket flag not supported by Miri fn deferaccept() { use crate::net::tests::LOCALHOST_IP4; use crate::net::{TcpListener, TcpStream}; diff --git a/library/std/src/os/unix/fs/tests.rs b/library/std/src/os/unix/fs/tests.rs index 52e0fe940a81f..3b7b0ef0ce0ba 100644 --- a/library/std/src/os/unix/fs/tests.rs +++ b/library/std/src/os/unix/fs/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // fs API support in Miri is quite spotty + use super::*; #[test] diff --git a/library/std/src/os/unix/net/tests.rs b/library/std/src/os/unix/net/tests.rs index 4014767461389..d310aa81db3e5 100644 --- a/library/std/src/os/unix/net/tests.rs +++ b/library/std/src/os/unix/net/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // Unix domain sockets are not supported in Miri + use super::*; use crate::io::prelude::*; use crate::io::{self, ErrorKind, IoSlice, IoSliceMut}; diff --git a/library/std/src/os/windows/fs/dirs.rs b/library/std/src/os/windows/fs/dirs.rs index 52710375e6eb2..56cf055d3299b 100644 --- a/library/std/src/os/windows/fs/dirs.rs +++ b/library/std/src/os/windows/fs/dirs.rs @@ -287,6 +287,7 @@ mod sys { } #[cfg(test)] +#[cfg(not(skip_unsupported_miri_tests))] // Windows known directory APIs are not supported in Miri mod tests { use super::*; diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs index e31cb002c0265..ecb42906e8ca8 100644 --- a/library/std/src/process/tests.rs +++ b/library/std/src/process/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // process spawning is not supported in Miri + use super::{Command, Output, Stdio}; use crate::io::prelude::*; use crate::io::{BorrowedBuf, ErrorKind}; diff --git a/library/std/src/sys/fs/windows/tests.rs b/library/std/src/sys/fs/windows/tests.rs index b53dfddecf627..dc57598d8984d 100644 --- a/library/std/src/sys/fs/windows/tests.rs +++ b/library/std/src/sys/fs/windows/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // Windows fs APIs are not supported in Miri + use super::{get_path_canonical, get_path_fallback}; use crate::env; use crate::fs::{File, canonicalize}; diff --git a/library/std/src/sys/net/connection/socket/tests.rs b/library/std/src/sys/net/connection/socket/tests.rs index cc072420b754b..d1c001d9d424d 100644 --- a/library/std/src/sys/net/connection/socket/tests.rs +++ b/library/std/src/sys/net/connection/socket/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows + use super::*; use crate::collections::HashMap; diff --git a/library/std/src/sys/pal/unix/conf/tests.rs b/library/std/src/sys/pal/unix/conf/tests.rs index a84086037ce0b..76aed1c6e608b 100644 --- a/library/std/src/sys/pal/unix/conf/tests.rs +++ b/library/std/src/sys/pal/unix/conf/tests.rs @@ -26,6 +26,7 @@ fn test_parse_glibc_version() { // logic is correct. #[test] #[cfg(target_vendor = "apple")] +#[cfg(not(skip_unsupported_miri_tests))] // macOS conf API is not supported in Miri fn test_confstr() { for key in [libc::_CS_DARWIN_USER_TEMP_DIR, libc::_CS_PATH] { let value_nohint = super::confstr(key, None).unwrap_or_else(|e| { diff --git a/library/std/src/sys/platform_version/darwin/tests.rs b/library/std/src/sys/platform_version/darwin/tests.rs index 17b2cc18ec096..24895c73bf3d6 100644 --- a/library/std/src/sys/platform_version/darwin/tests.rs +++ b/library/std/src/sys/platform_version/darwin/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // macOS version APIs are not supported in Miri + use super::public_extern::*; use super::*; use crate::process::Command; diff --git a/library/std/src/sys/process/unix/common/tests.rs b/library/std/src/sys/process/unix/common/tests.rs index eacb4d2d43122..c652488d0570b 100644 --- a/library/std/src/sys/process/unix/common/tests.rs +++ b/library/std/src/sys/process/unix/common/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // process spawning is not supported in Miri + use super::*; use crate::ffi::OsStr; use crate::sys::{cvt, cvt_nz}; diff --git a/library/std/src/sys/process/unix/pidfd/tests.rs b/library/std/src/sys/process/unix/pidfd/tests.rs index 4cc2368c25a22..97578eea370f3 100644 --- a/library/std/src/sys/process/unix/pidfd/tests.rs +++ b/library/std/src/sys/process/unix/pidfd/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // pidfd is not supported in Miri + use super::PidFd as InternalPidFd; use crate::assert_matches; use crate::os::fd::AsRawFd; diff --git a/library/std/src/sys/process/unix/unix/tests.rs b/library/std/src/sys/process/unix/unix/tests.rs index e360b61851b2e..22b65bae4a6dc 100644 --- a/library/std/src/sys/process/unix/unix/tests.rs +++ b/library/std/src/sys/process/unix/unix/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // process spawning is not supported in Miri + use crate::os::unix::process::{CommandExt, ExitStatusExt}; use crate::panic::catch_unwind; use crate::process::Command; diff --git a/library/std/src/sys/process/windows/tests.rs b/library/std/src/sys/process/windows/tests.rs index bc5e0d5c7fc97..22b5334c76472 100644 --- a/library/std/src/sys/process/windows/tests.rs +++ b/library/std/src/sys/process/windows/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // process spawning is not supported in Miri + use super::child_pipe::{Pipes, child_pipe}; use super::{Arg, make_command_line}; use crate::ffi::{OsStr, OsString}; diff --git a/library/std/tests/create_dir_all_bare.rs b/library/std/tests/create_dir_all_bare.rs index 30f800c5aa2e6..c3e91b8c613c8 100644 --- a/library/std/tests/create_dir_all_bare.rs +++ b/library/std/tests/create_dir_all_bare.rs @@ -31,7 +31,7 @@ impl Drop for CurrentDir { } #[test] -#[cfg_attr(all(miri, windows), ignore)] // File system access on Windows not supported by Miri +#[cfg_attr(all(windows, skip_unsupported_miri_tests), ignore)] // File system access on Windows not supported by Miri fn create_dir_all_bare() { let tmpdir = common::tmpdir(); CurrentDir::with(tmpdir.path(), || { diff --git a/library/std/tests/env_modify.rs b/library/std/tests/env_modify.rs index 71d15bc1c47c0..9eefe0cc25126 100644 --- a/library/std/tests/env_modify.rs +++ b/library/std/tests/env_modify.rs @@ -179,8 +179,9 @@ fn env_home_dir() { } } -#[test] // miri shouldn't detect any data race in this fn -#[cfg_attr(any(not(miri), target_os = "emscripten"), ignore)] +// This is primarily a Miri test (ensuring there are no data races), but can also run natively. +#[test] +#[cfg_attr(target_os = "emscripten", ignore)] fn test_env_get_set_multithreaded() { let getter = thread::spawn(|| { for _ in 0..100 { diff --git a/library/std/tests/pipe_subprocess.rs b/library/std/tests/pipe_subprocess.rs index c14db690224db..35ad327ef4f48 100644 --- a/library/std/tests/pipe_subprocess.rs +++ b/library/std/tests/pipe_subprocess.rs @@ -1,7 +1,7 @@ fn main() { // No `Command` on Miri, emscripten or L4Re #[cfg(all( - not(miri), + not(skip_unsupported_miri_tests), any(unix, windows), not(any(target_os = "emscripten", target_os = "l4re")) ))] diff --git a/library/std/tests/process_spawning.rs b/library/std/tests/process_spawning.rs index b7a9a1077696b..e634ee5155eab 100644 --- a/library/std/tests/process_spawning.rs +++ b/library/std/tests/process_spawning.rs @@ -6,7 +6,7 @@ mod common; #[test] // Process spawning not supported by Miri, Emscripten and wasi -#[cfg_attr(any(miri, target_os = "emscripten", target_os = "wasi"), ignore)] +#[cfg_attr(any(skip_unsupported_miri_tests, target_os = "emscripten", target_os = "wasi"), ignore)] #[cfg_attr( any(target_os = "tvos", target_os = "watchos", target_os = "l4re"), ignore = "fork is prohibited" diff --git a/library/std/tests/switch-stdout.rs b/library/std/tests/switch-stdout.rs index 91fe0200f6cae..829909bc364d0 100644 --- a/library/std/tests/switch-stdout.rs +++ b/library/std/tests/switch-stdout.rs @@ -50,7 +50,7 @@ fn switch_stdout_to(file: OwnedHandle) -> OwnedHandle { } #[test] -#[cfg_attr(miri, ignore)] // dup/SetStdHandle not supported by Miri +#[cfg_attr(all(windows, skip_unsupported_miri_tests), ignore)] // SetStdHandle not supported by Miri fn switch_stdout() { let temp = common::tmpdir(); let path = temp.join("switch-stdout-output"); diff --git a/library/std/tests/thread.rs b/library/std/tests/thread.rs index ef13ce44d3180..433b804952694 100644 --- a/library/std/tests/thread.rs +++ b/library/std/tests/thread.rs @@ -6,7 +6,7 @@ use std::time::{Duration, Instant}; #[test] #[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads -#[cfg_attr(miri, ignore)] // Miri does not like the thread leak +#[cfg_attr(miri, ignore)] // Test leaks memory; a copy in the Miri test suite covers this fn sleep_very_long() { let finished = Arc::new(Mutex::new(false)); let t_finished = finished.clone(); diff --git a/library/std/tests/thread_local/tests.rs b/library/std/tests/thread_local/tests.rs index c2164a0bc2cff..734437585efcb 100644 --- a/library/std/tests/thread_local/tests.rs +++ b/library/std/tests/thread_local/tests.rs @@ -403,7 +403,7 @@ fn thread_current_in_dtor() { // https://github.com/rust-lang/rust/pull/148799#issuecomment-3731806901 #[cfg(target_os = "windows")] #[test] -#[cfg_attr(miri, ignore)] // Miri does not support fibers +#[cfg_attr(skip_unsupported_miri_tests, ignore)] // Miri does not support fibers fn fiber_does_not_trigger_dtor() { use core::ffi::c_void; use std::ptr; diff --git a/library/std/tests/win_delete_self.rs b/library/std/tests/win_delete_self.rs index ce505de69a22d..1b4e95174664b 100644 --- a/library/std/tests/win_delete_self.rs +++ b/library/std/tests/win_delete_self.rs @@ -2,7 +2,7 @@ /// Attempting to delete a running binary should return an error on Windows. #[test] -#[cfg_attr(miri, ignore)] // `remove_file` does not work in Miri on Windows +#[cfg_attr(skip_unsupported_miri_tests, ignore)] // `remove_file` does not work in Miri on Windows fn win_delete_self() { let path = std::env::current_exe().unwrap(); assert!(std::fs::remove_file(path).is_err()); diff --git a/library/std/tests/windows_unix_socket.rs b/library/std/tests/windows_unix_socket.rs index dd71b1f135dce..865794361eabb 100644 --- a/library/std/tests/windows_unix_socket.rs +++ b/library/std/tests/windows_unix_socket.rs @@ -1,5 +1,5 @@ #![cfg(windows)] -#![cfg(not(miri))] // no Windows socket support in Miri +#![cfg(not(skip_unsupported_miri_tests))] // no Windows socket support in Miri #![feature(windows_unix_domain_sockets)] // Now only test windows_unix_domain_sockets feature // in the future, will test both unix and windows uds diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index 886966fdd496e..07412657f8687 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -58,13 +58,13 @@ check-aux: $(Q)$(BOOTSTRAP) test --stage 2 \ build-std \ $(BOOTSTRAP_ARGS) - # Run standard library tests in Miri. + ## Run standard library tests in Miri. $(Q)MIRIFLAGS="-Zmiri-strict-provenance" \ $(BOOTSTRAP) miri --stage 2 \ library/core \ library/alloc \ $(BOOTSTRAP_ARGS) \ - --tests # exclude doc tests + --tests # exclude doc tests, they are run below # Some doctests use file system operations to demonstrate dealing with `Result`, # so we have to run them with isolation disabled. $(Q)MIRIFLAGS="-Zmiri-disable-isolation" \ @@ -73,22 +73,15 @@ check-aux: library/alloc \ $(BOOTSTRAP_ARGS) \ --doc - # In `std` we cannot test everything, so we skip some modules. - $(Q)MIRIFLAGS="-Zmiri-disable-isolation" \ - $(BOOTSTRAP) miri --stage 2 \ - library/std \ - $(BOOTSTRAP_ARGS) \ - -- \ - --skip fs:: --skip net:: --skip process:: --skip sys:: - # Also test some very target-specific modules on other targets - # (making sure to cover an i686 target as well). - $(Q)MIRIFLAGS="-Zmiri-disable-isolation" BOOTSTRAP_SKIP_TARGET_SANITY=1 \ + # In `std` we cannot test everything. Tests should be disabled under `skip_unsupported_miri_tests`. + # We cover all three tier 1 architectures and operating systems. + $(Q)MIRIFLAGS="--cfg skip_unsupported_miri_tests -Zmiri-disable-isolation -Zmiri-no-short-fd-operations" \ + BOOTSTRAP_SKIP_TARGET_SANITY=1 \ $(BOOTSTRAP) miri --stage 2 \ library/std \ - --target aarch64-apple-darwin,i686-pc-windows-msvc \ $(BOOTSTRAP_ARGS) \ - -- \ - time:: sync:: thread:: env:: + --target x86_64-unknown-linux-gnu,aarch64-apple-darwin,i686-pc-windows-msvc \ + --tests # skip all doctests, they are not using skip_unsupported_miri_tests dist: $(Q)$(BOOTSTRAP) dist $(BOOTSTRAP_ARGS) distcheck: diff --git a/src/ci/docker/host-x86_64/test-x86_64-gnu-miri/check-miri.sh b/src/ci/docker/host-x86_64/test-x86_64-gnu-miri/check-miri.sh index d6fae3ac9d94f..da9797d05495e 100755 --- a/src/ci/docker/host-x86_64/test-x86_64-gnu-miri/check-miri.sh +++ b/src/ci/docker/host-x86_64/test-x86_64-gnu-miri/check-miri.sh @@ -46,12 +46,13 @@ case $HOST_TARGET in exit 1 ;; esac + # Also smoke-test `x.py miri`. This doesn't run any actual tests (that would take too long), # but it ensures that the crates build properly when tested with Miri. - #FIXME: Re-enable this for msvc once CI issues are fixed if [ "$HOST_TARGET" != "x86_64-pc-windows-msvc" ]; then python3 "$X_PY" miri --stage 2 library/core -- notest python3 "$X_PY" miri --stage 2 library/alloc -- notest - python3 "$X_PY" miri --stage 2 library/std -- notest + # This runs some tests that don't use a test harness and hence ignore the filter. + MIRIFLAGS="--cfg skip_unsupported_miri_tests" python3 "$X_PY" miri --stage 2 library/std -- notest fi diff --git a/src/tools/miri/src/shims/windows/foreign_items.rs b/src/tools/miri/src/shims/windows/foreign_items.rs index efaf79af02e88..7e5f545bffbfb 100644 --- a/src/tools/miri/src/shims/windows/foreign_items.rs +++ b/src/tools/miri/src/shims/windows/foreign_items.rs @@ -1214,6 +1214,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // We need to return something non-null here to make `compat_fn!` work. ecx.write_int(1, dest)?; } + "GetModuleHandleW" if ecx.frame_in_std() => { + let [_module_name] = &ecx.check_shim_sig( + shim_sig!(extern "system" fn(*_) -> winapi::HMODULE), + (link_name, abi, args), + )?; + // Returning null works best for `format_error`. + ecx.write_int(0, dest)?; + } "SetConsoleTextAttribute" if ecx.frame_in_std() => { let [_console_output, _attribute] = &ecx.check_shim_sig( shim_sig!(extern "system" fn(winapi::HANDLE, u16) -> winapi::BOOL), diff --git a/src/tools/miri/tests/pass/shims/io.rs b/src/tools/miri/tests/pass/shims/io.rs index a96b98c022746..554ee2dd0cee1 100644 --- a/src/tools/miri/tests/pass/shims/io.rs +++ b/src/tools/miri/tests/pass/shims/io.rs @@ -12,7 +12,8 @@ fn main() { let raw_os_error = if cfg!(unix) { 22 // EINVAL (on most Unixes, anyway) } else if cfg!(windows) { - 87 // ERROR_INVALID_PARAMETER + // FACILITY_NT_BIT hits an extra codepath in std + 87 | 268435456 // ERROR_INVALID_PARAMETER | FACILITY_NT_BIT } else { panic!("unsupported OS") }; From f64ebf2c04743ca6663c404615e49b864f9663a2 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Sun, 8 Nov 2026 23:24:06 +0100 Subject: [PATCH 23/34] windows: check for null before wide encoding Only a `\0` byte in an OsStr becomes a WTF16 NUL, so we can check before converting instead of after. For `to_u16s`, this up to halves the amount of memory being scanned, and it can use the optimized memchr [u8] path. For `ensure_no_nuls` the same applies, and this additionally skips a duplicated WTF8->WTF16 conversion: all but one call to it is followed by `encode_wide` anyway. --- library/std/src/sys/pal/windows/mod.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/library/std/src/sys/pal/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs index a9f3cdbdd9d3e..0f79a4b09000e 100644 --- a/library/std/src/sys/pal/windows/mod.rs +++ b/library/std/src/sys/pal/windows/mod.rs @@ -90,19 +90,19 @@ pub fn unrolled_find_u16s(needle: u16, haystack: &[u16]) -> Option { pub fn to_u16s>(s: S) -> io::Result> { fn inner(s: &OsStr) -> io::Result> { + if s.as_encoded_bytes().contains(&0) { + return Err(io::const_error!( + io::ErrorKind::InvalidInput, + "strings passed to WinAPI cannot contain NULs", + )); + } + // Most paths are ASCII, so reserve capacity for as much as there are bytes // in the OsStr plus one for the null-terminating character. We are not // wasting bytes here as paths created by this function are primarily used // in an ephemeral fashion. let mut maybe_result = Vec::with_capacity(s.len() + 1); maybe_result.extend(s.encode_wide()); - - if unrolled_find_u16s(0, &maybe_result).is_some() { - return Err(io::const_error!( - io::ErrorKind::InvalidInput, - "strings passed to WinAPI cannot contain NULs", - )); - } maybe_result.push(0); Ok(maybe_result) } @@ -207,7 +207,7 @@ pub fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] { } pub fn ensure_no_nuls>(s: T) -> io::Result { - if s.as_ref().encode_wide().any(|b| b == 0) { + if s.as_ref().as_encoded_bytes().contains(&0) { Err(io::const_error!(io::ErrorKind::InvalidInput, "nul byte found in provided data")) } else { Ok(s) From 0aa6251e6553cac8045f7502bcd4cd815887970f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 8 Nov 2026 19:30:10 +0100 Subject: [PATCH 24/34] Unignore passing GCC backend tests --- tests/ui/abi/abi-sysv64-arg-passing.rs | 1 - tests/ui/abi/abi-sysv64-register-usage.rs | 1 - tests/ui/abi/arm-unadjusted-intrinsic.rs | 1 - tests/ui/abi/avr-sram.rs | 1 - tests/ui/abi/compatibility.rs | 1 - .../homogenous-floats-target-feature-mixup.rs | 1 - .../ui/abi/interrupt-returns-never-or-unit.rs | 1 - tests/ui/abi/issue-28676.rs | 1 - tests/ui/abi/large-byval-align.rs | 1 - .../ui/abi/numbers-arithmetic/float-struct.rs | 1 - tests/ui/abi/pass-indirectly-attr.rs | 1 - tests/ui/abi/pass-indirectly-attr.stderr | 6 +- tests/ui/abi/s390x-softfloat-gate.rs | 1 - tests/ui/abi/segfault-no-out-of-stack.rs | 1 - .../shadow-call-stack-without-fixed-x18.rs | 1 - tests/ui/abi/stack-probes.rs | 1 - tests/ui/abi/stack-protector.rs | 1 - tests/ui/abi/struct-enums/struct-return.rs | 1 - tests/ui/abi/swift-abi-non-apple.rs | 1 - tests/ui/abi/swift-abi-non-apple.stderr | 14 +-- tests/ui/abi/variadic-ffi.rs | 1 - tests/ui/abi/x86stdcall.rs | 1 - .../no_std-alloc-error-handler-custom.rs | 1 - .../no_std-alloc-error-handler-default.rs | 1 - .../array-slice-vec/box-of-array-of-drop-1.rs | 1 - .../array-slice-vec/box-of-array-of-drop-2.rs | 1 - tests/ui/array-slice-vec/nested-vec-3.rs | 1 - tests/ui/array-slice-vec/slice-panic-1.rs | 1 - tests/ui/array-slice-vec/slice-panic-2.rs | 1 - tests/ui/asm/aarch64/aarch64-sve.rs | 1 - tests/ui/asm/aarch64/ttbr0_el2.rs | 1 - tests/ui/asm/aarch64v8r.rs | 1 - tests/ui/asm/arm-low-dreg.rs | 1 - tests/ui/asm/cortex-r82.rs | 1 - tests/ui/asm/global-target-feature.rs | 1 - tests/ui/asm/issue-92378.rs | 1 - tests/ui/asm/naked-functions/shim.rs | 1 - tests/ui/asm/thumbv6m-clobber-abi-r14.rs | 1 - tests/ui/asm/x86_64/issue-96797.rs | 1 - ...ont-project-to-specializable-projection.rs | 1 - ...project-to-specializable-projection.stderr | 8 +- tests/ui/attributes/main-removed-2/main.rs | 1 - tests/ui/backtrace/dylib-dep.rs | 1 - .../backtrace/synchronized-panic-handler.rs | 1 - .../synchronized-panic-handler.run.stderr | 4 +- tests/ui/c-variadic/copy.rs | 1 - tests/ui/c-variadic/inherent-method.rs | 1 - tests/ui/c-variadic/naked-invalid.rs | 1 - tests/ui/c-variadic/naked-invalid.stderr | 6 +- tests/ui/c-variadic/roundtrip.rs | 1 - tests/ui/c-variadic/trait-method.rs | 1 - tests/ui/c-variadic/valid.rs | 1 - .../assume-incomplete.rs | 1 - tests/ui/cfg/cfg-panic-abort.rs | 1 - tests/ui/cfg/cfg_target_object_format.rs | 1 - tests/ui/check-cfg/values-target-json.rs | 1 - .../callback-as-argument.rs | 1 - .../cmse-nonsecure-call/via-registers.rs | 1 - .../cmse-nonsecure-entry/via-registers.rs | 1 - .../custom-target-invalid-llvm-target.rs | 1 - tests/ui/codegen/mismatched-data-layouts.rs | 1 - tests/ui/codegen/passes-default-pipeline.rs | 1 - tests/ui/codegen/target-cpus.rs | 1 - .../function-return/requires-x86-or-x86_64.rs | 1 - .../requires-x86-or-x86_64.rs | 1 - .../invalid/reg-struct-return/requires-x86.rs | 1 - .../invalid/regparm/regparm-valid-values.rs | 1 - .../invalid/regparm/requires-x86.rs | 1 - .../print-request-help-stable-unstable.rs | 1 - ...t-destruct-stable-toolchain.nightly.stderr | 2 +- .../consts/const-destruct-stable-toolchain.rs | 1 - ...st-destruct-stable-toolchain.stable.stderr | 2 +- tests/ui/consts/const-eval/c-variadic.rs | 1 - tests/ui/consts/const-eval/parse_ints.rs | 2 - tests/ui/consts/const-eval/parse_ints.stderr | 4 +- tests/ui/consts/const_cmp_type_id.rs | 1 - tests/ui/consts/const_cmp_type_id.stderr | 2 +- tests/ui/consts/issue-73976-monomorphic.rs | 1 - tests/ui/consts/issue-94675.rs | 2 - tests/ui/consts/issue-94675.stderr | 2 +- tests/ui/consts/issue-miri-1910.rs | 1 - tests/ui/consts/issue-miri-1910.stderr | 2 +- tests/ui/consts/missing_span_in_backtrace.rs | 1 - .../consts/missing_span_in_backtrace.stderr | 14 +-- tests/ui/consts/try-operator.rs | 1 - tests/ui/coroutine/gen_block_panic.rs | 1 - tests/ui/coroutine/gen_block_panic.stderr | 2 +- tests/ui/coroutine/panic-drops-resume.rs | 1 - tests/ui/coroutine/panic-drops.rs | 1 - tests/ui/coroutine/panic-safe.rs | 1 - tests/ui/coroutine/resume-after-return.rs | 1 - tests/ui/coroutine/unwind-abort-mix.rs | 1 - .../ui/crate-loading/missing-target-error.rs | 1 - .../missing-target-no-std-error.rs | 1 - .../mut-ref-write-visible-after-unwind.rs | 1 - .../windows_gnu_split_debuginfo_off.rs | 1 - .../windows_gnu_split_debuginfo_packed.rs | 1 - .../windows_gnu_split_debuginfo_unpacked.rs | 1 - tests/ui/delegation/fn-header-variadic.rs | 1 - tests/ui/delegation/fn-header-variadic.stderr | 4 +- tests/ui/delegation/fn-header.rs | 1 - tests/ui/drop/drop-once-on-panic.rs | 1 - tests/ui/drop/drop-trait-enum.rs | 1 - tests/ui/drop/dynamic-drop-async.rs | 1 - tests/ui/drop/dynamic-drop.rs | 1 - tests/ui/drop/enum-destructor-on-unwind.rs | 1 - tests/ui/drop/move-closure-drop-on-unwind.rs | 1 - tests/ui/drop/panic-during-drop-14875.rs | 1 - tests/ui/drop/panic-during-slice-init.rs | 1 - tests/ui/drop/terminate-in-initializer.rs | 1 - .../explicit-tail-calls/become-cast-return.rs | 1 - .../callee_is_track_caller.rs | 1 - .../callee_is_track_caller.stderr | 2 +- .../callee_is_track_caller_polymorphic.rs | 1 - .../callee_is_track_caller_polymorphic.stderr | 2 +- .../default-trait-method.rs | 1 - tests/ui/explicit-tail-calls/drop-order.rs | 1 - tests/ui/explicit-tail-calls/indexer.rs | 1 - tests/ui/explicit-tail-calls/recursion-etc.rs | 1 - tests/ui/explicit-tail-calls/support/basic.rs | 1 - tests/ui/extern/extern-types-field-offset.rs | 1 - ...at-args-capture-from-pm-first-arg-macro.rs | 1 - ...rgs-capture-from-pm-first-arg-macro.stderr | 2 +- .../location-proc-macro-observer.rs | 1 - .../issue-77523-def-site-async-await.rs | 1 - .../precise-capturing/external-macro.rs | 1 - tests/ui/instrument-xray/platform-support.rs | 1 - .../intrinsics/panic-uninitialized-zeroed.rs | 1 - .../iter-filter-count-debug-check.rs | 1 - tests/ui/iterators/iter-sum-overflow-debug.rs | 1 - .../iter-sum-overflow-overflow-checks.rs | 1 - .../ui/linking/no-gc-encapsulation-symbols.rs | 1 - ...nused-qualification-in-derive-expansion.rs | 1 - tests/ui/macros/same-sequence-span.rs | 1 - tests/ui/macros/same-sequence-span.stderr | 8 +- tests/ui/mir/mir_drop_order.rs | 1 - tests/ui/mir/mir_let_chains_drop_order.rs | 1 - .../mir_match_guard_let_chains_drop_order.rs | 1 - .../ui/numbers-arithmetic/int-abs-overflow.rs | 1 - tests/ui/numbers-arithmetic/issue-8460.rs | 1 - .../catch-unwind-during-unwind-68696.rs | 1 - .../abort-link-to-unwinding-crates.rs | 1 - tests/ui/panic-runtime/abort.rs | 1 - tests/ui/panic-runtime/link-to-abort.rs | 1 - tests/ui/panics/alloc_error_hook-unwind.rs | 1 - tests/ui/panics/lsda-multiple-action.rs | 1 - ...panic-abort-backtrace-without-debuginfo.rs | 1 - .../panics/panic-handler-chain-update-hook.rs | 1 - tests/ui/panics/panic-handler-chain.rs | 1 - tests/ui/panics/panic-handler-flail-wildly.rs | 1 - tests/ui/panics/panic-handler-set-twice.rs | 1 - tests/ui/panics/panic-in-dtor-drops-fields.rs | 1 - tests/ui/panics/panic-recover-propagate.rs | 1 - .../panics/rvalue-cleanup-during-box-panic.rs | 1 - .../panics/unwind-force-no-unwind-tables.rs | 1 - ...971-outer-attr-following-inner-attr-ice.rs | 1 - ...outer-attr-following-inner-attr-ice.stderr | 2 +- .../unicode-control-codepoints-macros.rs | 1 - .../unicode-control-codepoints-macros.stderr | 10 +- .../parser/tuple-index-suffix-proc-macro.rs | 1 - .../tuple-index-suffix-proc-macro.stderr | 8 +- tests/ui/parser/unclosed-delimiter-in-dep.rs | 2 - ...nable_pointer_authentication_validation.rs | 1 - .../invalid_target_pointer_authentication.rs | 1 - ...on_not_supported_pointer_authentication.rs | 1 - tests/ui/proc-macro/add-impl.rs | 1 - .../ambiguous-builtin-attrs-test.rs | 1 - .../ambiguous-builtin-attrs-test.stderr | 2 +- .../ui/proc-macro/ambiguous-builtin-attrs.rs | 1 - .../proc-macro/ambiguous-builtin-attrs.stderr | 30 ++--- tests/ui/proc-macro/append-impl.rs | 1 - tests/ui/proc-macro/attr-args.rs | 1 - tests/ui/proc-macro/attr-invalid-exprs.rs | 1 - tests/ui/proc-macro/attr-invalid-exprs.stderr | 6 +- tests/ui/proc-macro/attr-on-trait.rs | 1 - tests/ui/proc-macro/bang-macro.rs | 1 - tests/ui/proc-macro/call-site.rs | 1 - tests/ui/proc-macro/count_compound_ops.rs | 1 - tests/ui/proc-macro/derive-bad.rs | 1 - tests/ui/proc-macro/derive-bad.stderr | 6 +- ...derive-helper-shadowing.edition2015.stderr | 14 +-- ...derive-helper-shadowing.edition2018.stderr | 18 +-- .../ui/proc-macro/derive-helper-shadowing.rs | 1 - tests/ui/proc-macro/derive-same-struct.rs | 1 - tests/ui/proc-macro/edition-imports-2018.rs | 1 - tests/ui/proc-macro/env.rs | 1 - tests/ui/proc-macro/expand-to-unstable.rs | 1 - tests/ui/proc-macro/expand-to-unstable.stderr | 2 +- tests/ui/proc-macro/expand-with-a-macro.rs | 1 - .../ui/proc-macro/gen-macro-rules-hygiene.rs | 1 - .../proc-macro/gen-macro-rules-hygiene.stderr | 10 +- tests/ui/proc-macro/gen-macro-rules.rs | 1 - tests/ui/proc-macro/generate-mod.rs | 1 - tests/ui/proc-macro/generate-mod.stderr | 28 ++--- tests/ui/proc-macro/hygiene_example.rs | 1 - tests/ui/proc-macro/is-available.rs | 1 - .../issue-104884-trait-impl-sugg-err.rs | 1 - .../issue-104884-trait-impl-sugg-err.stderr | 18 +-- tests/ui/proc-macro/issue-107113-wrap.rs | 1 - tests/ui/proc-macro/issue-107113-wrap.stderr | 2 +- tests/ui/proc-macro/issue-118809.rs | 1 - tests/ui/proc-macro/issue-118809.stderr | 4 +- tests/ui/proc-macro/issue-38586.rs | 1 - tests/ui/proc-macro/issue-38586.stderr | 2 +- .../issue-59191-replace-root-with-fn.rs | 1 - tests/ui/proc-macro/issue-79148.rs | 1 - tests/ui/proc-macro/issue-79148.stderr | 4 +- tests/ui/proc-macro/issue-83510.rs | 1 - tests/ui/proc-macro/issue-83510.stderr | 8 +- tests/ui/proc-macro/issue-91800.rs | 1 - tests/ui/proc-macro/issue-91800.stderr | 14 +-- tests/ui/proc-macro/lifetimes-rpass.rs | 1 - tests/ui/proc-macro/lints_in_proc_macros.rs | 1 - .../ui/proc-macro/lints_in_proc_macros.stderr | 2 +- tests/ui/proc-macro/load-two.rs | 1 - .../proc-macro/macro-crate-multi-decorator.rs | 1 - .../proc-macro/macro_rules_edition_from_pm.rs | 1 - tests/ui/proc-macro/match-expander.rs | 1 - tests/ui/proc-macro/match-expander.stderr | 2 +- tests/ui/proc-macro/mixed-site-span.rs | 1 - tests/ui/proc-macro/mixed-site-span.stderr | 108 +++++++++--------- tests/ui/proc-macro/modify-ast.rs | 1 - tests/ui/proc-macro/nonfatal-parsing.rs | 1 - tests/ui/proc-macro/nonfatal-parsing.stderr | 22 ++-- tests/ui/proc-macro/parent-source-spans.rs | 1 - .../ui/proc-macro/parent-source-spans.stderr | 42 +++---- tests/ui/proc-macro/quote/basic.rs | 1 - tests/ui/proc-macro/span-api-tests.rs | 1 - tests/ui/proc-macro/span-from-proc-macro.rs | 1 - .../ui/proc-macro/span-from-proc-macro.stderr | 8 +- tests/ui/proc-macro/test.rs | 1 - tests/ui/proc-macro/weird-hygiene.rs | 1 - tests/ui/proc-macro/weird-hygiene.stderr | 8 +- tests/ui/process/multi-panic.rs | 1 - tests/ui/process/println-with-broken-pipe.rs | 1 - tests/ui/process/process-panic-after-fork.rs | 1 - tests/ui/repr/16-bit-repr-c-enum.rs | 1 - tests/ui/resolve/prelude-order.rs | 1 - tests/ui/resolve/prelude-order.stderr | 10 +- .../dont-suggest-unstable-type.nightly.stderr | 2 +- .../suggestions/dont-suggest-unstable-type.rs | 1 - .../dont-suggest-unstable-type.stable.stderr | 2 +- .../std-panic-locations.default.stderr | 2 +- .../std-panic-locations.mir-opt.stderr | 2 +- .../std-panic-locations.rs | 1 - .../edition-spans.rs | 1 - .../runtime/on-broken-pipe/child-processes.rs | 1 - tests/ui/runtime/out-of-stack.rs | 1 - tests/ui/runtime/rt-explody-panic-payloads.rs | 1 - .../suggestions-not-always-applicable.fixed | 1 - .../suggestions-not-always-applicable.rs | 1 - .../rust-2021/reserved-prefixes-via-macro.rs | 1 - .../reserved-guarded-strings-via-macro.rs | 1 - .../unsafe-attributes-from-pm-in-2024.rs | 1 - .../unsafe-attributes-from-pm-in-2024.stderr | 8 +- .../unsafe-attributes-from-pm.rs | 1 - .../ui/scalable-vectors/project-into-field.rs | 1 - tests/ui/sepcomp/sepcomp-unwind.rs | 1 - .../simd/intrinsic/generic-arithmetic-pass.rs | 1 - tests/ui/simd/intrinsic/generic-as.rs | 1 - tests/ui/simd/issue-17170.rs | 1 - tests/ui/simd/masked-load-store.rs | 1 - tests/ui/simd/target-feature-mixup.rs | 1 - .../warn-stack-protector-unsupported.rs | 1 - tests/ui/structs/unit-like-struct-drop-run.rs | 1 - tests/ui/suggestions/issue-61963.rs | 1 - tests/ui/suggestions/issue-61963.stderr | 6 +- tests/ui/suggestions/suggest-ref-macro.rs | 1 - tests/ui/suggestions/suggest-ref-macro.stderr | 12 +- tests/ui/target-cpu/explicit-target-cpu.rs | 1 - tests/ui/target-cpu/unsupported-target-cpu.rs | 1 - ...incompatible-target-feature-flag-enable.rs | 1 - ...-irrelevant-target-feature-flag-disable.rs | 1 - .../abi-relevant-target-modifier.rs | 1 - .../abi-required-target-feature-attribute.rs | 1 - ...bi-required-target-feature-flag-disable.rs | 1 - ...ed-target-feature-missing-in-target-cpu.rs | 1 - tests/ui/target-feature/feature-hierarchy.rs | 1 - .../forbidden-target-feature-cfg.rs | 1 - .../forbidden-target-feature-flag-disable.rs | 1 - .../forbidden-target-feature-flag.rs | 1 - .../packedstack-combinations.rs | 1 - tests/ui/target-feature/tied-features-cli.rs | 1 - .../tied-features-no-implication-1.rs | 1 - .../unstable-target-feature-on-nightly.rs | 2 - tests/ui/target-feature/x86-soft-float-cfg.rs | 1 - tests/ui/target_modifiers/auxiliary/pauth.rs | 1 - .../auxiliary/sanitizer_default_explicit.rs | 1 - .../auxiliary/sanitizer_default_implicit.rs | 1 - .../auxiliary/sanitizer_non_default.rs | 1 - .../auxiliary/target_cpu_default_explicit.rs | 1 - .../auxiliary/target_cpu_default_implicit.rs | 1 - .../auxiliary/target_cpu_non_default.rs | 1 - tests/ui/target_modifiers/defaults_check.rs | 1 - .../target_modifiers/incompatible_fixedx18.rs | 1 - .../ui/target_modifiers/incompatible_pauth.rs | 1 - .../target_modifiers/incompatible_regparm.rs | 1 - tests/ui/target_modifiers/no_value_bool.rs | 1 - .../ui/target_modifiers/sanitizer_default.rs | 1 - .../ui/target_modifiers/target_cpu_default.rs | 1 - tests/ui/target_modifiers/two_flags.rs | 1 - .../test-attrs/test-panic-while-printing.rs | 1 - tests/ui/threads-sendsync/task-stderr.rs | 1 - tests/ui/threads-sendsync/unwind-resource.rs | 1 - ...issing-unstable-trait-bound.nightly.stderr | 2 +- .../missing-unstable-trait-bound.rs | 1 - ...missing-unstable-trait-bound.stable.stderr | 2 +- tests/ui/traits/clone-unwind-rc-cleanup.rs | 1 - .../const-drop-fail.new_precise.stderr | 12 +- .../const-drop-fail.new_stock.stderr | 12 +- .../const-drop-fail.old_precise.stderr | 12 +- .../const-drop-fail.old_stock.stderr | 12 +- .../ui/traits/const-traits/const-drop-fail.rs | 1 - ...supertrait-unstable.nightly-enabled.stderr | 18 +-- .../const-supertrait-unstable.nightly.stderr | 22 ++-- .../const-traits/const-supertrait-unstable.rs | 1 - ...-supertrait-unstable.stable-enabled.stderr | 30 ++--- .../const-supertrait-unstable.stable.stderr | 32 +++--- ...alid-sugg-for-derive-macro-issue-136343.rs | 1 - ...-sugg-for-derive-macro-issue-136343.stderr | 2 +- .../uninhabited-transparent-return-abi.rs | 1 - .../unsafe-binders-debuginfo.rs | 1 - 322 files changed, 333 insertions(+), 596 deletions(-) diff --git a/tests/ui/abi/abi-sysv64-arg-passing.rs b/tests/ui/abi/abi-sysv64-arg-passing.rs index e21ca94aa6e8f..602f3e467f528 100644 --- a/tests/ui/abi/abi-sysv64-arg-passing.rs +++ b/tests/ui/abi/abi-sysv64-arg-passing.rs @@ -28,7 +28,6 @@ //@ ignore-arm //@ ignore-aarch64 //@ ignore-windows -//@ ignore-backends: gcc // Windows is ignored because bootstrap doesn't yet know to compile rust_test_helpers with // the sysv64 ABI on Windows. diff --git a/tests/ui/abi/abi-sysv64-register-usage.rs b/tests/ui/abi/abi-sysv64-register-usage.rs index 576af8e696438..12c597b43c1f5 100644 --- a/tests/ui/abi/abi-sysv64-register-usage.rs +++ b/tests/ui/abi/abi-sysv64-register-usage.rs @@ -6,7 +6,6 @@ //@ ignore-arm //@ ignore-aarch64 //@ needs-asm-support -//@ ignore-backends: gcc #[cfg(target_arch = "x86_64")] pub extern "sysv64" fn all_the_registers( diff --git a/tests/ui/abi/arm-unadjusted-intrinsic.rs b/tests/ui/abi/arm-unadjusted-intrinsic.rs index 6068ef539133a..11577211fe2c3 100644 --- a/tests/ui/abi/arm-unadjusted-intrinsic.rs +++ b/tests/ui/abi/arm-unadjusted-intrinsic.rs @@ -6,7 +6,6 @@ //@ revisions: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64] needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![feature(no_core, lang_items, link_llvm_intrinsics, arm_target_feature)] #![no_std] #![no_core] diff --git a/tests/ui/abi/avr-sram.rs b/tests/ui/abi/avr-sram.rs index 7b8ec5ee8fa0c..a7cdf6ec2c7d0 100644 --- a/tests/ui/abi/avr-sram.rs +++ b/tests/ui/abi/avr-sram.rs @@ -18,7 +18,6 @@ //@[default_cpu] compile-flags: --target avr-none //@[default_cpu] needs-llvm-components: avr // -//@ ignore-backends: gcc // //[no_sram,disable_sram]~? WARN target feature `sram` must be enabled //[disable_sram]~? WARN target feature `sram` cannot be disabled with `-Ctarget-feature` diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 666910789dfb7..1116cb1a7e0fb 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -85,7 +85,6 @@ //@ revisions: nvptx64 //@[nvptx64] compile-flags: --target nvptx64-nvidia-cuda //@[nvptx64] needs-llvm-components: nvptx -//@ ignore-backends: gcc #![feature(no_core, rustc_attrs, lang_items)] #![feature(unsized_fn_params, transparent_unions)] #![no_core] diff --git a/tests/ui/abi/homogenous-floats-target-feature-mixup.rs b/tests/ui/abi/homogenous-floats-target-feature-mixup.rs index 21c6c276bb1c7..9fb2edb7bd5f9 100644 --- a/tests/ui/abi/homogenous-floats-target-feature-mixup.rs +++ b/tests/ui/abi/homogenous-floats-target-feature-mixup.rs @@ -6,7 +6,6 @@ //@ run-pass //@ needs-subprocess -//@ ignore-backends: gcc //@ ignore-i586 (no SSE2) #![allow(overflowing_literals)] diff --git a/tests/ui/abi/interrupt-returns-never-or-unit.rs b/tests/ui/abi/interrupt-returns-never-or-unit.rs index 75786730a2ca4..52f2594e80179 100644 --- a/tests/ui/abi/interrupt-returns-never-or-unit.rs +++ b/tests/ui/abi/interrupt-returns-never-or-unit.rs @@ -21,7 +21,6 @@ This test uses `cfg` because it is not testing whether these ABIs work on the pl //@ [avr] compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib //@ [msp430] needs-llvm-components: msp430 //@ [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib -//@ ignore-backends: gcc #![no_core] #![feature( no_core, diff --git a/tests/ui/abi/issue-28676.rs b/tests/ui/abi/issue-28676.rs index 616ed6bde24b1..6fc26ac307c0d 100644 --- a/tests/ui/abi/issue-28676.rs +++ b/tests/ui/abi/issue-28676.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![allow(dead_code)] diff --git a/tests/ui/abi/large-byval-align.rs b/tests/ui/abi/large-byval-align.rs index 7e640fb42a3cb..7b6538c818b41 100644 --- a/tests/ui/abi/large-byval-align.rs +++ b/tests/ui/abi/large-byval-align.rs @@ -1,7 +1,6 @@ //@ compile-flags: -Copt-level=0 //@ only-x86_64 //@ build-pass -//@ ignore-backends: gcc #[repr(C, align(536870912))] pub struct A(i64); diff --git a/tests/ui/abi/numbers-arithmetic/float-struct.rs b/tests/ui/abi/numbers-arithmetic/float-struct.rs index dc4c536a14e2d..a958dc272722f 100644 --- a/tests/ui/abi/numbers-arithmetic/float-struct.rs +++ b/tests/ui/abi/numbers-arithmetic/float-struct.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc use std::fmt::Debug; use std::hint::black_box; diff --git a/tests/ui/abi/pass-indirectly-attr.rs b/tests/ui/abi/pass-indirectly-attr.rs index bb90b8354ea91..72a5678b91753 100644 --- a/tests/ui/abi/pass-indirectly-attr.rs +++ b/tests/ui/abi/pass-indirectly-attr.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ check-fail //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" -//@ ignore-backends: gcc #![feature(rustc_attrs)] #![crate_type = "lib"] diff --git a/tests/ui/abi/pass-indirectly-attr.stderr b/tests/ui/abi/pass-indirectly-attr.stderr index f2ba517a43a6e..600e38004908d 100644 --- a/tests/ui/abi/pass-indirectly-attr.stderr +++ b/tests/ui/abi/pass-indirectly-attr.stderr @@ -1,5 +1,5 @@ error[E0692]: transparent struct cannot have other repr hints - --> $DIR/pass-indirectly-attr.rs:35:1 + --> $DIR/pass-indirectly-attr.rs:34:1 | LL | #[rustc_pass_indirectly_in_non_rustic_abis] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -82,7 +82,7 @@ error: fn_abi_of(extern_c) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/pass-indirectly-attr.rs:20:1 + --> $DIR/pass-indirectly-attr.rs:19:1 | LL | pub extern "C" fn extern_c(_: Type) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -171,7 +171,7 @@ error: fn_abi_of(extern_rust) = FnAbi { conv: Rust, can_unwind: false, } - --> $DIR/pass-indirectly-attr.rs:27:1 + --> $DIR/pass-indirectly-attr.rs:26:1 | LL | pub extern "Rust" fn extern_rust(_: Type) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/s390x-softfloat-gate.rs b/tests/ui/abi/s390x-softfloat-gate.rs index 496929eb09551..f8e05ebef2ed4 100644 --- a/tests/ui/abi/s390x-softfloat-gate.rs +++ b/tests/ui/abi/s390x-softfloat-gate.rs @@ -11,7 +11,6 @@ //@ [disable-softfloat] compile-flags: --target=s390x-unknown-linux-gnu //@ [disable-softfloat] compile-flags: -C target-feature=+soft-float //@ [disable-softfloat] needs-llvm-components: systemz -//@ ignore-backends: gcc //[disable-softfloat]~? WARN target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctly //[disable-softfloat]~? WARN target feature `soft-float` cannot be enabled with `-Ctarget-feature` diff --git a/tests/ui/abi/segfault-no-out-of-stack.rs b/tests/ui/abi/segfault-no-out-of-stack.rs index b122079d36f76..5e8b4e0dbf2a6 100644 --- a/tests/ui/abi/segfault-no-out-of-stack.rs +++ b/tests/ui/abi/segfault-no-out-of-stack.rs @@ -2,7 +2,6 @@ //@ needs-subprocess //@ compile-flags: -Zub-checks=no -Zmir-enable-passes=-CheckNull //@ ignore-fuchsia must translate zircon signal to SIGSEGV/SIGBUS, FIXME (#58590) -//@ ignore-backends: gcc #![feature(rustc_private)] diff --git a/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs index 824327ad06d36..b3bd0666ab21f 100644 --- a/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs +++ b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs @@ -1,7 +1,6 @@ //@ compile-flags: --target aarch64-unknown-none -Zsanitizer=shadow-call-stack //@ dont-check-compiler-stderr //@ needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![allow(internal_features)] #![crate_type = "rlib"] diff --git a/tests/ui/abi/stack-probes.rs b/tests/ui/abi/stack-probes.rs index be36eeefc31ea..c6a72fde0123c 100644 --- a/tests/ui/abi/stack-probes.rs +++ b/tests/ui/abi/stack-probes.rs @@ -11,7 +11,6 @@ //@ ignore-tvos Stack probes are enabled, but the SIGSEGV handler isn't //@ ignore-watchos Stack probes are enabled, but the SIGSEGV handler isn't //@ ignore-visionos Stack probes are enabled, but the SIGSEGV handler isn't -//@ ignore-backends: gcc use std::env; use std::mem::MaybeUninit; diff --git a/tests/ui/abi/stack-protector.rs b/tests/ui/abi/stack-protector.rs index 560b29576f3ab..ee12b541a3d53 100644 --- a/tests/ui/abi/stack-protector.rs +++ b/tests/ui/abi/stack-protector.rs @@ -4,7 +4,6 @@ //@ [ssp] compile-flags: -Z stack-protector=all -Z allow-partial-mitigations=stack-protector //@ compile-flags: -C opt-level=2 //@ compile-flags: -g -//@ ignore-backends: gcc #![allow(function_casts_as_integer)] diff --git a/tests/ui/abi/struct-enums/struct-return.rs b/tests/ui/abi/struct-enums/struct-return.rs index 5fe80d5f670b2..b8492de4974fa 100644 --- a/tests/ui/abi/struct-enums/struct-return.rs +++ b/tests/ui/abi/struct-enums/struct-return.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![allow(dead_code)] diff --git a/tests/ui/abi/swift-abi-non-apple.rs b/tests/ui/abi/swift-abi-non-apple.rs index a374f38c9c8eb..3ef85cf2003ba 100644 --- a/tests/ui/abi/swift-abi-non-apple.rs +++ b/tests/ui/abi/swift-abi-non-apple.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ needs-llvm-components: x86 //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -//@ ignore-backends: gcc #![no_core] #![feature(no_core, lang_items, abi_swift)] diff --git a/tests/ui/abi/swift-abi-non-apple.stderr b/tests/ui/abi/swift-abi-non-apple.stderr index 7dae75c96d46a..af0f5dd4ebaeb 100644 --- a/tests/ui/abi/swift-abi-non-apple.stderr +++ b/tests/ui/abi/swift-abi-non-apple.stderr @@ -1,41 +1,41 @@ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:14:8 + --> $DIR/swift-abi-non-apple.rs:13:8 | LL | extern "Swift" fn f() {} | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:17:12 + --> $DIR/swift-abi-non-apple.rs:16:12 | LL | extern "Swift" fn m(); | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:19:12 + --> $DIR/swift-abi-non-apple.rs:18:12 | LL | extern "Swift" fn dm() {} | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:24:12 + --> $DIR/swift-abi-non-apple.rs:23:12 | LL | extern "Swift" fn m() {} | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:28:12 + --> $DIR/swift-abi-non-apple.rs:27:12 | LL | extern "Swift" fn im() {} | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:31:18 + --> $DIR/swift-abi-non-apple.rs:30:18 | LL | type TA = extern "Swift" fn(); | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:33:8 + --> $DIR/swift-abi-non-apple.rs:32:8 | LL | extern "Swift" {} | ^^^^^^^ diff --git a/tests/ui/abi/variadic-ffi.rs b/tests/ui/abi/variadic-ffi.rs index 0f6183d6e2d40..293dc74fabec7 100644 --- a/tests/ui/abi/variadic-ffi.rs +++ b/tests/ui/abi/variadic-ffi.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc use std::ffi::VaList; diff --git a/tests/ui/abi/x86stdcall.rs b/tests/ui/abi/x86stdcall.rs index 77866c30f0e49..c1bd35b80d266 100644 --- a/tests/ui/abi/x86stdcall.rs +++ b/tests/ui/abi/x86stdcall.rs @@ -1,6 +1,5 @@ //@ run-pass //@ only-windows -//@ ignore-backends: gcc // GetLastError doesn't seem to work with stack switching #[cfg(windows)] diff --git a/tests/ui/allocator/no_std-alloc-error-handler-custom.rs b/tests/ui/allocator/no_std-alloc-error-handler-custom.rs index 7b7ca2f6cc6bd..1b0f0608fc61b 100644 --- a/tests/ui/allocator/no_std-alloc-error-handler-custom.rs +++ b/tests/ui/allocator/no_std-alloc-error-handler-custom.rs @@ -2,7 +2,6 @@ //@ ignore-android no libc //@ ignore-emscripten no libc //@ ignore-sgx no libc -//@ ignore-backends: gcc //@ only-linux //@ compile-flags:-C panic=abort //@ aux-build:helper.rs diff --git a/tests/ui/allocator/no_std-alloc-error-handler-default.rs b/tests/ui/allocator/no_std-alloc-error-handler-default.rs index 5a6c0b33d5108..51ecf1a6731ac 100644 --- a/tests/ui/allocator/no_std-alloc-error-handler-default.rs +++ b/tests/ui/allocator/no_std-alloc-error-handler-default.rs @@ -2,7 +2,6 @@ //@ ignore-android no libc //@ ignore-emscripten no libc //@ ignore-sgx no libc -//@ ignore-backends: gcc //@ only-linux //@ compile-flags:-C panic=abort //@ aux-build:helper.rs diff --git a/tests/ui/array-slice-vec/box-of-array-of-drop-1.rs b/tests/ui/array-slice-vec/box-of-array-of-drop-1.rs index 5f4e381c983a2..c7c05946c4ca9 100644 --- a/tests/ui/array-slice-vec/box-of-array-of-drop-1.rs +++ b/tests/ui/array-slice-vec/box-of-array-of-drop-1.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc #![allow(overflowing_literals)] diff --git a/tests/ui/array-slice-vec/box-of-array-of-drop-2.rs b/tests/ui/array-slice-vec/box-of-array-of-drop-2.rs index ea37d3e721264..98175a26ec0d1 100644 --- a/tests/ui/array-slice-vec/box-of-array-of-drop-2.rs +++ b/tests/ui/array-slice-vec/box-of-array-of-drop-2.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc #![allow(overflowing_literals)] diff --git a/tests/ui/array-slice-vec/nested-vec-3.rs b/tests/ui/array-slice-vec/nested-vec-3.rs index e3c04ed6f6bf0..51975743742cf 100644 --- a/tests/ui/array-slice-vec/nested-vec-3.rs +++ b/tests/ui/array-slice-vec/nested-vec-3.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc #![allow(overflowing_literals)] diff --git a/tests/ui/array-slice-vec/slice-panic-1.rs b/tests/ui/array-slice-vec/slice-panic-1.rs index 60680c367a671..9c66cd285aeb4 100644 --- a/tests/ui/array-slice-vec/slice-panic-1.rs +++ b/tests/ui/array-slice-vec/slice-panic-1.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc // Test that if a slicing expr[..] fails, the correct cleanups happen. diff --git a/tests/ui/array-slice-vec/slice-panic-2.rs b/tests/ui/array-slice-vec/slice-panic-2.rs index e5ba045248da2..b2b841642ae4b 100644 --- a/tests/ui/array-slice-vec/slice-panic-2.rs +++ b/tests/ui/array-slice-vec/slice-panic-2.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc // Test that if a slicing expr[..] fails, the correct cleanups happen. diff --git a/tests/ui/asm/aarch64/aarch64-sve.rs b/tests/ui/asm/aarch64/aarch64-sve.rs index daa4ab98dee75..ac19b7bc98131 100644 --- a/tests/ui/asm/aarch64/aarch64-sve.rs +++ b/tests/ui/asm/aarch64/aarch64-sve.rs @@ -2,7 +2,6 @@ //@ add-minicore //@ compile-flags: --target aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![crate_type = "rlib"] #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/aarch64/ttbr0_el2.rs b/tests/ui/asm/aarch64/ttbr0_el2.rs index 4032c70ed03c0..5e1e12de6f9c3 100644 --- a/tests/ui/asm/aarch64/ttbr0_el2.rs +++ b/tests/ui/asm/aarch64/ttbr0_el2.rs @@ -3,7 +3,6 @@ //@ build-pass //@ compile-flags: --target aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![crate_type = "lib"] #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/aarch64v8r.rs b/tests/ui/asm/aarch64v8r.rs index abc254ad5f8ee..4136c3e99763e 100644 --- a/tests/ui/asm/aarch64v8r.rs +++ b/tests/ui/asm/aarch64v8r.rs @@ -11,7 +11,6 @@ //@ [r82] compile-flags: --target aarch64v8r-unknown-none -C target-cpu=cortex-r82 //@ [r82] needs-llvm-components: aarch64 //@ build-pass -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/arm-low-dreg.rs b/tests/ui/asm/arm-low-dreg.rs index 6c1491ff06641..26f594f8362af 100644 --- a/tests/ui/asm/arm-low-dreg.rs +++ b/tests/ui/asm/arm-low-dreg.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target=armv7-unknown-linux-gnueabihf //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] #![no_core] diff --git a/tests/ui/asm/cortex-r82.rs b/tests/ui/asm/cortex-r82.rs index 74313e5cb48c1..c7a13ad7dccbd 100644 --- a/tests/ui/asm/cortex-r82.rs +++ b/tests/ui/asm/cortex-r82.rs @@ -4,7 +4,6 @@ //@ compile-flags: --target aarch64v8r-unknown-none -C target-cpu=cortex-r82 //@ needs-llvm-components: aarch64 //@ build-pass -//@ ignore-backends: gcc #![deny(dead_code)] #![feature(no_core)] diff --git a/tests/ui/asm/global-target-feature.rs b/tests/ui/asm/global-target-feature.rs index d84b4d51e6582..c3e4a171a663d 100644 --- a/tests/ui/asm/global-target-feature.rs +++ b/tests/ui/asm/global-target-feature.rs @@ -1,7 +1,6 @@ //@ build-pass //@ add-minicore //@ min-llvm-version: 23 -//@ ignore-backends: gcc // //@ revisions: riscv opt-0-bitcode-no opt-0 opt-s-bitcode-no // diff --git a/tests/ui/asm/issue-92378.rs b/tests/ui/asm/issue-92378.rs index 89ef2247d84b3..7a41ed5993aea 100644 --- a/tests/ui/asm/issue-92378.rs +++ b/tests/ui/asm/issue-92378.rs @@ -2,7 +2,6 @@ //@ compile-flags: --target armv5te-unknown-linux-gnueabi //@ needs-llvm-components: arm //@ build-pass -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/naked-functions/shim.rs b/tests/ui/asm/naked-functions/shim.rs index 8d5b87f0bedde..218f9a670fe90 100644 --- a/tests/ui/asm/naked-functions/shim.rs +++ b/tests/ui/asm/naked-functions/shim.rs @@ -8,7 +8,6 @@ //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/ui/asm/thumbv6m-clobber-abi-r14.rs b/tests/ui/asm/thumbv6m-clobber-abi-r14.rs index 342e65b52d9d8..bf4f724f28751 100644 --- a/tests/ui/asm/thumbv6m-clobber-abi-r14.rs +++ b/tests/ui/asm/thumbv6m-clobber-abi-r14.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target thumbv6m-none-eabi //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/x86_64/issue-96797.rs b/tests/ui/asm/x86_64/issue-96797.rs index 9978a4856a81f..5d3bbbb74bf56 100644 --- a/tests/ui/asm/x86_64/issue-96797.rs +++ b/tests/ui/asm/x86_64/issue-96797.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target x86_64-unknown-linux-gnu -O //@ needs-llvm-components: x86 -//@ ignore-backends: gcc #![crate_type = "lib"] #![feature(no_core)] #![no_core] diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs index d6180bb2f45d8..4bafb39f60096 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ edition: 2021 //@ known-bug: #108309 diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr index 4feaee82fef79..fb80fe2b5a0d8 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -1,12 +1,12 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/dont-project-to-specializable-projection.rs:14:35 + --> $DIR/dont-project-to-specializable-projection.rs:13:35 | LL | impl MyTrait for MyStruct { LL | default async fn foo(_: T) -> &'static str { | ^^^^^^^^^^^^ expected associated type, found future | note: type in trait - --> $DIR/dont-project-to-specializable-projection.rs:10:27 + --> $DIR/dont-project-to-specializable-projection.rs:9:27 | LL | trait MyTrait { LL | async fn foo(_: T) -> &'static str; @@ -15,7 +15,7 @@ LL | async fn foo(_: T) -> &'static str; found signature `fn(_) -> impl Future` error: async associated function in trait cannot be specialized - --> $DIR/dont-project-to-specializable-projection.rs:14:5 + --> $DIR/dont-project-to-specializable-projection.rs:13:5 | LL | default async fn foo(_: T) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | default async fn foo(_: T) -> &'static str { = note: specialization behaves in inconsistent and surprising ways with async functions in traits, and for now is disallowed error[E0599]: no method named `poll` found for struct `Pin<&mut impl Future>` in the current scope - --> $DIR/dont-project-to-specializable-projection.rs:49:28 + --> $DIR/dont-project-to-specializable-projection.rs:48:28 | LL | match fut.as_mut().poll(ctx) { | ^^^^ method not found in `Pin<&mut impl Future>` diff --git a/tests/ui/attributes/main-removed-2/main.rs b/tests/ui/attributes/main-removed-2/main.rs index 21a05dc4b40be..53696d68ced07 100644 --- a/tests/ui/attributes/main-removed-2/main.rs +++ b/tests/ui/attributes/main-removed-2/main.rs @@ -2,7 +2,6 @@ //@ proc-macro: tokyo.rs //@ compile-flags:--extern tokyo //@ edition:2021 -//@ ignore-backends: gcc use tokyo::main; diff --git a/tests/ui/backtrace/dylib-dep.rs b/tests/ui/backtrace/dylib-dep.rs index a51ce3d8d04cc..e01a6ade1d368 100644 --- a/tests/ui/backtrace/dylib-dep.rs +++ b/tests/ui/backtrace/dylib-dep.rs @@ -13,7 +13,6 @@ //@ ignore-watchos needs the `.dSYM` files to be moved to the device //@ ignore-visionos needs the `.dSYM` files to be moved to the device //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -g -Copt-level=0 -Cstrip=none -Cforce-frame-pointers=yes //@ ignore-wasm Requires custom symbolization code //@ aux-crate: dylib_dep_helper=dylib-dep-helper.rs diff --git a/tests/ui/backtrace/synchronized-panic-handler.rs b/tests/ui/backtrace/synchronized-panic-handler.rs index ef7cc1faec8de..29431ae3c458a 100644 --- a/tests/ui/backtrace/synchronized-panic-handler.rs +++ b/tests/ui/backtrace/synchronized-panic-handler.rs @@ -4,7 +4,6 @@ //@ exec-env:RUST_BACKTRACE=0 //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc use std::thread; const PANIC_MESSAGE: &str = "oops oh no woe is me"; diff --git a/tests/ui/backtrace/synchronized-panic-handler.run.stderr b/tests/ui/backtrace/synchronized-panic-handler.run.stderr index 5296a0d39ff30..c604d49c193c5 100644 --- a/tests/ui/backtrace/synchronized-panic-handler.run.stderr +++ b/tests/ui/backtrace/synchronized-panic-handler.run.stderr @@ -1,7 +1,7 @@ -thread '' ($TID) panicked at $DIR/synchronized-panic-handler.rs:12:5: +thread '' ($TID) panicked at $DIR/synchronized-panic-handler.rs:11:5: oops oh no woe is me note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread '' ($TID) panicked at $DIR/synchronized-panic-handler.rs:12:5: +thread '' ($TID) panicked at $DIR/synchronized-panic-handler.rs:11:5: oops oh no woe is me diff --git a/tests/ui/c-variadic/copy.rs b/tests/ui/c-variadic/copy.rs index 7befce36902c7..9f9c56f65da70 100644 --- a/tests/ui/c-variadic/copy.rs +++ b/tests/ui/c-variadic/copy.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc // Test the behavior of `VaList::clone`. In C a `va_list` is duplicated using `va_copy`, but the // rust api just uses `Clone`. This should create a completely independent cursor into the diff --git a/tests/ui/c-variadic/inherent-method.rs b/tests/ui/c-variadic/inherent-method.rs index 5f5cdc76d4a2e..156187fd67335 100644 --- a/tests/ui/c-variadic/inherent-method.rs +++ b/tests/ui/c-variadic/inherent-method.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #[repr(transparent)] struct S(i32); diff --git a/tests/ui/c-variadic/naked-invalid.rs b/tests/ui/c-variadic/naked-invalid.rs index 0cd37c94b6764..8d0b5607b5840 100644 --- a/tests/ui/c-variadic/naked-invalid.rs +++ b/tests/ui/c-variadic/naked-invalid.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ compile-flags: --target x86_64-unknown-linux-gnu //@ needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core, lang_items, rustc_attrs)] #![feature(abi_x86_interrupt, naked_functions_rustic_abi)] diff --git a/tests/ui/c-variadic/naked-invalid.stderr b/tests/ui/c-variadic/naked-invalid.stderr index 0842be296fe33..8d81bd0e10a11 100644 --- a/tests/ui/c-variadic/naked-invalid.stderr +++ b/tests/ui/c-variadic/naked-invalid.stderr @@ -1,5 +1,5 @@ error: `...` is not supported for `extern "Rust"` naked functions - --> $DIR/naked-invalid.rs:26:41 + --> $DIR/naked-invalid.rs:25:41 | LL | unsafe extern "Rust" fn c_variadic_rust(_: ...) { | ------------- ^^^^^^ @@ -9,7 +9,7 @@ LL | unsafe extern "Rust" fn c_variadic_rust(_: ...) { = help: C-variadic function must have a compatible calling convention error: `...` is not supported for `extern "x86-interrupt"` naked functions - --> $DIR/naked-invalid.rs:32:59 + --> $DIR/naked-invalid.rs:31:59 | LL | unsafe extern "x86-interrupt" fn c_variadic_x86_interrupt(_: ...) { | ---------------------- ^^^^^^ @@ -19,7 +19,7 @@ LL | unsafe extern "x86-interrupt" fn c_variadic_x86_interrupt(_: ...) { = help: C-variadic function must have a compatible calling convention error[E0703]: invalid ABI: found `nonsense` - --> $DIR/naked-invalid.rs:38:15 + --> $DIR/naked-invalid.rs:37:15 | LL | unsafe extern "nonsense" fn c_variadic_x86_nonsense(_: ...) { | ^^^^^^^^^^ invalid ABI diff --git a/tests/ui/c-variadic/roundtrip.rs b/tests/ui/c-variadic/roundtrip.rs index 992daa139a1fd..ba1f7f3bea8aa 100644 --- a/tests/ui/c-variadic/roundtrip.rs +++ b/tests/ui/c-variadic/roundtrip.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![feature( const_c_variadic, c_variadic_va_arg_safe, diff --git a/tests/ui/c-variadic/trait-method.rs b/tests/ui/c-variadic/trait-method.rs index 9a3ba87614214..557fbfe1a059c 100644 --- a/tests/ui/c-variadic/trait-method.rs +++ b/tests/ui/c-variadic/trait-method.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #[repr(transparent)] struct Struct(i32); diff --git a/tests/ui/c-variadic/valid.rs b/tests/ui/c-variadic/valid.rs index 9d937e611afe8..fba85cca8dc48 100644 --- a/tests/ui/c-variadic/valid.rs +++ b/tests/ui/c-variadic/valid.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc // In rust (and C23 and above) `...` can be the only argument. unsafe extern "C" fn only_dot_dot_dot(mut ap: ...) -> i32 { diff --git a/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs b/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs index 2ca004d9a906d..cafb7389e29fa 100644 --- a/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs +++ b/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs @@ -2,7 +2,6 @@ //@ proc-macro: ver-cfg-rel.rs //@ revisions: assume no_assume //@ [assume]compile-flags: -Z assume-incomplete-release -//@ ignore-backends: gcc #![feature(cfg_version)] diff --git a/tests/ui/cfg/cfg-panic-abort.rs b/tests/ui/cfg/cfg-panic-abort.rs index af4e119ef9fe3..b3255476c64c2 100644 --- a/tests/ui/cfg/cfg-panic-abort.rs +++ b/tests/ui/cfg/cfg-panic-abort.rs @@ -1,7 +1,6 @@ //@ build-pass //@ compile-flags: -C panic=abort //@ no-prefer-dynamic -//@ ignore-backends: gcc //@ reference: cfg.panic.def //@ reference: cfg.panic.values diff --git a/tests/ui/cfg/cfg_target_object_format.rs b/tests/ui/cfg/cfg_target_object_format.rs index cea2027b35c0b..dcb54d177cb48 100644 --- a/tests/ui/cfg/cfg_target_object_format.rs +++ b/tests/ui/cfg/cfg_target_object_format.rs @@ -1,6 +1,5 @@ //@ add-minicore //@ check-pass -//@ ignore-backends: gcc // //@ revisions: linux_gnu linux_musl linux_ohos linux_powerpc //@[linux_gnu] compile-flags: --target aarch64-unknown-linux-gnu diff --git a/tests/ui/check-cfg/values-target-json.rs b/tests/ui/check-cfg/values-target-json.rs index 21b6af9b55605..4e2cef3bc16e4 100644 --- a/tests/ui/check-cfg/values-target-json.rs +++ b/tests/ui/check-cfg/values-target-json.rs @@ -6,7 +6,6 @@ //@ needs-llvm-components: x86 //@ compile-flags: --crate-type=lib --check-cfg=cfg() //@ compile-flags: -Zunstable-options --target={{src-base}}/check-cfg/my-awesome-platform.json -//@ ignore-backends: gcc #![feature(lang_items, no_core, auto_traits, rustc_attrs)] #![no_core] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs index 0546b26820bca..de5823cccdf85 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(abi_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items, intrinsics)] #![no_core] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs index 5528865fc840e..db9a51969a9f3 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(abi_cmse_nonsecure_call, no_core, lang_items, intrinsics)] #![no_core] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs index 756cc6816acd8..3f979b5acba2b 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(cmse_nonsecure_entry, no_core, lang_items)] #![no_core] #![crate_type = "lib"] diff --git a/tests/ui/codegen/custom-target-invalid-llvm-target.rs b/tests/ui/codegen/custom-target-invalid-llvm-target.rs index d90b56c5d13c0..8b9af65cf3550 100644 --- a/tests/ui/codegen/custom-target-invalid-llvm-target.rs +++ b/tests/ui/codegen/custom-target-invalid-llvm-target.rs @@ -3,7 +3,6 @@ // ignore-tidy-target-specific-tests //@ check-fail //@ compile-flags: --target={{src-base}}/codegen/custom-target-invalid-llvm-target.json -Z unstable-options -//@ ignore-backends: gcc fn main() {} diff --git a/tests/ui/codegen/mismatched-data-layouts.rs b/tests/ui/codegen/mismatched-data-layouts.rs index bf866c3b1c9d0..ea1457148a52c 100644 --- a/tests/ui/codegen/mismatched-data-layouts.rs +++ b/tests/ui/codegen/mismatched-data-layouts.rs @@ -6,7 +6,6 @@ //@ normalize-stderr: "`, `[A-Za-z0-9-:]*`" -> "`, `normalized data layout`" //@ normalize-stderr: "layout, `[A-Za-z0-9-:]*`" -> "layout, `normalized data layout`" //@ normalize-stderr: "`mismatched-data-layout-\d+`" -> "`mismatched-data-layout-`" -//@ ignore-backends: gcc #![feature(lang_items, no_core, auto_traits)] #![no_core] diff --git a/tests/ui/codegen/passes-default-pipeline.rs b/tests/ui/codegen/passes-default-pipeline.rs index dd90b55e2da9f..9c4b19fec3c81 100644 --- a/tests/ui/codegen/passes-default-pipeline.rs +++ b/tests/ui/codegen/passes-default-pipeline.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc //@ compile-flags: -O -Cpasses=default fn main() { diff --git a/tests/ui/codegen/target-cpus.rs b/tests/ui/codegen/target-cpus.rs index 77a3f18dfa0fd..2d46e00f8034e 100644 --- a/tests/ui/codegen/target-cpus.rs +++ b/tests/ui/codegen/target-cpus.rs @@ -1,4 +1,3 @@ //@ needs-llvm-components: webassembly //@ compile-flags: --print=target-cpus --target=wasm32-unknown-unknown //@ check-pass -//@ ignore-backends: gcc diff --git a/tests/ui/compile-flags/invalid/function-return/requires-x86-or-x86_64.rs b/tests/ui/compile-flags/invalid/function-return/requires-x86-or-x86_64.rs index e46530a12c382..c7973c686da00 100644 --- a/tests/ui/compile-flags/invalid/function-return/requires-x86-or-x86_64.rs +++ b/tests/ui/compile-flags/invalid/function-return/requires-x86-or-x86_64.rs @@ -13,7 +13,6 @@ //@[aarch64] check-fail //@[aarch64] needs-llvm-components: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs b/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs index f0409a6f07796..bc81c993d26ef 100644 --- a/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs +++ b/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs @@ -13,7 +13,6 @@ //@[aarch64] check-fail //@[aarch64] needs-llvm-components: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs index 321cf56cd2a0f..436442ee72993 100644 --- a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs +++ b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs @@ -13,7 +13,6 @@ //@[aarch64] check-fail //@[aarch64] needs-llvm-components: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs b/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs index 6999eaac962aa..a66dfe8597718 100644 --- a/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs +++ b/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs @@ -17,7 +17,6 @@ //@[regparm4] check-fail //@[regparm4] compile-flags: -Zregparm=4 -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/invalid/regparm/requires-x86.rs b/tests/ui/compile-flags/invalid/regparm/requires-x86.rs index 983e412376dc0..32c4b5af35772 100644 --- a/tests/ui/compile-flags/invalid/regparm/requires-x86.rs +++ b/tests/ui/compile-flags/invalid/regparm/requires-x86.rs @@ -13,7 +13,6 @@ //@[aarch64] check-fail //@[aarch64] needs-llvm-components: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/print-request-help-stable-unstable.rs b/tests/ui/compile-flags/print-request-help-stable-unstable.rs index f75996f28e6bd..a1bde032784dd 100644 --- a/tests/ui/compile-flags/print-request-help-stable-unstable.rs +++ b/tests/ui/compile-flags/print-request-help-stable-unstable.rs @@ -2,7 +2,6 @@ //! //! Issue: -//@ ignore-backends: gcc //@ compile-flags: --print xxx // //@ revisions: stable nightly diff --git a/tests/ui/consts/const-destruct-stable-toolchain.nightly.stderr b/tests/ui/consts/const-destruct-stable-toolchain.nightly.stderr index 2d05a300165aa..d23fe15c126ab 100644 --- a/tests/ui/consts/const-destruct-stable-toolchain.nightly.stderr +++ b/tests/ui/consts/const-destruct-stable-toolchain.nightly.stderr @@ -1,5 +1,5 @@ error[E0493]: destructor of `T` cannot be evaluated at compile-time - --> $DIR/const-destruct-stable-toolchain.rs:12:24 + --> $DIR/const-destruct-stable-toolchain.rs:11:24 | LL | const fn const_drop(_: T) {} | ^ - value is dropped here diff --git a/tests/ui/consts/const-destruct-stable-toolchain.rs b/tests/ui/consts/const-destruct-stable-toolchain.rs index ad16a74508e4c..d14ab320516fd 100644 --- a/tests/ui/consts/const-destruct-stable-toolchain.rs +++ b/tests/ui/consts/const-destruct-stable-toolchain.rs @@ -3,7 +3,6 @@ // requires an unstable feature. // //@ needs-target-std -//@ ignore-backends: gcc // //@ revisions: stable nightly // diff --git a/tests/ui/consts/const-destruct-stable-toolchain.stable.stderr b/tests/ui/consts/const-destruct-stable-toolchain.stable.stderr index 4755afcd3f1e3..e56e66bade980 100644 --- a/tests/ui/consts/const-destruct-stable-toolchain.stable.stderr +++ b/tests/ui/consts/const-destruct-stable-toolchain.stable.stderr @@ -1,5 +1,5 @@ error[E0493]: destructor of `T` cannot be evaluated at compile-time - --> $DIR/const-destruct-stable-toolchain.rs:12:24 + --> $DIR/const-destruct-stable-toolchain.rs:11:24 | LL | const fn const_drop(_: T) {} | ^ - value is dropped here diff --git a/tests/ui/consts/const-eval/c-variadic.rs b/tests/ui/consts/const-eval/c-variadic.rs index 6dba6e1af5997..57c49ef283f3e 100644 --- a/tests/ui/consts/const-eval/c-variadic.rs +++ b/tests/ui/consts/const-eval/c-variadic.rs @@ -1,6 +1,5 @@ //@ edition: 2021 //@ run-pass -//@ ignore-backends: gcc #![feature(const_c_variadic)] #![feature(const_destruct)] diff --git a/tests/ui/consts/const-eval/parse_ints.rs b/tests/ui/consts/const-eval/parse_ints.rs index 6a7e157ea5039..409fae9e51d92 100644 --- a/tests/ui/consts/const-eval/parse_ints.rs +++ b/tests/ui/consts/const-eval/parse_ints.rs @@ -1,5 +1,3 @@ -//@ ignore-backends: gcc - const _OK: () = match i32::from_str_radix("-1234", 10) { Ok(x) => assert!(x == -1234), Err(_) => panic!(), diff --git a/tests/ui/consts/const-eval/parse_ints.stderr b/tests/ui/consts/const-eval/parse_ints.stderr index b8027fd951d5a..ef2214ce19d8c 100644 --- a/tests/ui/consts/const-eval/parse_ints.stderr +++ b/tests/ui/consts/const-eval/parse_ints.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation panicked: from_ascii_bytes_radix: radix must lie in the range `[2, 36]` - --> $DIR/parse_ints.rs:7:24 + --> $DIR/parse_ints.rs:5:24 | LL | const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_TOO_LOW` failed inside this call @@ -17,7 +17,7 @@ note: inside `core::num::::from_ascii_bytes_radix_impl` = note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation panicked: from_ascii_bytes_radix: radix must lie in the range `[2, 36]` - --> $DIR/parse_ints.rs:8:25 + --> $DIR/parse_ints.rs:6:25 | LL | const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_TOO_HIGH` failed inside this call diff --git a/tests/ui/consts/const_cmp_type_id.rs b/tests/ui/consts/const_cmp_type_id.rs index dc0701d3b1d6a..da0ba3ffebac8 100644 --- a/tests/ui/consts/const_cmp_type_id.rs +++ b/tests/ui/consts/const_cmp_type_id.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ compile-flags: -Znext-solver #![feature(const_trait_impl, const_cmp)] diff --git a/tests/ui/consts/const_cmp_type_id.stderr b/tests/ui/consts/const_cmp_type_id.stderr index b991b6af08cc1..dd2d1e86cced2 100644 --- a/tests/ui/consts/const_cmp_type_id.stderr +++ b/tests/ui/consts/const_cmp_type_id.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `TypeId: const PartialOrd` is not satisfied - --> $DIR/const_cmp_type_id.rs:11:18 + --> $DIR/const_cmp_type_id.rs:10:18 | LL | let _a = TypeId::of::() < TypeId::of::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/issue-73976-monomorphic.rs b/tests/ui/consts/issue-73976-monomorphic.rs index 6459150a66045..2867b836f4826 100644 --- a/tests/ui/consts/issue-73976-monomorphic.rs +++ b/tests/ui/consts/issue-73976-monomorphic.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ check-pass // // This test is complement to the test in issue-73976-polymorphic.rs. diff --git a/tests/ui/consts/issue-94675.rs b/tests/ui/consts/issue-94675.rs index 73ab2c7655800..c13fe26ae05a0 100644 --- a/tests/ui/consts/issue-94675.rs +++ b/tests/ui/consts/issue-94675.rs @@ -1,5 +1,3 @@ -//@ ignore-backends: gcc - #![feature(const_trait_impl)] struct Foo<'a> { diff --git a/tests/ui/consts/issue-94675.stderr b/tests/ui/consts/issue-94675.stderr index 3e89e37814fad..9a12c0ef6a75b 100644 --- a/tests/ui/consts/issue-94675.stderr +++ b/tests/ui/consts/issue-94675.stderr @@ -1,5 +1,5 @@ error: `IndexMut` is not yet stable as a const trait - --> $DIR/issue-94675.rs:11:17 + --> $DIR/issue-94675.rs:9:17 | LL | self.bar[0] = baz.len(); | ^^^ diff --git a/tests/ui/consts/issue-miri-1910.rs b/tests/ui/consts/issue-miri-1910.rs index 97cc92417bf46..dfc7bb737cd9e 100644 --- a/tests/ui/consts/issue-miri-1910.rs +++ b/tests/ui/consts/issue-miri-1910.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ normalize-stderr: "alloc[0-9]+\+0x[a-z0-9]+" -> "ALLOC" const C: () = unsafe { diff --git a/tests/ui/consts/issue-miri-1910.stderr b/tests/ui/consts/issue-miri-1910.stderr index af4e3f3fc5352..a5b518e94213f 100644 --- a/tests/ui/consts/issue-miri-1910.stderr +++ b/tests/ui/consts/issue-miri-1910.stderr @@ -1,5 +1,5 @@ error[E0080]: unable to turn pointer into integer - --> $DIR/issue-miri-1910.rs:7:5 + --> $DIR/issue-miri-1910.rs:6:5 | LL | const C: () = unsafe { ... diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs index b679493eb08eb..94de3390a0267 100644 --- a/tests/ui/consts/missing_span_in_backtrace.rs +++ b/tests/ui/consts/missing_span_in_backtrace.rs @@ -1,5 +1,4 @@ //! Check what happens when the error occurs inside a std function that we can't print the span of. -//@ ignore-backends: gcc //@ compile-flags: -Z ui-testing=no --diagnostic-width=80 use std::{ diff --git a/tests/ui/consts/missing_span_in_backtrace.stderr b/tests/ui/consts/missing_span_in_backtrace.stderr index 7af55684861bc..411dbe5403eb0 100644 --- a/tests/ui/consts/missing_span_in_backtrace.stderr +++ b/tests/ui/consts/missing_span_in_backtrace.stderr @@ -1,13 +1,13 @@ error[E0080]: memory access failed: attempting to access 1 byte, but got ALLOC$ID+0x4 which is at or beyond the end of the allocation of size 4 bytes - --> $DIR/missing_span_in_backtrace.rs:16:9 + --> $DIR/missing_span_in_backtrace.rs:15:9 | -10 | const X: () = { + 9 | const X: () = { ... -16 | / ptr::swap_nonoverlapping( -17 | | &mut x1 as *mut _ as *mut MaybeUninit, -18 | | &mut x2 as *mut _ as *mut MaybeUninit, -19 | | 10, -20 | | ); +15 | / ptr::swap_nonoverlapping( +16 | | &mut x1 as *mut _ as *mut MaybeUninit, +17 | | &mut x2 as *mut _ as *mut MaybeUninit, +18 | | 10, +19 | | ); | |_________^ evaluation of `X` failed inside this call | note: inside `swap_nonoverlapping::compiletime::>` diff --git a/tests/ui/consts/try-operator.rs b/tests/ui/consts/try-operator.rs index 54a6ed26241c6..8beff899bb5af 100644 --- a/tests/ui/consts/try-operator.rs +++ b/tests/ui/consts/try-operator.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ run-pass #![feature(const_trait_impl)] diff --git a/tests/ui/coroutine/gen_block_panic.rs b/tests/ui/coroutine/gen_block_panic.rs index 5417ed583e8ca..b6362d5046a3b 100644 --- a/tests/ui/coroutine/gen_block_panic.rs +++ b/tests/ui/coroutine/gen_block_panic.rs @@ -1,7 +1,6 @@ //@ edition: 2024 //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(gen_blocks)] fn main() { diff --git a/tests/ui/coroutine/gen_block_panic.stderr b/tests/ui/coroutine/gen_block_panic.stderr index d0a146e7baf9a..a43c9e03691a5 100644 --- a/tests/ui/coroutine/gen_block_panic.stderr +++ b/tests/ui/coroutine/gen_block_panic.stderr @@ -1,5 +1,5 @@ warning: unreachable statement - --> $DIR/gen_block_panic.rs:11:9 + --> $DIR/gen_block_panic.rs:10:9 | LL | panic!("foo"); | ------------- any code following this expression is unreachable diff --git a/tests/ui/coroutine/panic-drops-resume.rs b/tests/ui/coroutine/panic-drops-resume.rs index ee58dab3e3703..b23666b7885fb 100644 --- a/tests/ui/coroutine/panic-drops-resume.rs +++ b/tests/ui/coroutine/panic-drops-resume.rs @@ -2,7 +2,6 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] diff --git a/tests/ui/coroutine/panic-drops.rs b/tests/ui/coroutine/panic-drops.rs index c8ac401372f78..8c2cf560f2acc 100644 --- a/tests/ui/coroutine/panic-drops.rs +++ b/tests/ui/coroutine/panic-drops.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] diff --git a/tests/ui/coroutine/panic-safe.rs b/tests/ui/coroutine/panic-safe.rs index cee2afacb6145..d25eaa418fe14 100644 --- a/tests/ui/coroutine/panic-safe.rs +++ b/tests/ui/coroutine/panic-safe.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] diff --git a/tests/ui/coroutine/resume-after-return.rs b/tests/ui/coroutine/resume-after-return.rs index f566bd37d3d10..7028e1e81e55c 100644 --- a/tests/ui/coroutine/resume-after-return.rs +++ b/tests/ui/coroutine/resume-after-return.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ run-pass //@ needs-unwind diff --git a/tests/ui/coroutine/unwind-abort-mix.rs b/tests/ui/coroutine/unwind-abort-mix.rs index 175c2928a8010..517c6613e3d8b 100644 --- a/tests/ui/coroutine/unwind-abort-mix.rs +++ b/tests/ui/coroutine/unwind-abort-mix.rs @@ -6,7 +6,6 @@ //@ aux-build:unwind-aux.rs //@ compile-flags: -Cpanic=abort //@ needs-unwind -//@ ignore-backends: gcc extern crate unwind_aux; pub fn main() { diff --git a/tests/ui/crate-loading/missing-target-error.rs b/tests/ui/crate-loading/missing-target-error.rs index 3a75d568d2c8e..aece47ec3f9d4 100644 --- a/tests/ui/crate-loading/missing-target-error.rs +++ b/tests/ui/crate-loading/missing-target-error.rs @@ -8,6 +8,5 @@ //@ compile-flags: --target=thumbv6m-none-eabi //@ ignore-arm //@ needs-llvm-components: arm -//@ ignore-backends: gcc fn main() { } diff --git a/tests/ui/crate-loading/missing-target-no-std-error.rs b/tests/ui/crate-loading/missing-target-no-std-error.rs index c285740c62bec..6c337aa02b3bd 100644 --- a/tests/ui/crate-loading/missing-target-no-std-error.rs +++ b/tests/ui/crate-loading/missing-target-no-std-error.rs @@ -5,7 +5,6 @@ //@ compile-flags: --target thumbv7em-none-eabihf //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![deny(unsafe_code)] #![deny(warnings)] #![no_std] diff --git a/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs b/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs index 2e3073286f0f6..9db910d0d242e 100644 --- a/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs +++ b/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs @@ -4,7 +4,6 @@ //@ aux-build:mut-ref-write-visible-after-unwind.rs //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc extern crate mut_ref_write_visible_after_unwind as lib; diff --git a/tests/ui/debuginfo/windows_gnu_split_debuginfo_off.rs b/tests/ui/debuginfo/windows_gnu_split_debuginfo_off.rs index e0d0f9cff324d..3a8d9c998cf74 100644 --- a/tests/ui/debuginfo/windows_gnu_split_debuginfo_off.rs +++ b/tests/ui/debuginfo/windows_gnu_split_debuginfo_off.rs @@ -22,7 +22,6 @@ //@[x86_64_uwp_g] compile-flags: --target x86_64-uwp-windows-gnu //@[x86_64_uwp_g] needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core)] diff --git a/tests/ui/debuginfo/windows_gnu_split_debuginfo_packed.rs b/tests/ui/debuginfo/windows_gnu_split_debuginfo_packed.rs index e6f830ea73eb4..75b8141cc385f 100644 --- a/tests/ui/debuginfo/windows_gnu_split_debuginfo_packed.rs +++ b/tests/ui/debuginfo/windows_gnu_split_debuginfo_packed.rs @@ -21,7 +21,6 @@ //@[x86_64_uwp_g] compile-flags: --target x86_64-uwp-windows-gnu //@[x86_64_uwp_g] needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core)] diff --git a/tests/ui/debuginfo/windows_gnu_split_debuginfo_unpacked.rs b/tests/ui/debuginfo/windows_gnu_split_debuginfo_unpacked.rs index e8edbc669b5cc..3f4da555aadf1 100644 --- a/tests/ui/debuginfo/windows_gnu_split_debuginfo_unpacked.rs +++ b/tests/ui/debuginfo/windows_gnu_split_debuginfo_unpacked.rs @@ -21,7 +21,6 @@ //@[x86_64_uwp_g] compile-flags: --target x86_64-uwp-windows-gnu //@[x86_64_uwp_g] needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core)] diff --git a/tests/ui/delegation/fn-header-variadic.rs b/tests/ui/delegation/fn-header-variadic.rs index 051be3a51502d..132c0a22402c6 100644 --- a/tests/ui/delegation/fn-header-variadic.rs +++ b/tests/ui/delegation/fn-header-variadic.rs @@ -1,5 +1,4 @@ //@ aux-crate:fn_header_aux=fn-header-aux.rs -//@ ignore-backends: gcc #![feature(fn_delegation)] diff --git a/tests/ui/delegation/fn-header-variadic.stderr b/tests/ui/delegation/fn-header-variadic.stderr index a0b5a6313d080..e10ad339d8c2a 100644 --- a/tests/ui/delegation/fn-header-variadic.stderr +++ b/tests/ui/delegation/fn-header-variadic.stderr @@ -1,5 +1,5 @@ error: delegation to C-variadic functions is not allowed - --> $DIR/fn-header-variadic.rs:10:17 + --> $DIR/fn-header-variadic.rs:9:17 | LL | pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) {} | ------------------------------------------------------------- callee defined here @@ -8,7 +8,7 @@ LL | reuse to_reuse::variadic_fn; | ^^^^^^^^^^^ error: delegation to C-variadic functions is not allowed - --> $DIR/fn-header-variadic.rs:12:22 + --> $DIR/fn-header-variadic.rs:11:22 | LL | reuse fn_header_aux::variadic_fn_extern; | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/delegation/fn-header.rs b/tests/ui/delegation/fn-header.rs index a036dec4872a9..0b5154b29b9ca 100644 --- a/tests/ui/delegation/fn-header.rs +++ b/tests/ui/delegation/fn-header.rs @@ -4,7 +4,6 @@ //@ check-pass //@ edition:2018 //@ aux-crate:fn_header_aux=fn-header-aux.rs -//@ ignore-backends: gcc #![feature(fn_delegation)] #![deny(unused_unsafe)] diff --git a/tests/ui/drop/drop-once-on-panic.rs b/tests/ui/drop/drop-once-on-panic.rs index baba7abae91b0..4245f1649903b 100644 --- a/tests/ui/drop/drop-once-on-panic.rs +++ b/tests/ui/drop/drop-once-on-panic.rs @@ -3,7 +3,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc use std::thread; diff --git a/tests/ui/drop/drop-trait-enum.rs b/tests/ui/drop/drop-trait-enum.rs index efb6b2a912ab1..5a88d959ec6fa 100644 --- a/tests/ui/drop/drop-trait-enum.rs +++ b/tests/ui/drop/drop-trait-enum.rs @@ -4,7 +4,6 @@ #![allow(unused_variables)] //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc use std::thread; use std::sync::mpsc::{channel, Sender}; diff --git a/tests/ui/drop/dynamic-drop-async.rs b/tests/ui/drop/dynamic-drop-async.rs index 64de6995c7a82..e7a32d3c24e92 100644 --- a/tests/ui/drop/dynamic-drop-async.rs +++ b/tests/ui/drop/dynamic-drop-async.rs @@ -6,7 +6,6 @@ //@ run-pass //@ needs-unwind //@ edition:2018 -//@ ignore-backends: gcc #![allow(unused)] diff --git a/tests/ui/drop/dynamic-drop.rs b/tests/ui/drop/dynamic-drop.rs index 408604fe3e6a2..70e0e523f1c62 100644 --- a/tests/ui/drop/dynamic-drop.rs +++ b/tests/ui/drop/dynamic-drop.rs @@ -1,7 +1,6 @@ //@ edition:2015..2021 //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] diff --git a/tests/ui/drop/enum-destructor-on-unwind.rs b/tests/ui/drop/enum-destructor-on-unwind.rs index 9d2655564ca8c..498de521bd761 100644 --- a/tests/ui/drop/enum-destructor-on-unwind.rs +++ b/tests/ui/drop/enum-destructor-on-unwind.rs @@ -3,7 +3,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc use std::sync::atomic::{Ordering, AtomicUsize}; use std::thread; diff --git a/tests/ui/drop/move-closure-drop-on-unwind.rs b/tests/ui/drop/move-closure-drop-on-unwind.rs index ad110c1de01c8..28932aa36cc1d 100644 --- a/tests/ui/drop/move-closure-drop-on-unwind.rs +++ b/tests/ui/drop/move-closure-drop-on-unwind.rs @@ -4,7 +4,6 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc use std::panic; diff --git a/tests/ui/drop/panic-during-drop-14875.rs b/tests/ui/drop/panic-during-drop-14875.rs index 5a6f8f427758d..0c33f74ed61f7 100644 --- a/tests/ui/drop/panic-during-drop-14875.rs +++ b/tests/ui/drop/panic-during-drop-14875.rs @@ -2,7 +2,6 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc // Check that values are not leaked when a dtor panics (#14875) diff --git a/tests/ui/drop/panic-during-slice-init.rs b/tests/ui/drop/panic-during-slice-init.rs index ddf1e01dd8e7a..3e8e12536991c 100644 --- a/tests/ui/drop/panic-during-slice-init.rs +++ b/tests/ui/drop/panic-during-slice-init.rs @@ -6,7 +6,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc struct Foo; diff --git a/tests/ui/drop/terminate-in-initializer.rs b/tests/ui/drop/terminate-in-initializer.rs index 5dd8fe43c71e3..24ec39fe09638 100644 --- a/tests/ui/drop/terminate-in-initializer.rs +++ b/tests/ui/drop/terminate-in-initializer.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc // Issue #787 // Don't try to clean up uninitialized locals diff --git a/tests/ui/explicit-tail-calls/become-cast-return.rs b/tests/ui/explicit-tail-calls/become-cast-return.rs index d4cdcbf3a0112..2927185bbbc13 100644 --- a/tests/ui/explicit-tail-calls/become-cast-return.rs +++ b/tests/ui/explicit-tail-calls/become-cast-return.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc //@ ignore-wasm 'tail-call' feature not enabled in target wasm32-wasip1 //@ ignore-cross-compile #![expect(incomplete_features)] diff --git a/tests/ui/explicit-tail-calls/callee_is_track_caller.rs b/tests/ui/explicit-tail-calls/callee_is_track_caller.rs index b5e1b97e9da8d..f357ee3524a15 100644 --- a/tests/ui/explicit-tail-calls/callee_is_track_caller.rs +++ b/tests/ui/explicit-tail-calls/callee_is_track_caller.rs @@ -1,6 +1,5 @@ //@ run-pass //@ no-pass-override (checks for a warning produced by codegen) -//@ ignore-backends: gcc #![expect(incomplete_features)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/explicit-tail-calls/callee_is_track_caller.stderr b/tests/ui/explicit-tail-calls/callee_is_track_caller.stderr index 020a0542a57fd..e1a251d156f76 100644 --- a/tests/ui/explicit-tail-calls/callee_is_track_caller.stderr +++ b/tests/ui/explicit-tail-calls/callee_is_track_caller.stderr @@ -1,5 +1,5 @@ warning: tail calling a function marked with `#[track_caller]` has no special effect - --> $DIR/callee_is_track_caller.rs:8:12 + --> $DIR/callee_is_track_caller.rs:7:12 | LL | become b(x); | ^^^^ diff --git a/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.rs b/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.rs index 7623dd558251b..4214c26defb0a 100644 --- a/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.rs +++ b/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.rs @@ -1,6 +1,5 @@ //@ run-pass //@ no-pass-override (checks for a warning produced by codegen) -//@ ignore-backends: gcc #![expect(incomplete_features)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.stderr b/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.stderr index 7b4c144acffa5..5a1c40509ad3a 100644 --- a/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.stderr +++ b/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.stderr @@ -1,5 +1,5 @@ warning: tail calling a function marked with `#[track_caller]` has no special effect - --> $DIR/callee_is_track_caller_polymorphic.rs:8:12 + --> $DIR/callee_is_track_caller_polymorphic.rs:7:12 | LL | become T::f(); | ^^^^^^ diff --git a/tests/ui/explicit-tail-calls/default-trait-method.rs b/tests/ui/explicit-tail-calls/default-trait-method.rs index fbf2e80ced45e..144909fc1d1b6 100644 --- a/tests/ui/explicit-tail-calls/default-trait-method.rs +++ b/tests/ui/explicit-tail-calls/default-trait-method.rs @@ -3,7 +3,6 @@ // in a path determining whether the method in question is marked as `#[track_caller]`. // //@ run-pass -//@ ignore-backends: gcc #![feature(explicit_tail_calls)] #![expect(incomplete_features)] diff --git a/tests/ui/explicit-tail-calls/drop-order.rs b/tests/ui/explicit-tail-calls/drop-order.rs index ff6e2f09f57ce..58e1afbdf0c51 100644 --- a/tests/ui/explicit-tail-calls/drop-order.rs +++ b/tests/ui/explicit-tail-calls/drop-order.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![expect(incomplete_features)] #![feature(explicit_tail_calls)] use std::cell::RefCell; diff --git a/tests/ui/explicit-tail-calls/indexer.rs b/tests/ui/explicit-tail-calls/indexer.rs index c26d9774ce780..5644506b2f584 100644 --- a/tests/ui/explicit-tail-calls/indexer.rs +++ b/tests/ui/explicit-tail-calls/indexer.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc // Indexing taken from // https://github.com/phi-go/rfcs/blob/guaranteed-tco/text%2F0000-explicit-tail-calls.md#tail-call-elimination // no other test has utilized the "function table" diff --git a/tests/ui/explicit-tail-calls/recursion-etc.rs b/tests/ui/explicit-tail-calls/recursion-etc.rs index c22401d23799d..8c89ceb7869aa 100644 --- a/tests/ui/explicit-tail-calls/recursion-etc.rs +++ b/tests/ui/explicit-tail-calls/recursion-etc.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![expect(incomplete_features)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/explicit-tail-calls/support/basic.rs b/tests/ui/explicit-tail-calls/support/basic.rs index eb3041f106171..c2f327154066e 100644 --- a/tests/ui/explicit-tail-calls/support/basic.rs +++ b/tests/ui/explicit-tail-calls/support/basic.rs @@ -1,5 +1,4 @@ //@ build-pass -//@ ignore-backends: gcc //@ add-minicore // //@ revisions: i686 diff --git a/tests/ui/extern/extern-types-field-offset.rs b/tests/ui/extern/extern-types-field-offset.rs index 9fe1cdf3bc47a..a9562ac9fb015 100644 --- a/tests/ui/extern/extern-types-field-offset.rs +++ b/tests/ui/extern/extern-types-field-offset.rs @@ -3,7 +3,6 @@ //@ exec-env:RUST_BACKTRACE=0 //@ normalize-stderr: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL" //@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> "" -//@ ignore-backends: gcc #![feature(extern_types)] extern "C" { diff --git a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs index 794b51c7a8a25..26d483e43ae50 100644 --- a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs +++ b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs @@ -1,5 +1,4 @@ //@ proc-macro: format-string-proc-macro.rs -//@ ignore-backends: gcc extern crate format_string_proc_macro; diff --git a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr index c341c6ee4c513..e7ed2a76e6af1 100644 --- a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr +++ b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr @@ -1,5 +1,5 @@ error: there is no argument named `x` - --> $DIR/format-args-capture-from-pm-first-arg-macro.rs:7:5 + --> $DIR/format-args-capture-from-pm-first-arg-macro.rs:6:5 | LL | format_string_proc_macro::bad_format_args_captures!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/frontmatter/location-proc-macro-observer.rs b/tests/ui/frontmatter/location-proc-macro-observer.rs index 5237a0e982a6f..6c4c8c572897e 100644 --- a/tests/ui/frontmatter/location-proc-macro-observer.rs +++ b/tests/ui/frontmatter/location-proc-macro-observer.rs @@ -1,7 +1,6 @@ //@ check-pass //@ proc-macro: makro.rs //@ edition: 2021 -//@ ignore-backends: gcc // Check that a proc-macro doesn't try to parse frontmatter and instead treats // it as a regular Rust token sequence. See `auxiliary/makro.rs` for details. diff --git a/tests/ui/hygiene/issue-77523-def-site-async-await.rs b/tests/ui/hygiene/issue-77523-def-site-async-await.rs index 0a279682b71bb..ad6bd5e0b78bc 100644 --- a/tests/ui/hygiene/issue-77523-def-site-async-await.rs +++ b/tests/ui/hygiene/issue-77523-def-site-async-await.rs @@ -1,6 +1,5 @@ //@ build-pass //@ aux-build:def-site-async-await.rs -//@ ignore-backends: gcc // Regression test for issue #77523 // Tests that we don't ICE when an unusual combination diff --git a/tests/ui/impl-trait/precise-capturing/external-macro.rs b/tests/ui/impl-trait/precise-capturing/external-macro.rs index 1342ecd58dcf2..9d4d8a1bb119a 100644 --- a/tests/ui/impl-trait/precise-capturing/external-macro.rs +++ b/tests/ui/impl-trait/precise-capturing/external-macro.rs @@ -6,7 +6,6 @@ //@ aux-crate: no_use_macro=no-use-macro.rs //@ edition: 2024 //@ check-pass -//@ ignore-backends: gcc no_use_pm::pm_rpit!{} diff --git a/tests/ui/instrument-xray/platform-support.rs b/tests/ui/instrument-xray/platform-support.rs index 68b0e4f5c9821..238018b348dee 100644 --- a/tests/ui/instrument-xray/platform-support.rs +++ b/tests/ui/instrument-xray/platform-support.rs @@ -19,7 +19,6 @@ //@[aarch64-darwin] needs-llvm-components: aarch64 //@[aarch64-darwin] compile-flags: -Z instrument-xray --target=aarch64-apple-darwin //@[aarch64-darwin] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs index e2f251f77e4a9..110c039bee837 100644 --- a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs +++ b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs @@ -4,7 +4,6 @@ //@ revisions: default strict //@ [strict]compile-flags: -Zstrict-init-checks //@ needs-subprocess -//@ ignore-backends: gcc //@ edition:2024 #![allow(deprecated, invalid_value, unreachable_code)] diff --git a/tests/ui/iterators/iter-filter-count-debug-check.rs b/tests/ui/iterators/iter-filter-count-debug-check.rs index 6e3a3f73920e4..121e97a393fff 100644 --- a/tests/ui/iterators/iter-filter-count-debug-check.rs +++ b/tests/ui/iterators/iter-filter-count-debug-check.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -C overflow-checks use std::panic; diff --git a/tests/ui/iterators/iter-sum-overflow-debug.rs b/tests/ui/iterators/iter-sum-overflow-debug.rs index 974282b03792b..32efc925a454e 100644 --- a/tests/ui/iterators/iter-sum-overflow-debug.rs +++ b/tests/ui/iterators/iter-sum-overflow-debug.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -C debug_assertions=yes use std::panic; diff --git a/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs b/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs index aba6f9a188f3a..8fffd19e2beae 100644 --- a/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs +++ b/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -C overflow-checks use std::panic; diff --git a/tests/ui/linking/no-gc-encapsulation-symbols.rs b/tests/ui/linking/no-gc-encapsulation-symbols.rs index c60f35b55eb2f..36d69969199ce 100644 --- a/tests/ui/linking/no-gc-encapsulation-symbols.rs +++ b/tests/ui/linking/no-gc-encapsulation-symbols.rs @@ -5,7 +5,6 @@ // //@ build-pass //@ only-x86_64-unknown-linux-gnu -//@ ignore-backends: gcc unsafe extern "Rust" { // The __start_ section name is magical for the linker, diff --git a/tests/ui/lint/unused-qualification-in-derive-expansion.rs b/tests/ui/lint/unused-qualification-in-derive-expansion.rs index bf095c6449d8f..b2067e22c4443 100644 --- a/tests/ui/lint/unused-qualification-in-derive-expansion.rs +++ b/tests/ui/lint/unused-qualification-in-derive-expansion.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: add-impl.rs -//@ ignore-backends: gcc #![forbid(unused_qualifications)] diff --git a/tests/ui/macros/same-sequence-span.rs b/tests/ui/macros/same-sequence-span.rs index 9fae847a4e2fa..dfaf669a769a6 100644 --- a/tests/ui/macros/same-sequence-span.rs +++ b/tests/ui/macros/same-sequence-span.rs @@ -1,5 +1,4 @@ //@ proc-macro: proc_macro_sequence.rs -//@ ignore-backends: gcc // Regression test for issue #62831: Check that multiple sequences with the same span in the // left-hand side of a macro definition behave as if they had unique spans, and in particular that diff --git a/tests/ui/macros/same-sequence-span.stderr b/tests/ui/macros/same-sequence-span.stderr index d6652453e9a9e..c4289f07feb36 100644 --- a/tests/ui/macros/same-sequence-span.stderr +++ b/tests/ui/macros/same-sequence-span.stderr @@ -1,5 +1,5 @@ error: `$x:expr` may be followed by `$y:tt`, which is not allowed for `expr` fragments - --> $DIR/same-sequence-span.rs:15:18 + --> $DIR/same-sequence-span.rs:14:18 | LL | (1 $x:expr $($y:tt,)* | ^^^^^ not allowed after `expr` fragments @@ -7,7 +7,7 @@ LL | (1 $x:expr $($y:tt,)* = note: allowed there are: `=>`, `,` or `;` error: `$x:expr` may be followed by `=`, which is not allowed for `expr` fragments - --> $DIR/same-sequence-span.rs:16:18 + --> $DIR/same-sequence-span.rs:15:18 | LL | $(= $z:tt)* | ^ not allowed after `expr` fragments @@ -15,7 +15,7 @@ LL | $(= $z:tt)* = note: allowed there are: `=>`, `,` or `;` error: `$x:expr` may be followed by `$y:tt`, which is not allowed for `expr` fragments - --> $DIR/same-sequence-span.rs:20:1 + --> $DIR/same-sequence-span.rs:19:1 | LL | proc_macro_sequence::make_foo!(); | -------------------------------- in this macro invocation @@ -24,7 +24,7 @@ LL | proc_macro_sequence::make_foo!(); = note: this error originates in the macro `proc_macro_sequence::make_foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$x:expr` may be followed by `=`, which is not allowed for `expr` fragments - --> $DIR/same-sequence-span.rs:20:1 + --> $DIR/same-sequence-span.rs:19:1 | LL | proc_macro_sequence::make_foo!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not allowed after `expr` fragments diff --git a/tests/ui/mir/mir_drop_order.rs b/tests/ui/mir/mir_drop_order.rs index a7a1a26a956bf..21d1054c4222d 100644 --- a/tests/ui/mir/mir_drop_order.rs +++ b/tests/ui/mir/mir_drop_order.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc use std::cell::RefCell; use std::panic; diff --git a/tests/ui/mir/mir_let_chains_drop_order.rs b/tests/ui/mir/mir_let_chains_drop_order.rs index 1579e298ee79a..8a54f21b57fa5 100644 --- a/tests/ui/mir/mir_let_chains_drop_order.rs +++ b/tests/ui/mir/mir_let_chains_drop_order.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ edition: 2024 // See `mir_drop_order.rs` for more information diff --git a/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs b/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs index d2007dd2a2070..9c1eaf0fac635 100644 --- a/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs +++ b/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ revisions: edition2021 edition2024 //@ [edition2021] edition: 2021 //@ [edition2024] edition: 2024 diff --git a/tests/ui/numbers-arithmetic/int-abs-overflow.rs b/tests/ui/numbers-arithmetic/int-abs-overflow.rs index fd4a5a6052b83..6397f62d06551 100644 --- a/tests/ui/numbers-arithmetic/int-abs-overflow.rs +++ b/tests/ui/numbers-arithmetic/int-abs-overflow.rs @@ -2,7 +2,6 @@ //@ compile-flags: -C overflow-checks=on //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc use std::thread; diff --git a/tests/ui/numbers-arithmetic/issue-8460.rs b/tests/ui/numbers-arithmetic/issue-8460.rs index 52df432669f12..87867fdc93e41 100644 --- a/tests/ui/numbers-arithmetic/issue-8460.rs +++ b/tests/ui/numbers-arithmetic/issue-8460.rs @@ -2,7 +2,6 @@ #![allow(unused_must_use)] //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc #![feature(rustc_attrs)] use std::thread; diff --git a/tests/ui/panic-handler/catch-unwind-during-unwind-68696.rs b/tests/ui/panic-handler/catch-unwind-during-unwind-68696.rs index b4645a39691c2..aa3f9fc3bcea6 100644 --- a/tests/ui/panic-handler/catch-unwind-during-unwind-68696.rs +++ b/tests/ui/panic-handler/catch-unwind-during-unwind-68696.rs @@ -5,7 +5,6 @@ // entering the catch_unwind. // //@ run-pass -//@ ignore-backends: gcc use std::panic::catch_unwind; diff --git a/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs b/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs index bef2d8bcff050..0566d2319df1a 100644 --- a/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs +++ b/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs @@ -3,7 +3,6 @@ //@ aux-build:exit-success-if-unwind.rs //@ no-prefer-dynamic //@ needs-subprocess -//@ ignore-backends: gcc extern crate exit_success_if_unwind; diff --git a/tests/ui/panic-runtime/abort.rs b/tests/ui/panic-runtime/abort.rs index 2a52228801f8e..8cdfd018a9282 100644 --- a/tests/ui/panic-runtime/abort.rs +++ b/tests/ui/panic-runtime/abort.rs @@ -2,7 +2,6 @@ //@ compile-flags:-C panic=abort //@ no-prefer-dynamic //@ needs-subprocess -//@ ignore-backends: gcc use std::env; use std::process::Command; diff --git a/tests/ui/panic-runtime/link-to-abort.rs b/tests/ui/panic-runtime/link-to-abort.rs index 98718ab8342b8..a4013f2a6cf70 100644 --- a/tests/ui/panic-runtime/link-to-abort.rs +++ b/tests/ui/panic-runtime/link-to-abort.rs @@ -2,7 +2,6 @@ //@ compile-flags:-C panic=abort //@ no-prefer-dynamic -//@ ignore-backends: gcc #![feature(panic_abort)] diff --git a/tests/ui/panics/alloc_error_hook-unwind.rs b/tests/ui/panics/alloc_error_hook-unwind.rs index 8a107bc390d4a..ee8a13f78332c 100644 --- a/tests/ui/panics/alloc_error_hook-unwind.rs +++ b/tests/ui/panics/alloc_error_hook-unwind.rs @@ -3,7 +3,6 @@ //@ run-pass //@ needs-unwind //@ only-linux -//@ ignore-backends: gcc #![feature(alloc_error_hook)] diff --git a/tests/ui/panics/lsda-multiple-action.rs b/tests/ui/panics/lsda-multiple-action.rs index 236e8b90ca5b1..82d425bb1306b 100644 --- a/tests/ui/panics/lsda-multiple-action.rs +++ b/tests/ui/panics/lsda-multiple-action.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -Copt-level=3 struct Guard; diff --git a/tests/ui/panics/panic-abort-backtrace-without-debuginfo.rs b/tests/ui/panics/panic-abort-backtrace-without-debuginfo.rs index 00c90b30af968..a29afd68523be 100644 --- a/tests/ui/panics/panic-abort-backtrace-without-debuginfo.rs +++ b/tests/ui/panics/panic-abort-backtrace-without-debuginfo.rs @@ -16,7 +16,6 @@ //@ ignore-apple //@ ignore-arm-unknown-linux-gnueabihf FIXME(#146996) Try removing this once #146996 has been fixed. //@ ignore-msvc Backtraces on Windows requires debuginfo which we can't use here -//@ ignore-backends: gcc static FN_1: &str = "this_function_must_be_in_the_backtrace"; fn this_function_must_be_in_the_backtrace() { diff --git a/tests/ui/panics/panic-handler-chain-update-hook.rs b/tests/ui/panics/panic-handler-chain-update-hook.rs index b75c21c8b3b2d..cb62e8d8a85fd 100644 --- a/tests/ui/panics/panic-handler-chain-update-hook.rs +++ b/tests/ui/panics/panic-handler-chain-update-hook.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc #![feature(panic_update_hook)] diff --git a/tests/ui/panics/panic-handler-chain.rs b/tests/ui/panics/panic-handler-chain.rs index 49b76834ffe9e..4ff9f3a5a63a2 100644 --- a/tests/ui/panics/panic-handler-chain.rs +++ b/tests/ui/panics/panic-handler-chain.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; diff --git a/tests/ui/panics/panic-handler-flail-wildly.rs b/tests/ui/panics/panic-handler-flail-wildly.rs index b44a388caad32..d7ed84a9caf7d 100644 --- a/tests/ui/panics/panic-handler-flail-wildly.rs +++ b/tests/ui/panics/panic-handler-flail-wildly.rs @@ -4,7 +4,6 @@ #![allow(unused_must_use)] //@ needs-threads -//@ ignore-backends: gcc use std::panic; use std::thread; diff --git a/tests/ui/panics/panic-handler-set-twice.rs b/tests/ui/panics/panic-handler-set-twice.rs index aa40187f08ca2..6d95ec2402973 100644 --- a/tests/ui/panics/panic-handler-set-twice.rs +++ b/tests/ui/panics/panic-handler-set-twice.rs @@ -3,7 +3,6 @@ #![allow(unused_variables)] //@ needs-threads -//@ ignore-backends: gcc use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; diff --git a/tests/ui/panics/panic-in-dtor-drops-fields.rs b/tests/ui/panics/panic-in-dtor-drops-fields.rs index db07923433752..38eb6d0acfb81 100644 --- a/tests/ui/panics/panic-in-dtor-drops-fields.rs +++ b/tests/ui/panics/panic-in-dtor-drops-fields.rs @@ -4,7 +4,6 @@ #![allow(non_upper_case_globals)] //@ needs-threads -//@ ignore-backends: gcc use std::thread; diff --git a/tests/ui/panics/panic-recover-propagate.rs b/tests/ui/panics/panic-recover-propagate.rs index 36ca279bdbd25..ef6ae4fd7887d 100644 --- a/tests/ui/panics/panic-recover-propagate.rs +++ b/tests/ui/panics/panic-recover-propagate.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; diff --git a/tests/ui/panics/rvalue-cleanup-during-box-panic.rs b/tests/ui/panics/rvalue-cleanup-during-box-panic.rs index 03571f111aac0..84c5d85d7e096 100644 --- a/tests/ui/panics/rvalue-cleanup-during-box-panic.rs +++ b/tests/ui/panics/rvalue-cleanup-during-box-panic.rs @@ -21,7 +21,6 @@ // scenario worth testing. //@ needs-threads -//@ ignore-backends: gcc use std::thread; diff --git a/tests/ui/panics/unwind-force-no-unwind-tables.rs b/tests/ui/panics/unwind-force-no-unwind-tables.rs index 715f288fff10e..2226e4dd03ebc 100644 --- a/tests/ui/panics/unwind-force-no-unwind-tables.rs +++ b/tests/ui/panics/unwind-force-no-unwind-tables.rs @@ -6,7 +6,6 @@ //@ needs-unwind //@ ignore-windows target requires uwtable //@ compile-flags: -C panic=unwind -C force-unwind-tables=n -//@ ignore-backends: gcc use std::panic::{self, AssertUnwindSafe}; diff --git a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs index c82efe79e4d0f..461890e63e37b 100644 --- a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs +++ b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-89971-outer-attr-following-inner-attr-ice.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_89971_outer_attr_following_inner_attr_ice; diff --git a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr index 392e7d0321f03..51df17c7cc670 100644 --- a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr +++ b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr @@ -1,5 +1,5 @@ error: an inner attribute is not permitted in this context - --> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:12:1 + --> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:11:1 | LL | #![deny(missing_docs)] | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/parser/macro/unicode-control-codepoints-macros.rs b/tests/ui/parser/macro/unicode-control-codepoints-macros.rs index 701e7dfa30a39..775c50779760a 100644 --- a/tests/ui/parser/macro/unicode-control-codepoints-macros.rs +++ b/tests/ui/parser/macro/unicode-control-codepoints-macros.rs @@ -1,7 +1,6 @@ // Regression test for #140281 //@ edition: 2021 //@ proc-macro: unicode-control.rs -//@ ignore-backends: gcc extern crate unicode_control; use unicode_control::*; diff --git a/tests/ui/parser/macro/unicode-control-codepoints-macros.stderr b/tests/ui/parser/macro/unicode-control-codepoints-macros.stderr index b1d9c9d018744..2f40e327a4052 100644 --- a/tests/ui/parser/macro/unicode-control-codepoints-macros.stderr +++ b/tests/ui/parser/macro/unicode-control-codepoints-macros.stderr @@ -1,5 +1,5 @@ error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:21:9 + --> $DIR/unicode-control-codepoints-macros.rs:20:9 | LL | /// �test� RTL in doc in vec | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment contains invisible unicode text flow control codepoints @@ -10,7 +10,7 @@ LL | /// �test� RTL in doc in vec = note: `#[deny(text_direction_codepoint_in_literal)]` on by default error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:26:9 + --> $DIR/unicode-control-codepoints-macros.rs:25:9 | LL | / /** LL | | * �test� RTL in doc in macro @@ -22,7 +22,7 @@ LL | | */ = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:33:9 + --> $DIR/unicode-control-codepoints-macros.rs:32:9 | LL | / /** LL | | * �test� RTL in doc in macro @@ -34,7 +34,7 @@ LL | | */ = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:41:9 + --> $DIR/unicode-control-codepoints-macros.rs:40:9 | LL | /// �test� RTL in doc in proc macro | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment contains invisible unicode text flow control codepoints @@ -44,7 +44,7 @@ LL | /// �test� RTL in doc in proc macro = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:46:9 + --> $DIR/unicode-control-codepoints-macros.rs:45:9 | LL | /// �test� RTL in doc in proc macro | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment contains invisible unicode text flow control codepoints diff --git a/tests/ui/parser/tuple-index-suffix-proc-macro.rs b/tests/ui/parser/tuple-index-suffix-proc-macro.rs index 2463897381ec2..557c67738d30f 100644 --- a/tests/ui/parser/tuple-index-suffix-proc-macro.rs +++ b/tests/ui/parser/tuple-index-suffix-proc-macro.rs @@ -3,7 +3,6 @@ //! Like `tuple-index-suffix.rs`, but exercises the proc-macro interaction. //@ proc-macro: tuple-index-suffix-proc-macro-aux.rs -//@ ignore-backends: gcc extern crate tuple_index_suffix_proc_macro_aux; use tuple_index_suffix_proc_macro_aux as aux; diff --git a/tests/ui/parser/tuple-index-suffix-proc-macro.stderr b/tests/ui/parser/tuple-index-suffix-proc-macro.stderr index a242af5a789f7..47d179d355513 100644 --- a/tests/ui/parser/tuple-index-suffix-proc-macro.stderr +++ b/tests/ui/parser/tuple-index-suffix-proc-macro.stderr @@ -1,23 +1,23 @@ error: suffixes on a tuple index are invalid - --> $DIR/tuple-index-suffix-proc-macro.rs:18:28 + --> $DIR/tuple-index-suffix-proc-macro.rs:17:28 | LL | aux::bad_tup_indexing!(0usize); | ^^^^^^ invalid suffix `usize` error: suffixes on a tuple index are invalid - --> $DIR/tuple-index-suffix-proc-macro.rs:20:47 + --> $DIR/tuple-index-suffix-proc-macro.rs:19:47 | LL | aux::bad_tup_struct_indexing!(tup_struct, 0isize); | ^^^^^^ invalid suffix `isize` error: suffixes on a tuple index are invalid - --> $DIR/tuple-index-suffix-proc-macro.rs:25:28 + --> $DIR/tuple-index-suffix-proc-macro.rs:24:28 | LL | aux::bad_tup_indexing!(0u8); | ^^^ invalid suffix `u8` error: suffixes on a tuple index are invalid - --> $DIR/tuple-index-suffix-proc-macro.rs:27:47 + --> $DIR/tuple-index-suffix-proc-macro.rs:26:47 | LL | aux::bad_tup_struct_indexing!(tup_struct, 0u64); | ^^^^ invalid suffix `u64` diff --git a/tests/ui/parser/unclosed-delimiter-in-dep.rs b/tests/ui/parser/unclosed-delimiter-in-dep.rs index 4f0423a704f2e..40f517f317ef7 100644 --- a/tests/ui/parser/unclosed-delimiter-in-dep.rs +++ b/tests/ui/parser/unclosed-delimiter-in-dep.rs @@ -1,5 +1,3 @@ -//@ ignore-backends: gcc - mod unclosed_delim_mod; fn main() { diff --git a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs index d7306508f39d4..51f59ccab12c0 100644 --- a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs +++ b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ revisions: empty unprefixed all_unknown all_known mixed //@[empty] needs-llvm-components: aarch64 diff --git a/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs b/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs index 2d8b3b7a1915d..da482bcf97610 100644 --- a/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs +++ b/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ check-pass //@ needs-llvm-components: aarch64 diff --git a/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs b/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs index 6838e749fd333..03f811d0c4881 100644 --- a/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs +++ b/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ check-fail //@ needs-llvm-components: aarch64 diff --git a/tests/ui/proc-macro/add-impl.rs b/tests/ui/proc-macro/add-impl.rs index 645e9321bba04..2299f05c2e7fa 100644 --- a/tests/ui/proc-macro/add-impl.rs +++ b/tests/ui/proc-macro/add-impl.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: add-impl.rs -//@ ignore-backends: gcc #[macro_use] extern crate add_impl; diff --git a/tests/ui/proc-macro/ambiguous-builtin-attrs-test.rs b/tests/ui/proc-macro/ambiguous-builtin-attrs-test.rs index e580e0784b34e..8ee2223822a3c 100644 --- a/tests/ui/proc-macro/ambiguous-builtin-attrs-test.rs +++ b/tests/ui/proc-macro/ambiguous-builtin-attrs-test.rs @@ -1,6 +1,5 @@ //@ proc-macro: builtin-attrs.rs //@ compile-flags:--test -//@ ignore-backends: gcc #![feature(decl_macro, test)] diff --git a/tests/ui/proc-macro/ambiguous-builtin-attrs-test.stderr b/tests/ui/proc-macro/ambiguous-builtin-attrs-test.stderr index e5de873cf31f8..346cebf639d17 100644 --- a/tests/ui/proc-macro/ambiguous-builtin-attrs-test.stderr +++ b/tests/ui/proc-macro/ambiguous-builtin-attrs-test.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `NonExistent` in this scope - --> $DIR/ambiguous-builtin-attrs-test.rs:20:5 + --> $DIR/ambiguous-builtin-attrs-test.rs:19:5 | LL | NonExistent; | ^^^^^^^^^^^ not found in this scope diff --git a/tests/ui/proc-macro/ambiguous-builtin-attrs.rs b/tests/ui/proc-macro/ambiguous-builtin-attrs.rs index 922a2e4c1f463..9fd7bf26adc3b 100644 --- a/tests/ui/proc-macro/ambiguous-builtin-attrs.rs +++ b/tests/ui/proc-macro/ambiguous-builtin-attrs.rs @@ -1,6 +1,5 @@ //@ edition:2018 //@ proc-macro: builtin-attrs.rs -//@ ignore-backends: gcc #![feature(decl_macro)] //~ ERROR `feature` is ambiguous extern crate builtin_attrs; diff --git a/tests/ui/proc-macro/ambiguous-builtin-attrs.stderr b/tests/ui/proc-macro/ambiguous-builtin-attrs.stderr index 611721f9c6edb..04a76c41b8bf4 100644 --- a/tests/ui/proc-macro/ambiguous-builtin-attrs.stderr +++ b/tests/ui/proc-macro/ambiguous-builtin-attrs.stderr @@ -1,11 +1,11 @@ error[E0425]: cannot find value `NonExistent` in this scope - --> $DIR/ambiguous-builtin-attrs.rs:35:5 + --> $DIR/ambiguous-builtin-attrs.rs:34:5 | LL | NonExistent; | ^^^^^^^^^^^ not found in this scope error[E0659]: `repr` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:10:3 + --> $DIR/ambiguous-builtin-attrs.rs:9:3 | LL | #[repr(C)] | ^^^^ ambiguous name @@ -13,14 +13,14 @@ LL | #[repr(C)] = note: ambiguous because of a name conflict with a builtin attribute = note: `repr` could refer to a built-in attribute note: `repr` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:12:18 + --> $DIR/ambiguous-builtin-attrs.rs:11:18 | LL | #[cfg_attr(true, repr(C))] | ^^^^ ambiguous name @@ -28,14 +28,14 @@ LL | #[cfg_attr(true, repr(C))] = note: ambiguous because of a name conflict with a builtin attribute = note: `repr` could refer to a built-in attribute note: `repr` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:21:34 + --> $DIR/ambiguous-builtin-attrs.rs:20:34 | LL | fn non_macro_expanded_location<#[repr(C)] T>() { | ^^^^ ambiguous name @@ -43,14 +43,14 @@ LL | fn non_macro_expanded_location<#[repr(C)] T>() { = note: ambiguous because of a name conflict with a builtin attribute = note: `repr` could refer to a built-in attribute note: `repr` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:25:11 + --> $DIR/ambiguous-builtin-attrs.rs:24:11 | LL | #[repr(C)] | ^^^^ ambiguous name @@ -58,14 +58,14 @@ LL | #[repr(C)] = note: ambiguous because of a name conflict with a builtin attribute = note: `repr` could refer to a built-in attribute note: `repr` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `allow` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:39:3 + --> $DIR/ambiguous-builtin-attrs.rs:38:3 | LL | #[allow(unused)] | ^^^^^ ambiguous name @@ -73,14 +73,14 @@ LL | #[allow(unused)] = note: ambiguous because of a name conflict with a builtin attribute = note: `allow` could refer to a built-in attribute note: `allow` could also refer to the built-in attribute imported here - --> $DIR/ambiguous-builtin-attrs.rs:38:5 + --> $DIR/ambiguous-builtin-attrs.rs:37:5 | LL | use deny as allow; | ^^^^^^^^^^^^^ = help: use `crate::allow` to refer to this built-in attribute unambiguously error[E0659]: `feature` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:4:4 + --> $DIR/ambiguous-builtin-attrs.rs:3:4 | LL | #![feature(decl_macro)] | ^^^^^^^ ambiguous name @@ -88,14 +88,14 @@ LL | #![feature(decl_macro)] = note: ambiguous because of a name conflict with a builtin attribute = note: `feature` could refer to a built-in attribute note: `feature` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::feature` to refer to this attribute macro unambiguously error: the `repr(C)` attribute cannot be used on match arms - --> $DIR/ambiguous-builtin-attrs.rs:25:11 + --> $DIR/ambiguous-builtin-attrs.rs:24:11 | LL | #[repr(C)] | ^^^^^^^ @@ -105,7 +105,7 @@ LL | _ => {} = help: the `repr(C)` attribute can only be applied to data types error: the `repr(C)` attribute cannot be used on type parameters - --> $DIR/ambiguous-builtin-attrs.rs:21:34 + --> $DIR/ambiguous-builtin-attrs.rs:20:34 | LL | fn non_macro_expanded_location<#[repr(C)] T>() { | ^^^^^^^ diff --git a/tests/ui/proc-macro/append-impl.rs b/tests/ui/proc-macro/append-impl.rs index 48d21968de0ce..c0f208460b297 100644 --- a/tests/ui/proc-macro/append-impl.rs +++ b/tests/ui/proc-macro/append-impl.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: append-impl.rs -//@ ignore-backends: gcc #![allow(warnings)] diff --git a/tests/ui/proc-macro/attr-args.rs b/tests/ui/proc-macro/attr-args.rs index 4109b450a8ab3..1d3e0f725d250 100644 --- a/tests/ui/proc-macro/attr-args.rs +++ b/tests/ui/proc-macro/attr-args.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: attr-args.rs -//@ ignore-backends: gcc #![allow(warnings)] diff --git a/tests/ui/proc-macro/attr-invalid-exprs.rs b/tests/ui/proc-macro/attr-invalid-exprs.rs index bdfc0587b3b02..f476858a32ba1 100644 --- a/tests/ui/proc-macro/attr-invalid-exprs.rs +++ b/tests/ui/proc-macro/attr-invalid-exprs.rs @@ -1,7 +1,6 @@ //! Attributes producing expressions in invalid locations //@ proc-macro: attr-stmt-expr.rs -//@ ignore-backends: gcc #![feature(proc_macro_hygiene)] #![feature(stmt_expr_attributes)] diff --git a/tests/ui/proc-macro/attr-invalid-exprs.stderr b/tests/ui/proc-macro/attr-invalid-exprs.stderr index 43241e1e6fd5c..0d500c871453f 100644 --- a/tests/ui/proc-macro/attr-invalid-exprs.stderr +++ b/tests/ui/proc-macro/attr-invalid-exprs.stderr @@ -1,11 +1,11 @@ error: expected expression, found end of macro arguments - --> $DIR/attr-invalid-exprs.rs:13:13 + --> $DIR/attr-invalid-exprs.rs:12:13 | LL | let _ = #[no_output] "Hello, world!"; | ^^^^^^^^^^^^ error: macro expansion ignores `,` and any tokens following - --> $DIR/attr-invalid-exprs.rs:16:13 + --> $DIR/attr-invalid-exprs.rs:15:13 | LL | let _ = #[duplicate] "Hello, world!"; | ^^^^^^^^^^^^ caused by the macro expansion here @@ -17,7 +17,7 @@ LL | let _ = #[duplicate]; "Hello, world!"; | + error: macro expansion ignores `,` and any tokens following - --> $DIR/attr-invalid-exprs.rs:25:9 + --> $DIR/attr-invalid-exprs.rs:24:9 | LL | #[duplicate] | ^^^^^^^^^^^^ caused by the macro expansion here diff --git a/tests/ui/proc-macro/attr-on-trait.rs b/tests/ui/proc-macro/attr-on-trait.rs index 345653864f841..e95760a837c05 100644 --- a/tests/ui/proc-macro/attr-on-trait.rs +++ b/tests/ui/proc-macro/attr-on-trait.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: attr-on-trait.rs -//@ ignore-backends: gcc extern crate attr_on_trait; diff --git a/tests/ui/proc-macro/bang-macro.rs b/tests/ui/proc-macro/bang-macro.rs index 75f40de242ec9..2287e34c5dda9 100644 --- a/tests/ui/proc-macro/bang-macro.rs +++ b/tests/ui/proc-macro/bang-macro.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: bang-macro.rs -//@ ignore-backends: gcc extern crate bang_macro; use bang_macro::rewrite; diff --git a/tests/ui/proc-macro/call-site.rs b/tests/ui/proc-macro/call-site.rs index 5de4061b2a948..9c285e1ed117a 100644 --- a/tests/ui/proc-macro/call-site.rs +++ b/tests/ui/proc-macro/call-site.rs @@ -1,6 +1,5 @@ //@ check-pass //@ proc-macro: call-site.rs -//@ ignore-backends: gcc extern crate call_site; diff --git a/tests/ui/proc-macro/count_compound_ops.rs b/tests/ui/proc-macro/count_compound_ops.rs index fe90e7bfbe49a..20b0b87817e2f 100644 --- a/tests/ui/proc-macro/count_compound_ops.rs +++ b/tests/ui/proc-macro/count_compound_ops.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: count_compound_ops.rs -//@ ignore-backends: gcc extern crate count_compound_ops; use count_compound_ops::count_compound_ops; diff --git a/tests/ui/proc-macro/derive-bad.rs b/tests/ui/proc-macro/derive-bad.rs index 9b9a2bc33c946..9b237c731dbe4 100644 --- a/tests/ui/proc-macro/derive-bad.rs +++ b/tests/ui/proc-macro/derive-bad.rs @@ -1,5 +1,4 @@ //@ proc-macro: derive-bad.rs -//@ ignore-backends: gcc #[macro_use] extern crate derive_bad; diff --git a/tests/ui/proc-macro/derive-bad.stderr b/tests/ui/proc-macro/derive-bad.stderr index 8a252e826efff..43e97f40ba884 100644 --- a/tests/ui/proc-macro/derive-bad.stderr +++ b/tests/ui/proc-macro/derive-bad.stderr @@ -1,5 +1,5 @@ error: expected `:`, found `}` - --> $DIR/derive-bad.rs:7:10 + --> $DIR/derive-bad.rs:6:10 | LL | #[derive(A)] | ^ @@ -10,13 +10,13 @@ LL | #[derive(A)] = note: this error originates in the derive macro `A` (in Nightly builds, run with -Z macro-backtrace for more info) error: proc-macro derive produced unparsable tokens - --> $DIR/derive-bad.rs:7:10 + --> $DIR/derive-bad.rs:6:10 | LL | #[derive(A)] | ^ error[E0428]: the name `A` is defined multiple times - --> $DIR/derive-bad.rs:10:1 + --> $DIR/derive-bad.rs:9:1 | LL | #[derive(A)] | - previous definition of the type `A` here diff --git a/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr b/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr index 3a018bdcf0ad9..faae9014c38ba 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr +++ b/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr @@ -1,5 +1,5 @@ error: cannot find attribute `empty_helper` in this scope - --> $DIR/derive-helper-shadowing.rs:41:22 + --> $DIR/derive-helper-shadowing.rs:40:22 | LL | #[derive(GenHelperUse)] | ^^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL + use empty_helper; | error: cannot find attribute `empty_helper` in this scope - --> $DIR/derive-helper-shadowing.rs:17:11 + --> $DIR/derive-helper-shadowing.rs:16:11 | LL | macro_rules! gen_helper_use { LL | () => { @@ -29,26 +29,26 @@ LL + use empty_helper; | error[E0659]: `empty_helper` is ambiguous - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ ambiguous name | = note: ambiguous because of a name conflict with a derive helper attribute note: `empty_helper` could refer to the derive helper attribute defined here - --> $DIR/derive-helper-shadowing.rs:25:10 + --> $DIR/derive-helper-shadowing.rs:24:10 | LL | #[derive(Empty)] | ^^^^^ note: `empty_helper` could also refer to the attribute macro imported here - --> $DIR/derive-helper-shadowing.rs:13:5 + --> $DIR/derive-helper-shadowing.rs:12:5 | LL | use test_macros::empty_attr as empty_helper; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: use `crate::empty_helper` to refer to this attribute macro unambiguously error: derive helper attribute is used before it is introduced - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ @@ -65,7 +65,7 @@ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0659`. Future incompatibility report: Future breakage diagnostic: error: derive helper attribute is used before it is introduced - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr b/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr index a5c6ef25056ce..cb92094dada4c 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr +++ b/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr @@ -1,17 +1,17 @@ error: cannot use a derive helper attribute through an import - --> $DIR/derive-helper-shadowing.rs:45:15 + --> $DIR/derive-helper-shadowing.rs:44:15 | LL | #[renamed] | ^^^^^^^ | note: the derive helper attribute imported here - --> $DIR/derive-helper-shadowing.rs:44:17 + --> $DIR/derive-helper-shadowing.rs:43:17 | LL | use empty_helper as renamed; | ^^^^^^^^^^^^^^^^^^^^^^^ error: cannot find attribute `empty_helper` in this scope - --> $DIR/derive-helper-shadowing.rs:41:22 + --> $DIR/derive-helper-shadowing.rs:40:22 | LL | #[derive(GenHelperUse)] | ^^^^^^^^^^^^ @@ -24,7 +24,7 @@ LL + use crate::empty_helper; | error: cannot find attribute `empty_helper` in this scope - --> $DIR/derive-helper-shadowing.rs:17:11 + --> $DIR/derive-helper-shadowing.rs:16:11 | LL | macro_rules! gen_helper_use { LL | () => { @@ -41,26 +41,26 @@ LL + use crate::empty_helper; | error[E0659]: `empty_helper` is ambiguous - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ ambiguous name | = note: ambiguous because of a name conflict with a derive helper attribute note: `empty_helper` could refer to the derive helper attribute defined here - --> $DIR/derive-helper-shadowing.rs:25:10 + --> $DIR/derive-helper-shadowing.rs:24:10 | LL | #[derive(Empty)] | ^^^^^ note: `empty_helper` could also refer to the attribute macro imported here - --> $DIR/derive-helper-shadowing.rs:13:5 + --> $DIR/derive-helper-shadowing.rs:12:5 | LL | use test_macros::empty_attr as empty_helper; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: use `crate::empty_helper` to refer to this attribute macro unambiguously error: derive helper attribute is used before it is introduced - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ @@ -77,7 +77,7 @@ error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0659`. Future incompatibility report: Future breakage diagnostic: error: derive helper attribute is used before it is introduced - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/derive-helper-shadowing.rs b/tests/ui/proc-macro/derive-helper-shadowing.rs index 324d2477869e2..6a6a5760c45a6 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.rs +++ b/tests/ui/proc-macro/derive-helper-shadowing.rs @@ -3,7 +3,6 @@ //@[edition2018] edition:2018 //@ proc-macro: test-macros.rs //@ proc-macro: derive-helper-shadowing.rs -//@ ignore-backends: gcc #[macro_use] extern crate test_macros; diff --git a/tests/ui/proc-macro/derive-same-struct.rs b/tests/ui/proc-macro/derive-same-struct.rs index 04ab08dc76e5b..f7669ba1480b2 100644 --- a/tests/ui/proc-macro/derive-same-struct.rs +++ b/tests/ui/proc-macro/derive-same-struct.rs @@ -3,7 +3,6 @@ #![allow(path_statements)] #![allow(dead_code)] //@ proc-macro: derive-same-struct.rs -//@ ignore-backends: gcc #[macro_use] extern crate derive_same_struct; diff --git a/tests/ui/proc-macro/edition-imports-2018.rs b/tests/ui/proc-macro/edition-imports-2018.rs index af9eed74adb9b..a3808d9dce823 100644 --- a/tests/ui/proc-macro/edition-imports-2018.rs +++ b/tests/ui/proc-macro/edition-imports-2018.rs @@ -1,7 +1,6 @@ //@ check-pass //@ edition:2018 //@ proc-macro: edition-imports-2015.rs -//@ ignore-backends: gcc #[macro_use] extern crate edition_imports_2015; diff --git a/tests/ui/proc-macro/env.rs b/tests/ui/proc-macro/env.rs index ef3d8b5a898cb..c6923898d6ab2 100644 --- a/tests/ui/proc-macro/env.rs +++ b/tests/ui/proc-macro/env.rs @@ -1,7 +1,6 @@ //@ proc-macro: env.rs //@ run-pass //@ rustc-env: THE_CONST=1 -//@ ignore-backends: gcc #![crate_name = "foo"] diff --git a/tests/ui/proc-macro/expand-to-unstable.rs b/tests/ui/proc-macro/expand-to-unstable.rs index 37bfeab1fe71e..8968471ebd872 100644 --- a/tests/ui/proc-macro/expand-to-unstable.rs +++ b/tests/ui/proc-macro/expand-to-unstable.rs @@ -1,5 +1,4 @@ //@ proc-macro: derive-unstable.rs -//@ ignore-backends: gcc #![allow(warnings)] diff --git a/tests/ui/proc-macro/expand-to-unstable.stderr b/tests/ui/proc-macro/expand-to-unstable.stderr index 255f80501ea73..563c7ae8f9561 100644 --- a/tests/ui/proc-macro/expand-to-unstable.stderr +++ b/tests/ui/proc-macro/expand-to-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library - --> $DIR/expand-to-unstable.rs:9:10 + --> $DIR/expand-to-unstable.rs:8:10 | LL | #[derive(Unstable)] | ^^^^^^^^ diff --git a/tests/ui/proc-macro/expand-with-a-macro.rs b/tests/ui/proc-macro/expand-with-a-macro.rs index aa02cefbec684..e5baf3601db0a 100644 --- a/tests/ui/proc-macro/expand-with-a-macro.rs +++ b/tests/ui/proc-macro/expand-with-a-macro.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ proc-macro: expand-with-a-macro.rs -//@ ignore-backends: gcc #![deny(warnings)] diff --git a/tests/ui/proc-macro/gen-macro-rules-hygiene.rs b/tests/ui/proc-macro/gen-macro-rules-hygiene.rs index fb7c830c2edf4..3deec94fa3411 100644 --- a/tests/ui/proc-macro/gen-macro-rules-hygiene.rs +++ b/tests/ui/proc-macro/gen-macro-rules-hygiene.rs @@ -3,7 +3,6 @@ // `$crate` refers to the crate that defines `macro_rules` and not the outer transparent macro. //@ proc-macro: gen-macro-rules-hygiene.rs -//@ ignore-backends: gcc #[macro_use] extern crate gen_macro_rules_hygiene; diff --git a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr index 5238b26a6a74a..c39dc3d8de208 100644 --- a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr +++ b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr @@ -1,5 +1,5 @@ error[E0426]: use of undeclared label `'label_use` - --> $DIR/gen-macro-rules-hygiene.rs:13:1 + --> $DIR/gen-macro-rules-hygiene.rs:12:1 | LL | gen_macro_rules!(); | ^^^^^^^^^^^^^^^^^^ undeclared label `'label_use` @@ -8,7 +8,7 @@ LL | generated!(); | ------------ in this macro invocation error[E0425]: cannot find value `local_use` in this scope - --> $DIR/gen-macro-rules-hygiene.rs:13:1 + --> $DIR/gen-macro-rules-hygiene.rs:12:1 | LL | gen_macro_rules!(); | ^^^^^^^^^^^^^^^^^^ not found in this scope @@ -17,7 +17,7 @@ LL | generated!(); | ------------ in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/gen-macro-rules-hygiene.rs:19:13 + --> $DIR/gen-macro-rules-hygiene.rs:18:13 | LL | let local_use = 1; | ^^^^^^^^^ @@ -28,7 +28,7 @@ LL + local_def; | error[E0425]: cannot find value `local_def` in this scope - --> $DIR/gen-macro-rules-hygiene.rs:22:9 + --> $DIR/gen-macro-rules-hygiene.rs:21:9 | LL | gen_macro_rules!(); ... @@ -36,7 +36,7 @@ LL | local_def; | ^^^^^^^^^ not found in this scope | help: an identifier with the same name is defined here, but is not accessible due to macro hygiene - --> $DIR/gen-macro-rules-hygiene.rs:13:1 + --> $DIR/gen-macro-rules-hygiene.rs:12:1 | LL | gen_macro_rules!(); | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/gen-macro-rules.rs b/tests/ui/proc-macro/gen-macro-rules.rs index 8ee38b2cc2795..121d029e2e346 100644 --- a/tests/ui/proc-macro/gen-macro-rules.rs +++ b/tests/ui/proc-macro/gen-macro-rules.rs @@ -2,7 +2,6 @@ //@ check-pass //@ proc-macro: gen-macro-rules.rs -//@ ignore-backends: gcc extern crate gen_macro_rules as repro; diff --git a/tests/ui/proc-macro/generate-mod.rs b/tests/ui/proc-macro/generate-mod.rs index 23f231047e7fd..2f24b27509ab9 100644 --- a/tests/ui/proc-macro/generate-mod.rs +++ b/tests/ui/proc-macro/generate-mod.rs @@ -2,7 +2,6 @@ // Modules generated by transparent proc macros still acts as barriers for names (issue #50504). //@ proc-macro: generate-mod.rs -//@ ignore-backends: gcc extern crate generate_mod; diff --git a/tests/ui/proc-macro/generate-mod.stderr b/tests/ui/proc-macro/generate-mod.stderr index af90df2c3dc3b..821a91aa19617 100644 --- a/tests/ui/proc-macro/generate-mod.stderr +++ b/tests/ui/proc-macro/generate-mod.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:11:1 + --> $DIR/generate-mod.rs:10:1 | LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -9,7 +9,7 @@ LL | generate_mod::check!(); = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `Outer` in this scope - --> $DIR/generate-mod.rs:11:1 + --> $DIR/generate-mod.rs:10:1 | LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -19,7 +19,7 @@ LL | generate_mod::check!(); = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:14:1 + --> $DIR/generate-mod.rs:13:1 | LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -29,7 +29,7 @@ LL | #[generate_mod::check_attr] = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `OuterAttr` in this scope - --> $DIR/generate-mod.rs:14:1 + --> $DIR/generate-mod.rs:13:1 | LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -39,7 +39,7 @@ LL | #[generate_mod::check_attr] = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:18:10 + --> $DIR/generate-mod.rs:17:10 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -50,7 +50,7 @@ LL | #[derive(generate_mod::CheckDerive)] = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:18:10 + --> $DIR/generate-mod.rs:17:10 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -60,7 +60,7 @@ LL | #[derive(generate_mod::CheckDerive)] = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:25:14 + --> $DIR/generate-mod.rs:24:14 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -70,7 +70,7 @@ LL | #[derive(generate_mod::CheckDerive)] = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:25:14 + --> $DIR/generate-mod.rs:24:14 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -84,7 +84,7 @@ error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0425`. Future incompatibility report: Future breakage diagnostic: error: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:18:10 + --> $DIR/generate-mod.rs:17:10 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -96,7 +96,7 @@ LL | #[derive(generate_mod::CheckDerive)] Future breakage diagnostic: error: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:18:10 + --> $DIR/generate-mod.rs:17:10 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -108,7 +108,7 @@ LL | #[derive(generate_mod::CheckDerive)] Future breakage diagnostic: error: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:25:14 + --> $DIR/generate-mod.rs:24:14 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -120,7 +120,7 @@ LL | #[derive(generate_mod::CheckDerive)] Future breakage diagnostic: error: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:25:14 + --> $DIR/generate-mod.rs:24:14 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -132,7 +132,7 @@ LL | #[derive(generate_mod::CheckDerive)] Future breakage diagnostic: warning: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:32:10 + --> $DIR/generate-mod.rs:31:10 | LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -143,7 +143,7 @@ LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed Future breakage diagnostic: warning: cannot find type `OuterDeriveLint` in this scope - --> $DIR/generate-mod.rs:32:10 + --> $DIR/generate-mod.rs:31:10 | LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import diff --git a/tests/ui/proc-macro/hygiene_example.rs b/tests/ui/proc-macro/hygiene_example.rs index f74f22fb3b0e0..84b5e345608aa 100644 --- a/tests/ui/proc-macro/hygiene_example.rs +++ b/tests/ui/proc-macro/hygiene_example.rs @@ -1,6 +1,5 @@ //@ check-pass //@ aux-build:hygiene_example.rs -//@ ignore-backends: gcc extern crate hygiene_example; use hygiene_example::hello; diff --git a/tests/ui/proc-macro/is-available.rs b/tests/ui/proc-macro/is-available.rs index 9e9cf5d11b661..faee560d7a975 100644 --- a/tests/ui/proc-macro/is-available.rs +++ b/tests/ui/proc-macro/is-available.rs @@ -3,7 +3,6 @@ extern crate proc_macro; //@ proc-macro: is-available.rs -//@ ignore-backends: gcc extern crate is_available; fn main() { diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs index 0c66b47b39418..8ff046e9b2d59 100644 --- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs +++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-104884.rs -//@ ignore-backends: gcc use std::collections::BinaryHeap; diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr index 0390295a66a42..2f2181be49855 100644 --- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr +++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `PriorityQueue` with `PriorityQueue` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:8 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:8 | LL | #[derive(PartialOrd, AddImpl)] | ---------- in this derive macro expansion @@ -8,7 +8,7 @@ LL | struct PriorityQueue(BinaryHeap>); | ^^^^^^^^^^^^^ no implementation for `PriorityQueue == PriorityQueue` | help: the trait `PartialEq` is not implemented for `PriorityQueue` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:1 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:1 | LL | struct PriorityQueue(BinaryHeap>); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,13 +16,13 @@ note: required by a bound in `PartialOrd` --> $SRC_DIR/core/src/cmp.rs:LL:COL error[E0277]: the trait bound `PriorityQueue: Eq` is not satisfied - --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 | LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^ unsatisfied trait bound | help: the trait `Eq` is not implemented for `PriorityQueue` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:1 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:1 | LL | struct PriorityQueue(BinaryHeap>); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,13 +31,13 @@ note: required by a bound in `Ord` = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `T` with `T` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 | LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^ no implementation for `T < T` and `T > T` | note: required for `PriorityQueue` to implement `PartialOrd` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:8 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:8 | LL | #[derive(PartialOrd, AddImpl)] | ---------- in this derive macro expansion @@ -48,7 +48,7 @@ note: required by a bound in `Ord` --> $SRC_DIR/core/src/cmp.rs:LL:COL error[E0277]: can't compare `BinaryHeap>` with `_` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:25 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:25 | LL | #[derive(PartialOrd, AddImpl)] | ---------- in this derive macro expansion @@ -59,7 +59,7 @@ LL | struct PriorityQueue(BinaryHeap>); = help: the trait `PartialOrd<_>` is not implemented for `BinaryHeap>` error[E0599]: no method named `cmp` found for struct `BinaryHeap>` in the current scope - --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 | LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^ `BinaryHeap>` is not an iterator @@ -67,7 +67,7 @@ LL | #[derive(PartialOrd, AddImpl)] = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `height` on type `&PriorityQueue` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 | LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^ unknown field diff --git a/tests/ui/proc-macro/issue-107113-wrap.rs b/tests/ui/proc-macro/issue-107113-wrap.rs index a46cf893d90e8..2799e79bb1cb4 100644 --- a/tests/ui/proc-macro/issue-107113-wrap.rs +++ b/tests/ui/proc-macro/issue-107113-wrap.rs @@ -1,6 +1,5 @@ //@ edition:2021 //@ proc-macro: issue-107113.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_107113; diff --git a/tests/ui/proc-macro/issue-107113-wrap.stderr b/tests/ui/proc-macro/issue-107113-wrap.stderr index 9b5b0333256e6..b541051147d53 100644 --- a/tests/ui/proc-macro/issue-107113-wrap.stderr +++ b/tests/ui/proc-macro/issue-107113-wrap.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-107113-wrap.rs:8:1 + --> $DIR/issue-107113-wrap.rs:7:1 | LL | #[issue_107113::main] | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/issue-118809.rs b/tests/ui/proc-macro/issue-118809.rs index 3ceede7e885cf..a6a3956981a78 100644 --- a/tests/ui/proc-macro/issue-118809.rs +++ b/tests/ui/proc-macro/issue-118809.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-118809.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_118809; diff --git a/tests/ui/proc-macro/issue-118809.stderr b/tests/ui/proc-macro/issue-118809.stderr index 98329fea11940..30b09fd4006bf 100644 --- a/tests/ui/proc-macro/issue-118809.stderr +++ b/tests/ui/proc-macro/issue-118809.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-118809.rs:7:10 + --> $DIR/issue-118809.rs:6:10 | LL | #[derive(Deserialize)] | ^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | #[derive(Deserialize)] | arguments to this enum variant are incorrect | help: the type constructed contains `u32` due to the type of the argument passed - --> $DIR/issue-118809.rs:7:10 + --> $DIR/issue-118809.rs:6:10 | LL | #[derive(Deserialize)] | ^^^^^^^^^^^ this argument influences the type of `Some` diff --git a/tests/ui/proc-macro/issue-38586.rs b/tests/ui/proc-macro/issue-38586.rs index c9623fd383b1a..88dbb8037bebd 100644 --- a/tests/ui/proc-macro/issue-38586.rs +++ b/tests/ui/proc-macro/issue-38586.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-38586.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_38586; diff --git a/tests/ui/proc-macro/issue-38586.stderr b/tests/ui/proc-macro/issue-38586.stderr index e49d4c83e2734..0049155645078 100644 --- a/tests/ui/proc-macro/issue-38586.stderr +++ b/tests/ui/proc-macro/issue-38586.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `foo` in this scope - --> $DIR/issue-38586.rs:7:10 + --> $DIR/issue-38586.rs:6:10 | LL | #[derive(A)] | ^ not found in this scope diff --git a/tests/ui/proc-macro/issue-59191-replace-root-with-fn.rs b/tests/ui/proc-macro/issue-59191-replace-root-with-fn.rs index 988641b2b9c48..df236cce6d2a8 100644 --- a/tests/ui/proc-macro/issue-59191-replace-root-with-fn.rs +++ b/tests/ui/proc-macro/issue-59191-replace-root-with-fn.rs @@ -4,7 +4,6 @@ //@ edition:2018 //@ proc-macro: issue-59191.rs //@ needs-unwind (affects error output) -//@ ignore-backends: gcc #![feature(custom_inner_attributes)] #![issue_59191::no_main] diff --git a/tests/ui/proc-macro/issue-79148.rs b/tests/ui/proc-macro/issue-79148.rs index 7ce6216c842a6..b2248759b5f8e 100644 --- a/tests/ui/proc-macro/issue-79148.rs +++ b/tests/ui/proc-macro/issue-79148.rs @@ -1,6 +1,5 @@ //@ proc-macro: re-export.rs //@ edition:2018 -//@ ignore-backends: gcc extern crate re_export; diff --git a/tests/ui/proc-macro/issue-79148.stderr b/tests/ui/proc-macro/issue-79148.stderr index 80a5b1a0855f7..8adc4c6e0dbe4 100644 --- a/tests/ui/proc-macro/issue-79148.stderr +++ b/tests/ui/proc-macro/issue-79148.stderr @@ -1,11 +1,11 @@ error[E0364]: `Variant` is only public within the crate, and cannot be re-exported outside - --> $DIR/issue-79148.rs:9:1 + --> $DIR/issue-79148.rs:8:1 | LL | cause_ice!(); | ^^^^^^^^^^^^ | note: consider marking `Variant` as `pub` in the imported module - --> $DIR/issue-79148.rs:9:1 + --> $DIR/issue-79148.rs:8:1 | LL | cause_ice!(); | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/issue-83510.rs b/tests/ui/proc-macro/issue-83510.rs index 7f90906f4138e..595ce4f6c3080 100644 --- a/tests/ui/proc-macro/issue-83510.rs +++ b/tests/ui/proc-macro/issue-83510.rs @@ -1,6 +1,5 @@ //@ edition:2015..2021 //@ proc-macro: issue-83510.rs -//@ ignore-backends: gcc extern crate issue_83510; diff --git a/tests/ui/proc-macro/issue-83510.stderr b/tests/ui/proc-macro/issue-83510.stderr index 755d6e3a03ee5..f03e01f39c427 100644 --- a/tests/ui/proc-macro/issue-83510.stderr +++ b/tests/ui/proc-macro/issue-83510.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find type `Foo` in this scope - --> $DIR/issue-83510.rs:7:1 + --> $DIR/issue-83510.rs:6:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -7,7 +7,7 @@ LL | issue_83510::dance_like_you_want_to_ice!(); = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0404]: expected trait, found struct `Box` - --> $DIR/issue-83510.rs:7:1 + --> $DIR/issue-83510.rs:6:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a trait @@ -15,7 +15,7 @@ LL | issue_83510::dance_like_you_want_to_ice!(); = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0405]: cannot find trait `Baz` in this scope - --> $DIR/issue-83510.rs:7:1 + --> $DIR/issue-83510.rs:6:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -23,7 +23,7 @@ LL | issue_83510::dance_like_you_want_to_ice!(); = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: inherent associated types are unstable - --> $DIR/issue-83510.rs:7:1 + --> $DIR/issue-83510.rs:6:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/issue-91800.rs b/tests/ui/proc-macro/issue-91800.rs index 79cbf8632f009..8cecfad32b55b 100644 --- a/tests/ui/proc-macro/issue-91800.rs +++ b/tests/ui/proc-macro/issue-91800.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-91800-macro.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_91800_macro; diff --git a/tests/ui/proc-macro/issue-91800.stderr b/tests/ui/proc-macro/issue-91800.stderr index be5a8ece38404..63ebc0a552e33 100644 --- a/tests/ui/proc-macro/issue-91800.stderr +++ b/tests/ui/proc-macro/issue-91800.stderr @@ -1,5 +1,5 @@ error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-91800.rs:7:10 + --> $DIR/issue-91800.rs:6:10 | LL | #[derive(MyTrait)] | ^^^^^^^ @@ -7,13 +7,13 @@ LL | #[derive(MyTrait)] = note: this error originates in the derive macro `MyTrait` (in Nightly builds, run with -Z macro-backtrace for more info) error: proc-macro derive produced unparsable tokens - --> $DIR/issue-91800.rs:7:10 + --> $DIR/issue-91800.rs:6:10 | LL | #[derive(MyTrait)] | ^^^^^^^ error: - --> $DIR/issue-91800.rs:7:10 + --> $DIR/issue-91800.rs:6:10 | LL | #[derive(MyTrait)] | ^^^^^^^ @@ -21,7 +21,7 @@ LL | #[derive(MyTrait)] = note: this error originates in the derive macro `MyTrait` (in Nightly builds, run with -Z macro-backtrace for more info) error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-91800.rs:11:1 + --> $DIR/issue-91800.rs:10:1 | LL | #[attribute_macro] | ^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | #[attribute_macro] = note: this error originates in the attribute macro `attribute_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: - --> $DIR/issue-91800.rs:11:1 + --> $DIR/issue-91800.rs:10:1 | LL | #[attribute_macro] | ^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | #[attribute_macro] = note: this error originates in the attribute macro `attribute_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-91800.rs:16:1 + --> $DIR/issue-91800.rs:15:1 | LL | fn_macro! {} | ^^^^^^^^^^^^ @@ -45,7 +45,7 @@ LL | fn_macro! {} = note: this error originates in the macro `fn_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: - --> $DIR/issue-91800.rs:16:1 + --> $DIR/issue-91800.rs:15:1 | LL | fn_macro! {} | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/lifetimes-rpass.rs b/tests/ui/proc-macro/lifetimes-rpass.rs index 9b794e695cd1c..c462b27722f7e 100644 --- a/tests/ui/proc-macro/lifetimes-rpass.rs +++ b/tests/ui/proc-macro/lifetimes-rpass.rs @@ -2,7 +2,6 @@ #![allow(unused_variables)] //@ proc-macro: lifetimes-rpass.rs -//@ ignore-backends: gcc extern crate lifetimes_rpass as lifetimes; use lifetimes::*; diff --git a/tests/ui/proc-macro/lints_in_proc_macros.rs b/tests/ui/proc-macro/lints_in_proc_macros.rs index 2c22c787982eb..6714b8b6e1d5f 100644 --- a/tests/ui/proc-macro/lints_in_proc_macros.rs +++ b/tests/ui/proc-macro/lints_in_proc_macros.rs @@ -1,5 +1,4 @@ //@ proc-macro: bang_proc_macro2.rs -//@ ignore-backends: gcc extern crate bang_proc_macro2; diff --git a/tests/ui/proc-macro/lints_in_proc_macros.stderr b/tests/ui/proc-macro/lints_in_proc_macros.stderr index a845a73b45fe3..75e4a82914577 100644 --- a/tests/ui/proc-macro/lints_in_proc_macros.stderr +++ b/tests/ui/proc-macro/lints_in_proc_macros.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `foobar2` in this scope - --> $DIR/lints_in_proc_macros.rs:10:5 + --> $DIR/lints_in_proc_macros.rs:9:5 | LL | bang_proc_macro2!(); | ^^^^^^^^^^^^^^^^^^^ not found in this scope diff --git a/tests/ui/proc-macro/load-two.rs b/tests/ui/proc-macro/load-two.rs index 197e7845db33b..608379949e665 100644 --- a/tests/ui/proc-macro/load-two.rs +++ b/tests/ui/proc-macro/load-two.rs @@ -4,7 +4,6 @@ #![allow(dead_code)] //@ proc-macro: derive-atob.rs //@ proc-macro: derive-ctod.rs -//@ ignore-backends: gcc #[macro_use] extern crate derive_atob; diff --git a/tests/ui/proc-macro/macro-crate-multi-decorator.rs b/tests/ui/proc-macro/macro-crate-multi-decorator.rs index 68d4c8369382f..c89fcea2c63ea 100644 --- a/tests/ui/proc-macro/macro-crate-multi-decorator.rs +++ b/tests/ui/proc-macro/macro-crate-multi-decorator.rs @@ -3,7 +3,6 @@ //@ check-pass //@ proc-macro: duplicate.rs -//@ ignore-backends: gcc #[macro_use] extern crate duplicate; diff --git a/tests/ui/proc-macro/macro_rules_edition_from_pm.rs b/tests/ui/proc-macro/macro_rules_edition_from_pm.rs index fc3ae3ef2c814..8fc7d9097493d 100644 --- a/tests/ui/proc-macro/macro_rules_edition_from_pm.rs +++ b/tests/ui/proc-macro/macro_rules_edition_from_pm.rs @@ -7,7 +7,6 @@ //@[edition2021] edition:2021 //@[edition2024] edition:2024 //@ check-pass -//@ ignore-backends: gcc // This checks how the expr fragment specifier works. macro_rules_edition_pm::make_edition_macro!{} diff --git a/tests/ui/proc-macro/match-expander.rs b/tests/ui/proc-macro/match-expander.rs index b7245c7e682c1..23e5746c540f7 100644 --- a/tests/ui/proc-macro/match-expander.rs +++ b/tests/ui/proc-macro/match-expander.rs @@ -1,5 +1,4 @@ //@ proc-macro: match-expander.rs -//@ ignore-backends: gcc // Ensure that we don't point at macro invocation when providing inference contexts. #[macro_use] diff --git a/tests/ui/proc-macro/match-expander.stderr b/tests/ui/proc-macro/match-expander.stderr index d2423336b1d22..b77468ec60a5e 100644 --- a/tests/ui/proc-macro/match-expander.stderr +++ b/tests/ui/proc-macro/match-expander.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/match-expander.rs:9:5 + --> $DIR/match-expander.rs:8:5 | LL | match_expander::matcher!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `S`, found `bool` diff --git a/tests/ui/proc-macro/mixed-site-span.rs b/tests/ui/proc-macro/mixed-site-span.rs index 23f90ce67b6ef..9310fb5aafa87 100644 --- a/tests/ui/proc-macro/mixed-site-span.rs +++ b/tests/ui/proc-macro/mixed-site-span.rs @@ -3,7 +3,6 @@ //@ aux-build: token-site-span.rs //@ proc-macro: mixed-site-span.rs -//@ ignore-backends: gcc extern crate mixed_site_span; extern crate token_site_span; diff --git a/tests/ui/proc-macro/mixed-site-span.stderr b/tests/ui/proc-macro/mixed-site-span.stderr index 0c1aaaebba581..d47f06ce1e22c 100644 --- a/tests/ui/proc-macro/mixed-site-span.stderr +++ b/tests/ui/proc-macro/mixed-site-span.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:49:5 + --> $DIR/mixed-site-span.rs:48:5 | LL | invoke_with_crate!{input proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -9,7 +9,7 @@ LL | invoke_with_crate!{input proc_macro_item} = note: this error originates in the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:50:5 + --> $DIR/mixed-site-span.rs:49:5 | LL | invoke_with_ident!{input proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -19,7 +19,7 @@ LL | invoke_with_ident!{input proc_macro_item} = note: this error originates in the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:51:5 + --> $DIR/mixed-site-span.rs:50:5 | LL | invoke_with_crate!{call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -29,7 +29,7 @@ LL | invoke_with_crate!{call proc_macro_item} = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:52:5 + --> $DIR/mixed-site-span.rs:51:5 | LL | invoke_with_ident!{call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -39,7 +39,7 @@ LL | invoke_with_ident!{call proc_macro_item} = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:53:5 + --> $DIR/mixed-site-span.rs:52:5 | LL | invoke_with_ident!{hello call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -49,7 +49,7 @@ LL | invoke_with_ident!{hello call proc_macro_item} = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:56:5 + --> $DIR/mixed-site-span.rs:55:5 | LL | invoke_with_ident!{krate input proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -64,7 +64,7 @@ LL + invoke_with_ident!{krate input proc_macro_rules} | error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:57:5 + --> $DIR/mixed-site-span.rs:56:5 | LL | with_crate!{krate input proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -79,7 +79,7 @@ LL + with_crate!{krate input proc_macro_rules} | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:58:5 + --> $DIR/mixed-site-span.rs:57:5 | LL | with_crate!{krate call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -94,7 +94,7 @@ LL + with_crate!{krate call proc_macro_rules} | error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:62:28 + --> $DIR/mixed-site-span.rs:61:28 | LL | macro_rules! test {() => { LL | // crate::proc_macro_item @@ -113,7 +113,7 @@ LL + invoke_with_ident!{$crate input proc_macro_rules} | error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:63:21 + --> $DIR/mixed-site-span.rs:62:21 | LL | macro_rules! test {() => { ... @@ -132,7 +132,7 @@ LL + with_crate!{$crate input proc_macro_rules} | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:64:9 + --> $DIR/mixed-site-span.rs:63:9 | LL | with_crate!{$crate call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -150,7 +150,7 @@ LL + with_crate!{$crate call proc_macro_rules} | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:67:9 + --> $DIR/mixed-site-span.rs:66:9 | LL | invoke_with_ident!{$crate call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -163,7 +163,7 @@ LL | test!(); = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate::TokenItem` - --> $DIR/mixed-site-span.rs:89:5 + --> $DIR/mixed-site-span.rs:88:5 | LL | invoke_with_ident!{krate input TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -178,7 +178,7 @@ LL | quote!(use $krate::$ident as token_site_span::TokenItem as _;) | +++++++++++++++++++++++++++++ error[E0432]: unresolved import `$crate::TokenItem` - --> $DIR/mixed-site-span.rs:90:5 + --> $DIR/mixed-site-span.rs:89:5 | LL | with_crate!{krate input TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -193,7 +193,7 @@ LL | quote!(use $krate::$ident as token_site_span::TokenItem as _;) | +++++++++++++++++++++++++++++ error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:91:5 + --> $DIR/mixed-site-span.rs:90:5 | LL | with_crate!{krate call TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -208,7 +208,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:94:5 + --> $DIR/mixed-site-span.rs:93:5 | LL | invoke_with_crate!{mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -224,7 +224,7 @@ LL + ($s:ident $i:ident) => { token_site_span::TokenItem as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:95:5 + --> $DIR/mixed-site-span.rs:94:5 | LL | invoke_with_ident!{mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -240,7 +240,7 @@ LL + ($s:ident $i:ident) => { token_site_span::TokenItem as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:96:5 + --> $DIR/mixed-site-span.rs:95:5 | LL | invoke_with_ident!{krate mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -256,7 +256,7 @@ LL + ($m:ident $s:ident $i:ident) => { token_site_span::TokenItem as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:97:5 + --> $DIR/mixed-site-span.rs:96:5 | LL | with_crate!{krate mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -271,7 +271,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate::TokenItem` - --> $DIR/mixed-site-span.rs:101:28 + --> $DIR/mixed-site-span.rs:100:28 | LL | macro_rules! test {() => { LL | // crate::TokenItem @@ -290,7 +290,7 @@ LL + invoke_with_ident!{token_site_span::TokenItem as _} | error[E0432]: unresolved import `$crate::TokenItem` - --> $DIR/mixed-site-span.rs:102:21 + --> $DIR/mixed-site-span.rs:101:21 | LL | macro_rules! test {() => { ... @@ -309,7 +309,7 @@ LL + with_crate!{token_site_span::TokenItem as _} | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:103:9 + --> $DIR/mixed-site-span.rs:102:9 | LL | with_crate!{$crate call TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -327,7 +327,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:106:9 + --> $DIR/mixed-site-span.rs:105:9 | LL | invoke_with_ident!{$crate mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -346,7 +346,7 @@ LL + ($m:ident $s:ident $i:ident) => { token_site_span::TokenItem as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:107:9 + --> $DIR/mixed-site-span.rs:106:9 | LL | with_crate!{$crate mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -364,7 +364,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate::ItemUse` - --> $DIR/mixed-site-span.rs:131:5 + --> $DIR/mixed-site-span.rs:130:5 | LL | invoke_with_crate!{input ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -380,7 +380,7 @@ LL + ($s:ident $i:ident) => { with_crate!{ItemUse as _} }; | error[E0432]: unresolved import `$crate::ItemUse` - --> $DIR/mixed-site-span.rs:132:5 + --> $DIR/mixed-site-span.rs:131:5 | LL | invoke_with_ident!{input ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -396,7 +396,7 @@ LL + ($s:ident $i:ident) => { with_crate!{ItemUse as _} }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:135:5 + --> $DIR/mixed-site-span.rs:134:5 | LL | invoke_with_crate!{mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -412,7 +412,7 @@ LL + ($s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:136:5 + --> $DIR/mixed-site-span.rs:135:5 | LL | invoke_with_ident!{mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -428,7 +428,7 @@ LL + ($s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:137:5 + --> $DIR/mixed-site-span.rs:136:5 | LL | invoke_with_ident!{krate mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -444,7 +444,7 @@ LL + ($m:ident $s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:138:5 + --> $DIR/mixed-site-span.rs:137:5 | LL | with_crate!{krate mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -459,7 +459,7 @@ LL + ItemUse as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:140:5 + --> $DIR/mixed-site-span.rs:139:5 | LL | invoke_with_crate!{call ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -475,7 +475,7 @@ LL + ($s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:141:5 + --> $DIR/mixed-site-span.rs:140:5 | LL | invoke_with_ident!{call ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -491,7 +491,7 @@ LL + ($s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:142:5 + --> $DIR/mixed-site-span.rs:141:5 | LL | invoke_with_ident!{hello call ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -507,7 +507,7 @@ LL + ($m:ident $s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:145:9 + --> $DIR/mixed-site-span.rs:144:9 | LL | invoke_with_ident!{$crate mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -526,7 +526,7 @@ LL + ($m:ident $s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:146:9 + --> $DIR/mixed-site-span.rs:145:9 | LL | with_crate!{$crate mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -544,7 +544,7 @@ LL + ItemUse as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:148:9 + --> $DIR/mixed-site-span.rs:147:9 | LL | invoke_with_ident!{$crate call ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -563,7 +563,7 @@ LL + ($m:ident $s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:155:1 + --> $DIR/mixed-site-span.rs:154:1 | LL | use_input_crate!{proc_macro_item} | ^^^^^^^^^^^^^^^^^---------------^ @@ -573,7 +573,7 @@ LL | use_input_crate!{proc_macro_item} = note: this error originates in the macro `use_input_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:156:1 + --> $DIR/mixed-site-span.rs:155:1 | LL | use_input_krate!{proc_macro_item} | ^^^^^^^^^^^^^^^^^---------------^ @@ -583,7 +583,7 @@ LL | use_input_krate!{proc_macro_item} = note: this error originates in the macro `use_input_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:159:1 + --> $DIR/mixed-site-span.rs:158:1 | LL | use_call_crate!{proc_macro_item} | ^^^^^^^^^^^^^^^^---------------^ @@ -593,7 +593,7 @@ LL | use_call_crate!{proc_macro_item} = note: this error originates in the macro `use_call_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:160:1 + --> $DIR/mixed-site-span.rs:159:1 | LL | use_call_krate!{proc_macro_item} | ^^^^^^^^^^^^^^^^---------------^ @@ -603,7 +603,7 @@ LL | use_call_krate!{proc_macro_item} = note: this error originates in the macro `use_call_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:165:1 + --> $DIR/mixed-site-span.rs:164:1 | LL | use_mixed_crate!{TokenItem} | ^^^^^^^^^^^^^^^^^---------^ @@ -619,7 +619,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:166:1 + --> $DIR/mixed-site-span.rs:165:1 | LL | use_mixed_krate!{TokenItem} | ^^^^^^^^^^^^^^^^^---------^ @@ -635,7 +635,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:171:1 + --> $DIR/mixed-site-span.rs:170:1 | LL | use_input_crate!{ItemUse} | ^^^^^^^^^^^^^^^^^-------^ @@ -645,7 +645,7 @@ LL | use_input_crate!{ItemUse} = note: this error originates in the macro `use_input_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:172:1 + --> $DIR/mixed-site-span.rs:171:1 | LL | use_input_krate!{ItemUse} | ^^^^^^^^^^^^^^^^^-------^ @@ -655,7 +655,7 @@ LL | use_input_krate!{ItemUse} = note: this error originates in the macro `use_input_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:173:1 + --> $DIR/mixed-site-span.rs:172:1 | LL | use_mixed_crate!{ItemUse} | ^^^^^^^^^^^^^^^^^-------^ @@ -665,7 +665,7 @@ LL | use_mixed_crate!{ItemUse} = note: this error originates in the macro `use_mixed_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:174:1 + --> $DIR/mixed-site-span.rs:173:1 | LL | use_mixed_krate!{ItemUse} | ^^^^^^^^^^^^^^^^^-------^ @@ -675,7 +675,7 @@ LL | use_mixed_krate!{ItemUse} = note: this error originates in the macro `use_mixed_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:175:1 + --> $DIR/mixed-site-span.rs:174:1 | LL | use_call_crate!{ItemUse} | ^^^^^^^^^^^^^^^^-------^ @@ -685,7 +685,7 @@ LL | use_call_crate!{ItemUse} = note: this error originates in the macro `use_call_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:176:1 + --> $DIR/mixed-site-span.rs:175:1 | LL | use_call_krate!{ItemUse} | ^^^^^^^^^^^^^^^^-------^ @@ -695,7 +695,7 @@ LL | use_call_krate!{ItemUse} = note: this error originates in the macro `use_call_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0426]: use of undeclared label `'label_use` - --> $DIR/mixed-site-span.rs:23:9 + --> $DIR/mixed-site-span.rs:22:9 | LL | proc_macro_rules!(); | ^^^^^^^^^^^^^^^^^^^ undeclared label `'label_use` @@ -703,7 +703,7 @@ LL | proc_macro_rules!(); = note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `ItemUse` in crate `$crate` - --> $DIR/mixed-site-span.rs:23:9 + --> $DIR/mixed-site-span.rs:22:9 | LL | proc_macro_rules!(); | ^^^^^^^^^^^^^^^^^^^ not found in `$crate` @@ -715,13 +715,13 @@ LL + use ItemUse; | error[E0425]: cannot find value `local_use` in this scope - --> $DIR/mixed-site-span.rs:23:9 + --> $DIR/mixed-site-span.rs:22:9 | LL | proc_macro_rules!(); | ^^^^^^^^^^^^^^^^^^^ not found in this scope | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/mixed-site-span.rs:22:13 + --> $DIR/mixed-site-span.rs:21:13 | LL | let local_use = 1; | ^^^^^^^^^ @@ -733,13 +733,13 @@ LL + local_def; | error[E0425]: cannot find value `local_def` in this scope - --> $DIR/mixed-site-span.rs:28:9 + --> $DIR/mixed-site-span.rs:27:9 | LL | local_def; | ^^^^^^^^^ not found in this scope | help: an identifier with the same name is defined here, but is not accessible due to macro hygiene - --> $DIR/mixed-site-span.rs:23:9 + --> $DIR/mixed-site-span.rs:22:9 | LL | proc_macro_rules!(); | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/modify-ast.rs b/tests/ui/proc-macro/modify-ast.rs index 75aea597ed576..9e890f3ebaad9 100644 --- a/tests/ui/proc-macro/modify-ast.rs +++ b/tests/ui/proc-macro/modify-ast.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: modify-ast.rs -//@ ignore-backends: gcc extern crate modify_ast; diff --git a/tests/ui/proc-macro/nonfatal-parsing.rs b/tests/ui/proc-macro/nonfatal-parsing.rs index 853cbfd075e7b..207f5316ef4d9 100644 --- a/tests/ui/proc-macro/nonfatal-parsing.rs +++ b/tests/ui/proc-macro/nonfatal-parsing.rs @@ -2,7 +2,6 @@ //@ needs-unwind //@ edition: 2024 //@ dont-require-annotations: ERROR -//@ ignore-backends: gcc // FIXME: should be a run-pass test once invalidly parsed tokens no longer result in diagnostics extern crate proc_macro; diff --git a/tests/ui/proc-macro/nonfatal-parsing.stderr b/tests/ui/proc-macro/nonfatal-parsing.stderr index f015794e2ce67..8b1f63b512578 100644 --- a/tests/ui/proc-macro/nonfatal-parsing.stderr +++ b/tests/ui/proc-macro/nonfatal-parsing.stderr @@ -34,7 +34,7 @@ LL | | error: prefix `r` is unknown - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ unknown prefix @@ -43,7 +43,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: prefix `c` is unknown - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ unknown prefix @@ -52,7 +52,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: unknown start of token: \u{2000} - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL | | error: found invalid character; only `#` is allowed in raw string delimitation: \u{0} - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid digit for a base 2 literal - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -81,7 +81,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0768]: no valid digits found for number - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: binary float literal is not supported - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: character constant must be escaped: `'` - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ LL + nonfatal_parsing::run!(\'; | error: character constant must be escaped: `\n` - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,7 +123,7 @@ LL + nonfatal_parsing::run!(\n; | error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -191,7 +191,7 @@ LL | /*a*/ 0b2 // | ^ error: invalid digit for a base 2 literal - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/parent-source-spans.rs b/tests/ui/proc-macro/parent-source-spans.rs index f675f6fb6f7da..cc3ac795f7f17 100644 --- a/tests/ui/proc-macro/parent-source-spans.rs +++ b/tests/ui/proc-macro/parent-source-spans.rs @@ -1,5 +1,4 @@ //@ proc-macro: parent-source-spans.rs -//@ ignore-backends: gcc #![feature(decl_macro)] diff --git a/tests/ui/proc-macro/parent-source-spans.stderr b/tests/ui/proc-macro/parent-source-spans.stderr index 5d496ab9136a6..e865eb09ad437 100644 --- a/tests/ui/proc-macro/parent-source-spans.stderr +++ b/tests/ui/proc-macro/parent-source-spans.stderr @@ -1,5 +1,5 @@ error: first final: "hello" - --> $DIR/parent-source-spans.rs:17:12 + --> $DIR/parent-source-spans.rs:16:12 | LL | / macro two($a:expr, $b:expr) { LL | | three!($a, $b); @@ -12,7 +12,7 @@ LL | one!("hello", "world"); | ---------------------- in this macro invocation error: second final: "world" - --> $DIR/parent-source-spans.rs:17:16 + --> $DIR/parent-source-spans.rs:16:16 | LL | / macro two($a:expr, $b:expr) { LL | | three!($a, $b); @@ -25,7 +25,7 @@ LL | one!("hello", "world"); | ---------------------- in this macro invocation error: first parent: "hello" - --> $DIR/parent-source-spans.rs:11:5 + --> $DIR/parent-source-spans.rs:10:5 | LL | macro one($a:expr, $b:expr) { LL | two!($a, $b); @@ -35,7 +35,7 @@ LL | one!("hello", "world"); | ---------------------- in this macro invocation error: second parent: "world" - --> $DIR/parent-source-spans.rs:11:5 + --> $DIR/parent-source-spans.rs:10:5 | LL | macro one($a:expr, $b:expr) { LL | two!($a, $b); @@ -45,31 +45,31 @@ LL | one!("hello", "world"); | ---------------------- in this macro invocation error: first grandparent: "hello" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ error: second grandparent: "world" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ error: first source: "hello" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ error: second source: "world" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ error: first final: "yay" - --> $DIR/parent-source-spans.rs:17:12 + --> $DIR/parent-source-spans.rs:16:12 | LL | macro two($a:expr, $b:expr) { LL | three!($a, $b); @@ -79,7 +79,7 @@ LL | two!("yay", "rust"); | ------------------- in this macro invocation error: second final: "rust" - --> $DIR/parent-source-spans.rs:17:16 + --> $DIR/parent-source-spans.rs:16:16 | LL | macro two($a:expr, $b:expr) { LL | three!($a, $b); @@ -89,55 +89,55 @@ LL | two!("yay", "rust"); | ------------------- in this macro invocation error: first parent: "yay" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ error: second parent: "rust" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ error: first source: "yay" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ error: second source: "rust" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ error: first final: "hip" - --> $DIR/parent-source-spans.rs:49:12 + --> $DIR/parent-source-spans.rs:48:12 | LL | three!("hip", "hop"); | ^^^^^ error: second final: "hop" - --> $DIR/parent-source-spans.rs:49:19 + --> $DIR/parent-source-spans.rs:48:19 | LL | three!("hip", "hop"); | ^^^^^ error: first source: "hip" - --> $DIR/parent-source-spans.rs:49:12 + --> $DIR/parent-source-spans.rs:48:12 | LL | three!("hip", "hop"); | ^^^^^ error: second source: "hop" - --> $DIR/parent-source-spans.rs:49:19 + --> $DIR/parent-source-spans.rs:48:19 | LL | three!("hip", "hop"); | ^^^^^ error[E0425]: cannot find value `ok` in this scope - --> $DIR/parent-source-spans.rs:30:5 + --> $DIR/parent-source-spans.rs:29:5 | LL | parent_source_spans!($($tokens)*); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -155,7 +155,7 @@ LL + Ok; | error[E0425]: cannot find value `ok` in this scope - --> $DIR/parent-source-spans.rs:30:5 + --> $DIR/parent-source-spans.rs:29:5 | LL | parent_source_spans!($($tokens)*); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -173,7 +173,7 @@ LL + Ok; | error[E0425]: cannot find value `ok` in this scope - --> $DIR/parent-source-spans.rs:30:5 + --> $DIR/parent-source-spans.rs:29:5 | LL | parent_source_spans!($($tokens)*); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope diff --git a/tests/ui/proc-macro/quote/basic.rs b/tests/ui/proc-macro/quote/basic.rs index 4c6fb2408fb49..0336dbb785623 100644 --- a/tests/ui/proc-macro/quote/basic.rs +++ b/tests/ui/proc-macro/quote/basic.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: basic.rs -//@ ignore-backends: gcc extern crate basic; diff --git a/tests/ui/proc-macro/span-api-tests.rs b/tests/ui/proc-macro/span-api-tests.rs index 12832ba116397..792859ed05b16 100644 --- a/tests/ui/proc-macro/span-api-tests.rs +++ b/tests/ui/proc-macro/span-api-tests.rs @@ -2,7 +2,6 @@ //@ proc-macro: span-api-tests.rs //@ aux-build:span-test-macros.rs //@ compile-flags: -Ztranslate-remapped-path-to-local-path=yes -//@ ignore-backends: gcc #[macro_use] extern crate span_test_macros; diff --git a/tests/ui/proc-macro/span-from-proc-macro.rs b/tests/ui/proc-macro/span-from-proc-macro.rs index 24a28d53476c1..4e12a695a5c09 100644 --- a/tests/ui/proc-macro/span-from-proc-macro.rs +++ b/tests/ui/proc-macro/span-from-proc-macro.rs @@ -1,7 +1,6 @@ //@ proc-macro: custom-quote.rs //@ proc-macro: span-from-proc-macro.rs //@ compile-flags: -Z macro-backtrace -//@ ignore-backends: gcc #[macro_use] extern crate span_from_proc_macro; diff --git a/tests/ui/proc-macro/span-from-proc-macro.stderr b/tests/ui/proc-macro/span-from-proc-macro.stderr index 0605c727733b2..0b840a6728061 100644 --- a/tests/ui/proc-macro/span-from-proc-macro.stderr +++ b/tests/ui/proc-macro/span-from-proc-macro.stderr @@ -7,7 +7,7 @@ LL | pub fn error_from_attribute(_args: TokenStream, _input: TokenStream) -> Tok LL | field: MissingType | ^^^^^^^^^^^ not found in this scope | - ::: $DIR/span-from-proc-macro.rs:9:1 + ::: $DIR/span-from-proc-macro.rs:8:1 | LL | #[error_from_attribute] | ----------------------- in this attribute macro expansion @@ -21,7 +21,7 @@ LL | pub fn error_from_derive(_input: TokenStream) -> TokenStream { LL | Variant(OtherMissingType) | ^^^^^^^^^^^^^^^^ not found in this scope | - ::: $DIR/span-from-proc-macro.rs:12:10 + ::: $DIR/span-from-proc-macro.rs:11:10 | LL | #[derive(ErrorFromDerive)] | --------------- in this derive macro expansion @@ -35,7 +35,7 @@ LL | custom_quote::custom_quote! { LL | my_ident | ^^^^^^^^ not found in this scope | - ::: $DIR/span-from-proc-macro.rs:17:5 + ::: $DIR/span-from-proc-macro.rs:16:5 | LL | other_error_from_bang!(); | ------------------------ in this macro invocation @@ -51,7 +51,7 @@ LL | let bang_error: bool = 25; LL | pub fn error_from_bang(_input: TokenStream) -> TokenStream { | ---------------------------------------------------------- in this expansion of `error_from_bang!` | - ::: $DIR/span-from-proc-macro.rs:16:5 + ::: $DIR/span-from-proc-macro.rs:15:5 | LL | error_from_bang!(); | ------------------ in this macro invocation diff --git a/tests/ui/proc-macro/test.rs b/tests/ui/proc-macro/test.rs index d935dbe8ad3fb..e657d564b86fe 100644 --- a/tests/ui/proc-macro/test.rs +++ b/tests/ui/proc-macro/test.rs @@ -3,7 +3,6 @@ //@ edition: 2021 // Because of a (known) proc-macro ABI issue with GCC backend, this test // fails because of it. -//@ ignore-backends: gcc //! This is for everything that *would* be a #[test] inside of libproc_macro, //! except for the fact that proc_macro objects are not capable of existing diff --git a/tests/ui/proc-macro/weird-hygiene.rs b/tests/ui/proc-macro/weird-hygiene.rs index 8d8427d0e417e..de55484109ae3 100644 --- a/tests/ui/proc-macro/weird-hygiene.rs +++ b/tests/ui/proc-macro/weird-hygiene.rs @@ -1,5 +1,4 @@ //@ proc-macro: weird-hygiene.rs -//@ ignore-backends: gcc #![feature(stmt_expr_attributes)] #![feature(proc_macro_hygiene)] diff --git a/tests/ui/proc-macro/weird-hygiene.stderr b/tests/ui/proc-macro/weird-hygiene.stderr index a3c1e7b7671e6..2b2e705d9724d 100644 --- a/tests/ui/proc-macro/weird-hygiene.stderr +++ b/tests/ui/proc-macro/weird-hygiene.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `hidden_ident` in this scope - --> $DIR/weird-hygiene.rs:24:43 + --> $DIR/weird-hygiene.rs:23:43 | LL | Value = (stringify!($tokens + hidden_ident), 1).1 | ^^^^^^^^^^^^ not found in this scope @@ -8,14 +8,14 @@ LL | other!(50); | ---------- in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/weird-hygiene.rs:44:9 + --> $DIR/weird-hygiene.rs:43:9 | LL | let hidden_ident = "Hello1"; | ^^^^^^^^^^^^ = note: this error originates in the macro `inner` which comes from the expansion of the macro `other` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `hidden_ident` in this scope - --> $DIR/weird-hygiene.rs:35:13 + --> $DIR/weird-hygiene.rs:34:13 | LL | macro_rules! invoke_it { ... @@ -26,7 +26,7 @@ LL | invoke_it!(25); | -------------- in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/weird-hygiene.rs:44:9 + --> $DIR/weird-hygiene.rs:43:9 | LL | let hidden_ident = "Hello1"; | ^^^^^^^^^^^^ diff --git a/tests/ui/process/multi-panic.rs b/tests/ui/process/multi-panic.rs index 67bbd16fba75e..1fddffeb770a3 100644 --- a/tests/ui/process/multi-panic.rs +++ b/tests/ui/process/multi-panic.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-subprocess //@ needs-unwind -//@ ignore-backends: gcc fn check_for_no_backtrace(test: std::process::Output) { assert!(!test.status.success()); diff --git a/tests/ui/process/println-with-broken-pipe.rs b/tests/ui/process/println-with-broken-pipe.rs index 51521f1dcf42a..a56cc6aa7039b 100644 --- a/tests/ui/process/println-with-broken-pipe.rs +++ b/tests/ui/process/println-with-broken-pipe.rs @@ -9,7 +9,6 @@ //@ ignore-tvos no 'head' //@ ignore-watchos no 'head' //@ ignore-visionos no 'head' -//@ ignore-backends: gcc //@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:CC" //@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> "" //@ compile-flags: -Zon-broken-pipe=error diff --git a/tests/ui/process/process-panic-after-fork.rs b/tests/ui/process/process-panic-after-fork.rs index f3b56721419cd..a4c20ea6d7900 100644 --- a/tests/ui/process/process-panic-after-fork.rs +++ b/tests/ui/process/process-panic-after-fork.rs @@ -5,7 +5,6 @@ //@ ignore-fuchsia no fork //@ ignore-tvos fork is prohibited //@ ignore-watchos fork is prohibited -//@ ignore-backends: gcc #![feature(rustc_private)] #![feature(panic_always_abort)] diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs index f981ea23ee24e..3c3948de9dcc3 100644 --- a/tests/ui/repr/16-bit-repr-c-enum.rs +++ b/tests/ui/repr/16-bit-repr-c-enum.rs @@ -6,7 +6,6 @@ //@ [avr] compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib //@ [msp430] needs-llvm-components: msp430 //@ [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib -//@ ignore-backends: gcc #![feature(no_core, intrinsics, staged_api, rustc_attrs)] #![no_core] #![crate_type = "lib"] diff --git a/tests/ui/resolve/prelude-order.rs b/tests/ui/resolve/prelude-order.rs index 9bc3793dbf20c..cb5b82f8285f6 100644 --- a/tests/ui/resolve/prelude-order.rs +++ b/tests/ui/resolve/prelude-order.rs @@ -1,6 +1,5 @@ //@ proc-macro:macro_helpers.rs //@ compile-flags: --crate-type=lib -//@ ignore-backends: gcc /* There are 5 preludes and 3 namespaces. Test the order in which they are resolved. * See https://doc.rust-lang.org/nightly/reference/names/preludes.html. diff --git a/tests/ui/resolve/prelude-order.stderr b/tests/ui/resolve/prelude-order.stderr index c7929bf74d51e..c3d2d7072da37 100644 --- a/tests/ui/resolve/prelude-order.stderr +++ b/tests/ui/resolve/prelude-order.stderr @@ -1,17 +1,17 @@ error[E0433]: cannot find `inner` in `type_ns` - --> $DIR/prelude-order.rs:62:12 + --> $DIR/prelude-order.rs:61:12 | LL | #[type_ns::inner] | ^^^^^ could not find `inner` in `type_ns` error[E0433]: cannot find `inner` in `usize` - --> $DIR/prelude-order.rs:74:10 + --> $DIR/prelude-order.rs:73:10 | LL | #[usize::inner] | ^^^^^ could not find `inner` in `usize` error[E0573]: expected type, found crate `Option` - --> $DIR/prelude-order.rs:80:12 + --> $DIR/prelude-order.rs:79:12 | LL | fn e2() -> Option { None } | ^^^^^^^^^^^ not a type @@ -22,7 +22,7 @@ LL + use std::option::Option; | error[E0308]: mismatched types - --> $DIR/prelude-order.rs:83:1 + --> $DIR/prelude-order.rs:82:1 | LL | #[test] | ^^^^^^^- help: try adding a return type: `-> &'static str` @@ -32,7 +32,7 @@ LL | #[test] = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types - --> $DIR/prelude-order.rs:87:1 + --> $DIR/prelude-order.rs:86:1 | LL | #[global_allocator] | ^^^^^^^^^^^^^^^^^^^- help: try adding a return type: `-> &'static str` diff --git a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.nightly.stderr b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.nightly.stderr index 580b870d880cd..fea67c46d1dfb 100644 --- a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.nightly.stderr +++ b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.nightly.stderr @@ -1,5 +1,5 @@ error[E0433]: cannot find type `Complete` in this scope - --> $DIR/dont-suggest-unstable-type.rs:14:12 + --> $DIR/dont-suggest-unstable-type.rs:13:12 | LL | x.push(Complete::Item { name: "hello" }); | ^^^^^^^^ use of undeclared type `Complete` diff --git a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.rs b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.rs index c647df2420681..83390f894b87e 100644 --- a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.rs +++ b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.rs @@ -3,7 +3,6 @@ //! Regression test for . //! //@ needs-target-std -//@ ignore-backends: gcc //@ revisions: stable nightly //@[stable] act-as-stable diff --git a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.stable.stderr b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.stable.stderr index ca3a399d9d765..526bccb2671d2 100644 --- a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.stable.stderr +++ b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.stable.stderr @@ -1,5 +1,5 @@ error[E0433]: cannot find type `Complete` in this scope - --> $DIR/dont-suggest-unstable-type.rs:14:12 + --> $DIR/dont-suggest-unstable-type.rs:13:12 | LL | x.push(Complete::Item { name: "hello" }); | ^^^^^^^^ use of undeclared type `Complete` diff --git a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default.stderr b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default.stderr index 259a2e2c5e73b..e2616fb502e8d 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default.stderr +++ b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default.stderr @@ -1,5 +1,5 @@ warning: value assigned to `small` is never read - --> $DIR/std-panic-locations.rs:47:31 + --> $DIR/std-panic-locations.rs:46:31 | LL | assert_panicked(move || { small[1] += 1; }); | ^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.mir-opt.stderr b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.mir-opt.stderr index 259a2e2c5e73b..e2616fb502e8d 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.mir-opt.stderr +++ b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.mir-opt.stderr @@ -1,5 +1,5 @@ warning: value assigned to `small` is never read - --> $DIR/std-panic-locations.rs:47:31 + --> $DIR/std-panic-locations.rs:46:31 | LL | assert_panicked(move || { small[1] += 1; }); | ^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs index b365e786fd050..62338819625d4 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs +++ b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ revisions: default mir-opt //@[mir-opt] compile-flags: -Zmir-opt-level=4 diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs index 2387dfb2bc575..414d5518e1fb0 100644 --- a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs @@ -7,7 +7,6 @@ //@ check-pass //@ proc-macro: count.rs -//@ ignore-backends: gcc extern crate count; const _: () = { diff --git a/tests/ui/runtime/on-broken-pipe/child-processes.rs b/tests/ui/runtime/on-broken-pipe/child-processes.rs index b7022e1b09d90..05b5a8c29ffe4 100644 --- a/tests/ui/runtime/on-broken-pipe/child-processes.rs +++ b/tests/ui/runtime/on-broken-pipe/child-processes.rs @@ -2,7 +2,6 @@ //@ ignore-cross-compile because aux-bin does not yet support it //@ ignore-remote because aux-bin does not yet support it //@ only-unix because SIGPIPE is a unix thing -//@ ignore-backends: gcc //@ run-pass //@ aux-bin:assert-sigpipe-disposition.rs //@ aux-crate:sigpipe_utils=sigpipe-utils.rs diff --git a/tests/ui/runtime/out-of-stack.rs b/tests/ui/runtime/out-of-stack.rs index 2e140bc9277a2..9038d7d291bea 100644 --- a/tests/ui/runtime/out-of-stack.rs +++ b/tests/ui/runtime/out-of-stack.rs @@ -12,7 +12,6 @@ //@ ignore-tvos stack overflow handlers aren't enabled //@ ignore-watchos stack overflow handlers aren't enabled //@ ignore-visionos stack overflow handlers aren't enabled -//@ ignore-backends: gcc #![feature(rustc_private)] diff --git a/tests/ui/runtime/rt-explody-panic-payloads.rs b/tests/ui/runtime/rt-explody-panic-payloads.rs index 1d5795f8e8652..d564a26ca7374 100644 --- a/tests/ui/runtime/rt-explody-panic-payloads.rs +++ b/tests/ui/runtime/rt-explody-panic-payloads.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-subprocess -//@ ignore-backends: gcc use std::env; use std::process::Command; diff --git a/tests/ui/rust-2018/suggestions-not-always-applicable.fixed b/tests/ui/rust-2018/suggestions-not-always-applicable.fixed index 3a42434494d84..e3070ba150b6d 100644 --- a/tests/ui/rust-2018/suggestions-not-always-applicable.fixed +++ b/tests/ui/rust-2018/suggestions-not-always-applicable.fixed @@ -3,7 +3,6 @@ //@ run-rustfix //@ rustfix-only-machine-applicable //@ check-pass -//@ ignore-backends: gcc #![warn(rust_2018_compatibility)] diff --git a/tests/ui/rust-2018/suggestions-not-always-applicable.rs b/tests/ui/rust-2018/suggestions-not-always-applicable.rs index 3a42434494d84..e3070ba150b6d 100644 --- a/tests/ui/rust-2018/suggestions-not-always-applicable.rs +++ b/tests/ui/rust-2018/suggestions-not-always-applicable.rs @@ -3,7 +3,6 @@ //@ run-rustfix //@ rustfix-only-machine-applicable //@ check-pass -//@ ignore-backends: gcc #![warn(rust_2018_compatibility)] diff --git a/tests/ui/rust-2021/reserved-prefixes-via-macro.rs b/tests/ui/rust-2021/reserved-prefixes-via-macro.rs index 456649f23ca67..eec1b859c2033 100644 --- a/tests/ui/rust-2021/reserved-prefixes-via-macro.rs +++ b/tests/ui/rust-2021/reserved-prefixes-via-macro.rs @@ -1,7 +1,6 @@ //@ run-pass //@ edition:2021 //@ proc-macro: reserved-prefixes-macro-2018.rs -//@ ignore-backends: gcc extern crate reserved_prefixes_macro_2018 as m2018; diff --git a/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs b/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs index ddb32c2671739..ead2ab40b77ac 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs +++ b/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs @@ -1,7 +1,6 @@ //@ run-pass //@ edition:2024 //@ proc-macro: reserved-guarded-strings-macro-2021.rs -//@ ignore-backends: gcc extern crate reserved_guarded_strings_macro_2021 as m2021; diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.rs index dca05cc27f6e1..20f7af8c1196e 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.rs +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.rs @@ -1,7 +1,6 @@ // Test for unsafe attributes generated by a proc-macro. //@ proc-macro: unsafe-attributes-pm-in-2024.rs -//@ ignore-backends: gcc unsafe_attributes_pm_in_2024::missing_unsafe!(); //~ ERROR unsafe attribute used without unsafe diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr index a65ccd29afe5a..4f1201dae2987 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr @@ -1,5 +1,5 @@ error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-from-pm-in-2024.rs:6:1 + --> $DIR/unsafe-attributes-from-pm-in-2024.rs:5:1 | LL | unsafe_attributes_pm_in_2024::missing_unsafe!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ usage of unsafe attribute @@ -7,7 +7,7 @@ LL | unsafe_attributes_pm_in_2024::missing_unsafe!(); = note: this error originates in the macro `unsafe_attributes_pm_in_2024::missing_unsafe` (in Nightly builds, run with -Z macro-backtrace for more info) error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-from-pm-in-2024.rs:8:1 + --> $DIR/unsafe-attributes-from-pm-in-2024.rs:7:1 | LL | #[unsafe_attributes_pm_in_2024::attr_missing_unsafe] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ usage of unsafe attribute @@ -15,7 +15,7 @@ LL | #[unsafe_attributes_pm_in_2024::attr_missing_unsafe] = note: this error originates in the attribute macro `unsafe_attributes_pm_in_2024::attr_missing_unsafe` (in Nightly builds, run with -Z macro-backtrace for more info) error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-from-pm-in-2024.rs:11:10 + --> $DIR/unsafe-attributes-from-pm-in-2024.rs:10:10 | LL | #[derive(unsafe_attributes_pm_in_2024::AttrMissingUnsafe)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ usage of unsafe attribute @@ -23,7 +23,7 @@ LL | #[derive(unsafe_attributes_pm_in_2024::AttrMissingUnsafe)] = note: this error originates in the derive macro `unsafe_attributes_pm_in_2024::AttrMissingUnsafe` (in Nightly builds, run with -Z macro-backtrace for more info) error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-from-pm-in-2024.rs:14:1 + --> $DIR/unsafe-attributes-from-pm-in-2024.rs:13:1 | LL | unsafe_attributes_pm_in_2024::macro_rules_missing_unsafe!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ usage of unsafe attribute diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs index 8b7073649b7a2..e2c504e708c55 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs @@ -6,7 +6,6 @@ //@[edition2021] edition:2021 //@[edition2024] edition:2024 //@ proc-macro: unsafe-attributes-pm.rs -//@ ignore-backends: gcc unsafe_attributes_pm::missing_unsafe!(); diff --git a/tests/ui/scalable-vectors/project-into-field.rs b/tests/ui/scalable-vectors/project-into-field.rs index 4b829de8f2280..9d989190421c4 100644 --- a/tests/ui/scalable-vectors/project-into-field.rs +++ b/tests/ui/scalable-vectors/project-into-field.rs @@ -3,7 +3,6 @@ //@ compile-flags: -Copt-level=0 --target=aarch64-unknown-linux-gnu //@ dont-check-compiler-stderr //@ failure-status: 101 -//@ ignore-backends: gcc //@ needs-llvm-components: aarch64 #![feature(no_core, rustc_attrs)] #![no_std] diff --git a/tests/ui/sepcomp/sepcomp-unwind.rs b/tests/ui/sepcomp/sepcomp-unwind.rs index 0038e887c4ee6..95591676b5eed 100644 --- a/tests/ui/sepcomp/sepcomp-unwind.rs +++ b/tests/ui/sepcomp/sepcomp-unwind.rs @@ -3,7 +3,6 @@ #![allow(dead_code)] //@ compile-flags: -C codegen-units=3 //@ needs-threads -//@ ignore-backends: gcc // Test unwinding through multiple compilation units. diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs index 62782db37ed4c..3b96fe3f3ba7f 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc //@ compile-flags: --cfg minisimd_const #![allow(non_camel_case_types)] diff --git a/tests/ui/simd/intrinsic/generic-as.rs b/tests/ui/simd/intrinsic/generic-as.rs index b81402e9dca4d..41366957d1f63 100644 --- a/tests/ui/simd/intrinsic/generic-as.rs +++ b/tests/ui/simd/intrinsic/generic-as.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc //@ compile-flags: --cfg minisimd_const #![feature(repr_simd, core_intrinsics, const_trait_impl, const_cmp, const_index)] diff --git a/tests/ui/simd/issue-17170.rs b/tests/ui/simd/issue-17170.rs index 508f480a58db3..6e5b4c413b03b 100644 --- a/tests/ui/simd/issue-17170.rs +++ b/tests/ui/simd/issue-17170.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![feature(repr_simd)] diff --git a/tests/ui/simd/masked-load-store.rs b/tests/ui/simd/masked-load-store.rs index 7098a4405c7fb..bae79ad28dbca 100644 --- a/tests/ui/simd/masked-load-store.rs +++ b/tests/ui/simd/masked-load-store.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ compile-flags: --cfg minisimd_const //@ run-pass #![feature(repr_simd, core_intrinsics, const_trait_impl, const_cmp, const_index)] diff --git a/tests/ui/simd/target-feature-mixup.rs b/tests/ui/simd/target-feature-mixup.rs index 5f599f38fb92f..bf7c2c5731a36 100644 --- a/tests/ui/simd/target-feature-mixup.rs +++ b/tests/ui/simd/target-feature-mixup.rs @@ -4,7 +4,6 @@ //@ needs-subprocess //@ ignore-fuchsia must translate zircon signal to SIGILL, FIXME (#58590) -//@ ignore-backends: gcc #![feature(repr_simd)] diff --git a/tests/ui/stack-protector/warn-stack-protector-unsupported.rs b/tests/ui/stack-protector/warn-stack-protector-unsupported.rs index 9e0e126dabe66..a635976c8427b 100644 --- a/tests/ui/stack-protector/warn-stack-protector-unsupported.rs +++ b/tests/ui/stack-protector/warn-stack-protector-unsupported.rs @@ -5,7 +5,6 @@ //@ [all] compile-flags: -Z stack-protector=all //@ [strong] compile-flags: -Z stack-protector=strong //@ [basic] compile-flags: -Z stack-protector=basic -//@ ignore-backends: gcc #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/ui/structs/unit-like-struct-drop-run.rs b/tests/ui/structs/unit-like-struct-drop-run.rs index 5e3fc5931bdc5..3d00871837cf8 100644 --- a/tests/ui/structs/unit-like-struct-drop-run.rs +++ b/tests/ui/structs/unit-like-struct-drop-run.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc // Make sure the destructor is run for unit-like structs. diff --git a/tests/ui/suggestions/issue-61963.rs b/tests/ui/suggestions/issue-61963.rs index bf0680b986038..77e4b21f5dbd5 100644 --- a/tests/ui/suggestions/issue-61963.rs +++ b/tests/ui/suggestions/issue-61963.rs @@ -1,7 +1,6 @@ //@ edition: 2015 //@ proc-macro: issue-61963.rs //@ proc-macro: issue-61963-1.rs -//@ ignore-backends: gcc #![deny(bare_trait_objects)] #[macro_use] diff --git a/tests/ui/suggestions/issue-61963.stderr b/tests/ui/suggestions/issue-61963.stderr index f9146a619ec45..ffdeef12bb7f1 100644 --- a/tests/ui/suggestions/issue-61963.stderr +++ b/tests/ui/suggestions/issue-61963.stderr @@ -1,5 +1,5 @@ error: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-61963.rs:24:14 + --> $DIR/issue-61963.rs:23:14 | LL | bar: Box, | ^^^ @@ -7,7 +7,7 @@ LL | bar: Box, = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see note: the lint level is defined here - --> $DIR/issue-61963.rs:5:9 + --> $DIR/issue-61963.rs:4:9 | LL | #![deny(bare_trait_objects)] | ^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | bar: Box, | +++ error: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-61963.rs:20:1 + --> $DIR/issue-61963.rs:19:1 | LL | pub struct Foo { | ^^^ diff --git a/tests/ui/suggestions/suggest-ref-macro.rs b/tests/ui/suggestions/suggest-ref-macro.rs index 41a2acf90628a..2f31af33782cb 100644 --- a/tests/ui/suggestions/suggest-ref-macro.rs +++ b/tests/ui/suggestions/suggest-ref-macro.rs @@ -1,6 +1,5 @@ // run-check //@ proc-macro: proc-macro-type-error.rs -//@ ignore-backends: gcc extern crate proc_macro_type_error; diff --git a/tests/ui/suggestions/suggest-ref-macro.stderr b/tests/ui/suggestions/suggest-ref-macro.stderr index 9bb26f7f5ab3a..2dc46a0eb98ad 100644 --- a/tests/ui/suggestions/suggest-ref-macro.stderr +++ b/tests/ui/suggestions/suggest-ref-macro.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/suggest-ref-macro.rs:9:1 + --> $DIR/suggest-ref-macro.rs:8:1 | LL | #[hello] | ^^^^^^^^ @@ -8,14 +8,14 @@ LL | #[hello] | arguments to this function are incorrect | note: function defined here - --> $DIR/suggest-ref-macro.rs:9:1 + --> $DIR/suggest-ref-macro.rs:8:1 | LL | #[hello] | ^^^^^^^^ = note: this error originates in the attribute macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types - --> $DIR/suggest-ref-macro.rs:16:11 + --> $DIR/suggest-ref-macro.rs:15:11 | LL | macro_rules! bla { LL | () => { @@ -28,7 +28,7 @@ LL | bla!(); | ------ in this macro invocation | note: function defined here - --> $DIR/suggest-ref-macro.rs:12:4 + --> $DIR/suggest-ref-macro.rs:11:4 | LL | fn x(_: &mut i32) {} | ^ ----------- @@ -38,7 +38,7 @@ LL | x(&mut 123); | ++++ error[E0308]: mismatched types - --> $DIR/suggest-ref-macro.rs:27:10 + --> $DIR/suggest-ref-macro.rs:26:10 | LL | x($v) | - arguments to this function are incorrect @@ -47,7 +47,7 @@ LL | bla!(456); | ^^^ expected `&mut i32`, found integer | note: function defined here - --> $DIR/suggest-ref-macro.rs:12:4 + --> $DIR/suggest-ref-macro.rs:11:4 | LL | fn x(_: &mut i32) {} | ^ ----------- diff --git a/tests/ui/target-cpu/explicit-target-cpu.rs b/tests/ui/target-cpu/explicit-target-cpu.rs index 29f8e9de1f6ea..d39c4f47036f2 100644 --- a/tests/ui/target-cpu/explicit-target-cpu.rs +++ b/tests/ui/target-cpu/explicit-target-cpu.rs @@ -22,7 +22,6 @@ //@[avr_cpu] compile-flags: -Ctarget-cpu=atmega328p //@[avr_cpu] build-pass -//@ ignore-backends: gcc #![crate_type = "rlib"] // We don't want to link in any other crate as this would make it necessary to specify diff --git a/tests/ui/target-cpu/unsupported-target-cpu.rs b/tests/ui/target-cpu/unsupported-target-cpu.rs index dafbfbc015ec1..2fccc16d37da5 100644 --- a/tests/ui/target-cpu/unsupported-target-cpu.rs +++ b/tests/ui/target-cpu/unsupported-target-cpu.rs @@ -5,7 +5,6 @@ //@[nvptx-sm60] compile-flags: --target=nvptx64-nvidia-cuda --crate-type=rlib -Ctarget-cpu=sm_60 //@[nvptx-sm60] needs-llvm-components: nvptx //@[nvptx-sm60] build-fail -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs index c6b5e15599d8e..c6d9ac419abae 100644 --- a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs +++ b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs @@ -9,7 +9,6 @@ // FIXME(#147881): *disable* the feature again for minicore as otherwise that will fail to build. //@[riscv] minicore-compile-flags: -Ctarget-feature=-d //@[riscv] needs-llvm-components: riscv -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core, riscv_target_feature)] diff --git a/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs b/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs index 38b35c67ba6ff..10c33816b37fa 100644 --- a/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs @@ -5,7 +5,6 @@ //@ needs-llvm-components: x86 //@ compile-flags: -Ctarget-feature=-x87 //@ build-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] #![no_core] diff --git a/tests/ui/target-feature/abi-relevant-target-modifier.rs b/tests/ui/target-feature/abi-relevant-target-modifier.rs index cb09064903ba2..ba647ffeb3af4 100644 --- a/tests/ui/target-feature/abi-relevant-target-modifier.rs +++ b/tests/ui/target-feature/abi-relevant-target-modifier.rs @@ -5,7 +5,6 @@ //@ needs-llvm-components: arm //@[allowed] compile-flags: -Cunsafe-allow-abi-mismatch=target-feature //@ aux-build: using-atomics-32.rs -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/target-feature/abi-required-target-feature-attribute.rs b/tests/ui/target-feature/abi-required-target-feature-attribute.rs index b2d2c95313d2b..e9a9ad86f90ac 100644 --- a/tests/ui/target-feature/abi-required-target-feature-attribute.rs +++ b/tests/ui/target-feature/abi-required-target-feature-attribute.rs @@ -3,7 +3,6 @@ //@ compile-flags: --target=x86_64-unknown-none --crate-type=lib //@ needs-llvm-components: x86 //@ build-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core, x87_target_feature)] #![no_core] diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs index 489dcb4f16813..b6c0481e41553 100644 --- a/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs @@ -23,7 +23,6 @@ // Remove some LLVM warnings that only show up sometimes. //@ normalize-stderr: "\n[^\n]*(target-abi|lp64f)[^\n]*" -> "" -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] diff --git a/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs b/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs index 1a0b26cadd4e3..8567b5cd8522a 100644 --- a/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs +++ b/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs @@ -11,7 +11,6 @@ // check-fail -//@ ignore-backends: gcc //@ add-minicore // Don't inherit the target-cpu above for minicore, to avoid errors when building that. //@ minicore-compile-flags: -Ctarget-cpu=generic diff --git a/tests/ui/target-feature/feature-hierarchy.rs b/tests/ui/target-feature/feature-hierarchy.rs index 2629f5b000f80..b9da6072aa518 100644 --- a/tests/ui/target-feature/feature-hierarchy.rs +++ b/tests/ui/target-feature/feature-hierarchy.rs @@ -12,7 +12,6 @@ //@ [hexagon-hvxv66] needs-llvm-components: hexagon //@ build-pass //@ add-minicore -//@ ignore-backends: gcc #![no_core] #![crate_type = "rlib"] #![feature(intrinsics, rustc_attrs, no_core, staged_api)] diff --git a/tests/ui/target-feature/forbidden-target-feature-cfg.rs b/tests/ui/target-feature/forbidden-target-feature-cfg.rs index db1a7b817bb8a..4bffb0122b00e 100644 --- a/tests/ui/target-feature/forbidden-target-feature-cfg.rs +++ b/tests/ui/target-feature/forbidden-target-feature-cfg.rs @@ -2,7 +2,6 @@ //@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib //@ needs-llvm-components: riscv //@ check-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] #![no_core] diff --git a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs index e1f576bb6d89e..93130c32b4c13 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs @@ -4,7 +4,6 @@ //@ compile-flags: -Ctarget-feature=-forced-atomics // For now this is just a warning. //@ build-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] diff --git a/tests/ui/target-feature/forbidden-target-feature-flag.rs b/tests/ui/target-feature/forbidden-target-feature-flag.rs index ad6d3ee6dfa9d..ea7aed374a893 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag.rs +++ b/tests/ui/target-feature/forbidden-target-feature-flag.rs @@ -4,7 +4,6 @@ //@ compile-flags: -Ctarget-feature=+forced-atomics // For now this is just a warning. //@ build-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] diff --git a/tests/ui/target-feature/packedstack-combinations.rs b/tests/ui/target-feature/packedstack-combinations.rs index dc45ac1ff5e83..fab2820169d3f 100644 --- a/tests/ui/target-feature/packedstack-combinations.rs +++ b/tests/ui/target-feature/packedstack-combinations.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ revisions: wrong_arch only_packedstack backchain_attr backchain_cli with_softfloat //@ compile-flags: -Zpacked-stack --crate-type=rlib -//@ ignore-backends: gcc //@ [wrong_arch] compile-flags: --target=x86_64-unknown-linux-gnu //@ [wrong_arch] should-fail diff --git a/tests/ui/target-feature/tied-features-cli.rs b/tests/ui/target-feature/tied-features-cli.rs index ffa38721c7da2..b7815a9c44d53 100644 --- a/tests/ui/target-feature/tied-features-cli.rs +++ b/tests/ui/target-feature/tied-features-cli.rs @@ -11,7 +11,6 @@ //@ [three] compile-flags: -C target-feature=+paca,+pacg,-paca //@ [four] build-pass //@ [four] compile-flags: -C target-feature=-paca,+pacg -C target-feature=+paca -//@ ignore-backends: gcc //@ add-minicore // FIXME(#147881): *disable* the features again for minicore as otherwise that will fail to build. //@ minicore-compile-flags: -C target-feature=-pacg,-paca diff --git a/tests/ui/target-feature/tied-features-no-implication-1.rs b/tests/ui/target-feature/tied-features-no-implication-1.rs index 326da8b8dcf30..3ead2185c27ab 100644 --- a/tests/ui/target-feature/tied-features-no-implication-1.rs +++ b/tests/ui/target-feature/tied-features-no-implication-1.rs @@ -3,7 +3,6 @@ //@ needs-llvm-components: aarch64 //@[paca] compile-flags: -Ctarget-feature=+paca //@[pacg] compile-flags: -Ctarget-feature=+pacg -//@ ignore-backends: gcc //@ add-minicore // FIXME(#147881): *disable* the features again for minicore as otherwise that will fail to build. //@ minicore-compile-flags: -C target-feature=-pacg,-paca diff --git a/tests/ui/target-feature/unstable-target-feature-on-nightly.rs b/tests/ui/target-feature/unstable-target-feature-on-nightly.rs index 76b01ef42d8fa..e9cbb8e115397 100644 --- a/tests/ui/target-feature/unstable-target-feature-on-nightly.rs +++ b/tests/ui/target-feature/unstable-target-feature-on-nightly.rs @@ -1,8 +1,6 @@ //! Ensure that on nightly we don't warn about using unstable target features. //@ only-x86_64 -// FIXME: Once GCC backend is fixed, remove this `ignore-backends`. -//@ ignore-backends: gcc //@ compile-flags: -Ctarget-feature=+x87 --crate-type=rlib //@ check-pass diff --git a/tests/ui/target-feature/x86-soft-float-cfg.rs b/tests/ui/target-feature/x86-soft-float-cfg.rs index 8718338ca105d..01d1cdc9e404d 100644 --- a/tests/ui/target-feature/x86-soft-float-cfg.rs +++ b/tests/ui/target-feature/x86-soft-float-cfg.rs @@ -5,7 +5,6 @@ //@[soft] compile-flags: --target=x86_64-unknown-none --crate-type=lib //@[soft] needs-llvm-components: x86 //@ check-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] #![no_core] diff --git a/tests/ui/target_modifiers/auxiliary/pauth.rs b/tests/ui/target_modifiers/auxiliary/pauth.rs index 32bd7651c0b44..9230ab460b09e 100644 --- a/tests/ui/target_modifiers/auxiliary/pauth.rs +++ b/tests/ui/target_modifiers/auxiliary/pauth.rs @@ -1,7 +1,6 @@ //@ compile-flags: --target aarch64-unknown-linux-pauthtest -Zpointer-authentication=+calls,+init-fini //@ needs-llvm-components: aarch64 //@ no-prefer-dynamic -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/sanitizer_default_explicit.rs b/tests/ui/target_modifiers/auxiliary/sanitizer_default_explicit.rs index 831c681179b9a..160aaf7490c25 100644 --- a/tests/ui/target_modifiers/auxiliary/sanitizer_default_explicit.rs +++ b/tests/ui/target_modifiers/auxiliary/sanitizer_default_explicit.rs @@ -3,7 +3,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target riscv64gc-unknown-fuchsia -Zsanitizer=shadow-call-stack //@ needs-llvm-components: riscv -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/sanitizer_default_implicit.rs b/tests/ui/target_modifiers/auxiliary/sanitizer_default_implicit.rs index 6aac2294283f8..701aa6e835e7e 100644 --- a/tests/ui/target_modifiers/auxiliary/sanitizer_default_implicit.rs +++ b/tests/ui/target_modifiers/auxiliary/sanitizer_default_implicit.rs @@ -4,7 +4,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target riscv64gc-unknown-fuchsia //@ needs-llvm-components: riscv -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/sanitizer_non_default.rs b/tests/ui/target_modifiers/auxiliary/sanitizer_non_default.rs index c04ab13b310ff..2745f347fa7c5 100644 --- a/tests/ui/target_modifiers/auxiliary/sanitizer_non_default.rs +++ b/tests/ui/target_modifiers/auxiliary/sanitizer_non_default.rs @@ -4,7 +4,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target riscv64gc-unknown-fuchsia -Zsanitizer=cfi -Clinker-plugin-lto //@ needs-llvm-components: riscv -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs b/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs index 3c56f64dfdb3a..81606c66c9955 100644 --- a/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs +++ b/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs @@ -1,7 +1,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_70 //@ needs-llvm-components: nvptx -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/target_cpu_default_implicit.rs b/tests/ui/target_modifiers/auxiliary/target_cpu_default_implicit.rs index 6b71ca5eb034d..5603c94eaec19 100644 --- a/tests/ui/target_modifiers/auxiliary/target_cpu_default_implicit.rs +++ b/tests/ui/target_modifiers/auxiliary/target_cpu_default_implicit.rs @@ -1,7 +1,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target nvptx64-nvidia-cuda //@ needs-llvm-components: nvptx -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs b/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs index a4fa7e2a33af6..25b59059db0af 100644 --- a/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs +++ b/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs @@ -1,7 +1,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_80 //@ needs-llvm-components: nvptx -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/defaults_check.rs b/tests/ui/target_modifiers/defaults_check.rs index c86b5a12fc8a7..f7b80807ed050 100644 --- a/tests/ui/target_modifiers/defaults_check.rs +++ b/tests/ui/target_modifiers/defaults_check.rs @@ -11,7 +11,6 @@ //@[error] compile-flags: -Zreg-struct-return=true //@[ok] check-pass //@[ok_explicit] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/incompatible_fixedx18.rs b/tests/ui/target_modifiers/incompatible_fixedx18.rs index 1cf1d2fc18ff3..d6028bdc0bf27 100644 --- a/tests/ui/target_modifiers/incompatible_fixedx18.rs +++ b/tests/ui/target_modifiers/incompatible_fixedx18.rs @@ -8,7 +8,6 @@ // [error_generated] no extra compile-flags //@[allow_mismatch] check-pass //@[allow_match] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/incompatible_pauth.rs b/tests/ui/target_modifiers/incompatible_pauth.rs index 302e845e8bd4f..c096f848737bb 100644 --- a/tests/ui/target_modifiers/incompatible_pauth.rs +++ b/tests/ui/target_modifiers/incompatible_pauth.rs @@ -9,7 +9,6 @@ //@ [ok_reverse_order] check-pass //@ [error_generated] compile-flags: -Zpointer-authentication=+calls,-init-fini //@ needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/incompatible_regparm.rs b/tests/ui/target_modifiers/incompatible_regparm.rs index 07018a6d6e948..6fea34cca7789 100644 --- a/tests/ui/target_modifiers/incompatible_regparm.rs +++ b/tests/ui/target_modifiers/incompatible_regparm.rs @@ -7,7 +7,6 @@ //@[allow_no_value] compile-flags: -Cunsafe-allow-abi-mismatch // [error_generated] no extra compile-flags //@[allow_regparm_mismatch] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/no_value_bool.rs b/tests/ui/target_modifiers/no_value_bool.rs index 054d27b323949..df0d57d556f32 100644 --- a/tests/ui/target_modifiers/no_value_bool.rs +++ b/tests/ui/target_modifiers/no_value_bool.rs @@ -12,7 +12,6 @@ //@[error_explicit] compile-flags: -Zreg-struct-return=false //@[ok] check-pass //@[ok_explicit] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/sanitizer_default.rs b/tests/ui/target_modifiers/sanitizer_default.rs index 5b3b1f4d7b6e5..3e00412a77de6 100644 --- a/tests/ui/target_modifiers/sanitizer_default.rs +++ b/tests/ui/target_modifiers/sanitizer_default.rs @@ -11,7 +11,6 @@ //@ aux-build:sanitizer_non_default.rs //@ compile-flags: --target riscv64gc-unknown-fuchsia //@ needs-llvm-components: riscv -//@ ignore-backends: gcc //@ revisions: implicit_default explicit_default implicit_mismatch explicit_mismatch //@[implicit_default] check-pass diff --git a/tests/ui/target_modifiers/target_cpu_default.rs b/tests/ui/target_modifiers/target_cpu_default.rs index db24989fd130e..6089283bdc8bc 100644 --- a/tests/ui/target_modifiers/target_cpu_default.rs +++ b/tests/ui/target_modifiers/target_cpu_default.rs @@ -14,7 +14,6 @@ //@ aux-build:target_cpu_non_default.rs //@ compile-flags: --target nvptx64-nvidia-cuda //@ needs-llvm-components: nvptx -//@ ignore-backends: gcc //@ revisions: implicit_default explicit_default implicit_mismatch explicit_mismatch //@[implicit_default] check-pass diff --git a/tests/ui/target_modifiers/two_flags.rs b/tests/ui/target_modifiers/two_flags.rs index c9ae341ce8c6c..e86cda43c1dc8 100644 --- a/tests/ui/target_modifiers/two_flags.rs +++ b/tests/ui/target_modifiers/two_flags.rs @@ -6,7 +6,6 @@ //@[two_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=regparm,reg-struct-return //@[unknown_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=unknown_flag -Zregparm=2 -Zreg-struct-return=true //@[two_allowed] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/test-attrs/test-panic-while-printing.rs b/tests/ui/test-attrs/test-panic-while-printing.rs index 49e8d9c7afdf1..a50a15fbe5af5 100644 --- a/tests/ui/test-attrs/test-panic-while-printing.rs +++ b/tests/ui/test-attrs/test-panic-while-printing.rs @@ -1,7 +1,6 @@ //@ compile-flags:--test //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc use std::fmt; use std::fmt::{Display, Formatter}; diff --git a/tests/ui/threads-sendsync/task-stderr.rs b/tests/ui/threads-sendsync/task-stderr.rs index f54b5a5cc5f68..3934084e02a0a 100644 --- a/tests/ui/threads-sendsync/task-stderr.rs +++ b/tests/ui/threads-sendsync/task-stderr.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc #![feature(internal_output_capture)] diff --git a/tests/ui/threads-sendsync/unwind-resource.rs b/tests/ui/threads-sendsync/unwind-resource.rs index c5fbfc5bf5b03..ec27a1846fef2 100644 --- a/tests/ui/threads-sendsync/unwind-resource.rs +++ b/tests/ui/threads-sendsync/unwind-resource.rs @@ -3,7 +3,6 @@ #![allow(non_camel_case_types)] //@ needs-threads -//@ ignore-backends: gcc use std::sync::mpsc::{channel, Sender}; use std::thread; diff --git a/tests/ui/trait-bounds/missing-unstable-trait-bound.nightly.stderr b/tests/ui/trait-bounds/missing-unstable-trait-bound.nightly.stderr index 75381e75bf558..47e9cdebb36d5 100644 --- a/tests/ui/trait-bounds/missing-unstable-trait-bound.nightly.stderr +++ b/tests/ui/trait-bounds/missing-unstable-trait-bound.nightly.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::ops::Range` is not an iterator - --> $DIR/missing-unstable-trait-bound.rs:13:14 + --> $DIR/missing-unstable-trait-bound.rs:12:14 | LL | for _ in t {} | ^ `Range` is not an iterator diff --git a/tests/ui/trait-bounds/missing-unstable-trait-bound.rs b/tests/ui/trait-bounds/missing-unstable-trait-bound.rs index ab77ffce3d768..1b563bb803a3e 100644 --- a/tests/ui/trait-bounds/missing-unstable-trait-bound.rs +++ b/tests/ui/trait-bounds/missing-unstable-trait-bound.rs @@ -3,7 +3,6 @@ //@ ignore-wasm32 //@ ignore-wasm64 -//@ ignore-backends: gcc // //@ revisions: stable nightly //@[stable] act-as-stable diff --git a/tests/ui/trait-bounds/missing-unstable-trait-bound.stable.stderr b/tests/ui/trait-bounds/missing-unstable-trait-bound.stable.stderr index f647267ac2e07..e34826eb4984b 100644 --- a/tests/ui/trait-bounds/missing-unstable-trait-bound.stable.stderr +++ b/tests/ui/trait-bounds/missing-unstable-trait-bound.stable.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::ops::Range` is not an iterator - --> $DIR/missing-unstable-trait-bound.rs:13:14 + --> $DIR/missing-unstable-trait-bound.rs:12:14 | LL | for _ in t {} | ^ `Range` is not an iterator diff --git a/tests/ui/traits/clone-unwind-rc-cleanup.rs b/tests/ui/traits/clone-unwind-rc-cleanup.rs index dab48a1b4c6cf..cd02050ea2746 100644 --- a/tests/ui/traits/clone-unwind-rc-cleanup.rs +++ b/tests/ui/traits/clone-unwind-rc-cleanup.rs @@ -2,7 +2,6 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![allow(unused_variables)] #![allow(unused_imports)] diff --git a/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr b/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr index 9d7d1a154ec78..33289d9ed3386 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr @@ -1,17 +1,17 @@ error[E0367]: `NonTrivialDrop` does not implement `[const] Destruct` - --> $DIR/const-drop-fail.rs:20:30 + --> $DIR/const-drop-fail.rs:19:30 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^ | note: required for this `Drop` impl - --> $DIR/const-drop-fail.rs:23:1 + --> $DIR/const-drop-fail.rs:22:1 | LL | const impl Drop for ConstImplWithDropGlue { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:36:5 + --> $DIR/const-drop-fail.rs:35:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -20,13 +20,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:38:5 + --> $DIR/const-drop-fail.rs:37:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -35,7 +35,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` diff --git a/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr b/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr index 9d7d1a154ec78..33289d9ed3386 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr @@ -1,17 +1,17 @@ error[E0367]: `NonTrivialDrop` does not implement `[const] Destruct` - --> $DIR/const-drop-fail.rs:20:30 + --> $DIR/const-drop-fail.rs:19:30 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^ | note: required for this `Drop` impl - --> $DIR/const-drop-fail.rs:23:1 + --> $DIR/const-drop-fail.rs:22:1 | LL | const impl Drop for ConstImplWithDropGlue { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:36:5 + --> $DIR/const-drop-fail.rs:35:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -20,13 +20,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:38:5 + --> $DIR/const-drop-fail.rs:37:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -35,7 +35,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` diff --git a/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr b/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr index 9d7d1a154ec78..33289d9ed3386 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr @@ -1,17 +1,17 @@ error[E0367]: `NonTrivialDrop` does not implement `[const] Destruct` - --> $DIR/const-drop-fail.rs:20:30 + --> $DIR/const-drop-fail.rs:19:30 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^ | note: required for this `Drop` impl - --> $DIR/const-drop-fail.rs:23:1 + --> $DIR/const-drop-fail.rs:22:1 | LL | const impl Drop for ConstImplWithDropGlue { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:36:5 + --> $DIR/const-drop-fail.rs:35:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -20,13 +20,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:38:5 + --> $DIR/const-drop-fail.rs:37:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -35,7 +35,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` diff --git a/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr b/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr index 9d7d1a154ec78..33289d9ed3386 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr @@ -1,17 +1,17 @@ error[E0367]: `NonTrivialDrop` does not implement `[const] Destruct` - --> $DIR/const-drop-fail.rs:20:30 + --> $DIR/const-drop-fail.rs:19:30 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^ | note: required for this `Drop` impl - --> $DIR/const-drop-fail.rs:23:1 + --> $DIR/const-drop-fail.rs:22:1 | LL | const impl Drop for ConstImplWithDropGlue { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:36:5 + --> $DIR/const-drop-fail.rs:35:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -20,13 +20,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:38:5 + --> $DIR/const-drop-fail.rs:37:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -35,7 +35,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` diff --git a/tests/ui/traits/const-traits/const-drop-fail.rs b/tests/ui/traits/const-traits/const-drop-fail.rs index 5a3894ed4dfe2..721b1d077f7c9 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.rs +++ b/tests/ui/traits/const-traits/const-drop-fail.rs @@ -2,7 +2,6 @@ //@[new_stock] compile-flags: -Znext-solver //@ revisions: new_stock old_stock new_precise old_precise //@ ignore-compare-mode-next-solver (explicit revisions) -//@ ignore-backends: gcc #![feature(const_trait_impl, const_destruct)] #![cfg_attr(any(new_precise, old_precise), feature(const_precise_live_drops))] diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.nightly-enabled.stderr b/tests/ui/traits/const-traits/const-supertrait-unstable.nightly-enabled.stderr index ae38e9799981f..43ac8df50d8f1 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.nightly-enabled.stderr +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.nightly-enabled.stderr @@ -1,17 +1,17 @@ error: `[const]` is not allowed here - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ | note: this trait is not `const`, so it cannot have `[const]` trait bounds - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -22,7 +22,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -34,7 +34,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -46,7 +46,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` @@ -57,7 +57,7 @@ LL | const trait Bar: [const] Foo {} | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` @@ -69,13 +69,13 @@ LL | const trait Bar: [const] Foo {} | +++++ error[E0015]: cannot call non-const method `::a` in constant functions - --> $DIR/const-supertrait-unstable.rs:37:7 + --> $DIR/const-supertrait-unstable.rs:36:7 | LL | x.a(); | ^^^ | note: method `a` is not const because trait `Foo` is not const - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ this trait is not const diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.nightly.stderr b/tests/ui/traits/const-traits/const-supertrait-unstable.nightly.stderr index ba0c399c0d27b..ed1fa6bf261a9 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.nightly.stderr +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.nightly.stderr @@ -1,17 +1,17 @@ error: `[const]` is not allowed here - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ | note: this trait is not `const`, so it cannot have `[const]` trait bounds - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0658]: const trait impls are experimental - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ @@ -21,7 +21,7 @@ LL | trait Bar: [const] Foo {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: const trait impls are experimental - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ @@ -31,7 +31,7 @@ LL | const fn foo(x: &T) { = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -42,7 +42,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -54,7 +54,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -66,7 +66,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` @@ -77,7 +77,7 @@ LL | const trait Bar: [const] Foo {} | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` @@ -89,13 +89,13 @@ LL | const trait Bar: [const] Foo {} | +++++ error[E0015]: cannot call non-const method `::a` in constant functions - --> $DIR/const-supertrait-unstable.rs:37:7 + --> $DIR/const-supertrait-unstable.rs:36:7 | LL | x.a(); | ^^^ | note: method `a` is not const because trait `Foo` is not const - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ this trait is not const diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.rs b/tests/ui/traits/const-traits/const-supertrait-unstable.rs index 0d70a4b876d9b..04e49b4109f32 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.rs +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.rs @@ -2,7 +2,6 @@ //! We don't want to provide suggestions on stable that only make sense in nightly. //@ needs-target-std -//@ ignore-backends: gcc //@ normalize-stderr: "dev release channel" -> "nightly release channel" //@ normalize-stderr: "stable release channel" -> "nightly release channel" diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.stable-enabled.stderr b/tests/ui/traits/const-traits/const-supertrait-unstable.stable-enabled.stderr index 196f3dc2724ba..dbcc8d46d3fc7 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.stable-enabled.stderr +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.stable-enabled.stderr @@ -1,92 +1,92 @@ error: `[const]` is not allowed here - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ | note: this trait is not `const`, so it cannot have `[const]` trait bounds - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0554]: `#![feature]` may not be used on the nightly release channel - --> $DIR/const-supertrait-unstable.rs:19:30 + --> $DIR/const-supertrait-unstable.rs:18:30 | LL | #![cfg_attr(feature_enabled, feature(const_trait_impl))] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` | note: `Bar` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` | note: `Bar` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const method `::a` in constant functions - --> $DIR/const-supertrait-unstable.rs:37:7 + --> $DIR/const-supertrait-unstable.rs:36:7 | LL | x.a(); | ^^^ | note: method `a` is not const because trait `Foo` is not const - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ this trait is not const diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.stable.stderr b/tests/ui/traits/const-traits/const-supertrait-unstable.stable.stderr index 50ceda54258c1..ee1c731e604a6 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.stable.stderr +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.stable.stderr @@ -1,17 +1,17 @@ error: `[const]` is not allowed here - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ | note: this trait is not `const`, so it cannot have `[const]` trait bounds - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0658]: const trait impls are experimental - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ @@ -19,7 +19,7 @@ LL | trait Bar: [const] Foo {} = note: see issue #143874 for more information error[E0658]: const trait impls are experimental - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ @@ -27,76 +27,76 @@ LL | const fn foo(x: &T) { = note: see issue #143874 for more information error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` | note: `Bar` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` | note: `Bar` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const method `::a` in constant functions - --> $DIR/const-supertrait-unstable.rs:37:7 + --> $DIR/const-supertrait-unstable.rs:36:7 | LL | x.a(); | ^^^ | note: method `a` is not const because trait `Foo` is not const - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ this trait is not const diff --git a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs index 81c2d778b057f..c08030fc5c150 100644 --- a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs +++ b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs @@ -1,5 +1,4 @@ //@ proc-macro: derive-demo-issue-136343.rs -//@ ignore-backends: gcc #[macro_use] extern crate derive_demo_issue_136343; diff --git a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr index d69eaae533551..0b9c1d9123aab 100644 --- a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr +++ b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/invalid-sugg-for-derive-macro-issue-136343.rs:7:10 + --> $DIR/invalid-sugg-for-derive-macro-issue-136343.rs:6:10 | LL | #[derive(Sample)] | ^^^^^^ diff --git a/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs b/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs index e439a82be5abb..2c2788a3e5642 100644 --- a/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs +++ b/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc // See https://github.com/rust-lang/rust/issues/135802 enum Void {} diff --git a/tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs b/tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs index 21f8fe7fdf8fd..f0f1a6f99b9e9 100644 --- a/tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs +++ b/tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs @@ -1,7 +1,6 @@ // This is a regression test for . //@ check-pass //@ compile-flags: -Cdebuginfo=2 -//@ ignore-backends: gcc #![feature(unsafe_binders)] use std::unsafe_binder::wrap_binder; From 0e999152f03311db3ca3ada95226f82d2617f0c1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Nov 2026 20:49:53 +0100 Subject: [PATCH 25/34] mpsc_sync::stream_send_recv_stress: wait for all thread to finish --- library/std/tests/sync/mpsc_sync.rs | 58 ++++++++++++++++++----------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/library/std/tests/sync/mpsc_sync.rs b/library/std/tests/sync/mpsc_sync.rs index dfe1f8c6b7b8c..25faeb6323548 100644 --- a/library/std/tests/sync/mpsc_sync.rs +++ b/library/std/tests/sync/mpsc_sync.rs @@ -420,34 +420,48 @@ fn oneshot_multi_thread_send_recv_stress() { #[test] fn stream_send_recv_stress() { - for _ in 0..stress_factor() { - let (tx, rx) = sync_channel::>(0); - - send(tx, 0); - recv(rx, 0); + thread::scope(|s| { + for _ in 0..stress_factor() { + let (tx, rx) = sync_channel::>(0); + + send(tx, 0, s); + recv(rx, 0, s); + + fn send<'scope, 'env>( + tx: SyncSender>, + i: i32, + s: &'scope thread::Scope<'scope, 'env>, + ) where + 'env: 'scope, + { + if i == 10 { + return; + } - fn send(tx: SyncSender>, i: i32) { - if i == 10 { - return; + s.spawn(move || { + tx.send(Box::new(i)).unwrap(); + send(tx, i + 1, s); + }); } - thread::spawn(move || { - tx.send(Box::new(i)).unwrap(); - send(tx, i + 1); - }); - } + fn recv<'scope, 'env>( + rx: Receiver>, + i: i32, + s: &'scope thread::Scope<'scope, 'env>, + ) where + 'env: 'scope, + { + if i == 10 { + return; + } - fn recv(rx: Receiver>, i: i32) { - if i == 10 { - return; + s.spawn(move || { + assert!(*rx.recv().unwrap() == i); + recv(rx, i + 1, s); + }); } - - thread::spawn(move || { - assert!(*rx.recv().unwrap() == i); - recv(rx, i + 1); - }); } - } + }) } #[test] From d11b3f4d61c50f4149ea34a89302cf24a0c52b86 Mon Sep 17 00:00:00 2001 From: Abhinav Srivastav Date: Sun, 8 Nov 2026 16:29:33 +0000 Subject: [PATCH 26/34] fix MSVC calling convention symbol byte counts --- compiler/rustc_codegen_llvm/src/declare.rs | 13 ++++ compiler/rustc_codegen_ssa/src/back/lto.rs | 8 +-- .../src/back/symbol_export.rs | 70 +++++++++++++------ compiler/rustc_codegen_ssa/src/common.rs | 55 ++++++++++++++- .../assembly-llvm/win32-byte-count-suffix.rs | 11 ++- tests/codegen-llvm/abi-x86_64-win-zst.rs | 23 ++++-- .../msvc-x86-callconv-byte-count.rs | 46 ++++++++++++ .../unwind-abis/fastcall-unwind-abi.rs | 4 +- .../unwind-abis/stdcall-unwind-abi.rs | 4 +- .../unwind-abis/system-unwind-abi.rs | 4 +- .../unwind-abis/vectorcall-unwind-abi.rs | 4 +- .../linking/msvc-callconv-export-prefixes.rs | 37 ++++++++++ 12 files changed, 234 insertions(+), 45 deletions(-) create mode 100644 tests/codegen-llvm/msvc-x86-callconv-byte-count.rs create mode 100644 tests/ui/linking/msvc-callconv-export-prefixes.rs diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs index 78bc5aba450aa..a5c7796810a63 100644 --- a/compiler/rustc_codegen_llvm/src/declare.rs +++ b/compiler/rustc_codegen_llvm/src/declare.rs @@ -169,6 +169,19 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { instance: Option>, ) -> &'ll Value { debug!("declare_rust_fn(name={:?}, fn_abi={:?})", name, fn_abi); + // Some calling conventions (such as fastcall and vectorcall) decorate + // symbols with the argument byte count. Use rustc's original argument + // layouts and prefix the decorated name with `\x01` so LLVM does not + // decorate it a second time. + let decorated_name = rustc_codegen_ssa::common::windows_calling_convention_name( + &self.tcx.sess.target, + fn_abi.conv, + name, + &fn_abi.args, + ) + .map(|name| format!("\x01{name}")); + + let name = decorated_name.as_deref().unwrap_or(name); // Function addresses in Rust are never significant, allowing functions to // be merged. diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs index a1de6b709cd92..c85ebe07b2c6b 100644 --- a/compiler/rustc_codegen_ssa/src/back/lto.rs +++ b/compiler/rustc_codegen_ssa/src/back/lto.rs @@ -12,7 +12,7 @@ use rustc_session::config::Lto; use rustc_structures::CrateType; use tracing::info; -use crate::back::symbol_export::{self, allocator_shim_symbols, symbol_name_for_instance_in_crate}; +use crate::back::symbol_export::{self, allocator_shim_symbols}; use crate::back::write::CodegenContext; use crate::base::allocator_kind_for_codegen; use crate::diagnostics::{DynamicLinkingWithLTO, LtoDisallowed, LtoDylib, LtoProcMacro}; @@ -104,11 +104,11 @@ pub(crate) fn exported_symbols_for_lto( tcx.exported_non_generic_symbols(cnum) .iter() .chain(tcx.exported_generic_symbols(cnum)) - .filter_map(|&(s, info): &(ExportedSymbol<'_>, SymbolExportInfo)| { + .flat_map(|&(s, info): &(ExportedSymbol<'_>, SymbolExportInfo)| { if info.level.is_below_threshold(export_threshold) || info.used { - Some(symbol_name_for_instance_in_crate(tcx, s, cnum)) + symbol_export::symbol_names_for_lto(tcx, s, cnum) } else { - None + vec![] } }) .collect::>() diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index e2acf1fdcf69b..6b9214b0b55fb 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -1,7 +1,7 @@ use std::collections::hash_map::Entry::*; use object::pe; -use rustc_abi::{CanonAbi, X86Call}; +use rustc_abi::CanonAbi; use rustc_ast::expand::allocator::{AllocatorKind, NO_ALLOC_SHIM_IS_UNSTABLE, global_fn_name}; use rustc_crate_store::CrateDepKind; use rustc_data_structures::fx::FxHashSet; @@ -758,9 +758,31 @@ fn calling_convention_for_symbol<'tcx>( .unwrap_or((CanonAbi::Rust, &[])) } +/// Names used to preserve an exported symbol during LTO. +/// +/// The restriction pass matches LLVM IR names, which retain the `\x01` +/// marker for explicitly decorated symbols. ThinLTO GUIDs instead use +/// the identifier without that marker, so preserve both spellings. +pub(crate) fn symbol_names_for_lto<'tcx>( + tcx: TyCtxt<'tcx>, + symbol: ExportedSymbol<'tcx>, + instantiating_crate: CrateNum, +) -> Vec { + let name = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate); + let (callconv, args) = calling_convention_for_symbol(tcx, symbol); + + if let Some(decorated) = + crate::common::windows_calling_convention_name(&tcx.sess.target, callconv, &name, args) + { + vec![format!("\x01{decorated}"), decorated] + } else { + vec![name] + } +} /// This is the symbol name of the given instance as seen by the linker. /// -/// On 32-bit Windows symbols are decorated according to their calling conventions. +/// On Windows, symbols are decorated according to their calling conventions. +/// Vectorcall symbols are also decorated on non-Windows targets. pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>( tcx: TyCtxt<'tcx>, symbol: ExportedSymbol<'tcx>, @@ -777,8 +799,15 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>( let target = &tcx.sess.target; if !target.is_like_windows { + let (callconv, args) = calling_convention_for_symbol(tcx, symbol); + if let Some(name) = + crate::common::windows_calling_convention_name(target, callconv, &undecorated, args) + { + return name; + } + // Mach-O has a global "_" suffix and `object` crate will handle it. - // ELF does not have any symbol decorations. + // Other calling conventions do not need decoration here. return undecorated; } @@ -791,27 +820,26 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>( _ => return undecorated, }; + // LLVM treats names beginning with '\x01' as already mangled and strips that prefix. + // Names beginning with '?' are left undecorated by LLVM; the prefix is kept. + if let Some(name) = undecorated.strip_prefix('\x01') { + return name.to_string(); + } + if undecorated.starts_with('?') { + return undecorated; + } let (callconv, args) = calling_convention_for_symbol(tcx, symbol); - // Decorate symbols with prefixes, suffixes and total number of bytes of arguments. - // Reference: https://docs.microsoft.com/en-us/cpp/build/reference/decorated-names?view=msvc-170 - let (prefix, suffix) = match callconv { - CanonAbi::X86(X86Call::Fastcall) => ("@", "@"), - CanonAbi::X86(X86Call::Stdcall) => ("_", "@"), - CanonAbi::X86(X86Call::Vectorcall) => ("", "@@"), - _ => { - if let Some(prefix) = prefix { - undecorated.insert(0, prefix); - } - return undecorated; - } - }; + if let Some(name) = + crate::common::windows_calling_convention_name(target, callconv, &undecorated, args) + { + return name; + } - let args_in_bytes: u64 = args - .iter() - .map(|abi| abi.layout.size.bytes().next_multiple_of(target.pointer_width as u64 / 8)) - .sum(); - format!("{prefix}{undecorated}{suffix}{args_in_bytes}") + if let Some(prefix) = prefix { + undecorated.insert(0, prefix); + } + undecorated } pub(crate) fn exporting_symbol_name_for_instance_in_crate<'tcx>( diff --git a/compiler/rustc_codegen_ssa/src/common.rs b/compiler/rustc_codegen_ssa/src/common.rs index b5f1fee9407f4..8b00f8a32182a 100644 --- a/compiler/rustc_codegen_ssa/src/common.rs +++ b/compiler/rustc_codegen_ssa/src/common.rs @@ -1,13 +1,15 @@ #![allow(non_camel_case_types)] +use rustc_abi::{CanonAbi, X86Call}; use rustc_attr_ir::PeImportNameType; use rustc_attr_ir::lang_items::LangItem; use rustc_crate_store::{DllCallingConvention, DllImport, DllImportSymbolType}; use rustc_middle::mir::interpret::{GlobalAlloc, PointerArithmetic, Scalar}; use rustc_middle::ty::layout::TyAndLayout; -use rustc_middle::ty::{self, Instance, ScalarInt, TyCtxt}; +use rustc_middle::ty::{self, Instance, ScalarInt, Ty, TyCtxt}; use rustc_span::{Span, bug, span_bug}; -use rustc_target::spec::{CfgAbi, Env, Os, Target}; +use rustc_target::callconv::ArgAbi; +use rustc_target::spec::{Arch, CfgAbi, Env, Os, Target}; use crate::traits::*; @@ -174,6 +176,55 @@ pub fn is_using_dlltool(target: &Target) -> bool { target.os == Os::Windows && target.env == Env::Gnu && target.cfg_abi == CfgAbi::Unspecified } +/// Computes the total argument size used for Windows calling-convention +/// symbol decoration. Each argument is rounded up to the pointer width. +fn windows_abi_argument_byte_sum<'tcx>(args: &[ArgAbi<'tcx, Ty<'tcx>>], target: &Target) -> u64 { + let pointer_bytes = target.pointer_width as u64 / 8; + + args.iter().map(|arg| arg.layout.size.bytes().next_multiple_of(pointer_bytes)).sum() +} + +/// Computes the linker-visible decorated symbol name for supported Windows +/// calling conventions using the original `FnAbi` argument layouts. +/// Vectorcall is also decorated on non-Windows targets. +/// +/// The byte count is computed before backend-specific argument lowering, +/// which may replace indirectly passed arguments with pointers. +/// +/// For example, on 32-bit Windows, `extern "fastcall" fn foo(i32, i32)` +/// is decorated as `@foo@8`. On 64-bit targets, +/// `extern "vectorcall" fn foo(i32)` is decorated as `foo@@8`. +/// +/// Returns `None` if no decoration is required or if the name begins with +/// `\x01` or `?`, indicating that it must not be decorated further. +/// +/// This function does not add LLVM's `\x01` escape prefix. Backend-specific +/// handling of that marker is the responsibility of the caller. +pub fn windows_calling_convention_name<'tcx>( + target: &Target, + conv: CanonAbi, + name: &str, + args: &[ArgAbi<'tcx, Ty<'tcx>>], +) -> Option { + if !target.is_like_windows && conv != CanonAbi::X86(X86Call::Vectorcall) { + return None; + } + + if name.starts_with('\x01') || name.starts_with('?') { + return None; + } + + let (prefix, suffix) = match (&target.arch, conv) { + (Arch::X86, CanonAbi::X86(X86Call::Fastcall)) => ("@", "@"), + (Arch::X86, CanonAbi::X86(X86Call::Stdcall)) => ("_", "@"), + (Arch::X86 | Arch::X86_64, CanonAbi::X86(X86Call::Vectorcall)) => ("", "@@"), + _ => return None, + }; + + let args_in_bytes = windows_abi_argument_byte_sum(args, target); + Some(format!("{prefix}{name}{suffix}{args_in_bytes}")) +} + pub fn i686_decorated_name( dll_import: &DllImport, mingw: bool, diff --git a/tests/assembly-llvm/win32-byte-count-suffix.rs b/tests/assembly-llvm/win32-byte-count-suffix.rs index 83b01c62dca85..14d90e2d4eea2 100644 --- a/tests/assembly-llvm/win32-byte-count-suffix.rs +++ b/tests/assembly-llvm/win32-byte-count-suffix.rs @@ -249,9 +249,8 @@ extern "vectorcall" fn eight_vectors_vectorcall( ) { } -/// FIXME: the mangled name for this type is incorrect on msvc, where the argument is passed -/// indirectly and a pointer takes up 4 bytes, but clang counts the size of the type and uses -/// @8 there. With GNU the value is passed directly, so the suffix is correct. +// MSVC passes this argument indirectly, but the decoration uses the +// original 8-byte type size rather than the 4-byte pointer size. #[repr(C, align(8))] struct OverAligned(u32, u32); @@ -260,16 +259,16 @@ struct OverAligned(u32, u32); extern "C" fn overaligned(_: OverAligned) {} // windows-gnu-LABEL: _overaligned_stdcall@8: -// windows-msvc-LABEL: _overaligned_stdcall@4: +// windows-msvc-LABEL: _overaligned_stdcall@8: #[unsafe(no_mangle)] extern "stdcall" fn overaligned_stdcall(_: OverAligned) {} // windows-gnu-LABEL: @overaligned_fastcall@8: -// windows-msvc-LABEL: @overaligned_fastcall@4: +// windows-msvc-LABEL: @overaligned_fastcall@8: #[unsafe(no_mangle)] extern "fastcall" fn overaligned_fastcall(_: OverAligned) {} // windows-gnu-LABEL: overaligned_vectorcall@@8: -// windows-msvc-LABEL: overaligned_vectorcall@@4: +// windows-msvc-LABEL: overaligned_vectorcall@@8: #[unsafe(no_mangle)] extern "vectorcall" fn overaligned_vectorcall(_: OverAligned) {} diff --git a/tests/codegen-llvm/abi-x86_64-win-zst.rs b/tests/codegen-llvm/abi-x86_64-win-zst.rs index bcb275a78bb82..52a81b661b5ec 100644 --- a/tests/codegen-llvm/abi-x86_64-win-zst.rs +++ b/tests/codegen-llvm/abi-x86_64-win-zst.rs @@ -43,15 +43,15 @@ extern "win64" fn pass_c_maybezst_win64(_: CMaybeZst) {} #[no_mangle] extern "win64" fn pass_c_maybezst_2_win64(_: CMaybeZst2) {} -// CHECK: define x86_vectorcallcc void @pass_rust_zst_vectorcall() +// CHECK: define x86_vectorcallcc void @"\01pass_rust_zst_vectorcall@@0"( #[no_mangle] extern "vectorcall" fn pass_rust_zst_vectorcall(_: ()) {} -// CHECK: define x86_vectorcallcc void @pass_c_maybezst_vectorcall(ptr {{[^,]*}}) +// CHECK: define x86_vectorcallcc void @"\01pass_c_maybezst_vectorcall@@0"(ptr {{[^,]*}}) #[no_mangle] extern "vectorcall" fn pass_c_maybezst_vectorcall(_: CMaybeZst) {} -// CHECK: define x86_vectorcallcc void @pass_c_maybezst_2_vectorcall(ptr {{[^,]*}}) +// CHECK: define x86_vectorcallcc void @"\01pass_c_maybezst_2_vectorcall@@0"(ptr {{[^,]*}}) #[no_mangle] extern "vectorcall" fn pass_c_maybezst_2_vectorcall(_: CMaybeZst2) {} @@ -73,6 +73,21 @@ extern "fastcall" fn pass_c_maybezst_fastcall(_: CMaybeZst) {} #[cfg(windows)] // "fastcall" is not valid on 64bit Linux extern "fastcall" fn pass_c_maybezst_2_fastcall(_: CMaybeZst2) {} +// Keep the original argument size when a vectorcall argument is passed +// indirectly. This also exercises vectorcall decoration on Linux. +#[repr(C)] +pub struct Big { + pub data: [u64; 4], +} + +// CHECK: define x86_vectorcallcc void @"\01vc_big@@32"( +#[unsafe(export_name = "vc_big")] +pub extern "vectorcall" fn vc_big(_: Big) {} + +// CHECK: define x86_vectorcallcc void @"\01vc_u64@@8"( +#[unsafe(export_name = "vc_u64")] +pub extern "vectorcall" fn vc_u64(_: u64) {} + // The sysv64 ABI ignores ZST. // CHECK: define x86_64_sysvcc void @pass_rust_zst_sysv64() @@ -116,7 +131,7 @@ extern "win64" fn ret_c_maybezst_win64() -> CMaybeZst { CMaybeZst } -// CHECK: define x86_vectorcallcc void @ret_c_maybezst_vectorcall(ptr {{[^,]*}}) +// CHECK: define x86_vectorcallcc void @"\01ret_c_maybezst_vectorcall@@0"(ptr {{[^,]*}}) #[no_mangle] extern "vectorcall" fn ret_c_maybezst_vectorcall() -> CMaybeZst { CMaybeZst diff --git a/tests/codegen-llvm/msvc-x86-callconv-byte-count.rs b/tests/codegen-llvm/msvc-x86-callconv-byte-count.rs new file mode 100644 index 0000000000000..ac867b9fa9a80 --- /dev/null +++ b/tests/codegen-llvm/msvc-x86-callconv-byte-count.rs @@ -0,0 +1,46 @@ +// Regression test for rust-lang/rust#165299. +// Verify decoration using source argument layouts on 32-bit Windows. +// +//@ add-minicore +//@ revisions: msvc gnu +//@[msvc] compile-flags: --target i686-pc-windows-msvc +//@[gnu] compile-flags: --target i686-pc-windows-gnu +//@ needs-llvm-components: x86 + +#![feature(abi_vectorcall, no_core)] +#![no_core] +#![crate_type = "lib"] + +extern crate minicore; +use minicore::*; + +#[repr(C)] +pub struct Big { + pub data: [u64; 4], +} + +// CHECK-DAG: @"\01@fast_big@32" +#[unsafe(export_name = "fast_big")] +pub extern "fastcall" fn fast_big(_: Big) {} + +// CHECK-DAG: @"\01_std_big@32" +#[unsafe(export_name = "std_big")] +pub extern "stdcall" fn std_big(_: Big) {} + +// CHECK-DAG: @"\01vec_big@@32" +#[unsafe(export_name = "vec_big")] +pub extern "vectorcall" fn vec_big(_: Big) {} + +// CHECK-DAG: @"\01vec_u64@@8" +#[unsafe(export_name = "vec_u64")] +pub extern "vectorcall" fn vec_u64(_: u64) {} + +// Names beginning with '?' are already decorated. +// CHECK-DAG: @"?special" +#[unsafe(export_name = "?special")] +pub extern "stdcall" fn question(_: u32) {} + +// The LLVM escape prefix must not acquire another decoration. +// CHECK-DAG: @"\01special" +#[unsafe(export_name = "\x01special")] +pub extern "stdcall" fn escaped(_: u32) {} diff --git a/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs index 51c6fd15b9c5c..b0b5924443a65 100644 --- a/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `fastcall-unwind` extern functions. `fastcall-unwind` functions MUST NOT have this attribute. We // disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @"\01@rust_item_that_cannot_unwind@0"() unnamed_addr #0 #[no_mangle] pub extern "fastcall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @"\01@rust_item_that_can_unwind@0"() unnamed_addr #1 #[no_mangle] pub extern "fastcall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs index b5fcea52b4d61..7cd06eb4e0fc9 100644 --- a/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // extern functions. `stdcall-unwind` functions MUST NOT have this attribute. We disable // optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @"\01_rust_item_that_cannot_unwind@0"() unnamed_addr #0 #[no_mangle] pub extern "stdcall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @"\01_rust_item_that_can_unwind@0"() unnamed_addr #1 #[no_mangle] pub extern "stdcall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs index 15fce95fe285b..59b05c04dc766 100644 --- a/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs @@ -7,11 +7,11 @@ #![crate_type = "lib"] -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @{{.*}}rust_item_that_cannot_unwind{{.*}}() unnamed_addr #0 #[no_mangle] pub extern "system" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @{{.*}}rust_item_that_can_unwind{{.*}}() unnamed_addr #1 #[no_mangle] pub extern "system-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs index 8cedb55ae1d28..664ad73797437 100644 --- a/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `vectorcall-unwind` extern functions. `vectorcall-unwind` functions MUST NOT have this attribute. // We disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @"\01rust_item_that_cannot_unwind@@0"() unnamed_addr #0 #[no_mangle] pub extern "vectorcall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @"\01rust_item_that_can_unwind@@0"() unnamed_addr #1 #[no_mangle] pub extern "vectorcall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/ui/linking/msvc-callconv-export-prefixes.rs b/tests/ui/linking/msvc-callconv-export-prefixes.rs new file mode 100644 index 0000000000000..6dc7332fba847 --- /dev/null +++ b/tests/ui/linking/msvc-callconv-export-prefixes.rs @@ -0,0 +1,37 @@ +// Regression test for rust-lang/rust#165299. +// +// Cross-compile a Windows MSVC cdylib and link it to check that the +// linker-visible names agree with the names emitted by LLVM. +// +// `minicore` avoids requiring a Windows target sysroot, while rust-lld +// allows this test to link on non-Windows hosts. `/NOENTRY` avoids needing +// a DLL entry point or Windows startup libraries. +// +// Check normal vectorcall decoration and names explicitly marked as +// already decorated with either `\x01` or `?`. + +//@ build-pass +//@ add-minicore +//@ revisions: i686 x86_64 +//@[i686] compile-flags: --target i686-pc-windows-msvc +//@[x86_64] compile-flags: --target x86_64-pc-windows-msvc +//@ compile-flags: -Clinker=rust-lld -Clink-arg=/NOENTRY -Cpanic=abort +//@ needs-llvm-components: x86 +//@ needs-rust-lld +//@ ignore-backends: gcc + +#![feature(no_core, abi_vectorcall)] +#![no_core] +#![crate_type = "cdylib"] + +extern crate minicore; +use minicore::*; + +#[unsafe(export_name = "\x01ctl_vectorcall")] +pub extern "vectorcall" fn escaped(_: u32, _: u32) {} + +#[unsafe(export_name = "?q_vectorcall")] +pub extern "vectorcall" fn question(_: u32, _: u32) {} + +#[unsafe(export_name = "normal_vectorcall")] +pub extern "vectorcall" fn normal(_: u32, _: u32) {} From 792c14e8ec9f94ad9c437b62651a12a08a809eac Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Nov 2026 23:08:37 +0100 Subject: [PATCH 27/34] tweak comment --- src/tools/miri/src/shims/unix/foreign_items.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/miri/src/shims/unix/foreign_items.rs b/src/tools/miri/src/shims/unix/foreign_items.rs index 4014060b11019..c6169fb7fdfe8 100644 --- a/src/tools/miri/src/shims/unix/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/foreign_items.rs @@ -67,7 +67,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // 512 seems to be a reasonable default. The value is not critical, in // the sense that getpwuid_r takes and checks the buffer length. ("_SC_GETPW_R_SIZE_MAX", |_ecx| 512), - // Never hand out FDs at or above `FD_LIMIT`. + // We only hand out FDs in `0..FD_LIMIT`, making `FD_LIMIT` the max + // number of open FDs. ("_SC_OPEN_MAX", |_ecx| FD_LIMIT.into()), // Our hard-coded hostname is just 4 bytes so we don't need anything big here. ("_SC_HOST_NAME_MAX", |_ecx| 255), From b52077cac99d4b0f0ed8f063320fadb9c9e0b87c Mon Sep 17 00:00:00 2001 From: Luca Versari Date: Sat, 7 Nov 2026 10:46:50 +0100 Subject: [PATCH 28/34] Remove `backend_optimization_level`. Turns out that all uses were effectively equivalent to using sess.opts.optimize. --- .../rustc_codegen_cranelift/src/driver/aot.rs | 8 ++---- compiler/rustc_codegen_gcc/src/lib.rs | 6 +--- .../src/back/llvm_backend.rs | 10 ++----- compiler/rustc_codegen_llvm/src/back/write.rs | 2 +- compiler/rustc_codegen_ssa/src/back/write.rs | 13 ++++----- compiler/rustc_codegen_ssa/src/base.rs | 28 +------------------ compiler/rustc_codegen_ssa/src/lib.rs | 1 - .../rustc_codegen_ssa/src/traits/write.rs | 8 ++---- compiler/rustc_middle/src/queries.rs | 6 +--- 9 files changed, 16 insertions(+), 66 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/driver/aot.rs b/compiler/rustc_codegen_cranelift/src/driver/aot.rs index ce3741b582827..6fde623d46f73 100644 --- a/compiler/rustc_codegen_cranelift/src/driver/aot.rs +++ b/compiler/rustc_codegen_cranelift/src/driver/aot.rs @@ -22,7 +22,7 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle}; use rustc_middle::dep_graph::WorkProduct; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::mono::{MonoItem, MonoItemData, Visibility}; -use rustc_session::config::{OptLevel, OutputFilenames, OutputType}; +use rustc_session::config::{OutputFilenames, OutputType}; use rustc_session::{BorrowedIncrCompSession, Session}; use rustc_span::Symbol; @@ -318,11 +318,7 @@ impl WriteBackendMethods for AotDriver { type TargetMachine = (); type ThinData = Infallible; - fn target_machine_factory( - &self, - _sess: &Session, - _opt_level: OptLevel, - ) -> TargetMachineFactoryFn { + fn target_machine_factory(&self, _sess: &Session) -> TargetMachineFactoryFn { Arc::new(|_, _| ()) } diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index 17034d0c195e7..fa15ec2838b24 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -409,11 +409,7 @@ impl WriteBackendMethods for GccCodegenBackend { false } - fn target_machine_factory( - &self, - _sess: &Session, - _opt_level: OptLevel, - ) -> TargetMachineFactoryFn { + fn target_machine_factory(&self, _sess: &Session) -> TargetMachineFactoryFn { // FIXME(antoyo): set opt level. Arc::new(|_, _| ()) } diff --git a/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs b/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs index 69d63c52e4b88..7864d0cc81491 100644 --- a/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs +++ b/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs @@ -22,7 +22,7 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle}; use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::{WorkProduct, WorkProductMap}; use rustc_middle::ty::TyCtxt; -use rustc_session::config::{OptLevel, OutputFilenames, PrintKind, PrintRequest}; +use rustc_session::config::{OutputFilenames, PrintKind, PrintRequest}; use rustc_session::{ BorrowedIncrCompSession, CodegenBackendInit, EarlySession, IncrCompSession, Session, }; @@ -89,12 +89,8 @@ impl WriteBackendMethods for LlvmCodegenBackend { fn thread_profiler() -> Box { Box::new(TimeTraceProfiler::new()) } - fn target_machine_factory( - &self, - sess: &Session, - optlvl: OptLevel, - ) -> TargetMachineFactoryFn { - back::write::target_machine_factory(sess, optlvl) + fn target_machine_factory(&self, sess: &Session) -> TargetMachineFactoryFn { + back::write::target_machine_factory(sess, sess.opts.optimize) } fn optimize_and_codegen_fat_lto( sess: &Session, diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index e43b9ba6359ed..4e1a3f998a265 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -116,7 +116,7 @@ pub(crate) fn create_target_machine(tcx: TyCtxt<'_>, mod_name: &str) -> OwnedTar Some(tcx.output_filenames(()).temp_path_for_cgu(OutputType::Object, mod_name)); let config = TargetMachineFactoryConfig { split_dwarf_file, output_obj_file }; - target_machine_factory(tcx.sess, tcx.backend_optimization_level(()))(tcx.dcx(), config) + target_machine_factory(tcx.sess, tcx.sess.opts.optimize)(tcx.dcx(), config) } // `s` and `z` are the same codegen level; what tells LLVM that they are size builds is the diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 406e5a5b04c61..24fcab7218f7e 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -23,8 +23,8 @@ use rustc_metadata::fs::copy_to_stdout; use rustc_middle::dep_graph::{WorkProduct, WorkProductMap}; use rustc_middle::ty::TyCtxt; use rustc_session::config::{ - self, JobsMode, Lto, OptLevel, OptimizationObjective, OutFileName, OutputFilenames, OutputType, - Passes, SwitchWithOptPath, + self, JobsMode, Lto, OptimizationObjective, OutFileName, OutputFilenames, OutputType, Passes, + SwitchWithOptPath, }; use rustc_session::{BorrowedIncrCompSession, IncrCompSession, Session}; use rustc_span::source_map::SourceMap; @@ -328,7 +328,6 @@ pub struct CodegenContext { pub crate_types: Vec, pub output_filenames: Arc, pub module_config: Arc, - pub opt_level: OptLevel, pub msvc_imps_needed: bool, pub is_pe_coff: bool, pub target_can_use_split_dwarf: bool, @@ -1243,8 +1242,7 @@ fn start_executing_work( .expect("failed to spawn helper thread") }); - let opt_level = tcx.backend_optimization_level(()); - let tm_factory = backend.target_machine_factory(tcx.sess, opt_level); + let tm_factory = backend.target_machine_factory(tcx.sess); let remark_dir = if let Some(ref dir) = sess.opts.unstable_opts.remark_dir { let result = fs::create_dir_all(dir).and_then(|_| dir.canonicalize()); @@ -1271,7 +1269,6 @@ fn start_executing_work( remark_dir, output_filenames: Arc::clone(tcx.output_filenames(())), module_config: regular_config, - opt_level, msvc_imps_needed: msvc_imps_needed(tcx), is_pe_coff: tcx.sess.target.is_like_windows, target_can_use_split_dwarf: tcx.sess.target_can_use_split_dwarf(), @@ -2147,7 +2144,7 @@ impl OngoingCodegen { (compiled_modules, work_products) } MaybeLtoModules::FatLto { cgcx, needs_fat_lto } => { - let tm_factory = self.backend.target_machine_factory(sess, cgcx.opt_level); + let tm_factory = self.backend.target_machine_factory(sess); // FIXME cache local pre-LTO bitcode let work_products = WorkProductMap::default(); @@ -2168,7 +2165,7 @@ impl OngoingCodegen { (compiled_modules, work_products) } MaybeLtoModules::ThinLto { cgcx, needs_thin_lto } => { - let tm_factory = self.backend.target_machine_factory(sess, cgcx.opt_level); + let tm_factory = self.backend.target_machine_factory(sess); let compiled_modules = CompiledModules { modules: do_thin_lto::( diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index ae35dcfe42e60..4361e192972f4 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -11,14 +11,13 @@ use rustc_ast::expand::allocator::{ }; use rustc_attr_ir::lang_items::LangItem; use rustc_attr_ir::target::Target; -use rustc_attr_ir::{DebuggerVisualizerType, EiiDecl, EiiImpl, OptimizeAttr, find_attr}; +use rustc_attr_ir::{DebuggerVisualizerType, EiiDecl, EiiImpl, find_attr}; use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry}; use rustc_data_structures::sync::{IntoDynSyncSend, par_map}; use rustc_data_structures::unord::UnordMap; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; -use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs; use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile; use rustc_middle::middle::dependency_format::{Dependencies, Linkage}; use rustc_middle::middle::exported_symbols::{self, SymbolExportKind}; @@ -26,7 +25,6 @@ use rustc_middle::middle::lang_items; use rustc_middle::mir::interpret::{CTFE_ALLOC_SALT, ErrorHandled, Scalar}; use rustc_middle::mir::{BinOp, ConstValue}; use rustc_middle::mono::{CodegenUnit, CodegenUnitNameBuilder, MonoItem, MonoItemPartitions}; -use rustc_middle::query::Providers; use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, LayoutOf, TyAndLayout}; use rustc_middle::ty::{self, Instance, PatternKind, Ty, TyCtxt, UintTy, Unnormalized}; use rustc_session::config::{self, EntryFnType, JobsMode}; @@ -1217,30 +1215,6 @@ impl CrateInfo { } } -pub(crate) fn provide(providers: &mut Providers) { - providers.backend_optimization_level = |tcx, cratenum| { - let global = tcx.sess.opts.optimize; - - // Nothing to promote outside a size build. At `-Copt-level=0` the upgrade would populate - // the pass manager, and its module-wide passes ignore the `optnone` annotation. - if global.objective() != config::OptimizationObjective::Size { - return global; - } - - // A speed-marked body in a size build needs a speed level, and `-O2` is the lowest one. - let for_speed = config::OptLevel::More; - - let defids = tcx.collect_and_partition_mono_items(cratenum).all_mono_items; - - let any_for_speed = defids.items().any(|id| { - let CodegenFnAttrs { optimize, .. } = tcx.codegen_fn_attrs(*id); - matches!(optimize, OptimizeAttr::Speed) - }); - - if any_for_speed { for_speed } else { global } - }; -} - pub fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx>, cgu: &CodegenUnit<'tcx>) -> CguReuse { if !tcx.dep_graph.is_fully_enabled() || tcx.sess.opts.unstable_opts.disable_incr_comp_backend_caching diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index 1ac9564db0149..d19b80897a21d 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -326,7 +326,6 @@ pub enum CodegenError { pub fn provide(providers: &mut Providers) { crate::back::symbol_export::provide(providers); - crate::base::provide(&mut providers.queries); crate::target_features::provide(&mut providers.queries); crate::codegen_attrs::provide(&mut providers.queries); } diff --git a/compiler/rustc_codegen_ssa/src/traits/write.rs b/compiler/rustc_codegen_ssa/src/traits/write.rs index 36bc0a68d882e..1576c438f54ae 100644 --- a/compiler/rustc_codegen_ssa/src/traits/write.rs +++ b/compiler/rustc_codegen_ssa/src/traits/write.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_errors::DiagCtxtHandle; use rustc_middle::dep_graph::WorkProduct; -use rustc_session::{BorrowedIncrCompSession, Session, config}; +use rustc_session::{BorrowedIncrCompSession, Session}; use crate::back::lto::ThinModule; use crate::back::write::{ @@ -28,11 +28,7 @@ pub trait WriteBackendMethods: Clone + 'static { fn thread_profiler() -> Box { Box::new(()) } - fn target_machine_factory( - &self, - sess: &Session, - opt_level: config::OptLevel, - ) -> TargetMachineFactoryFn; + fn target_machine_factory(&self, sess: &Session) -> TargetMachineFactoryFn; /// Performs fat LTO by merging all modules into a single one, running autodiff /// if necessary and running any further optimizations fn optimize_and_codegen_fat_lto( diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index 7442daa296f03..9b58174f58ebe 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -74,7 +74,7 @@ use rustc_lint_defs::{LintId, StableLintExpectationId}; use rustc_macros::rustc_queries; use rustc_middle::middle::resolve::TypeRelativeDelegationRes; use rustc_session::Limits; -use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion}; +use rustc_session::config::{EntryFnType, OutputFilenames, SymbolManglingVersion}; use rustc_span::def_id::{LOCAL_CRATE, ModId}; use rustc_span::{DUMMY_SP, LocalExpnId, Span, Spanned, Symbol}; use rustc_target::spec::PanicStrategy; @@ -2488,10 +2488,6 @@ rustc_queries! { desc { "getting codegen unit `{sym}`" } } - query backend_optimization_level(_: ()) -> OptLevel { - desc { "optimization level used by backend" } - } - /// Return the filenames where output artefacts shall be stored. /// /// This query returns an `&Arc` because codegen backends need the value even after the `TyCtxt` From 117c51759e5761e750a3780f79cec572eda312ea Mon Sep 17 00:00:00 2001 From: Shun Sakai Date: Tue, 10 Nov 2026 11:35:44 +0900 Subject: [PATCH 29/34] docs(num): remove needless whitespaces --- library/core/src/num/int_macros.rs | 2 +- library/core/src/num/uint_macros.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index fb86481c42443..80bc32b2f6858 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -507,7 +507,7 @@ macro_rules! int_impl { } /// Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, - /// second least-significant bit becomes second most-significant bit, etc. + /// second least-significant bit becomes second most-significant bit, etc. /// /// # Examples /// diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index e202621673604..3ee925bd2e905 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -881,7 +881,7 @@ macro_rules! uint_impl { } /// Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, - /// second least-significant bit becomes second most-significant bit, etc. + /// second least-significant bit becomes second most-significant bit, etc. /// /// # Examples /// From 2fa016a961681fa7d59e15f516b371fdb211b401 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Mon, 9 Nov 2026 12:24:38 +0100 Subject: [PATCH 30/34] Remove parsed arm of `check_attr` --- .../rustc_attr_parsing/src/validate_attr.rs | 37 ++++--------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/validate_attr.rs b/compiler/rustc_attr_parsing/src/validate_attr.rs index 74cc6690d54cf..1b0cb8657015f 100644 --- a/compiler/rustc_attr_parsing/src/validate_attr.rs +++ b/compiler/rustc_attr_parsing/src/validate_attr.rs @@ -30,41 +30,20 @@ pub fn check_attr(psess: &ParseSess, attr: &Attribute) { | AttrKind::Generated(..) => return, } - let builtin_attr_info = attr.name().and_then(|name| BUILTIN_ATTRIBUTE_SET.get(&name)); + // Parsed attributes are validated during attribute parsing + if AttributeParser::is_parsed_attribute(&attr.path()) { + return; + } - // Check input tokens for built-in and key-value attributes. - if let Some(name) = builtin_attr_info { - if AttributeParser::is_parsed_attribute(slice::from_ref(name)) { - return; - } + let attr_item = attr.get_normal_item(); + if let AttrArgs::Eq { .. } = attr_item.args { + // All key-value attributes are restricted to meta-item syntax. match parse_meta(psess, attr) { - // Don't check safety again, we just did that - Ok(meta) => { - // FIXME The only unparsed builtin attributes that are left are the lint attributes, so we can hardcode the template here - let lint_attrs = [sym::forbid, sym::allow, sym::warn, sym::deny, sym::expect]; - assert!(lint_attrs.contains(name)); - - let template = template!( - List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#], - "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes" - ); - check_builtin_meta_item(psess, &meta, attr.style, *name, template, false) - } + Ok(_) => {} Err(err) => { err.emit(); } } - } else { - let attr_item = attr.get_normal_item(); - if let AttrArgs::Eq { .. } = attr_item.args { - // All key-value attributes are restricted to meta-item syntax. - match parse_meta(psess, attr) { - Ok(_) => {} - Err(err) => { - err.emit(); - } - } - } } } From 6fd528c98200347a54cc5a73b13909531ee75440 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Mon, 9 Nov 2026 12:58:11 +0100 Subject: [PATCH 31/34] Move `check_attr` to attribute parsing --- .../rustc_ast_passes/src/ast_validation.rs | 5 ---- compiler/rustc_attr_parsing/src/interface.rs | 16 +++++++++- .../rustc_attr_parsing/src/validate_attr.rs | 30 +------------------ compiler/rustc_expand/src/expand.rs | 1 - tests/ui/attributes/issue-90873.stderr | 24 +++++++-------- .../key-value-nested-attr-fail.stderr | 24 +++++++-------- .../ui/attributes/unused-item-in-attr.stderr | 12 ++++---- tests/ui/consts/issue-90878-2.stderr | 12 ++++---- 8 files changed, 52 insertions(+), 72 deletions(-) diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index a6e88f21ba74f..88816587ae3b4 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -25,7 +25,6 @@ use rustc_abi::{CVariadicStatus, CanonAbi, ExternAbi, InterruptKind}; use rustc_ast::visit::{AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, walk_list}; use rustc_ast::*; use rustc_ast_pretty::pprust::{self, State}; -use rustc_attr_parsing::validate_attr; use rustc_data_structures::fx::FxIndexMap; use rustc_errors::{DiagCtxtHandle, Diagnostic, LintBuffer}; use rustc_feature::Features; @@ -1402,10 +1401,6 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara } impl Visitor<'_> for AstValidator<'_> { - fn visit_attribute(&mut self, attr: &Attribute) { - validate_attr::check_attr(&self.sess.psess, attr); - } - fn visit_ty(&mut self, ty: &Ty) { self.visit_ty_common(ty); self.walk_ty(ty) diff --git a/compiler/rustc_attr_parsing/src/interface.rs b/compiler/rustc_attr_parsing/src/interface.rs index a4cf7b9342dd5..9bd489a5aea8f 100644 --- a/compiler/rustc_attr_parsing/src/interface.rs +++ b/compiler/rustc_attr_parsing/src/interface.rs @@ -23,6 +23,7 @@ use crate::diagnostics::ParsedDescription; use crate::generated::GeneratedAttrState; use crate::parser::{AllowExprMetavar, ArgParser, PathParser, RefPathParser}; use crate::synthetic::SyntheticAttrState; +use crate::validate_attr::parse_meta; use crate::{AttributeTemplate, ShouldEmit, diagnostics}; pub struct EmitAttribute( @@ -359,7 +360,8 @@ impl<'sess> AttributeParser<'sess> { n.item.path.segments.iter().map(|seg| seg.ident.name).collect::>(); let inner_span = lower_span(n.item.span); - if let Some(accept) = ATTRIBUTE_PARSERS.accepters.get(parts.as_slice()) { + let accepter = ATTRIBUTE_PARSERS.accepters.get(parts.as_slice()); + if let Some(accept) = accepter { self.check_attribute_safety( &attr_path, inner_span, @@ -492,6 +494,18 @@ impl<'sess> AttributeParser<'sess> { attributes.push(attr); }; + + if accepter.is_none() + && let rustc_ast::AttrArgs::Eq { .. } = n.item.args + { + // All key-value attributes are restricted to meta-item syntax. + match parse_meta(&self.sess.psess, &attr) { + Ok(_) => {} + Err(err) => { + err.emit(); + } + } + } } } } diff --git a/compiler/rustc_attr_parsing/src/validate_attr.rs b/compiler/rustc_attr_parsing/src/validate_attr.rs index 1b0cb8657015f..9dd67bb0dd24c 100644 --- a/compiler/rustc_attr_parsing/src/validate_attr.rs +++ b/compiler/rustc_attr_parsing/src/validate_attr.rs @@ -1,7 +1,6 @@ //! Meta-syntax validation logic of attributes for post-expansion. use std::convert::identity; -use std::slice; use rustc_ast::SyntheticAttr::CfgAttrTrace; use rustc_ast::token::Delimiter; @@ -12,40 +11,13 @@ use rustc_ast::{ }; use rustc_attr_ir::AttrPath; use rustc_errors::{Applicability, Diagnostic, PResult}; -use rustc_feature::BUILTIN_ATTRIBUTE_SET; use rustc_lint_defs::builtin::ILL_FORMED_ATTRIBUTE_INPUT; use rustc_parse::parse_in; use rustc_session::diagnostics::report_lit_error; use rustc_session::parse::ParseSess; use rustc_span::{Span, Symbol, sym}; -use crate::{AttributeParser, AttributeTemplate, diagnostics as errors, template}; - -pub fn check_attr(psess: &ParseSess, attr: &Attribute) { - use ast::SyntheticAttr::*; - match &attr.kind { - AttrKind::Normal(_) => {} - AttrKind::Synthetic(CfgTrace(_) | CfgAttrTrace(_)) - | AttrKind::DocComment(..) - | AttrKind::Generated(..) => return, - } - - // Parsed attributes are validated during attribute parsing - if AttributeParser::is_parsed_attribute(&attr.path()) { - return; - } - - let attr_item = attr.get_normal_item(); - if let AttrArgs::Eq { .. } = attr_item.args { - // All key-value attributes are restricted to meta-item syntax. - match parse_meta(psess, attr) { - Ok(_) => {} - Err(err) => { - err.emit(); - } - } - } -} +use crate::{AttributeTemplate, diagnostics as errors}; pub fn parse_meta<'a>(psess: &'a ParseSess, attr: &Attribute) -> PResult<'a, MetaItem> { let item = attr.get_normal_item(); diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index b9c1bb9545d2f..af1e4be5e8399 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -2235,7 +2235,6 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { let mut attrs = attrs.iter().peekable(); let mut span: Option = None; while let Some(attr) = attrs.next() { - validate_attr::check_attr(&self.cx.sess.psess, attr); AttributeParser::parse_limited_all( self.cx.sess, slice::from_ref(attr), diff --git a/tests/ui/attributes/issue-90873.stderr b/tests/ui/attributes/issue-90873.stderr index 444497538e8dc..afe36156f0e3a 100644 --- a/tests/ui/attributes/issue-90873.stderr +++ b/tests/ui/attributes/issue-90873.stderr @@ -1,15 +1,3 @@ -error: attribute value must be a literal - --> $DIR/issue-90873.rs:1:6 - | -LL | #![u=||{static d=||1;}] - | ^^^^^^^^^^^^^^^^^ - -error: attribute value must be a literal - --> $DIR/issue-90873.rs:6:6 - | -LL | #![a={impl std::ops::Neg for i8 {}}] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: cannot find attribute `u` in this scope --> $DIR/issue-90873.rs:1:4 | @@ -22,6 +10,18 @@ error: cannot find attribute `a` in this scope LL | #![a={impl std::ops::Neg for i8 {}}] | ^ +error: attribute value must be a literal + --> $DIR/issue-90873.rs:1:6 + | +LL | #![u=||{static d=||1;}] + | ^^^^^^^^^^^^^^^^^ + +error: attribute value must be a literal + --> $DIR/issue-90873.rs:6:6 + | +LL | #![a={impl std::ops::Neg for i8 {}}] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0601]: `main` function not found in crate `issue_90873` --> $DIR/issue-90873.rs:6:37 | diff --git a/tests/ui/attributes/key-value-nested-attr-fail.stderr b/tests/ui/attributes/key-value-nested-attr-fail.stderr index d01fd85b70489..468e95a113ef5 100644 --- a/tests/ui/attributes/key-value-nested-attr-fail.stderr +++ b/tests/ui/attributes/key-value-nested-attr-fail.stderr @@ -16,18 +16,6 @@ error: `cfg` is not supported in this position LL | #[clippy::insubstantial = #[cfg(true)] "insignificant"] | ^^^^^^^^^^^^ -error: this attribute is not allowed in this context - --> $DIR/key-value-nested-attr-fail.rs:51:24 - | -LL | #[clippy::immaterial = #[allow(dead_code)] "incorporeal"] - | ^^^^^^^^^^^^^^^^^^^ - -error: this attribute is not allowed in this context - --> $DIR/key-value-nested-attr-fail.rs:59:9 - | -LL | #[arg = #[allow(dead_code)] 0] - | ^^^^^^^^^^^^^^^^^^^ - error: this attribute is not allowed in this context --> $DIR/key-value-nested-attr-fail.rs:17:10 | @@ -61,6 +49,18 @@ error: this attribute is not allowed in this context LL | repr(Rust) | ^^^^^^^^^^ +error: this attribute is not allowed in this context + --> $DIR/key-value-nested-attr-fail.rs:51:24 + | +LL | #[clippy::immaterial = #[allow(dead_code)] "incorporeal"] + | ^^^^^^^^^^^^^^^^^^^ + +error: this attribute is not allowed in this context + --> $DIR/key-value-nested-attr-fail.rs:59:9 + | +LL | #[arg = #[allow(dead_code)] 0] + | ^^^^^^^^^^^^^^^^^^^ + error: attribute value must be a literal --> $DIR/key-value-nested-attr-fail.rs:65:25 | diff --git a/tests/ui/attributes/unused-item-in-attr.stderr b/tests/ui/attributes/unused-item-in-attr.stderr index 84130965d31cf..1d4437647d3cc 100644 --- a/tests/ui/attributes/unused-item-in-attr.stderr +++ b/tests/ui/attributes/unused-item-in-attr.stderr @@ -1,14 +1,14 @@ -error: attribute value must be a literal - --> $DIR/unused-item-in-attr.rs:1:7 - | -LL | #[w = { extern crate alloc; }] - | ^^^^^^^^^^^^^^^^^^^^^^^ - error: cannot find attribute `w` in this scope --> $DIR/unused-item-in-attr.rs:1:3 | LL | #[w = { extern crate alloc; }] | ^ +error: attribute value must be a literal + --> $DIR/unused-item-in-attr.rs:1:7 + | +LL | #[w = { extern crate alloc; }] + | ^^^^^^^^^^^^^^^^^^^^^^^ + error: aborting due to 2 previous errors diff --git a/tests/ui/consts/issue-90878-2.stderr b/tests/ui/consts/issue-90878-2.stderr index 0b332840042ef..f5991ef9bcf7b 100644 --- a/tests/ui/consts/issue-90878-2.stderr +++ b/tests/ui/consts/issue-90878-2.stderr @@ -1,14 +1,14 @@ -error: attribute value must be a literal - --> $DIR/issue-90878-2.rs:1:7 - | -LL | #![l=|x|[b;x ]] - | ^^^^^^^^^ - error: cannot find attribute `l` in this scope --> $DIR/issue-90878-2.rs:1:5 | LL | #![l=|x|[b;x ]] | ^ +error: attribute value must be a literal + --> $DIR/issue-90878-2.rs:1:7 + | +LL | #![l=|x|[b;x ]] + | ^^^^^^^^^ + error: aborting due to 2 previous errors From 0a179cceeaa018512a43b369e91ffce586e62c83 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Mon, 9 Nov 2026 12:58:27 +0100 Subject: [PATCH 32/34] Add test checking that the behaviour for diagnostic attrs is preserved --- tests/ui/diagnostic_namespace/invalid_lit.rs | 8 +++++++ .../diagnostic_namespace/invalid_lit.stderr | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/ui/diagnostic_namespace/invalid_lit.rs create mode 100644 tests/ui/diagnostic_namespace/invalid_lit.stderr diff --git a/tests/ui/diagnostic_namespace/invalid_lit.rs b/tests/ui/diagnostic_namespace/invalid_lit.rs new file mode 100644 index 0000000000000..2198258fa498a --- /dev/null +++ b/tests/ui/diagnostic_namespace/invalid_lit.rs @@ -0,0 +1,8 @@ +#[diagnostic::on_unimplemented = 1 + 1] +//~^ ERROR attribute value must be a literal +#[diagnostic::not_exist = 1 + 1] +//~^ ERROR attribute value must be a literal +//~| WARN unknown diagnostic attribute +fn main() { + +} diff --git a/tests/ui/diagnostic_namespace/invalid_lit.stderr b/tests/ui/diagnostic_namespace/invalid_lit.stderr new file mode 100644 index 0000000000000..5659d4f56b02f --- /dev/null +++ b/tests/ui/diagnostic_namespace/invalid_lit.stderr @@ -0,0 +1,22 @@ +error: attribute value must be a literal + --> $DIR/invalid_lit.rs:1:34 + | +LL | #[diagnostic::on_unimplemented = 1 + 1] + | ^^^^^ + +error: attribute value must be a literal + --> $DIR/invalid_lit.rs:3:27 + | +LL | #[diagnostic::not_exist = 1 + 1] + | ^^^^^ + +warning: unknown diagnostic attribute + --> $DIR/invalid_lit.rs:3:15 + | +LL | #[diagnostic::not_exist = 1 + 1] + | ^^^^^^^^^ + | + = note: `#[warn(unknown_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default + +error: aborting due to 2 previous errors; 1 warning emitted + From eaf2a71851f539f9cea949006cbd72b62308d949 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 19 Oct 2026 09:33:01 +0200 Subject: [PATCH 33/34] fs::Dir tests: ensure remove and rename do not follow symlinks --- library/std/src/fs/tests.rs | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index 605ad25270a63..15b81210928d4 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -3250,6 +3250,14 @@ fn test_dir_remove_file() { check!(f.flush()); drop(f); let dir = check!(Dir::open(tmpdir.path())); + + if got_symlink_permission(&tmpdir) { + // Removing a symlink should remove the link, not the destination. + check!(symlink_file("foo.txt", &tmpdir.join("link"))); + check!(dir.remove_file("link")); + assert!(check!(dir.metadata("foo.txt")).is_file()); // file still exists + } + check!(dir.remove_file("foo.txt")); assert!(!matches!(exists(tmpdir.join("foo.txt")), Ok(true))); } @@ -3266,6 +3274,14 @@ fn test_dir_rename_file() { let mut buf = [0u8; 3]; check!(f.read_exact(&mut buf)); assert_eq!(b"bar", &buf); + + // Renaming a symlink should rename the link, not the destination. + if got_symlink_permission(&tmpdir) { + check!(symlink_file("baz.txt", &tmpdir.join("link"))); + check!(dir.rename("link", &dir, "link-renamed")); + assert!(check!(dir.symlink_metadata("baz.txt")).is_file()); // file still exists + assert!(check!(dir.symlink_metadata("link-renamed")).is_symlink()); // symlink has new name + } } // FIXME: re-enable once QNX fixes TOCTOU bug for fs::remove_dir @@ -3277,6 +3293,21 @@ fn test_dir_remove_dir() { let tmpdir = tmpdir(); check!(fs::create_dir(tmpdir.join("foo"))); let dir = check!(Dir::open(tmpdir.path())); + + if got_symlink_permission(&tmpdir) { + // Removing a symlink should remove the link, not the destination. + check!(symlink_dir("foo", &tmpdir.join("link"))); + if cfg!(windows) { + // directory symlinks need `remove_dir` on Windows + dir.remove_file("link").unwrap_err(); + check!(dir.remove_dir("link")); + } else { + dir.remove_dir("link").unwrap_err(); + check!(dir.remove_file("link")); + } + assert!(check!(dir.metadata("foo")).is_dir()); // dir still exists + } + check!(dir.remove_dir("foo")); assert!(!matches!(exists(tmpdir.join("foo")), Ok(true))); } @@ -3289,6 +3320,14 @@ fn test_dir_rename_dir() { check!(dir.rename("foo", &dir, "baz")); let m = check!(tmpdir.join("baz").metadata()); assert!(m.is_dir()); + + // Renaming a symlink should rename the link, not the destination. + if got_symlink_permission(&tmpdir) { + check!(symlink_dir("baz", &tmpdir.join("link"))); + check!(dir.rename("link", &dir, "link-renamed")); + assert!(check!(dir.symlink_metadata("baz")).is_dir()); // dir still exists + assert!(check!(dir.symlink_metadata("link-renamed")).is_symlink()); // symlink has new name + } } #[test] From 811ebf70afd33068a39de321b79d2854e8c80a26 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 19 Oct 2026 09:35:35 +0200 Subject: [PATCH 34/34] windows: fix Dir::{remove_*,rename} symlink behavior --- library/std/src/sys/fs/windows/dir.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/std/src/sys/fs/windows/dir.rs b/library/std/src/sys/fs/windows/dir.rs index 60f8c2522de26..4a6ea4f20f19d 100644 --- a/library/std/src/sys/fs/windows/dir.rs +++ b/library/std/src/sys/fs/windows/dir.rs @@ -157,7 +157,8 @@ impl Dir { fn remove_native(&self, path: &[u16], dir: bool) -> io::Result<()> { let mut opts = OpenOptions::new(); opts.access_mode(c::DELETE); - let create_opt = if dir { c::FILE_DIRECTORY_FILE } else { c::FILE_NON_DIRECTORY_FILE }; + let mut create_opt = if dir { c::FILE_DIRECTORY_FILE } else { c::FILE_NON_DIRECTORY_FILE }; + create_opt |= c::FILE_OPEN_REPARSE_POINT; let handle = self.open_file_native(path, &opts, create_opt)?; File::from_inner(handle).delete().io_result() } @@ -165,9 +166,8 @@ impl Dir { fn rename_native(&self, from: &[u16], to_dir: &Self, to: &[u16]) -> io::Result<()> { let mut opts = OpenOptions::new(); opts.access_mode(c::DELETE); - // FIXME: custom_flags is ignored by `open_file_native`! - opts.custom_flags(c::FILE_FLAG_OPEN_REPARSE_POINT | c::FILE_FLAG_BACKUP_SEMANTICS); - let handle = self.open_file_native(from, &opts, /* create_opt */ 0)?; + let handle = + self.open_file_native(from, &opts, /* create_opt */ c::FILE_OPEN_REPARSE_POINT)?; // Calculate the layout of the `FILE_RENAME_INFORMATION` we pass to `NtSetInformationFile` // This is a dynamically sized struct so we need to get the position of the last field to calculate the actual size. const too_long_err: io::Error =