-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Patterns in extern fns either ICE or aren't type-checked #10877
Comments
I'm inclined to say that the correct behavior is to deny all patterns other than |
Nominating. |
@alexcrichton I agree |
Accepted for 1.0, P-backcompat-lang. |
Good newbie bug. |
Being a good newbie, I'll have a crack at this one. :) |
Might have aimed a little too high by trying this issue.. but from what i understand, the type checking is working as people would like, but the message is incorrect and should be a actual syntax error and not an ICE... so the below is some thing like how it should work? struct Foo { x: int }
extern {
// This one should fail because you've supplied a literal as a fn arg with
// no type
fn foo(1: ());
// This one should fail because you've specified '()' as a variable name for
// the fn args
fn bar((): int);
// This one should pass because you've declared a deconstructed variable name
// for the input parm 'x' and you've declared a type. This still should trigger
// the warning for not using a 'libc::c_int'.
fn baz(Foo {x}: int);
// This should pass because you've specified input parameters and rust will
// infer the type?
fn qux((x,y): ());
} Sorry if I've completely misunderstood, still pretty nubbins with Rust. :\ |
@mankyKitty my reading of acrichto's comment is that all of your examples should fail; ideally only an identfier should pass. |
They should all fail, the only thing that should pass is One way to implement this would be to make it an actual syntax error. You can find a starting place for this change by grepping for
No inference; this is always incorrect because you're trying to match a 2-tuple pattern (i.e. type |
Functions declared in an 'extern' were not properly typed checked and will report syntax errors on failure instead of an ICE. Fixes rust-lang#10877
[`new_without_default`]: Now emits on const fns While `Default::default` is not const, it can still call `const new`; there's no reason this shouldn't be linted as well. fixes rust-lang#10877 changelog: [`new_without_default`]: Now emits on const fns
The following compiles fine, but uncommenting any of the currently-commented
extern
functions makes the compiler ICE.For
foo
the ICE message isand the others are similar.
The text was updated successfully, but these errors were encountered: