Skip to content

Commit 8c64f01

Browse files
committed
Make the compiler compile 😅
1 parent 76488e7 commit 8c64f01

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

compiler/rustc_interface/src/util.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,14 @@ pub fn scoped_thread<F: FnOnce() -> R + Send, R: Send>(cfg: thread::Builder, f:
120120
let result_ptr = Ptr(&mut result as *mut _ as *mut ());
121121

122122
let thread = cfg.spawn(move || {
123-
let run = unsafe { (*(run.0 as *mut Option<F>)).take().unwrap() };
124-
let result = unsafe { &mut *(result_ptr.0 as *mut Option<R>) };
123+
let run = unsafe {
124+
let x = run;
125+
(*(x.0 as *mut Option<F>)).take().unwrap()
126+
};
127+
let result = unsafe {
128+
let x = result_ptr;
129+
&mut *(x.0 as *mut Option<R>)
130+
};
125131
*result = Some(run());
126132
});
127133

compiler/rustc_typeck/src/expr_use_visitor.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
405405
};
406406

407407
let with_place = return_if_err!(self.mc.cat_expr(&with_expr));
408+
self.delegate_consume(&with_place, with_place.hir_id);
408409

409410
// Select just those fields of the `with`
410411
// expression that will actually be used
@@ -531,6 +532,8 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
531532

532533
let tcx = self.tcx();
533534
let ExprUseVisitor { ref mc, body_owner: _, ref mut delegate } = *self;
535+
delegate.borrow(discr_place, discr_place.hir_id, ty::ImmBorrow);
536+
534537
return_if_err!(mc.cat_pattern(discr_place.clone(), pat, |place, pat| {
535538
if let PatKind::Binding(_, canonical_id, ..) = pat.kind {
536539
debug!("walk_pat: binding place={:?} pat={:?}", place, pat,);

0 commit comments

Comments
 (0)