]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #76088 - hbina:add_example, r=LukasKalbertodt
Tyler Mandry [Wed, 2 Sep 2020 01:24:27 +0000 (18:24 -0700)]
Rollup merge of #76088 - hbina:add_example, r=LukasKalbertodt

Add more examples to lexicographic cmp on Iterators.

Given two arrays of T1 and T2, the most important rule of lexicographical comparison is that two arrays
of equal length will be compared until the first difference occured.

The examples provided only focuses on the second rule that says that the
shorter array will be filled with some T2 that is less than every T1.
Which is only possible because of the first rule.

3 years agoRollup merge of #76074 - richkadel:llvm-coverage-map-gen-6b.5.1, r=wesleywiser
Tyler Mandry [Wed, 2 Sep 2020 01:24:25 +0000 (18:24 -0700)]
Rollup merge of #76074 - richkadel:llvm-coverage-map-gen-6b.5.1, r=wesleywiser

Add new `-Z dump-mir-spanview` option

Similar to `-Z dump-mir-graphviz`, this adds the option to write
HTML+CSS files that allow users to analyze the spans associated with MIR
elements (by individual statement, just terminator, or overall basic
block).

This PR was split out from PR #76004, and exposes an API for spanview
HTML+CSS files that is also used to analyze code regions chosen for
coverage instrumentation (in a follow-on PR).

Rust compiler MCP rust-lang/compiler-team#278

Relevant issue: #34701 - Implement support for LLVMs code coverage
instrumentation

r? @tmandry
FYI @wesleywiser

3 years agoRollup merge of #74880 - chrisduerr:fix_matches, r=dtolnay
Tyler Mandry [Wed, 2 Sep 2020 01:24:23 +0000 (18:24 -0700)]
Rollup merge of #74880 - chrisduerr:fix_matches, r=dtolnay

Add trailing comma support to matches macro

3 years agoAuto merge of #76010 - Aaron1011:fix/cfg-generic-param, r=petrochenkov
bors [Tue, 1 Sep 2020 20:03:55 +0000 (20:03 +0000)]
Auto merge of #76010 - Aaron1011:fix/cfg-generic-param, r=petrochenkov

Run cfg-stripping on generic parameters before invoking derive macros

Fixes #75930

This changes the tokens seen by a proc-macro. However, ising a `#[cfg]` attribute
on a generic paramter is unusual, and combining it with a proc-macro
derive is probably even more unusual. I don't expect this to cause any
breakage.

3 years agoAuto merge of #74559 - jonhoo:stabilize-vecdeque-make_contiguous, r=dtolnay
bors [Tue, 1 Sep 2020 18:02:37 +0000 (18:02 +0000)]
Auto merge of #74559 - jonhoo:stabilize-vecdeque-make_contiguous, r=dtolnay

Stabilize deque_make_contiguous

Closes #70929.

/cc @Amanieu

3 years agoAuto merge of #76197 - Mark-Simulacrum:no-llvm-no-ninja, r=pietroalbini
bors [Tue, 1 Sep 2020 15:42:29 +0000 (15:42 +0000)]
Auto merge of #76197 - Mark-Simulacrum:no-llvm-no-ninja, r=pietroalbini

Move ninja requirements to a dynamic check, when actually building

It isn't practical to determine whether we'll build LLVM very early in the
pipeline, so move the ninja checking to a dynamic check.

r? @pietroalbini -- this should fix nightlies

3 years agoMove ninja requirements to a dynamic check, when actually building
Mark Rousskov [Tue, 1 Sep 2020 13:17:26 +0000 (09:17 -0400)]
Move ninja requirements to a dynamic check, when actually building

It isn't practical to determine whether we'll build LLVM very early in the
pipeline, so move the ninja checking to a dynamic check.

3 years agoWill land in 1.48, not 1.47
Jon Gjengset [Tue, 1 Sep 2020 13:50:32 +0000 (09:50 -0400)]
Will land in 1.48, not 1.47

3 years agoMerge branch 'master' into stabilize-vecdeque-make_contiguous
Jon Gjengset [Tue, 1 Sep 2020 13:49:42 +0000 (09:49 -0400)]
Merge branch 'master' into stabilize-vecdeque-make_contiguous

3 years agoAuto merge of #75529 - bugadani:bounds-check, r=nagisa
bors [Tue, 1 Sep 2020 13:36:52 +0000 (13:36 +0000)]
Auto merge of #75529 - bugadani:bounds-check, r=nagisa

