-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Rust 1.19 regression, scopeguard, ICE #42463
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
Labels
regression-from-stable-to-beta
Performance or correctness regression from stable to beta.
Comments
Reduced testcase (closure satisfying use std::ops::{Deref, DerefMut};
struct CheckedDeref<T, F> {
value: T,
check: F
}
impl<F: Fn(&T) -> bool, T> Deref for CheckedDeref<T, F> {
type Target = T;
fn deref(&self) -> &T {
assert!((self.check)(&self.value));
&self.value
}
}
impl<F: Fn(&T) -> bool, T> DerefMut for CheckedDeref<T, F> {
fn deref_mut(&mut self) -> &mut T {
assert!((self.check)(&self.value));
&mut self.value
}
}
fn main() {
let mut v = CheckedDeref {
value: vec![0],
check: |v: &Vec<_>| !v.is_empty()
};
v.push(1);
assert_eq!(*v, vec![0, 1]);
} Working on a fix now. |
bors
added a commit
that referenced
this issue
Jun 7, 2017
rustc_typeck: do not overlap a borrow of TypeckTables with method lookup. If trait selection is reached, it could potentially request a closure signature, which will have to borrow the `TypeckTables` of the current function, and so those tables *should not* be mutably borrowed. Fixes #42463. r? @nikomatsakis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/bluss/scopeguard
cc @bluss
The text was updated successfully, but these errors were encountered: