-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
ICE: Unexpected type returned from struct_tail #16812
Comments
This is still happening. Does this mean we should avoid using DSTs for complex custom types for now? |
Visiting for triage This is still an issue:
|
ICE also happens with a tupled trait object: fn main() {
let x: &(Clone, Iterator) = panic!();
}
|
I've seen this too with: Reproducer:
Version:
Backtrace:
|
fn main() {
let _ : Box<Fn([u8])> = Box::new(|ref _a| {});
} No longer reproduces but the other tests do. |
cc #25388 |
Is this the same as or related to #24957? |
use std::path::Path;
use std::path::PathBuf;
pub enum Source
{
File(Path), // compiler error :(
// File(PathBuf), // works :)
}
pub fn source_to_dbtype(src: &Source) -> u8
{
match src
{
&Source::File(..) => 1,
}
} leads to I'm using the Ubuntu PPA "rust-nightly", version 201509240405 |
fn main() {
let x: &(Clone, Iterator) = panic!();
} Does not compile for other reasons that the ICE anymore. I've adjusted to the following and could not reproduce it anymore. trait T {}
fn main() {
let x: &(T, Iterator<Item = u32>) = panic!();
} |
Another example hitting this same ICE: use std::any::Any;
enum MyOption<T: ?Sized> {
None,
Some(T)
}
fn main() {
let _: Box<MyOption<Any>> = panic!();
} |
Bugs similar to this one have been reported numerous times (most of the references to this issue are duplicates). Although it would be nice for reporters to search for similar issues before filing a new one, it's hard to blame them, since the ICE message from rustc tells people to file an issue. This issue itself was opened over two years ago. Separate from fixing the underlying problem, we should at least investigate displaying a real error instead of an ICE. |
Disallow Unsized Enums Fixes #16812. This PR is a potential fix for #16812, an issue which is reported [again](#36801) and [again](#36975), with over a dozen duplicates by now. This PR is mainly meant to promoted discussion about the issue and the correct way to fix it. This is a [breaking-change] since the error is now reported during wfchecking, so that even the definition of a (potentially) unsized enum will cause an error (whereas it would previously cause an ICE at trans time if the enum was used in an unsized manner).
fix: Goto implementation to impls inside blocks Fixes rust-lang#3739
Backtrace:
This seems to occur when using a non-struct type that contains an unsized type. This is probably because
unsized_part_of_type
only handlesty_struct
and the base unsized types. This should be extended to handle enums and tuples as well.The text was updated successfully, but these errors were encountered: