Skip to content

Negative bounds (with feature gate) #129

Open

Description

A counterpart to #73 enabling negative bounds checking. Currently the impl in the compiler is being reworked to make use of the new trait solver (rust-lang/rust#112875). Despite the feature being unstable it would be great if MIR formality could model these rules.

Example

Negative bounds should only match on types which have negative trait impls. This example implements FooTrait for CoreStruct because CoreStruct implements !CoreTrait:

crate core {
    trait CoreTrait<> where [] {}
    struct CoreStruct<> where [] {}
    impl<> !CoreTrait<> for CoreStruct<> where [] {}
}
crate foo {
    trait FooTrait<> where [] {}
    impl<ty T> FooTrait<> for T where [T: !CoreTrait<>] {}
}

note: When converting this into a test some assertion should be written to ensure that CoreStruct actually implements FooTrait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions