File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
compiler/rustc_mir/src/transform/check_consts Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,13 @@ impl NonConstOp for CellBorrowBehindRef {
227227#[ derive( Debug ) ]
228228pub struct CellBorrow ;
229229impl NonConstOp for CellBorrow {
230+ fn status_in_item ( & self , ccx : & ConstCx < ' _ , ' _ > ) -> Status {
231+ match ccx. const_kind ( ) {
232+ // The borrow checker does a much better job at handling these than we do
233+ hir:: ConstContext :: ConstFn => Status :: Allowed ,
234+ _ => Status :: Forbidden ,
235+ }
236+ }
230237 fn importance ( & self ) -> DiagnosticImportance {
231238 // The problematic cases will already emit a `CellBorrowBehindRef`
232239 DiagnosticImportance :: Secondary
Original file line number Diff line number Diff line change @@ -36,4 +36,6 @@ unsafe impl<T> Sync for Wrap<T> {}
3636
3737static BAR_PTR : Wrap < * mut u32 > = Wrap ( BAR . 0 . get ( ) ) ;
3838
39+ const fn fst_ref < T , U > ( x : & ( T , U ) ) -> & T { & x. 0 }
40+
3941fn main ( ) { }
You can’t perform that action at this time.
0 commit comments