-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Strange compilation failure #22722
Labels
A-type-system
Area: Type system
Comments
This looks like a duplication of #22252. |
Also, #21114. |
I also just started seeing a similar issue, so not sure what recently changed to make this affect more code. // ...
fn main() {
let args: Args = Docopt::new(USAGE)
.and_then(|d| d.decode())
.unwrap_or_else(|e| e.exit());
if args.flag_version {
println!("{}", VERSION);
return
}
match server::start(&args.flag_listen) {
Ok(_) => println!("listening on {} ...", &args.flag_listen),
Err(err) => panic!("failed to start hearts server: {}", err),
}
} fails without a semi-colon at the end. src/main.rs:47:26: 47:42 error: `args.flag_listen` does not live long enough
src/main.rs:47 match server::start(&args.flag_listen) {
^~~~~~~~~~~~~~~~
src/main.rs:38:11: 51:2 note: reference must be valid for the destruction scope surrounding block at 38:10...
src/main.rs:38 fn main() {
src/main.rs:39 let docopt = Docopt::new(USAGE).unwrap();
src/main.rs:40 let args: Args = docopt.decode().unwrap();
src/main.rs:41
src/main.rs:42 if args.flag_version {
src/main.rs:43 println!("{}", VERSION);
...
src/main.rs:40:46: 51:2 note: ...but borrowed value is only valid for the block suffix following statement 1 at 40:45
src/main.rs:40 let args: Args = docopt.decode().unwrap();
src/main.rs:41
src/main.rs:42 if args.flag_version {
src/main.rs:43 println!("{}", VERSION);
src/main.rs:44 return
src/main.rs:45 }
... |
Closing as a dupe of #22252; thanks for filing! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rustc 1.0.0-nightly (2b01a37 2015-02-21) (built 2015-02-22)
I try to compile file:
And get error:
The text was updated successfully, but these errors were encountered: