trait_sel: delay bug for removed pointeesized#142661
trait_sel: delay bug for removed pointeesized#142661davidtwco wants to merge 1 commit intorust-lang:masterfrom
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 PointeeSizedand 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