]> git.lizzy.rs Git - rust.git/log
rust.git
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 #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 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 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 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 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 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 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 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 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 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>
3 years agoRollup merge of #80646 - bugadani:meta, r=petrochenkov
Guillaume Gomez [Sun, 3 Jan 2021 16:09:13 +0000 (17:09 +0100)]
Rollup merge of #80646 - bugadani:meta, r=petrochenkov

Clean up in `each_child_of_item`

This PR hopes to eliminate some of the surprising elements I encountered while reading the function.
- `macros_only` is checked against inside the loop body, but if it is `true`, the loop is skipped anyway
- only query `span` when relevant
- no need to allocate attribute vector

3 years agoRollup merge of #80628 - matthiaskrgr:match_ref_pats, r=varkor
Guillaume Gomez [Sun, 3 Jan 2021 16:09:11 +0000 (17:09 +0100)]
Rollup merge of #80628 - matthiaskrgr:match_ref_pats, r=varkor

reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats)

3 years agoRollup merge of #80617 - GuillaumeGomez:detect-invalid-rustdoc-test-commands, r=jyn514
Guillaume Gomez [Sun, 3 Jan 2021 16:09:09 +0000 (17:09 +0100)]
Rollup merge of #80617 - GuillaumeGomez:detect-invalid-rustdoc-test-commands, r=jyn514

Detect invalid rustdoc test commands

Fixes #80570.

There are now errors displayed in case of bad command syntax:

```
---- [rustdoc] rustdoc/remove-url-from-headings.rs stdout ----

error: htmldocck failed!
status: exit code: 1
command: "/usr/bin/python" "/home/imperio/rust/rust/src/etc/htmldocck.py" "/home/imperio/rust/rust/build/x86_64-unknown-linux-gnu/test/rustdoc/remove-url-from-headings" "/home/imperio/rust/rust/src/test/rustdoc/remove-url-from-headings.rs"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
3: Invalid command: `!`@has`,` (try with ``@!has`)`
// !`@has` - '//a[`@href="http://a.a"]'`

