Commit Graph

82130 Commits

Author SHA1 Message Date
varkor
384db4f0cf Add support for all integer types 2018-08-16 20:09:04 +01:00
varkor
b3d2baff94 Give correct suggestions 2018-08-16 20:09:04 +01:00
varkor
e3357d9984 Implement interval checking 2018-08-16 20:09:04 +01:00
bors
b5590423e6 Auto merge of #53304 - dtolnay:extend, r=dtolnay
TokenStream::extend

Two new insta-stable impls in libproc_macro:

```rust
impl Extend<TokenTree> for TokenStream
impl Extend<TokenStream> for TokenStream
```

`proc_macro::TokenStream` already implements `FromIterator<TokenTree>` and `FromIterator<TokenStream>` so I elected to support the same input types for `Extend`.

**This commit reduces compile time of Serde derives by 60% (takes less than half as long to compile)** as measured by building our test suite:

```console
$ git clone https://github.com/serde-rs/serde
$ cd serde/test_suite
$ cargo check --tests --features proc-macro2/nightly
$ rm -f ../target/debug/deps/libtest_*.rmeta
$ time cargo check --tests --features proc-macro2/nightly
Before: 20.8 seconds
After: 8.6 seconds
```

r? @alexcrichton
2018-08-16 15:44:30 +00:00
bors
5050349749 Auto merge of #53256 - ollie27:writeln, r=KodrAus
Don't accept non-string literals for the format string in writeln

This is to improve diagnostics.

`println` and `eprintln` were already fixed by #52394.

Fixes #30143
2018-08-16 13:29:40 +00:00
bors
b837f5be70 Auto merge of #53173 - alexcrichton:win-arm64, r=sfackler
Start adding an `aarch64-pc-windows-msvc` target

This commit adds the necessary definitions for target specs and such as well as
the necessary support in libstd to compile basic `aarch64-pc-windows-msvc`
binaries. The target is not currently built on CI, but it can be built locally
with:

    ./configure --target=aarch64-pc-windows-msvc --set rust.lld
    ./x.py build src/libstd --target aarch64-pc-windows-msvc

Currently this fails to build `libtest` due to a linker bug (seemingly in LLD?)
which hasn't been investigate yet. Otherwise though with libstd you can build a
hello world program (linked with LLD). I've not tried to execute it yet, but it
at least links!

Full support for this target is still a long road ahead, but this is hopefully a
good stepping stone to get started.

Points of note about this target are:

* Currently defaults to `panic=abort` as support is still landing in LLVM for
  SEH on AArch64.
* Currently defaults to LLD as a linker as I was able to get farther with it
  than I was with `link.exe`
2018-08-16 11:18:12 +00:00
bors
142bb27373 Auto merge of #53147 - ashtneoi:dont-suggest-ref, r=estebank
For move errors, suggest match ergonomics instead of `ref`

Partially fixes issue #52423. Also makes errors and suggestions more consistent between move-from-place and move-from-value errors.

Limitations:
- Only the first pattern in a match arm can have a "consider removing this borrow operator" suggestion.
- Suggestions don't always compile as-is (see the TODOs in the test for details).

Sorry for the really long test. I wanted to make sure I handled every case I could think of, and it turned out there were a lot of them.

Questions:
- Is there any particular applicability I should set on those suggestions?
- Are the notes about the `Copy` trait excessive?
2018-08-16 08:45:32 +00:00
bors
996e26c23f Auto merge of #53295 - estebank:on-unimplemented, r=michaelwoerister
Various changes to `rustc_on_unimplemented`

- Add `from_method` and `from_desugaring` to formatting options
- Change wording of errors slightly
2018-08-16 06:34:13 +00:00
ashtneoi
0023dd9ba1 Split tests more and bless them again 2018-08-15 22:36:19 -07:00
ashtneoi
f335fb08c2 Move tests into their own directory 2018-08-15 22:35:56 -07:00
bors
fc323ba160 Auto merge of #53293 - petrochenkov:gramattr2, r=alexcrichton
syntax: Enforce attribute grammar in the parser

Also fix feature-gating for `unrestricted_attribute_tokens` that was introduced in https://github.com/rust-lang/rust/pull/53270, but was actually broken.

cc https://github.com/rust-lang/rust/pull/50911
2018-08-16 04:16:12 +00:00
bors
6c712b1492 Auto merge of #53289 - ljedrz:improve_lexer, r=michaelwoerister
A few cleanups and minor improvements for the lexer

- improve readability by adjusting the formatting of some function signatures and adding some newlines
- reorder some functions for easier reading
- remove redundant `'static` in `const`s
- remove some explicit `return`s
- read directly to a `String` in `gather_comments_and_literals`
- change `unwrap_or!` (macro) to `unwrap_or` (function)
- move an `assert!`ion from `try_next_token` (called in a loop) to `try_real_token` after all calls to `try_next_token`
- `#[inline]` some one-liner functions
- assign directly from an `if-else` expression
- refactor a `match` to `map_or`
- add a `token::is_irrelevant` function to detect tokens that are not "`real`"
2018-08-16 01:08:13 +00:00
Alex Crichton
fccc04d3e7 Start adding an aarch64-pc-windows-msvc target
This commit adds the necessary definitions for target specs and such as well as
the necessary support in libstd to compile basic `aarch64-pc-windows-msvc`
binaries. The target is not currently built on CI, but it can be built locally
with:

    ./configure --target=aarch64-pc-windows-msvc --set rust.lld
    ./x.py build src/libstd --target aarch64-pc-windows-msvc

Currently this fails to build `libtest` due to a linker bug (seemingly in LLD?)
which hasn't been investigate yet. Otherwise though with libstd you can build a
hello world program (linked with LLD). I've not tried to execute it yet, but it
at least links!

Full support for this target is still a long road ahead, but this is hopefully a
good stepping stone to get started.

Points of note about this target are:

* Currently defaults to `panic=abort` as support is still landing in LLVM for
  SEH on AArch64.
* Currently defaults to LLD as a linker as I was able to get farther with it
  than I was with `link.exe`
2018-08-15 17:20:13 -07:00
ashtneoi
f4229b81b5 Re-bless test 2018-08-15 15:25:53 -07:00
ashtneoi
4c4e1ef2c5 Add files I forgot to commit earlier 2018-08-15 15:14:21 -07:00
ashtneoi
671d7e064f Change a method name and clarify a comment 2018-08-15 15:14:21 -07:00
ashtneoi
bd2b54c23c Bless tests 2018-08-15 15:14:21 -07:00
ashtneoi
a5b008c450 Test move-into-Fn/FnMut errors too 2018-08-15 15:14:21 -07:00
ashtneoi
6a24abbbc5 Fix compiletest JSON error message 2018-08-15 15:14:21 -07:00
ashtneoi
3c3a7bad49 Allocate fewer Strings at a time 2018-08-15 15:14:21 -07:00
ashtneoi
81c27c6af7 Add another FIXME about suggestions 2018-08-15 15:14:21 -07:00
ashtneoi
9a0020a879 Bless UI tests 2018-08-15 15:14:21 -07:00
ashtneoi
d6dbdee739 Remove incorrect space 2018-08-15 15:14:21 -07:00
ashtneoi
a583aa642e Remove unnecessary comment
Turns out I didn't read the original comment correctly and had some
confusion about how MIR uses temporaries.
2018-08-15 15:14:21 -07:00
ashtneoi
0a82abc47b Test patterns in tuples 2018-08-15 15:14:21 -07:00
ashtneoi
6cf4e14ac0 Coalesce var-is-not-Copy notes per move 2018-08-15 15:14:21 -07:00
ashtneoi
20ae08bda6 Dedup suggestions 2018-08-15 15:14:21 -07:00
ashtneoi
40b5118c8a Remove unnecessary underscore 2018-08-15 15:14:21 -07:00
ashtneoi
8135372ed1 Change TODOs to FIXMEs 2018-08-15 15:14:21 -07:00
ashtneoi
10aaba8dbe Make move errors more consistent with typeck errors 2018-08-15 15:14:21 -07:00
ashtneoi
701c74e067 Make move error suggestions clearer 2018-08-15 15:14:21 -07:00
ashtneoi
b05e9a7f77 Add backquotes around variable name 2018-08-15 15:14:21 -07:00
ashtneoi
8080bdf275 Fix move errors for index expressions
The suggestion logic gave up too early, which kept it from suggesting
borrowing index expressions.
2018-08-15 15:14:21 -07:00
ashtneoi
54ddb36ce7 Test move errors for index expressions 2018-08-15 15:14:21 -07:00
ashtneoi
1e87908c52 Accept whitespace between & and mut 2018-08-15 15:14:21 -07:00
ashtneoi
3a5812bdd9 Add more TODOs 2018-08-15 15:14:21 -07:00
ashtneoi
a05f82fd2d Suggest match ergonomics, not ref/ref mut 2018-08-15 15:14:21 -07:00
ashtneoi
7b10133297 Fix some random stuff 2018-08-15 15:10:43 -07:00
bors
d767ee1161 Auto merge of #53400 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #52453 (improve diagnostics for tests with custom return values)
 - #53271 (use ? to simplify `TransitiveRelation.maybe_map`)
 - #53279 (Extend documentation of `rustc_on_unimplemented`)
 - #53342 (fix error for unsized packed struct field)
 - #53344 (Add doc examples for std::alloc::{alloc,alloc_zeroed}.)
 - #53368 (Ignore test that fails on stage1)
 - #53388 (Fix links' color)
 - #53396 (Fix since of Iterator::flatten to be a proper semver)

