use crate::check::{callee, FnCtxt, Needs, PlaceOp};
use crate::hir::def_id::DefId;
use crate::hir::GenericArg;
-use rustc::infer::{self, InferOk};
-use rustc::traits;
use rustc::ty::adjustment::{Adjust, Adjustment, OverloadedDeref, PointerCast};
use rustc::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
use rustc::ty::fold::TypeFoldable;
use rustc::ty::subst::{Subst, SubstsRef};
use rustc::ty::{self, GenericParamDefKind, Ty};
use rustc_hir as hir;
+use rustc_infer::infer::{self, InferOk};
+use rustc_infer::traits;
use rustc_span::Span;
use std::ops::Deref;
// If they were not explicitly supplied, just construct fresh
// variables.
let generics = self.tcx.generics_of(pick.item.def_id);
- AstConv::check_generic_arg_count_for_call(
+ let arg_count_mismatch = AstConv::check_generic_arg_count_for_call(
self.tcx, self.span, &generics, &seg, true, // `is_method_call`
);
parent_substs,
false,
None,
+ arg_count_mismatch,
// Provide the generic args, and whether types should be inferred.
- |_| {
- // The last argument of the returned tuple here is unimportant.
- if let Some(ref data) = seg.args { (Some(data), false) } else { (None, false) }
+ |def_id| {
+ // The last component of the returned tuple here is unimportant.
+ if def_id == pick.item.def_id {
+ if let Some(ref data) = seg.args {
+ return (Some(data), false);
+ }
+ }
+ (None, false)
},
// Provide substitutions for parameters for which (valid) arguments have been provided.
|param, arg| match (¶m.kind, arg) {