Skip to content

Commit

Permalink
Fix issue in conv with higher-ranked associated type constraints (#978)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilehmann authored Jan 29, 2025
1 parent 3b9ea96 commit 34df96b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 4 additions & 6 deletions crates/flux-fhir-analysis/src/conv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,14 +964,10 @@ impl<'genv, 'tcx: 'genv, P: ConvPhase<'genv, 'tcx>> ConvCtxt<P> {
.into()];
self.conv_generic_args_into(env, trait_id, trait_segment, &mut args)?;

env.pop_layer();
let vars = generic_params
.iter()
.map(|param| self.param_as_bound_var(param))
.try_collect_vec()?;
let vars = env.top_layer().to_bound_vars(self.genv())?;
let poly_trait_ref = rty::Binder::bind_with_vars(
rty::TraitRef { def_id: trait_id, args: args.into() },
List::from_vec(vars),
vars,
);

clauses.push(
Expand All @@ -987,6 +983,8 @@ impl<'genv, 'tcx: 'genv, P: ConvPhase<'genv, 'tcx>> ConvCtxt<P> {
self.conv_assoc_item_constraint(env, &poly_trait_ref, cstr, clauses)?;
}

env.pop_layer();

Ok(())
}

Expand Down
2 changes: 2 additions & 0 deletions tests/tests/pos/surface/issue-977.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Testing conversion of higher-ranked associated type constraint
pub fn map<F: FnOnce(&i32) -> &i32>(f: F) {}

0 comments on commit 34df96b

Please sign in to comment.