Skip to content

better_any regression #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
compiler-errors opened this issue Apr 18, 2025 · 0 comments · Fixed by rust-lang/rust#141347
Closed

better_any regression #183

compiler-errors opened this issue Apr 18, 2025 · 0 comments · Fixed by rust-lang/rust#141347
Labels
from-crater A regression found via a crater run, not part of our test suite

Comments

@compiler-errors
Copy link
Member

https://crater-reports.s3.amazonaws.com/pr-133502-2/try%23da0a4799770027c4c578bf48cdb390acfde09023/reg/better_any-0.2.0/log.txt

use std::any::TypeId;

unsafe trait TidAble<'a>: Tid<'a> {}
trait TidExt<'a>: Tid<'a> {
    fn downcast_box(self: Box<Self>) {
        loop {}
    }
}

impl<'a, X: ?Sized + Tid<'a>> TidExt<'a> for X {}

unsafe trait Tid<'a>: 'a {}

unsafe impl<'a, T: ?Sized + TidAble<'a>> Tid<'a> for T {}

impl<'a> dyn Tid<'a> + 'a {
    fn downcast_any_box(self: Box<Self>) {
        self.downcast_box();
    }
}

unsafe impl<'a> TidAble<'a> for dyn Tid<'a> + 'a {}
error[E0283]: type annotations needed: cannot satisfy `dyn Tid<'a>: Tid<'_>`
  --> src/lib.rs:18:14
   |
18 |         self.downcast_box();

Conflict between blanket impl and dyn impl. Probably fixed if we were to fix the dyn overlap problem.

@lcnr lcnr added the from-crater A regression found via a crater run, not part of our test suite label Apr 19, 2025
@lcnr lcnr changed the title better_any regression better_any regression May 8, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 22, 2025
Rollup merge of rust-lang#141347 - lcnr:lets-make-it-unsound-3, r=compiler-errors

incorrectly prefer builtin `dyn` impls :3

This makes rust-lang#57893 slightly more exploitable with the new solver. It's still strictly better than the old solver and the underlying unsoundness persists in the new one even without this preference.

Properly fixing rust-lang#57893 is something we've been looking at more deeply recently and discussed at the [Types Meetup during the All-Hands](https://hackmd.io/rz-4ghMzTb2wXOkdLKHaHw#Dyn-traits). Whatever approach we'll end up deciding on will likely require a fairly long transition period and some significant further design work. This should not block `-Znext-solver`.

fixes rust-lang/trait-system-refactor-initiative#183

r? `@compiler-errors` cc `@rust-lang/types`
@lcnr lcnr moved this from unknown to done in -Znext-solver=globally May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from-crater A regression found via a crater run, not part of our test suite
Projects
Development

Successfully merging a pull request may close this issue.

2 participants