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

[beta] Backports #47682

Merged
merged 5 commits into from
Jan 23, 2018
Merged

[beta] Backports #47682

merged 5 commits into from
Jan 23, 2018

Conversation

Robin Kruppe and others added 4 commits January 23, 2018 16:57
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.
@rust-highfive
Copy link
Collaborator

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive
Copy link
Collaborator

warning Warning warning

  • Pull requests are usually filed against the master branch for this repo, but this one is against beta. Please double check that you specified the right target!

@MaloJaffre MaloJaffre changed the title [beta] backport [beta] Backports Jan 23, 2018
@alexcrichton
Copy link
Member

Thanks! It looks like the "lower link args" isn't cleanly backporting (build failure), mind fixing that up? If you're busy though I can take a look!

When spawning a linker rustc has historically been known to blow OS limits for
the command line being too large, notably on Windows. This is especially true of
incremental compilation where there can be dozens of object files per
compilation. The compiler currently has logic for detecting a failure to spawn
and instead passing arguments via a file instead, but this failure detection
only triggers if a process actually fails to spawn.

Unfortunately on Windows we've got something else to worry about which is
`cmd.exe`. The compiler may be running a linker through `cmd.exe` where
`cmd.exe` has a limit of 8192 on the command line vs 32k on `CreateProcess`.
Moreso rustc actually succeeds in spawning `cmd.exe` today, it's just that after
it's running `cmd.exe` fails to spawn its child, which rustc doesn't currently
detect.

Consequently this commit updates the logic for the spawning the linker on
Windows to instead have a heuristic to see if we need to pass arguments via a
file. This heuristic is an overly pessimistic and "inaccurate" calculation which
just calls `len` on a bunch of `OsString` instances (where `len` is not
precisely the length in u16 elements). This number, when exceeding the 6k
threshold, will force rustc to always pass arguments through a file.

This strategy should avoid us trying to parse the output on Windows of the
linker to see if it successfully spawned yet failed to actually sub-spawn the
linker. We may just be passing arguments through files a little more commonly
now...

The motivation for this commit was a recent bug in Gecko [1] when beta testing,
notably when incremental compilation was enabled it blew out the limit on
`cmd.exe`. This commit will also fix rust-lang#46999 as well though as emscripten uses a
bat script as well (and we're blowing the limit there).

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1430886

Closes rust-lang#46999

(cherry picked from commit 66366f9)
@MaloJaffre
Copy link
Contributor Author

Thanks @alexcrichton for this info, I will take a look at it now!

@kennytm kennytm added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 23, 2018
@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 23, 2018
@MaloJaffre
Copy link
Contributor Author

The build should be fixed now.

@alexcrichton
Copy link
Member

@bors: r+ p=5

Thanks!

@bors
Copy link
Contributor

bors commented Jan 23, 2018

📌 Commit 590924b has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jan 23, 2018

⌛ Testing commit 590924b with merge ed9751a...

bors added a commit that referenced this pull request Jan 23, 2018
[beta] Backports

Cherry-picked into beta:
- #47401
- #47494
- #47503
- #47507
@bors
Copy link
Contributor

bors commented Jan 23, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing ed9751a to beta...

@bors bors merged commit 590924b into rust-lang:beta Jan 23, 2018
@MaloJaffre MaloJaffre deleted the beta-backport branch January 23, 2018 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants