Commit Graph

74794 Commits

Author SHA1 Message Date
Esteban Küber
0c9afa87ba Provide missing comma in match arm suggestion
When finding:

```rust
match &Some(3) {
    &None => 1
    &Some(2) => { 3 }
    _ => 2
}
```

provide the following diagnostic:

```
error: expected one of `,`, `.`, `?`, `}`, or an operator, found `=>`
 --> $DIR/missing-comma-in-match.rs:15:18
  |
X |         &None => 1
  |               --  - help: missing comma
  |               |
  |               while parsing the match arm starting here
X |         &Some(2) => { 3 }
  |                  ^^ expected one of `,`, `.`, `?`, `}`, or an operator here
```
2018-02-27 10:45:18 -08:00
bors
29f5c699b1 Auto merge of #48449 - petrochenkov:uidiff, r=nikomatsakis
Anonymize some line numbers in UI test output

New unstable flag `-Z ui-testing` is introduced. This flag changes diagnostic output of the compiler *in some way* making it more suitable for UI testing (this is intentionally vague).
At the moment this flag anonymizes line numbers at line starts thus solving the largest issue with UI test diffs. If diffs continue to be too noisy, some other tweaks could be applied (e.g. anonymizing lines/columns in `--> $DIR/file.rs:line:column`), but this needs some time and experience (we shouldn't diverge too much from the actual output in general).

If comment `// disable-ui-testing-normalization` is added to an UI test, then `-Z ui-testing` is not passed.

Closes https://github.com/rust-lang/rust/issues/46643
2018-02-27 00:29:50 +00:00
Vadim Petrochenkov
9f9183d34d Fix rebase 2018-02-26 21:20:31 +03:00
Vadim Petrochenkov
7ba5fd168a Update UI tests 2018-02-26 20:24:42 +03:00
Vadim Petrochenkov
99b1054d9f Anonymize remaining line numbers at line starts 2018-02-26 20:24:41 +03:00
Vadim Petrochenkov
e650eef8b0 Implement opt-out from UI testing normalization 2018-02-26 20:24:41 +03:00
Vadim Petrochenkov
fa2d9fc4b9 Update UI tests 2018-02-26 20:24:02 +03:00
Vadim Petrochenkov
cdbd8c2f2a Support flag -Z ui-testing for tweaking diagnostic output for UI tests 2018-02-26 20:24:00 +03:00
bors
bedbad6119 Auto merge of #48337 - GuillaumeGomez:rustc-explain, r=estebank
Rustc explain

Fixes #48041.

To make the review easier, I separated tests update to code update. Also, I used this script to generate new ui tests stderr:

```python
from os import listdir
from os.path import isdir, isfile, join

PATH = "src/test/ui"

def do_something(path):
    files = [join(path, f) for f in listdir(path)]

    for f in files:
        if isdir(f):
            do_something(f)
            continue
        if not isfile(f) or not f.endswith(".stderr"):
            continue
        x = open(f, "r")
        content = x.read().strip()
        if "error[E" not in content:
            continue
        errors = dict()
        for y in content.splitlines():
            if y.startswith("error[E"):
                errors[y[6:11]] = True
        errors = sorted(errors.keys())
        if len(errors) < 1:
            print("weird... {}".format(f))
            continue
        if len(errors) > 1:
            content += "\n\nYou've got a few errors: {}".format(", ".join(errors))
            content += "\nIf you want more information on an error, try using \"rustc --explain {}\"".format(errors[0])
        else:
            content += "\n\nIf you want more information on this error, try using \"rustc --explain {}\"".format(errors[0])
        content += "\n"
        x = open(f, "w")
        x.write(content)

do_something(PATH)
```
2018-02-26 12:34:52 +00:00
bors
4a70e27219 Auto merge of #48082 - jseyfried:improve_struct_field_hygiene, r=petrochenkov
macros: improve struct constructor field hygiene, fix span bug

Fixes #47311.
r? @nrc
2018-02-26 09:41:33 +00:00
Guillaume Gomez
ce6429af7a Fix new tests 2018-02-26 09:56:00 +01:00
bors
322d7f7b97 Auto merge of #48531 - kennytm:rollup, r=kennytm
Rollup of 17 pull requests

- Successful merges: #47964, #47970, #48076, #48115, #48166, #48281, #48297, #48302, #48362, #48369, #48489, #48491, #48494, #48517, #48529, #48235, #48330
- Failed merges:
2018-02-25 15:04:40 +00:00
kennytm
1aa103511b
Rollup merge of #48330 - frewsxcv:frewsxcv-tests-zero-duration, r=sfackler
Add tests ensuring zero-Duration timeouts result in errors; fix Redox issues.

Part of #48311
2018-02-25 22:47:56 +08:00
Corey Farwell
a554a2f564 Return error if timeout is zero-Duration on Redox. 2018-02-25 08:54:08 -05:00
kennytm
0652af21b5
Rollup merge of #48235 - varkor:parse-float-lonely-exponent, r=alexcrichton
Make ".e0" not parse as 0.0

This forces floats to have either a digit before the separating point, or after. Thus `".e0"` is invalid like `"."`, when using `parse()`. Fixes #40654. As mentioned in the issue, this is technically a breaking change... but clearly incorrect behaviour at present.
2018-02-25 21:36:46 +08:00
kennytm
268b6d6189
Rollup merge of #48529 - remexre:docs/fix/unicode-0021, r=kennytm
Fixes docs for ASCII functions to no longer claim U+0021 is '@'.

Looks like a typo that got copy-pasted without anyone checking on it.
2018-02-25 21:30:53 +08:00
kennytm
eb0ab5e6b2
Rollup merge of #48517 - penpalperson:master, r=Mark-Simulacrum
Added error-format flag to x.py.

Fixes #48475

r? @Mark-Simulacrum
2018-02-25 21:30:51 +08:00
kennytm
4ab2184312
Rollup merge of #48494 - bdrewery:freebsd-omit-frame-pointer, r=eddyb
Workaround abort(2) on compilation error on FreeBSD.

Same problem as OpenBSD, tracking bug #43575.

@semarie @dumbbell
2018-02-25 21:30:50 +08:00
kennytm
1c62067448
Rollup merge of #48491 - glaubitz:s390x-linux, r=sanxiyn
test: Fix s390x-unknown-linux-gnu atomic-lock-free test not run for systemz

The s390-unknown-linux-gnu atomic-lock-free test is currently run for ```LLVM_COMPONENTS == powerpc```. I assume it was meant to be run for ```LLVM_COMPONENTS == systemz```, so let's fix this.
2018-02-25 21:30:48 +08:00
kennytm
266386a10e
Rollup merge of #48489 - glaubitz:x32-linux, r=alexcrichton
bootstrap: Add openssl configuration for x86_64-unknown-linux-gnux32

OpenSSL provides a native configuration for x86_64-unknown-linux-gnux32:

> https://github.com/openssl/openssl/blob/master/Configurations/10-main.conf#L810

Let's use it.
2018-02-25 21:30:47 +08:00
kennytm
c9b6dcaaf9
Rollup merge of #48369 - newpavlov:rdrand, r=nagisa
Rename rdrnd target feature to rdrand

Plus minor cleanup.

Related stdsimd [issue](https://github.com/rust-lang-nursery/stdsimd/issues/325).
2018-02-25 21:30:45 +08:00
kennytm
f28931f767
Rollup merge of #48362 - cuviper:libdir_relative, r=Mark-Simulacrum
rustbuild: Restore Config.libdir_relative

This re-introduces a `Config.libdir_relative` field, now derived from
`libdir` and made relative to `prefix` if necessary.

This fixes a regression from #46592 when `--libdir` is given an absolute
path.  `Builder::sysroot_libdir` should always use a relative path so
its callers don't clobber system locations, and `librustc` also asserts
that `CFG_LIBDIR_RELATIVE` is really relative.
2018-02-25 21:30:44 +08:00
Guillaume Gomez
16fb6b082d Reduce error codes length when too much are thrown 2018-02-25 12:15:05 +01:00
Guillaume Gomez
5747fd6611 Update ui tests 2018-02-25 12:15:05 +01:00
Guillaume Gomez
1dc2015a9d Update tools code 2018-02-25 12:14:43 +01:00
Guillaume Gomez
9b597a1542 Add rustc --explain back 2018-02-25 12:14:43 +01:00
kennytm
6627cbae92
Rollup merge of #48302 - mark-i-m:markim_macro-test, r=aturon
Move macro-at-most-once-rep-ambig test to ui test

I had written this test for the feature. Now moving to ui test.
2018-02-25 15:54:46 +08:00
kennytm
b571155631
Rollup merge of #48297 - glaubitz:sparc-linux, r=estebank
Add missing pieces for sparc-linux-gnu support

I noticed that while Rust has CABI support for 32-bit SPARC, there are still some pieces missing to be able to use Rust on a 32-Bit SPARC system like Gentoo which still defaults to a 32-bit port unlike Debian's sparc64 port.

This PR is an attempt to add the missing pieces. I will send the necessary changes for libc in a separate PR.

CC @jrtc27
2018-02-25 15:54:45 +08:00
kennytm
3e2072e51d
Rollup merge of #48281 - jakllsch:netbsd-powerpc, r=alexcrichton
Add powerpc-unknown-netbsd target
2018-02-25 15:54:44 +08:00
kennytm
b443e57ce6
Rollup merge of #48166 - hedgehog1024:hedgehog1024-stabilize-entry_and_modify, r=alexcrichton
Stabilize 'entry_and_modify' feature

Stabilize `entry_and_modify` feature introduced by #44734.

Closes #44733
2018-02-25 15:54:42 +08:00
kennytm
562626ac3f
Rollup merge of #48115 - Centril:feature/iterator_flatten, r=alexcrichton
Add Iterator::flatten

This adds the trait method `.flatten()` on `Iterator` which flattens one level of nesting from an iterator or (into)iterators. The method `.flat_fmap(f)` is then redefined as `.map(f).flatten()`. The implementation of `Flatten` is essentially that of what it was for `FlatMap` but removing the call to `f` at various places.

Hopefully the type alias approach should be OK as was indicated / alluded to by @bluss and @eddyb in https://github.com/rust-lang/rfcs/pull/2306#issuecomment-361391370.

cc @scottmcm
2018-02-25 15:54:41 +08:00
kennytm
725856d67f
Rollup merge of #48076 - canarysnort01:fix_pie, r=alexcrichton
pass correct pie args to gcc linker

When linking with gcc, run gcc -v to see if --enable-default-pie is
compiled in. If it is, pass -no-pie when necessary to disable pie.
Otherwise, pass -pie when necessary to enable it.

Fixes #48032 and fixes #35061
2018-02-25 15:54:40 +08:00
kennytm
e253224541
Rollup merge of #47970 - vlovich:condvar_wait_until, r=dtolnay
Add Condvar APIs not susceptible to spurious wake

Provide wait_until and wait_timeout_until helper wrappers that aren't susceptible to spurious wake.
Additionally wait_timeout_until makes it possible to more easily write code that waits for a fixed amount of time in face of spurious wakes since otherwise each user would have to do math on adjusting the duration.

Implements #47960.
2018-02-25 15:54:39 +08:00
kennytm
f5116e712f
Rollup merge of #47964 - jcowgill:mips64-abi, r=eddyb
rustc_trans: rewrite mips64 ABI code

This PR rewrites the ABI handling code for 64-bit MIPS and should fix various FFI issues including #47290.

To accomodate the 64-bit ABI I have had to add a new `CastTarget` variant which I've called `Chunked` (though maybe this isn't the best name). This allows an ABI to cast to some arbitrary structure of `Reg` types. This is required on MIPS which might need to cast to a structure containing a mixture of `i64` and `f64` types.
2018-02-25 15:54:38 +08:00
Manish Goregaokar
0aa753ba30
1.25.0 -> 1.26.- 2018-02-25 14:24:24 +08:00
Nathan Ringo
64236092e5
Fixes docs for ASCII functions to no longer claim U+0021 is '@'. 2018-02-24 23:48:51 -06:00
bors
026339e42b Auto merge of #48520 - Manishearth:rollup, r=Manishearth
Rollup of 15 pull requests

- Successful merges: #47689, #48110, #48197, #48296, #48386, #48392, #48404, #48415, #48441, #48448, #48452, #48481, #48490, #48499, #48503
- Failed merges:
2018-02-25 02:07:14 +00:00
Manish Goregaokar
52047f0ba0 ignore-pretty on dyn trait test 2018-02-24 18:02:33 -08:00
Manish Goregaokar
7ba4afc17a
Rollup merge of #48503 - petrochenkov:nort, r=Mark-Simulacrum
Remove directory `src/rt`
2018-02-24 15:52:20 -08:00
Manish Goregaokar
0a7210166e
Rollup merge of #48499 - dwijnand:patch-1, r=BurntSushi
Fix capitalisation in Path#file_name's docs
2018-02-24 15:52:19 -08:00
Manish Goregaokar
9523c82543
Rollup merge of #48490 - petrochenkov:orpat, r=eddyb
Implement multiple patterns with `|` in `if let` and `while let` (RFC 2175)

cc https://github.com/rust-lang/rust/issues/48215
2018-02-24 15:52:17 -08:00
Manish Goregaokar
7e6829938c
Rollup merge of #48481 - Manishearth:dyn-paren, r=petrochenkov
Allow parentheses in `dyn (Trait)`

r? @eddyb @nikomatsakis
2018-02-24 15:52:16 -08:00
Manish Goregaokar
2dba874d57
Rollup merge of #48452 - varkor:unpacked-kind, r=eddyb
Introduce UnpackedKind

This adds an `UnpackedKind` type as a typesafe counterpart to `Kind`. This should make future changes to kinds (such as const generics!) more resilient, as the type-checker will be able to catch more potential issues.

r? @eddyb
cc @yodaldevoid
2018-02-24 15:52:15 -08:00
Manish Goregaokar
90f21d4377
Rollup merge of #48448 - nikomatsakis:default-binding-mode-issue-46688, r=cramertj
reset default binding mode when we pass through a `&` pattern

Fixes #46688.

r? @cramertj
2018-02-24 15:52:14 -08:00
Manish Goregaokar
69757c5bb9
Rollup merge of #48441 - petrochenkov:exty, r=estebank
Fix parsing of extern paths in types and poly-traits

Fixes https://github.com/rust-lang/rust/issues/48262
2018-02-24 15:52:13 -08:00
Manish Goregaokar
43d1d6e885
Rollup merge of #48415 - QuietMisdreavus:traits-on-traits-on-traits, r=Manishearth
rustdoc: don't crash when an external trait's docs needs to import another trait

Fixes https://github.com/rust-lang/rust/issues/48414

When resolving intra-paths for an item, rustdoc needs to have information about their items on hand, for proper bookkeeping. When loading a path for an external item, it needs to load these items from their host crate, since their information isn't otherwise available. This includes resolving paths for those docs. which can cause this process to recurse. Rustdoc keeps a map of external traits in a `RefCell<HashMap<DefId, Trait>>`, and it keeps a borrow of this active when importing an external trait. In the linked crash, this led to a RefCell borrow error, panic, and ICE.

This PR manually releases the borrow while importing the trait, and also keeps a list of traits being imported at the given moment. The latter keeps rustdoc from infinitely recursing as it tries to import the same trait repeatedly.
2018-02-24 15:52:11 -08:00
Manish Goregaokar
9901befe06
Rollup merge of #48404 - steveklabnik:second-edition-is-the-best-edition, r=QuietMisdreavus
Update the book to promote second edition

This updates the book repository, but mostly to include
https://github.com/rust-lang/book/pull/1180

TL;DR: the second edition is close enough to done that we should
universally recommend it over the first edition.
2018-02-24 15:52:10 -08:00
Manish Goregaokar
7738eb4ddb
Rollup merge of #48392 - estebank:string, r=petrochenkov
Handle custom diagnostic for `&str + String`

Now all of `&str + &str`, `&str + String` and `String + String` have relevant diagnostic output.
2018-02-24 15:52:09 -08:00
Manish Goregaokar
d45c4a6d27
Rollup merge of #48386 - withoutboats:nonstandard-style, r=Manishearth
Add nonstandard_style alias for bad_style.
2018-02-24 15:52:08 -08:00
Manish Goregaokar
58af0c7b64
Rollup merge of #48296 - ishitatsuyuki:exp-unblow, r=nikomatsakis
Fix exponential projection complexity on nested types

This implements solution 1 from https://github.com/rust-lang/rust/issues/38528#issuecomment-366263076.

The code quality is currently extremely poor, but we can improve them during review.

Blocking issues:

- we probably don't want a quadratic deduplication for obligations.
- is there an alternative to deduplication?

Based on #48315.

Needs changelog. Noticable improvement on compile time is expected.

Fix #38528
Close #39684
Close #43757
2018-02-24 15:52:07 -08:00