Skip to content
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

Missing error "some control paths may return to the caller" in this case #897

Closed
jruderman opened this issue Sep 10, 2011 · 1 comment
Closed

Comments

@jruderman
Copy link
Contributor

fn f() -> ! { ret 42; fail; }
fn main() { }

Result:

Assertion failed: (getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"), function AssertOK, file Instructions.cpp, line 1065.

If I remove the "fail;" I get the error message I expect:

error: In non-returning function f, some control paths may return to the caller
@ghost ghost assigned catamorphism Sep 11, 2011
@jruderman
Copy link
Contributor Author

fn f() -> ! { ret; fail; }
fn main() { f(); }

Compiles as a program that crashes.

fhahn added a commit to fhahn/rust that referenced this issue Feb 12, 2014
* src/test/run-pass/issue-3559.rs was fixed in rust-lang#4726
* src/test/compile-fail/borrowck-call-sendfn.rs was fixed in rust-lang#2978
* update src/test/compile-fail/issue-5500-1.rs to work with current Rust
* removed src/test/compile-fail/issue-5500.rs because it is tested in
    src/test/run-fail/issue-5500.rs
* src/test/compile-fail/view-items-at-top.rs fixed
* rust-lang#897 fixed
* compile-fail/issue-6762.rs issue was closed as dup of rust-lang#6801
* deleted compile-fail/issue-2074.rs because it became irelevant and is
  irrelevant rust-lang#2074, a test covering this was added in
  4f92f45
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants