Commit Graph

76052 Commits

Author SHA1 Message Date
Alex Crichton
6fd3cc585a Rollup merge of #49262 - oli-obk:fixed_size_array_len, r=estebank
Produce nice array lengths on a best effort basis

fixes #49208

r? @estebank
2018-03-23 10:16:10 -07:00
Alex Crichton
815171b592 Rollup merge of #49169 - sanxiyn:doc-only, r=aturon
Document only-X test header

This was added in #47487 without documentation.
2018-03-23 10:16:10 -07:00
Alex Crichton
401a93096d Rollup merge of #49160 - estebank:issue-47457-missing-fields, r=oli-obk
Reduce the diagnostic spam when multiple fields are missing in pattern

Fix #47457.
2018-03-23 10:16:10 -07:00
Alex Crichton
db2dde9a41 Rollup merge of #49102 - glandium:decimal, r=aturon
Remove core::fmt::num::Decimal

Before ebf9e1aaf6, it was used for Display::fmt, but ebf9e1aaf6 replaced
that with a faster implementation, and nothing else uses it.
2018-03-23 10:16:09 -07:00
Alex Crichton
4b31b5bda7 Rollup merge of #49030 - Zoxc:misc, r=michaelwoerister
Misc changes from my parallel rustc branch

r? @michaelwoerister
2018-03-23 10:16:09 -07:00
Alex Crichton
f74d01cf29 Rollup merge of #49028 - QuietMisdreavus:the-dark-forbidden-corners-of-rustdoc, r=frewsxcv
add an "unstable features" chapter to the rustdoc book

There are several rustdoc features that currently are undocumented, but also don't fit with the rest of the Rustdoc Book since they're also unstable. Some of these have corresponding feature gates and chapters in the Unstable Book, but many don't, and i wanted a place to talk about them officially.

Goal: talk about everything rustdoc can do that needs nightly

- [x] Feature gates (extensions to the doc attribute that can be caught by the compiler)
  - [x] doc(cfg)
  - [x] doc(masked)
  - [x] doc(spotlight)
  - [x] doc(include)
- [x] Command-line flags (features that require a CLI flag to use, where the flag itself is a `-Z` command or otherwise requires `-Z unstable-options` before rustdoc will accept it)
  - [x] markdown-before-content/markdown-after-content
  - [x] playground-url
  - [x] display-warnings
  - [x] crate-version
  - [x] linker
  - [x] sort-modules-by-appearance
  - [x] themes/theme-checker
  - [x] resource-suffix
  - [x] `-Z force-unstable-if-unmarked`
- [x] Nightly-gated functionality (features that are gated by requiring a nightly build without needing a CLI flag or a feature gate to unlock)
  - [x] intra-links
  - [x] error numbers for `compile_fail` doctests
2018-03-23 10:16:08 -07:00
Alex Crichton
7c0c7ef330 Rollup merge of #48909 - RalfJung:type_alias_bounds, r=petrochenkov
Improve lint for type alias bounds

First of all, I learned just today that I was wrong assuming that the bounds in type aliases are entirely ignored: It turns out they are used to resolve associated types in type aliases. So:
```rust
type T1<U: Bound> = U::Assoc; // compiles
type T2<U> = U::Assoc; // fails
type T3<U> = <U as Bound>::Assoc; // "correct" way to write this, maybe?
```
I am sorry for creating this mess.

This PR changes the wording of the lint accordingly. Moreover, since just removing the bound is no longer always a possible fix, I tried to detect cases like `T1` above and show a helpful message to the user:
```
warning: bounds on generic parameters are not enforced in type aliases
  --> $DIR/type-alias-bounds.rs:57:12
   |
LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases
   |            ^^^^^
   |
   = help: the bound will not be checked when the type alias is used, and should be removed
help: use absolute paths (i.e., <T as Trait>::Assoc) to refer to associated types in type aliases
  --> $DIR/type-alias-bounds.rs:57:21
   |
LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases
   |                     ^^^^^^^^
```
I am not sure if I got this entirely right. Ideally, we could provide a suggestion involving the correct trait and type name -- however, while I have access to the HIR in the lint, I do not know how to get access to the resolved name information, like which trait `Assoc` belongs to above. The lint does not even run if that resolution fails, so I assume that information is available *somewhere*...

This is a follow-up for (parts of) https://github.com/rust-lang/rust/pull/48326. Also see https://github.com/rust-lang/rust/issues/21903.

This changes the name of a lint, but that lint was just merged to master yesterday and has never even been on beta.
2018-03-23 10:16:08 -07:00
Alex Crichton
f836ae48e6 Rollup merge of #48883 - alexcrichton:wasm-custom-sections, r=nikomatsakis
rustc: Add a `#[wasm_custom_section]` attribute

This commit is an implementation of adding custom sections to wasm artifacts in
rustc. The intention here is to expose the ability of the wasm binary format to
contain custom sections with arbitrary user-defined data. Currently neither our
version of LLVM nor LLD supports this so the implementation is currently custom
to rustc itself.

The implementation here is to attach a `#[wasm_custom_section = "foo"]`
attribute to any `const` which has a type like `[u8; N]`. Other types of
constants aren't supported yet but may be added one day! This should hopefully
be enough to get off the ground with *some* custom section support.

The current semantics are that any constant tagged with `#[wasm_custom_section]`
section will be *appended* to the corresponding section in the final output wasm
artifact (and this affects dependencies linked in as well, not just the final
crate). This means that whatever is interpreting the contents must be able to
interpret binary-concatenated sections (or each constant needs to be in its own
custom section).

To test this change the existing `run-make` test suite was moved to a
`run-make-fulldeps` folder and a new `run-make` test suite was added which
applies to all targets by default. This test suite currently only has one test
which only runs for the wasm target (using a node.js script to use `WebAssembly`
in JS to parse the wasm output).
2018-03-23 10:16:07 -07:00
Alex Crichton
16eeb10bee Rollup merge of #48624 - bdrewery:freebsd-posix-spawn, r=alexcrichton
Command: Support posix_spawn() on FreeBSD/OSX/GNU Linux
2018-03-23 10:16:07 -07:00
Alex Crichton
7cf4cb5a7b
Rollup merge of #48265 - SimonSapin:nonzero, r=KodrAus
Add 12 num::NonZero* types for primitive integers, deprecate core::nonzero

RFC: https://github.com/rust-lang/rfcs/pull/2307
Tracking issue: ~~https://github.com/rust-lang/rust/issues/27730~~ https://github.com/rust-lang/rust/issues/49137
Fixes https://github.com/rust-lang/rust/issues/27730
2018-03-23 09:27:06 -05:00
Simon Sapin
00721de714 Mention closures in docs for Clone and Copy 2018-03-23 15:12:10 +01:00
David Wood
3a0162b7cb
Fixed issues with incremental tests. 2018-03-23 14:04:08 +00:00
Oliver Schneider
f9019aee5b
Simplify local accessors 2018-03-23 12:44:33 +01:00
David Wood
03481f19ea
Updated MIR with UserAssertTy in mir-opt tests. 2018-03-23 11:34:06 +00:00
Simon Sapin
ee67e14034 Stabilize the copy_closures and clone_closures features
In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do.
2018-03-23 11:37:07 +01:00
csmoe
ced7687c06 add test for issue-48238 2018-03-23 18:01:05 +08:00
Oliver Schneider
4ea4dd23cd
Don't allocate a local array at all if there are no locals 2018-03-23 10:47:55 +01:00
Oliver Schneider
b18b776b8f
Replace uses of Hash(Map|Set) with FxHash(Map|Set) in miri 2018-03-23 10:32:27 +01:00
Oliver Schneider
bf8e4f231a
Vec<_> -> IndexVec<Local, _> 2018-03-23 08:31:13 +01:00
bors
55e1104dd9 Auto merge of #49285 - nrc:update, r=alexcrichton
Update RLS and Rustfmt

Fixes broken RLS tests/build

r? @alexcrichton
2018-03-23 05:43:00 +00:00
Alex Crichton
a09e9e9a2a ci: Don't use Travis caches for docker images
This commit moves away from caching on Travis to our own caching on S3 for
caching docker layers between builds. Unfortunately the Travis caches have over
time had a few critical pain points:

* Caches are only updated for successful builds, meaning that if a build times
  out or fails in a different location the sucessfully-created docker images
  isn't always cached. While this makes sense as a general rule of caches it
  hurts our use cases.