Eliminate some other bound checks when index comes from an enum

#36962 introduced an assumption for the upper limit of the enum's value. This PR adds an assumption to the lower value as well.

I've modified the original codegen test to show that derived (in that case, adding 1) values also don't generate bounds checks.

However, this test is actually carefully crafted to not hit a bug: if the enum's variants are modified to 1 and 2 instead of 2 and 3, the test fails by adding a bounds check. I suppose this is an LLVM issue and #75525, while not exactly in this context should be tracking it.

I'm not at all confident if this patch can be accepted, or even if it _should_ be accepted in this state. But I'm curious about what others think :)

~Improves~ Should improve #13926 but does not close it because it's not exactly predictable, where bounds checks may pop up against the assumptions.

3 years agoAuto merge of #76155 - matklad:rust-analyzer-2020-08-31, r=matklad
bors [Tue, 1 Sep 2020 10:01:04 +0000 (10:01 +0000)]
Auto merge of #76155 - matklad:rust-analyzer-2020-08-31, r=matklad

:arrow_up: rust-analyzer

r? @ghost

3 years agoAuto merge of #76071 - khyperia:configurable_to_immediate, r=eddyb
bors [Tue, 1 Sep 2020 07:44:34 +0000 (07:44 +0000)]
Auto merge of #76071 - khyperia:configurable_to_immediate, r=eddyb

Make to_immediate/from_immediate configurable by backends

`librustc_codegen_ssa` has the concept of an immediate vs. memory type, and `librustc_codegen_llvm` uses this distinction to implement `bool`s being `i8` in memory, and `i1` in immediate contexts. However, some of that implementation leaked into `codegen_ssa` when converting to/from immediate values. So, move those methods into builder traits, so that behavior can be configured by backends.

This is useful if a backend is able to keep bools as bools, or, needs to do more trickery than just bools to bytes.

