Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement align_offset intrinsic and thus enabling from_utf8 #324

Merged
merged 2 commits into from
Sep 4, 2017

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Sep 1, 2017

fixes #190

@KodrAus
Copy link

KodrAus commented Sep 1, 2017

So I guess we'll need to do a pass through std and replace any other instances of manual alignment checking with this new intrinsic (or one of the fns on top of it once that lands) so miri can make the most of it?

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 1, 2017

So I guess we'll need to do a pass through std and replace any other instances of manual alignment checking with this new intrinsic (or one of the fns on top of it once that lands) so miri can make the most of it?

Yes. I'll be rerunning miri on the rust test suite to figure out which places are relevant.

For now this PR is blocked on @eddyb's fix for promoteds inside statics.

@RalfJung
Copy link
Member

RalfJung commented Sep 1, 2017

@eddyb's fix for promoteds inside statics.

Yeah, master is currently red. Got a link for that?

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 1, 2017

Nope. No PR open yet. Discussion is here

bors added a commit to rust-lang/rust that referenced this pull request Sep 3, 2017
Better StorageLive / StorageDead placement for constants.

Fixes problems in miri (see rust-lang/miri#324 (comment)) caused by the new scope rules in #43932.
What I've tried to do here is always have a `StorageLive` but no `StorageDead` for `'static` slots.
It might not work perfectly in all cases, but it should unblock miri.

r? @nikomatsakis cc @oli-obk
@eddyb
Copy link
Member

eddyb commented Sep 3, 2017

rust-lang/rust#44252 merged, next nightly should be fixed.

@RalfJung RalfJung merged commit ee5383f into rust-lang:master Sep 4, 2017
@RalfJung
Copy link
Member

RalfJung commented Sep 4, 2017

It's not great that we will never execute the "aligned" loop of code using this -- if there's bad things going on there, miri will not notice. But I guess there's not too much we can do.

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 4, 2017

We can improve the intrinsic to work if the alignment of the allocation is bigger than 1.

Then we can allocate some bytes but with a high alignment and run the utf8 checks on that memory

@oli-obk oli-obk deleted the align_offset branch September 4, 2017 12:27
@RalfJung
Copy link
Member

RalfJung commented Sep 5, 2017

Yeah that would help for this, but not in general for other uses of the intrinsic.

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 7, 2017

Right. For that we'll need the intptrcast model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReadPointerAsBytes error in ::std::str::from_utf8()
4 participants