Commit Graph

60907 Commits

Author SHA1 Message Date
Alex Crichton
915242af7a Rollup merge of #39335 - cramertj:cramertj/can_begin_expr_fix, r=petrochenkov
Fix can_begin_expr keyword behavior

Partial fix for #28784.
2017-01-27 16:42:07 -08:00
Alex Crichton
30ae115a1d Rollup merge of #39332 - nagisa:another-bigendian-128, r=eddyb
Fix another endianness issue in i128 trans

Apparently LLVMArbitraryPrecisionInteger demands integers to be in low-endian 64-bytes, rather than host-endian 64-bytes. This is weird, and obviously, not documented. And rustc now works a teeny bit more on big endians.

r? @eddyb
2017-01-27 16:42:07 -08:00
Alex Crichton
a5ff116557 Rollup merge of #39321 - king6cong:master, r=frewsxcv
doc comment typo fix
2017-01-27 16:42:06 -08:00
Alex Crichton
4ef67babf2 Rollup merge of #39314 - stjepang:rewrite-sort-header, r=brson
Rewrite the first sentence in slice::sort

For every method, the first sentence should consisely explain what it does,
not how. This sentence usually starts with a verb.

It's really weird for `sort` to be explained in terms of another function,
namely `sort_by`. There's no need for that because it's obvious how `sort`
sorts elements: there is `T: Ord`.

If `sort_by_key` does not have to explicitly state how it's implemented,
then `sort` doesn't either.

r? @steveklabnik
2017-01-27 16:42:06 -08:00
Alex Crichton
06fcccfb7d Rollup merge of #39313 - est31:drop_in_place_is_stable, r=GuillaumeGomez
drop_in_place is stable now, don't #![feature] it in the nomicon and a test.

It was stable since Rust 1.8.

r? @GuillaumeGomez
2017-01-27 16:42:06 -08:00
Alex Crichton
e1a5c467c7 Rollup merge of #39311 - solson:fix-unpretty-mir-non-local, r=eddyb
Avoid ICE when pretty-printing non-local MIR item.

This comes up when using `-Zunstable-options --unpretty=mir`. Previously, rustc would ICE due to an unwrap later in this function (after `as_local_node_id`). Instead, we should just ignore items from other crates when pretty-printing MIR.

This was reported in #rust: [this playground code](https://is.gd/PSMBZS) causes an ICE if you click the MIR button. The problem is the mention of the non-local item `std::usize::MAX`, so you can reduce the test case [a lot](https://is.gd/SaLjaa).

r? @eddyb
2017-01-27 16:42:06 -08:00
Alex Crichton
0edc3d37bb Rollup merge of #39307 - alexcrichton:stabilize-1.16, r=brson
std: Stabilize APIs for the 1.16.0 release

This commit applies the stabilization/deprecations of the 1.16.0 release, as
tracked by the rust-lang/rust issue tracker and the final-comment-period tag.

The following APIs were stabilized:

* `VecDeque::truncate`
* `VecDeque::resize`
* `String::insert_str`
* `Duration::checked_{add,sub,div,mul}`
* `str::replacen`
* `SocketAddr::is_ipv{4,6}`
* `IpAddr::is_ipv{4,6}`
* `str::repeat`
* `Vec::dedup_by`
* `Vec::dedup_by_key`
* `Result::unwrap_or_default`
* `<*const T>::wrapping_offset`
* `<*mut T>::wrapping_offset`
* `CommandExt::creation_flags` (on Windows)
* `File::set_permissions`
* `String::split_off`

The following APIs were deprecated

* `EnumSet` - replaced with other ecosystem abstractions, long since unstable

Closes #27788
Closes #35553
Closes #35774
Closes #36436
Closes #36949
Closes #37079
Closes #37087
Closes #37516
Closes #37827
Closes #37916
Closes #37966
Closes #38080
2017-01-27 16:42:06 -08:00
Alex Crichton
13e3b36f68 Rollup merge of #39306 - GuillaumeGomez:newtype_help, r=eddyb
Add note for E0117

Fixes #39249.

I just applied the suggestion of @durka since I don't see anything else to add.
2017-01-27 16:42:05 -08:00
Alex Crichton
ac1e92328a Rollup merge of #39302 - alexcrichton:upload-all, r=brson
travis: Upload all artifacts in build/dist

Previously we only uploaded tarballs, but this modifies Travis/AppVeyor to
upload everything. We shouldn't have anything else in there to worry about and
otherwise we need to be sure to pick up pkg/msi/exe installers.
2017-01-27 16:41:50 -08:00
Alex Crichton
0e64d4954f Rollup merge of #39290 - canndrew:hide-uninhabitedness, r=nikomatsakis
Hide uninhabitedness checks behind feature gate

