Skip to content

Commit 2ff337a

Browse files
committed
rustc_mir: use the right type for associated const literals.
1 parent 9107ec1 commit 2ff337a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/librustc_mir/hair/cx/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ fn convert_path_expr<'a, 'tcx>(
927927
ExprKind::Literal {
928928
literal: cx.tcx.mk_const(ty::Const {
929929
val: ConstValue::Unevaluated(def_id, substs),
930-
ty: cx.tcx.type_of(def_id),
930+
ty: cx.tables().node_type(expr.hir_id),
931931
}),
932932
user_ty,
933933
}

src/test/ui/dropck/dropck_trait_cycle_checked.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0597]: `o2` does not live long enough
22
--> $DIR/dropck_trait_cycle_checked.rs:111:13
33
|
44
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
5-
| -------- cast requires that `o2` is borrowed for `'static`
5+
| -------- cast requires that `o2` is borrowed for `'static`
66
LL | o1.set0(&o2);
77
| ^^^ borrowed value does not live long enough
88
...
@@ -13,7 +13,7 @@ error[E0597]: `o3` does not live long enough
1313
--> $DIR/dropck_trait_cycle_checked.rs:112:13
1414
|
1515
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
16-
| -------- cast requires that `o3` is borrowed for `'static`
16+
| -------- cast requires that `o3` is borrowed for `'static`
1717
LL | o1.set0(&o2);
1818
LL | o1.set1(&o3);
1919
| ^^^ borrowed value does not live long enough
@@ -37,7 +37,7 @@ error[E0597]: `o3` does not live long enough
3737
--> $DIR/dropck_trait_cycle_checked.rs:114:13
3838
|
3939
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
40-
| -------- cast requires that `o3` is borrowed for `'static`
40+
| -------- cast requires that `o3` is borrowed for `'static`
4141
...
4242
LL | o2.set1(&o3);
4343
| ^^^ borrowed value does not live long enough
@@ -49,7 +49,7 @@ error[E0597]: `o1` does not live long enough
4949
--> $DIR/dropck_trait_cycle_checked.rs:115:13
5050
|
5151
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
52-
| -------- cast requires that `o1` is borrowed for `'static`
52+
| -------- cast requires that `o1` is borrowed for `'static`
5353
...
5454
LL | o3.set0(&o1);
5555
| ^^^ borrowed value does not live long enough
@@ -61,7 +61,7 @@ error[E0597]: `o2` does not live long enough
6161
--> $DIR/dropck_trait_cycle_checked.rs:116:13
6262
|
6363
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
64-
| -------- cast requires that `o2` is borrowed for `'static`
64+
| -------- cast requires that `o2` is borrowed for `'static`
6565
...
6666
LL | o3.set1(&o2);
6767
| ^^^ borrowed value does not live long enough

0 commit comments

Comments
 (0)