File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
compiler/rustc_trait_selection/src/solve
tests/ui/traits/new-solver Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,20 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
89
89
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
90
90
goal : Goal < ' tcx , Self > ,
91
91
) -> QueryResult < ' tcx > {
92
+ // This differs from the current stable behavior and
93
+ // fixes #84857. Due to breakage found via crater, we
94
+ // currently instead lint patterns which can be used to
95
+ // exploit this unsoundness on stable, see #93367 for
96
+ // more details.
97
+ if let Some ( def_id) = ecx. tcx ( ) . find_map_relevant_impl (
98
+ goal. predicate . def_id ( ) ,
99
+ goal. predicate . self_ty ( ) ,
100
+ Some ,
101
+ ) {
102
+ debug ! ( ?def_id, ?goal, "disqualified auto-trait implementation" ) ;
103
+ return Err ( NoSolution ) ;
104
+ }
105
+
92
106
ecx. probe_and_evaluate_goal_for_constituent_tys (
93
107
goal,
94
108
structural_traits:: instantiate_constituent_tys_for_auto_trait,
Original file line number Diff line number Diff line change
1
+ // compile-flags: -Ztrait-solver=next
2
+ // check-pass
3
+
4
+ struct Foo ( * mut ( ) ) ;
5
+
6
+ unsafe impl Sync for Foo { }
7
+
8
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments