Skip to content

Commit 28b7460

Browse files
committed
fix negative trait bound in outline view (#14044)
1 parent f1b257f commit 28b7460

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

crates/ide/src/file_structure.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
160160
let label = match target_trait {
161161
None => format!("impl {}", target_type.syntax().text()),
162162
Some(t) => {
163-
format!("impl {} for {}", t.syntax().text(), target_type.syntax().text(),)
163+
format!("impl {}{} for {}",
164+
it.excl_token().map(|x| x.to_string()).unwrap_or_default(),
165+
t.syntax().text(),
166+
target_type.syntax().text(),)
164167
}
165168
};
166169

@@ -213,6 +216,26 @@ mod tests {
213216
expect.assert_debug_eq(&structure)
214217
}
215218

219+
#[test]
220+
fn test_nagative_trait_bound() {
221+
let txt = r#"impl !Unpin for Test {}"#;
222+
check(txt, expect![[r#"
223+
[
224+
StructureNode {
225+
parent: None,
226+
label: "impl !Unpin for Test",
227+
navigation_range: 16..20,
228+
node_range: 0..23,
229+
kind: SymbolKind(
230+
Impl,
231+
),
232+
detail: None,
233+
deprecated: false,
234+
},
235+
]
236+
"#]]);
237+
}
238+
216239
#[test]
217240
fn test_file_structure() {
218241
check(

0 commit comments

Comments
 (0)