Skip to content

Commit c015578

Browse files
committed
---
yaml --- r: 282027 b: refs/heads/stable c: d3a6d67 h: refs/heads/master i: 282025: adafc2f 282023: 6931641
1 parent b061ec2 commit c015578

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 3c795e08d6f4a532f12f3f8e1837db5e0647f8b0
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 9cc5ee359a27b096d4945c672eb1383f4490fbf1
32+
refs/heads/stable: d3a6d67fb85c766d58c3097ef8c880e468e25478
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc_mir/hair/cx/expr.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,11 +668,15 @@ fn convert_path_expr<'a, 'tcx: 'a>(cx: &mut Cx<'a, 'tcx>, expr: &'tcx hir::Expr)
668668
},
669669
Def::Const(def_id) |
670670
Def::AssociatedConst(def_id) => {
671-
if let Some(v) = cx.try_const_eval_literal(expr) {
672-
return ExprKind::Literal { literal: v };
673-
} else {
674-
def_id
671+
if let Some(e) = const_eval::lookup_const_by_id(cx.tcx, def_id, Some(expr.id), None) {
672+
// FIXME ConstVal can't be yet used with adjustments, as they would be lost.
673+
if !cx.tcx.tables.borrow().adjustments.contains_key(&e.id) {
674+
if let Some(v) = cx.try_const_eval_literal(e) {
675+
return ExprKind::Literal { literal: v };
676+
}
677+
}
675678
}
679+
def_id
676680
}
677681

678682
Def::Static(node_id, _) => return ExprKind::StaticRef {

0 commit comments

Comments
 (0)