mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Auto merge of #14185 - anergictcell:fix_14142, r=HKalbasi
Fix: Run doctests for structs with lifetime parameters from IDE Fixes #14142: Doctests can't be triggered for structs with lifetimes This MR adds lifetime parameters to the structs path for runnables so that they can be triggered from an IDE as well. This is my first MR for rust-analyzer, please let me know if I should change something, either in code or the description here.
This commit is contained in:
commit
c386316fe0
3 changed files with 370 additions and 10 deletions
|
@ -459,6 +459,13 @@ impl Resolver {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn generic_params(&self) -> Option<&Interned<GenericParams>> {
|
||||
self.scopes().find_map(|scope| match scope {
|
||||
Scope::GenericParams { params, .. } => Some(params),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn body_owner(&self) -> Option<DefWithBodyId> {
|
||||
self.scopes().find_map(|scope| match scope {
|
||||
Scope::ExprScope(it) => Some(it.owner),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue