-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Panic in nightly rustc when compiling code that tries to borrow *v as mutable behind & reference #82032
Comments
It would be nice to reproduce this without the async-std dependency. |
Slightly smaller: use async_std::{fs, io, prelude::*};
type Handle = io::BufWriter<fs::File>;
async fn die_horribly(thing: &[Handle]) {
for v in thing {
v.flush().await;
}
}
fn main() {} |
I bisected far enough to find it regressed between the 9th and 10th, then ran out of disk space 🤦
|
pub struct Handle {}
impl Handle {
async fn flush(&mut self) {}
}
async fn die_horribly(thing: &[Handle]) {
for v in thing {
v.flush().await;
}
} Smaller example without |
Here you go. The async part doesn't seem important and the issue still occurs with the use std::{fs, io::*};
use std::collections::HashMap;
type Handle = BufWriter<fs::File>;
struct Thing(HashMap<String, Handle>);
impl Thing {
pub fn die_horribly(&mut self) {
for v in self.0.values() {
v.flush();
}
}
}
fn main() {
} It could probably be reduced in size further but I'm not much of a Rust expert. I suspect anything which triggers that particular compiler error would do the trick. |
searched nightlies: from nightly-2021-02-10 to nightly-2021-02-11 bisected with cargo-bisect-rustc v0.6.0Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --preserve --regress ice --start 2021-02-10 --end 2021-02-11 |
Are edit: nvm just saw that someone posted a non-async example |
Rollup of 11 pull requests Successful merges: - rust-lang#80523 (#[doc(inline)] sym_generated) - rust-lang#80920 (Visit more targets when validating attributes) - rust-lang#81720 (Updated smallvec version due to RUSTSEC-2021-0003) - rust-lang#81891 ([rustdoc-json] Make `header` a vec of modifiers, and FunctionPointer consistent) - rust-lang#81912 (Implement the precise analysis pass for lint `disjoint_capture_drop_reorder`) - rust-lang#81914 (Fixing bad suggestion for `_` in `const` type when a function rust-lang#81885) - rust-lang#81919 (BTreeMap: fix internal comments) - rust-lang#81927 (Add a regression test for rust-lang#32498) - rust-lang#81965 (Fix MIR pretty printer for non-local DefIds) - rust-lang#82029 (Use debug log level for developer oriented logs) - rust-lang#82056 (fix ice (rust-lang#82032)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Code
Dependencies from Cargo.toml
Meta
rustc --version --verbose
:The internal compiler error does not occur in stable (
rustc 1.50.0 (cb75ad5db 2021-02-10)
):The fix for compilation is to use
values_mut()
instead ofvalues()
and this also prevents the panic in the nightly version of rustc.Error output
Backtrace
The text was updated successfully, but these errors were encountered: