diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-09-01 12:26:51 +0200 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-09-01 12:26:51 +0200 |
| commit | cf25ef9d9d22d91c9bf3ceb8ab2262a16370d171 (patch) | |
| tree | 9ed237f8d50f16204b434481f926bb7324be0b2d | |
| parent | 324384375537ef1e40f7fad550ba1da83e2d1458 (diff) | |
| download | rust-cf25ef9d9d22d91c9bf3ceb8ab2262a16370d171.tar.gz rust-cf25ef9d9d22d91c9bf3ceb8ab2262a16370d171.zip | |
Implement `align_offset` intrinsic and thus enabling `from_utf8`
| -rw-r--r-- | miri/intrinsic.rs | 6 | ||||
| -rw-r--r-- | tests/run-pass-fullmir/from_utf8.rs | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/miri/intrinsic.rs b/miri/intrinsic.rs index 8c722a46ae3..693a478c2df 100644 --- a/miri/intrinsic.rs +++ b/miri/intrinsic.rs @@ -34,6 +34,12 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator> let intrinsic_name = &self.tcx.item_name(instance.def_id()).as_str()[..]; match intrinsic_name { + "align_offset" => { + // FIXME: return a real value in case the target allocation has an + // alignment bigger than the one requested + self.write_primval(dest, PrimVal::Bytes(u128::max_value()), dest_ty)?; + }, + "add_with_overflow" => { self.intrinsic_with_overflow( mir::BinOp::Add, diff --git a/tests/run-pass-fullmir/from_utf8.rs b/tests/run-pass-fullmir/from_utf8.rs new file mode 100644 index 00000000000..69e6c521af6 --- /dev/null +++ b/tests/run-pass-fullmir/from_utf8.rs @@ -0,0 +1,3 @@ +fn main() { + let _ = ::std::str::from_utf8(b"a"); +} |
