]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #79675 - CraftSpider:79669, r=estebank
Yuki Okushi [Fri, 8 Jan 2021 02:11:34 +0000 (11:11 +0900)]
Rollup merge of #79675 - CraftSpider:79669, r=estebank

Make sure rust-call errors occur correctly for traits

Fixes #79669

Adds trait method resolution to the error, and adds UI tests to ensure it doesn't happen again. Opening as draft because I'm getting weird link errors from unrelated code on my machine, and want to see what CI thinks.

3 years agoAuto merge of #80709 - lzutao:target-enumerate, r=petrochenkov
bors [Thu, 7 Jan 2021 21:33:57 +0000 (21:33 +0000)]
Auto merge of #80709 - lzutao:target-enumerate, r=petrochenkov

Limit target endian to an enum instead of free string

This is #77604 revived.

3 years agoAuto merge of #80790 - JohnTitor:rollup-js1noez, r=JohnTitor
bors [Thu, 7 Jan 2021 18:20:12 +0000 (18:20 +0000)]
Auto merge of #80790 - JohnTitor:rollup-js1noez, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #80012 (Add pointing const identifier when emitting E0435)
 - #80521 (MIR Inline is incompatible with coverage)
 - #80659 (Edit rustc_ast::tokenstream docs)
 - #80660 (Properly handle primitive disambiguators in rustdoc)
 - #80738 (Remove bottom margin from crate version when the docs sidebar is collapsed)
 - #80744 (rustdoc: Turn `next_def_id` comments into docs)
 - #80750 (Don't use to_string on Symbol in rustc_passes/check_attr.rs)
 - #80769 (Improve wording of parse doc)
 - #80780 (Return EOF_CHAR constant instead of magic char.)
 - #80784 (rustc_parse: Better spans for synthesized token streams)

Failed merges:

 - #80785 (rustc_ast_pretty: Remove `PrintState::insert_extra_parens`)

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

3 years agoRollup merge of #80784 - petrochenkov:nontspan, r=Aaron1011
Yuki Okushi [Thu, 7 Jan 2021 17:06:20 +0000 (02:06 +0900)]
Rollup merge of #80784 - petrochenkov:nontspan, r=Aaron1011

rustc_parse: Better spans for synthesized token streams

I think using the nonterminal span for synthesizing its tokens is a better approximation than using `DUMMY_SP` or the attribute span like #79472 did in `expand.rs`.

r? `@Aaron1011`

3 years agoRollup merge of #80780 - lianghanzhen:master, r=petrochenkov
Yuki Okushi [Thu, 7 Jan 2021 17:06:18 +0000 (02:06 +0900)]
Rollup merge of #80780 - lianghanzhen:master, r=petrochenkov

Return EOF_CHAR constant instead of magic char.

3 years agoRollup merge of #80769 - ejez:patch-1, r=jonas-schievink
Yuki Okushi [Thu, 7 Jan 2021 17:06:16 +0000 (02:06 +0900)]
Rollup merge of #80769 - ejez:patch-1, r=jonas-schievink

Improve wording of parse doc

Change:
```
`parse` can parse any type that...
```
to:
```
`parse` can parse into any type that...
```
Word `into` added to be more precise and in coherence with other parts of the doc.

3 years agoRollup merge of #80750 - GuillaumeGomez:cleanup-to_string, r=lzutao
Yuki Okushi [Thu, 7 Jan 2021 17:06:14 +0000 (02:06 +0900)]
Rollup merge of #80750 - GuillaumeGomez:cleanup-to_string, r=lzutao

Don't use to_string on Symbol in rustc_passes/check_attr.rs

Improve code from #80686.

r? ``@lzutao``

3 years agoRollup merge of #80744 - camelid:next_def_id-docs, r=jyn514
Yuki Okushi [Thu, 7 Jan 2021 17:06:13 +0000 (02:06 +0900)]
Rollup merge of #80744 - camelid:next_def_id-docs, r=jyn514

rustdoc: Turn `next_def_id` comments into docs

Split out from #80740.

r? ``@jyn514``

3 years agoRollup merge of #80738 - arusahni:master, r=GuillaumeGomez
Yuki Okushi [Thu, 7 Jan 2021 17:06:11 +0000 (02:06 +0900)]
Rollup merge of #80738 - arusahni:master, r=GuillaumeGomez

Remove bottom margin from crate version when the docs sidebar is collapsed

This fixes a mobile UI bug where a vertical scrollbar would always be
rendered on the sidebar nav when the menu was closed.  When opened, the overflow would be handled by the opened sidebar, causing the scrollbar to disappear, and the contents to shift to the right.

## Firefox
**Before**
![before-ff](https://user-images.githubusercontent.com/139487/103713599-c2f74c00-4f8a-11eb-88c0-d5c6c088f8a0.png)
![before](https://user-images.githubusercontent.com/139487/103713793-2bdec400-4f8b-11eb-8223-94b77cc05f71.gif)

**After**
![after-ff](https://user-images.githubusercontent.com/139487/103713605-c8ed2d00-4f8a-11eb-9ee8-f86cafaa8775.png)
![after](https://user-images.githubusercontent.com/139487/103713805-31d4a500-4f8b-11eb-9e5b-4156402ca43e.gif)

## Chrome
**Before**
![localhost_8000_unicode_xid_ (1)](https://user-images.githubusercontent.com/139487/103713626-d60a1c00-4f8a-11eb-8605-cc98e04e9ad0.png)

**After**
![localhost_8000_unicode_xid_](https://user-images.githubusercontent.com/139487/103713622-d1456800-4f8a-11eb-8c66-7d19f81614ca.png)

3 years agoRollup merge of #80660 - max-heller:issue-80559-fix, r=jyn514
Yuki Okushi [Thu, 7 Jan 2021 17:06:09 +0000 (02:06 +0900)]
Rollup merge of #80660 - max-heller:issue-80559-fix, r=jyn514

Properly handle primitive disambiguators in rustdoc

Fixes #80559

r? ``@jyn514``

Is there a way to test that the generated intra-doc link is what I expect?

3 years agoRollup merge of #80659 - pierwill:edit-tokenstream, r=davidtwco
Yuki Okushi [Thu, 7 Jan 2021 17:06:07 +0000 (02:06 +0900)]
Rollup merge of #80659 - pierwill:edit-tokenstream, r=davidtwco

Edit rustc_ast::tokenstream docs

Fix some punctuation and wording, and add intra-documentation links.

3 years agoRollup merge of #80521 - richkadel:llvm-coverage-counters-2.4.0, r=wesleywiser
Yuki Okushi [Thu, 7 Jan 2021 17:06:03 +0000 (02:06 +0900)]
Rollup merge of #80521 - richkadel:llvm-coverage-counters-2.4.0, r=wesleywiser

MIR Inline is incompatible with coverage

Fixes: #80060
Fixed by disabling inlining if `-Zinstrument-coverage` is set.

The PR also adds additional use cases to the coverage test for doctests.

r? `@wesleywiser`
cc: `@tmandry`

3 years agoRollup merge of #80012 - sasurau4:feature/point-constant-identifier-E0435, r=petrochenkov
Yuki Okushi [Thu, 7 Jan 2021 17:05:58 +0000 (02:05 +0900)]
Rollup merge of #80012 - sasurau4:feature/point-constant-identifier-E0435, r=petrochenkov

Add pointing const identifier when emitting E0435

Fix #79919

3 years agoAuto merge of #77853 - ijackson:slice-strip-stab, r=Amanieu
bors [Thu, 7 Jan 2021 15:21:30 +0000 (15:21 +0000)]
Auto merge of #77853 - ijackson:slice-strip-stab, r=Amanieu

Stabilize slice::strip_prefix and slice::strip_suffix

These two methods are useful.  The corresponding methods on `str` are already stable.

I believe that stablising these now would not get in the way of, in the future, extending these to take a richer pattern API a la `str`'s patterns.

Tracking PR: #73413.  I also have an outstanding PR to improve the docs for these two functions and the corresponding ones on `str`: #75078

I have tried to follow the [instructions in the dev guide](https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr).  The part to do with `compiler/rustc_feature` did not seem applicable.  I assume that's because these are just library features, so there is no corresponding machinery in rustc.

3 years agorustc_parse: Better spans for synthesized token streams
Vadim Petrochenkov [Thu, 7 Jan 2021 13:43:22 +0000 (16:43 +0300)]
rustc_parse: Better spans for synthesized token streams

3 years agoReturn EOF_CHAR constant instead of magic char.
Hanzhen Liang [Thu, 7 Jan 2021 12:20:04 +0000 (13:20 +0100)]
Return EOF_CHAR constant instead of magic char.

3 years agoAuto merge of #79863 - JohnTitor:compiler-builtins, r=bjorn3
bors [Thu, 7 Jan 2021 11:22:42 +0000 (11:22 +0000)]
Auto merge of #79863 - JohnTitor:compiler-builtins, r=bjorn3

Update `compiler_builtins` to 0.1.39

This version contains the fixes of https://github.com/rust-lang/compiler-builtins/issues/390 and https://github.com/rust-lang/compiler-builtins/issues/391.
Also, rename features following https://github.com/rust-lang/compiler-builtins/pull/386.

3 years agoRefine E0435 description
Daiki Ihara [Sat, 26 Dec 2020 12:15:51 +0000 (21:15 +0900)]
Refine E0435 description

3 years agobless tests
Daiki Ihara [Sun, 13 Dec 2020 15:40:59 +0000 (00:40 +0900)]
bless tests

3 years agoAdd pointing const identifier when emitting E0435
Daiki Ihara [Sun, 13 Dec 2020 15:32:59 +0000 (00:32 +0900)]
Add pointing const identifier when emitting E0435

3 years agoAuto merge of #80648 - Aaron1011:expn-data-private, r=petrochenkov
bors [Thu, 7 Jan 2021 08:25:39 +0000 (08:25 +0000)]
Auto merge of #80648 - Aaron1011:expn-data-private, r=petrochenkov

Make `ExpnData` fields `krate` and `orig_id` private

These fields are only used by hygiene serialized, and should not be
accessed by anything outside of `rustc_span`.

3 years agoUpdate `compiler_builtins` to 0.1.39
Yuki Okushi [Wed, 9 Dec 2020 19:48:08 +0000 (04:48 +0900)]
Update `compiler_builtins` to 0.1.39

3 years agoImprove wording of parse doc
Ejez [Thu, 7 Jan 2021 04:47:03 +0000 (07:47 +0300)]
Improve wording of parse doc

Change:
```
`parse` can parse any type that...
```
to:
```
`parse` can parse into any type that...
```
Word `into` added to be more precise and in coherence with other parts of the doc.

3 years agoAuto merge of #80200 - mahkoh:dst-offset, r=nagisa
bors [Thu, 7 Jan 2021 03:13:21 +0000 (03:13 +0000)]
Auto merge of #80200 - mahkoh:dst-offset, r=nagisa

Optimize DST field access

For

    struct X<T: ?Sized>(T)
    struct Y<T: ?Sized>(u8, T)

the offset of the unsized field is

    0
    mem::align_of_val(&self.1)

respectively. This patch changes the expression used to compute these
offsets so that the optimizer can perform this optimization.

Consider

```rust
fn f(x: &X<dyn Any>) -> &dyn Any {
    &x.0
}
```

Before:

```asm
test:
movq %rsi, %rdx
movq 16(%rsi), %rax
leaq -1(%rax), %rcx
negq %rax
andq %rcx, %rax
addq %rdi, %rax
retq
```

After:

```asm
test:
movq %rsi, %rdx
movq %rdi, %rax
retq
```

3 years agoAuto merge of #80425 - camelid:resolve-moduledata-docs, r=petrochenkov
bors [Thu, 7 Jan 2021 00:31:09 +0000 (00:31 +0000)]
Auto merge of #80425 - camelid:resolve-moduledata-docs, r=petrochenkov

Document `ModuleData` and improve names

- Document `ModuleData`
- Rename `ModuleData.normal_ancestor_id` to `nearest_parent_mod`
- Rename `Resolver::nearest_mod_parent` to `nearest_parent_mod`

cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/mentoring/near/221029702

r? `@petrochenkov`

3 years agoAuto merge of #80754 - sunfishcode:path-cleanup/rustc-fs-util, r=davidtwco
bors [Wed, 6 Jan 2021 21:48:06 +0000 (21:48 +0000)]
Auto merge of #80754 - sunfishcode:path-cleanup/rustc-fs-util, r=davidtwco

Optimize away a `fs::metadata` call.

This also eliminates a use of a `Path` convenience function, in support
of #80741, refactoring `std::path` to focus on pure data structures and
algorithms.

3 years agoRename to `nearest_parent_mod`
Camelid [Mon, 28 Dec 2020 00:54:47 +0000 (16:54 -0800)]
Rename to `nearest_parent_mod`

* Rename `ModuleData.normal_ancestor_id` to `nearest_parent_mod`

`normal_ancestor_id` is a very confusing name if you don't already
understand what it means. Adding docs helps, but using a clearer and
more obvious name is also important.

* Rename `Resolver::nearest_mod_parent` to `nearest_parent_mod`

* Add more docs

3 years agoDocument `ModuleData`
Camelid [Mon, 28 Dec 2020 00:53:57 +0000 (16:53 -0800)]
Document `ModuleData`

* Convert comments on fields to doc comments so they're visible in API
  docs
* Add new documentation
* Get rid of "normal module" terminology

3 years agoAuto merge of #80758 - RalfJung:miri, r=RalfJung
bors [Wed, 6 Jan 2021 18:56:48 +0000 (18:56 +0000)]
Auto merge of #80758 - RalfJung:miri, r=RalfJung

update Miri

update Miri to include fix for https://github.com/rust-lang/miri/issues/1643
Cc `@rust-lang/miri` r? `@ghost`

3 years agoupdate Miri
Ralf Jung [Wed, 6 Jan 2021 17:29:04 +0000 (18:29 +0100)]
update Miri

3 years agoOptimize away a `fs::metadata` call.
Dan Gohman [Wed, 6 Jan 2021 16:20:58 +0000 (08:20 -0800)]
Optimize away a `fs::metadata` call.

This also eliminates a use of a `Path` convenience function, in support
of #80741, refactoring `std::path` to focus on pure data structures and
algorithms.

3 years agoChange related spec files to use the new enum
Lzu Tao [Tue, 5 Jan 2021 01:13:27 +0000 (01:13 +0000)]
Change related spec files to use the new enum

3 years agoPrefer enum Endian in rustc_target::Target
Lzu Tao [Tue, 5 Jan 2021 01:01:29 +0000 (01:01 +0000)]
Prefer enum Endian in rustc_target::Target

3 years agoAuto merge of #80714 - jakevossen5:master, r=lcnr
bors [Wed, 6 Jan 2021 10:25:18 +0000 (10:25 +0000)]
Auto merge of #80714 - jakevossen5:master, r=lcnr

fixed const_generics error help

Closes https://github.com/rust-lang/rust/issues/80702

3 years agoDon't use to_string on Symbol
Guillaume Gomez [Wed, 6 Jan 2021 09:59:50 +0000 (10:59 +0100)]
Don't use to_string on Symbol

3 years agoAuto merge of #80724 - GuillaumeGomez:remove-useless-doc_alias-feature, r=jyn514
bors [Wed, 6 Jan 2021 05:41:42 +0000 (05:41 +0000)]
Auto merge of #80724 - GuillaumeGomez:remove-useless-doc_alias-feature, r=jyn514

Remove useless doc_alias feature gate

As `@jyn514`  rightfully noted in https://github.com/rust-lang/rust/pull/80686 , this feature is no more. Therefore, cleanup time!

r? `@jyn514`

3 years agoApply suggestions from code review
Camelid [Wed, 6 Jan 2021 03:46:51 +0000 (19:46 -0800)]
Apply suggestions from code review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agorustdoc: Turn `next_def_id` comments into docs
Camelid [Wed, 6 Jan 2021 00:32:50 +0000 (16:32 -0800)]
rustdoc: Turn `next_def_id` comments into docs

3 years agoAuto merge of #80415 - cjgillot:issue-77828, r=petrochenkov
bors [Wed, 6 Jan 2021 00:36:14 +0000 (00:36 +0000)]
Auto merge of #80415 - cjgillot:issue-77828, r=petrochenkov

Compute parent module when collecting hir::MacroDef.

Fixes #77828.

r? `@jyn514`

3 years agoRemove bottom margin from crate version when the sidebar is collapsed.
Aru Sahni [Tue, 5 Jan 2021 23:53:23 +0000 (18:53 -0500)]
Remove bottom margin from crate version when the sidebar is collapsed.

This fixes a mobile UI bug where a vertical scrollbar would always be
rendered on the sidebar nav when the menu was closed.

3 years agoDocument hackiness around primitive associated item disambiguators
max-heller [Tue, 5 Jan 2021 20:15:25 +0000 (15:15 -0500)]
Document hackiness around primitive associated item disambiguators

3 years agoDo not swallow parent for MacroDef.
Camille GILLOT [Tue, 29 Dec 2020 20:43:17 +0000 (21:43 +0100)]
Do not swallow parent for MacroDef.

3 years agoAdd rustdoc test.
Camille GILLOT [Mon, 28 Dec 2020 21:01:05 +0000 (22:01 +0100)]
Add rustdoc test.

3 years agoCompute parent module when collecting hir::MacroDef.
Camille GILLOT [Sun, 27 Dec 2020 16:57:17 +0000 (17:57 +0100)]
Compute parent module when collecting hir::MacroDef.

3 years agoAuto merge of #80711 - camelid:intrinsic-of-val-safety, r=oli-obk
bors [Tue, 5 Jan 2021 17:07:25 +0000 (17:07 +0000)]
Auto merge of #80711 - camelid:intrinsic-of-val-safety, r=oli-obk

Make `size_of_val` and `min_align_of_val` intrinsics unsafe

Fixes #80668.

r? `@oli-obk`

3 years agoRemove useless doc_alias feature
Guillaume Gomez [Tue, 5 Jan 2021 15:20:46 +0000 (16:20 +0100)]
Remove useless doc_alias feature

3 years agoAuto merge of #80717 - mbartlett21:patch-2, r=dtolnay
bors [Tue, 5 Jan 2021 14:15:49 +0000 (14:15 +0000)]
Auto merge of #80717 - mbartlett21:patch-2, r=dtolnay

Add more code spans to docs in intrinsics.rs

I have added some more code spans in core/src/intrinsics.rs, changing some `=` to `==`, etc. I also changed the wording in some sections.

3 years agoAuto merge of #80699 - usbalbin:const_copy_tracking_issue, r=oli-obk
bors [Tue, 5 Jan 2021 11:29:27 +0000 (11:29 +0000)]
Auto merge of #80699 - usbalbin:const_copy_tracking_issue, r=oli-obk

const_intrinsic_copy - Add Reference to tracking issue

Add reference to tracking issue #80697 for feature gate added in previous PR #79684

3 years agoAuto merge of #80686 - GuillaumeGomez:error-doc-alias-same-name, r=jyn514
bors [Tue, 5 Jan 2021 08:47:46 +0000 (08:47 +0000)]
Auto merge of #80686 - GuillaumeGomez:error-doc-alias-same-name, r=jyn514

Error when #[doc(alias)] has same name as the item

Something I came across when reviewing some doc alias PRs.

r? `@jyn514`

3 years agoAdd code spans to docs in intrinsics.rs
mbartlett21 [Tue, 5 Jan 2021 07:27:10 +0000 (17:27 +1000)]
Add code spans to docs in intrinsics.rs

3 years agofixed feature gate stderr
Jake Vossen [Tue, 5 Jan 2021 07:02:39 +0000 (00:02 -0700)]
fixed feature gate stderr

3 years agofixed const_generics error help
Jake Vossen [Tue, 5 Jan 2021 05:35:44 +0000 (22:35 -0700)]
fixed const_generics error help

3 years agoMake `size_of_val` and `min_align_of_val` intrinsics unsafe
Camelid [Tue, 5 Jan 2021 02:34:31 +0000 (18:34 -0800)]
Make `size_of_val` and `min_align_of_val` intrinsics unsafe

3 years agoAuto merge of #80708 - JohnTitor:rollup-6esk027, r=JohnTitor
bors [Tue, 5 Jan 2021 03:06:32 +0000 (03:06 +0000)]
Auto merge of #80708 - JohnTitor:rollup-6esk027, r=JohnTitor

Rollup of 12 pull requests

Successful merges:

 - #80442 (Mention Arc::make_mut and Rc::make_mut in the documentation of Cow)
 - #80533 (bootstrap: clippy fixes)
 - #80538 (Add check for `[T;N]`/`usize` mismatch in astconv)
 - #80612 (Remove reverted change from relnotes)
 - #80627 (Builder: Warn if test file does not exist)
 - #80637 (Use Option::filter instead of open-coding it)
 - #80643 (Move variable into the only branch where it is relevant)
 - #80656 (Fixed documentation error for `std::hint::spin_loop`)
 - #80666 (Fix missing link for "fully qualified syntax")
 - #80672 (./x.py clippy: allow the most noisy lints)
 - #80677 (doc -- list edit for consistency)
 - #80696 (make sure that promoteds which fail to evaluate in dead const code behave correctly)

Failed merges:

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

3 years agoRollup merge of #80696 - RalfJung:failing-promoteds, r=oli-obk
Yuki Okushi [Tue, 5 Jan 2021 00:52:52 +0000 (09:52 +0900)]
Rollup merge of #80696 - RalfJung:failing-promoteds, r=oli-obk

make sure that promoteds which fail to evaluate in dead const code behave correctly

https://github.com/rust-lang/rust/pull/80243 showed that we'll have to live with these kinds of failing promoteds for a while, so let's make sure we have a test that covers them.

3 years agoRollup merge of #80677 - kw-fn:patch-2, r=jyn514
Yuki Okushi [Tue, 5 Jan 2021 00:52:50 +0000 (09:52 +0900)]
Rollup merge of #80677 - kw-fn:patch-2, r=jyn514

doc -- list edit for consistency

3 years agoRollup merge of #80672 - matthiaskrgr:xpy_clippy_less_noise, r=Mark-Simulacrum
Yuki Okushi [Tue, 5 Jan 2021 00:52:49 +0000 (09:52 +0900)]
Rollup merge of #80672 - matthiaskrgr:xpy_clippy_less_noise, r=Mark-Simulacrum

./x.py clippy: allow the most noisy lints

This silences the following clippy lints in ./x.py clippy:

many_single_char_names (there are a lot of warnings caused by stdarch)
collapsible_if (can reduce readability)
type_complexity
missing_safety_doc (there are almost 3K warnings issued)
too_many_arguments
needless_lifetimes (people want 'tcx lifetimes etc)
wrong_self_convention (warns about from_..(), to_..(), into_..().. fns that do or do not take self by reference.

Just for clarification; this only changes the output of `x.py clippy` inside the rustc repo and does not change anything about clippy or how `cargo clippy` is run on peoples crates.

3 years agoRollup merge of #80666 - jjlin:master, r=Dylan-DPC
Yuki Okushi [Tue, 5 Jan 2021 00:52:47 +0000 (09:52 +0900)]
Rollup merge of #80666 - jjlin:master, r=Dylan-DPC

Fix missing link for "fully qualified syntax"

This issue can currently be seen at https://doc.rust-lang.org/stable/std/rc/index.html#toggle-all-docs:~:text=%5B-,fully%20qualified%20syntax

It originates from #76138, where the link was added to `library/alloc/src/sync.rs`, but not `library/alloc/src/rc.rs`.

3 years agoRollup merge of #80656 - booleancoercion:master, r=sfackler
Yuki Okushi [Tue, 5 Jan 2021 00:52:45 +0000 (09:52 +0900)]
Rollup merge of #80656 - booleancoercion:master, r=sfackler

Fixed documentation error for `std::hint::spin_loop`

Fixes #80644.

3 years agoRollup merge of #80643 - LingMan:unwrap, r=oli-obk
Yuki Okushi [Tue, 5 Jan 2021 00:52:44 +0000 (09:52 +0900)]
Rollup merge of #80643 - LingMan:unwrap, r=oli-obk

Move variable into the only branch where it is relevant

At the `if` branch `filter` (the `let` binding) is `None` iff `filter` (the parameter) was `None`.
We can branch on the parameter, move the binding into the `if`, and the complexity of handling
`Option<Option<_>` largely dissolves.

`@rustbot` modify labels +C-cleanup +T-compiler

Note: I have no idea how hot this code is. If this method frequently gets called with a `None` filter, there might be a small perf improvement.

3 years agoRollup merge of #80637 - LingMan:filter, r=oli-obk
Yuki Okushi [Tue, 5 Jan 2021 00:52:42 +0000 (09:52 +0900)]
Rollup merge of #80637 - LingMan:filter, r=oli-obk

Use Option::filter instead of open-coding it

`@rustbot` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #80627 - bugadani:warn, r=Mark-Simulacrum
Yuki Okushi [Tue, 5 Jan 2021 00:52:40 +0000 (09:52 +0900)]
Rollup merge of #80627 - bugadani:warn, r=Mark-Simulacrum

Builder: Warn if test file does not exist

Running `./x.py test` with a file that does not exists (but where the path belongs to a test suite) silently ignores the missing file and runs the whole test suite. This PR prints a warning to reduce the potential surprise factor.

Closes #80621

3 years agoRollup merge of #80612 - rust-lang:XAMPPRocky-patch-1, r=Mark-Simulacrum
Yuki Okushi [Tue, 5 Jan 2021 00:52:38 +0000 (09:52 +0900)]
Rollup merge of #80612 - rust-lang:XAMPPRocky-patch-1, r=Mark-Simulacrum

Remove reverted change from relnotes

r? `@Mark-Simulacrum`

3 years agoRollup merge of #80538 - JulianKnodt:err_usize, r=lcnr
Yuki Okushi [Tue, 5 Jan 2021 00:52:37 +0000 (09:52 +0900)]
Rollup merge of #80538 - JulianKnodt:err_usize, r=lcnr

Add check for `[T;N]`/`usize` mismatch in astconv

Helps clarify the issue in #80506
by adding a specific check for mismatches between [T;N] and usize.

r? `@lcnr`

3 years agoRollup merge of #80533 - matthiaskrgr:bootstrap_clppy, r=Mark-Simulacrum
Yuki Okushi [Tue, 5 Jan 2021 00:52:35 +0000 (09:52 +0900)]
Rollup merge of #80533 - matthiaskrgr:bootstrap_clppy, r=Mark-Simulacrum

bootstrap: clippy fixes

addresses:

clippy::or_fun_call
clippy::single_char_add_str
clippy::comparison_to_empty
clippy::or_fun_call

3 years agoRollup merge of #80442 - steffahn:mention_arc_in_cow, r=Mark-Simulacrum
Yuki Okushi [Tue, 5 Jan 2021 00:52:33 +0000 (09:52 +0900)]
Rollup merge of #80442 - steffahn:mention_arc_in_cow, r=Mark-Simulacrum

Mention Arc::make_mut and Rc::make_mut in the documentation of Cow

Following this discussion: https://users.rust-lang.org/t/should-the-cow-documentation-mention-arc/53341

_Rendered (the last paragraph is new):_

![Screenshot_20201228_171551](https://user-images.githubusercontent.com/3986214/103228135-5d72e200-4930-11eb-89e1-38b5c86b08c7.png)

`@rustbot` modify labels: T-doc, T-libs

3 years agoAuto merge of #80426 - jyn514:bootstrap-caching, r=Mark-Simulacrum
bors [Tue, 5 Jan 2021 00:20:18 +0000 (00:20 +0000)]
Auto merge of #80426 - jyn514:bootstrap-caching, r=Mark-Simulacrum

Don't use `self.date` unconditionally for `program_out_of_date()`

This avoids unnecessary cache invalidations for programs not affected by
the stage0 version (which is everything except the stage0 compiler
itself).

The redundant invalidations weren't noticed until now because they only
showed up on stage0 bumps, at which point people are used to rebuilding
everything anyway. I noticed it in https://github.com/rust-lang/rust/pull/79540
because I wasn't adding `self.date` to the stamp file (because I didn't realize it was necessary). Rather than
adding self.date I thought it was better to remove it from the cache key.

3 years agoAuto merge of #80624 - RalfJung:place-ref, r=oli-obk
bors [Mon, 4 Jan 2021 20:56:34 +0000 (20:56 +0000)]
Auto merge of #80624 - RalfJung:place-ref, r=oli-obk

use PlaceRef more consistently instead of loosely coupled local+projection

Instead of working directly with the `projections` array, use `iter_projections` and `last_projection`. This avoids having to construct new `PlaceRef` from the pieces everywhere.

I only did this for a few files, to see how people think about this. If y'all are happy with this, I'll open an E-mentor issue to complete this. I grepped for `Place::ty_from` to find the places that need adjusting -- this could miss some, but I am not sure what else to grep for.

3 years agofix incompatible disambiguator test
max-heller [Mon, 4 Jan 2021 20:38:30 +0000 (15:38 -0500)]
fix incompatible disambiguator test

3 years agoInlining enabled by -mir-opt-level > 1 is incompatible with coverage
Rich Kadel [Sat, 2 Jan 2021 17:40:15 +0000 (09:40 -0800)]
Inlining enabled by -mir-opt-level > 1 is incompatible with coverage

Fixes: #80060
Also adds additional test cases for coverage of doctests.

3 years agomake sure that promoteds which fail to evaluate in dead const code behave correctly
Ralf Jung [Mon, 4 Jan 2021 16:15:57 +0000 (17:15 +0100)]
make sure that promoteds which fail to evaluate in dead const code behave correctly

3 years agoAdded reference to tracking issue and removed unneeded line
Albin Hedman [Mon, 4 Jan 2021 18:36:25 +0000 (19:36 +0100)]
Added reference to tracking issue and removed unneeded line

3 years agoAuto merge of #80688 - ehuss:update-mdbook, r=pietroalbini
bors [Mon, 4 Jan 2021 16:11:47 +0000 (16:11 +0000)]
Auto merge of #80688 - ehuss:update-mdbook, r=pietroalbini

[security] Update mdbook

Changelog from 0.4.3 to 0.4.5: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-045

3 years agoAdd tests for new doc alias check
Guillaume Gomez [Mon, 4 Jan 2021 14:05:49 +0000 (15:05 +0100)]
Add tests for new doc alias check

3 years agoUpdate mdbook
Eric Huss [Mon, 4 Jan 2021 15:18:37 +0000 (07:18 -0800)]
Update mdbook

3 years agoBuilder: Warn if test file does not exist
Dániel Buga [Mon, 4 Jan 2021 15:09:59 +0000 (16:09 +0100)]
Builder: Warn if test file does not exist

3 years agoAdd an error in case the doc alias is the same as the item it's aliasing
Guillaume Gomez [Mon, 4 Jan 2021 14:05:36 +0000 (15:05 +0100)]
Add an error in case the doc alias is the same as the item it's aliasing

3 years agoAuto merge of #80651 - GroteGnoom:issue-78123-fix, r=Nadrieril
bors [Mon, 4 Jan 2021 13:23:08 +0000 (13:23 +0000)]
Auto merge of #80651 - GroteGnoom:issue-78123-fix, r=Nadrieril

Add note to non-exhaustive match on reference to empty

Rust prints "type `&A` is non-empty" even is A is empty.
This is the intended behavior, but can be confusing.
This commit adds a note to non-exhaustive pattern errors if they are a
reference to something uninhabited.

I did not add tests to check that the note is not shown for
non-references or inhabited references, because this is already done
in other tests.

Maybe the added test is superfluous, because
`always-inhabited-union-ref` already checks for this case.

This does not handle &&Void or &&&void etc. I could add those as special
cases as well and ignore people who need quadruple
references.

Fixes #78123

3 years agoAuto merge of #80661 - jyn514:duplicate-types, r=GuillaumeGomez
bors [Mon, 4 Jan 2021 10:32:28 +0000 (10:32 +0000)]
Auto merge of #80661 - jyn514:duplicate-types, r=GuillaumeGomez

Cleanup rustdoc handling of associated types

This is best reviewed a commit at a time. No particular reason for these changes, they just stood out as I was reviewing https://github.com/rust-lang/rust/pull/80653 and thinking about https://github.com/rust-lang/rust/issues/80379. The new test case worked before, it just wasn't tested.

r? `@GuillaumeGomez`

3 years agoAdd check for array/usize mismatch in astconv
kadmin [Wed, 30 Dec 2020 23:07:41 +0000 (23:07 +0000)]
Add check for array/usize mismatch in astconv

3 years agoAuto merge of #80610 - Aaron1011:unhash-def-path-hash, r=varkor
bors [Mon, 4 Jan 2021 07:49:01 +0000 (07:49 +0000)]
Auto merge of #80610 - Aaron1011:unhash-def-path-hash, r=varkor

Use `UnhashMap` whenever we have a key of `DefPathHash`

3 years agoAuto merge of #80554 - GuillaumeGomez:more-js-cleanup, r=jyn514
bors [Mon, 4 Jan 2021 05:04:04 +0000 (05:04 +0000)]
Auto merge of #80554 - GuillaumeGomez:more-js-cleanup, r=jyn514

More js cleanup

Part of #79052 (Same kind as #80515).

This one is about some small fixes:
 * Replacing some loops with `onEachLazy`.
 * Removing unused function arguments.
 * Turn `buildHelperPopup` into a variable so it can be "replaced" once the function has been called once so it's not called again.

r? `@jyn514`

3 years agodoc -- list edit for consistency
oliver [Mon, 4 Jan 2021 04:50:24 +0000 (04:50 +0000)]
doc -- list edit for consistency

3 years agohalf working
max-heller [Mon, 4 Jan 2021 02:55:53 +0000 (21:55 -0500)]
half working

3 years agoAuto merge of #80418 - oli-obk:this_could_have_been_so_simple, r=RalfJung
bors [Mon, 4 Jan 2021 02:15:57 +0000 (02:15 +0000)]
Auto merge of #80418 - oli-obk:this_could_have_been_so_simple, r=RalfJung

Allow references to interior mutable data behind a feature gate

supercedes #80373 by simply not checking for interior mutability on borrows of locals that have `StorageDead` and thus can never be leaked to the final value of the constant

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

r? `@RalfJung`

3 years agostill verify disambiguators for primitives
max-heller [Mon, 4 Jan 2021 01:35:18 +0000 (20:35 -0500)]
still verify disambiguators for primitives

3 years agoprimitive disambiguator tests
max-heller [Mon, 4 Jan 2021 01:34:07 +0000 (20:34 -0500)]
primitive disambiguator tests

3 years agofix issue 80559
max-heller [Sun, 3 Jan 2021 20:34:06 +0000 (15:34 -0500)]
fix issue 80559

3 years ago./x.py clippy: allow the most noisy lints
Matthias Krüger [Mon, 4 Jan 2021 01:20:42 +0000 (02:20 +0100)]
./x.py clippy: allow the most noisy lints

This silences the following clippy lints in ./x.py clippy:

many_single_char_names (there are a lot of warnings caused by stdarch)
collapsible_if (can reduce readability)
type_complexity
missing_safety_doc (there are almost 3K warnings issued)
too_many_arguments
needless_lifetimes (people want 'tcx lifetimes etc)
wrong_self_convention (warns about from_..(), to_..(), into_..().. fns that do or do not take self by reference.

3 years agoFix missing link for "fully qualified syntax"
Jeremy Lin [Sun, 3 Jan 2021 21:59:02 +0000 (13:59 -0800)]
Fix missing link for "fully qualified syntax"

3 years agoDon't clone `type_` unnecessarily
Joshua Nelson [Sun, 3 Jan 2021 21:08:21 +0000 (16:08 -0500)]
Don't clone `type_` unnecessarily

3 years agoSimplify rustdoc handling of type aliases for associated types
Joshua Nelson [Sun, 3 Jan 2021 20:38:46 +0000 (15:38 -0500)]
Simplify rustdoc handling of type aliases for associated types

The logic was very hard to follow before.

3 years agoAuto merge of #77859 - bugadani:no-duplicate-ref-link-error, r=jyn514
bors [Sun, 3 Jan 2021 20:24:16 +0000 (20:24 +0000)]
Auto merge of #77859 - bugadani:no-duplicate-ref-link-error, r=jyn514

Rustdoc: only report broken ref-style links once

This PR assigns the markdown `LinkType` to each parsed link and passes this information into the link collector.
If a link can't be resolved in `resolve_with_disambiguator`, the failure is cached for the link types where we only want to report the error once (namely `Shortcut` and `Reference`).

Fixes  #77681

3 years agoAdd notes to stderr of non-exhaustive-reference test
Daniel Noom [Sun, 3 Jan 2021 20:12:27 +0000 (21:12 +0100)]
Add notes to stderr of non-exhaustive-reference test

3 years agoEdit rustc_ast::tokenstream docs
pierwill [Sun, 3 Jan 2021 19:54:56 +0000 (11:54 -0800)]
Edit rustc_ast::tokenstream docs

Fix some punctuation and wording, and add intra-documentation links.

3 years agoAdd note on void reference test
Daniel Noom [Sun, 3 Jan 2021 19:49:35 +0000 (20:49 +0100)]
Add note on void reference test

This test is also changed by adding a note about uninhabited references
still counting as inhabited.

3 years agoAdd note to non-exhaustive match on reference to empty
Daniel Noom [Sun, 3 Jan 2021 13:13:33 +0000 (14:13 +0100)]
Add note to non-exhaustive match on reference to empty

Rust prints "type `&A` is non-empty" even is A is empty.
This is the intended behavior, but can be confusing.
This commit adds a note to non-exhaustive pattern errors if they are a
reference to something uninhabited.

I did not add tests to check that the note is not shown for
non-references or inhabited references, because this is already done
in other tests.

Maybe the added test is superfluous, because
`always-inhabited-union-ref` already checks for this case.

This does not handle &&Void or &&&void etc. I could add those as special
cases as well and ignore people who need quadruple
references.

Fixes #78123

3 years agoFixed documentation error
bool [Sun, 3 Jan 2021 17:54:54 +0000 (19:54 +0200)]
Fixed documentation error

3 years agoAuto merge of #80655 - GuillaumeGomez:rollup-ai7soid, r=GuillaumeGomez
bors [Sun, 3 Jan 2021 17:42:27 +0000 (17:42 +0000)]
Auto merge of #80655 - GuillaumeGomez:rollup-ai7soid, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #80580 (Add suggestion for "ignore" doc code block)
 - #80591 (remove allow(incomplete_features) from std)
 - #80617 (Detect invalid rustdoc test commands)
 - #80628 (reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats))
 - #80646 (Clean up in `each_child_of_item`)

Failed merges:

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

3 years agoOnly report reference-style link errors once
Dániel Buga [Mon, 12 Oct 2020 14:52:20 +0000 (16:52 +0200)]
Only report reference-style link errors once

Co-authored-by: Joshua Nelson <joshua@yottadb.com>