Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upStrange compilation failure #22722
Comments
This comment has been minimized.
This comment has been minimized.
|
This looks like a duplication of #22252. |
This comment has been minimized.
This comment has been minimized.
|
Also, #21114. |
This comment has been minimized.
This comment has been minimized.
|
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 }
... |
steveklabnik
added
the
A-typesystem
label
Feb 25, 2015
This comment has been minimized.
This comment has been minimized.
|
Closing as a dupe of #22252; thanks for filing! |
huonw
closed this
Jan 8, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bozaro commentedFeb 23, 2015
rustc 1.0.0-nightly (2b01a37 2015-02-21) (built 2015-02-22)
I try to compile file:
And get error: