mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Add associated type test.
This commit is contained in:
parent
283ec13fc0
commit
d4e75312ba
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@ -120,6 +120,12 @@
|
|||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"outFiles": [ "${workspaceFolder}/editors/code/out/tests/unit/**/*.js" ],
|
"outFiles": [ "${workspaceFolder}/editors/code/out/tests/unit/**/*.js" ],
|
||||||
"preLaunchTask": "Pretest"
|
"preLaunchTask": "Pretest"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"name": "(Windows) Attach",
|
||||||
|
"type": "cppvsdbg",
|
||||||
|
"request": "attach",
|
||||||
|
"processId": "${command:pickProcess}"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ members = [ "crates/*", "xtask/" ]
|
|||||||
[profile.dev]
|
[profile.dev]
|
||||||
# disabling debug info speeds up builds a bunch,
|
# disabling debug info speeds up builds a bunch,
|
||||||
# and we don't rely on it for debugging that much.
|
# and we don't rely on it for debugging that much.
|
||||||
debug = 0
|
debug = 2
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
incremental = true
|
incremental = true
|
||||||
|
@ -2080,4 +2080,61 @@ fn func(foo: i32) { if true { <|>foo; }; }
|
|||||||
]
|
]
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_hover_associated_type_has_goto_type_action() {
|
||||||
|
let (_, actions) = check_hover_result(
|
||||||
|
"
|
||||||
|
//- /main.rs
|
||||||
|
trait Foo {
|
||||||
|
type Item;
|
||||||
|
fn get(self) -> Self::Item {}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Bar{}
|
||||||
|
struct S{}
|
||||||
|
|
||||||
|
impl Foo for S{
|
||||||
|
type Item = Bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test() -> impl Foo {
|
||||||
|
S{}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let s<|>t = test().get();
|
||||||
|
}
|
||||||
|
",
|
||||||
|
&["Foo::Item<impl Foo>"],
|
||||||
|
);
|
||||||
|
assert_debug_snapshot!(actions,
|
||||||
|
@r###"
|
||||||
|
[
|
||||||
|
GoToType(
|
||||||
|
[
|
||||||
|
HoverGotoTypeData {
|
||||||
|
mod_path: "Foo",
|
||||||
|
nav: NavigationTarget {
|
||||||
|
file_id: FileId(
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
full_range: 0..62,
|
||||||
|
name: "Foo",
|
||||||
|
kind: TRAIT_DEF,
|
||||||
|
focus_range: Some(
|
||||||
|
6..9,
|
||||||
|
),
|
||||||
|
container_name: None,
|
||||||
|
description: Some(
|
||||||
|
"trait Foo",
|
||||||
|
),
|
||||||
|
docs: None,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
|
"###);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user