Skip to content

Commit 3a6215d

Browse files
authored
Rollup merge of #145537 - zachs18:metasized-negative-bound-fix, r=davidtwco
Do not consider a `T: !Sized` candidate to satisfy a `T: !MetaSized` obligation. This example should fail to compile (and does under this PR, with the old and new solvers), but currently compiles successfully ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=6e0e5d0ae0cdf0571dea97938fb4a86d)), because (IIUC) the old solver's `lazily_elaborate_sizedness_candidate`/callers and the new solver's `TraitPredicate::fast_reject_assumption`/`match_assumption` consider a `T: _ Sized` candidate to satisfy a `T: _ MetaSized` obligation, for either polarity `_`, when that should only hold for positive polarity. ```rs #![feature(negative_bounds)] #![feature(sized_hierarchy)] use std::marker::MetaSized; fn foo<T: !MetaSized>() {} fn bar<T: !Sized + MetaSized>() { foo::<T>(); //~^ ERROR the trait bound `T: !MetaSized` is not satisfied // error under this PR } ``` Only observable with the internal-only `feature(negative_bounds)`, so might just be "wontfix". This example is added as a test in this PR (as well as testing that `foo<()>` and `foo<str>` are disallowed for `fn foo<T: !MetaSized`). cc `@davidtwco` for `feature(sized_hierarchy)` Maybe similar to 91c53c9 from <rust-lang/rust#143307>
2 parents a710161 + 04b0ab6 commit 3a6215d

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)