Stream: t-lang/wg-unsafe-code-guidelines

Topic: miri question from reddit


Jake Goulding (Oct 29 2018 at 16:42, on Zulip):

https://www.reddit.com/r/rust/comments/9sanq8/hey_rustaceans_got_an_easy_question_ask_here/e8o5znz

Jake Goulding (Oct 29 2018 at 17:34, on Zulip):

@RalfJ ^

RalfJ (Oct 29 2018 at 18:04, on Zulip):

@Jake Goulding this is another instance of a bug @Oli just wrote a fix for

Jake Goulding (Oct 29 2018 at 18:05, on Zulip):

Which is blocked on nightly updating?

RalfJ (Oct 29 2018 at 18:05, on Zulip):

which hasnt landed in rustc yet

RalfJ (Oct 29 2018 at 18:05, on Zulip):

it hasnt even been r+'d^^

RalfJ (Oct 29 2018 at 18:06, on Zulip):

I wrote a comment on reddit with the relevant link

Jake Goulding (Oct 29 2018 at 18:06, on Zulip):

1..=0 is the range of all possible integers

wat.

Jake Goulding (Oct 29 2018 at 18:07, on Zulip):

seems like it should be .. by itself.

RalfJ (Oct 29 2018 at 18:07, on Zulip):

yeah @eddyb has strange logic^^

RalfJ (Oct 29 2018 at 18:07, on Zulip):

these ranges are wrapping

RalfJ (Oct 29 2018 at 18:07, on Zulip):

at "whatever the size of the scalar is"

eddyb (Oct 29 2018 at 18:08, on Zulip):

wraparound ranges are super useful

eddyb (Oct 29 2018 at 18:08, on Zulip):

and LLVM uses them

eddyb (Oct 29 2018 at 18:09, on Zulip):

it means you don't need a separate concept of a signed range and an unsigned range

eddyb (Oct 29 2018 at 18:09, on Zulip):

which is what we had before

RalfJ (Oct 29 2018 at 18:09, on Zulip):

wrapped ranges are great but using RangeInclusive for them is a bad hack

RalfJ (Oct 29 2018 at 18:09, on Zulip):

that type comes with a contains method that's just plain wrong now

Jake Goulding (Oct 29 2018 at 18:10, on Zulip):

is there a difference in 1..=0 and 2..=1, etc.?

RalfJ (Oct 29 2018 at 18:14, on Zulip):

no

eddyb (Oct 29 2018 at 18:17, on Zulip):

ahhhh yeah I just never got around to writing a proper type

eddyb (Oct 29 2018 at 18:17, on Zulip):

that handles all the operations correctly

Jake Goulding (Oct 29 2018 at 18:24, on Zulip):

I wonder what the outcome will be of these "internal" bits leaking out to real humans via such things as Miri error messages.

RalfJ (Oct 29 2018 at 18:30, on Zulip):

probably the error messages shouldn't use that notation when there is actual wrapping going on

RalfJ (Oct 29 2018 at 18:30, on Zulip):

I was just too lazy to implement better pretty printing^^

RalfJ (Oct 29 2018 at 18:30, on Zulip):

(the error msg is in rustc btw, and can also occur during CTFE)

Last update: Nov 19 2019 at 19:00UTC