Skip to content

Commit

Permalink
rustc_mir: use the right type for associated const literals.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Aug 12, 2019
1 parent 2882bee commit 22127b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/hair/cx/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ fn convert_path_expr<'a, 'tcx>(
ExprKind::Literal {
literal: cx.tcx.mk_const(ty::Const {
val: ConstValue::Unevaluated(def_id, substs),
ty: cx.tcx.type_of(def_id),
ty: cx.tables().node_type(expr.hir_id),
}),
user_ty,
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/ui/dropck/dropck_trait_cycle_checked.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0597]: `o2` does not live long enough
--> $DIR/dropck_trait_cycle_checked.rs:111:13
|
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
| -------- cast requires that `o2` is borrowed for `'static`
| -------- cast requires that `o2` is borrowed for `'static`
LL | o1.set0(&o2);
| ^^^ borrowed value does not live long enough
...
Expand All @@ -13,7 +13,7 @@ error[E0597]: `o3` does not live long enough
--> $DIR/dropck_trait_cycle_checked.rs:112:13
|
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
| -------- cast requires that `o3` is borrowed for `'static`
| -------- cast requires that `o3` is borrowed for `'static`
LL | o1.set0(&o2);
LL | o1.set1(&o3);
| ^^^ borrowed value does not live long enough
Expand All @@ -37,7 +37,7 @@ error[E0597]: `o3` does not live long enough
--> $DIR/dropck_trait_cycle_checked.rs:114:13
|
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
| -------- cast requires that `o3` is borrowed for `'static`
| -------- cast requires that `o3` is borrowed for `'static`
...
LL | o2.set1(&o3);
| ^^^ borrowed value does not live long enough
Expand All @@ -49,7 +49,7 @@ error[E0597]: `o1` does not live long enough
--> $DIR/dropck_trait_cycle_checked.rs:115:13
|
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
| -------- cast requires that `o1` is borrowed for `'static`
| -------- cast requires that `o1` is borrowed for `'static`
...
LL | o3.set0(&o1);
| ^^^ borrowed value does not live long enough
Expand All @@ -61,7 +61,7 @@ error[E0597]: `o2` does not live long enough
--> $DIR/dropck_trait_cycle_checked.rs:116:13
|
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
| -------- cast requires that `o2` is borrowed for `'static`
| -------- cast requires that `o2` is borrowed for `'static`
...
LL | o3.set1(&o2);
| ^^^ borrowed value does not live long enough
Expand Down

0 comments on commit 22127b1

Please sign in to comment.