mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
failing test for a reference local
This commit is contained in:
parent
cd5ad4e500
commit
4c1a1b2570
1 changed files with 66 additions and 0 deletions
|
@ -1134,6 +1134,72 @@ struct S {
|
||||||
fn foo(s: S) {
|
fn foo(s: S) {
|
||||||
let $0x = s.sub;
|
let $0x = s.sub;
|
||||||
x.do_thing();
|
x.do_thing();
|
||||||
|
}"#,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_extract_var_reference_local() {
|
||||||
|
check_assist(
|
||||||
|
extract_variable,
|
||||||
|
r#"
|
||||||
|
struct X;
|
||||||
|
|
||||||
|
struct S {
|
||||||
|
sub: X
|
||||||
|
}
|
||||||
|
|
||||||
|
impl S {
|
||||||
|
fn new() -> S {
|
||||||
|
S {
|
||||||
|
sub: X::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl X {
|
||||||
|
fn new() -> X {
|
||||||
|
X { }
|
||||||
|
}
|
||||||
|
fn do_thing(&self) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn foo() {
|
||||||
|
let local = &mut S::new();
|
||||||
|
$0local.sub$0.do_thing();
|
||||||
|
}"#,
|
||||||
|
r#"
|
||||||
|
struct X;
|
||||||
|
|
||||||
|
struct S {
|
||||||
|
sub: X
|
||||||
|
}
|
||||||
|
|
||||||
|
impl S {
|
||||||
|
fn new() -> S {
|
||||||
|
S {
|
||||||
|
sub: X::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl X {
|
||||||
|
fn new() -> X {
|
||||||
|
X { }
|
||||||
|
}
|
||||||
|
fn do_thing(&self) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn foo() {
|
||||||
|
let local = &mut S::new();
|
||||||
|
let $0x = local.sub;
|
||||||
|
x.do_thing();
|
||||||
}"#,
|
}"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue