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

if/alt expressions don't understand how to return functions that fail #452

Closed
brson opened this issue Jun 4, 2011 · 1 comment
Closed
Labels
A-typesystem Area: The type system

Comments

@brson
Copy link
Contributor

brson commented Jun 4, 2011

In the following example the first arm of the if expression doesn't translate:

fn f() -> ! { fail }

fn g() -> int {
  auto x = if (true) {
    f()
  } else {
    10
  };
  ret x;
}

Trans thinks that f() returns int (because x is int) and tries to copy the result of f, which is not int. Replacing f() with a plain fail expression works as expected.

brson added a commit that referenced this issue Jun 11, 2011
brson added a commit that referenced this issue Jun 11, 2011
@brson
Copy link
Contributor Author

brson commented Jun 11, 2011

This issue has been fixed in passing

@brson brson closed this as completed Jun 11, 2011
arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 10, 2015
Change RFC rust-lang#212 (integer fallback) to use `i32` instead of `int` as the fallback
kazcw pushed a commit to kazcw/rust that referenced this issue Oct 23, 2018
GuillaumeGomez pushed a commit to GuillaumeGomez/rust that referenced this issue Feb 21, 2024
Remove unused `feature = "master"` cfg in build_system
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Partial support for subslice pattern

* Added two tests for sub-slices

* Added fixme to broken test

* Add copyright notice in tests

* Add comments linking to full support issue

* Remove `dbg` macros

* Use `ssize_t` for index

Co-authored-by: Zyad Hassan <zyadh@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system
Projects
None yet
Development

No branches or pull requests

1 participant