* Caches are per-branch and builder which means that we don't have a separate
  cache on each release channel. All our merges go through the `auto` branch
  which means that they're all sharing the same cache, even those for merging to
  master/beta. This means that PRs which switch between master/beta will keep
  rebuilting and having cache misses.

* Caches have historically been invaliated somewhat regularly a little more
  aggressively than we'd want (I think).

* We don't always need to update the contents of the cache if the Docker image
  didn't change at all, and saving off the docker layers can sometimes be quite
  expensive.

For all these reasons this commit drops the usage of Travis's built-in caching
support. Instead our own caching is used by storing blobs to S3. Normally this
would be a very risky endeavour but we're basically priming a cache for a cache
(docker) so if we get this wrong the failure mode is longer builds, not stale
caches. We'll notice that pretty quickly and hopefully fix it!

The logic here is inserted directly into the `src/ci/docker/run.sh` script to
download an image based on a shasum of the `Dockerfile` and other assorted files.
This blob, if found, is loaded into docker and we record what layers were
inserted. After docker finishes the build (hopefully quickly with lots of cache
hits) we then see the sha of the final image. If it's one of the layers we
loaded then there's no need to update the cache. Otherwise we upload our layers
to the global cache, possibly overwriting what we previously just downloaded.

This is hopefully a step towards mitigating #49278 although it doesn't
completely fix it as it means we'll still probably have to retry builds that
bust the cache.
2018-03-22 18:31:45 -07:00
Josh Stone
86f7d8939d Allow installing rustfmt without config.extended
This assertion was preventing `./x.py install rustfmt` if attempted
without an "extended" build configuration, but it actually builds and
installs just fine.
2018-03-22 18:31:32 -07:00
David Wood
447ae7612a
Added flag to disable user type assertion. 2018-03-22 22:48:39 +00:00
Niko Matsakis
04aeef8d45
Debug logs for replace_bound_regions_with_nll_infer_vars 2018-03-22 22:40:51 +00:00
Nick Cameron
aa238a3780 Update RLS and Rustfmt
Fixes broken RLS tests/build
2018-03-23 10:34:47 +13:00
David Wood
fc5c4daa88
Temporarily only adding UserAssertTy on binding patterns. 2018-03-22 21:11:03 +00:00
David Wood
e1648bde17
Switched from canonicalize_query to canonicalize_response 2018-03-22 21:11:03 +00:00
David Wood
692a931887
UserAssertTy can handle inference variables.
This commit modifies the UserAssertTy statement to take a canonicalized
type rather than a regular type so that we can handle the case where the
user provided type contains a inference variable.
2018-03-22 21:11:02 +00:00
David Wood
5d2a60c57e
No longer visiting user_assert_ty statements in constraint generation. 2018-03-22 21:11:02 +00:00
David Wood
d4b9a7874b
Added comment in renumberer about UserAssertTy. 2018-03-22 21:11:02 +00:00
David Wood
c8d81b1a2e
Updated test with expected error message. 2018-03-22 21:11:01 +00:00
David Wood
ee4c7ac154
Added override in renumberer for UserAssertTy. 2018-03-22 21:11:01 +00:00
David Wood
239b3ec473
Changed location to at_self from at_successor. 2018-03-22 21:11:01 +00:00
David Wood
5f21aa8734
Added initial processing of UserAssertTy statements. 2018-03-22 21:11:00 +00:00
David Wood
1331cd4a8c
Killing UserAssertTy in CleanupPostBorrowck pass. 2018-03-22 21:11:00 +00:00
David Wood
17b285d203
Added UserAssertTy statement. 2018-03-22 21:10:59 +00:00
David Wood
c0fdb29362
Added initial test for #47184 2018-03-22 21:09:37 +00:00
Niko Matsakis
94468dac63 permit '_ and &T in impl headers
Deprecated forms of elision are not supported.
2018-03-22 16:54:52 -04:00
Niko Matsakis
df70060bd6 distinguish the three cases where elision occurs 2018-03-22 16:54:52 -04:00
Niko Matsakis
1488095b08 change in-band array to store hir::LifetimeName 2018-03-22 16:54:51 -04:00
Niko Matsakis
d913af8691 add new test for dyn<Trait + '_> used in a struct
`'_` is illegal in structs; this currently gets a duplicate error
2018-03-22 16:54:51 -04:00
Niko Matsakis
f07ebc5df8 add a helper function maybe_collect_in_band_lifetime 2018-03-22 16:54:51 -04:00
Niko Matsakis
f71807d507 make parent_id not optional
It'd be pretty buggy if `None` were supplied anyway; we'd skip over
in-band lifetimes completely!
2018-03-22 16:54:51 -04:00
Niko Matsakis
a5743b3b57 change with_in_scope_lifetime_defs to take an iterator 2018-03-22 16:54:51 -04:00
Niko Matsakis
1b26be5750 rustfmt lowering.rs 2018-03-22 16:54:50 -04:00
David Wood
73fa6d52ed
Remove std/test documentation from compiler docs. 2018-03-22 20:49:05 +00:00
Alex Crichton
d889957dab rustc: Add a #[wasm_import_module] attribute
This commit adds a new attribute to the Rust compiler specific to the wasm
target (and no other targets). The `#[wasm_import_module]` attribute is used to
specify the module that a name is imported from, and is used like so:

    #[wasm_import_module = "./foo.js"]
    extern {
        fn some_js_function();
    }

