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 {
227
227
#[ derive( Debug ) ]
228
228
pub struct CellBorrow ;
229
229
impl 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
+ }
230
237
fn importance ( & self ) -> DiagnosticImportance {
231
238
// The problematic cases will already emit a `CellBorrowBehindRef`
232
239
DiagnosticImportance :: Secondary
Original file line number Diff line number Diff line change @@ -36,4 +36,6 @@ unsafe impl<T> Sync for Wrap<T> {}
36
36
37
37
static BAR_PTR : Wrap < * mut u32 > = Wrap ( BAR . 0 . get ( ) ) ;
38
38
39
+ const fn fst_ref < T , U > ( x : & ( T , U ) ) -> & T { & x. 0 }
40
+
39
41
fn main ( ) { }
You can’t perform that action at this time.
0 commit comments