Commit Graph

73414 Commits

Author SHA1 Message Date
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
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
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
bors fd0f29237c Auto merge of #47261 - estebank:immutable-arg, r=petrochenkov
Assignment to immutable argument: diagnostic tweak

Re #46659.
2018-01-14 06:09:14 +00:00
bors b762c2d9dd Auto merge of #47223 - alexcrichton:new-target-feature, r=eddyb
rustc: Tweak `#[target_feature]` syntax

This is an implementation of the `#[target_feature]` syntax-related changes of
[RFC 2045][rfc]. Notably two changes have been implemented:

* The new syntax is `#[target_feature(enable = "..")]` instead of
  `#[target_feature = "+.."]`. The `enable` key is necessary instead of the `+`
  to indicate that a feature is being enabled, and a sub-list is used for
  possible expansion in the future. Additionally within this syntax the feature
  names being enabled are now whitelisted against a known set of target feature
  names that we know about.

* The `#[target_feature]` attribute can only be applied to unsafe functions. It
  was decided in the RFC that invoking an instruction possibly not defined for
  the current processor is undefined behavior, so to enable this feature for now
  it requires an `unsafe` intervention.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md
2018-01-14 03:27:35 +00:00
bors 80e2e67f4c Auto merge of #46832 - Diggsey:bufread-cheaper-seek, r=alexcrichton
BufRead: Only flush the internal buffer if seeking outside of it.

Fixes #31100

r? @dtolnay
2018-01-14 00:42:11 +00:00
Alex Crichton 0ecaa67e90 rustc: Refactor attribute checking to operate on HIR
This'll enable running queries that could be cached and overall be more amenable
to the query infastructure.
2018-01-13 16:07:13 -08:00
bors cf4c3cbe55 Auto merge of #47416 - petrochenkov:remove-impl-for-dot-dot, r=petrochenkov
Remove `impl Foo for .. {}` in favor `auto trait Foo {}`

Rebase of https://github.com/rust-lang/rust/pull/46480 with restored parsing support.
2018-01-13 21:48:12 +00:00
projektir a2df413187 Adding RBE as a submodule #46194 2018-01-13 13:04:53 -08:00
Vadim Petrochenkov 318cf22bd1 Move "no asm" check into AST validation 2018-01-13 23:35:11 +03:00
Diggory Blake c96f30257a Add note to documentation 2018-01-13 18:44:25 +00:00
Diggory Blake 562ba04e45 Implement "seek_relative" 2018-01-13 18:39:37 +00:00
Alex Crichton 5f006cebfc rustc: Tweak `#[target_feature]` syntax
This is an implementation of the `#[target_feature]` syntax-related changes of
[RFC 2045][rfc]. Notably two changes have been implemented:

* The new syntax is `#[target_feature(enable = "..")]` instead of
  `#[target_feature = "+.."]`. The `enable` key is necessary instead of the `+`
  to indicate that a feature is being enabled, and a sub-list is used for
  possible expansion in the future. Additionally within this syntax the feature
  names being enabled are now whitelisted against a known set of target feature
  names that we know about.

* The `#[target_feature]` attribute can only be applied to unsafe functions. It
  was decided in the RFC that invoking an instruction possibly not defined for
  the current processor is undefined behavior, so to enable this feature for now
  it requires an `unsafe` intervention.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md
2018-01-13 10:07:18 -08:00
Clar Charr 52e074e40e Better Debug impl for io::Error. 2018-01-13 12:45:19 -05:00
Vadim Petrochenkov 22598776b0 Re-add support for `impl Trait for ..` to the parser 2018-01-13 19:26:49 +03:00
leonardo.yvens 8b4d852f32 Address review. 2018-01-13 18:49:28 +03:00
leonardo.yvens 4e3953bbdd Parse `auto trait` inside fns.
Also refactored parsing auto traits.
2018-01-13 18:49:28 +03:00
leonardo.yvens 9ccd3ac178 Fix rustdoc 2018-01-13 18:48:01 +03:00
leonardo.yvens 3bb2ff05eb Move coherence/overlap.rs into coherence/mod.rs
`fn check_impl` was feeling lonely with a file all for itself.
2018-01-13 18:48:00 +03:00
leonardo.yvens edd52b1975 Remove wfcheck for auto traits, remove dead error codes
The WF checks are now done as an AST validation.
2018-01-13 18:48:00 +03:00
leonardo.yvens 02b5fee732 Adjust tests for removal of `impl Foo for .. {}` 2018-01-13 18:48:00 +03:00
leonardo.yvens f93183adb4 Remove `impl Foo for ..` in favor of `auto trait Foo`
No longer parse it.
Remove AutoTrait variant from AST and HIR.
Remove backwards compatibility lint.
Remove coherence checks, they make no sense for the new syntax.
Remove from rustdoc.
2018-01-13 18:48:00 +03:00
bors e6072a7b38 Auto merge of #47251 - rkruppe:rm-simd-attr, r=eddyb
Remove deprecated unstable attribute #[simd]

The `#[simd]` attribute has been deprecated since c8b6d5b23c back in 2015. Any nightly crates using it have had ample time to switch to `#[repr(simd)]`, and if they didn't they're likely broken by now anyway.

r? @eddyb
2018-01-13 15:29:31 +00:00
est31 38e2667584 Enforce dashes in the unstable book file names
Also rename the existing underscore using files to use dashes.

Fixes #47394.
2018-01-13 15:44:44 +01:00
bors 9b2f8ac29e Auto merge of #47242 - estebank:issue-15980, r=petrochenkov
`struct` pattern parsing and diagnostic tweaks

 - Recover from struct parse error on match and point out missing match
   body.
 - Point at struct when finding non-identifier while parsing its fields.
 - Add label to "expected identifier, found {}" error.

Fix #15980.
2018-01-13 12:42:33 +00:00
Sebastian Dröge 5f4fc82142 Add unit tests for exact_chunks/exact_chunks_mut
These are basically modified copies of the chunks/chunks_mut tests.
2018-01-13 12:19:01 +02:00
Sebastian Dröge ed774838b3 Test the whole chunks instead of just an element in the chunks/chunks_mut tests
Easy enough to do and ensures that the whole chunk is as expected
instead of just the element that was looked at before.
2018-01-13 12:19:00 +02:00
Sebastian Dröge baa81dc77f Use assert_eq!() instead of assert!(a == b) in slice chunks_mut() unit test
This way more useful information is printed if the test ever fails.
2018-01-13 12:18:59 +02:00
Sebastian Dröge 8a82e8e89f Mention in the exact_chunks docs that this can often be optimized better by the compiler
And also link from the normal chunks iterator to the exact_chunks one.
2018-01-13 12:18:58 +02:00
Sebastian Dröge 6bf1dfdd76 Implement TrustedRandomAccess for slice::{ExactChunks, ExactChunksMut} 2018-01-13 12:18:57 +02:00