Use inputs/output getters for rustc::ty::FnSig instead of the now non-existent fields.
This commit is contained in:
parent
778ce4dfd3
commit
3de6f9db20
7 changed files with 7 additions and 7 deletions
|
@ -142,7 +142,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CCHelper<'a, 'tcx> {
|
||||||
let ty = self.cx.tcx.tables().node_id_to_type(callee.id);
|
let ty = self.cx.tcx.tables().node_id_to_type(callee.id);
|
||||||
match ty.sty {
|
match ty.sty {
|
||||||
ty::TyFnDef(_, _, ty) |
|
ty::TyFnDef(_, _, ty) |
|
||||||
ty::TyFnPtr(ty) if ty.sig.skip_binder().output.sty == ty::TyNever => {
|
ty::TyFnPtr(ty) if ty.sig.skip_binder().output().sty == ty::TyNever => {
|
||||||
self.divergence += 1;
|
self.divergence += 1;
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -66,7 +66,7 @@ fn check_closure(cx: &LateContext, expr: &Expr) {
|
||||||
ty::TyFnDef(_, _, fn_ty) |
|
ty::TyFnDef(_, _, fn_ty) |
|
||||||
ty::TyFnPtr(fn_ty) => {
|
ty::TyFnPtr(fn_ty) => {
|
||||||
if fn_ty.unsafety == Unsafety::Unsafe ||
|
if fn_ty.unsafety == Unsafety::Unsafe ||
|
||||||
fn_ty.sig.skip_binder().output.sty == ty::TyNever {
|
fn_ty.sig.skip_binder().output().sty == ty::TyNever {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
|
||||||
ExprRet(_) => self.report_diverging_sub_expr(e),
|
ExprRet(_) => self.report_diverging_sub_expr(e),
|
||||||
ExprCall(ref func, _) => match self.cx.tcx.tables().expr_ty(func).sty {
|
ExprCall(ref func, _) => match self.cx.tcx.tables().expr_ty(func).sty {
|
||||||
ty::TyFnDef(_, _, fn_ty) |
|
ty::TyFnDef(_, _, fn_ty) |
|
||||||
ty::TyFnPtr(fn_ty) => if let ty::TyNever = self.cx.tcx.erase_late_bound_regions(&fn_ty.sig).output.sty {
|
ty::TyFnPtr(fn_ty) => if let ty::TyNever = self.cx.tcx.erase_late_bound_regions(&fn_ty.sig).output().sty {
|
||||||
self.report_diverging_sub_expr(e);
|
self.report_diverging_sub_expr(e);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
|
|
@ -188,7 +188,7 @@ fn has_is_empty(cx: &LateContext, expr: &Expr) -> bool {
|
||||||
if let ty::AssociatedKind::Method = item.kind {
|
if let ty::AssociatedKind::Method = item.kind {
|
||||||
if &*item.name.as_str() == "is_empty" {
|
if &*item.name.as_str() == "is_empty" {
|
||||||
let ty = cx.tcx.item_type(item.def_id).fn_sig().skip_binder();
|
let ty = cx.tcx.item_type(item.def_id).fn_sig().skip_binder();
|
||||||
ty.inputs.len() == 1
|
ty.inputs().len() == 1
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ fn check_arguments(cx: &LateContext, arguments: &[Expr], type_definition: &TyS,
|
||||||
match type_definition.sty {
|
match type_definition.sty {
|
||||||
TypeVariants::TyFnDef(_, _, fn_type) |
|
TypeVariants::TyFnDef(_, _, fn_type) |
|
||||||
TypeVariants::TyFnPtr(fn_type) => {
|
TypeVariants::TyFnPtr(fn_type) => {
|
||||||
let parameters = &fn_type.sig.skip_binder().inputs;
|
let parameters = fn_type.sig.skip_binder().inputs();
|
||||||
for (argument, parameter) in arguments.iter().zip(parameters.iter()) {
|
for (argument, parameter) in arguments.iter().zip(parameters.iter()) {
|
||||||
match parameter.sty {
|
match parameter.sty {
|
||||||
TypeVariants::TyRef(_, TypeAndMut { mutbl: MutImmutable, .. }) |
|
TypeVariants::TyRef(_, TypeAndMut { mutbl: MutImmutable, .. }) |
|
||||||
|
|
|
@ -94,7 +94,7 @@ fn check_fn(cx: &LateContext, decl: &FnDecl, fn_id: NodeId) {
|
||||||
let fn_def_id = cx.tcx.map.local_def_id(fn_id);
|
let fn_def_id = cx.tcx.map.local_def_id(fn_id);
|
||||||
let fn_ty = cx.tcx.item_type(fn_def_id).fn_sig().skip_binder();
|
let fn_ty = cx.tcx.item_type(fn_def_id).fn_sig().skip_binder();
|
||||||
|
|
||||||
for (arg, ty) in decl.inputs.iter().zip(&fn_ty.inputs) {
|
for (arg, ty) in decl.inputs.iter().zip(fn_ty.inputs()) {
|
||||||
if let ty::TyRef(_, ty::TypeAndMut { ty, mutbl: MutImmutable }) = ty.sty {
|
if let ty::TyRef(_, ty::TypeAndMut { ty, mutbl: MutImmutable }) = ty.sty {
|
||||||
if match_type(cx, ty, &paths::VEC) {
|
if match_type(cx, ty, &paths::VEC) {
|
||||||
span_lint(cx,
|
span_lint(cx,
|
||||||
|
|
|
@ -751,7 +751,7 @@ pub fn return_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, fn_item: NodeId) -> ty::T
|
||||||
let fn_def_id = cx.tcx.map.local_def_id(fn_item);
|
let fn_def_id = cx.tcx.map.local_def_id(fn_item);
|
||||||
let fn_sig = cx.tcx.item_type(fn_def_id).fn_sig();
|
let fn_sig = cx.tcx.item_type(fn_def_id).fn_sig();
|
||||||
let fn_sig = cx.tcx.liberate_late_bound_regions(parameter_env.free_id_outlive, fn_sig);
|
let fn_sig = cx.tcx.liberate_late_bound_regions(parameter_env.free_id_outlive, fn_sig);
|
||||||
fn_sig.output
|
fn_sig.output()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if two types are the same.
|
/// Check if two types are the same.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue