You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This test case which came up in discussions of #3166 revealed a bug in our GLB computation. It successfully compiles but should not. The expected error is in the function set_desc(), which combines &self with &---this should yield a lifetime of only the body of the function itself, since that is the only lifetime that the two lifetime parameters are guaranteed to have in common, but it currently yields &. Wrong!
mod argparse {
use std;
import std::map;
import either::{either, left, right};
struct Flag {
name: &str;
desc: &str;
max_count: uint;
mut value: uint;
}
fn flag(name: &str, desc: &str) -> Flag {
Flag { name: name, desc: desc, max_count: 1, value: 0 }
}
impl Flag {
fn set_desc(self, s: &str) -> Flag {
Flag {
name: self.name,
desc: s,
max_count: self.max_count,
value: self.value
}
}
}
}
fn main () {
let f : argparse::Flag = argparse::flag(~"flag", ~"My flag");
let updated_flag = f.set_desc(~"My new flag");
assert updated_flag.desc == "My new flag";
}
I have a fix underway.
The text was updated successfully, but these errors were encountered:
This test case which came up in discussions of #3166 revealed a bug in our GLB computation. It successfully compiles but should not. The expected error is in the function
set_desc()
, which combines&self
with&
---this should yield a lifetime of only the body of the function itself, since that is the only lifetime that the two lifetime parameters are guaranteed to have in common, but it currently yields&
. Wrong!I have a fix underway.
The text was updated successfully, but these errors were encountered: