fix tests to handle the Typeof bodies
This commit is contained in:
parent
f704ef5ff7
commit
d572aa2fd4
|
@ -259,6 +259,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
|
|||
TyKind::ImplTrait(..) => {
|
||||
self.create_def(ty.id, DefPathData::ImplTrait);
|
||||
}
|
||||
TyKind::Typeof(ref expr) => self.visit_ast_const_integer(expr),
|
||||
_ => {}
|
||||
}
|
||||
visit::walk_ty(self, ty);
|
||||
|
|
|
@ -260,7 +260,9 @@ pub enum DefPathData {
|
|||
/// Pattern binding
|
||||
Binding(InternedString),
|
||||
/// An `impl Trait` type node.
|
||||
ImplTrait
|
||||
ImplTrait,
|
||||
/// A `typeof` type node.
|
||||
Typeof,
|
||||
}
|
||||
|
||||
impl Definitions {
|
||||
|
@ -387,7 +389,8 @@ impl DefPathData {
|
|||
ClosureExpr |
|
||||
StructCtor |
|
||||
Initializer |
|
||||
ImplTrait => None
|
||||
ImplTrait |
|
||||
Typeof => None
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -415,6 +418,7 @@ impl DefPathData {
|
|||
StructCtor => "{{constructor}}",
|
||||
Initializer => "{{initializer}}",
|
||||
ImplTrait => "{{impl-Trait}}",
|
||||
Typeof => "{{typeof}}",
|
||||
};
|
||||
|
||||
Symbol::intern(s).as_str()
|
||||
|
|
|
@ -180,7 +180,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
data @ DefPathData::MacroDef(..) |
|
||||
data @ DefPathData::ClosureExpr |
|
||||
data @ DefPathData::Binding(..) |
|
||||
data @ DefPathData::ImplTrait => {
|
||||
data @ DefPathData::ImplTrait |
|
||||
data @ DefPathData::Typeof => {
|
||||
let parent_def_id = self.parent_def_id(def_id).unwrap();
|
||||
self.push_item_path(buffer, parent_def_id);
|
||||
buffer.push(&data.as_interned_str());
|
||||
|
|
|
@ -1147,6 +1147,7 @@ fn ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
|
||||
NodeExpr(_) => match tcx.hir.get(tcx.hir.get_parent_node(node_id)) {
|
||||
NodeTy(&hir::Ty { node: TyArray(_, body), .. }) |
|
||||
NodeTy(&hir::Ty { node: TyTypeof(body), .. }) |
|
||||
NodeExpr(&hir::Expr { node: ExprRepeat(_, body), .. })
|
||||
if body.node_id == node_id => tcx.types.usize,
|
||||
|
||||
|
|
Loading…
Reference in New Issue