Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend) Only include direct parent bounds for associated types in traits. #1193

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions frontend/exporter/src/types/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,10 +840,15 @@ fn region_bounds_at_current_owner<'tcx, S: UnderOwnerState<'tcx>>(s: &S) -> Gene
};

let clauses: Vec<ty::Clause<'tcx>> = if use_item_bounds {
tcx.item_bounds(s.owner_id())
tcx.explicit_item_bounds(s.owner_id())
.map_bound(|clauses| {
clauses
.iter()
.map(|(x, _span)| x)
.copied()
.collect::<Vec<_>>()
})
.instantiate_identity()
.iter()
.collect()
} else {
predicates_defined_on(tcx, s.owner_id())
.predicates
Expand Down
11 changes: 5 additions & 6 deletions test-harness/src/snapshots/toolchain__traits into-fstar.snap
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,6 @@ let use_impl_trait (_: Prims.unit) : Prims.unit =
class t_Foo (v_Self: Type0) = {
f_AssocType:Type0;
f_AssocType_15012754260415912210:t_SuperTrait f_AssocType;
f_AssocType_3242921639065184873:Core.Clone.t_Clone f_AssocType;
f_N:usize;
f_assoc_f_pre:Prims.unit -> Type0;
f_assoc_f_post:Prims.unit -> Prims.unit -> Type0;
Expand All @@ -624,12 +623,12 @@ class t_Foo (v_Self: Type0) = {
f_method_f_post:v_Self -> Prims.unit -> Type0;
f_method_f:x0: v_Self
-> Prims.Pure Prims.unit (f_method_f_pre x0) (fun result -> f_method_f_post x0 result);
f_assoc_type_pre:{| i3: Core.Marker.t_Copy f_AssocType |} -> f_AssocType -> Type0;
f_assoc_type_post:{| i3: Core.Marker.t_Copy f_AssocType |} -> f_AssocType -> Prims.unit -> Type0;
f_assoc_type:{| i3: Core.Marker.t_Copy f_AssocType |} -> x0: f_AssocType
f_assoc_type_pre:{| i2: Core.Marker.t_Copy f_AssocType |} -> f_AssocType -> Type0;
f_assoc_type_post:{| i2: Core.Marker.t_Copy f_AssocType |} -> f_AssocType -> Prims.unit -> Type0;
f_assoc_type:{| i2: Core.Marker.t_Copy f_AssocType |} -> x0: f_AssocType
-> Prims.Pure Prims.unit
(f_assoc_type_pre #i3 x0)
(fun result -> f_assoc_type_post #i3 x0 result)
(f_assoc_type_pre #i2 x0)
(fun result -> f_assoc_type_post #i2 x0 result)
}

class t_Lang (v_Self: Type0) = {
Expand Down
Loading