Skip to content

Missing tests for #92630 #93143

Closed
Closed
@steffahn

Description

@steffahn

Right.. #92630 is my own PR; I'm noting this as an issue, mainly so I won't forget this, because I won't do this myself right now / today. Or someone else can do this if they want.

I'm not 100% certain where the best place for such a test to go is, and/or whether it makes sense to have them in one place or separated and more close to the respective type's definition.

A test to prevent any future regression removing the new auto trait implementations introduced by #92630 can look about as follows

// does not need to run, just tests by whether or not this compiles
fn _test<'a>() {
    use std::marker::PhantomData;
    use std::panic::{RefUnwindSafe, UnwindSafe};

    trait Trait {}
    type NoAutoTraits<'a> = PhantomData<dyn Trait + 'a>;
    fn all_auto_traits<T: Send + Sync + Unpin + UnwindSafe + RefUnwindSafe>() {}

    all_auto_traits::<std::iter::Empty<NoAutoTraits<'a>>>();
    all_auto_traits::<std::hash::BuildHasherDefault<NoAutoTraits<'a>>>();
    all_auto_traits::<std::future::Pending<NoAutoTraits<'a>>>();
}

Edit: This code is needlessly complicated, see my comment below.

@rustbot label C-enhancement, A-testsuite, E-easy, E-needs-test, T-libs

Metadata

Metadata

Assignees

Labels

A-testsuiteArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions