]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMerge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup
flip1995 [Thu, 25 Mar 2021 18:29:11 +0000 (19:29 +0100)]
Merge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup

3 years agoAuto merge of #6971 - flip1995:rustup, r=flip1995
bors [Thu, 25 Mar 2021 17:49:06 +0000 (17:49 +0000)]
Auto merge of #6971 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump Clippy Version -> 0.1.53
flip1995 [Thu, 25 Mar 2021 17:48:48 +0000 (18:48 +0100)]
Bump Clippy Version -> 0.1.53

3 years agoBump nightly version -> 2021-03-25
flip1995 [Thu, 25 Mar 2021 17:38:52 +0000 (18:38 +0100)]
Bump nightly version -> 2021-03-25

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 25 Mar 2021 17:38:13 +0000 (18:38 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #83387 - cuviper:min-llvm-10, r=nagisa
bors [Thu, 25 Mar 2021 13:11:18 +0000 (13:11 +0000)]
Auto merge of #83387 - cuviper:min-llvm-10, r=nagisa

Update the minimum external LLVM to 10

r? `@nikic`

3 years agoAuto merge of #82565 - m-ou-se:ununstabilize-bits, r=kennytm
bors [Thu, 25 Mar 2021 10:29:58 +0000 (10:29 +0000)]
Auto merge of #82565 - m-ou-se:ununstabilize-bits, r=kennytm

Revert reverting of stabilizing integer::BITS.

Now that `lexical-core` has an updated version that won't break with this stabilization, let's try to stabilize this again.

See https://github.com/rust-lang/rust/issues/81654#issuecomment-778564715

Tracking issue with FCP: https://github.com/rust-lang/rust/issues/76904

3 years agoAuto merge of #83445 - erikdesjardins:rmunion, r=RalfJung
bors [Thu, 25 Mar 2021 07:48:52 +0000 (07:48 +0000)]
Auto merge of #83445 - erikdesjardins:rmunion, r=RalfJung

RemoveZsts: don't touch unions

This should fix a Miri ICE

r? `@RalfJung`

3 years agoAuto merge of #83307 - richkadel:cov-unused-functions-1.1, r=tmandry
bors [Thu, 25 Mar 2021 05:07:34 +0000 (05:07 +0000)]
Auto merge of #83307 - richkadel:cov-unused-functions-1.1, r=tmandry

coverage bug fixes and optimization support

Adjusted LLVM codegen for code compiled with `-Zinstrument-coverage` to
address multiple, somewhat related issues.

Fixed a significant flaw in prior coverage solution: Every counter
generated a new counter variable, but there should have only been one
counter variable per function. This appears to have bloated .profraw
files significantly. (For a small program, it increased the size by
about 40%. I have not tested large programs, but there is anecdotal
evidence that profraw files were way too large. This is a good fix,
regardless, but hopefully it also addresses related issues.

Fixes: #82144
Invalid LLVM coverage data produced when compiled with -C opt-level=1

Existing tests now work up to at least `opt-level=3`. This required a
detailed analysis of the LLVM IR, comparisons with Clang C++ LLVM IR
when compiled with coverage, and a lot of trial and error with codegen
adjustments.

The biggest hurdle was figuring out how to continue to support coverage
results for unused functions and generics. Rust's coverage results have
three advantages over Clang's coverage results:

1. Rust's coverage map does not include any overlapping code regions,
   making coverage counting unambiguous.
2. Rust generates coverage results (showing zero counts) for all unused
   functions, including generics. (Clang does not generate coverage for
   uninstantiated template functions.)
3. Rust's unused functions produce minimal stubbed functions in LLVM IR,
   sufficient for including in the coverage results; while Clang must
   generate the complete LLVM IR for each unused function, even though
   it will never be called.

This PR removes the previous hack of attempting to inject coverage into
some other existing function instance, and generates dedicated instances
for each unused function. This change, and a few other adjustments
(similar to what is required for `-C link-dead-code`, but with lower
impact), makes it possible to support LLVM optimizations.

Fixes: #79651
Coverage report: "Unexecuted instantiation:..." for a generic function
from multiple crates

Fixed by removing the aforementioned hack. Some "Unexecuted
instantiation" notices are unavoidable, as explained in the
`used_crate.rs` test, but `-Zinstrument-coverage` has new options to
back off support for either unused generics, or all unused functions,
which avoids the notice, at the cost of less coverage of unused
functions.

Fixes: #82875
Invalid LLVM coverage data produced with crate brotli_decompressor

Fixed by disabling the LLVM function attribute that forces inlining, if
`-Z instrument-coverage` is enabled. This attribute is applied to
Rust functions with `#[inline(always)], and in some cases, the forced
inlining breaks coverage instrumentation and reports.

FYI: `@wesleywiser`

r? `@tmandry`

3 years agoAuto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen
bors [Thu, 25 Mar 2021 03:01:35 +0000 (03:01 +0000)]
Auto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen

Check for `.to_string().into_bytes()` in string_lit_to_bytes

fixes #6927

changelog: Add a check for `into_bytes()` to string_lit_to_bytes lint

3 years agoAuto merge of #83454 - JohnTitor:rollup-9ae0565, r=JohnTitor
bors [Thu, 25 Mar 2021 02:26:19 +0000 (02:26 +0000)]
Auto merge of #83454 - JohnTitor:rollup-9ae0565, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #83041 (stabilize debug_non_exhaustive)
 - #83349 (Remove Option::{unwrap_none, expect_none}.)
 - #83420 (Add documentation for rustdoc-gui tests)
 - #83421 (Add Result::into_err where the Ok variant is the never type)
 - #83427 (small cleanups in rustc_errors / emitter)
 - #83434 (Update RELEASES.md)
 - #83440 (Use intra-doc link in core::cell)
 - #83442 (LLVMWrapper: attractive nuisance macros)

Failed merges:

 - #83438 (Update RELEASES.md)

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agocheck for `.to_string().into_bytes()` in string_lit_to_bytes
Elliot Bobrow [Wed, 24 Mar 2021 00:10:27 +0000 (17:10 -0700)]
check for `.to_string().into_bytes()` in string_lit_to_bytes

apply changes from review

3 years agoRollup merge of #83442 - durin42:remove-questionable-macros, r=cuviper
Yuki Okushi [Thu, 25 Mar 2021 00:07:32 +0000 (09:07 +0900)]
Rollup merge of #83442 - durin42:remove-questionable-macros, r=cuviper

LLVMWrapper: attractive nuisance macros

This came up in the review of #83425: it's hard to imagine a use of
LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble
when a point release gets created, so let's just discard them to prevent
the issue.

3 years agoRollup merge of #83440 - fee1-dead:core-cell-intralink, r=jyn514
Yuki Okushi [Thu, 25 Mar 2021 00:07:31 +0000 (09:07 +0900)]
Rollup merge of #83440 - fee1-dead:core-cell-intralink, r=jyn514

Use intra-doc link in core::cell

``@rustbot`` label T-doc A-intra-doc-links

r? ``@jyn514``

3 years agoRollup merge of #83434 - wesleywiser:update_releases, r=Mark-Simulacrum
Yuki Okushi [Thu, 25 Mar 2021 00:07:30 +0000 (09:07 +0900)]
Rollup merge of #83434 - wesleywiser:update_releases, r=Mark-Simulacrum

Update RELEASES.md

This change was backed out in #83412 so we should remove the reference
to it from the release notes.

3 years agoRollup merge of #83427 - llogiq:refactor-emitter, r=estebank
Yuki Okushi [Thu, 25 Mar 2021 00:07:29 +0000 (09:07 +0900)]
Rollup merge of #83427 - llogiq:refactor-emitter, r=estebank

small cleanups in rustc_errors / emitter

This is either moving code around so it gets called less often or using if let instead of match in a few cases.

3 years agoRollup merge of #83421 - faern:add-into-err, r=joshtriplett
Yuki Okushi [Thu, 25 Mar 2021 00:07:28 +0000 (09:07 +0900)]
Rollup merge of #83421 - faern:add-into-err, r=joshtriplett

Add Result::into_err where the Ok variant is the never type

Equivalent of #66045 but for the inverse situation where `T: Into<!>` rather than `E: Into<!>`.

I'm using the same feature gate name. I can't see why one of these methods would be OK to stabilize but not the other.

Tracking issue: #61695

3 years agoRollup merge of #83420 - GuillaumeGomez:rustdoc-gui-tests-doc, r=CraftSpider
Yuki Okushi [Thu, 25 Mar 2021 00:07:27 +0000 (09:07 +0900)]
Rollup merge of #83420 - GuillaumeGomez:rustdoc-gui-tests-doc, r=CraftSpider

Add documentation for rustdoc-gui tests

I think a bit of documentation doesn't hurt in this case considering how "out of the ordinary" this is.

r? ``@jyn514``

3 years agoRollup merge of #83349 - m-ou-se:unwrap-none, r=dtolnay
Yuki Okushi [Thu, 25 Mar 2021 00:07:26 +0000 (09:07 +0900)]
Rollup merge of #83349 - m-ou-se:unwrap-none, r=dtolnay

Remove Option::{unwrap_none, expect_none}.

This removes `Option::unwrap_none` and `Option::expect_none` since we're not going to stabilize them, see https://github.com/rust-lang/rust/issues/62633.

Closes #62633

3 years agoRollup merge of #83041 - guswynn:stable_debug_struct, r=m-ou-se
Yuki Okushi [Thu, 25 Mar 2021 00:07:24 +0000 (09:07 +0900)]
Rollup merge of #83041 - guswynn:stable_debug_struct, r=m-ou-se

stabilize debug_non_exhaustive

tracking issue: https://github.com/rust-lang/rust/issues/67364

but it is still an open question whether the other `Debug*` struct's should have a similar method. I would guess that would best be put underneath a new feature gate, as this one seems uncontroversial enough to stabilize as is

3 years agoBump debug_non_exhaustive stabilization to 1.53.
Mara Bos [Wed, 24 Mar 2021 21:54:04 +0000 (22:54 +0100)]
Bump debug_non_exhaustive stabilization to 1.53.

3 years agoBump int_bits_const stable version to 1.53.
Mara Bos [Fri, 26 Feb 2021 21:39:32 +0000 (22:39 +0100)]
Bump int_bits_const stable version to 1.53.

3 years agoRevert "Revert stabilizing integer::BITS."
Mara Bos [Fri, 26 Feb 2021 21:38:24 +0000 (22:38 +0100)]
Revert "Revert stabilizing integer::BITS."

3 years agoAuto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth
bors [Wed, 24 Mar 2021 21:09:01 +0000 (21:09 +0000)]
Auto merge of #6952 - Jarcho:new_ret_no_self_fp, r=Manishearth

Fix `new_ret_no_self` false positive

fixes: #1724

changelog: Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments

3 years agoAuto merge of #83220 - Aaron1011:fix/eval-region-cache, r=nikomatsakis
bors [Wed, 24 Mar 2021 20:51:37 +0000 (20:51 +0000)]
Auto merge of #83220 - Aaron1011:fix/eval-region-cache, r=nikomatsakis

Use `EvaluatedToOkModuloRegions` whenever we erase regions

Fixes #80691

When we evaluate a trait predicate, we convert an
`EvaluatedToOk` result to `EvaluatedToOkModuloRegions` if we erased any
regions. We cache the result under a region-erased 'freshened'
predicate, so `EvaluatedToOk` may not be correct for other predicates
that have the same cache key.

3 years agoRename `contains_adt` to `contains_adt_constructor`
Jason Newcomb [Wed, 24 Mar 2021 20:19:27 +0000 (16:19 -0400)]
Rename `contains_adt` to `contains_adt_constructor`

3 years agoFix false positive with `new_ret_no_self` when returning `Self` with different generi...
Jason Newcomb [Tue, 23 Mar 2021 01:38:14 +0000 (21:38 -0400)]
Fix false positive with `new_ret_no_self` when returning `Self` with different generic arguments

3 years agoUse `EvaluatedToOkModuloRegions` whenever we erase regions
Aaron Hill [Tue, 16 Mar 2021 23:28:27 +0000 (19:28 -0400)]
Use `EvaluatedToOkModuloRegions` whenever we erase regions

Fixes #80691

When we evaluate a trait predicate, we convert an
`EvaluatedToOk` result to `EvaluatedToOkModuloRegions` if we erased any
regions. We cache the result under a region-erased 'freshened'
predicate, so `EvaluatedToOk` may not be correct for other predicates
that have the same cache key.

3 years agoAuto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq
bors [Wed, 24 Mar 2021 18:42:20 +0000 (18:42 +0000)]
Auto merge of #6962 - TaKO8Ki:fix-false-positive-in-manual-flatten, r=llogiq

Fix false positive in `manual_flatten`

This pull request fixes false positive in `manual_flatten` in case using a slice of references .

closes: #6893

changelog: fix false positive in `manual_flatten`

3 years agoLLVMWrapper: attractive nuisance macros
Augie Fackler [Wed, 24 Mar 2021 14:25:03 +0000 (10:25 -0400)]
LLVMWrapper: attractive nuisance macros

THis came up in the review of #83425: it's hard to imagine a use of
LLVM_VERSION_LE() or LLVM_VERSION_EQ() that's not asking for trouble
when a point release gets created, so let's just discard them to prevent
the issue.

3 years agoRemoveZsts: don't touch unions
Erik Desjardins [Wed, 24 Mar 2021 17:00:36 +0000 (13:00 -0400)]
RemoveZsts: don't touch unions

3 years agomerge imports
Takayuki Maeda [Wed, 24 Mar 2021 15:17:43 +0000 (00:17 +0900)]
merge imports

3 years agofix false positive in manual_flatten
Takayuki Maeda [Wed, 24 Mar 2021 15:15:15 +0000 (00:15 +0900)]
fix false positive in manual_flatten

3 years agoAuto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakis
bors [Wed, 24 Mar 2021 14:45:16 +0000 (14:45 +0000)]
Auto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakis

2229 migration: Don't try resolve regions before writeback

In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`,
because we might not have performed regionck yet.

Fixes: #83176
r? `@nikomatsakis`

3 years agoUse intra-doc link in core::cell
Deadbeef [Wed, 24 Mar 2021 13:42:49 +0000 (21:42 +0800)]
Use intra-doc link in core::cell

3 years agoAuto merge of #83050 - osa1:issue83048, r=matthewjasper
bors [Wed, 24 Mar 2021 12:02:13 +0000 (12:02 +0000)]
Auto merge of #83050 - osa1:issue83048, r=matthewjasper

Run analyses before thir-tree dumps

Fixes #83048

3 years agoAuto merge of #83408 - ijackson:expose-splitinclusive, r=dtolnay
bors [Wed, 24 Mar 2021 09:21:06 +0000 (09:21 +0000)]
Auto merge of #83408 - ijackson:expose-splitinclusive, r=dtolnay

Expose str::SplitInclusive in alloc and therefore in std

This seems to have been omitted from the beginning when this feature was first introduced in 86bf96291d82.  Most users won't need to name this type which is probably why this wasn't noticed in the meantime.

See #83372 for a different but related bug.

### Notes for reviewers

I think I have got this right but TBH I am not very familiar with the relationship between core and std and so on.  <strike>I also haven't don't any kind of test (not even a build) yet.  I will do a local docs build to see that the type now appears in the std docs.</strike>  I did a local docs build and it has made this type appear as `std::str::SplitInclusive` as expected

The linkification of the return value from `str::split_inclusive` teleports me to the online url for `core::str::SplitInclusive`.  I think this may be a rustdoc anomaly (similar to #79630 maybe) but I am not sure.  Perhaps it means I haven't done the `std` -> `core` referrence correctly.

I made this insta-stable since it seems like simply a bug.  Please LMK if that is not right.  *(edited to add:)* In particular, IDK how this ought to relate to the (?)current release process.

3 years agoAuto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnr
bors [Wed, 24 Mar 2021 04:13:27 +0000 (04:13 +0000)]
Auto merge of #75384 - JulianKnodt:cg_def, r=varkor,lcnr

implement `feature(const_generics_defaults)`

Implements const generics defaults `struct Example<const N: usize=3>`, as well as a query for getting the default of a given const-parameter's def id. There are some remaining FIXME's but they were specified as not blocking for merging this PR. This also puts the defaults behind the unstable feature gate `#![feature(const_generics_defaults)]`.

~~This currently creates a field which is always false on `GenericParamDefKind` for future use when
consts are permitted to have defaults. I'm not sure if this is exactly what is best for adding default parameters, but I mimicked the style of type defaults, so hopefully this is ok.~~

r? `@lcnr`

3 years agoBump alloc::str::SplitInclusive to 1.53.0 release
David Tolnay [Wed, 24 Mar 2021 03:26:19 +0000 (20:26 -0700)]
Bump alloc::str::SplitInclusive to 1.53.0 release

3 years agoUpdate RELEASES.md
Wesley Wiser [Wed, 24 Mar 2021 02:03:51 +0000 (22:03 -0400)]
Update RELEASES.md

This change was backed out in #83412 so we should remove the reference
to it from the release notes.

3 years agoAuto merge of #83432 - Dylan-DPC:rollup-4z5f6al, r=Dylan-DPC
bors [Wed, 24 Mar 2021 01:32:32 +0000 (01:32 +0000)]
Auto merge of #83432 - Dylan-DPC:rollup-4z5f6al, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #83051 (Sidebar trait items order)
 - #83313 (Only enable assert_dep_graph when query-dep-graph is enabled.)
 - #83353 (Add internal io::Error::new_const to avoid allocations.)
 - #83391 (Allow not emitting `uwtable` on Android)
 - #83392 (Change `-W help` to display edition level.)
 - #83393 (Codeblock tooltip position)
 - #83399 (rustdoc: Record crate name instead of using `None`)
 - #83405 (Slight visual improvements to warning boxes in the docs)
 - #83415 (Remove unnecessary `Option` wrapping around `Crate.module`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #83415 - camelid:remove-crate-module-option, r=jyn514
Dylan DPC [Wed, 24 Mar 2021 00:52:36 +0000 (01:52 +0100)]
Rollup merge of #83415 - camelid:remove-crate-module-option, r=jyn514

Remove unnecessary `Option` wrapping around `Crate.module`

I'm wondering if it was originally there so that we could `take` the
module which enables `after_krate` to take an `&Crate`. However, the two
impls of `after_krate` only use `Crate.name`, so we can pass just the
name instead.

3 years agoRollup merge of #83405 - r00ster91:deprecated_emoji, r=GuillaumeGomez
Dylan DPC [Wed, 24 Mar 2021 00:52:35 +0000 (01:52 +0100)]
Rollup merge of #83405 - r00ster91:deprecated_emoji, r=GuillaumeGomez

Slight visual improvements to warning boxes in the docs

First I noticed that sometimes the thumbs-down emoji in the docs is hard to see and hard to look at because the yellow emoji color and the color of the box below are so bright. Especially if you look at the screen late at night you can notice it. I thought I should change that so I added a black outline around the emoji. It works using the [`text-shadow`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow) property. It may be a bit hacky but it seems to work well and browser compatibility looks pretty good too: [browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow#browser_compatibility).
For consistency the microscope has the black border too.
Alternatively I had `drop-shadow(0px 0px 1px black);` in mind but its [browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/drop-shadow()#browser_compatibility) doesn't look as good and the blurry shadow probably doesn't look as good either.

Then, I thought that now that I'm at it I could also try changing the purple color to a color you would rather expect to see for deprecation: red. For the red I've taken the blue and reused it as a foundation and moved it to the red color spectrum.
But then I thought that the purple color could still be reused for something else: for the boxes that tell you about portability (e.g. _only supported on Unix_). These are currently blue.

I think blue doesn't really represent danger like it should. Not being cross-platform represents a danger because if you want to compile for a different platform, your code may not compile anymore. Blue looks too friendly and is in my opinion more suitable for a box containing general information like for instance "This is available since 1.0.0". None of the current three box types (unstable, deprecated and portability) are that.

I think purple is a better fit for it because it's kind of in the middle between "use it" and "don't use it". Deprecated is definitely "don't use it". To illustrate this better, here's a color spectrum:

Blue = friendly,  "use it".
![image](https://user-images.githubusercontent.com/35064754/112139891-9a6b0f80-8bd3-11eb-94e1-dc747a3d4cf9.png)
Red = danger, "don't use it".

And the purple in the middle (the color that the portability box now has) probably represents "use it if you have to", so it's not entirely friendly and not entirely a danger. That is why I think it fits.

However I made one change to that existing purple: I made the outer color a bit brighter because it's outstandingly dark compared to the other outer colors of the other boxes.

This is all subjective but in my opinion it looks nicer. At first you might need to get used to it though. Notice the box colors and the black outlines around the emoji shapes:
![image](https://user-images.githubusercontent.com/35064754/112139327-ebc6cf00-8bd2-11eb-88ac-25219b43a1a0.png)
![image](https://user-images.githubusercontent.com/35064754/112139392-000acc00-8bd3-11eb-90c2-81feec93c521.png)

3 years agoRollup merge of #83399 - camelid:rustdoc-priv-link-from-crate, r=jyn514
Dylan DPC [Wed, 24 Mar 2021 00:52:34 +0000 (01:52 +0100)]
Rollup merge of #83399 - camelid:rustdoc-priv-link-from-crate, r=jyn514

rustdoc: Record crate name instead of using `None`

Fixes #83365.

r? `@jyn514`

3 years agoRollup merge of #83393 - GuillaumeGomez:codeblock-tooltip-position, r=Nemo157
Dylan DPC [Wed, 24 Mar 2021 00:52:32 +0000 (01:52 +0100)]
Rollup merge of #83393 - GuillaumeGomez:codeblock-tooltip-position, r=Nemo157

Codeblock tooltip position

The codeblocks tooltips were misplaced. Normally, there is no top margin applied to a tooltip unless the codeblock is the first element of the doc block. The CSS rule was too vague though, applying it to all tooltips where the codeblock was the first child of its parent. Which can be easily seen with lists:

Before:

![Screenshot from 2021-03-22 22-05-16](https://user-images.githubusercontent.com/3050060/112059812-a667ba80-8b5c-11eb-88dd-1c598ceb3766.png)

After:

![Screenshot from 2021-03-22 22-06-31](https://user-images.githubusercontent.com/3050060/112059815-a7005100-8b5c-11eb-9e40-8fc57513e498.png)

r? ``@Nemo157``

3 years agoRollup merge of #83392 - ehuss:w-help-edition, r=varkor
Dylan DPC [Wed, 24 Mar 2021 00:52:31 +0000 (01:52 +0100)]
Rollup merge of #83392 - ehuss:w-help-edition, r=varkor

Change `-W help` to display edition level.

`-W help` was not honoring the `--edition` flag when displaying the default lint level. It was using the edition for sorting, but not for the final display.

This isn't important right now as there aren't any edition-specific lint levels. Also, the `declare_lint` macro is broken and doesn't even allow setting them right now. However, I figure it wouldn't hurt to fix this before I forget about it, in case edition-specific lints are ever used in the future.

3 years agoRollup merge of #83391 - hyd-dev:uwtable, r=alexcrichton
Dylan DPC [Wed, 24 Mar 2021 00:52:30 +0000 (01:52 +0100)]
Rollup merge of #83391 - hyd-dev:uwtable, r=alexcrichton

Allow not emitting `uwtable` on Android

`uwtable` is marked as required on Android, so it can't be disabled via `-C force-unwind-tables=no`. However, I found that the reason it's marked as required was to resolve a [backtrace issue in Gecko](https://github.com/rust-lang/rust/issues/49867), and I haven't find any other reasons that make it required ([yet](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Unwind.20tables.20are.20strictly.20required.20on.20Windows.20and.20Android)). Therefore, I assume it's safe to turn it off if a (nice) backtrace is not needed, and submit this PR to allow `-C force-unwind-tables=no` when targeting Android.

Note that I haven't tested this change on Android as I don't have an Android environment for testing.

3 years agoRollup merge of #83353 - m-ou-se:io-error-avoid-alloc, r=nagisa
Dylan DPC [Wed, 24 Mar 2021 00:52:29 +0000 (01:52 +0100)]
Rollup merge of #83353 - m-ou-se:io-error-avoid-alloc, r=nagisa

Add internal io::Error::new_const to avoid allocations.

This makes it possible to have a io::Error containing a message with zero allocations, and uses that everywhere to avoid the *three* allocations involved in `io::Error::new(kind, "message")`.

The function signature isn't perfect, because it needs a reference to the `&str`. So for now, this is just a `pub(crate)` function. Later, we'll be able to use `fn new_const<MSG: &'static str>(kind: ErrorKind)` to make that a bit better. (Then we'll also be able to use some ZST trickery if that would result in more efficient code.)

See https://github.com/rust-lang/rust/issues/83352

3 years agoRollup merge of #83313 - cjgillot:assert, r=michaelwoerister
Dylan DPC [Wed, 24 Mar 2021 00:52:28 +0000 (01:52 +0100)]
Rollup merge of #83313 - cjgillot:assert, r=michaelwoerister

Only enable assert_dep_graph when query-dep-graph is enabled.

This is a debugging option. The only effect should be on rustc tests.

r? ``@michaelwoerister``

3 years agoRollup merge of #83051 - GuillaumeGomez:sidebar-trait-items-order, r=CraftSpider...
Dylan DPC [Wed, 24 Mar 2021 00:52:27 +0000 (01:52 +0100)]
Rollup merge of #83051 - GuillaumeGomez:sidebar-trait-items-order, r=CraftSpider,jyn514

Sidebar trait items order

We were actually sorting `Symbol` and not `String`, creating a completely invalid sort result. I added a test to prevent regressions.

r? ``@jyn514``

3 years agoChanges from review comments
Rich Kadel [Tue, 23 Mar 2021 21:25:52 +0000 (14:25 -0700)]
Changes from review comments

3 years agosmall cleanups in rustc_errors / emitter
Andre Bogus [Tue, 23 Mar 2021 23:09:11 +0000 (00:09 +0100)]
small cleanups in rustc_errors / emitter

3 years agoAdd test for Result::into_err
Linus Färnstrand [Tue, 23 Mar 2021 20:27:38 +0000 (21:27 +0100)]
Add test for Result::into_err

3 years agoAdd Result::into_err where the Ok variant can never happen
Linus Färnstrand [Tue, 23 Mar 2021 20:24:26 +0000 (21:24 +0100)]
Add Result::into_err where the Ok variant can never happen

3 years agoAdd documentation for rustdoc-gui tests
Guillaume Gomez [Tue, 23 Mar 2021 20:15:32 +0000 (21:15 +0100)]
Add documentation for rustdoc-gui tests

3 years agoUpdate to not have extra match
kadmin [Mon, 22 Mar 2021 23:26:07 +0000 (23:26 +0000)]
Update to not have extra match

3 years agoAuto merge of #82994 - camelid:rename-source-to-span, r=jyn514
bors [Tue, 23 Mar 2021 19:06:10 +0000 (19:06 +0000)]
Auto merge of #82994 - camelid:rename-source-to-span, r=jyn514

Rename `source` to `span` and `span` to `source`

- Rename `clean::Item.source` to `span`
- Rename `clean::Span::span()` to `clean::Span::inner()`
- Rename `rustdoc_json_types::Item.source` to `span`
- rustdoc-json: Rename `Import.span` to `Import.source`

*See also the [discussion on Zulip][z] (this is a bit more than discussed in
that conversation, but all the changes are related).*

r? `@jyn514`

[z]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/get.20span.20of.20file.20from.20name/near/229603729

3 years agoRemove another unnecessary `Option`
Camelid [Tue, 23 Mar 2021 18:19:42 +0000 (11:19 -0700)]
Remove another unnecessary `Option`

The previous changes mean that we can now remove this `Option`.

3 years agoRemove unnecessary `Option` wrapping around `Crate.module`
Camelid [Tue, 23 Mar 2021 18:04:09 +0000 (11:04 -0700)]
Remove unnecessary `Option` wrapping around `Crate.module`

I'm wondering if it was originally there so that we could `take` the
module which enables `after_krate` to take an `&Crate`. However, the two
impls of `after_krate` only use `Crate.name`, so we can pass just the
name instead.

3 years agoTweak docs
Camelid [Tue, 23 Mar 2021 17:37:58 +0000 (10:37 -0700)]
Tweak docs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoAdd has_default to GenericParamDefKind::Const
kadmin [Tue, 11 Aug 2020 00:02:45 +0000 (00:02 +0000)]
Add has_default to GenericParamDefKind::Const

This currently creates a field which is always false on GenericParamDefKind for future use when
consts are permitted to have defaults

Update const_generics:default locations

Previously just ignored them, now actually do something about them.

Fix using type check instead of value

Add parsing

This adds all the necessary changes to lower const-generics defaults from parsing.

Change P<Expr> to AnonConst

This matches the arguments passed to instantiations of const generics, and makes it specific to
just anonymous constants.

Attempt to fix lowering bugs

3 years agoUpdate with comments
kadmin [Sat, 20 Mar 2021 22:34:58 +0000 (22:34 +0000)]
Update with comments

3 years agoUpdate with comments
kadmin [Thu, 18 Mar 2021 06:38:11 +0000 (06:38 +0000)]
Update with comments

A bunch of nits fixed, and a new test for pretty printing the AST.

3 years agoAdd query for const_param_default
kadmin [Wed, 3 Mar 2021 06:38:02 +0000 (06:38 +0000)]
Add query for const_param_default

3 years agoUpdate tests
kadmin [Mon, 1 Mar 2021 21:41:49 +0000 (21:41 +0000)]
Update tests

3 years agoprogress, stuff compiles now
lcnr [Mon, 1 Mar 2021 11:50:09 +0000 (12:50 +0100)]
progress, stuff compiles now

3 years agoSome refactoring
varkor [Wed, 30 Dec 2020 15:34:53 +0000 (15:34 +0000)]
Some refactoring

3 years agoAdd has_default to GenericParamDefKind::Const
kadmin [Tue, 11 Aug 2020 00:02:45 +0000 (00:02 +0000)]
Add has_default to GenericParamDefKind::Const

This currently creates a field which is always false on GenericParamDefKind for future use when
consts are permitted to have defaults

Update const_generics:default locations

Previously just ignored them, now actually do something about them.

Fix using type check instead of value

Add parsing

This adds all the necessary changes to lower const-generics defaults from parsing.

Change P<Expr> to AnonConst

This matches the arguments passed to instantiations of const generics, and makes it specific to
just anonymous constants.

Attempt to fix lowering bugs

3 years agoFix comment.
Camille GILLOT [Tue, 23 Mar 2021 11:59:53 +0000 (12:59 +0100)]
Fix comment.

3 years agoUse &str instead of String
Guillaume Gomez [Tue, 23 Mar 2021 16:36:36 +0000 (17:36 +0100)]
Use &str instead of String

3 years agoAuto merge of #6957 - camsteffen:eq-ty-kind, r=flip1995
bors [Tue, 23 Mar 2021 16:25:28 +0000 (16:25 +0000)]
Auto merge of #6957 - camsteffen:eq-ty-kind, r=flip1995

Factor out `SpanlessEq::eq_ty_kind`

changelog: none

3 years agoAdd test to enforce sidebar trait items order
Guillaume Gomez [Fri, 12 Mar 2021 13:25:01 +0000 (14:25 +0100)]
Add test to enforce sidebar trait items order

3 years agoFix sidebar trait items sort
Guillaume Gomez [Fri, 12 Mar 2021 11:19:31 +0000 (12:19 +0100)]
Fix sidebar trait items sort

3 years agoFactor out eq_ty_kind
Cameron Steffen [Tue, 23 Mar 2021 15:40:27 +0000 (10:40 -0500)]
Factor out eq_ty_kind

3 years agoAuto merge of #83177 - erikdesjardins:zstassign, r=oli-obk
bors [Tue, 23 Mar 2021 12:23:27 +0000 (12:23 +0000)]
Auto merge of #83177 - erikdesjardins:zstassign, r=oli-obk

Remove assignments to ZST places instead of marking ZST return place as unused

partially reverts #83118

requested by `@tmiasko` in https://github.com/rust-lang/rust/pull/83118#issuecomment-799692574

r? `@oli-obk`

3 years agoExpose str::SplitInclusive in alloc and therefore in std
Ian Jackson [Tue, 23 Mar 2021 11:57:03 +0000 (11:57 +0000)]
Expose str::SplitInclusive in alloc and therefore in std

This seems to have been omitted from the beginning when this feature
was first introduced in 86bf96291d82.

Most users won't need to name this type which is probably why this
wasn't noticed in the meantime.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoSlight visual improvements to warning boxes in the docs
r00ster91 [Tue, 23 Mar 2021 11:23:45 +0000 (12:23 +0100)]
Slight visual improvements to warning boxes in the docs

3 years agoAuto merge of #83260 - durin42:llvm-update, r=nagisa
bors [Tue, 23 Mar 2021 09:42:22 +0000 (09:42 +0000)]
Auto merge of #83260 - durin42:llvm-update, r=nagisa

rustc: changes to allow an llvm update

This lets LLVM be built using 2b5f3f446f36, which is only a few weeks old. The next change in LLVM (5de2d189e6ad) breaks rustc again by removing a function that's exposed into the Rust code, but I'll file a bug about that separately.

Please scrutinize the `thinLTOResolvePrevailingInIndex` call, as I'm not at all sure an empty config is right.

I'm also suspicious that a specific alignment could be specified in the call to CreateAtomicCmpXchg, but I don't know enough to figure that out.

Thanks!

3 years agoChange def_id filter to use requires_monomorphization()
Rich Kadel [Tue, 23 Mar 2021 07:33:57 +0000 (00:33 -0700)]
Change def_id filter to use requires_monomorphization()

Per @wesleywiser's comment: https://github.com/rust-lang/rust/pull/83307#discussion_r599223342

3 years agoAuto merge of #82271 - Aaron1011:debug-refcell, r=m-ou-se
bors [Tue, 23 Mar 2021 04:49:47 +0000 (04:49 +0000)]
Auto merge of #82271 - Aaron1011:debug-refcell, r=m-ou-se

Add `debug-refcell` feature to libcore

See https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Attaching.20backtraces.20to.20RefCell/near/226273614
for some background discussion

This PR adds a new off-by-default feature `debug-refcell` to libcore.
When enabled, this feature stores additional debugging information in
`RefCell`. This information is included in the panic message when
`borrow()` or `borrow_mut()` panics, to make it easier to track down the
source of the issue.

Currently, we store the caller location for the earliest active borrow.
This has a number of advantages:
* There is only a constant amount of overhead per `RefCell`
* We don't need any heap memory, so it can easily be implemented in core
* Since we are storing the *earliest* active borrow, we don't need any
  extra logic in the `Drop` implementation for `Ref` and `RefMut`

Limitations:
* We only store the caller location, not a full `Backtrace`. Until
  we get support for `Backtrace` in libcore, this is the best tha we can
do.
* The captured location is only displayed when `borrow()` or
  `borrow_mut()` panics. If a crate calls `try_borrow().unwrap()`
  or `try_borrow_mut().unwrap()`, this extra information will be lost.

To make testing easier, I've enabled the `debug-refcell` feature by
default. I'm not sure how to write a test for this feature - we would
need to rebuild core from the test framework, and create a separate
sysroot.

Since this feature will be off-by-default, users will need to use
`xargo` or `cargo -Z build-std` to enable this feature. For users using
a prebuilt standard library, this feature will be disabled with zero
overhead.

I've created a simple test program:

```rust
use std::cell::RefCell;

fn main() {
    let _ = std::panic::catch_unwind(|| {
        let val = RefCell::new(true);
        let _first = val.borrow();
        let _second = val.borrow();
        let _third = val.borrow_mut();
    });

    let _ = std::panic::catch_unwind(|| {
        let val  = RefCell::new(true);
        let first = val.borrow_mut();
        drop(first);

        let _second = val.borrow_mut();

        let _thid = val.borrow();
    });
}
```

which produces the following output:

```
thread 'main' panicked at 'already borrowed: BorrowMutError at refcell_test.rs:6:26', refcell_test.rs:8:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'already mutably borrowed: BorrowError at refcell_test.rs:16:27', refcell_test.rs:18:25
```

3 years agoDon't push the crate name onto the `Cache.stack`
Camelid [Tue, 23 Mar 2021 04:18:06 +0000 (21:18 -0700)]
Don't push the crate name onto the `Cache.stack`

Now that we record the crate's name in its `clean::Item`, pushing the
crate name onto the `stack` causes duplicate paths. E.g., the URL
generated for the path `::foo::bar::baz` would be something like

    ../foo/foo/bar/baz

With this commit, the URL is corrected to

    ../foo/bar/baz

3 years agoAuto merge of #83398 - JohnTitor:rollup-om80krv, r=JohnTitor
bors [Tue, 23 Mar 2021 02:01:14 +0000 (02:01 +0000)]
Auto merge of #83398 - JohnTitor:rollup-om80krv, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #80705 (Update Source Code Pro and include italics)
 - #81917 (Update RELEASES.md for 1.51.0)
 - #82732 (Remove theme.js file)
 - #83356 (rustdoc: Replace pair of `Option`s with an enum)
 - #83384 (rename :pat2018 -> :pat2015)
 - #83385 (:arrow_up: rust-analyzer)
 - #83389 (add rust-analyzer rustc_private option in librustdoc Cargo.toml)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agorustdoc: Record crate name instead of using `None`
Camelid [Tue, 23 Mar 2021 01:18:57 +0000 (18:18 -0700)]
rustdoc: Record crate name instead of using `None`

3 years agoRollup merge of #83389 - njasm:test_rustdoc, r=jyn514
Yuki Okushi [Tue, 23 Mar 2021 01:15:45 +0000 (10:15 +0900)]
Rollup merge of #83389 - njasm:test_rustdoc, r=jyn514

add rust-analyzer rustc_private option in librustdoc Cargo.toml

This addition will allow to have code completion while hacking rustdoc with rust-analyzer.

more info: https://rust-analyzer.github.io/manual.html#rust-analyzer.rustcSource

r? `@jyn514`

3 years agoRollup merge of #83385 - lnicola:rust-analyzer-2021-03-22, r=jonas-schievink
Yuki Okushi [Tue, 23 Mar 2021 01:15:44 +0000 (10:15 +0900)]
Rollup merge of #83385 - lnicola:rust-analyzer-2021-03-22, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #83384 - mark-i-m:rename-pat2018, r=joshtriplett
Yuki Okushi [Tue, 23 Mar 2021 01:15:43 +0000 (10:15 +0900)]
Rollup merge of #83384 - mark-i-m:rename-pat2018, r=joshtriplett

rename :pat2018 -> :pat2015

as requested by T-lang on zulip: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/or.20patterns/near/231133873

No functional changes here... just renaming.

r? `@nikomatsakis`

3 years agoRollup merge of #83356 - camelid:rustdoc-option-to-enum, r=GuillaumeGomez
Yuki Okushi [Tue, 23 Mar 2021 01:15:42 +0000 (10:15 +0900)]
Rollup merge of #83356 - camelid:rustdoc-option-to-enum, r=GuillaumeGomez

rustdoc: Replace pair of `Option`s with an enum

They are never both `None` or both `Some`, so it makes more sense to use
an enum so that we "make impossible states impossible".

3 years agoRollup merge of #82732 - GuillaumeGomez:remove-theme-file, r=Nemo157
Yuki Okushi [Tue, 23 Mar 2021 01:15:40 +0000 (10:15 +0900)]
Rollup merge of #82732 - GuillaumeGomez:remove-theme-file, r=Nemo157

Remove theme.js file

Fixes #82616.

The first commit moves the `theme.js` file into `main.js`, which requires to also run a small `.replace` on the `main.js` content.

The second commit is just a small cleanup to centralize DOM ids.

Since it removes a file from rustdoc output: cc `@rust-lang/docs-rs`

cc `@jsha`
r? `@jyn514`

3 years agoRollup merge of #81917 - rust-lang:relnotes-1.51.0, r=Mark-Simulacrum
Yuki Okushi [Tue, 23 Mar 2021 01:15:39 +0000 (10:15 +0900)]
Rollup merge of #81917 - rust-lang:relnotes-1.51.0, r=Mark-Simulacrum

Update RELEASES.md for 1.51.0

### [Rendered](https://github.com/rust-lang/rust/blob/relnotes-1.51.0/RELEASES.md)

r? `@Mark-Simulacrum`
cc `@rust-lang/release`

3 years agoRollup merge of #80705 - tspiteri:italic-and-update-SourceCodePro, r=GuillaumeGomez
Yuki Okushi [Tue, 23 Mar 2021 01:15:38 +0000 (10:15 +0900)]
Rollup merge of #80705 - tspiteri:italic-and-update-SourceCodePro, r=GuillaumeGomez

Update Source Code Pro and include italics

Fixes #65502.

#65665, a similar PR to this was merged but reverted because of https://github.com/rust-lang/rust/pull/65665#issuecomment-556860510.

The issue in that comment is the upstream issue https://github.com/adobe-fonts/source-code-pro/issues/217 which should now be fixed in the upstream since [2.032R-ro/1.052R-it/1.012R-VAR release](https://github.com/adobe-fonts/source-code-pro/releases/tag/2.032R-ro/1.052R-it/1.012R-VAR), so I think this can now be merged.

A couple of notes from the original PR:
* Since this PR changes the font set, I think docs.rs would have to be updated if this PR is merged.
* The fonts have a double extension (.ttf.woff); this is to keep the names consistent with the upstream font release which does that to distinguish these from the .otf.woff files (Source Code Pro otf renders poorly on older Windows system apps).

3 years agoonly run RemoveZsts at mir-opt-level 3 and above
Erik Desjardins [Mon, 22 Mar 2021 22:30:56 +0000 (18:30 -0400)]
only run RemoveZsts at mir-opt-level 3 and above

3 years agoAdd GUI test to enforce tooltip position
Guillaume Gomez [Mon, 22 Mar 2021 21:17:43 +0000 (22:17 +0100)]
Add GUI test to enforce tooltip position

3 years agoFix codeblock tooltip position
Guillaume Gomez [Mon, 22 Mar 2021 21:17:21 +0000 (22:17 +0100)]
Fix codeblock tooltip position

3 years agoAllow not emitting `uwtable` on Android
hyd-dev [Mon, 22 Mar 2021 18:38:30 +0000 (02:38 +0800)]
Allow not emitting `uwtable` on Android

3 years agoErr if the debugging options are not passed.
Camille GILLOT [Mon, 22 Mar 2021 18:21:55 +0000 (19:21 +0100)]
Err if the debugging options are not passed.

3 years agoAuto merge of #6950 - Sciencentistguy:master, r=phansch
bors [Mon, 22 Mar 2021 20:29:13 +0000 (20:29 +0000)]
Auto merge of #6950 - Sciencentistguy:master, r=phansch

Ignore str::len() in or_fun_call lint.

changelog: Changed `or_fun_call` to ignore `str::len`, in the same way it ignores `slice::len` and `array::len`

Closes #6943

3 years agoFix asm! from AT&T to Intel syntax
Josh Stone [Mon, 22 Mar 2021 20:12:53 +0000 (13:12 -0700)]
Fix asm! from AT&T to Intel syntax

3 years agoChange `-W help` to display edition level.
Eric Huss [Mon, 22 Mar 2021 19:57:52 +0000 (12:57 -0700)]
Change `-W help` to display edition level.

3 years agoAuto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis
bors [Mon, 22 Mar 2021 19:48:27 +0000 (19:48 +0000)]
Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis

Stabilize or_patterns (RFC 2535, 2530, 2175)

closes #54883

This PR stabilizes the or_patterns feature in Rust 1.53.

This is blocked on the following (in order):
- [x] The crater run in https://github.com/rust-lang/rust/pull/78935#issuecomment-731564021
- [x] The resolution of the unresolved questions and a second crater run (https://github.com/rust-lang/rust/pull/78935#issuecomment-735412705)
    - It looks like we will need to pursue some sort of edition-based transition for `:pat`.
- [x] Nomination and discussion by T-lang
- [x] Implement new behavior for `:pat` based on consensus (https://github.com/rust-lang/rust/pull/80100).
- [ ] An FCP on stabilization

EDIT: Stabilization report is in https://github.com/rust-lang/rust/pull/79278#issuecomment-772815177

3 years agoAuto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis
bors [Mon, 22 Mar 2021 19:48:27 +0000 (19:48 +0000)]
Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis

Stabilize or_patterns (RFC 2535, 2530, 2175)

closes #54883

This PR stabilizes the or_patterns feature in Rust 1.53.

This is blocked on the following (in order):
- [x] The crater run in https://github.com/rust-lang/rust/pull/78935#issuecomment-731564021
- [x] The resolution of the unresolved questions and a second crater run (https://github.com/rust-lang/rust/pull/78935#issuecomment-735412705)
    - It looks like we will need to pursue some sort of edition-based transition for `:pat`.
- [x] Nomination and discussion by T-lang
- [x] Implement new behavior for `:pat` based on consensus (https://github.com/rust-lang/rust/pull/80100).
- [ ] An FCP on stabilization

EDIT: Stabilization report is in https://github.com/rust-lang/rust/pull/79278#issuecomment-772815177