File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -674,11 +674,10 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
674674 return ;
675675 }
676676 }
677- let param_env = ty:: ParamEnv :: empty ( ) ;
678- if ty. is_copy_modulo_regions ( cx. tcx , param_env) {
677+ if ty. is_copy_modulo_regions ( cx. tcx , cx. param_env ) {
679678 return ;
680679 }
681- if type_implements_negative_copy_modulo_regions ( cx. tcx , ty, param_env) {
680+ if type_implements_negative_copy_modulo_regions ( cx. tcx , ty, cx . param_env ) {
682681 return ;
683682 }
684683 if def. is_variant_list_non_exhaustive ( )
@@ -694,7 +693,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
694693 . tcx
695694 . infer_ctxt ( )
696695 . build ( )
697- . type_implements_trait ( iter_trait, [ ty] , param_env)
696+ . type_implements_trait ( iter_trait, [ ty] , cx . param_env )
698697 . must_apply_modulo_regions ( )
699698 {
700699 return ;
@@ -711,7 +710,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
711710
712711 if type_allowed_to_implement_copy (
713712 cx. tcx ,
714- param_env,
713+ cx . param_env ,
715714 ty,
716715 traits:: ObligationCause :: misc ( item. span , item. owner_id . def_id ) ,
717716 )
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ #![ feature( trivial_bounds) ]
4+ #![ allow( trivial_bounds) ]
5+
6+ // Make sure that we still use the where-clauses from the struct when checking
7+ // if it may implement `Copy` unconditionally.
8+ // Fix for <https://github.com/rust-lang/rust/issues/125394>.
9+
10+ pub trait Foo {
11+ type Assoc ;
12+ }
13+
14+ pub struct Bar ;
15+
16+ // This needs to be public
17+ pub struct Baz2 ( <Bar as Foo >:: Assoc )
18+ where
19+ Bar : Foo ;
20+
21+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments