@@ -17,10 +17,8 @@ use formality_types::{
17
17
} ;
18
18
19
19
impl super :: Check < ' _ > {
20
- #[ context( "check_trait_impl({v:?})" ) ]
21
- pub ( super ) fn check_trait_impl ( & self , v : & TraitImpl ) -> Fallible < ( ) > {
22
- let TraitImpl { binder, safety } = v;
23
-
20
+ #[ context( "check_trait_impl({trait_impl:?})" ) ]
21
+ pub ( super ) fn check_trait_impl ( & self , trait_impl : & TraitImpl ) -> Fallible < ( ) > {
24
22
let mut env = Env :: default ( ) ;
25
23
26
24
let TraitImplBoundData {
@@ -29,7 +27,7 @@ impl super::Check<'_> {
29
27
trait_parameters,
30
28
where_clauses,
31
29
impl_items,
32
- } = env. instantiate_universally ( binder) ;
30
+ } = env. instantiate_universally ( & trait_impl . binder ) ;
33
31
34
32
let trait_ref = trait_id. with ( self_ty, trait_parameters) ;
35
33
@@ -45,7 +43,7 @@ impl super::Check<'_> {
45
43
trait_items,
46
44
} = trait_decl. binder . instantiate_with ( & trait_ref. parameters ) ?;
47
45
48
- self . check_safety_matches ( & trait_decl, safety ) ?;
46
+ self . check_safety_matches ( & trait_decl, & trait_impl ) ?;
49
47
50
48
for impl_item in & impl_items {
51
49
self . check_trait_impl_item ( & env, & where_clauses, & trait_items, impl_item) ?;
@@ -74,8 +72,8 @@ impl super::Check<'_> {
74
72
}
75
73
76
74
/// Validate that the declared safety of an impl matches the one from the trait declaration.
77
- fn check_safety_matches ( & self , trait_decl : & Trait , trait_impl : & Safety ) -> Fallible < ( ) > {
78
- if trait_decl. safety != * trait_impl {
75
+ fn check_safety_matches ( & self , trait_decl : & Trait , trait_impl : & TraitImpl ) -> Fallible < ( ) > {
76
+ if trait_decl. safety != trait_impl. safety {
79
77
match trait_decl. safety {
80
78
Safety :: Safe => bail ! ( "implementing the trait `{:?}` is not unsafe" , trait_decl. id) ,
81
79
Safety :: Unsafe => bail ! (
0 commit comments