diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs index 64aa7a66b0191..0d328d5cc6a70 100644 --- a/compiler/rustc_attr_parsing/src/attributes/mod.rs +++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs @@ -58,6 +58,7 @@ pub(crate) mod pin_v2; pub(crate) mod proc_macro_attrs; pub(crate) mod prototype; pub(crate) mod repr; +pub(crate) mod rustc_allocator; pub(crate) mod rustc_dump; pub(crate) mod rustc_internal; pub(crate) mod semantics; diff --git a/compiler/rustc_attr_parsing/src/attributes/rustc_allocator.rs b/compiler/rustc_attr_parsing/src/attributes/rustc_allocator.rs new file mode 100644 index 0000000000000..5782f9473a994 --- /dev/null +++ b/compiler/rustc_attr_parsing/src/attributes/rustc_allocator.rs @@ -0,0 +1,60 @@ +use super::prelude::*; + +pub(crate) struct RustcAllocatorParser; + +impl NoArgsAttributeParser for RustcAllocatorParser { + const PATH: &[Symbol] = &[sym::rustc_allocator]; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; + const ALLOWED_TARGETS: AllowedTargets = + AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]); + const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcAllocator; +} + +pub(crate) struct RustcAllocatorZeroedParser; + +impl NoArgsAttributeParser for RustcAllocatorZeroedParser { + const PATH: &[Symbol] = &[sym::rustc_allocator_zeroed]; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; + const ALLOWED_TARGETS: AllowedTargets = + AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]); + const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcAllocatorZeroed; +} + +pub(crate) struct RustcAllocatorZeroedVariantParser; + +impl SingleAttributeParser for RustcAllocatorZeroedVariantParser { + const PATH: &[Symbol] = &[sym::rustc_allocator_zeroed_variant]; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; + const ALLOWED_TARGETS: AllowedTargets = + AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]); + const TEMPLATE: AttributeTemplate = template!(NameValueStr: "function"); + const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost; + fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option { + let Some(name) = args.name_value().and_then(NameValueParser::value_as_str) else { + cx.expected_name_value(cx.attr_span, None); + return None; + }; + + Some(AttributeKind::RustcAllocatorZeroedVariant { name }) + } +} + +pub(crate) struct RustcDeallocatorParser; + +impl NoArgsAttributeParser for RustcDeallocatorParser { + const PATH: &[Symbol] = &[sym::rustc_deallocator]; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; + const ALLOWED_TARGETS: AllowedTargets = + AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]); + const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDeallocator; +} + +pub(crate) struct RustcReallocatorParser; + +impl NoArgsAttributeParser for RustcReallocatorParser { + const PATH: &[Symbol] = &[sym::rustc_reallocator]; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; + const ALLOWED_TARGETS: AllowedTargets = + AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]); + const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcReallocator; +} diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index 449894f7834bc..7c0182c7e063f 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -64,6 +64,10 @@ use crate::attributes::proc_macro_attrs::{ }; use crate::attributes::prototype::CustomMirParser; use crate::attributes::repr::{AlignParser, AlignStaticParser, ReprParser}; +use crate::attributes::rustc_allocator::{ + RustcAllocatorParser, RustcAllocatorZeroedParser, RustcAllocatorZeroedVariantParser, + RustcDeallocatorParser, RustcReallocatorParser, +}; use crate::attributes::rustc_dump::{ RustcDumpDefParents, RustcDumpItemBounds, RustcDumpPredicates, RustcDumpUserArgs, RustcDumpVtable, @@ -223,6 +227,7 @@ attribute_parsers!( Single, Single, Single, + Single, Single, Single, Single, @@ -273,7 +278,10 @@ attribute_parsers!( Single>, Single>, Single>, + Single>, + Single>, Single>, + Single>, Single>, Single>, Single>, @@ -288,6 +296,7 @@ attribute_parsers!( Single>, Single>, Single>, + Single>, Single>, Single>, Single>, diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index a25ce9e5a90ac..28e91a25a21a0 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -1,6 +1,7 @@ //! Set and unset common attributes on LLVM values. use rustc_hir::attrs::{InlineAttr, InstructionSetAttr, OptimizeAttr, RtsanSetting}; use rustc_hir::def_id::DefId; +use rustc_hir::find_attr; use rustc_middle::middle::codegen_fn_attrs::{ CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry, SanitizerFnAttrs, }; @@ -470,9 +471,7 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>( { to_add.push(create_alloc_family_attr(cx.llcx)); if let Some(instance) = instance - && let Some(zv) = - tcx.get_attr(instance.def_id(), rustc_span::sym::rustc_allocator_zeroed_variant) - && let Some(name) = zv.value_str() + && let Some(name) = find_attr!(tcx.get_all_attrs(instance.def_id()), rustc_hir::attrs::AttributeKind::RustcAllocatorZeroedVariant {name} => name) { to_add.push(llvm::CreateAttrStringValue( cx.llcx, diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index fa02c5c51f7c1..1b0427e7e6766 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -335,6 +335,18 @@ fn process_builtin_attrs( AttributeKind::InstructionSet(instruction_set) => { codegen_fn_attrs.instruction_set = Some(*instruction_set) } + AttributeKind::RustcAllocator => { + codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR + } + AttributeKind::RustcDeallocator => { + codegen_fn_attrs.flags |= CodegenFnAttrFlags::DEALLOCATOR + } + AttributeKind::RustcReallocator => { + codegen_fn_attrs.flags |= CodegenFnAttrFlags::REALLOCATOR + } + AttributeKind::RustcAllocatorZeroed => { + codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR_ZEROED + } _ => {} } } @@ -344,13 +356,7 @@ fn process_builtin_attrs( }; match name { - sym::rustc_allocator => codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR, sym::rustc_nounwind => codegen_fn_attrs.flags |= CodegenFnAttrFlags::NEVER_UNWIND, - sym::rustc_reallocator => codegen_fn_attrs.flags |= CodegenFnAttrFlags::REALLOCATOR, - sym::rustc_deallocator => codegen_fn_attrs.flags |= CodegenFnAttrFlags::DEALLOCATOR, - sym::rustc_allocator_zeroed => { - codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR_ZEROED - } sym::patchable_function_entry => { codegen_fn_attrs.patchable_function_entry = parse_patchable_function_entry(tcx, attr); diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index 7b7fae9fdcca8..eff871cb8bb46 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -906,12 +906,24 @@ pub enum AttributeKind { /// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations). Repr { reprs: ThinVec<(ReprAttr, Span)>, first_span: Span }, + /// Represents `#[rustc_allocator]` + RustcAllocator, + + /// Represents `#[rustc_allocator_zeroed]` + RustcAllocatorZeroed, + + /// Represents `#[rustc_allocator_zeroed_variant]` + RustcAllocatorZeroedVariant { name: Symbol }, + /// Represents `#[rustc_builtin_macro]`. RustcBuiltinMacro { builtin_name: Option, helper_attrs: ThinVec, span: Span }, /// Represents `#[rustc_coherence_is_core]` RustcCoherenceIsCore(Span), + /// Represents `#[rustc_deallocator]` + RustcDeallocator, + /// Represents `#[rustc_dump_def_parents]` RustcDumpDefParents, @@ -972,6 +984,9 @@ pub enum AttributeKind { /// Represents `#[rustc_pass_indirectly_in_non_rustic_abis]` RustcPassIndirectlyInNonRusticAbis(Span), + /// Represents `#[rustc_reallocator]` + RustcReallocator, + /// Represents `#[rustc_scalable_vector(N)]` RustcScalableVector { /// The base multiple of lanes that are in a scalable vector, if provided. `element_count` diff --git a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs index dff8a57277714..28b41ac709256 100644 --- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs +++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs @@ -97,8 +97,12 @@ impl AttributeKind { PubTransparent(..) => Yes, RecursionLimit { .. } => No, Repr { .. } => No, + RustcAllocator => No, + RustcAllocatorZeroed => No, + RustcAllocatorZeroedVariant { .. } => Yes, RustcBuiltinMacro { .. } => Yes, RustcCoherenceIsCore(..) => No, + RustcDeallocator => No, RustcDumpDefParents => No, RustcDumpItemBounds => No, RustcDumpPredicates => No, @@ -119,6 +123,7 @@ impl AttributeKind { RustcNoImplicitAutorefs => Yes, RustcObjectLifetimeDefault => No, RustcPassIndirectlyInNonRusticAbis(..) => No, + RustcReallocator => No, RustcScalableVector { .. } => Yes, RustcShouldNotBeCalledOnConstItems(..) => Yes, RustcSimdMonomorphizeLaneLimit(..) => Yes, // Affects layout computation, which needs to work cross-crate diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 4b71d4755cb6c..1e723dd6b4647 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -316,6 +316,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> { | AttributeKind::RustcDumpDefParents | AttributeKind::RustcDumpVtable(..) | AttributeKind::NeedsAllocator + | AttributeKind::RustcAllocator + | AttributeKind::RustcAllocatorZeroed + | AttributeKind::RustcAllocatorZeroedVariant { .. } + | AttributeKind::RustcDeallocator + | AttributeKind::RustcReallocator ) => { /* do nothing */ } Attribute::Unparsed(attr_item) => { style = Some(attr_item.style); @@ -360,12 +365,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { | sym::rustc_do_not_const_check | sym::rustc_reservation_impl | sym::rustc_doc_primitive - | sym::rustc_allocator - | sym::rustc_deallocator - | sym::rustc_reallocator | sym::rustc_conversion_suggestion - | sym::rustc_allocator_zeroed - | sym::rustc_allocator_zeroed_variant | sym::rustc_deprecated_safe_2024 | sym::rustc_test_marker | sym::rustc_abi diff --git a/library/std/src/sys/thread/unix.rs b/library/std/src/sys/thread/unix.rs index 6f23c28c04d6a..5a210703ce9b7 100644 --- a/library/std/src/sys/thread/unix.rs +++ b/library/std/src/sys/thread/unix.rs @@ -49,7 +49,7 @@ impl Thread { // WASI does not support threading via pthreads. While wasi-libc provides // pthread stubs, pthread_create returns EAGAIN, which causes confusing // errors. We return UNSUPPORTED_PLATFORM directly instead. - if cfg!(target_os = "wasi") { + if cfg!(all(target_os = "wasi", not(target_feature = "atomics"))) { return Err(io::Error::UNSUPPORTED_PLATFORM); } diff --git a/tests/ui/issues/issue-38919.rs b/tests/ui/associated-types/associated-type-as-value.rs similarity index 57% rename from tests/ui/issues/issue-38919.rs rename to tests/ui/associated-types/associated-type-as-value.rs index 3d28f1936b47f..ddc8082366584 100644 --- a/tests/ui/issues/issue-38919.rs +++ b/tests/ui/associated-types/associated-type-as-value.rs @@ -1,3 +1,5 @@ +//! regression test for + fn foo() { T::Item; //~ ERROR no associated item named `Item` found } diff --git a/tests/ui/issues/issue-38919.stderr b/tests/ui/associated-types/associated-type-as-value.stderr similarity index 89% rename from tests/ui/issues/issue-38919.stderr rename to tests/ui/associated-types/associated-type-as-value.stderr index 4a4bd2ee43d8d..c553582b39077 100644 --- a/tests/ui/issues/issue-38919.stderr +++ b/tests/ui/associated-types/associated-type-as-value.stderr @@ -1,5 +1,5 @@ error[E0599]: no associated item named `Item` found for type parameter `T` in the current scope - --> $DIR/issue-38919.rs:2:8 + --> $DIR/associated-type-as-value.rs:4:8 | LL | fn foo() { | - associated item `Item` not found for this type parameter diff --git a/tests/ui/issues/issue-17441.rs b/tests/ui/cast/cast-to-unsized-type.rs similarity index 86% rename from tests/ui/issues/issue-17441.rs rename to tests/ui/cast/cast-to-unsized-type.rs index e5f83c4ebadd8..4c7ca49fd98d0 100644 --- a/tests/ui/issues/issue-17441.rs +++ b/tests/ui/cast/cast-to-unsized-type.rs @@ -1,3 +1,5 @@ +//! regression test for + fn main() { let _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` diff --git a/tests/ui/issues/issue-17441.stderr b/tests/ui/cast/cast-to-unsized-type.stderr similarity index 85% rename from tests/ui/issues/issue-17441.stderr rename to tests/ui/cast/cast-to-unsized-type.stderr index 96aad879e24d2..087cfac774847 100644 --- a/tests/ui/issues/issue-17441.stderr +++ b/tests/ui/cast/cast-to-unsized-type.stderr @@ -1,5 +1,5 @@ error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` - --> $DIR/issue-17441.rs:2:16 + --> $DIR/cast-to-unsized-type.rs:4:16 | LL | let _foo = &[1_usize, 2] as [usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | let _foo = &[1_usize, 2] as &[usize]; | + error[E0620]: cast to unsized type: `Box` as `dyn Debug` - --> $DIR/issue-17441.rs:5:16 + --> $DIR/cast-to-unsized-type.rs:7:16 | LL | let _bar = Box::new(1_usize) as dyn std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -21,25 +21,25 @@ LL | let _bar = Box::new(1_usize) as Box; | ++++ + error[E0620]: cast to unsized type: `usize` as `dyn Debug` - --> $DIR/issue-17441.rs:8:16 + --> $DIR/cast-to-unsized-type.rs:10:16 | LL | let _baz = 1_usize as dyn std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using a box or reference as appropriate - --> $DIR/issue-17441.rs:8:16 + --> $DIR/cast-to-unsized-type.rs:10:16 | LL | let _baz = 1_usize as dyn std::fmt::Debug; | ^^^^^^^ error[E0620]: cast to unsized type: `[usize; 2]` as `[usize]` - --> $DIR/issue-17441.rs:11:17 + --> $DIR/cast-to-unsized-type.rs:13:17 | LL | let _quux = [1_usize, 2] as [usize]; | ^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using a box or reference as appropriate - --> $DIR/issue-17441.rs:11:17 + --> $DIR/cast-to-unsized-type.rs:13:17 | LL | let _quux = [1_usize, 2] as [usize]; | ^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-2995.rs b/tests/ui/cast/non-primitive-isize-ref-cast.rs similarity index 59% rename from tests/ui/issues/issue-2995.rs rename to tests/ui/cast/non-primitive-isize-ref-cast.rs index 0da7909480d20..95259456eeded 100644 --- a/tests/ui/issues/issue-2995.rs +++ b/tests/ui/cast/non-primitive-isize-ref-cast.rs @@ -1,3 +1,5 @@ +//! regression test for + fn bad (p: *const isize) { let _q: &isize = p as &isize; //~ ERROR non-primitive cast } diff --git a/tests/ui/issues/issue-2995.stderr b/tests/ui/cast/non-primitive-isize-ref-cast.stderr similarity index 88% rename from tests/ui/issues/issue-2995.stderr rename to tests/ui/cast/non-primitive-isize-ref-cast.stderr index f4a08e1751fc8..3f4c171d3dc7e 100644 --- a/tests/ui/issues/issue-2995.stderr +++ b/tests/ui/cast/non-primitive-isize-ref-cast.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `*const isize` as `&isize` - --> $DIR/issue-2995.rs:2:22 + --> $DIR/non-primitive-isize-ref-cast.rs:4:22 | LL | let _q: &isize = p as &isize; | ^^^^^^^^^^^ invalid cast diff --git a/tests/ui/issues/issue-19922.rs b/tests/ui/enum/enum-nonexisting-field.rs similarity index 69% rename from tests/ui/issues/issue-19922.rs rename to tests/ui/enum/enum-nonexisting-field.rs index fede86f22afd8..837430340f33c 100644 --- a/tests/ui/issues/issue-19922.rs +++ b/tests/ui/enum/enum-nonexisting-field.rs @@ -1,3 +1,5 @@ +//! regression test for + enum Homura { Akemi { madoka: () } } diff --git a/tests/ui/issues/issue-19922.stderr b/tests/ui/enum/enum-nonexisting-field.stderr similarity index 89% rename from tests/ui/issues/issue-19922.stderr rename to tests/ui/enum/enum-nonexisting-field.stderr index 0355d3a89710b..22bfa08dadb37 100644 --- a/tests/ui/issues/issue-19922.stderr +++ b/tests/ui/enum/enum-nonexisting-field.stderr @@ -1,5 +1,5 @@ error[E0559]: variant `Homura::Akemi` has no field named `kaname` - --> $DIR/issue-19922.rs:6:34 + --> $DIR/enum-nonexisting-field.rs:8:34 | LL | let homura = Homura::Akemi { kaname: () }; | ^^^^^^ `Homura::Akemi` does not have this field diff --git a/tests/ui/issues/issue-17351.rs b/tests/ui/lint/unused/unused-trait-fn.rs similarity index 72% rename from tests/ui/issues/issue-17351.rs rename to tests/ui/lint/unused/unused-trait-fn.rs index 86049377198c1..57b39c0de17ee 100644 --- a/tests/ui/issues/issue-17351.rs +++ b/tests/ui/lint/unused/unused-trait-fn.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass trait Str { fn foo(&self) {} } //~ WARN method `foo` is never used diff --git a/tests/ui/issues/issue-17351.stderr b/tests/ui/lint/unused/unused-trait-fn.stderr similarity index 87% rename from tests/ui/issues/issue-17351.stderr rename to tests/ui/lint/unused/unused-trait-fn.stderr index 043d4ffc78082..f33fed29c94c7 100644 --- a/tests/ui/issues/issue-17351.stderr +++ b/tests/ui/lint/unused/unused-trait-fn.stderr @@ -1,5 +1,5 @@ warning: method `foo` is never used - --> $DIR/issue-17351.rs:3:16 + --> $DIR/unused-trait-fn.rs:4:16 | LL | trait Str { fn foo(&self) {} } | --- ^^^ diff --git a/tests/ui/issues/issue-22599.rs b/tests/ui/lint/unused/unused-var-in-match-arm.rs similarity index 68% rename from tests/ui/issues/issue-22599.rs rename to tests/ui/lint/unused/unused-var-in-match-arm.rs index 05096e5c18531..780225f98dbb8 100644 --- a/tests/ui/issues/issue-22599.rs +++ b/tests/ui/lint/unused/unused-var-in-match-arm.rs @@ -1,3 +1,4 @@ +//! regression test for #![deny(unused_variables)] fn f(_: i32) {} diff --git a/tests/ui/issues/issue-22599.stderr b/tests/ui/lint/unused/unused-var-in-match-arm.stderr similarity index 78% rename from tests/ui/issues/issue-22599.stderr rename to tests/ui/lint/unused/unused-var-in-match-arm.stderr index b599f6febe31b..a1b9849293ef4 100644 --- a/tests/ui/issues/issue-22599.stderr +++ b/tests/ui/lint/unused/unused-var-in-match-arm.stderr @@ -1,11 +1,11 @@ error: unused variable: `a` - --> $DIR/issue-22599.rs:8:19 + --> $DIR/unused-var-in-match-arm.rs:9:19 | LL | v = match 0 { a => 0 }; | ^ help: if this is intentional, prefix it with an underscore: `_a` | note: the lint level is defined here - --> $DIR/issue-22599.rs:1:9 + --> $DIR/unused-var-in-match-arm.rs:2:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-19692.rs b/tests/ui/methods/method-not-found-on-struct.rs similarity index 69% rename from tests/ui/issues/issue-19692.rs rename to tests/ui/methods/method-not-found-on-struct.rs index 99eccc8a8175c..b2a457ed19e5c 100644 --- a/tests/ui/issues/issue-19692.rs +++ b/tests/ui/methods/method-not-found-on-struct.rs @@ -1,3 +1,5 @@ +//! regression test for + struct Homura; fn akemi(homura: Homura) { diff --git a/tests/ui/issues/issue-19692.stderr b/tests/ui/methods/method-not-found-on-struct.stderr similarity index 90% rename from tests/ui/issues/issue-19692.stderr rename to tests/ui/methods/method-not-found-on-struct.stderr index 1e3d7a2e2f517..3bf775f30a7a3 100644 --- a/tests/ui/issues/issue-19692.stderr +++ b/tests/ui/methods/method-not-found-on-struct.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `kaname` found for struct `Homura` in the current scope - --> $DIR/issue-19692.rs:4:40 + --> $DIR/method-not-found-on-struct.rs:6:40 | LL | struct Homura; | ------------- method `kaname` not found for this struct diff --git a/tests/ui/issues/issue-34209.rs b/tests/ui/pattern/enum-variant-not-found.rs similarity index 66% rename from tests/ui/issues/issue-34209.rs rename to tests/ui/pattern/enum-variant-not-found.rs index 632ddb91b36fd..e78e28abeb6e3 100644 --- a/tests/ui/issues/issue-34209.rs +++ b/tests/ui/pattern/enum-variant-not-found.rs @@ -1,3 +1,5 @@ +//! regression test for + enum S { A, } diff --git a/tests/ui/issues/issue-34209.stderr b/tests/ui/pattern/enum-variant-not-found.stderr similarity index 90% rename from tests/ui/issues/issue-34209.stderr rename to tests/ui/pattern/enum-variant-not-found.stderr index 83b40d0c08161..6db4cf79d6b32 100644 --- a/tests/ui/issues/issue-34209.stderr +++ b/tests/ui/pattern/enum-variant-not-found.stderr @@ -1,5 +1,5 @@ error[E0599]: no variant named `B` found for enum `S` - --> $DIR/issue-34209.rs:7:12 + --> $DIR/enum-variant-not-found.rs:9:12 | LL | enum S { | ------ variant `B` not found here diff --git a/tests/ui/issues/issue-16745.rs b/tests/ui/pattern/match-constant-and-byte-literal.rs similarity index 71% rename from tests/ui/issues/issue-16745.rs rename to tests/ui/pattern/match-constant-and-byte-literal.rs index 99c85bcffcf81..7a793478016df 100644 --- a/tests/ui/issues/issue-16745.rs +++ b/tests/ui/pattern/match-constant-and-byte-literal.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass fn main() { const X: u8 = 0; diff --git a/tests/ui/issues/auxiliary/issue-11680.rs b/tests/ui/privacy/auxiliary/imported-enum-is-private.rs similarity index 53% rename from tests/ui/issues/auxiliary/issue-11680.rs rename to tests/ui/privacy/auxiliary/imported-enum-is-private.rs index 74abbf0bf8cda..ea847d9aff135 100644 --- a/tests/ui/issues/auxiliary/issue-11680.rs +++ b/tests/ui/privacy/auxiliary/imported-enum-is-private.rs @@ -1,3 +1,5 @@ +//! auxiliary crate for + enum Foo { Bar(isize) } diff --git a/tests/ui/issues/issue-11680.rs b/tests/ui/privacy/imported-enum-is-private.rs similarity index 50% rename from tests/ui/issues/issue-11680.rs rename to tests/ui/privacy/imported-enum-is-private.rs index 9f3dfebcc812c..b628676a25c6b 100644 --- a/tests/ui/issues/issue-11680.rs +++ b/tests/ui/privacy/imported-enum-is-private.rs @@ -1,6 +1,7 @@ -//@ aux-build:issue-11680.rs +//! regression test for +//@ aux-build:imported-enum-is-private.rs -extern crate issue_11680 as other; +extern crate imported_enum_is_private as other; fn main() { let _b = other::Foo::Bar(1); diff --git a/tests/ui/issues/issue-11680.stderr b/tests/ui/privacy/imported-enum-is-private.stderr similarity index 79% rename from tests/ui/issues/issue-11680.stderr rename to tests/ui/privacy/imported-enum-is-private.stderr index 5bcf93de811fe..cae1ebb0e29e2 100644 --- a/tests/ui/issues/issue-11680.stderr +++ b/tests/ui/privacy/imported-enum-is-private.stderr @@ -1,5 +1,5 @@ error[E0603]: enum `Foo` is private - --> $DIR/issue-11680.rs:6:21 + --> $DIR/imported-enum-is-private.rs:7:21 | LL | let _b = other::Foo::Bar(1); | ^^^ --- tuple variant `Bar` is not publicly re-exported @@ -7,13 +7,13 @@ LL | let _b = other::Foo::Bar(1); | private enum | note: the enum `Foo` is defined here - --> $DIR/auxiliary/issue-11680.rs:1:1 + --> $DIR/auxiliary/imported-enum-is-private.rs:3:1 | LL | enum Foo { | ^^^^^^^^ error[E0603]: enum `Foo` is private - --> $DIR/issue-11680.rs:9:27 + --> $DIR/imported-enum-is-private.rs:10:27 | LL | let _b = other::test::Foo::Bar(1); | ^^^ --- tuple variant `Bar` is not publicly re-exported @@ -21,7 +21,7 @@ LL | let _b = other::test::Foo::Bar(1); | private enum | note: the enum `Foo` is defined here - --> $DIR/auxiliary/issue-11680.rs:6:5 + --> $DIR/auxiliary/imported-enum-is-private.rs:8:5 | LL | enum Foo { | ^^^^^^^^ diff --git a/tests/ui/issues/issue-26472.rs b/tests/ui/privacy/private-struct-field-in-module.rs similarity index 81% rename from tests/ui/issues/issue-26472.rs rename to tests/ui/privacy/private-struct-field-in-module.rs index b100c59ad0bd7..7ed8def1c6916 100644 --- a/tests/ui/issues/issue-26472.rs +++ b/tests/ui/privacy/private-struct-field-in-module.rs @@ -1,3 +1,5 @@ +//! regression test for + mod sub { pub struct S { len: usize } impl S { diff --git a/tests/ui/issues/issue-26472.stderr b/tests/ui/privacy/private-struct-field-in-module.stderr similarity index 81% rename from tests/ui/issues/issue-26472.stderr rename to tests/ui/privacy/private-struct-field-in-module.stderr index d7134bff17618..2394686f69caf 100644 --- a/tests/ui/issues/issue-26472.stderr +++ b/tests/ui/privacy/private-struct-field-in-module.stderr @@ -1,5 +1,5 @@ error[E0616]: field `len` of struct `S` is private - --> $DIR/issue-26472.rs:11:15 + --> $DIR/private-struct-field-in-module.rs:13:15 | LL | let v = s.len; | ^^^ private field @@ -10,7 +10,7 @@ LL | let v = s.len(); | ++ error[E0616]: field `len` of struct `S` is private - --> $DIR/issue-26472.rs:12:7 + --> $DIR/private-struct-field-in-module.rs:14:7 | LL | s.len = v; | ^^^ private field diff --git a/tests/ui/issues/issue-16966.rs b/tests/ui/type-inference/panic-with-unspecified-type.rs similarity index 62% rename from tests/ui/issues/issue-16966.rs rename to tests/ui/type-inference/panic-with-unspecified-type.rs index 66a3fadac8d96..0f96759e81445 100644 --- a/tests/ui/issues/issue-16966.rs +++ b/tests/ui/type-inference/panic-with-unspecified-type.rs @@ -1,3 +1,4 @@ +//! regression test for //@ edition:2015..2021 fn main() { panic!(std::default::Default::default()); diff --git a/tests/ui/issues/issue-16966.stderr b/tests/ui/type-inference/panic-with-unspecified-type.stderr similarity index 91% rename from tests/ui/issues/issue-16966.stderr rename to tests/ui/type-inference/panic-with-unspecified-type.stderr index e294d8830de04..5f08a7552632c 100644 --- a/tests/ui/issues/issue-16966.stderr +++ b/tests/ui/type-inference/panic-with-unspecified-type.stderr @@ -1,5 +1,5 @@ error[E0283]: type annotations needed - --> $DIR/issue-16966.rs:3:12 + --> $DIR/panic-with-unspecified-type.rs:4:12 | LL | panic!(std::default::Default::default()); | -------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- diff --git a/tests/ui/issues/issue-25368.rs b/tests/ui/type-inference/send-with-unspecified-type.rs similarity index 79% rename from tests/ui/issues/issue-25368.rs rename to tests/ui/type-inference/send-with-unspecified-type.rs index 4be83457f7a8b..4c2de025d69c0 100644 --- a/tests/ui/issues/issue-25368.rs +++ b/tests/ui/type-inference/send-with-unspecified-type.rs @@ -1,3 +1,5 @@ +//! regression test for + use std::sync::mpsc::channel; use std::thread::spawn; use std::marker::PhantomData; diff --git a/tests/ui/issues/issue-25368.stderr b/tests/ui/type-inference/send-with-unspecified-type.stderr similarity index 91% rename from tests/ui/issues/issue-25368.stderr rename to tests/ui/type-inference/send-with-unspecified-type.stderr index 23f1441e69dcf..85692e8ad0cd9 100644 --- a/tests/ui/issues/issue-25368.stderr +++ b/tests/ui/type-inference/send-with-unspecified-type.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-25368.rs:11:27 + --> $DIR/send-with-unspecified-type.rs:13:27 | LL | tx.send(Foo{ foo: PhantomData }); | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `PhantomData` diff --git a/tests/ui/issues/issue-24013.rs b/tests/ui/type-inference/swap-with-unspecified-type.rs similarity index 70% rename from tests/ui/issues/issue-24013.rs rename to tests/ui/type-inference/swap-with-unspecified-type.rs index c6d3016712720..db415df19e99a 100644 --- a/tests/ui/issues/issue-24013.rs +++ b/tests/ui/type-inference/swap-with-unspecified-type.rs @@ -1,3 +1,5 @@ +//! regression test for + fn main() { use std::mem::{transmute, swap}; let a = 1; diff --git a/tests/ui/issues/issue-24013.stderr b/tests/ui/type-inference/swap-with-unspecified-type.stderr similarity index 87% rename from tests/ui/issues/issue-24013.stderr rename to tests/ui/type-inference/swap-with-unspecified-type.stderr index 37a86ecc54374..eaaed559ebf16 100644 --- a/tests/ui/issues/issue-24013.stderr +++ b/tests/ui/type-inference/swap-with-unspecified-type.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-24013.rs:5:13 + --> $DIR/swap-with-unspecified-type.rs:7:13 | LL | unsafe {swap::<&mut _>(transmute(&a), transmute(&b))}; | ^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `swap` diff --git a/tests/ui/issues/issue-35241.rs b/tests/ui/type/struct-constructor-as-value.rs similarity index 53% rename from tests/ui/issues/issue-35241.rs rename to tests/ui/type/struct-constructor-as-value.rs index 2fa762475da95..9cac1caf86ece 100644 --- a/tests/ui/issues/issue-35241.rs +++ b/tests/ui/type/struct-constructor-as-value.rs @@ -1,3 +1,5 @@ +//! regression test for + struct Foo(u32); fn test() -> Foo { Foo } //~ ERROR mismatched types diff --git a/tests/ui/issues/issue-35241.stderr b/tests/ui/type/struct-constructor-as-value.stderr similarity index 93% rename from tests/ui/issues/issue-35241.stderr rename to tests/ui/type/struct-constructor-as-value.stderr index 6f6602793fdb7..5915f971b324a 100644 --- a/tests/ui/issues/issue-35241.stderr +++ b/tests/ui/type/struct-constructor-as-value.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-35241.rs:3:20 + --> $DIR/struct-constructor-as-value.rs:5:20 | LL | struct Foo(u32); | ---------- `Foo` defines a struct constructor here, which should be called