Failed merges:

r? @ghost
2018-08-15 19:39:54 +00:00
Guillaume Gomez
b9a51ce2f6
Rollup merge of #53396 - matklad:fix-flatten-since, r=varkor
Fix since of Iterator::flatten to be a proper semver

r? @kennytm
2018-08-15 19:20:29 +02:00
Guillaume Gomez
7acfa8615a
Rollup merge of #53388 - GuillaumeGomez:fix-links-color, r=frewsxcv
Fix links' color

Fixes #53375.

Problem was coming from the minifier.

r? @frewsxcv
2018-08-15 19:20:28 +02:00
Guillaume Gomez
a9a67a3a76
Rollup merge of #53368 - matthewjasper:only-stage-2, r=varkor
Ignore test that fails on stage1

The error code is not emitted on stage1, so ignore this test there.
2018-08-15 19:20:26 +02:00
Guillaume Gomez
25839dd9c6
Rollup merge of #53344 - frewsxcv:frewsxcv-doc-ptr, r=ollie27
Add doc examples for std::alloc::{alloc,alloc_zeroed}.

None
2018-08-15 19:20:25 +02:00
Guillaume Gomez
6bea743d56
Rollup merge of #53342 - RalfJung:unsized-packed, r=cramertj
fix error for unsized packed struct field

It was really confusing to be told "only the last field of a struct may have a dynamically sized type" when only the last field *was* unsized.
2018-08-15 19:20:23 +02:00
Guillaume Gomez
8e4f2d115a
Rollup merge of #53279 - estebank:on-unimplemented-doc, r=GuillaumeGomez
Extend documentation of `rustc_on_unimplemented`
2018-08-15 19:20:22 +02:00
Guillaume Gomez
b941c8e7fb
Rollup merge of #53271 - llogiq:simplify-maybe-map, r=joshtriplett
use ? to simplify `TransitiveRelation.maybe_map`

I think this looks much clearer than the original.
2018-08-15 19:20:21 +02:00
Guillaume Gomez
d8815cfe7d
Rollup merge of #52453 - srijs:fix-52436, r=TimNN
improve diagnostics for tests with custom return values

This is an attempt at getting the ball rolling to improve the diagnostics for test functions that return custom `impl Termination` values (see #52436).

An alternative could be to use `eprintln!`, but including this in the panic message felt nicely consistent with how failing test assertions would be reported.

Let me know what you think!
2018-08-15 19:20:19 +02:00
bors
d679b57a3a Auto merge of #53164 - davidtwco:issue-52663-span-decl-captured-variables, r=nikomatsakis
Provide span for declaration of captured variables

Part of #52663.

r? @nikomatsakis
2018-08-15 17:03:39 +00:00
Aleksey Kladov
1a0d3f0979 Fix since of Iterator::flatten to be a proper semver 2018-08-15 19:28:42 +03:00
bors
0f4b4987cd Auto merge of #53237 - overdrivenpotato:wasm-export-table, r=alexcrichton
Export WASM table by default

This allows loading a rust-generated `.wasm` binary in a host and using the exported table much like the `memory` export.
2018-08-15 14:40:46 +00:00