Here the import of the symbol `some_js_function` is tagged with the `./foo.js`
module in the wasm output file. Wasm-the-format includes two fields on all
imports, a module and a field. The field is the symbol name (`some_js_function`
above) and the module has historically unconditionally been `"env"`. I'm not
sure if this `"env"` convention has asm.js or LLVM roots, but regardless we'd
like the ability to configure it!

The proposed ES module integration with wasm (aka a wasm module is "just another
ES module") requires that the import module of wasm imports is interpreted as an
ES module import, meaning that you'll need to encode paths, NPM packages, etc.
As a result, we'll need this to be something other than `"env"`!

Unfortunately neither our version of LLVM nor LLD supports custom import modules
(aka anything not `"env"`). My hope is that by the time LLVM 7 is released both
will have support, but in the meantime this commit adds some primitive
encoding/decoding of wasm files to the compiler. This way rustc postprocesses
the wasm module that LLVM emits to ensure it's got all the imports we'd like to
have in it.

Eventually I'd ideally like to unconditionally require this attribute to be
placed on all `extern { ... }` blocks. For now though it seemed prudent to add
it as an unstable attribute, so for now it's not required (as that'd force usage
of a feature gate). Hopefully it doesn't take too long to "stabilize" this!

cc rust-lang-nursery/rust-wasm#29
2018-03-22 13:16:38 -07:00
Alex Crichton
7df6f4161c rustc: Add a #[wasm_custom_section] attribute
This commit is an implementation of adding custom sections to wasm artifacts in
rustc. The intention here is to expose the ability of the wasm binary format to
contain custom sections with arbitrary user-defined data. Currently neither our
version of LLVM nor LLD supports this so the implementation is currently custom
to rustc itself.

The implementation here is to attach a `#[wasm_custom_section = "foo"]`
attribute to any `const` which has a type like `[u8; N]`. Other types of
constants aren't supported yet but may be added one day! This should hopefully
be enough to get off the ground with *some* custom section support.

The current semantics are that any constant tagged with `#[wasm_custom_section]`
section will be *appended* to the corresponding section in the final output wasm
artifact (and this affects dependencies linked in as well, not just the final
crate). This means that whatever is interpreting the contents must be able to
interpret binary-concatenated sections (or each constant needs to be in its own
custom section).

To test this change the existing `run-make` test suite was moved to a
`run-make-fulldeps` folder and a new `run-make` test suite was added which
applies to all targets by default. This test suite currently only has one test
which only runs for the wasm target (using a node.js script to use `WebAssembly`
in JS to parse the wasm output).
2018-03-22 13:16:38 -07:00
bors
52f7e8836c Auto merge of #49210 - oli-obk:pango_crash, r=eddyb
Fix the conversion between bit representations and i128 representations

fixes #49181

the `Discr` type now encodes the bit representation instead of `i128` or `u128` casted to `u128`.

r? @eddyb
2018-03-22 20:02:14 +00:00
David Wood
1b0e9f5af9
Only generate documentation for local rustc crates. 2018-03-22 17:21:30 +00:00