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

avoid double-unsizing arrays in bytestring match lowering #47503

Merged
merged 1 commit into from
Jan 19, 2018

Conversation

arielb1
Copy link
Contributor

@arielb1 arielb1 commented Jan 16, 2018

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).

Fixes rust-lang#46920.
@arielb1 arielb1 added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jan 16, 2018
@arielb1
Copy link
Contributor Author

arielb1 commented Jan 16, 2018

beta-nominating because this is a regression

@eddyb
Copy link
Member

eddyb commented Jan 17, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Jan 17, 2018

📌 Commit 06e32d0 has been approved by eddyb

@kennytm kennytm 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
@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jan 18, 2018
@alexcrichton
Copy link
Member

@bors: p=1

(this'll get backported to beta once merged)

@bors
Copy link
Contributor

bors commented Jan 19, 2018

⌛ 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
Copy link
Contributor

bors commented Jan 19, 2018

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

@bors bors merged commit 06e32d0 into rust-lang:master Jan 19, 2018
@MaloJaffre MaloJaffre mentioned this pull request Jan 23, 2018
bors added a commit that referenced this pull request Jan 23, 2018
[beta] Backports

Cherry-picked into beta:
- #47401
- #47494
- #47503
- #47507
@alexcrichton alexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Feb 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: 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