1
Fork 0

Use inputs/output getters for rustc::ty::FnSig instead of the now non-existent fields.

This commit is contained in:
Arnavion 2016-12-10 23:57:19 -08:00
parent 778ce4dfd3
commit 3de6f9db20
7 changed files with 7 additions and 7 deletions

View file

@ -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);
match ty.sty {
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;
}
_ => (),

View file

@ -66,7 +66,7 @@ fn check_closure(cx: &LateContext, expr: &Expr) {
ty::TyFnDef(_, _, fn_ty) |
ty::TyFnPtr(fn_ty) => {
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;
}
}

View file

@ -132,7 +132,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
ExprRet(_) => self.report_diverging_sub_expr(e),
ExprCall(ref func, _) => match self.cx.tcx.tables().expr_ty(func).sty {
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);
},
_ => {},

View file

@ -188,7 +188,7 @@ fn has_is_empty(cx: &LateContext, expr: &Expr) -> bool {
if let ty::AssociatedKind::Method = item.kind {
if &*item.name.as_str() == "is_empty" {
let ty = cx.tcx.item_type(item.def_id).fn_sig().skip_binder();
ty.inputs.len() == 1
ty.inputs().len() == 1
} else {
false
}

View file

@ -60,7 +60,7 @@ fn check_arguments(cx: &LateContext, arguments: &[Expr], type_definition: &TyS,
match type_definition.sty {
TypeVariants::TyFnDef(_, _, 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()) {
match parameter.sty {
TypeVariants::TyRef(_, TypeAndMut { mutbl: MutImmutable, .. }) |

View file

@ -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_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 match_type(cx, ty, &paths::VEC) {
span_lint(cx,

View file

@ -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_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);
fn_sig.output
fn_sig.output()
}
/// Check if two types are the same.