1
Fork 0

Make liveness print out a proper error message for moves out of a self field

This was a call to span_bug() before. I'm not sure about the other cases,
but the test case shows that the `vk_self` case can certainly arise with
a bad program, so it should be a span_err() thing and not a span_bug() thing.

Closes #2590
This commit is contained in:
Tim Chevalier 2012-06-21 17:41:40 -07:00
parent a06398214a
commit cc323d8637
2 changed files with 21 additions and 1 deletions

View file

@ -1669,7 +1669,14 @@ impl check_methods for @liveness {
#fmt["illegal move from field `%s`", *name]);
ret;
}
vk_local(*) | vk_self | vk_implicit_ret {
vk_self {
self.tcx.sess.span_err(
move_span,
"illegal move from self (cannot move out of a field of \
self)");
ret;
}
vk_local(*) | vk_implicit_ret {
self.tcx.sess.span_bug(
move_span,
#fmt["illegal reader (%?) for `%?`",

View file

@ -0,0 +1,13 @@
import dvec::dvec;
type parser = {
tokens: dvec<int>,
};
impl parser for parser {
fn parse() -> [mut int] {
dvec::unwrap(self.tokens) //! ERROR illegal move from self
}
}
fn main() {}