-
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
Polonius (but not ordinary NLL) accepts code which segfaults #53142
Comments
Removing the soundness label until further details are provided. |
I suggest we close this bug. The problem basically roots in this file: https://github.com/bhuztez/porus/blob/5a733ac564146f20bb1b2a65ff98d3ca9234a1ab/src/ptr.rs The codebase exposes unsafe pointer operations as safe functions without any soundness check, and those "safe" operations are used to build some basic data structures, which are then used in the code in question. There is nothing Rust compiler can promise with that on soundness, because the code basically bypasses any soundness check. |
This may be a Polonius bug. Note that the project invokes rustc with Compiling these files directly on commit af6ecbc without NLL gives the following errors: ALDS1_6_B.rs
ITP1_6_A.rs
(Note: I haven't checked the source in detail whether the segfault is caused by the invalid "safe" code in #53142 (comment)) |
cc @rust-lang/wg-compiler-nll |
It sounds like it would be helpful if someone (@bhuztez, perhaps?) could try to "narrow this down" to an isolated example. I'm going to mark it as NLL-deferred for now, since Polonius is not high priority just now. |
|
compile the following code with struct X<'a, T: 'a> {
a: &'a T,
b: isize,
c: isize,
}
struct Y<'a, T: 'a> {
a: &'a T,
b: usize,
}
fn new_y<'a, T: 'a>(x: &'a T) -> Y<'a, T> {
Y {
a: x,
b: 100,
}
}
fn main() {
let a = &200isize;
let y = new_y(&X{a: a, b: 300, c:400});
let f = || { println!("{}", y.a.b); };
(|| { f() })();
} |
I think that — quite likely — the optimization work has broken polonius mode. We might consider removing it for now. |
I know some of the changes I am doing are likely to break it. =) |
[NLL] Get Polonius borrow check to work in simple cases * Restores the generation of outlives facts from subtyping. * Restore liveness facts. * Generate invalidates facts at the start point of each location, where we check for errors. * Add a small test for simple cases (previously these cases have compiled, and more recently ICEd). Closes #54212 cc #53142 (will need test) ### Known limitations * Two phase borrows aren't implemented for Polonius yet * Invalidation facts haven't been updated for some of the recent changes to make `Drop` terminators access fewer things. * Fact generation is not as optimized as it could be. * Around 30 tests fail in compare mode, often tests that are ignored in nll compare mode r? @nikomatsakis
Is this still an issue? |
I'm going to go ahead and close this as it seems likely that polonius has since changed and in any case it doesn't seem helpful to keep a bug open about it :) If anything it could be moved to the polonius repo :) |
Based on this tweet https://twitter.com/bhuztez/status/1026061344980828160.
Commit that worked around the segfault: https://github.com/bhuztez/porus/commit/d28ebdac301c0d81284bbfb93e0eb0c2d48ddb5b
@bhuztez 不知道你能不能看英语,能否提供有关这个bug的详细资料吗?
The text was updated successfully, but these errors were encountered: