Skip to content

Commit b51ab7d

Browse files
committed
Clarify impl Map for !.
All the methods are unreachable, so make that clearer.
1 parent 7ff6790 commit b51ab7d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/rustc_hir/src/intravisit.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -121,25 +121,25 @@ pub trait Map<'hir> {
121121
// Used when no map is actually available, forcing manual implementation of nested visitors.
122122
impl<'hir> Map<'hir> for ! {
123123
fn hir_node(&self, _: HirId) -> Node<'hir> {
124-
*self;
124+
unreachable!();
125125
}
126126
fn hir_node_by_def_id(&self, _: LocalDefId) -> Node<'hir> {
127127
*self;
128128
}
129129
fn body(&self, _: BodyId) -> &'hir Body<'hir> {
130-
*self;
130+
unreachable!();
131131
}
132132
fn item(&self, _: ItemId) -> &'hir Item<'hir> {
133-
*self;
133+
unreachable!();
134134
}
135135
fn trait_item(&self, _: TraitItemId) -> &'hir TraitItem<'hir> {
136-
*self;
136+
unreachable!();
137137
}
138138
fn impl_item(&self, _: ImplItemId) -> &'hir ImplItem<'hir> {
139-
*self;
139+
unreachable!();
140140
}
141141
fn foreign_item(&self, _: ForeignItemId) -> &'hir ForeignItem<'hir> {
142-
*self;
142+
unreachable!();
143143
}
144144
}
145145

@@ -203,7 +203,7 @@ use nested_filter::NestedFilter;
203203
/// to monitor future changes to `Visitor` in case a new method with a
204204
/// new default implementation gets introduced.)
205205
pub trait Visitor<'v>: Sized {
206-
// this type should not be overridden, it exists for convenient usage as `Self::Map`
206+
// This type should not be overridden, it exists for convenient usage as `Self::Map`.
207207
type Map: Map<'v> = <Self::NestedFilter as NestedFilter<'v>>::Map;
208208

209209
///////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)