Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/body/lower.rs')
-rw-r--r--crates/hir-def/src/body/lower.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/hir-def/src/body/lower.rs b/crates/hir-def/src/body/lower.rs
index c6d9ba6cfe..faba9050fc 100644
--- a/crates/hir-def/src/body/lower.rs
+++ b/crates/hir-def/src/body/lower.rs
@@ -12,6 +12,7 @@ use intern::Interned;
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
use span::AstIdMap;
+use stdx::never;
use syntax::{
ast::{
self, ArrayExprKind, AstChildren, BlockExpr, HasArgList, HasAttrs, HasLoopBody, HasName,
@@ -480,7 +481,8 @@ impl ExprCollector<'_> {
} else if e.const_token().is_some() {
Mutability::Shared
} else {
- unreachable!("parser only remaps to raw_token() if matching mutability token follows")
+ never!("parser only remaps to raw_token() if matching mutability token follows");
+ Mutability::Shared
}
} else {
Mutability::from_mutable(e.mut_token().is_some())
@@ -963,7 +965,7 @@ impl ExprCollector<'_> {
.resolve_path(
self.db,
module,
- &path,
+ path,
crate::item_scope::BuiltinShadowMode::Other,
Some(MacroSubNs::Bang),
)
@@ -1006,9 +1008,9 @@ impl ExprCollector<'_> {
Some((mark, expansion)) => {
// Keep collecting even with expansion errors so we can provide completions and
// other services in incomplete macro expressions.
- self.source_map
- .expansions
- .insert(macro_call_ptr, self.expander.current_file_id().macro_file().unwrap());
+ if let Some(macro_file) = self.expander.current_file_id().macro_file() {
+ self.source_map.expansions.insert(macro_call_ptr, macro_file);
+ }
let prev_ast_id_map = mem::replace(
&mut self.ast_id_map,
self.db.ast_id_map(self.expander.current_file_id()),