Encountered 1 errors
```

r? `@camelid`

3 years agoRollup merge of #80591 - lcnr:incomplete-features, r=RalfJung
Guillaume Gomez [Sun, 3 Jan 2021 16:09:08 +0000 (17:09 +0100)]
Rollup merge of #80591 - lcnr:incomplete-features, r=RalfJung

remove allow(incomplete_features) from std

cc https://github.com/rust-lang/rust/pull/80349#issuecomment-753357123

> Now I am somewhat concerned that the standard library uses some of these features...

I think it is theoretically ok to use incomplete features in the standard library or the compiler if we know that there is an already working subset and we explicitly document what we have to be careful about. Though at that point it is probably better to try and split the incomplete feature into two separate ones, similar to `min_specialization`.

Will be interesting once `feature(const_evaluatable_checked)` works well enough to imo be used in the compiler but not yet well enough to be removed from `INCOMPLETE_FEATURES`.

r? `@RalfJung`

3 years agoRollup merge of #80580 - GuillaumeGomez:suggestion-ignore-codeblock-warn, r=jyn514
Guillaume Gomez [Sun, 3 Jan 2021 16:09:01 +0000 (17:09 +0100)]
Rollup merge of #80580 - GuillaumeGomez:suggestion-ignore-codeblock-warn, r=jyn514

Add suggestion for "ignore" doc code block

Part of https://github.com/rust-lang/rust/issues/30032.

This PR adds a suggestion to help users when they have a "ignore" doc code block which is invalid rust code.

r? `@jyn514`

3 years agoStylistic fixes to diagnostic messages
oli [Sun, 3 Jan 2021 15:11:34 +0000 (15:11 +0000)]
Stylistic fixes to diagnostic messages

3 years agoRefactor the non-transient cell borrow error diagnostic
oli [Sun, 3 Jan 2021 14:46:19 +0000 (14:46 +0000)]
Refactor the non-transient cell borrow error diagnostic

3 years agoDangling pointers point to everything and nothing
Oli Scherer [Sun, 3 Jan 2021 14:19:07 +0000 (15:19 +0100)]
Dangling pointers point to everything and nothing

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoGrammar fixes
Oli Scherer [Sun, 3 Jan 2021 14:15:23 +0000 (15:15 +0100)]
Grammar fixes

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoInline resetMouseMoved function directly into "mousemove" event handler
Guillaume Gomez [Thu, 31 Dec 2020 12:21:50 +0000 (13:21 +0100)]
Inline resetMouseMoved function directly into "mousemove" event handler

3 years agoReplace some loops with "onEachLazy" call
Guillaume Gomez [Thu, 31 Dec 2020 12:21:27 +0000 (13:21 +0100)]
Replace some loops with "onEachLazy" call

3 years agoMake `ExpnData` fields `krate` and `orig_id` private
Aaron Hill [Sun, 3 Jan 2021 13:56:49 +0000 (08:56 -0500)]
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 agoCreate a "is_ignore" variable instead of doing the comparison multiple times
Guillaume Gomez [Sun, 3 Jan 2021 13:56:56 +0000 (14:56 +0100)]
Create a "is_ignore" variable instead of doing the comparison multiple times

3 years agoUpdate now-more-precise operation with a preciser message
oli [Sun, 3 Jan 2021 13:45:16 +0000 (13:45 +0000)]
Update now-more-precise operation with a preciser message

3 years agoApply suggestions from code review
Oli Scherer [Sun, 3 Jan 2021 13:20:51 +0000 (14:20 +0100)]
Apply suggestions from code review

comment nits

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agouse PlaceRef more consistently instead of loosely coupled local+projection
Ralf Jung [Sat, 2 Jan 2021 18:31:37 +0000 (19:31 +0100)]
use PlaceRef more consistently instead of loosely coupled local+projection

3 years agoMove variable into condition where it's used
Dániel Buga [Sun, 3 Jan 2021 11:50:29 +0000 (12:50 +0100)]
Move variable into condition where it's used

3 years agoNo need to collect result of get_item_attrs
Dániel Buga [Sun, 3 Jan 2021 11:49:53 +0000 (12:49 +0100)]
No need to collect result of get_item_attrs

3 years agoDetect invalid rustdoc test commands
Guillaume Gomez [Sat, 2 Jan 2021 13:11:19 +0000 (14:11 +0100)]
Detect invalid rustdoc test commands

3 years agoAuto merge of #80590 - camelid:bool-never-docs, r=nagisa
bors [Sun, 3 Jan 2021 12:21:12 +0000 (12:21 +0000)]
Auto merge of #80590 - camelid:bool-never-docs, r=nagisa

Update `bool` and `!` docs

3 years agoClean up convoluted macros_only logic
Dániel Buga [Sun, 3 Jan 2021 11:47:38 +0000 (12:47 +0100)]
Clean up convoluted macros_only logic

3 years agoAuto merge of #80247 - tmiasko:indent, r=bjorn3
bors [Sun, 3 Jan 2021 09:16:24 +0000 (09:16 +0000)]
Auto merge of #80247 - tmiasko:indent, r=bjorn3

Fix indentation of -Z meta-stats output

3 years agoMove variable into the only branch where it is relevant
LingMan [Sun, 3 Jan 2021 08:19:52 +0000 (09:19 +0100)]
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.

3 years agoAuto merge of #80261 - GuillaumeGomez:attr-rework, r=jyn514
bors [Sun, 3 Jan 2021 06:29:42 +0000 (06:29 +0000)]
Auto merge of #80261 - GuillaumeGomez:attr-rework, r=jyn514

rustdoc DocFragment rework

Kind of a follow-up of #80119.

A few things are happening in this PR. I'm not sure about the impact on perf though so I'm very interested about that too (if the perf is worse, then we can just close this PR).

The idea here is mostly about reducing the memory usage by relying even more on `Symbol` instead of `String`. The only issue is that `DocFragment` has 3 modifications performed on it:
 1. Unindenting
 2. Collapsing similar comments into one
 3. "Beautifying" (weird JS-like comments handling).

To do so, I saved the information about unindent and the "collapse" is now on-demand (which is why I'm not sure the perf will be better, it has to be run multiple times...).

r? `@jyn514`

3 years agoUse Option::filter instead of open-coding it
LingMan [Sun, 3 Jan 2021 03:38:56 +0000 (04:38 +0100)]
Use Option::filter instead of open-coding it

3 years agoAuto merge of #79827 - tmiasko:size-align, r=kennytm
bors [Sun, 3 Jan 2021 03:43:29 +0000 (03:43 +0000)]
Auto merge of #79827 - tmiasko:size-align, r=kennytm

Describe why `size_align` have not been inlined so far

although it is used only in one place.

3 years agoAuto merge of #80623 - flip1995:clippyup, r=Manishearth
bors [Sun, 3 Jan 2021 00:55:26 +0000 (00:55 +0000)]
Auto merge of #80623 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update.

This includes a Cargo.lock update for the recent Clippy version bump.

r? `@Manishearth`

3 years agoAuto merge of #80592 - Skynoodle:snake-case-lint-reserved-identifier, r=davidtwco
bors [Sat, 2 Jan 2021 22:06:17 +0000 (22:06 +0000)]
Auto merge of #80592 - Skynoodle:snake-case-lint-reserved-identifier, r=davidtwco

Suggest renaming or escaping when fixing non-snake-case identifiers which would conflict with keywords

Fixes #80575