(Note that there's already a large amount of things abstracted with "immediate types" - this is just bringing this particular thing in line to be abstracted as well)

---

Pinging @eddyb since that's who I was talking about this change with when they suggested I submit a PR.

3 years agoAdd new `-Z dump-mir-spanview` option
Rich Kadel [Sat, 29 Aug 2020 17:55:46 +0000 (10:55 -0700)]
Add new `-Z dump-mir-spanview` option

Similar to `-Z dump-mir-graphviz`, this adds the option to write
HTML+CSS files that allow users to analyze the spans associated with MIR
elements (by individual statement, just terminator, or overall basic
block).

This PR was split out from PR #76004, and exposes an API for spanview
HTML+CSS files that is also used to analyze code regions chosen for
coverage instrumentation (in a follow-on PR).

Rust compiler MCP rust-lang/compiler-team#278

Relevant issue: #34701 - Implement support for LLVMs code coverage
instrumentation

3 years agoAuto merge of #76047 - Dylan-DPC:rename/maybe, r=RalfJung
bors [Tue, 1 Sep 2020 05:41:22 +0000 (05:41 +0000)]
Auto merge of #76047 - Dylan-DPC:rename/maybe, r=RalfJung

rename get_{ref, mut} to assume_init_{ref,mut} in Maybeuninit

References #63568

Rework with comments addressed from #66174

Have replaced most of the occurrences I've found, hopefully didn't miss out anything

r? @RalfJung

(thanks @danielhenrymantilla for the initial work on this)

3 years agoAuto merge of #76186 - tmandry:rollup-49nliiy, r=tmandry
bors [Tue, 1 Sep 2020 03:26:55 +0000 (03:26 +0000)]
Auto merge of #76186 - tmandry:rollup-49nliiy, r=tmandry

Rollup of 12 pull requests

Successful merges:

 - #75945 (Use `env::func()`, not 'the function env::func' in docs for std::env)
 - #76002 (Fix `-Z instrument-coverage` on MSVC)
 - #76003 (Adds two source span utility functions used in source-based coverage)
 - #76059 (Clean up E0764)
 - #76103 (Clean up E0769)
 - #76139 (Make `cow_is_borrowed` methods const)
 - #76154 (Fix rustdoc strings indentation)
 - #76161 (Remove notrust in rustc_middle)
 - #76163 (README: Adjust Linux and macOS support platform and architecture)
 - #76166 (Make `StringReader` private)
 - #76172 (Revert #75463)
 - #76178 (Update expect-test to 1.0)

Failed merges:

r? @ghost

3 years agoRollup merge of #76178 - matklad:et, r=Mark-Simulacrum
Tyler Mandry [Tue, 1 Sep 2020 02:18:31 +0000 (19:18 -0700)]
Rollup merge of #76178 - matklad:et, r=Mark-Simulacrum

Update expect-test to 1.0

The only change is that `expect_file` now uses path relative to the
current file (same as `include!`). Before, it used paths relative to
the workspace root, which makes no sense.

3 years agoRollup merge of #76172 - ecstatic-morse:revert-75463, r=RalfJung
Tyler Mandry [Tue, 1 Sep 2020 02:18:29 +0000 (19:18 -0700)]
Rollup merge of #76172 - ecstatic-morse:revert-75463, r=RalfJung

Revert #75463

This was approved by me prematurely. It needs T-libs approval. Sorry @CDirkx.

r? @RalfJung

3 years agoRollup merge of #76166 - matklad:privatereader, r=petrochenkov
Tyler Mandry [Tue, 1 Sep 2020 02:18:28 +0000 (19:18 -0700)]
Rollup merge of #76166 - matklad:privatereader, r=petrochenkov

Make `StringReader` private

r? @ghost

closes #75619

3 years agoRollup merge of #76163 - lzutao:readme-glibc, r=cuviper
Tyler Mandry [Tue, 1 Sep 2020 02:18:26 +0000 (19:18 -0700)]
Rollup merge of #76163 - lzutao:readme-glibc, r=cuviper

README: Adjust Linux and macOS support platform and architecture

cc #74163

3 years agoRollup merge of #76161 - pickfire:patch-3, r=pickfire
Tyler Mandry [Tue, 1 Sep 2020 02:18:24 +0000 (19:18 -0700)]
Rollup merge of #76161 - pickfire:patch-3, r=pickfire

Remove notrust in rustc_middle

Fix #19599

This confuse people, no trust or not rust?
Or not rust no trust? Only trust rust ^^

Superseeds https://github.com/rust-lang/rust/pull/76063
r? @matklad

3 years agoRollup merge of #76154 - GuillaumeGomez:strings-indent, r=jyn514
Tyler Mandry [Tue, 1 Sep 2020 02:18:22 +0000 (19:18 -0700)]
Rollup merge of #76154 - GuillaumeGomez:strings-indent, r=jyn514

Fix rustdoc strings indentation

I took the opportunity to clean up our strings indentation a bit because it was a bit messy.

r? @jyn514

3 years agoRollup merge of #76139 - CDirkx:cow-is-borrowed, r=ecstatic-morse
Tyler Mandry [Tue, 1 Sep 2020 02:18:21 +0000 (19:18 -0700)]
Rollup merge of #76139 - CDirkx:cow-is-borrowed, r=ecstatic-morse

Make `cow_is_borrowed` methods const

Constify the following methods of `alloc::borrow::Cow`:
 - `is_borrowed`
 - `is_owned`

Analogous to the const methods `is_some` and `is_none` for Option, and `is_ok` and `is_err` for Result.

These methods are still unstable under `cow_is_borrowed`.
Possible because of #49146 (Allow if and match in constants).

Tracking issue: #65143

3 years agoRollup merge of #76103 - GuillaumeGomez:cleanup-e0769, r=Dylan-DPC
Tyler Mandry [Tue, 1 Sep 2020 02:18:19 +0000 (19:18 -0700)]
Rollup merge of #76103 - GuillaumeGomez:cleanup-e0769, r=Dylan-DPC

Clean up E0769

r? @pickfire

cc @Dylan-DPC

3 years agoRollup merge of #76059 - GuillaumeGomez:cleanup-e0764, r=Dylan-DPC,pickfire
Tyler Mandry [Tue, 1 Sep 2020 02:18:18 +0000 (19:18 -0700)]
Rollup merge of #76059 - GuillaumeGomez:cleanup-e0764, r=Dylan-DPC,pickfire

Clean up E0764

r? @Dylan-DPC

3 years agoRollup merge of #76003 - richkadel:llvm-coverage-map-gen-6b.4, r=wesleywiser
Tyler Mandry [Tue, 1 Sep 2020 02:18:16 +0000 (19:18 -0700)]
Rollup merge of #76003 - richkadel:llvm-coverage-map-gen-6b.4, r=wesleywiser

Adds two source span utility functions used in source-based coverage

`span.is_empty()` - returns true if `lo()` and `hi()` are equal. This is
not only a convenience, but makes it clear that a `Span` can be empty
(that is, retrieving the source for an empty `Span` will return an empty
string), and codifies the (otherwise undocumented--in the rustc_span
package, at least) fact that `Span` is a half-open interval (where
`hi()` is the open end).

`source_map.lookup_file_span()` - returns an enclosing `Span`
representing the start and end positions of the file enclosing the given
`BytePos`. This gives developers a clear way to quickly determine if any
any other `BytePos` or `Span` is also from the same file (for example,
by simply calling `file_span.contains(span)`).

This results in much simpler code and is much more runtime efficient
compared with the obvious alternative: calling `source_map.lookup_line()`
for any two `Span`'s byte positions, handle both arms of the `Result`
(both contain the file), and then compare files. It is also more
efficient than the non-public method `lookup_source_file_idx()` for each
`BytePos`, because, while comparing the internal source file indexes
would be efficient, looking up the source file index for every `BytePos`
or `Span` to be compared requires a binary search (worst case
performance being O(log n) for every lookup).

`source_map.lookup_file_span()` performs the binary search only once, to
get the `file_span` result that can be used to compare to any number of
other `BytePos` or `Span` values and those comparisons are always O(1).

This PR was split out from PR #75828 .

r? @tmandry
FYI: @wesleywiser

3 years agoRollup merge of #76002 - richkadel:llvm-coverage-map-gen-6b.3, r=tmandry
Tyler Mandry [Tue, 1 Sep 2020 02:18:14 +0000 (19:18 -0700)]
Rollup merge of #76002 - richkadel:llvm-coverage-map-gen-6b.3, r=tmandry

Fix `-Z instrument-coverage` on MSVC

Found that `-C link-dead-code` (which was enabled automatically
under `-Z instrument-coverage`) was causing the linking error that
resulted in segmentation faults in coverage instrumented binaries. Link
dead code is now disabled under MSVC, allowing `-Z instrument-coverage`
to be enabled under MSVC for the first time.

More details are included in Issue #76038 .

Note this PR makes it possible to support `Z instrument-coverage` but
does not enable instrument coverage for MSVC in existing tests. It will be
enabled in another PR to follow this one (both PRs coming from original
PR #75828).

r? @tmandry
FYI: @wesleywiser

3 years agoRollup merge of #75945 - pickfire:patch-7, r=jyn514
Tyler Mandry [Tue, 1 Sep 2020 02:18:13 +0000 (19:18 -0700)]
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

3 years agoAdds two source span utility functions used in source-based coverage
Rich Kadel [Thu, 27 Aug 2020 20:58:01 +0000 (13:58 -0700)]
Adds two source span utility functions used in source-based coverage

`span.is_empty()` - returns true if `lo()` and `hi()` are equal. This is
not only a convenience, but makes it clear that a `Span` can be empty
(that is, retrieving the source for an empty `Span` will return an empty
string), and codifies the (otherwise undocumented--in the rustc_span
package, at least) fact that `Span` is a half-open interval (where
`hi()` is the open end).

`source_map.lookup_file_span()` - returns an enclosing `Span`
representing the start and end positions of the file enclosing the given
`BytePos`. This gives developers a clear way to quickly determine if any
any other `BytePos` or `Span` is also from the same file (for example,
by simply calling `file_span.contains(span)`).

This results in much simpler code and is much more runtime efficient
compared with the obvious alternative: calling `source_map.lookup_line()`
for any two `Span`'s byte positions, handle both arms of the `Result`
(both contain the file), and then compare files. It is also more
efficient than the non-public method `lookup_source_file_idx()` for each
`BytePos`, because, while comparing the internal source file indexes
would be efficient, looking up the source file index for every `BytePos`
or `Span` to be compared requires a binary search (worst case
performance being O(log n) for every lookup).

`source_map.lookup_file_span()` performs the binary search only once, to
get the `file_span` result that can be used to compare to any number of
other `BytePos` or `Span` values and those comparisons are always O(1).

3 years agoFix `-Z instrument-coverage` on MSVC
Rich Kadel [Thu, 27 Aug 2020 19:53:43 +0000 (12:53 -0700)]
Fix `-Z instrument-coverage` on MSVC

Found that -C link-dead-code (which was enabled automatically
under -Z instrument-coverage) was causing the linking error that
resulted in segmentation faults in coverage instrumented binaries. Link
dead code is now disabled under MSVC, allowing `-Z instrument-coverage`
to be enabled under MSVC for the first time.

More details are included in Issue #76038.

(This PR was broken out from PR #75828)

3 years agoRemove tick for macOS x86
Lzu Tao [Tue, 1 Sep 2020 01:11:05 +0000 (01:11 +0000)]
Remove tick for macOS x86

3 years agoAuto merge of #75931 - estebank:suggest-if-let, r=petrochenkov
bors [Tue, 1 Sep 2020 00:26:01 +0000 (00:26 +0000)]
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.

3 years agoAdd a test for const
CDirkx [Mon, 31 Aug 2020 23:53:43 +0000 (01:53 +0200)]
Add a test for const

Similar to the tests for Option and Result.

3 years agoAuto merge of #76174 - ehuss:update-cargo, r=ehuss
bors [Mon, 31 Aug 2020 21:57:35 +0000 (21:57 +0000)]
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)

3 years agoUpdate cargo
Eric Huss [Mon, 31 Aug 2020 17:36:13 +0000 (10:36 -0700)]
Update cargo

3 years agoAuto merge of #75979 - lzutao:seprate-tests, r=Mark-Simulacrum
bors [Mon, 31 Aug 2020 20:03:33 +0000 (20:03 +0000)]
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.

3 years agoUpdate expect-test to 1.0
Aleksey Kladov [Mon, 31 Aug 2020 19:04:09 +0000 (21:04 +0200)]
Update expect-test to 1.0

The only change is that `expect_file` now uses path relative to the
current file (same as `include!`). Before, it used paths relative to
the workspace root, which makes no sense.

3 years agoClean up E0764 explanation
Guillaume Gomez [Mon, 31 Aug 2020 18:14:37 +0000 (20:14 +0200)]
Clean up E0764 explanation

3 years agoClean up E0769 explanation
Guillaume Gomez [Mon, 31 Aug 2020 18:10:57 +0000 (20:10 +0200)]
Clean up E0769 explanation

3 years agoAuto merge of #76030 - davidtwco:fewer-names-llvm-type-of, r=eddyb
bors [Mon, 31 Aug 2020 18:04:29 +0000 (18:04 +0000)]
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)

3 years agoRevert #75463
Dylan MacKenzie [Mon, 31 Aug 2020 17:20:34 +0000 (10:20 -0700)]
Revert #75463

This was approved by me prematurely. It needs T-libs approval.

3 years agoMake StringReader private
Aleksey Kladov [Mon, 31 Aug 2020 16:01:01 +0000 (18:01 +0200)]
Make StringReader private

After the recent refactorings, we can actually completely hide this
type. It should help with #63689.

3 years agoAuto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
bors [Mon, 31 Aug 2020 15:55:13 +0000 (15:55 +0000)]
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.

3 years agoAvoid StringReader when checking code blocks for syntax errors
Aleksey Kladov [Sat, 29 Aug 2020 12:29:23 +0000 (14:29 +0200)]
Avoid StringReader when checking code blocks for syntax errors

`parse_stream_from_source_str` is a more stable API to convert a
string into a bunch of tokens, and it also catches errors about
mismatched parenthesis.

3 years agoFix string
Guillaume Gomez [Mon, 31 Aug 2020 15:07:25 +0000 (17:07 +0200)]
Fix string

3 years agoAdjust Linux supported kernels and glibc
Lzu Tao [Mon, 31 Aug 2020 14:43:54 +0000 (14:43 +0000)]
Adjust Linux supported kernels and glibc

3 years agoRemove notrust in rustc_middle
Ivan Tham [Mon, 31 Aug 2020 14:10:09 +0000 (22:10 +0800)]
Remove notrust in rustc_middle

Fix #19599

This confuse people, no trust or not rust?
Or not rust no trust? Only trust rust ^^

3 years agoAuto merge of #76159 - matklad:rollup-8jydjg3, r=matklad
bors [Mon, 31 Aug 2020 13:30:13 +0000 (13:30 +0000)]
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

3 years agoRollup merge of #76127 - petrochenkov:lld, r=Mark-Simulacrum
Aleksey Kladov [Mon, 31 Aug 2020 13:22:45 +0000 (15:22 +0200)]
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

3 years agoRollup merge of #76115 - calebcartwright:parser-fn-visibility, r=matklad
Aleksey Kladov [Mon, 31 Aug 2020 13:22:43 +0000 (15:22 +0200)]
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`

https://github.com/rust-lang/rust/blob/db534b3ac286cf45688c3bbae6aa6e77439e52d2/src/librustc_parse/parser/mod.rs#L433-L436

3 years agoRollup merge of #76075 - marmeladema:remove-once-cell-crate, r=matklad
Aleksey Kladov [Mon, 31 Aug 2020 13:22:42 +0000 (15:22 +0200)]
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.

3 years agoRollup merge of #76050 - matklad:pos, r=petrochenkov
Aleksey Kladov [Mon, 31 Aug 2020 13:22:40 +0000 (15:22 +0200)]
Rollup merge of #76050 - matklad:pos, r=petrochenkov

Remove unused function

3 years agoRollup merge of #75938 - Amjad50:min_const_generics-tests-revisions, r=lcnr
Aleksey Kladov [Mon, 31 Aug 2020 13:22:38 +0000 (15:22 +0200)]
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

3 years agothe one left behind
DPC [Mon, 31 Aug 2020 12:57:12 +0000 (14:57 +0200)]
the one left behind

3 years ago:arrow_up: rust-analyzer
Aleksey Kladov [Mon, 31 Aug 2020 11:56:24 +0000 (13:56 +0200)]
:arrow_up: rust-analyzer

3 years agoFix strings indent
Guillaume Gomez [Mon, 31 Aug 2020 11:16:50 +0000 (13:16 +0200)]
Fix strings indent

3 years agoAuto merge of #76153 - matklad:rollup-vlblfup, r=matklad
bors [Mon, 31 Aug 2020 11:01:40 +0000 (11:01 +0000)]
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

3 years agoFix duplicate error messages in const_generics tests
Amjad Alsharafi [Mon, 31 Aug 2020 10:35:04 +0000 (18:35 +0800)]
Fix duplicate error messages in const_generics tests

3 years agoRollup merge of #76134 - CDirkx:patch-1, r=nagisa
Aleksey Kladov [Mon, 31 Aug 2020 10:51:55 +0000 (12:51 +0200)]
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.

3 years agoRollup merge of #76117 - mark-i-m:patch-1, r=petrochenkov
Aleksey Kladov [Mon, 31 Aug 2020 10:51:54 +0000 (12:51 +0200)]
Rollup merge of #76117 - mark-i-m:patch-1, r=petrochenkov

Update README.md

3 years agoRollup merge of #76069 - pickfire:patch-16, r=jyn514
Aleksey Kladov [Mon, 31 Aug 2020 10:51:53 +0000 (12:51 +0200)]
Rollup merge of #76069 - pickfire:patch-16, r=jyn514

Use explicit intra-doc link in path for Vec resize

r? @jyn514

3 years agoRollup merge of #76058 - pickfire:patch-11, r=jyn514
Aleksey Kladov [Mon, 31 Aug 2020 10:51:51 +0000 (12:51 +0200)]
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

3 years agoRollup merge of #76055 - pickfire:patch-9, r=jyn514
Aleksey Kladov [Mon, 31 Aug 2020 10:51:49 +0000 (12:51 +0200)]
Rollup merge of #76055 - pickfire:patch-9, r=jyn514

Keep doc standard for Vec DrainFilter

r? @jyn514

3 years agoRollup merge of #76052 - aszenz:GH-66816_removes_disable_attribute_before_return...
Aleksey Kladov [Mon, 31 Aug 2020 10:51:46 +0000 (12:51 +0200)]
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

3 years agoRollup merge of #76033 - camelid:patch-7, r=Dylan-DPC
Aleksey Kladov [Mon, 31 Aug 2020 10:51:45 +0000 (12:51 +0200)]
Rollup merge of #76033 - camelid:patch-7, r=Dylan-DPC

Add missing hyphen

reference counted pointer -> reference-counted pointer

@rustbot modify labels: T-doc

3 years agoRollup merge of #76023 - pickfire:patch-4, r=jyn514
Aleksey Kladov [Mon, 31 Aug 2020 10:51:42 +0000 (12:51 +0200)]
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

3 years agoRollup merge of #75969 - nixphix:docs/mod, r=jyn514
Aleksey Kladov [Mon, 31 Aug 2020 10:51:40 +0000 (12:51 +0200)]
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
```

3 years agocg_llvm: `fewer_names` in `uncached_llvm_type`
David Wood [Fri, 28 Aug 2020 15:24:52 +0000 (16:24 +0100)]
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>
3 years agoAuto merge of #75932 - Amjad50:intra-doc-core-slice, r=jyn514
bors [Mon, 31 Aug 2020 09:09:37 +0000 (09:09 +0000)]
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

3 years agoAuto merge of #75926 - camelid:patch-5, r=jonas-schievink
bors [Mon, 31 Aug 2020 07:17:34 +0000 (07:17 +0000)]
Auto merge of #75926 - camelid:patch-5, r=jonas-schievink

Fix typo in release notes

3 years agoAdd codegen tests
Dániel Buga [Tue, 25 Aug 2020 09:44:18 +0000 (11:44 +0200)]
Add codegen tests

3 years agoAdditional assumption to elide bounds check
Dániel Buga [Sun, 30 Aug 2020 19:26:03 +0000 (21:26 +0200)]
Additional assumption to elide bounds check

3 years agoAuto merge of #76027 - davidtwco:issue-61139-remove-obsolete-pretty-printer, r=eddyb
bors [Mon, 31 Aug 2020 05:32:54 +0000 (05:32 +0000)]
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)

3 years agoAuto merge of #75082 - Aaron1011:feature/proc-macro-backtrace, r=petrochenkov
bors [Mon, 31 Aug 2020 03:19:05 +0000 (03:19 +0000)]
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.

3 years agostd: move "mod tests/benches" to separate files
Lzu Tao [Thu, 27 Aug 2020 13:45:01 +0000 (13:45 +0000)]
std: move "mod tests/benches" to separate files

Also doing fmt inplace as requested.

3 years agotidy: add new exceptions and remove std from skip list
Lzu Tao [Thu, 27 Aug 2020 13:36:02 +0000 (13:36 +0000)]
tidy: add new exceptions and remove std from skip list

Also doing fmt inplace as requested.

3 years agoAdd `-Z proc-macro-backtrace` to allow showing proc-macro panics
Aaron Hill [Mon, 31 Aug 2020 02:17:24 +0000 (22:17 -0400)]
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.

3 years agoMake `cow_is_borrowed` methods const
CDirkx [Mon, 31 Aug 2020 01:43:47 +0000 (03:43 +0200)]
Make `cow_is_borrowed` methods const

Constify the following methods of `alloc::borrow::Cow`:
 - `is_borrowed`
 - `is_owned`

These methods are still unstable under `cow_is_borrowed`.
Possible because of #49146 (Allow if and match in constants).

Tracking issue: #65143

3 years agoAuto merge of #75463 - CDirkx:ordering-const, r=CDirkx
bors [Mon, 31 Aug 2020 01:28:42 +0000 (01:28 +0000)]
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

3 years agofix
DPC [Mon, 31 Aug 2020 00:27:38 +0000 (02:27 +0200)]
fix

3 years agoUpdate MinGW instructions to include ninja
CDirkx [Sun, 30 Aug 2020 23:22:25 +0000 (01:22 +0200)]
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).

3 years agoAuto merge of #74668 - petrochenkov:noname, r=mark-i-m
bors [Sun, 30 Aug 2020 23:14:05 +0000 (23:14 +0000)]
Auto merge of #74668 - petrochenkov:noname, r=mark-i-m

cleanup: Remove duplicate library names from `Cargo.toml`s

3 years agoSuggest `if let x = y` when encountering `if x = y`
Esteban Küber [Wed, 26 Aug 2020 03:28:25 +0000 (20:28 -0700)]
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.

3 years agoUpdate `since` to correct release
CDirkx [Sun, 30 Aug 2020 21:59:37 +0000 (23:59 +0200)]
Update `since` to correct release

`const_ordering` will stabilize in version 1.48.0

3 years agoStabilize feature `const_ordering`
CDirkx [Sun, 30 Aug 2020 21:48:54 +0000 (23:48 +0200)]
Stabilize feature `const_ordering`

