Commit graph

73453 commits

Author SHA1 Message Date
kennytm
233f29190b Rollup merge of #47436 - GuillaumeGomez:up-html-diff, r=QuietMisdreavus
Update html-diff crate => fix unicode parsing and invalid paths

r? @QuietMisdreavus
2018-01-18 01:57:19 +08:00
kennytm
7e70993065 Rollup merge of #47427 - EdSchouten:cloudabi-ci, r=alexcrichton
Add a Docker container for doing automated builds for CloudABI.

Setting up a cross compilation toolchain for CloudABI is relatively
easy. It's just a matter of installing a somewhat recent version of
Clang (5.0 preferred) and installing the corresponding
`${target}-cxx-runtime` package, containing a set of core C/C++ libraries
(libc, libc++, libunwind, etc).

Eventually it would be nice if we could also run `x.py test`. That,
however still requires some more work. Both libtest and compiletest
would need to be adjusted to deal with CloudABI's requirement of having
all of an application's dependencies injected. Let's settle for just
doing `x.py dist` for now.
2018-01-18 01:57:18 +08:00
kennytm
01749e1b34 Rollup merge of #47426 - varkor:default-mir-dump-dir, r=nikomatsakis
Add a default directory for -Zmir-dump-dir

The current behaviour of dumping in the current directory is rarely
desirable: a sensible default directory for dumping is much more
convenient. This makes sets the default value for `-Zmir-dump-dir`
to `mir_dump/`.

r? @eddyb
2018-01-18 01:57:17 +08:00
kennytm
bd8aa02ff4 Rollup merge of #47407 - gaurikholkar:master, r=estebank
fix mispositioned span

This fixes #47377

The output now looks like this
```
error[E0369]: binary operation `+` cannot be applied to type `&str`
 --> h.rs:3:11
  |
3 |     let _a = b + ", World!";
  |              ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
  |
3 |     let _a = b.to_owned() + ", World!";
  |              ^^^^^^^^^

error: aborting due to previous error
```
For the case when emojis are involved,  it gives the new output for proper indentation.
But for an indentation as follows,
```
fn main() {
let b = "hello";
    let _a = b + ", World!";
}
```
it still mispositions the span
```
3 |     println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
  |                                           ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings
  |
3 |     println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!";
  |                                           ^^^^^^^
error: aborting due to previous erro
```

cc @estebank  @est31
2018-01-18 01:57:16 +08:00
kennytm
e7087f0f4f Rollup merge of #47404 - integer32llc:reexport-to-re-export, r=steveklabnik
Standardize on "re-export" rather than "reexport"

While working on the book with our editors, it was brought to our attention that we're not consistent with when we use "re-export" versus "reexport". For the book, we've decided (with our editors) to go with "re-export"; in prose, I think that looks better. In code, I'm fine with "reexport".

However, the rustdoc generated section is currently "Reexports", so when we have a screenshot of generated documentation with the prose where we use "re-export", it's inconsistent.

It's too late to fix this for the book because we're using 1.21.0 for the output in the book, and it's really only one spot so it's not a huge deal, but I'd like to advocate for changing the documentation header so that a future edition of the book can be consistent.

The first commit here only changes the documentation section heading text and rustdoc documentation that references it. This is the commit that's most important to me.

The second commit changes error messages and associated tests to also be consistent with the use of re-export. This is the next most important commit to me, but I could be argued out of this one because then it won't match code like the `macro_reexports` feature name, which ostensibly should change to `macro_re_exports` to be most consistent but I didn't want to change code.

The last commit changes re-export anywhere else in prose: either in documentation comments or regular comments. This is least important as most of them aren't user-visible. Instances like these will likely sneak back in over time. I'm totally fine dropping this commit if anyone wants, but [the hobgoblins made me do it](http://www.bartleby.com/100/420.47.html) and it sets a good example.

r? @steveklabnik
2018-01-18 01:57:15 +08:00
kennytm
29c2aa7932 Rollup merge of #47387 - Rantanen:linkchecker-error-msg, r=steveklabnik
Report errors instead of panic!() when linkcheck encounters absolute paths

The RBE contained some absolute links that failed the link check in #46196. Diagnosing these issues was needlessly complicated, thanks to the linkchecker just panicing instead of reporting proper errors.

This PR replaces the panic with a proper `*errors = true` + error message handling.

The linkchecker itself doesn't have any tests so I intentionally didn't touch anything else than the code that previously did the `panic!()`. A small code quality improvement might be made by binding the `Path::new(base).join(url)` into a variable before the for-loop and using this resolved url in both the for loop and the error message.

r? @steveklabnik

(If not for any other reason than having r on the #46196.)
2018-01-18 01:57:14 +08:00
kennytm
175dd84ed8 Rollup merge of #47333 - arthurprs:iter-position-bounds-check, r=dtolnay
Optimize slice.{r}position result bounds check

Second attempt of https://github.com/rust-lang/rust/pull/45501
Fixes https://github.com/rust-lang/rust/issues/45964

Demo: https://godbolt.org/g/N4mBHp
2018-01-18 01:57:13 +08:00
kennytm
283ee54458 Rollup merge of #47302 - andjo403:commentfix, r=michaelwoerister
fix faulty comment

after #43506 there is no fixed number of request sent.
2018-01-18 01:57:12 +08:00
bors
3e49ada752 Auto merge of #47035 - acfoltzer:dep-info-tweak, r=alexcrichton
Remove dep-info files as targets in themselves

If you ask `rustc` to `--emit dep-info`, the resulting dependency file contains a rule for producing the dependency file itself. This differs from the output of `gcc -MD` or `clang -MD`, which only includes dependency rules for the object files produced.

Tools like Ninja often consume and delete dependency files as soon as they’re produced for performance reasons, particularly on Windows. In the case of `rustc` output, though, the recently-deleted dependency file is cached by Ninja as a target, and therefore triggers a rebuild every time.

This very small patch removes the dep-info file from the list of output filenames, so it matches the behavior of gcc and clang.
2018-01-17 09:22:22 +00:00
Ed Schouten
dcf0cd0ac0 Only enable CloudABI builds for x86-64 for now.
We'll turn on other architectures if it turns out we have enough
capacity.
2018-01-16 23:21:51 +01:00
Ed Schouten
ae4288f9ff Integrate dist-cloudabi into dist-various-2.
As discussed in #47427, let's not have a separate container for doing
CloudABI builds. It's a lot faster if we integrate it into an existing
container, so there's less duplication of what's being built.

Upgrade the existing container to Ubuntu 17.10, which is required for
CloudABI builds. The version of Clang shipped with 16.04 is not recent
enough to support CloudABI properly.
2018-01-16 22:23:18 +01:00
Gauri
efe3d69ad8 fix minor errors 2018-01-17 02:07:15 +05:30
Gauri
a4e3f361ba using tabs in ui tests 2018-01-17 02:00:09 +05:30
Gauri
d769539f42 fix tidy checks 2018-01-17 01:31:21 +05:30
Ed Schouten
5801f95cbc Move dist-cloudabi/ into disabled/.
There is not enough capacity to do automated builds for CloudABI at this
time.
2018-01-16 20:31:09 +01:00
Ed Schouten
24c3a6db9b Add a Docker container for doing automated builds for CloudABI.
Setting up a cross compilation toolchain for CloudABI is relatively
easy. It's just a matter of installing a somewhat recent version of
Clang (5.0 preferred) and installing the corresponding
${target}-cxx-runtime package, containing a set of core C/C++ libraries
(libc, libc++, libunwind, etc).

Eventually it would be nice if we could also run 'x.py test'. That,
however still requires some more work. Both libtest and compiletest
would need to be adjusted to deal with CloudABI's requirement of having
all of an application's dependencies injected. Let's settle for just
doing 'x.py dist' for now.
2018-01-16 20:31:09 +01:00
bors
da569fa9dd Auto merge of #47209 - eddyb:ccx, r=nikomatsakis
rustc_trans: reorganize CrateContext and rename context types.

Firstly, the `{Shared,Local}CrateContext` hasn't been meaningful for a while now, and this PR resolves it by moving all their fields to `CrateContext` and removing redundant accessor methods.

Secondly, this PR contains the following mass-renames:
* `ccx: CrateContext` -> `cx: CodegenCx`
* `mircx: MirContext` -> `fx: FunctionCx`
* `bcx: Builder` -> `bx: Builder`

r? @nikomatsakis
2018-01-16 08:06:15 +00:00
Adam C. Foltzer
8c09d29d04 Add -Z dep-info-omit-d-target to control dep-info style
This avoids a breaking change to dep-info output, putting the
gcc/clang-compliant dep-info behavior behind a flag
2018-01-15 13:19:46 -08:00
Adam C. Foltzer
7e99764df3 remove dep-info files as targets in themselves 2018-01-15 13:18:49 -08:00
Carol (Nichols || Goulding)
e168aa385b
Reexport -> re-export in prose and documentation comments 2018-01-15 13:36:53 -05:00
Carol (Nichols || Goulding)
90fcd4476c
Reexport -> re-export in error messages 2018-01-15 13:36:52 -05:00
Carol (Nichols || Goulding)
c698496f84
Reexport -> re-export in documentation section headings 2018-01-15 13:36:52 -05:00
bors
79a521bb9a Auto merge of #47413 - GuillaumeGomez:unstable-error-code, r=estebank
Add error code for unstable feature errors

Fixes #47397.
2018-01-15 15:36:54 +00:00
bors
57850e5360 Auto merge of #47445 - kennytm:rollup, r=kennytm
Rollup of 10 pull requests

- Successful merges: #47120, #47126, #47277, #47330, #47368, #47372, #47414, #47417, #47432, #47443
- Failed merges: #47334
2018-01-15 12:46:10 +00:00
kennytm
fa008c02f1
Rollup merge of #47443 - FenrirWolf:rand, r=alexcrichton
Remove leftover Rand stuff

The in-tree version of `rand` was removed in 6bc8f164b0, but for some reason this lone file avoided the purge. Figured it's about time to finish the job. 😈
2018-01-15 18:49:40 +08:00
kennytm
5d9d5ea712
Rollup merge of #47432 - etaoins:make-fulldeps-update-references-exec, r=petrochenkov
Make ui-fulldeps/update-references executable

When a ui-fulldeps comparison fails it suggests running update-references.sh:

```
src/test/ui-fulldeps/update-references.sh 'rust/build/x86_64-apple-darwin/test/ui-fulldeps' 'resolve-error.rs'
```

This does not work as update-references.sh isn't executable. The other update-references.sh in the ui directory is already executable so this looks like an oversight.
2018-01-15 18:49:39 +08:00
kennytm
2dc815c242
Rollup merge of #47417 - petrochenkov:noasm, r=estebank
Move "no asm" check into AST validation
2018-01-15 18:49:38 +08:00
kennytm
63f4285247
Rollup merge of #47414 - est31:master, r=alexcrichton
Enforce dashes in the unstable book file names

Also rename the existing underscore using files to use dashes.

Fixes #47394.
2018-01-15 18:49:37 +08:00
kennytm
f98a9a681e
Rollup merge of #47372 - topecongiro:issue-43925, r=alexcrichton
Avoid panicking when invalid argument is passed to cfg(..)

Closes #43925.
Closes #43926.
2018-01-15 18:49:36 +08:00
kennytm
afb1e193ef
Rollup merge of #47368 - chrisvittal:nll-tests, r=nikomatsakis
Add NLL tests for #46557 and #38899

This adapts the sample code from the two issues into test code.

Closes #46557
Closes #38899

r? @nikomatsakis
2018-01-15 18:49:34 +08:00
kennytm
6966f335ac
Rollup merge of #47330 - bmusin:patch-2, r=shepmaster
fix off-by-one error

Fixes https://github.com/rust-lang/rust/issues/47325.
2018-01-15 18:49:33 +08:00
kennytm
26c1ec300c
Rollup merge of #47277 - tspiteri:log-correctness, r=frewsxcv
doc: show that `f32::log` and `f64::log` are not correctly rounded

Fixes #47273.

One thing I'm not sure about is whether the "calculated as `self.ln() / base.ln()`" bit is being too specific, maybe we do not want to make this such a strong commitment. I think it's fine, but we should not make commitments in the API documentation by accident.

In case that is removed, the added sentence "`self.log2()` can ... base 10." still makes it amply clear that the `log` methods can be more inaccurate than other methods. If the above clause is removed, this second sentence can be moved to the first paragraph, kind of like the accuracy comment for the [`mul_add`](https://doc.rust-lang.org/std/primitive.f32.html#method.mul_add) method.
2018-01-15 18:49:32 +08:00
kennytm
5d0474ad73
Rollup merge of #47126 - sdroege:exact-chunks, r=bluss
Add slice::ExactChunks and ::ExactChunksMut iterators

These guarantee that always the requested slice size will be returned
and any leftoever elements at the end will be ignored. It allows llvm to
get rid of bounds checks in the code using the iterator.

This is inspired by the same iterators provided by ndarray.

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

I'll add unit tests for all this if the general idea and behaviour makes sense for everybody.
Also see https://github.com/rust-lang/rust/issues/47115#issuecomment-354715511 for an example what this improves.
2018-01-15 18:49:31 +08:00
kennytm
06112abd5f
Rollup merge of #47120 - clarcharr:io_error_debug, r=dtolnay
Better Debug impl for io::Error.

This PR includes the below changes:

1. The former impl wrapped the entire thing in `Error { repr: ... }` which was unhelpful; this has been removed.
2. The `Os` variant of `io::Error` included the code and message, but not the kind; this has been fixed.
3. The `Custom` variant of `io::Error` included a `Custom(Custom { ... })`, which is now just `Custom { ... }`.

Example of previous impl:

```rust
Error {
    repr: Custom(
        Custom {
            kind: InvalidData,
            error: Error {
                repr: Os {
                    code: 2,
                    message: "no such file or directory"
                }
            }
        }
    )
}
```

Example of new impl:

```rust
Custom {
    kind: InvalidData,
    error: Os {
        code: 2,
        kind: NotFound,
        message: "no such file or directory"
    }
}
```
2018-01-15 18:49:30 +08:00
Guillaume Gomez
c8a110ed63 Add error code for unstable feature errors 2018-01-15 10:28:00 +01:00
bors
8ff449d505 Auto merge of #47329 - davidtwco:issue-46983, r=nikomatsakis
NLL: bad error message when converting anonymous lifetime to `'static`

Fixes #46983.

r? @nikomatsakis
2018-01-15 06:52:12 +00:00
Fenrir
1482afbbed Remove leftover Rand stuff 2018-01-14 23:09:53 -07:00
bors
bb345a0be3 Auto merge of #46196 - projektir:rbe-submodule, r=steveklabnik
Adding RBE as a submodule #46194

Adding RBE as a submodule to start issue #46194.
2018-01-15 02:02:22 +00:00
varkor
394b95fdd6 Fix test 2018-01-15 00:09:39 +00:00
Guillaume Gomez
e2bd0e15dc Update html-diff crate => fix unicode parsing and invalid paths 2018-01-15 00:40:49 +01:00
Ryan Cumming
46c59aef62 Make ui-fulldeps/update-references executable
When a ui-fulldeps comparison fails it suggests running
update-references.sh:

```
src/test/ui-fulldeps/update-references.sh 'rust/build/x86_64-apple-darwin/test/ui-fulldeps' 'resolve-error.rs'
```

This does not work as update-references.sh isn't executable. The other
update-references.sh in the ui directory is already executable so this looks
like an oversight.
2018-01-15 08:09:55 +11:00
varkor
2ccc82e27e Make dump_mir_dir non-optional 2018-01-14 20:02:07 +00:00
varkor
a22e71685a Add a default directory for -Zmir-dump-dir
The current behaviour of dumping in the current directory is rarely
desirable: a sensible default directory for dumping is much more
convenient.
2018-01-14 17:15:39 +00:00
bors
3f92e8d898 Auto merge of #46455 - petrochenkov:pimpl, r=nikomatsakis
syntax: Rewrite parsing of impls

Properly parse impls for the never type `!`
Recover from missing `for` in `impl Trait for Type`
Prohibit inherent default impls and default impls of auto traits (https://github.com/rust-lang/rust/issues/37653#issuecomment-348687794, https://github.com/rust-lang/rust/issues/37653#issuecomment-348688785)
Change wording in more diagnostics to use "auto traits"
Fix some spans in diagnostics
Some other minor code cleanups in the parser
Disambiguate generics and qualified paths in impls (parse `impl <Type as Trait>::AssocTy { ... }`)
Replace the future-compatibility hack from https://github.com/rust-lang/rust/pull/38268 with actually parsing generic parameters
Add a test for https://github.com/rust-lang/rust/issues/46438
2018-01-14 16:56:15 +00:00
Vadim Petrochenkov
60c48dd16a syntax: Disambiguate generics and qualified paths 2018-01-14 18:10:19 +03:00
Vadim Petrochenkov
d19e4c4a85 syntax: Rewrite parsing of impls
Properly parse impls for the never type `!`
Recover from missing `for` in `impl Trait for Type`
Prohibit inherent default impls and default impls of auto traits
Change wording in more diagnostics to use "auto traits"
Some minor code cleanups in the parser
2018-01-14 18:10:05 +03:00
bors
adc9d86363 Auto merge of #47322 - nikomatsakis:nll-ice, r=pnkfelix
resolve type and region variables in "NLL dropck"

Fixes #47022.

r? @pnkfelix
2018-01-14 14:11:59 +00:00
bors
5d6f6e65ff Auto merge of #47274 - Manishearth:rustdoc-span, r=QuietMisdreavus
Use correct line offsets for doctests

Not yet tested.

This doesn't handle char positions. It could if I collected a map of char offsets and lines, but this is a bit more work and requires hooking into the parser much more (unsure if it's possible).

r? @QuietMisdreavus

(fixes #45868)
2018-01-14 11:28:27 +00:00
bors
48ab4cde54 Auto merge of #47268 - EdSchouten:cloudabi-libstd, r=alexcrichton
Implement libstd for CloudABI.

Though CloudABI is strongly inspired by POSIX, its absence of features that don't work well with capability-based sandboxing makes it different enough that adding bits to `sys/unix` will make things a mess. This change therefore adds CloudABI specific platform code under `sys/cloudabi`.

One of the goals of this implementation is to build as much as possible directly on top of CloudABI's system call layer, as opposed to using the C library. This is preferred, as the system call layer is supposed to be stable, whereas the C library ABI technically is not. An advantage of this approach is that it allows us to implement certain interfaces, such as mutexes and condition variables more optimally. They can be lighter than the ones provided by pthreads.

This change disables some modules that cannot realistically be implemented right now. For example, libstd's pathname abstraction is not designed with POSIX `*at()` (e.g., `openat()`) in mind. The `*at()` functions are the only set of file system APIs available on CloudABI. There is no global file system namespace, nor a process working directory. Discussions on how to port these modules over are outside the scope of this change.
2018-01-14 08:49:10 +00:00
Eduard-Mihai Burtescu
4e40a0d436 rustc_trans: rename mircx: MirContext to fx: FunctionCx. 2018-01-14 08:56:44 +02:00