This reverts the fix to match exhaustiveness checking so that it can be discussed. The new code is now hidden behind the `never_type` feature gate.
2017-01-27 16:41:50 -08:00
Alex Crichton
666fc45289 Rollup merge of #39285 - nrc:save-tables, r=@eddyb
save-analysis: get tables directly, accomodating them being missing

Fixes an ICE when running with save-analysis after an error

r? @eddyb
2017-01-27 16:41:50 -08:00
Alex Crichton
f1658610be Rollup merge of #39284 - alexcrichton:manifesting, r=brson
rustbuild: Add manifest generation in-tree

This commit adds a new tool, `build-manifest`, which is used to generate a
distribution manifest of all produced artifacts. This tool is intended to
replace the `build-rust-manifest.py` script that's currently located on the
buildmaster. The intention is that we'll have a builder which periodically:

* Downloads all artifacts for a commit
* Runs `./x.py dist hash-and-sign`. This will generate `sha256` and `asc` files
  as well as TOML manifests.
* Upload all generated hashes and manifests to the directory the artifacts came
  from.
* Upload *all* artifacts (tarballs and hashes and manifests) to an archived
  location.
* If necessary, upload all artifacts to the main location.

This script is intended to just be the second step here where orchestrating
uploads and such will all happen externally from the build system itself.

cc #38531
2017-01-27 16:41:49 -08:00
Alex Crichton
a2a3074fb3 Rollup merge of #38617 - pnkfelix:double-reference, r=pnkfelix
Detect double reference when applying binary op

``` rust
let vr = v.iter().filter(|x| {
    x % 2 == 0
});
```

will now yield the following compiler output:

``` bash
ERROR binary operation `%` cannot be applied to type `&&_`
NOTE this is a reference of a reference to a type that `%` can be applied to,
you need to dereference this variable once for this operation to work
NOTE an implementation of `std::ops::Rem` might be missing for `&&_`
```

The first NOTE is new.

Fix #33877

----

Thanks to @estebank for providing the original PR #34420 (of which this is a tweaked rebase).
2017-01-27 16:41:49 -08:00
Segev Finer
1b4a6c86fa Use libc::c_char instead of i8 due to platforms with unsigned char 2017-01-28 01:01:16 +02:00
Guillaume Gomez
460a3b20aa Don't generate doc if doc comments only filled with 'white' characters 2017-01-27 23:18:07 +01:00
bors
154c202afb Auto merge of #37057 - brson:nosuggest, r=nikomatsakis
rustc: Remove all "consider using an explicit lifetime parameter" suggestions

These give so many incorrect suggestions that having them is
detrimental to the user experience. The compiler should not be
suggesting changes to the code that are wrong - it is infuriating: not
only is the compiler telling you that _you don't understand_ borrowing,
_the compiler itself_ appears to not understand borrowing. It does not
inspire confidence.

r? @nikomatsakis
2017-01-27 22:13:41 +00:00
Simonas Kazlauskas
98bc300d69 Use __SIZEOF_INT128__ to test __int128 presence
Previously we tested whether a handful of preprocessor variables indicating certain 64 bit
platforms, but this does not work for other 64 bit targets which have support for __int128 in C
compiler.

Use the __SIZEOF__INT128__ preprocessor variable instead. This variable gets set to 16 by gcc and
clang for every target where __int128 is supported.
2017-01-27 23:23:26 +02:00
Niko Matsakis
f4010d7e61 move cast_kinds into TypeckTables where it belongs 2017-01-27 16:16:43 -05:00
Steve Klabnik
810b22bdb1 Fix cyryl's mailmap entry 2017-01-27 15:28:52 -05:00
Steve Klabnik
945177de8c Fix @jethrogb's mailmap entry
cc rust-lang-nursery/thanks#51
2017-01-27 15:19:30 -05:00
Steve Klabnik
0f2a5f686f Fix up @carols10cents' mailmap entry
The previous ways didn't work; this does.

cc rust-lang-nursery/thanks#45
2017-01-27 14:29:59 -05:00
bors
62a7258677 Auto merge of #39320 - alexcrichton:less-backtraces, r=aturon
travis: Turn off core dumps on OSX

I've seen these take up quite a bit of log space and I have the sneaking
suspicion that they're just making our test suite take longer (sometimes timing
out on 32-bit OSX now). In any case the backtraces haven't proven too useful,
unfortunately.
2017-01-27 18:12:04 +00:00
Oliver Middleton
09b3903aec Fix a few links in the docs 2017-01-27 18:08:51 +00:00
bors
463affee6b Auto merge of #39282 - petrochenkov:selfstab, r=nikomatsakis
Stabilize Self and associated types in struct expressions and patterns

Rebase of https://github.com/rust-lang/rust/pull/37734
Closes https://github.com/rust-lang/rust/issues/37544
r? @nikomatsakis
2017-01-27 12:23:23 +00:00
bors
8367fb7ba6 Auto merge of #39252 - alexcrichton:less-exports, r=nrc
Hide a few more standard library symbols

These commits touch up some of the symbol visibility rules for some crates related to the standard library, notably:

* Symbols that are `pub extern` and `#[no_mangle]` which are internal-to-rust ABI things are no longer at the `C` export level, but the `Rust` export level. This includes allocators, panic runtimes, and compiler builtins.
* The libbacktrace library is now compiled with `-fvisibility=hidden` to ensure that we don't export those symbols.
2017-01-27 10:01:45 +00:00
Segev Finer
450554ebf1 Attempt at fixing dead code lints 2017-01-27 11:33:24 +02:00
Alex Crichton
3d6f263b2a std: Compile libbacktrace with -fvisibility=hidden
We don't want these symbols exported from the standard library, this is
just an internal implementation detail of the standard library
currently.

Closes #34984
2017-01-26 23:48:08 -08:00
Alex Crichton
a5561ce2b9 rustc: Don't export builtins/panic/alloc syms
This hides symbols from various unstable and implementation-detail
crates of the standard library. Although typically transitive exported
`pub extern` functions are exported from cdylibs, these crates aren't
necessary as they're all implementation details.

Closes #34493
2017-01-26 23:47:39 -08:00
bors
fece9c7356 Auto merge of #39281 - michaelwoerister:make-cc-incr-comp-opt-in, r=nikomatsakis
incr.comp.: Make cross-crate tracking for incr. comp. opt-in.

