Upgrade x86_64-fortanix-unknown-sgx platform support to tier 2
## Overview
1. This PR upgrades x86_64-fortanix-unknown-sgx platform support to tier 2 (std only) by setting up build automation for this target.
1. For supporting unwinding, this target needs to link to a port of LLVM's libunwind (more details could be found in #56979), which will be distributed along with the Rust binaries (similar to the extra musl objects)
### Building and copying libunwind:
We have added a new build script (`build-x86_64-fortanix-unknown-sgx-toolchain.sh`) that will run while the container is built. This will build `libunwind.a` from git source.
While the container is built, the persistent volumes where obj/ gets created aren't yet mapped. As a workaround, we copy the built `libunwind.a` to `obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-fortanix-unknown-sgx/lib/` after x.py runs.
If any reviewer knows of a better solution, please do tell.
r? @Mark-Simulacrum
Rollup of 8 pull requests
Successful merges:
- #57043 (Fix poor worst case performance of set intersection)
- #57480 (Clean up and fix a bug in query plumbing)
- #57481 (provide suggestion for invalid boolean cast)
- #57540 (Modify some parser diagnostics to continue evaluating beyond the parser)
- #57570 (Querify local `plugin_registrar_fn` and `proc_macro_decls_static`)
- #57572 (Unaccept `extern_in_paths`)
- #57585 (Recover from item trailing semicolon)
- #57589 (Add a debug_assert to Vec::set_len)
Failed merges:
r? @ghost
Querify local `plugin_registrar_fn` and `proc_macro_decls_static`
Instead of calculating them as part of the `Session`, we do that in the query system.
It's also nice that these queries are already defined for external crates - here, we provide the queries for the local crate.
r? @nikomatsakis
Modify some parser diagnostics to continue evaluating beyond the parser
Continue evaluating further errors after parser errors on:
- trailing type argument attribute
- lifetime in incorrect location
- incorrect binary literal
- missing `for` in `impl Trait for Foo`
- type argument in `where` clause
- incorrect float literal
- incorrect `..` in pattern
- associated types
- incorrect discriminator value variant error
and others. All of these were found by making `continue-parse-after-error` `true` by default to identify errors that would need few changes. There are now only a handful of errors that have any change with `continue-parse-after-error` enabled.
These changes make it so `rust` _won't_ stop evaluation after finishing parsing, enabling type checking errors to be displayed on the existing code without having to fix the parse errors.
Each commit has an individual diagnostic change with their corresponding tests.
CC #48724.
Fix poor worst case performance of set intersection
Specifically, intersection of asymmetrically sized sets when the large set is on the left. See also the [latest answer on stackoverflow](https://stackoverflow.com/questions/35439376/python-set-intersection-is-faster-then-rust-hashset-intersection).
Also applied to the union member, where the effect is much less but still measurable.
Formatted the changed code only, does not increase the error count reported by tidy check, and tried to adhere to the spirit of the unit tests.
Update cargo
13 commits in 34320d212dca8cd27d06ce93c16c6151f46fcf2e..2b4a5f1f0bb6e13759e88ea9512527b0beba154f
2019-01-03 19:12:38 +0000 to 2019-01-12 04:13:12 +0000
- Add test for publish with [patch] + cleanup. (rust-lang/cargo#6544)
- Fix clippy warning (rust-lang/cargo#6546)
- Revert "Workaround by using yesterday's nightly" (rust-lang/cargo#6540)
- Adding feature-flags to `cargo publish` and `cargo package` (rust-lang/cargo#6453)
- Fix the Travis CI badge (rust-lang/cargo#6530)
- Add helpful text for Windows exceptions like Unix (rust-lang/cargo#6532)
- Report fix bugs to Rust instead of Cargo (rust-lang/cargo#6531)
- --{example,bin,bench,test} with no argument now lists all available targets (rust-lang/cargo#6505)
- Rebuild on mid build file modification (rust-lang/cargo#6484)
- Derive Clone for TomlDependency (rust-lang/cargo#6527)
- publish: rework the crates.io detection logic. (rust-lang/cargo#6525)
- avoid duplicates in ignore files (rust-lang/cargo#6521)
- Rustflags in metadata (rust-lang/cargo#6503)
r? @alexcrichton
Remove the `connect_timeout_unroutable` test.
It requires an unreachable IP address, but there is no such thing, and
this has caused it to fail for multiple people.
Fixes#44698, fixes#50065.
r? @sfackler
Stabilize cfg_target_vendor
This stabilizes the use of `cfg(target_vendor = "...")` and removes the corresponding `cfg_target_vendor` feature. Other unstable cfgs remain behind their existing feature gates.
This functionality was added back in 2015 in #28612 to complete the coverage of target tuples (`<arch><sub>-<vendor>-<os>-<env>`). [RFC 131](https://github.com/rust-lang/rfcs/blob/master/text/0131-target-specification.md) governs the target specification, not including `target_vendor` seems to have just been an oversight. `target_os`, `target_family`, and `target_arch` are stable as of 1.0.0. `target_env` was also not mentioned in RFC 131, was added in #24777, never behind a feature_gate, and insta-stable at 1.1.0.
The functionality is tested in [test/run-pass/cfg/cfg-target-vendor.rs](https://github.com/rust-lang/rust/blob/master/src/test/run-pass/cfg/cfg-target-vendor.rs).
Closes#29718
MetadataOnlyCodegenBackend: run the collector only once
Use the `collect_and_partition_mono_items` query to avoid calling the collector directly twice.
Fixes#57406.
Stabilize core::convert::identity
r? @SimonSapin
fixes https://github.com/rust-lang/rust/issues/53500
This is waiting for FCP to complete but in the interim it would be good to review.
Use structured suggestions for nonstandard style lints
This PR modifies the lints in the nonstandard_style group to use structured suggestions. Note that there's a bit of tricky span calculation going on for the `crate_name` attribute. It also simplifies the code a bit: I don't think the "fallback" suggestions for these lints can actually be triggered.
Fixes#48103.
Fixes#52414.
Tweak output of type mismatch between "then" and `else` `if` arms
```
error[E0308]: if and else have incompatible types
--> $DIR/if-else-type-mismatch.rs:5:9
|
LL | let _ = if true {
| _____________-
LL | | 42i32
| | ----- expected because of this
LL | | } else {
LL | | 42u32
| | ^^^^^ expected i32, found u32
LL | | };
| |_____- if and else have incompatible types
|
= note: expected type `i32`
found type `u32`
error[E0308]: if and else have incompatible types
--> file.rs:2:38
|
LL | let _ = if false { 3u8; } else { 3u8 };
| ---- ^^^ expected (), found u8
| | |
| | help: consider removing this semicolon
| expected because of this
|
= note: expected type `()`
found type `u8`
error[E0308]: if and else have incompatible types
--> file.rs:3:37
|
LL | let _ = if false { 3u8 } else { 3u8; };
| --- ^^^-
| | | |
| | | help: consider removing this semicolon
| | expected u8, found ()
| expected because of this
|
= note: expected type `u8`
found type `()`
error[E0308]: if and else have incompatible types
--> file.rs:4:37
|
LL | let _ = if false { 3i8 } else { 3u8 };
| --- ^^^ expected i8, found u8
| |
| expected because of this
|
= note: expected type `i8`
found type `u8`
```
Fix#57348.
Add dist builder for Armv8-M Mainline
This commit adds the Armv8-M Mainline target in the list of targets that
get their dist components built. It also update the build-manifest so
that this target gets also its dist components uploaded.
I took example on other pull requests doing the same thing for another target to make the changes. Please feel free to comment if things needs to be added or removed.
Doing `./x.py dist --target thumbv8m.main-none-eabi` worked locally so I assume that this will also work on the CI.
It will (I think) however need a new release of alexcrichton/cc-rs to include the pull request alexcrichton/cc-rs#363 @alexcrichton
I hope to do the HardFloat version (`thumbv8m.main-none-eabihf`) and Baseline (`thumbv8m.base-none-eabi`) later, as fixes need to be done on compiler-builtins first to support those.
Rollup of 4 pull requests
Successful merges:
- #56874 (Simplify foreign type rendering.)
- #57113 (Move diagnostics out from QueryJob and optimize for the case with no diagnostics)
- #57366 (Point at match discriminant on type error in match arm pattern)
- #57538 (librustc_mir: Fix ICE with slice patterns)
Failed merges:
- #57381 (Tweak output of type mismatch between "then" and `else` `if` arms)
r? @ghost
librustc_mir: Fix ICE with slice patterns
If a match arm does not include all fields in a structure and a later
pattern includes a field that is an array, we will attempt to use the
array type from the prior arm. When calculating the field type, treat
a array of an unknown size as a `TyErr`.
Fixes: #57472
Point at match discriminant on type error in match arm pattern
```
error[E0308]: mismatched types
--> src/main.rs:5:9
|
4 | let temp: usize = match a + b {
| ----- this expression has type `usize`
5 | Ok(num) => num,
| ^^^^^^^ expected usize, found enum `std::result::Result`
|
= note: expected type `usize`
found type `std::result::Result<_, _>`
```
Fix#57279.
Simplify foreign type rendering.
Simplified foreign type rendering by switching from tables to flexbox. Also, removed some seemingly extraneous elements like “ghost” spans.
Reduces element count on the `std::iter::Iterator` page by 30%. On my laptop it drops Iterator page load time from ~15s to ~10s. Frame times during scrolling are a hair lower too.
Known visual changes (happy to tweak based on feedback):
* The main `impl ...` headers are now getting the default, larger, h3 font size. This was an accident, but I liked how it turned out so I didn't fix it.
* There's a hair less vertical spacing between the end of a where block and the start of the next fn. Now, all spacing is consistent. I think this looks a bit worse. I may tweak vertical spacing more here or in a follow-up that cleans up vertical spacing more broadly.
* "[src]" links are all sized at 17px. A few were 19px in the original.
I haven't yet done heavy cross-browser or cross-crate testing. I was hoping to get a quick thumbs up or thumbs down here at this first draft, then if this is on the right track I'll spend some time on that testing.
TODO:
- [x] Test on Chrome
- [x] Test on Firefox
- [ ] ~~Test on UC Android~~
- [x] Test on Edge
- [x] Test on iOS safari
- [x] Test on desktop safari
- [x] Update automated tests
- [x] Increase vertical margin
- [x] Fix "Important traits for" hover overlap
- [x] Wait for #55798 to land & merge it
rustc: Place wasm linker args first instead of last
This ensures that arguments passed via `-C link-arg` can override the
first ones on the command line, for example allowing configuring of the
stack size.
NLL: Add union justifications to conflicting borrows.
Fixes#57100.
This PR adds justifications to error messages for conflicting borrows of union fields.
Where previously an error message would say ``cannot borrow `u.b` as mutable..``, it now says ``cannot borrow `u` (via `u.b`) as mutable..``.
r? @pnkfelix
Make `TokenStream` less recursive.
`TokenStream` is currently recursive in *two* ways:
- the `TokenTree` variant contains a `ThinTokenStream`, which can
contain a `TokenStream`;
- the `TokenStream` variant contains a `Vec<TokenStream>`.
The latter is not necessary and causes significant complexity. This
commit replaces it with the simpler `Vec<(TokenTree, IsJoint)>`.
This reduces complexity significantly. In particular, `StreamCursor` is
eliminated, and `Cursor` becomes much simpler, consisting now of just a
`TokenStream` and an index.
The commit also removes the `Extend` impl for `TokenStream`, because it
is only used in tests. (The commit also removes those tests.)
Overall, the commit reduces the number of lines of code by almost 200.
If a match arm does not include all fields in a structure and a later
pattern includes a field that is an array, we will attempt to use the
array type from the prior arm. When calculating the field type, treat
a array of an unknown size as a TyErr.