-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Description
Currently, if we define a tuple struct:
struct S(t1, ..., tn)
then S
has the same type as
fn( x1 : t1, ..., xn : tn) -> S
This allows us to write code that seems unintuitive / wrong:
struct Foo(bool);
let x = Foo(true);
fn foo(_: uint) -> Foo { Foo(false) } // Note that we don't even check to make sure the argument types match in patterns
match x {
foo(x) => println!("{}", x)
}
// Produces `true`
It seems to me that we should disallow this. My preference would be to just make tuple structs unique, named type constructors that wrap tuple type constructors (not functions). So the type of S
above might be (internally) Unique(Tuple(t1, ..., tn), S)
.
Metadata
Metadata
Assignees
Labels
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️