mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Merge #10795
10795: Remove unwrap in doc path resolution r=Veykril a=udoprog I keep hitting this constantly in my project, and I haven't dug very deep into the root cause. But seeing as the project otherwise compiles it appears to be something unsupported is being incorrectly parsed in rust-analyzer which for other cases is handled by returning `None`. Co-authored-by: John-John Tedro <udoprog@tedro.se>
This commit is contained in:
commit
b844d453b2
@ -147,7 +147,7 @@ fn resolve_doc_path(
|
||||
AttrDefId::MacroDefId(_) => return None,
|
||||
};
|
||||
let path = ast::Path::parse(link).ok()?;
|
||||
let modpath = ModPath::from_src(db.upcast(), path, &Hygiene::new_unhygienic()).unwrap();
|
||||
let modpath = ModPath::from_src(db.upcast(), path, &Hygiene::new_unhygienic())?;
|
||||
let resolved = resolver.resolve_module_path_in_items(db.upcast(), &modpath);
|
||||
let resolved = if resolved == PerNs::none() {
|
||||
resolver.resolve_module_path_in_trait_assoc_items(db.upcast(), &modpath)?
|
||||
|
Loading…
Reference in New Issue
Block a user