Commit graph

126356 commits

Author SHA1 Message Date
Tyler Mandry
b675824493
Rollup merge of #75945 - pickfire:patch-7, r=jyn514
Use `env::func()`, not 'the function env::func' in docs for std::env

Follow up of https://github.com/rust-lang/rust/pull/75629

r? @jyn514
2020-08-31 19:18:13 -07:00
bors
d824b23514 Auto merge of #75931 - estebank:suggest-if-let, r=petrochenkov
Suggest `if let x = y` when encountering `if x = y`

Detect potential cases where `if let` was meant but `let` was left out.

Fix #44990.
2020-09-01 00:26:01 +00:00
bors
d927e5a655 Auto merge of #76174 - ehuss:update-cargo, r=ehuss
Update cargo

8 commits in 51b66125ba97d2906f461b3f4e0408f206299bb6..126907a7cfccbe93778530e6a6bbaa3adb6c515c
2020-08-19 20:22:52 +0000 to 2020-08-31 20:42:11 +0000
- Fix flakiness in close_output test (rust-lang/cargo#8668)
- Reload unstable table from config file in `reload_rooted_at` (rust-lang/cargo#8656)
- Bump to 0.49.0, update changelog (rust-lang/cargo#8659)
- Fix LTO with doctests. (rust-lang/cargo#8657)
- Add spaces after -C and -Z flags for consistency (rust-lang/cargo#8648)
- Fix cache_messages::rustdoc test broken on beta. (rust-lang/cargo#8653)
- fix: remove unnecessary allocations (rust-lang/cargo#8641)
- Fixed a spelling and some clippy warnings (rust-lang/cargo#8637)
2020-08-31 21:57:35 +00:00
Eric Huss
103c497668 Update cargo 2020-08-31 14:08:53 -07:00
bors
45f638bd86 Auto merge of #75979 - lzutao:seprate-tests, r=Mark-Simulacrum
Move `#[cfg(test)]` modules into separate files to save recompiling the `std` crate

Implements an accepted proposal: https://github.com/rust-lang/compiler-team/issues/344

Some notes for reviewers:
* `mod tests` nested in `mod foo` in `mod bar`, I move `foo` to a new file, `tests` is a new file in foo: For example library/std/src/sys/sgx/abi/tls.rs
* `mod test` (not `mod tests`) also is moved.
* `mod benches` are moved.
* `mod tests` is placed before any `use` statements: The topic is discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Code.20Style.20process
* Some files in cloudabi was changed too. But I notice copyright banners in those files, should we ping cloudabi people?
* I formatted files after moving tests around. I think that may make it easier to review :p .
* Some files don't need `ignore-tidy-filelength` anymore.
2020-08-31 20:03:33 +00:00
bors
1d22f75c9f Auto merge of #76030 - davidtwco:fewer-names-llvm-type-of, r=eddyb
cg_llvm: `fewer_names` in `uncached_llvm_type`

This PR changes `uncached_llvm_type` so that a named struct type (with an empty name) is always created when the `fewer_names` option is enabled. By skipping the generation of names, we can improve perf. Giving `LLVMStructCreateNamed` an empty name works because LLVM will perform random renames to avoid collisions. Needs a perf run!

cc @eddyb (whom I've discussed this with)
2020-08-31 18:04:29 +00:00
bors
897ef3a0ec Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
Get rid of bounds check in slice::chunks_exact() and related function…

…s during construction

LLVM can't figure out in

    let rem = self.len() % chunk_size;
    let len = self.len() - rem;
    let (fst, snd) = self.split_at(len);

and

    let rem = self.len() % chunk_size;
    let (fst, snd) = self.split_at(rem);

that the index passed to split_at() is smaller than the slice length and
adds a bounds check plus panic for it.

Apart from removing the overhead of the bounds check this also allows
LLVM to optimize code around the ChunksExact iterator better.
2020-08-31 15:55:13 +00:00
bors
1fd8636d24 Auto merge of #76159 - matklad:rollup-8jydjg3, r=matklad
Rollup of 5 pull requests

Successful merges:

 - #75938 (Added some `min_const_generics` revisions into `const_generics` tests)
 - #76050 (Remove unused function)
 - #76075 (datastructures: replace `once_cell` crate with an impl from std)
 - #76115 (Restore public visibility on some parsing functions for rustfmt)
 - #76127 (rustbuild: Remove one LLD workaround)

Failed merges:

r? @ghost
2020-08-31 13:30:13 +00:00
Aleksey Kladov
9caf08f052
Rollup merge of #76127 - petrochenkov:lld, r=Mark-Simulacrum
rustbuild: Remove one LLD workaround

The version of LLD shipped with Rust no longer have this issue.

Closes https://github.com/rust-lang/rust/issues/68647
2020-08-31 15:22:45 +02:00
Aleksey Kladov
d8eb30127b
Rollup merge of #76115 - calebcartwright:parser-fn-visibility, r=matklad
Restore public visibility on some parsing functions for rustfmt

In #74826 the visibility of several parsing functions was reduced. However, rustfmt is an external consumer of some of these functions as well and needs the visibility to be public, similar to other elements in rustc_parse such as `parse_ident`

db534b3ac2/src/librustc_parse/parser/mod.rs (L433-L436)
2020-08-31 15:22:43 +02:00
Aleksey Kladov
67f16431aa
Rollup merge of #76075 - marmeladema:remove-once-cell-crate, r=matklad
datastructures: replace `once_cell` crate with an impl from std

Fixes #75700

r? @matklad

We might need a perf run for this change.
2020-08-31 15:22:42 +02:00
Aleksey Kladov
7d2460e5c4
Rollup merge of #76050 - matklad:pos, r=petrochenkov
Remove unused function
2020-08-31 15:22:40 +02:00
Aleksey Kladov
4e2a25d759
Rollup merge of #75938 - Amjad50:min_const_generics-tests-revisions, r=lcnr
Added some `min_const_generics` revisions into `const_generics` tests

Help in #75279. still a lot more to cover though

r? @lcnr
2020-08-31 15:22:38 +02:00
bors
3b4797cb59 Auto merge of #76153 - matklad:rollup-vlblfup, r=matklad
Rollup of 9 pull requests

Successful merges:

 - #75969 (Switch to intra-doc links in core/src/{convert,iter}/mod.rs)
 - #76023 (Liballoc extend use intra doc link)
 - #76033 (Add missing hyphen)
 - #76052 (GH-66816:  Remove disable attr before return)
 - #76055 (Keep doc standard for Vec DrainFilter)
 - #76058 (Use assertions on Vec doc)
 - #76069 (Use explicit intra-doc link in path for Vec resize)
 - #76117 (Update README.md)
 - #76134 (Update MinGW instructions to include ninja)

Failed merges:

r? @ghost
2020-08-31 11:01:40 +00:00
Amjad Alsharafi
668f63d833 Fix duplicate error messages in const_generics tests 2020-08-31 18:52:22 +08:00
Aleksey Kladov
bd91b08507
Rollup merge of #76134 - CDirkx:patch-1, r=nagisa
Update MinGW instructions to include ninja

Rust now requires `ninja` to build, so the MinGW build instructions are updated to reflect this.

Like for `python` and `cmake`, the `mingw-w64-x86_64-ninja` package should be used. The default package from the `msys2` subsystem doesn't handle paths correctly on windows.
2020-08-31 12:51:55 +02:00
Aleksey Kladov
f8481745aa
Rollup merge of #76117 - mark-i-m:patch-1, r=petrochenkov
Update README.md
2020-08-31 12:51:54 +02:00
Aleksey Kladov
13c4f04561
Rollup merge of #76069 - pickfire:patch-16, r=jyn514
Use explicit intra-doc link in path for Vec resize

r? @jyn514
2020-08-31 12:51:53 +02:00
Aleksey Kladov
d829a5bcb1
Rollup merge of #76058 - pickfire:patch-11, r=jyn514
Use assertions on Vec doc

Clarify what the state of Vec after with_capacity on doc.

r? @jyn514
2020-08-31 12:51:51 +02:00
Aleksey Kladov
af1f46cf99
Rollup merge of #76055 - pickfire:patch-9, r=jyn514
Keep doc standard for Vec DrainFilter

r? @jyn514
2020-08-31 12:51:49 +02:00
Aleksey Kladov
300d7f661a
Rollup merge of #76052 - aszenz:GH-66816_removes_disable_attribute_before_return, r=GuillaumeGomez
GH-66816:  Remove disable attr before return

Passing --disable-per-crate-search removes the create search inputs so moved code around so that the search input is enabled
first before the function returns.

Fixes #66816
2020-08-31 12:51:46 +02:00
Aleksey Kladov
6ce3243995
Rollup merge of #76033 - camelid:patch-7, r=Dylan-DPC
Add missing hyphen

reference counted pointer -> reference-counted pointer

@rustbot modify labels: T-doc
2020-08-31 12:51:45 +02:00
Aleksey Kladov
e59eb4e0fa
Rollup merge of #76023 - pickfire:patch-4, r=jyn514
Liballoc extend use intra doc link

Superseeds https://github.com/rust-lang/rust/pull/75729/commits

r? @jyn514
2020-08-31 12:51:42 +02:00
Aleksey Kladov
c6017142a3
Rollup merge of #75969 - nixphix:docs/mod, r=jyn514
Switch to intra-doc links in core/src/{convert,iter}/mod.rs

Partial fix for #75080

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514

couldn't fix these

```rust
     ../../std/string/struct.String.html
     ../../std/primitive.never.html
     ../../std/sync/mpsc/struct.TryIter.html
```
2020-08-31 12:51:40 +02:00
David Wood
fa01ce802f
cg_llvm: fewer_names in uncached_llvm_type
This commit changes `uncached_llvm_type` so that a named struct type
(with an empty name) is always created when the `fewer_names` option
is enabled. By skipping the generation of names, we can improve perf.
Giving `LLVMStructCreateNamed` an empty name works because LLVM will
perform random renames to avoid collisions.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-31 11:20:52 +01:00
bors
8bfe289886 Auto merge of #75932 - Amjad50:intra-doc-core-slice, r=jyn514
Use intra-doc links for `core/src/slice.mod.rs`

partial help in #75080

r? @jyn514

- most are using primitive types links, which cannot be used with intra links at the moment
- also `std` cannot be referenced in any link, `std::ptr::NonNull` and `std::slice` could not be referenced
2020-08-31 09:09:37 +00:00
bors
6c44bcc4ff Auto merge of #75926 - camelid:patch-5, r=jonas-schievink
Fix typo in release notes
2020-08-31 07:17:34 +00:00
bors
8ed5cb56b5 Auto merge of #76027 - davidtwco:issue-61139-remove-obsolete-pretty-printer, r=eddyb
ty: remove obsolete pretty printer

Fixes #61139.

This PR removes the obsolete printer and replaces all uses of it with `FmtPrinter`. Of the replaced uses, all but one use was in `debug!` logging, two cases were notable:

- `MonoItem::to_string` is used in `-Z print-mono-items` and therefore affects the output of all codegen-units tests (which have been updated).
- `DefPathBasedNames` was used in `librustc_codegen_llvm/type_of.rs` with `LLVMStructCreateNamed` and that'll now get different values, but nothing will break as a result of this.

cc @eddyb (whom I've discussed this with)
2020-08-31 05:32:54 +00:00
bors
e98f0632bb Auto merge of #75082 - Aaron1011:feature/proc-macro-backtrace, r=petrochenkov
Add `-Z proc-macro-backtrace` to allow showing proc-macro panics

Fixes #75050

Previously, we would unconditionally suppress the panic hook during
proc-macro execution. This commit adds a new flag
`-Z proc-macro-backtrace`, which allows running the panic hook for
easier debugging.
2020-08-31 03:19:05 +00:00
Lzu Tao
a4e926daee std: move "mod tests/benches" to separate files
Also doing fmt inplace as requested.
2020-08-31 02:56:59 +00:00
Lzu Tao
db6cbfc49c tidy: add new exceptions and remove std from skip list
Also doing fmt inplace as requested.
2020-08-31 02:56:58 +00:00
Aaron Hill
d9208665b5
Add -Z proc-macro-backtrace to allow showing proc-macro panics
Fixes #75050

Previously, we would unconditionally suppress the panic hook during
proc-macro execution. This commit adds a new flag
-Z proc-macro-backtrace, which allows running the panic hook for
easier debugging.
2020-08-30 22:17:24 -04:00
bors
92290d1631 Auto merge of #75463 - CDirkx:ordering-const, r=CDirkx
Make some Ordering methods const

Constify the following methods of `core::cmp::Ordering`:
 - `reverse`
 - `then`

Possible because of #49146 (Allow `if` and `match` in constants).

Tracking issue:  #76113
2020-08-31 01:28:42 +00:00
CDirkx
00d459a93f
Update MinGW instructions to include ninja
Added the `mingw-w64-x86_64-ninja` package to the build guide for MinGW, as well as a note not to use the `ninja` package from the `msys2` subsystem (doesn't handle paths correctly on windows).
2020-08-31 01:22:25 +02:00
bors
022e1fe235 Auto merge of #74668 - petrochenkov:noname, r=mark-i-m
cleanup: Remove duplicate library names from `Cargo.toml`s
2020-08-30 23:14:05 +00:00
Esteban Küber
07112ca62d Suggest if let x = y when encountering if x = y
Detect potential cases where `if let` was meant but `let` was left out.

Fix #44990.
2020-08-30 15:01:06 -07:00
CDirkx
12f4624f71 Update since to correct release
`const_ordering` will stabilize in version 1.48.0
2020-08-30 23:59:37 +02:00
CDirkx
89fc3fb93b Stabilize feature const_ordering 2020-08-30 23:48:54 +02:00
Vadim Petrochenkov
21c624a230 rustbuild: Remove one LLD workaround 2020-08-31 00:26:07 +03:00
bors
36b0d7e257 Auto merge of #75779 - scileo:fix-issue-75492, r=petrochenkov
Improve error message when typo is made in format!

The expansion of the format! built-in macro is roughly done in two steps:
  - the format expression is parsed, the arguments are parsed,
  - the format expression is checked to be a string literal, code is expanded.

The problem is that the expression parser can eat too much tokens, which invalidates the parsing of the next format arguments. As the format expression check happens next, the error emitted concerns the format arguments, whereas the problem is about the format expression.

This PR contains two commits. The first one actually checks that the formatting expression is a string literal before raising any error about the formatting arguments, and the second one contains some simple heuristics which allow to suggest, when the format expression is followed by a dot instead of a comma, to suggest to replace the dot with a comma.

This pull request should fix #75492.

Note: this is my first non-doc contribution to the rust ecosystem. Feel free to make any comment about my code, or whatever. I'll be very happy to fix it :)
2020-08-30 21:03:06 +00:00
Sebastian Dröge
8d3cf9237d Improve documentation of slice::get_unchecked() / split_at_unchecked()
Thanks to Ivan Tham, who gave the majority of these suggestions during
their review.
2020-08-30 23:13:47 +03:00
Sebastian Dröge
d08996ac54 Get rid of bounds check in slice::chunks_exact() and related functions during construction
LLVM can't figure out in

    let rem = self.len() % chunk_size;
    let len = self.len() - rem;
    let (fst, snd) = self.split_at(len);

and

    let rem = self.len() % chunk_size;
    let (fst, snd) = self.split_at(rem);

that the index passed to split_at() is smaller than the slice length and
adds a bounds check plus panic for it.

Apart from removing the overhead of the bounds check this also allows
LLVM to optimize code around the ChunksExact iterator better.
2020-08-30 23:13:47 +03:00
Sebastian Dröge
30dc32b10e Add (non-public) slice::split_at_unchecked() and split_at_mut_unchecked()
These are unsafe variants of the non-unchecked functions and don't do
any bounds checking.

For the time being these are not public and only a preparation for the
following commit. Making it public and stabilization can follow later
and be discussed in https://github.com/rust-lang/rust/issues/76014 .
2020-08-30 23:13:46 +03:00
Sasha
f6d18db402 Use string literal directly when available in format
Previous implementation used the `Parser::parse_expr` function in order
to extract the format expression. If the first comma following the
format expression was mistakenly replaced with a dot, then the next
format expression was eaten by the function, because it looked as a
syntactically valid expression, which resulted in incorrectly spanned
error messages.

The way the format expression is exctracted is changed: we first look at
the first available token in the first argument supplied to the
`format!` macro call. If it is a string literal, then it is promoted as
a format expression immediatly, otherwise we fall back to the original
`parse_expr`-related method.

This allows us to ensure that the parser won't consume too much tokens
when a typo is made.

A test has been created so that it is ensured that the issue is properly
fixed.
2020-08-30 22:09:58 +02:00
Vadim Petrochenkov
7dfbf59f10 cleanup: Remove duplicate library names from Cargo.tomls 2020-08-30 22:57:54 +03:00
marmeladema
68500ffacb datastructures: replace once_cell crate with an impl from std 2020-08-30 20:06:14 +01:00
Who? Me?!
0175c437e2
Update README.md 2020-08-30 13:40:11 -05:00
Caleb Cartwright
883b1e7592 parser: restore some fn visibility for rustfmt 2020-08-30 13:04:36 -05:00
David Wood
6ff471b1cf
ty: remove obsolete printer
This commit removes the obsolete printer and replaces all uses of it
with `FmtPrinter`. Of the replaced uses, all but one use was in `debug!`
logging, two cases were notable:

- `MonoItem::to_string` is used in `-Z print-mono-items` and therefore
  affects the output of all codegen-units tests.
- `DefPathBasedNames` was used in `librustc_codegen_llvm/type_of.rs`
  with `LLVMStructCreateNamed` and that'll now get different values, but
  this should result in no functional change.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-30 18:59:07 +01:00
Aleksey Kladov
518cac9190 Remove unused function 2020-08-30 19:54:45 +02:00