Skip to content

Commit 7e2cc40

Browse files
committed
---
yaml --- r: 273269 b: refs/heads/beta c: 92e4858 h: refs/heads/master i: 273267: 3edcfed
1 parent e0db384 commit 7e2cc40

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: eb43d952118f8d33e221c00f71a343f32ce17655
26+
refs/heads/beta: 92e485874e668fdc21855e0a288f526161576070
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc_trans/trans/mir/constant.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use trans::abi;
1717
use trans::common::{self, BlockAndBuilder, C_bool, C_bytes, C_floating_f64, C_integral,
1818
C_str_slice, C_undef};
1919
use trans::consts;
20+
use trans::datum;
2021
use trans::expr;
2122
use trans::inline;
2223
use trans::type_of;
@@ -122,7 +123,18 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
122123
let d = bcx.with_block(|bcx| {
123124
expr::trans(bcx, expr)
124125
});
125-
OperandRef::from_rvalue_datum(d.datum.to_rvalue_datum(d.bcx, "").datum)
126+
127+
let datum = d.datum.to_rvalue_datum(d.bcx, "").datum;
128+
129+
match datum.kind.mode {
130+
datum::RvalueMode::ByValue => {
131+
OperandRef {
132+
ty: datum.ty,
133+
val: OperandValue::Immediate(datum.val)
134+
}
135+
}
136+
datum::RvalueMode::ByRef => self.trans_load(bcx, datum.val, datum.ty)
137+
}
126138
}
127139
mir::Literal::Value { ref value } => {
128140
self.trans_constval(bcx, value, ty)

branches/beta/src/librustc_trans/trans/mir/operand.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,6 @@ impl<'tcx> OperandRef<'tcx> {
8181
_ => unreachable!()
8282
}
8383
}
84-
85-
pub fn from_rvalue_datum(datum: datum::Datum<'tcx, datum::Rvalue>) -> OperandRef {
86-
OperandRef {
87-
ty: datum.ty,
88-
val: match datum.kind.mode {
89-
datum::RvalueMode::ByRef => OperandValue::Ref(datum.val),
90-
datum::RvalueMode::ByValue => OperandValue::Immediate(datum.val),
91-
}
92-
}
93-
}
9484
}
9585

9686
impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {

0 commit comments

Comments
 (0)