Skip to content

Commit ccd142c

Browse files
committed
Auto merge of #14058 - gftea:master, r=Veykril
fix negative trait bound in outline view (#14044) try to fix and close #14044
2 parents a257a58 + fd1a9a9 commit ccd142c

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

crates/ide/src/file_structure.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ 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(),
167+
)
164168
}
165169
};
166170

@@ -213,6 +217,29 @@ mod tests {
213217
expect.assert_debug_eq(&structure)
214218
}
215219

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

0 commit comments

Comments
 (0)