mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Add macros for known names and paths
This commit is contained in:
parent
169fe4932f
commit
259c42f00e
16 changed files with 185 additions and 166 deletions
|
@ -6,7 +6,7 @@ use std::sync::Arc;
|
|||
|
||||
use either::Either;
|
||||
use hir_expand::{
|
||||
name::{self, AsName, Name},
|
||||
name::{AsName, Name, N},
|
||||
InFile,
|
||||
};
|
||||
use ra_arena::{map::ArenaMap, Arena};
|
||||
|
@ -90,11 +90,11 @@ impl GenericParams {
|
|||
|
||||
// traits get the Self type as an implicit first type parameter
|
||||
let self_param_id =
|
||||
generics.types.alloc(TypeParamData { name: name::SELF_TYPE, default: None });
|
||||
generics.types.alloc(TypeParamData { name: N![Self], default: None });
|
||||
sm.insert(self_param_id, Either::Left(src.value.clone()));
|
||||
// add super traits as bounds on Self
|
||||
// i.e., trait Foo: Bar is equivalent to trait Foo where Self: Bar
|
||||
let self_param = TypeRef::Path(name::SELF_TYPE.into());
|
||||
let self_param = TypeRef::Path(N![Self].into());
|
||||
generics.fill_bounds(&src.value, self_param);
|
||||
|
||||
generics.fill(&mut sm, &src.value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue