Commit Graph

88802 Commits

Author SHA1 Message Date
varkor
1e4a8a01c4 Update the const fn tracking issue to the new metabug 2019-01-13 01:55:44 +00:00
Esteban Küber
db740313e0 Remove unrelated errors from parse stderr tests 2019-01-12 17:12:41 -08:00
Eric Huss
0a3f178ab1 Update cargo 2019-01-12 15:26:02 -08:00
Vadim Petrochenkov
805099cf3e hygiene: Do not treat Self ctor as a local variable 2019-01-13 02:18:53 +03:00
Vadim Petrochenkov
6aa7856369 resolve: Mark extern crate items as used in more cases 2019-01-13 01:50:53 +03:00
Vadim Petrochenkov
f8028b0b6c privacy: Fix private-in-public check for existential types 2019-01-13 00:41:11 +03:00
Vadim Petrochenkov
ebdd072e3b resolve: Add a test for issue #57539 2019-01-13 00:15:23 +03:00
bors
75a369c5b1 Auto merge of #56759 - petrochenkov:prestabuni, r=nikomatsakis
Stabilize `uniform_paths`

Address all the things described in https://github.com/rust-lang/rust/issues/56417.

Assign visibilities to `macro_rules` items - `pub` to `macro_export`-ed macros and `pub(crate)` to non-exported macros, these visibilities determine how far these macros can be reexported with `use`.

Prohibit use of reexported inert attributes and "tool modules", after renaming (e.g. `use inline as imported_inline`) their respective tools and even compiler passes won't be able to recognize and properly check them.

Also turn use of uniform paths in 2015 macros into an error, I'd prefer to neither remove nor stabilize them right away because I still want to make some experiments in this area (uniform path fallback was added to 2015 macros used on 2018 edition in https://github.com/rust-lang/rust/pull/56053#issuecomment-441405140).

UPDATE: The last commit also stabilizes the feature `uniform_paths`.

Closes https://github.com/rust-lang/rust/issues/53130
Closes https://github.com/rust-lang/rust/issues/55618
Closes https://github.com/rust-lang/rust/issues/56326
Closes https://github.com/rust-lang/rust/issues/56398
Closes https://github.com/rust-lang/rust/issues/56417
Closes https://github.com/rust-lang/rust/issues/56821
Closes https://github.com/rust-lang/rust/issues/57252
Closes https://github.com/rust-lang/rust/issues/57422
2019-01-12 20:11:36 +00:00
Taiki Endo
6d442938e0 Add #[must_use] message to Iterator and Future 2019-01-13 02:57:27 +09:00
Corey Farwell
0394dce788
whitespace 2019-01-12 11:19:02 -05:00
Corey Farwell
1445a065de
bring back the example i removed, also add symmetry and simplify impl 2019-01-12 11:17:49 -05:00
Corey Farwell
423a5bb5c4
add comment explaining what the derive does 2019-01-12 11:00:14 -05:00
Igor Matuszewski
7948b18414 Use ptr::eq where applicable 2019-01-12 16:18:55 +01:00
Vadim Petrochenkov
250935d0c7 Fix a hole in generic parameter import future-proofing
Add some tests for buggy derive helpers
2019-01-12 16:18:55 +03:00
Vadim Petrochenkov
79134c0517 Stabilize uniform_paths 2019-01-12 16:18:55 +03:00
Vadim Petrochenkov
2f3db49c3d resolve: Prohibit use of imported tool modules 2019-01-12 16:18:20 +03:00
Vadim Petrochenkov
bf1e70cd1f resolve: Prohibit use of imported non-macro attributes 2019-01-12 16:18:20 +03:00
Vadim Petrochenkov
e1d1487fc4 resolve: Prohibit use of uniform paths in macros originating from 2015 edition
...while still keeping ambiguity errors future-proofing for uniform paths.
This corner case is not going to be stabilized for 1.32 and needs some more general experiments about retrofitting 2018 import rules to 2015 edition
2019-01-12 16:17:26 +03:00
Vadim Petrochenkov
099b3d86f9 resolve: Assign pub and pub(crate) visibilities to macro_rules items 2019-01-12 16:17:26 +03:00
bors
d6525ef539 Auto merge of #57542 - Centril:rollup, r=Centril
Rollup of 26 pull requests

Successful merges:

 - #56425 (Redo the docs for Vec::set_len)
 - #56906 (Issue #56905)
 - #57042 (Don't call `FieldPlacement::count` when count is too large)
 - #57175 (Stabilize `let` bindings and destructuring in constants and const fn)
 - #57192 (Change std::error::Error trait documentation to talk about `source` instead of `cause`)
 - #57296 (Fixed the link to the ? operator)
 - #57368 (Use CMAKE_{C,CXX}_COMPILER_LAUNCHER for ccache)
 - #57400 (Rustdoc: update Source Serif Pro and replace Heuristica italic)
 - #57417 (rustdoc: use text-based doctest parsing if a macro is wrapping main)
 - #57433 (Add link destination for `read-ownership`)
 - #57434 (Remove `CrateNum::Invalid`.)
 - #57441 (Supporting backtrace for x86_64-fortanix-unknown-sgx.)
 - #57450 (actually take a slice in this example)
 - #57459 (Reference tracking issue for inherent associated types in diagnostic)
 - #57463 (docs: Fix some 'second-edition' links)
 - #57466 (Remove outdated comment)
 - #57493 (use structured suggestion when casting a reference)
 - #57498 (make note of one more normalization that Paths do)
 - #57499 (note that FromStr does not work for borrowed types)
 - #57505 (Remove submodule step from README)
 - #57510 (Add a profiles section to the manifest)
 - #57511 (Fix undefined behavior)
 - #57519 (Correct RELEASES.md for 1.32.0)
 - #57522 (don't unwrap unexpected tokens in `format!`)
 - #57530 (Fixing a typographical error.)
 - #57535 (Stabilise irrefutable if-let and while-let patterns)

Failed merges:

r? @ghost
2019-01-12 11:22:20 +00:00
Shotaro Yamada
038d837224 Fix simple formatting optimization
name                        old2 ns/iter  new2 ns/iter  diff ns/iter   diff %  speedup
fmt::write_str_macro1       12,295        12,308                  13    0.11%   x 1.00
fmt::write_str_macro2       24,079        21,451              -2,628  -10.91%   x 1.12
fmt::write_str_macro_debug  238,363       230,807             -7,556   -3.17%   x 1.03
fmt::write_str_ref          6,203         6,064                 -139   -2.24%   x 1.02
fmt::write_str_value        6,225         6,075                 -150   -2.41%   x 1.02
fmt::write_vec_macro1       17,144        17,121                 -23   -0.13%   x 1.00
fmt::write_vec_macro2       29,845        26,703              -3,142  -10.53%   x 1.12
fmt::write_vec_macro_debug  248,840       242,117             -6,723   -2.70%   x 1.03
fmt::write_vec_ref          5,954         6,438                  484    8.13%   x 0.92
fmt::write_vec_value        5,959         6,439                  480    8.06%   x 0.93
2019-01-12 19:15:41 +09:00
Shotaro Yamada
d7a7ce9edd Utilize specialized zip iterator impl
name                        old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
 fmt::write_str_macro1       13,927       12,489             -1,438  -10.33%   x 1.12
 fmt::write_str_macro2       24,633       23,418             -1,215   -4.93%   x 1.05
 fmt::write_str_macro_debug  234,633      233,092            -1,541   -0.66%   x 1.01
 fmt::write_str_ref          5,819        5,823                   4    0.07%   x 1.00
 fmt::write_str_value        6,012        5,828                -184   -3.06%   x 1.03
 fmt::write_vec_macro1       18,550       17,143             -1,407   -7.58%   x 1.08
 fmt::write_vec_macro2       30,369       28,920             -1,449   -4.77%   x 1.05
 fmt::write_vec_macro_debug  244,338      244,901               563    0.23%   x 1.00
 fmt::write_vec_ref          5,952        5,885                 -67   -1.13%   x 1.01
 fmt::write_vec_value        5,944        5,894                 -50   -0.84%   x 1.01
2019-01-12 19:15:23 +09:00
Mazdak Farrokhzad
3117784c18
Rollup merge of #57535 - varkor:stabilise-if-while-let-patterns, r=Centril
Stabilise irrefutable if-let and while-let patterns

This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495).

This replaces https://github.com/rust-lang/rust/pull/55639, as we want to stabilise this in time for the beta cut-off.

Closes https://github.com/rust-lang/rust/pull/55639.

r? @Centril
2019-01-12 10:55:25 +01:00
Mazdak Farrokhzad
0a8b5b4907
Rollup merge of #57530 - insideoutclub:master, r=estebank
Fixing a typographical error.
2019-01-12 10:55:24 +01:00
Mazdak Farrokhzad
e234d15724
Rollup merge of #57522 - euclio:format-ice, r=varkor
don't unwrap unexpected tokens in `format!`

Fixes #57512.
2019-01-12 10:55:22 +01:00
Mazdak Farrokhzad
7da604e745
Rollup merge of #57519 - pthariensflame:patch-2, r=alexcrichton
Correct RELEASES.md for 1.32.0

The `into_to_from_bytes` feature was stabilized for `i128` and `u128` just like for the other integer types, but they seem to have been missed.
2019-01-12 10:55:21 +01:00
Mazdak Farrokhzad
bcbf73f9c1
Rollup merge of #57511 - jethrogb:jb/fix-undef, r=cramertj
Fix undefined behavior

From the [`MaybeUninit::get_mut` docs](https://doc.rust-lang.org/std/mem/union.MaybeUninit.html):
> It is up to the caller to guarantee that the the MaybeUninit really is in an initialized state, otherwise this will immediately cause undefined behavior.

r? @joshtriplett
2019-01-12 10:55:20 +01:00
Mazdak Farrokhzad
1f66062b92
Rollup merge of #57510 - nrc:manifest-profiles, r=alexcrichton
Add a profiles section to the manifest

This supports the profiles work for Rustup in a backwards compatible manner.

r? @alexcrichton
2019-01-12 10:55:19 +01:00
Mazdak Farrokhzad
52e02fc16b
Rollup merge of #57505 - rust-lang:nrc-patch-1, r=alexcrichton
Remove submodule step from README

Since the bootstrap does it now
2019-01-12 10:55:18 +01:00
Mazdak Farrokhzad
dc6d86b04e
Rollup merge of #57499 - steveklabnik:gh47757, r=Mark-Simulacrum
note that FromStr does not work for borrowed types

Fixes #47757
2019-01-12 10:55:16 +01:00
Mazdak Farrokhzad
cbe377b2f5
Rollup merge of #57498 - steveklabnik:gh29008, r=alexcrichton
make note of one more normalization that Paths do

Fixes #29008
2019-01-12 10:55:15 +01:00
Mazdak Farrokhzad
e0cea0db5d
Rollup merge of #57493 - euclio:deref-suggest, r=oli-obk
use structured suggestion when casting a reference
2019-01-12 10:55:13 +01:00
Mazdak Farrokhzad
1fff64a694
Rollup merge of #57466 - king6cong:comment, r=alexcrichton
Remove outdated comment

More here: https://github.com/rust-lang/rustc-guide/pull/261
2019-01-12 10:55:12 +01:00
Mazdak Farrokhzad
e7dc880052
Rollup merge of #57463 - phansch:fix_some_links, r=steveklabnik
docs: Fix some 'second-edition' links

If I understand it correctly, we now want to link to

    https://doc.rust-lang.org/book/*.html

instead of

    https://doc.rust-lang.org/book/second-edition/*.html

because the second-edition page says that it's no longer distributed with
Rust's docs.

For example: https://doc.rust-lang.org/book/second-edition/ch13-01-closures.html
2019-01-12 10:55:11 +01:00
Mazdak Farrokhzad
f7da074d2a
Rollup merge of #57459 - varkor:E0202-issue-reference, r=petrochenkov
Reference tracking issue for inherent associated types in diagnostic

This makes it clearer that associated types in inherent impls are an intended feature, like the diagnostic for equality constraints in where clauses. (This is more helpful, because the lack of associated types is a confusing omission and it lets users more easily track the state of the feature.)
2019-01-12 10:55:09 +01:00
Mazdak Farrokhzad
0b1427eeb8
Rollup merge of #57450 - steveklabnik:gh45678, r=KodrAus
actually take a slice in this example

Fixes #45678
2019-01-12 10:55:08 +01:00
Mazdak Farrokhzad
85a7fc8c48
Rollup merge of #57441 - VardhanThigle:Vardhan/x86_64-fortanix-unknown-sgx-backtrace-support, r=alexcrichton
Supporting backtrace for x86_64-fortanix-unknown-sgx.

# Overview
Implementing following functions required by `libstd/sys_common` to support `backtrace`:
```
1. unwind_backtrace
2. trace_fn
3. resolve_symname
```
# Description:
The changes here are quite similar to the Cloudabi target `src/libstd/sys/cloudabi/backtrace.rs`
The first 2 functions are implemented via calls to libunwind.a that is linked to the `x86_64-fortanix-unknown-sgx` (#56979),  we have not implemented functionality needed by `resolve_symname`  (or `dladdr`) to reduce SGX TCB. Rather, we print the function address (relative to enclave image base) in `resolve_symname` which can be later translated to correct symbol name (say, via `addr2line`).

# Note:
For `x86_64-fortanix-unknown-sgx`, the `RUST_BACKTRACE` environment has to be set from within the program running in an enclave.
cc: @jethrogb
r? @alexcrichton
2019-01-12 10:55:07 +01:00
Mazdak Farrokhzad
632d8909a0
Rollup merge of #57434 - nnethercote:rm-CrateNum-Invalid, r=petrochenkov
Remove `CrateNum::Invalid`.

It's unused.
2019-01-12 10:55:05 +01:00
Mazdak Farrokhzad
a9c9a2c048
Rollup merge of #57433 - ecstatic-morse:issue-56610-bad-link, r=dtolnay
Add link destination for `read-ownership`

Resolves #56610.
2019-01-12 10:55:03 +01:00
Mazdak Farrokhzad
a61ebac367
Rollup merge of #57417 - QuietMisdreavus:semi-revert-doctest-parsing, r=GuillaumeGomez
rustdoc: use text-based doctest parsing if a macro is wrapping main

This is a "forward-port" of https://github.com/rust-lang/rust/pull/57019, intended to get https://github.com/rust-lang/rust/issues/56898 on nightly, since it's now fixed on beta (and already worked on stable).

To recap:

* The libsyntax-based doctest parsing now checks to see whether there is a top-level macro invocation in the doctest while it's checking for `fn main` and an `extern crate` statement.
* If it finds a macro invocation and *didn't* find `fn main`, then it performs the older text-based scan to allow doctests like the ones in `allocator_api` to still compile.

A "proper" fix will involve changing how `make_test` works to call it later in the `run_test` function, after the initial steps of compilation have completed. I've filed [a separate issue](https://github.com/rust-lang/rust/issues/57415) for that, though.
2019-01-12 10:55:02 +01:00
Mazdak Farrokhzad
7be2ff3d48
Rollup merge of #57400 - tspiteri:source-serif-pro-it, r=GuillaumeGomez
Rustdoc: update Source Serif Pro and replace Heuristica italic

When Source Serif Pro was used to replace Heuristica in #15530, the italic variant was not ready yet, but now it is. This PR updates the Source Serif Pro font files to the [latest release](https://github.com/adobe-fonts/source-serif-pro/releases/tag/2.007R-ro%2F1.007R-it) which includes an italic variant, and replaces Heuristica italic with Source Serif Pro italic.

Fixes #57363.
2019-01-12 10:55:01 +01:00
Mazdak Farrokhzad
c6146b2370
Rollup merge of #57368 - petrhosek:cmake-compiler-launcher, r=alexcrichton
Use CMAKE_{C,CXX}_COMPILER_LAUNCHER for ccache

CMake 3.4 and newer which is the required minimum version for LLVM
supports CMAKE_{C,CXX}_COMPILER_LAUNCHER for settting the compiler
launcher such as ccache which doesn't require shifting arguments.
2019-01-12 10:54:59 +01:00
Mazdak Farrokhzad
ebbecac538
Rollup merge of #57296 - JosephTLyons:Fix-question-mark-operator-in-stdio-document, r=wesleywiser
Fixed the link to the ? operator

I'm working on updating all broken links, but figured I'd break up the pull requests so they are easier to review, versus just one big pull request.
2019-01-12 10:54:58 +01:00
Mazdak Farrokhzad
40a819b7df
Rollup merge of #57192 - czipperz:error_trait_doc_cause_to_source, r=wesleywiser
Change std::error::Error trait documentation to talk about `source` instead of `cause`

Resolves #57056
2019-01-12 10:54:57 +01:00
Mazdak Farrokhzad
bd8f464877
Rollup merge of #57175 - oli-obk:const_let_stabilization, r=nikomatsakis
Stabilize `let` bindings and destructuring in constants and const fn

r? @Centril

This PR stabilizes the following features in constants and `const` functions:

* irrefutable destructuring patterns (e.g. `const fn foo((x, y): (u8, u8)) { ... }`)
* `let` bindings (e.g. `let x = 1;`)
* mutable `let` bindings (e.g. `let mut x = 1;`)
* assignment (e.g. `x = y`) and assignment operator (e.g. `x += y`) expressions, even where the assignment target is a projection (e.g. a struct field or index operation like `x[3] = 42`)
* expression statements (e.g. `3;`)

This PR does explicitly *not* stabilize:

* mutable references (i.e. `&mut T`)
* dereferencing mutable references
* refutable patterns (e.g. `Some(x)`)
* operations on `UnsafeCell` types (as that would need raw pointers and mutable references and such, not because it is explicitly forbidden. We can't explicitly forbid it as such values are OK as long as they aren't mutated.)
* We are not stabilizing `let` bindings in constants that use `&&` and `||` short circuiting operations. These are treated as `&` and `|` inside `const` and `static` items right now. If we stopped treating them as `&` and `|` after stabilizing `let` bindings, we'd break code like `let mut x = false; false && { x = true; false };`. So to use `let` bindings in constants you need to change `&&` and `||` to `&` and `|` respectively.
2019-01-12 10:54:56 +01:00
Mazdak Farrokhzad
017f046c13
Rollup merge of #57042 - pnkfelix:issue-57038-sidestep-ice-in-fieldplacement-count, r=michaelwoerister
Don't call `FieldPlacement::count` when count is too large

Sidestep ICE in `FieldPlacement::count` by not calling it when count will not fit in host's usize.

(I briefly played with trying to fix this by changing `FieldPlacement::count` to return a `u64`. However, based on how `FieldPlacement` is used, it seems like this would be a largely pointless pursuit... I'm open to counter-arguments, however.)

Fix #57038
2019-01-12 10:54:54 +01:00
Mazdak Farrokhzad
53aa8a1ad0
Rollup merge of #56906 - blitzerr:master, r=nikomatsakis
Issue #56905

Adding a map to TypeckTables to get the list of all the Upvars
given a closureID. This is help us get rid of the recurring
pattern in the codebase of iterating over the free vars
using with_freevars.
2019-01-12 10:54:53 +01:00
Mazdak Farrokhzad
e69a5cb2d7
Rollup merge of #56425 - scottmcm:redo-vec-set_len-docs, r=Centril
Redo the docs for Vec::set_len

Inspired by the [recent conversation on IRLO](https://internals.rust-lang.org/t/make-vec-set-len-enforce-the-len-cap-invariant/8927/23?u=scottmcm).

This is just my first stab at this; suggestions welcome.
2019-01-12 10:54:51 +01:00
Mazdak Farrokhzad
6c623224dc const_let: --bless with --compare-mode=nll 2019-01-12 10:32:27 +01:00
Mazdak Farrokhzad
3dc08ed068 move const_let accepted gate to avoid future conflict. 2019-01-12 10:31:52 +01:00