Commit Graph

75179 Commits

Author SHA1 Message Date
Esteban Küber
36baa81be9 Add label to primary span in some parse errors 2018-02-27 10:47:33 -08:00
Esteban Küber
ba7039cfd6 Detect missing if blocks
When unnecessarily using a fat arrow after an if condition, suggest the
removal of it.

When finding an if statement with no block, point at the `if` keyword to
provide more context.
2018-02-27 10:46:23 -08:00
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
Scott McMurray
fc2e4e7833 Put some thought and documentation effort into process::ExitCode 2018-02-27 10:31:17 -08:00
John Kåre Alsaker
89e55d108c Make TransitiveRelation thread safe. Avoid locking by using get_mut in some cases. 2018-02-27 19:07:33 +01:00
Mazdak Farrokhzad
f8ebb3f09f fix wording on panics in binary operators on RefCells" 2018-02-27 15:48:50 +01:00
Björn Steinbrink
f05d9679d7 Backport LLVM fixes for a JumpThreading / assume intrinsic bug 2018-02-27 14:20:13 +01:00
Tatsuyuki Ishi
f297f56e76 Bring back ParamEnv deduplication 2018-02-27 17:30:20 +09:00
Phlosioneer
ffb6291cd0 Improve --help performance for x.py
Since compiling the bootstrap command doesn't require any submodules,
we can skip updating submodules when a --help command is passed in.
On my machine, this saves 1 minute if the submodules are already
downloaded, and 10 minutes if run on a clean repo.

This commit also adds a message before compiling/downloading anything
when a --help command is passed in, to tell the user WHY --help
takes so long to complete. It also points the user to the bootstrap
README.md for faster help.

Finally, this fixes one warning message that still referenced using
make instead of x.py, even though x.py is now the standard way of
building rust.
2018-02-26 20:45:52 -05:00
Phlosioneer
b7b3498ce8 Fix doctest failure
Tried to be fancy with print statements.
2018-02-26 19:48:15 -05: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
Alex Crichton
c133a082a8 rustc: Rename bmi feature to bmi1
This is what [Intel calls it][bmi1] and will [remove a special case][stdsimd]
when verifying intrinsics in stdsimd.

[bmi1]: https://software.intel.com/sites/landingpage/IntrinsicsGuide/#othertechs=BMI1
[stdsimd]: bed25b2a9f/crates/stdsimd-verify/tests/x86-intel.rs (L252-L258)
2018-02-26 15:58:16 -08:00
Mark Simulacrum
9c80019e6c Fix error-format argument to x.py 2018-02-26 15:07:24 -07:00
Bryan Drewery
279e5b0a48 FreeBSD uses Clang which can return small structs as an integer. 2018-02-26 10:21:55 -08:00
Bryan Drewery
2026453bcf Add specific target option for returning struct as an integer. 2018-02-26 10:21:52 -08: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
Mark Simulacrum
5db73fc6db Encode linker arguments as UTF-16 on MSVC platforms 2018-02-26 08:51:39 -08:00
Christian Poveda
9091584def some grammar corrections 2018-02-26 11:14:40 -05: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
Ryan Cumming
c237d4f859 Add test for #48508
This is named for the issue as it's testing the specific details of that
bug. It's a bit tricky as the ICE requires multiple files and debug info
enabled to trigger.
2018-02-26 19:25:10 +11:00
John Paul Adrian Glaubitz
7c84ba43ce test: Run atomic-lock-free on powerpc-linux-gnuspe 2018-02-26 02:07:24 +01:00
John Paul Adrian Glaubitz
b7683a33ce build-manifest: Add powerpc-unknown-linux-gnuspe target 2018-02-26 02:07:24 +01:00
John Paul Adrian Glaubitz
a22fbf8a9c librustc_back: Add support for powerpc-linux-gnuspe 2018-02-26 02:07:24 +01:00
John Paul Adrian Glaubitz
88de279dca bootstrap: Add openssl configuration for powerpc-unknown-linux-gnuspe 2018-02-26 02:07:24 +01:00
varkor
2466644389 Ensure main() always has external linkage
This ensures that the entry function is never elided due to inlining, even with `inline(always)`. Fixes #47783.

There were a couple of possible ways of addressing this issue; I simply picked the one that seemed most direct. A warning could be appropriate, but considering using inlining hints in other places it doesn't apply also throws no warnings, and it seems like an edge case anyway, I haven't added one for now.
2018-02-25 23:05:06 +00:00
Mark Mansi
7a82da1c4d tidy fix 2018-02-25 15:42:25 -06:00
Mark Mansi
d6f22a2481 Make comment into a doc comment and change readme ref 2018-02-25 15:26:53 -06:00
Mark Mansi
968ce252a8 Change links to readmes 2018-02-25 15:24:14 -06:00
Phlosioneer
e8904f935a Change the example string to something arbitrary
The choice of string is arbitrary, so all references to a number
in the string were removed. The string is now the standard "Hello
world!".
2018-02-25 15:46:17 -05:00
Mikhail Modin
12c7e27330 restore Subslice move out from array after elaborate drops and borrowck 2018-02-25 18:59:16 +03: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
Christian Poveda
397ce8a1ae fixed links 2018-02-25 09:39:21 -05: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