parent
fe8a31e569
commit
7f1ea3ef6a
3 changed files with 14 additions and 24 deletions
|
@ -666,6 +666,15 @@ fn parse_path(p: parser) -> @ast::path {
|
||||||
{global: global, idents: ids, types: []});
|
{global: global, idents: ids, types: []});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_value_path(p: parser) -> @ast::path {
|
||||||
|
let pt = parse_path(p);
|
||||||
|
let last_word = pt.node.idents[vec::len(pt.node.idents)-1u];
|
||||||
|
if p.bad_expr_words.contains_key(last_word) {
|
||||||
|
p.fatal("found " + last_word + " in expression position");
|
||||||
|
}
|
||||||
|
pt
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_path_and_ty_param_substs(p: parser, colons: bool) -> @ast::path {
|
fn parse_path_and_ty_param_substs(p: parser, colons: bool) -> @ast::path {
|
||||||
let lo = p.span.lo;
|
let lo = p.span.lo;
|
||||||
let path = parse_path(p);
|
let path = parse_path(p);
|
||||||
|
@ -1514,7 +1523,7 @@ fn parse_pat(p: parser) -> @ast::pat {
|
||||||
token::LPAREN | token::LBRACKET | token::LT { false }
|
token::LPAREN | token::LBRACKET | token::LT { false }
|
||||||
_ { true }
|
_ { true }
|
||||||
} {
|
} {
|
||||||
let name = parse_path(p);
|
let name = parse_value_path(p);
|
||||||
let sub = if eat(p, token::AT) { some(parse_pat(p)) }
|
let sub = if eat(p, token::AT) { some(parse_pat(p)) }
|
||||||
else { none };
|
else { none };
|
||||||
pat = ast::pat_ident(name, sub);
|
pat = ast::pat_ident(name, sub);
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
// error-pattern: overwriting x will invalidate reference y
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let x = [];
|
|
||||||
let &y = x;
|
|
||||||
while true {
|
|
||||||
log(error, y);
|
|
||||||
x = [1];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
// Ensures that invalidating a reference in one branch doesn't
|
|
||||||
// influence other branches.
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let x = [];
|
|
||||||
let &y = x;
|
|
||||||
if true { x = [1]; }
|
|
||||||
else { log(error, y); }
|
|
||||||
}
|
|
Loading…
Reference in a new issue