Skip to content

Commit

Permalink
Rollup merge of #67149 - JohnTitor:fix-ice-1, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Do not ICE #67123

Fixes #67123

r? @matthewjasper
  • Loading branch information
tmandry authored Dec 9, 2019
2 parents 5ce5464 + b879ecc commit c2702e3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
let tcx = self.infcx.tcx;
let generics = tcx.generics_of(self.mir_def_id);
let param = generics.type_param(&param_ty, tcx);
if let Some(generics) = tcx.hir().get_generics(self.mir_def_id) {
if let Some(generics) =
tcx.hir().get_generics(tcx.closure_base_def_id(self.mir_def_id)) {
suggest_constraining_type_param(
generics,
&mut err,
Expand Down
5 changes: 5 additions & 0 deletions src/test/ui/closures/issue-67123.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fn foo<T>(t: T) {
|| { t; t; }; //~ ERROR: use of moved value
}

fn main() {}
15 changes: 15 additions & 0 deletions src/test/ui/closures/issue-67123.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error[E0382]: use of moved value: `t`
--> $DIR/issue-67123.rs:2:13
|
LL | fn foo<T>(t: T) {
| - help: consider restricting this bound: `T: Copy`
LL | || { t; t; };
| - ^ value used here after move
| |
| value moved here
|
= note: move occurs because `t` has type `T`, which does not implement the `Copy` trait

error: aborting due to previous error

For more information about this error, try `rustc --explain E0382`.

0 comments on commit c2702e3

Please sign in to comment.