3 years agorustbuild: Remove one LLD workaround
Vadim Petrochenkov [Sun, 30 Aug 2020 14:51:17 +0000 (17:51 +0300)]
rustbuild: Remove one LLD workaround

3 years agoAuto merge of #75779 - scileo:fix-issue-75492, r=petrochenkov
bors [Sun, 30 Aug 2020 21:03:06 +0000 (21:03 +0000)]
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 :)

3 years agoImprove documentation of slice::get_unchecked() / split_at_unchecked()
Sebastian Dröge [Sun, 30 Aug 2020 19:47:05 +0000 (22:47 +0300)]
Improve documentation of slice::get_unchecked() / split_at_unchecked()

Thanks to Ivan Tham, who gave the majority of these suggestions during
their review.

3 years agoGet rid of bounds check in slice::chunks_exact() and related functions during constru...
Sebastian Dröge [Wed, 26 Aug 2020 06:59:04 +0000 (09:59 +0300)]
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.

3 years agoAdd (non-public) slice::split_at_unchecked() and split_at_mut_unchecked()
Sebastian Dröge [Fri, 28 Aug 2020 05:55:41 +0000 (08:55 +0300)]
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 .

3 years agoUse string literal directly when available in format
Sasha [Fri, 28 Aug 2020 21:04:42 +0000 (23:04 +0200)]
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.

