Skip to content

avoid double-unsizing arrays in bytestring match lowering - #47503

Merged
bors merged 1 commit into
rust-lang:masterfrom
arielb1:check-size
Jan 19, 2018
Merged

avoid double-unsizing arrays in bytestring match lowering#47503
bors merged 1 commit into
rust-lang:masterfrom
arielb1:check-size

Conversation

@arielb1

Copy link
Copy Markdown
Contributor

The match lowering code, when lowering matches against bytestrings,
works by coercing both the scrutinee and the pattern to &[u8] and
then comparing them using <[u8] as Eq>::eq.

If the scrutinee is already of type &[u8], then unsizing it is both
unneccessary and a trait error caught by the new and updated MIR typeck,
so this PR changes lowering to avoid doing that (match lowering tried to
avoid that before, but that attempt was quite broken).

Fixes#46920.

r? @eddyb

The match lowering code, when lowering matches against bytestrings,
works by coercing both the scrutinee and the pattern to `&[u8]` and
then comparing them using `<[u8] as Eq>::eq`.
If the scrutinee is already of type `&[u8]`, then unsizing it is both
unneccessary and a trait error caught by the new and updated MIR typeck,
so this PR changes lowering to avoid doing that (match lowering tried to
avoid that before, but that attempt was quite broken).
Fixesrust-lang#46920.
@arielb1arielb1 added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jan 16, 2018
@arielb1

Copy link
Copy Markdown
ContributorAuthor

beta-nominating because this is a regression

@eddyb

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 17, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit 06e32d0 has been approved by eddyb

@kennytmkennytm added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 17, 2018
@nikomatsakisnikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jan 18, 2018
@alexcrichton

Copy link
Copy Markdown
Member

@bors: p=1

(this'll get backported to beta once merged)

@bors

bors commented Jan 19, 2018

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 06e32d0 with merge 5965b79...

bors added a commit that referenced this pull request Jan 19, 2018
avoid double-unsizing arrays in bytestring match lowering
The match lowering code, when lowering matches against bytestrings,
works by coercing both the scrutinee and the pattern to `&[u8]` and
then comparing them using `<[u8] as Eq>::eq`.
If the scrutinee is already of type `&[u8]`, then unsizing it is both
unneccessary and a trait error caught by the new and updated MIR typeck,
so this PR changes lowering to avoid doing that (match lowering tried to
avoid that before, but that attempt was quite broken).
Fixes#46920.
r? @eddyb
@bors

bors commented Jan 19, 2018

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing 5965b79 to master...

@bors
bors merged commit 06e32d0 into rust-lang:masterJan 19, 2018
@MaloJaffreMaloJaffre mentioned this pull request Jan 23, 2018
bors added a commit that referenced this pull request Jan 23, 2018
@alexcrichtonalexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Feb 2, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-acceptedAccepted for backporting to the compiler in the beta channel.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@arielb1@eddyb@bors@alexcrichton@kennytm@nikomatsakis