-
Notifications
You must be signed in to change notification settings - Fork 13.5k
trait_sel: delay bug for removed pointeesized #142661
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
trait_sel: delay bug for removed pointeesized #142661
Conversation
Won't that cause the following to ICE without an error? #![feature(sized_hierarchy)]
use std::marker::PointeeSized;
type Foo = dyn PointeeSized; Or sth similar that doesn't cause other errors |
This doesn't error, it just compiles. If I add a use of #![feature(sized_hierarchy)]
use std::marker::PointeeSized;
type Foo = dyn PointeeSized;
fn foo(f: &Foo) {}
fn main() {
foo(&());
} ..then I do get an error, but not an ICE. It's an incorrect error, because
Only way to correct that is to re-implement the builtin impl for |
https://github.com/davidtwco/rust/tree/issue-142652-dyn-pointeesized-reimpl re-adds that builtin impl and makes the snippet from the previous comment pass, can replace this with that if we want. |
This code path isn't hit during normal compilation, only in error reporting, so delaying the bug is sufficient. It might be possible to trigger this with `dyn PointeeSized` and code that doesn't error but no such example could be found at the time of writing.
251eec8
to
e7d308c
Compare
Ah right. So what about a coercion that should succeed?
or maybe somemething else. I'm fine just not doing anything here and waiting for someone to figure out how to hit that delayed bug without an error, but ideally we'd try a bit. fn foo<T: PointeeSized>(t: Box<T>) -> Box<dyn PointeeSized> { t } maybe? |
No error on this one.
We do get an error on this one, but largely because
|
@bors r+ rollup |
Do we want to do anything about this incorrectly erroring? #![feature(sized_hierarchy)]
use std::marker::PointeeSized;
type Foo = dyn PointeeSized;
fn foo(f: &Foo) {}
fn main() {
foo(&());
} |
probably, but either improving the error or collecting all the info on why we wanted to avoid the builtin impl in the first place and discussing that |
I think avoiding the builtin impl was just because we thought it couldn't be hit with the |
Right, in that case let's add it |
Fixes #142652
This code path isn't hit during normal compilation, only in error reporting, so delaying the bug is sufficient. It might be possible to trigger this with
dyn PointeeSized
and code that doesn't error but I couldn't work out how to make that happen. This can only happen when you use the feature so it's not an urgent thing and if we find another case then I can fix that then.r? @oli-obk