3 years agocleanup: Remove duplicate library names from `Cargo.toml`s
Vadim Petrochenkov [Thu, 23 Jul 2020 07:25:49 +0000 (10:25 +0300)]
cleanup: Remove duplicate library names from `Cargo.toml`s

3 years agodatastructures: replace `once_cell` crate with an impl from std
marmeladema [Sat, 29 Aug 2020 18:16:49 +0000 (19:16 +0100)]
datastructures: replace `once_cell` crate with an impl from std

3 years agoUpdate README.md
Who? Me?! [Sun, 30 Aug 2020 18:40:11 +0000 (13:40 -0500)]
Update README.md

3 years agoparser: restore some fn visibility for rustfmt
Caleb Cartwright [Sun, 30 Aug 2020 18:04:36 +0000 (13:04 -0500)]
parser: restore some fn visibility for rustfmt

3 years agoty: remove obsolete printer
David Wood [Fri, 28 Aug 2020 13:31:03 +0000 (14:31 +0100)]
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>
3 years agoRemove unused function
Aleksey Kladov [Sat, 29 Aug 2020 09:00:59 +0000 (11:00 +0200)]
Remove unused function

3 years agoMove lexer unit tests to rustc_lexer
Aleksey Kladov [Sat, 29 Aug 2020 10:10:16 +0000 (12:10 +0200)]
Move lexer unit tests to rustc_lexer

