Uh oh!
There was an error while loading. Please reload this page.
Fixed-size byte string literals (RFC 339) - #22838
Conversation
rust-highfive
commented
Feb 26, 2015
(rust_highfive has picked a reviewer for you, use r? to override) |
petrochenkov
commented
Feb 26, 2015
Notes:
|
alexcrichton
commented
Feb 27, 2015
I personally considered the breakage of this behavior to be a showstopper for the previous attempt: match foo {b"foo" => {/* ... */}}Others may have a different opinion though! I'm also getting quite worried about how we're just spraying impls of traits for cc @nrc, @nikomatsakis on the coercions aspect, do we perhaps have any RFCs in the pipeline to help here? This relatively small change ended up having quite a large fallout! |
nrc
commented
Feb 27, 2015
re coercions: There's nothing in the pipeline re coercions in matches - there was some RFC recently about array patterns in matches, but I think that makes things stricter. I'm not quite sure what it means to coerce in a pattern - if it means that |
petrochenkov
commented
Feb 27, 2015
@alexcrichton I don't think it's a showstopper for several reasons:
So, I'd like to land this PR until it's too late and to work on the fix for patterns independently of it (I currently study the implementation of pattern matching in the compiler). |
petrochenkov
commented
Feb 27, 2015
|
petrochenkov
commented
Feb 27, 2015
Everything about fixed-size arrays feels not quite right until some form of rust-lang/rfcs#884 is implemented, but it doesn't mean that they should be second class citizens. In principle I can kill the new impls and spend some more time manually coercing |
petrochenkov
commented
Feb 27, 2015
@alexcrichton I think it's possible to remove some of the metadata bloat with the next trick (where the coherence rules allow it): |
alexcrichton
commented
Feb 27, 2015
@petrochenkov that's a pretty good idea! I like how it's turned out for fixed-size arrays. I'm not super happy that this has cc @aturon, I'm curious what you think about the ergonomic fall out here as well as the |
petrochenkov
commented
Mar 2, 2015
I think I know what to do with byte string literal patterns - they will behave exactly like array patterns - they will denote |
bors
commented
Mar 7, 2015
☔ The latest upstream changes (presumably #23107) made this pull request unmergeable. Please resolve the merge conflicts. |
petrochenkov
commented
Mar 9, 2015
Fixed byte string literal patterns and rebased |
alexcrichton
commented
Mar 10, 2015
Wow, nice work @petrochenkov! cc @aturon, I'm curious as to your opinion of |
aturon
commented
Mar 10, 2015
@alexcrichton@petrochenkov Sorry for the delay giving feedback on this. I'm not too worried about In any case, I don't think we should hold up the PR just for that reason, since it's a minor impl detail that can be improved later on. |
alexcrichton
commented
Mar 10, 2015
@aturon while the trait itself remains stable, we are leaking stable functionality via the trait itself. Right now the stability pass does not consider the stability of an
I'm a little uncomfortable with the two and would prefer coercions to take over, but just want to confirm that you're on board with this information as well. |
petrochenkov
commented
Mar 11, 2015
What coercions exactly? I remember someone (maybe @japaric or @eddyb ?) proposing "impl lookup with coercions" - if we are not able to find an impl of trait |
eddyb
commented
Mar 11, 2015
@blaenk came up with that idea, I merely gave it a name (bound-targeting coercions). |
alexcrichton
commented
Mar 11, 2015
@petrochenkov yeah that's basically what I was thinking, although I'm not sure if it's actually plausible. I'm just wary of committing to providing impls for these traits for all these fixed size arrays. |
petrochenkov
commented
Mar 17, 2015
@alexcrichton |
alexcrichton
commented
Mar 17, 2015
Gah sorry about the delay on this @petrochenkov! I meant to discuss this with @aturon in more depth in the meantime, but we never got around to it :(. Due to the conservative nature of this, however, I'm fine landing this for now, thanks for being patient! As an aside, |
alexcrichton
commented
Mar 17, 2015
bors
commented
Mar 17, 2015
bors
commented
Mar 17, 2015
💔 Test failed - auto-win-64-nopt-t |
petrochenkov
commented
Mar 18, 2015
alexcrichton
commented
Mar 18, 2015
bors
commented
Mar 18, 2015
⌛ Testing commit dccd17d with merge 46f649c... |
bors
commented
Mar 18, 2015
Changed in rust-lang#22838. audited (raw) byte string literals @ rust-lang#16676
Changed in rust-lang#22838. audited (raw) byte string literals @ rust-lang#16676
Changed in rust-lang#22838. audited (raw) byte string literals @ rust-lang#16676
Changed in rust-lang#22838. audited (raw) byte string literals @ rust-lang#16676
Changed in rust-lang#22838. audited (raw) byte string literals @ rust-lang#16676
Changed in rust-lang#22838. audited (raw) byte string literals @ rust-lang#16676
This patch changes the type of byte string literals from
&[u8]to&[u8; N].It also implements some necessary traits (
IntoBytes,Seek,Read,BufRead) for fixed-size arrays (also related to #21725) and adds test for #17233, which seems to be resolved.Fixes#18465
[breaking-change]