Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/add_missing_impl_members.rs')
-rw-r--r--crates/ide-assists/src/handlers/add_missing_impl_members.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/crates/ide-assists/src/handlers/add_missing_impl_members.rs b/crates/ide-assists/src/handlers/add_missing_impl_members.rs
index 7f8ea44fb1..57df39d541 100644
--- a/crates/ide-assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/ide-assists/src/handlers/add_missing_impl_members.rs
@@ -2318,4 +2318,49 @@ impl<'a> Test<'a, i32> for bool {
"#,
);
}
+
+ #[test]
+ fn issue_17321() {
+ check_assist(
+ add_missing_impl_members,
+ r#"
+fn main() {}
+
+mod other_file_1 {
+ pub const SOME_CONSTANT: usize = 8;
+}
+
+mod other_file_2 {
+ use crate::other_file_1::SOME_CONSTANT;
+
+ pub trait Trait {
+ type Iter: Iterator<Item = [u8; SOME_CONSTANT]>;
+ }
+}
+
+pub struct MyStruct;
+
+impl other_file_2::Trait for MyStruct$0 {}"#,
+ r#"
+fn main() {}
+
+mod other_file_1 {
+ pub const SOME_CONSTANT: usize = 8;
+}
+
+mod other_file_2 {
+ use crate::other_file_1::SOME_CONSTANT;
+
+ pub trait Trait {
+ type Iter: Iterator<Item = [u8; SOME_CONSTANT]>;
+ }
+}
+
+pub struct MyStruct;
+
+impl other_file_2::Trait for MyStruct {
+ $0type Iter;
+}"#,
+ );
+ }
}