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:
parent
a06398214a
commit
cc323d8637
2 changed files with 21 additions and 1 deletions
|
@ -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 `%?`",
|
||||
|
|
13
src/test/compile-fail/issue-2590.rs
Normal file
13
src/test/compile-fail/issue-2590.rs
Normal 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() {}
|
Loading…
Add table
Add a link
Reference in a new issue