Skip to content

Resolve should make sure variables aren't used before they're declared #481

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

Closed
pcwalton opened this issue Jun 13, 2011 · 4 comments
Closed

Comments

@pcwalton
Copy link
Contributor

Typestate usually errors out when this happens, but the message is confusing. This should be picked up in resolve.

@graydon
Copy link
Contributor

graydon commented Jun 27, 2011

Disagree. Typestate is the right place to do this, and closures make it unclear anyways. If the error message is bad, that's a different bug.

@pcwalton
Copy link
Contributor Author

I'm not sure how closures make this unclear.

I guess the issue is that variable declarations in Rust hoist just like JavaScript. Is this intended behavior?

@eholk
Copy link
Contributor

eholk commented Jul 15, 2011

As a C/C++ programmer, it's really weird to me that stuff like this is legal:

fn main() {
    x = 4;
    log_err x;
    auto x;
}

@marijnh
Copy link
Contributor

marijnh commented Aug 16, 2011

Fixed by e33af7e

@marijnh marijnh closed this as completed Aug 16, 2011
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Add execl, execle, execlp

I tried to be as close as possible to the existing definitions of `execv` and friends.

btw: do you still welcome these PR? Doesn't the [new bindgen/build.rs method](http://fitzgeraldnick.com/2016/12/14/using-libbindgen-in-build-rs.html) offer to automate this crate to 100%
kazcw pushed a commit to kazcw/rust that referenced this issue Oct 23, 2018
pdietl pushed a commit to pdietl/rust that referenced this issue Apr 23, 2020
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* initial draft of 2nd tutorial section

* add exercise solutions, fix minor issues
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

4 participants