aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/doc_links.rs6
-rw-r--r--crates/ide/src/hover.rs20
-rw-r--r--crates/ide/src/inlay_hints.rs4
3 files changed, 26 insertions, 4 deletions
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index 320694a17..ec3828ab2 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -286,7 +286,7 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option<String> {
286 .and_then( 286 .and_then(
287 |url| if let Some(fragment) = fragment { url.join(&fragment).ok() } else { Some(url) }, 287 |url| if let Some(fragment) = fragment { url.join(&fragment).ok() } else { Some(url) },
288 ) 288 )
289 .map(|url| url.into_string()) 289 .map(|url| url.into())
290} 290}
291 291
292fn rewrite_intra_doc_link( 292fn rewrite_intra_doc_link(
@@ -325,7 +325,7 @@ fn rewrite_intra_doc_link(
325 }; 325 };
326 } 326 }
327 327
328 Some((new_url.into_string(), strip_prefixes_suffixes(title).to_string())) 328 Some((new_url.into(), strip_prefixes_suffixes(title).to_string()))
329} 329}
330 330
331/// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`). 331/// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`).
@@ -345,7 +345,7 @@ fn rewrite_url_link(db: &RootDatabase, def: ModuleDef, target: &str) -> Option<S
345 get_symbol_filename(db, &def).as_deref().map(|f| url.join(f).ok()).flatten() 345 get_symbol_filename(db, &def).as_deref().map(|f| url.join(f).ok()).flatten()
346 }) 346 })
347 .and_then(|url| url.join(target).ok()) 347 .and_then(|url| url.join(target).ok())
348 .map(|url| url.into_string()) 348 .map(|url| url.into())
349} 349}
350 350
351/// Rewrites a markdown document, applying 'callback' to each link. 351/// Rewrites a markdown document, applying 'callback' to each link.
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 9de653739..04598cd06 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -3957,4 +3957,24 @@ mod string {
3957 "#]], 3957 "#]],
3958 ) 3958 )
3959 } 3959 }
3960
3961 #[test]
3962 fn function_doesnt_shadow_crate_in_use_tree() {
3963 check(
3964 r#"
3965//- /main.rs crate:main deps:foo
3966use foo$0::{foo};
3967
3968//- /foo.rs crate:foo
3969pub fn foo() {}
3970"#,
3971 expect![[r#"
3972 *foo*
3973
3974 ```rust
3975 extern crate foo
3976 ```
3977 "#]],
3978 )
3979 }
3960} 3980}
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs
index 0ada3f92b..85f887737 100644
--- a/crates/ide/src/inlay_hints.rs
+++ b/crates/ide/src/inlay_hints.rs
@@ -225,8 +225,10 @@ fn hint_iterator(
225 } 225 }
226 let iter_trait = famous_defs.core_iter_Iterator()?; 226 let iter_trait = famous_defs.core_iter_Iterator()?;
227 let iter_mod = famous_defs.core_iter()?; 227 let iter_mod = famous_defs.core_iter()?;
228 // assert this struct comes from `core::iter` 228
229 // Assert that this struct comes from `core::iter`.
229 iter_mod.visibility_of(db, &strukt.into()).filter(|&vis| vis == hir::Visibility::Public)?; 230 iter_mod.visibility_of(db, &strukt.into()).filter(|&vis| vis == hir::Visibility::Public)?;
231
230 if ty.impls_trait(db, iter_trait, &[]) { 232 if ty.impls_trait(db, iter_trait, &[]) {
231 let assoc_type_item = iter_trait.items(db).into_iter().find_map(|item| match item { 233 let assoc_type_item = iter_trait.items(db).into_iter().find_map(|item| match item {
232 hir::AssocItem::TypeAlias(alias) if alias.name(db) == known::Item => Some(alias), 234 hir::AssocItem::TypeAlias(alias) if alias.name(db) == known::Item => Some(alias),