StringReader is an intornal abstraction which at the moment changes a
lot, so these unit tests cause quite a bit of friction.

Moving them to rustc_lexer and more ingerated-testing style should
make them much less annoying, hopefully without decreasing their
usefulness much.

Note that coloncolon tests are removed (it's unclear what those are
testing).

\r\n tests are removed as well, as we normalize line endings even
before lexing.

3 years agoRun cfg-stripping on generic parameters before invoking derive macros
Aaron Hill [Fri, 28 Aug 2020 03:17:40 +0000 (23:17 -0400)]
Run cfg-stripping on generic parameters before invoking derive macros

Fixes #75930

This changes the tokens seen by a proc-macro. However, ising a `#[cfg]` attribute
on a generic paramter is unusual, and combining it with a proc-macro
derive is probably even more unusual. I don't expect this to cause any
breakage.

3 years agoAdd unstable `const_ordering` feature, and some tests.
CDirkx [Sun, 30 Aug 2020 17:40:00 +0000 (19:40 +0200)]
Add unstable `const_ordering` feature, and some tests.

3 years agoAuto merge of #74862 - mark-i-m:mv-compiler, r=petrochenkov
bors [Sun, 30 Aug 2020 15:57:57 +0000 (15:57 +0000)]
Auto merge of #74862 - mark-i-m:mv-compiler, r=petrochenkov

Move almost all compiler crates to compiler/

This PR implements https://github.com/rust-lang/compiler-team/issues/336 and moves all `rustc_*` crates from `src` to the new `compiler` directory.

`librustc_foo` directories are renamed to `rustc_foo`.
`src` directories are introduced inside `rustc_*` directories to mirror the scheme already use for `library` crates.