-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: internal compiler error: Accessing (*_310)
with the kind Write(Move)
shouldn't be possible
#54597
Comments
I took a liberty to re-format the issue report to add code blocks and hide the long panic message behind |
Much appreciated. |
This looks likely to be an NLL or at least MIR-borrowck bug... @scuzzycheese can you provide a standalone test case (rather than a code fragment as given in the description)? If you cannot provide that, can you point us to a github repo that reproduces the problem? |
I'll try. I can't release the code directly unfortunately, as it technically belongs to my company. Let me see if I can reproduce it in a standalone test case. |
@scuzzycheese also, was this a recently injected problem? Can you potentially bisect to a particular nightly build of the Rust compiler? |
tentatively tagging as NLL-complete under the assumption that the original code was supposed to compile, though its possible that this is actually an NLL-sound issue and we just need to fix the ICE. |
I have not yet managed to reproduce the problem locally. @scuzzycheese can you provide the whole function that is causing the ICE? Or would providing that be a violation of your company's policy? |
Silly silly me! I forgot to backtrack to the nightly indicated by @scuzzycheese when I previously attempted to reproduce. I have now successfully reproduced the bug via nightly-2018-07-11-x86_64-apple-darwin and the following code: #![feature(nll)]
extern crate serde_json;
fn _foo(val: serde_json::Value) {
let _reviewers_original: Vec<serde_json::Value> = match val["reviewers"].as_array() {
Some(array) => {
println!("Reviewers: {:?}", array);
*array
}
None => vec![]
};
}
fn main() {
println!("Hello, world!");
} The same code compiles and runs successfully with a more recent nightly. I'll bisect to determine where the bug was fixed. |
Here is the summary of changes from the time period covered by the two nightlies indicated in the previous comment: % git log 874dec2..866a713 --author bors --format=oneline |
In any case this is not a high priority bug, since it appears to have been fixed. I suspect we wouldn't backport whatever the fix is. The main things I am interested in now is to 1. track down which PR fixed this (though this is not a must-have), and 2. add a regression test for it (which would involve making a test that doesn't rely on serde). |
Hi @pnkfelix, apologies for not getting the example together for you, but thanks for managing to reproduce it for yourself. Glad it's not a problem in nightly still. |
Here's a reduction that does not rely on serde (play): #![feature(nll)]
#![allow(dead_code)]
#[derive(Debug)]
struct Value;
impl Value {
fn as_array(&self) -> Option<&Vec<Value>> {
None
}
}
fn foo(val: Value) {
let _reviewers_original: Vec<Value> = match val.as_array() {
Some(array) => {
*array
}
None => vec![]
};
}
fn main() {
} |
My current hypothesis is that this was fixed by PR #52359 ; I haven't done the full bisection, I'm just basing that on skimming the log and then skimming the diff for that PR in particular |
(and I'm no longer sure this actually needs a test. PR #52359 included updates to the .nll.stderr files that make it clear that it resolved ICE's that at least look superficially similar to the one here...) |
I have confirmed that this was fixed by #52359. But I looked again as its test suite, and I'm not as convinced that this case is covered by it The test that had its stderr updated to remove an ICE was this: rust/src/test/ui/issue-20801.rs Lines 13 to 47 in d34924d
and there's enough different stuff in the test in this issue (e.g interactions with enums and match), that I am going to throw the E-needstest label back on this issue. |
Deferred, so removing from milestone |
…t, r=estebank regression test for move out of borrow via pattern regression test for issue rust-lang#54597. (We may have other tests that cover this, but I couldn't immediately find them associated with the PR that originally fixed the ICE here.)
Oh this was resolved by #55090. |
CODE:
message_json is a serde_json object
The code may very well be wrong, but I don't expect the compiler to panic.
May or may not be helpful:
A very long panic message
The text was updated successfully, but these errors were encountered: