mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-28 13:46:03 +00:00

- linked-list cursor-like patterns - issue-46589 These are known-bugs for the polonius alpha, where they show the same imprecision as NLLs, but are supported by the old datalog implementation.
33 lines
669 B
Rust
33 lines
669 B
Rust
//@ ignore-compare-mode-polonius (explicit revisions)
|
|
//@ revisions: nll polonius legacy
|
|
//@ [nll] known-bug: #46589
|
|
//@ [polonius] known-bug: #46589
|
|
//@ [polonius] compile-flags: -Zpolonius=next
|
|
//@ [legacy] check-pass
|
|
//@ [legacy] compile-flags: -Zpolonius=legacy
|
|
|
|
struct Foo;
|
|
|
|
impl Foo {
|
|
fn get_self(&mut self) -> Option<&mut Self> {
|
|
Some(self)
|
|
}
|
|
|
|
fn new_self(&mut self) -> &mut Self {
|
|
self
|
|
}
|
|
|
|
fn trigger_bug(&mut self) {
|
|
let other = &mut (&mut *self);
|
|
|
|
*other = match (*other).get_self() {
|
|
Some(s) => s,
|
|
None => (*other).new_self()
|
|
};
|
|
|
|
let c = other;
|
|
}
|
|
}
|
|
|
|
fn main() {}
|