Skip to content

Commit 26316e3

Browse files
committed
Pass only GenericArgs to def_ty_with_args
1 parent ea5468b commit 26316e3

3 files changed

Lines changed: 12 additions & 17 deletions

File tree

src/analyze.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,16 @@ impl<'tcx> Analyzer<'tcx> {
241241
pub fn def_ty_with_args(
242242
&mut self,
243243
def_id: DefId,
244-
rty_args: rty::TypeArgs,
245244
generic_args: mir_ty::GenericArgsRef<'tcx>,
246245
) -> Option<rty::RefinedType> {
246+
let type_builder = TypeBuilder::new(self.tcx, def_id);
247247
let deferred_ty = match self.defs.get(&def_id)? {
248248
DefTy::Concrete(rty) => {
249249
let mut def_ty = rty.clone();
250250
def_ty.instantiate_ty_params(
251-
rty_args
252-
.clone()
253-
.into_iter()
251+
generic_args
252+
.types()
253+
.map(|ty| type_builder.build(ty))
254254
.map(rty::RefinedType::unrefined)
255255
.collect(),
256256
);
@@ -264,7 +264,6 @@ impl<'tcx> Analyzer<'tcx> {
264264
return Some(rty.clone());
265265
}
266266

267-
let type_builder = TypeBuilder::new(self.tcx, def_id);
268267
let mut analyzer = self.local_def_analyzer(def_id.as_local()?);
269268
analyzer
270269
.type_builder(type_builder)

src/analyze/basic_block.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,12 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
407407
_ty,
408408
) => {
409409
let func_ty = match operand.const_fn_def() {
410-
Some((def_id, args)) => {
411-
let rty_args: IndexVec<_, _> =
412-
args.types().map(|ty| self.type_builder.build(ty)).collect();
413-
self.ctx
414-
.def_ty_with_args(def_id, rty_args, args)
415-
.expect("unknown def")
416-
.ty
417-
.clone()
418-
}
410+
Some((def_id, args)) => self
411+
.ctx
412+
.def_ty_with_args(def_id, args)
413+
.expect("unknown def")
414+
.ty
415+
.clone(),
419416
_ => unimplemented!(),
420417
};
421418
PlaceType::with_ty_and_term(func_ty.vacuous(), chc::Term::null())
@@ -628,9 +625,8 @@ impl<'tcx, 'ctx> Analyzer<'tcx, 'ctx> {
628625
tracing::info!(?def_id, ?resolved_def_id, "resolve",);
629626
}
630627

631-
let rty_args = args.types().map(|ty| self.type_builder.build(ty)).collect();
632628
self.ctx
633-
.def_ty_with_args(resolved_def_id, rty_args, args)
629+
.def_ty_with_args(resolved_def_id, args)
634630
.expect("unknown def")
635631
.ty
636632
.vacuous()

src/rty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mod subtyping;
5555
pub use subtyping::{relate_sub_closed_type, ClauseScope, Subtyping};
5656

5757
mod params;
58-
pub use params::{RefinedTypeArgs, TypeArgs, TypeParamIdx, TypeParamSubst};
58+
pub use params::{RefinedTypeArgs, TypeParamIdx, TypeParamSubst};
5959

6060
rustc_index::newtype_index! {
6161
/// An index representing function parameter.

0 commit comments

Comments
 (0)