Skip to content

Commit ee5383f

Browse files
authored
Merge pull request #324 from oli-obk/align_offset
Implement `align_offset` intrinsic and thus enabling `from_utf8`
2 parents 9386f05 + 3b6852a commit ee5383f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

miri/intrinsic.rs

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
3434

3535
let intrinsic_name = &self.tcx.item_name(instance.def_id()).as_str()[..];
3636
match intrinsic_name {
37+
"align_offset" => {
38+
// FIXME: return a real value in case the target allocation has an
39+
// alignment bigger than the one requested
40+
self.write_primval(dest, PrimVal::Bytes(u128::max_value()), dest_ty)?;
41+
},
42+
3743
"add_with_overflow" => {
3844
self.intrinsic_with_overflow(
3945
mir::BinOp::Add,

tests/run-pass-fullmir/from_utf8.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
let _ = ::std::str::from_utf8(b"a");
3+
}

0 commit comments

Comments
 (0)