The current implementation of cross-crate dependency tracking can cause quite long compile times and high memory usage for some crates (see #39208 for example). This PR therefore makes that part of dependency tracking optional. Incremental compilation still works, it will only have very coarse dep-tracking for upstream crates.

r? @nikomatsakis
2017-01-27 07:36:43 +00:00
Taylor Cramer
d83687f68c Fix can_begin_expr keyword behavior 2017-01-26 21:51:20 -08:00
bors
025fb7de09 Auto merge of #39139 - estebank:issue-38147, r=nikomatsakis
Point to immutable arg/fields when trying to use as &mut

Present the following output when trying to access an immutable borrow's
field as mutable:

```
error[E0389]: cannot borrow data mutably in a `&` reference
  --> $DIR/issue-38147-1.rs:27:9
   |
26 | fn f(&self) {
   |      -----  use `&mut self` here to make mutable
27 |     f.s.push('x');
   |     ^^^ assignment into an immutable reference
```

And the following when trying to access an immutable struct field as mutable:

```
error: cannot borrow immutable borrowed content `*self.s` as mutable
  --> $DIR/issue-38147-3.rs:17:9
   |
12 |     s: &'a String
   |     ------------- use `&'a mut String` here to make mutable
...|
16 |     fn f(&self) {
   |          -----  use `&mut self` here to make mutable
17 |         self.s.push('x');
   |         ^^^^^^ cannot borrow as mutable
```

Fixes #38147.
2017-01-27 04:57:12 +00:00
Simonas Kazlauskas
b8036b6908 Fix another endian-ness issue in i128 trans
Apparently LLVMArbitraryPrecisionInteger demands integers to be in low-endian 64-bytes, rather than
host-endian 64-bytes. This is weird, and obviously, not documented. Also, fixed now. And rustc now
works a teeny bit more on big endians.
2017-01-27 04:36:12 +02:00
bors
23a94697c2 Auto merge of #39158 - petrochenkov:bounds, r=nikomatsakis
Bounds parsing refactoring 2

See https://github.com/rust-lang/rust/pull/37511 for previous discussion.
cc @matklad

Relaxed parsing rules:
 - zero bounds after `:` are allowed in all contexts.
 - zero predicates are allowed after `where`.
- trailing separator `,` is allowed after predicates in `where` clauses not followed by `{`.

Other parsing rules:
 - trailing separator `+` is still allowed in all bound lists.

Code is also cleaned up and tests added.

I haven't touched parsing of trait object types yet, I'll do it later.
2017-01-27 01:27:12 +00:00
Brian Anderson
a2735c0249 rustc: Remove all "consider using an explicit lifetime parameter" suggestions
These give so many incorrect suggestions that having them is
detrimental to the user experience. The compiler should not be
suggesting changes to the code that are wrong - it is infuriating: not
only is the compiler telling you that _you don't understand_ borrowing,
_the compiler itself_ appears to not understand borrowing. It does not
inspire confidence.
2017-01-26 22:11:29 +00:00
Esteban Küber
e1280d81af Point to immutable arg/fields when trying to use as &mut
Point to immutable borrow arguments and fields when trying to use them as
mutable borrows. Add label to primary span on "cannot borrow as mutable"
errors.

Present the following output when trying to access an immutable borrow's
field as mutable:

```
error[E0389]: cannot borrow data mutably in a `&` reference
  --> $DIR/issue-38147-1.rs:27:9
   |
26 | fn f(&self) {
   |      -----  use `&mut self` here to make mutable
27 |     f.s.push('x');
   |     ^^^ assignment into an immutable reference
```

And the following when trying to access an immutable struct field as mutable:

```
error: cannot borrow immutable borrowed content `*self.s` as mutable
  --> $DIR/issue-38147-3.rs:17:9
   |
12 |     s: &'a String
   |     ------------- use `&'a mut String` here to make mutable
...|
16 |     fn f(&self) {
   |          -----  use `&mut self` here to make mutable
17 |         self.s.push('x');
   |         ^^^^^^ cannot borrow as mutable
```
2017-01-26 10:57:23 -08:00
Scott Olson
8ad06af131 Avoid ICE when pretty-printing non-local MIR item.
This comes up when using `-Zunstable-options --unpretty=mir`.
Previously, rustc would ICE due to an unwrap later in this function
(after `as_local_node_id`). Instead, we should just ignore items from
other crates when pretty-printing MIR.
2017-01-26 10:44:28 -08:00
Nick Cameron
36ad34d343 save-analysis: get tables directly, accomodating them being missing
Fixes an ICE when running with save-analsysis after an error
2017-01-27 07:21:06 +13:00
king6cong
fc490ad679 doc comment typo fix 2017-01-27 02:05:33 +08:00
bors
8430042a49 Auto merge of #39066 - arielb1:lifetime-extension-test, r=nikomatsakis
End temporary lifetimes being extended by `let X: &_` hints

cc #39283

r? @nikomatsakis
2017-01-26 17:42:52 +00:00
Alex Crichton
7095a48bf6 travis: Turn off core dumps on OSX
I've seen these take up quite a bit of log space and I have the sneaking
suspicion that they're just making our test suite take longer (sometimes timing
out on 32-bit OSX now). In any case the backtraces haven't proven too useful,
unfortunately.
2017-01-26 09:04:59 -08:00
bors
491b978822 Auto merge of #39309 - eddyb:map-shmap, r=nikomatsakis
Rename tcx.map to the far more descriptive tcx.hir.

Also a bit more renaming because `ast_map` and `'ast` were still used with HIR.
Main motivation is to "free up" `tcx.map`, or rather, `tcx.maps`, to consolidate `ty::maps` there.

r? @nikomatsakis
2017-01-26 15:02:23 +00:00
Vadim Petrochenkov
bd4d5ec758 Better comments for FIXMEs 2017-01-26 17:41:37 +03:00
bors
07fe04c1e2 Auto merge of #38819 - GuillaumeGomez:main_func_wrong_type, r=GuillaumeGomez
Add a distinct error code and description for "main function has wron…

…g type"
2017-01-26 12:23:13 +00:00
Eduard-Mihai Burtescu
1ff3641623 rustc: don't call the HIR AST. 2017-01-26 13:41:28 +02:00
Eduard-Mihai Burtescu
45c8c5678a rustc: rename TyCtxt's map field to hir. 2017-01-26 13:41:28 +02:00
Guillaume Gomez
eaf182e539 Add note for E0117 2017-01-26 12:09:31 +01:00
Guillaume Gomez
97b9c8b8d3 Update error code number 2017-01-26 11:17:17 +01:00
Guillaume Gomez
e7c3fb90ee Add a distinct error code and description for "main function has wrong type" 2017-01-26 11:12:46 +01:00
Stjepan Glavina
f02c9e3741 Rewrite the first sentence in slice::sort
For every method, the first sentence should consisely explain what it does,
not how. This sentence usually starts with a verb.

It's really weird for `sort` to be explained in terms of another function,
namely `sort_by`. There's no need for that because it's obvious how `sort`
sorts elements: there is `T: Ord`.

If `sort_by_key` does not have to explicitly state how it's implemented,
then `sort` doesn't either.
2017-01-26 11:09:45 +01:00
bors
5158501367 Auto merge of #39075 - est31:remove_reflect, r=nikomatsakis
Remove Reflect

PR for removing the `Reflect` trait. Opened so that a crater run can be done for testing the impact: https://github.com/rust-lang/rust/issues/27749#issuecomment-272665163

Fixes #27749
2017-01-26 09:54:03 +00:00