Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 69b8a6f

Browse files
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 0b0908d + ce496e0 commit 69b8a6f

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
    (0)

    AltStyle によって変換されたページ (->オリジナル) /