FIx ICE on wf check for foreign fns
This commit is contained in:
parent
507bff92fa
commit
7008911080
4 changed files with 50 additions and 1 deletions
|
@ -153,6 +153,7 @@ fn msg_span_from_early_bound_and_free_regions(
|
|||
Some(Node::Item(it)) => item_scope_tag(&it),
|
||||
Some(Node::TraitItem(it)) => trait_item_scope_tag(&it),
|
||||
Some(Node::ImplItem(it)) => impl_item_scope_tag(&it),
|
||||
Some(Node::ForeignItem(it)) => foreign_item_scope_tag(&it),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let (prefix, span) = match *region {
|
||||
|
@ -233,6 +234,13 @@ fn impl_item_scope_tag(item: &hir::ImplItem<'_>) -> &'static str {
|
|||
}
|
||||
}
|
||||
|
||||
fn foreign_item_scope_tag(item: &hir::ForeignItem<'_>) -> &'static str {
|
||||
match item.kind {
|
||||
hir::ForeignItemKind::Fn(..) => "method body",
|
||||
hir::ForeignItemKind::Static(..) | hir::ForeignItemKind::Type => "associated item",
|
||||
}
|
||||
}
|
||||
|
||||
fn explain_span(tcx: TyCtxt<'tcx>, heading: &str, span: Span) -> (String, Option<Span>) {
|
||||
let lo = tcx.sess.source_map().lookup_char_pos(span.lo());
|
||||
(format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize() + 1), Some(span))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue