diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-30 17:45:05 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-30 17:45:05 +0100 |
commit | fd7c454d516e3af90d8c0d0d8a22655345fec2d7 (patch) | |
tree | 6e5292a731c7039d92c636bc66a27714845ffb1c /crates/ide/src | |
parent | 277db63a08d9910ffbcf1eded723c176941feff1 (diff) | |
parent | b4bb7743810b1e6ac8b897a465c430e9ed8d5c44 (diff) |
Merge #8186
8186: Lower traits to `TraitRef` instead of `TypeRef` r=matklad a=Veykril
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/doc_links.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/hover.rs | 6 | ||||
-rw-r--r-- | crates/ide/src/references/rename.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/runnables.rs | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 99276168f..67e2e5a1c 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs | |||
@@ -237,7 +237,7 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option<String> { | |||
237 | .and_then(|assoc| match assoc.container(db) { | 237 | .and_then(|assoc| match assoc.container(db) { |
238 | AssocItemContainer::Trait(t) => Some(t.into()), | 238 | AssocItemContainer::Trait(t) => Some(t.into()), |
239 | AssocItemContainer::Impl(impld) => { | 239 | AssocItemContainer::Impl(impld) => { |
240 | impld.target_ty(db).as_adt().map(|adt| adt.into()) | 240 | impld.self_ty(db).as_adt().map(|adt| adt.into()) |
241 | } | 241 | } |
242 | }) | 242 | }) |
243 | .unwrap_or_else(|| f.clone().into()), | 243 | .unwrap_or_else(|| f.clone().into()), |
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 02a1a5b37..7e35a1450 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -195,7 +195,7 @@ fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<Hov | |||
195 | let adt = match def { | 195 | let adt = match def { |
196 | Definition::ModuleDef(ModuleDef::Trait(it)) => return it.try_to_nav(db).map(to_action), | 196 | Definition::ModuleDef(ModuleDef::Trait(it)) => return it.try_to_nav(db).map(to_action), |
197 | Definition::ModuleDef(ModuleDef::Adt(it)) => Some(it), | 197 | Definition::ModuleDef(ModuleDef::Adt(it)) => Some(it), |
198 | Definition::SelfType(it) => it.target_ty(db).as_adt(), | 198 | Definition::SelfType(it) => it.self_ty(db).as_adt(), |
199 | _ => None, | 199 | _ => None, |
200 | }?; | 200 | }?; |
201 | adt.try_to_nav(db).map(to_action) | 201 | adt.try_to_nav(db).map(to_action) |
@@ -318,7 +318,7 @@ fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option<String> | |||
318 | Definition::ModuleDef(md) => match md { | 318 | Definition::ModuleDef(md) => match md { |
319 | ModuleDef::Function(f) => match f.as_assoc_item(db)?.container(db) { | 319 | ModuleDef::Function(f) => match f.as_assoc_item(db)?.container(db) { |
320 | AssocItemContainer::Trait(t) => Some(t.name(db)), | 320 | AssocItemContainer::Trait(t) => Some(t.name(db)), |
321 | AssocItemContainer::Impl(i) => i.target_ty(db).as_adt().map(|adt| adt.name(db)), | 321 | AssocItemContainer::Impl(i) => i.self_ty(db).as_adt().map(|adt| adt.name(db)), |
322 | }, | 322 | }, |
323 | ModuleDef::Variant(e) => Some(e.parent_enum(db).name(db)), | 323 | ModuleDef::Variant(e) => Some(e.parent_enum(db).name(db)), |
324 | _ => None, | 324 | _ => None, |
@@ -376,7 +376,7 @@ fn hover_for_definition( | |||
376 | }, | 376 | }, |
377 | Definition::Local(it) => hover_for_local(it, db), | 377 | Definition::Local(it) => hover_for_local(it, db), |
378 | Definition::SelfType(impl_def) => { | 378 | Definition::SelfType(impl_def) => { |
379 | impl_def.target_ty(db).as_adt().and_then(|adt| from_hir_fmt(db, adt, mod_path)) | 379 | impl_def.self_ty(db).as_adt().and_then(|adt| from_hir_fmt(db, adt, mod_path)) |
380 | } | 380 | } |
381 | Definition::GenericParam(it) => from_hir_fmt(db, it, None), | 381 | Definition::GenericParam(it) => from_hir_fmt(db, it, None), |
382 | Definition::Label(it) => Some(Markup::fenced_block(&it.name(db))), | 382 | Definition::Label(it) => Some(Markup::fenced_block(&it.name(db))), |
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 26d6dc9c9..98456967a 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -307,7 +307,7 @@ fn rename_to_self(sema: &Semantics<RootDatabase>, local: hir::Local) -> RenameRe | |||
307 | hir::AssocItemContainer::Impl(impl_) => impl_, | 307 | hir::AssocItemContainer::Impl(impl_) => impl_, |
308 | }; | 308 | }; |
309 | let first_param_ty = first_param.ty(); | 309 | let first_param_ty = first_param.ty(); |
310 | let impl_ty = impl_.target_ty(sema.db); | 310 | let impl_ty = impl_.self_ty(sema.db); |
311 | let (ty, self_param) = if impl_ty.remove_ref().is_some() { | 311 | let (ty, self_param) = if impl_ty.remove_ref().is_some() { |
312 | // if the impl is a ref to the type we can just match the `&T` with self directly | 312 | // if the impl is a ref to the type we can just match the `&T` with self directly |
313 | (first_param_ty.clone(), "self") | 313 | (first_param_ty.clone(), "self") |
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 7e4c5a078..11bd385bb 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs | |||
@@ -298,7 +298,7 @@ fn module_def_doctest(sema: &Semantics<RootDatabase>, def: hir::ModuleDef) -> Op | |||
298 | // FIXME: this also looks very wrong | 298 | // FIXME: this also looks very wrong |
299 | if let Some(assoc_def) = assoc_def { | 299 | if let Some(assoc_def) = assoc_def { |
300 | if let hir::AssocItemContainer::Impl(imp) = assoc_def.container(sema.db) { | 300 | if let hir::AssocItemContainer::Impl(imp) = assoc_def.container(sema.db) { |
301 | let ty = imp.target_ty(sema.db); | 301 | let ty = imp.self_ty(sema.db); |
302 | if let Some(adt) = ty.as_adt() { | 302 | if let Some(adt) = ty.as_adt() { |
303 | let name = adt.name(sema.db); | 303 | let name = adt.name(sema.db); |
304 | let idx = path.rfind(':').map_or(0, |idx| idx + 1); | 304 | let idx = path.rfind(':').map_or(0, |idx| idx + 1); |