]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #91910 - tmiasko:miri-extern-type, r=RalfJung
Matthias Krüger [Sat, 18 Dec 2021 07:16:28 +0000 (08:16 +0100)]
Rollup merge of #91910 - tmiasko:miri-extern-type, r=RalfJung

miri: lift restriction on extern types being the only field in a struct

Fixes #91827.

r? ````@RalfJung````

2 years agoRollup merge of #91818 - camelid:unused-result-type, r=jackh726
Matthias Krüger [Sat, 18 Dec 2021 07:16:27 +0000 (08:16 +0100)]
Rollup merge of #91818 - camelid:unused-result-type, r=jackh726

Show the unused type for `unused_results` lint

I think it's helpful to know what type was unused when looking at these
warnings. The type will likely determine whether the result *should* be
used, or whether it should just be ignored.

Including the type also matches the behavior of the `must_use` lint:
unused `SomeType` that must be used.

2 years agoRollup merge of #89090 - cjgillot:bare-dyn, r=jackh726
Matthias Krüger [Sat, 18 Dec 2021 07:16:26 +0000 (08:16 +0100)]
Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726

Lint bare traits in AstConv.

Removing the lint from lowering allows to:
- make lowering querification easier;
- have the lint implementation in only one place.

r? `@estebank`

2 years agoRollup merge of #87901 - poliorcetics:pub-pub-pub, r=jackh726
Matthias Krüger [Sat, 18 Dec 2021 07:16:25 +0000 (08:16 +0100)]
Rollup merge of #87901 - poliorcetics:pub-pub-pub, r=jackh726

Fix suggestion of additional `pub` when using `pub pub fn ...`

Fix #87694.

Marked as draft to start with because I want to explore doing the same fix for `const const fn` and other repeated-but-valid keywords.

`@rustbot` label A-diagnostics D-invalid-suggestion T-compiler

2 years agoget_mut_span_in_struct_field uses span.between
Lucas Kent [Sat, 18 Dec 2021 01:57:55 +0000 (12:57 +1100)]
get_mut_span_in_struct_field uses span.between

2 years agoImplement StableHash for BitSet and BitMatrix via Hash
Tomasz Miąsko [Sat, 18 Dec 2021 00:00:00 +0000 (00:00 +0000)]
Implement StableHash for BitSet and BitMatrix via Hash

This fixes an issue where bit sets / bit matrices the same word
content but a different domain size would receive the same hash.

2 years agoDerive hash for BitSet and BitMatrix
Tomasz Miąsko [Tue, 14 Dec 2021 00:00:00 +0000 (00:00 +0000)]
Derive hash for BitSet and BitMatrix

2 years agoRevert "Update Cranelift to 0.79.0"
bjorn3 [Fri, 17 Dec 2021 22:23:17 +0000 (23:23 +0100)]
Revert "Update Cranelift to 0.79.0"

This reverts commit a1037fad7dda722e4d63c5c09f6582079fe02a4c.

There are two regressions in Cranelift with respect to small integer
operations. Both have already been fixed on thebmain branch, but we will
have to wait for a new Cranelift release. They have been fixed by
bytecodealliance/wasmtime#3610 and bytecodealliance/wasmtime#3617.

2 years agoAuto merge of #89841 - cormacrelf:let-else-typed, r=nagisa
bors [Fri, 17 Dec 2021 22:12:34 +0000 (22:12 +0000)]
Auto merge of #89841 - cormacrelf:let-else-typed, r=nagisa

Implement let-else type annotations natively

Tracking issue: #87335

Fixes #89688, fixes #89807, edit: fixes  #89960 as well

As explained in https://github.com/rust-lang/rust/issues/89688#issuecomment-940405082, the previous desugaring moved the let-else scrutinee into a dummy variable, which meant if you wanted to refer to it again in the else block, it had moved.

This introduces a new hir type, ~~`hir::LetExpr`~~ `hir::Let`, which takes over all the fields of `hir::ExprKind::Let(...)` and adds an optional type annotation. The `hir::Let` is then treated like a `hir::Local` when type checking a function body, specifically:

* `GatherLocalsVisitor` overrides a new `Visitor::visit_let_expr` and does pretty much exactly what it does for `visit_local`, assigning a local type to the `hir::Let` ~~(they could be deduplicated but they are right next to each other, so at least we know they're the same)~~
* It reuses the code in `check_decl_local` to typecheck the `hir::Let`, simply returning 'bool' for the expression type after doing that.

* ~~`FnCtxt::check_expr_let` passes this local type in to `demand_scrutinee_type`, and then imitates check_decl_local's pattern checking~~
* ~~`demand_scrutinee_type` (the blindest change for me, please give this extra scrutiny) uses this local type instead of of creating a new one~~
    * ~~Just realised the `check_expr_with_needs` was passing NoExpectation further down, need to pass the type there too. And apparently this Expectation API already exists.~~

Some other misc notes:

* ~~Is the clippy code supposed to be autoformatted? I tried not to give huge diffs but maybe some rustfmt changes simply haven't hit it yet.~~
* in `rustc_ast_lowering/src/block.rs`, I noticed some existing `self.alias_attrs()` calls in `LoweringContext::lower_stmts` seem to be copying attributes from the lowered locals/etc to the statements. Is that right? I'm new at this, I don't know.

2 years agoAdd space and 2 grave accents
r00ster [Fri, 17 Dec 2021 22:11:04 +0000 (23:11 +0100)]
Add space and 2 grave accents

2 years agoRemove 'speculative evaluation' of predicates
Aaron Hill [Fri, 17 Dec 2021 15:27:26 +0000 (10:27 -0500)]
Remove 'speculative evaluation' of predicates

Performing 'speculative evaluation' introduces caching bugs that
cannot be fixed without invasive changes to projection.

Hopefully, we can win back most of the performance lost by
re-adding 'cache completion'

Fixes #90662

2 years agofix(rustc_lint): mark the parens around `(1..loop {})` as unused
Michael Howell [Fri, 17 Dec 2021 21:12:31 +0000 (14:12 -0700)]
fix(rustc_lint): mark the parens around `(1..loop {})` as unused

2 years agoRename `has_elf_tls` to `has_thread_local`
Chris Denton [Fri, 17 Dec 2021 20:56:38 +0000 (20:56 +0000)]
Rename `has_elf_tls` to `has_thread_local`

2 years agoAuto merge of #91838 - scottmcm:array-slice-eq-via-arrays-not-slices, r=dtolnay
bors [Fri, 17 Dec 2021 19:17:29 +0000 (19:17 +0000)]
Auto merge of #91838 - scottmcm:array-slice-eq-via-arrays-not-slices, r=dtolnay

Do array-slice equality via array equality, rather than always via slices

~~Draft because it needs a rebase after #91766 eventually gets through bors.~~

This enables the optimizations from #85828 to be used for array-to-slice comparisons too, not just array-to-array.

For example, <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=5f9ba69b3d5825a782f897c830d3a6aa>
```rust
pub fn demo(x: &[u8], y: [u8; 4]) -> bool {
    *x == y
}
```
Currently writes the array to stack for no reason:
```nasm
sub rsp, 4
mov dword ptr [rsp], edx
cmp rsi, 4
jne .LBB0_1
mov eax, dword ptr [rdi]
cmp eax, dword ptr [rsp]
sete al
add rsp, 4
ret

.LBB0_1:
xor eax, eax
add rsp, 4
ret
```
Whereas with the change in this PR it just compares it directly:
```nasm
cmp rsi, 4
jne .LBB1_1
cmp dword ptr [rdi], edx
sete al
ret

.LBB1_1:
xor eax, eax
ret
```

2 years agoSet `RUST_BACKTRACE=0` when running location-detail tests
Aaron Hill [Fri, 17 Dec 2021 19:05:48 +0000 (14:05 -0500)]
Set `RUST_BACKTRACE=0` when running location-detail tests

This ensures that the output does not depend on environment variables
set in the shell.

2 years agoEnable `#[thread_local]` for all windows-msvc targets
Chris Denton [Fri, 17 Dec 2021 15:47:44 +0000 (15:47 +0000)]
Enable `#[thread_local]` for all windows-msvc targets

2 years agoAuto merge of #92036 - flip1995:clippyup, r=Manishearth
bors [Fri, 17 Dec 2021 15:29:35 +0000 (15:29 +0000)]
Auto merge of #92036 - flip1995:clippyup, r=Manishearth

Update Clippy

Only one day delayed! :sweat_smile:

r? `@Manishearth`

2 years agoUpdate stdlib to the 2021 edition
Lucas Kent [Fri, 17 Dec 2021 09:08:36 +0000 (20:08 +1100)]
Update stdlib to the 2021 edition

2 years agoPoint to the tracking issue
Deadbeef [Fri, 17 Dec 2021 12:48:04 +0000 (20:48 +0800)]
Point to the tracking issue

2 years agoBless ui tests
Deadbeef [Fri, 17 Dec 2021 07:38:12 +0000 (15:38 +0800)]
Bless ui tests

2 years agoAdd a temporary hack before env fix lands in bootstrap
Deadbeef [Fri, 17 Dec 2021 06:16:12 +0000 (14:16 +0800)]
Add a temporary hack before env fix lands in bootstrap

2 years agoConstify (most) `Option` methods
Deadbeef [Tue, 14 Dec 2021 17:58:01 +0000 (01:58 +0800)]
Constify (most) `Option` methods

2 years agoUse a const ParamEnv when in default_method_body_is_const
Deadbeef [Fri, 17 Dec 2021 12:39:55 +0000 (20:39 +0800)]
Use a const ParamEnv when in default_method_body_is_const

2 years agoMerge commit '23d11428de3e973b34a5090a78d62887f821c90e' into clippyup
flip1995 [Fri, 17 Dec 2021 12:40:22 +0000 (13:40 +0100)]
Merge commit '23d11428de3e973b34a5090a78d62887f821c90e' into clippyup

2 years agoAuto merge of #8134 - flip1995:rustup, r=flip1995
bors [Fri, 17 Dec 2021 12:24:03 +0000 (12:24 +0000)]
Auto merge of #8134 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-12-17
flip1995 [Fri, 17 Dec 2021 12:22:34 +0000 (13:22 +0100)]
Bump nightly version -> 2021-12-17

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Fri, 17 Dec 2021 11:22:41 +0000 (12:22 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agopass -Wl,-z,origin to set DF_ORIGIN when using rpath
Sébastien Marie [Fri, 17 Dec 2021 11:27:14 +0000 (11:27 +0000)]
pass -Wl,-z,origin to set DF_ORIGIN when using rpath

DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string.

Some implementations are just ignoring DF_ORIGIN and do substitution for $ORIGIN if present (whatever DF_ORIGIN pr

Set the flag inconditionally if rpath is wanted.

2 years agoAuto merge of #92023 - ehuss:update-cargo, r=ehuss
bors [Fri, 17 Dec 2021 10:37:26 +0000 (10:37 +0000)]
Auto merge of #92023 - ehuss:update-cargo, r=ehuss

Update cargo

8 commits in a359ce16073401f28b84840da85b268aa3d37c88..fcef61230c3b6213b6b0d233a36ba4ebd1649ec3
2021-12-14 18:40:22 +0000 to 2021-12-17 02:30:38 +0000
- Minor docs change for `cargo test --help` (rust-lang/cargo#10210)
- Make clippy happy (rust-lang/cargo#10205)
- Enhance descriptions of issue templates (rust-lang/cargo#10202)
- Add workaround for sporadic kills when building on Macos (rust-lang/cargo#10196)
- Detect filesystem loop during walking the projects (rust-lang/cargo#10188)
- Error about not having any crates with documentation (rust-lang/cargo#10204)
- Don't document libs with doc=false (rust-lang/cargo#10201)
- Bumps up tar to 0.4.36 (rust-lang/cargo#10198)

2 years agoUpdate cranelift patch section
bjorn3 [Fri, 17 Dec 2021 09:58:04 +0000 (10:58 +0100)]
Update cranelift patch section

2 years agoMerge commit '533f0fc81ab9ba097779fcd27c8f9ea12261fef5' into psimd
Vadim Petrochenkov [Fri, 17 Dec 2021 07:10:53 +0000 (15:10 +0800)]
Merge commit '533f0fc81ab9ba097779fcd27c8f9ea12261fef5' into psimd

2 years agoDisable test on bootstrap compiler
Dylan MacKenzie [Fri, 17 Dec 2021 06:11:17 +0000 (22:11 -0800)]
Disable test on bootstrap compiler

2 years agoAuto merge of #91812 - camelid:assoc-const-lazy, r=GuillaumeGomez
bors [Fri, 17 Dec 2021 06:03:38 +0000 (06:03 +0000)]
Auto merge of #91812 - camelid:assoc-const-lazy, r=GuillaumeGomez

rustdoc: Pretty-print assoc const defaults on-demand

This should improve performance, clean up the code, and help pave the
way for #83035.

2 years agoTest const impl of `cmp` traits
Dylan MacKenzie [Wed, 1 Dec 2021 22:37:51 +0000 (14:37 -0800)]
Test const impl of `cmp` traits

2 years agoMark defaulted `PartialEq`/`PartialOrd` methods as const
Dylan MacKenzie [Tue, 30 Nov 2021 03:06:44 +0000 (19:06 -0800)]
Mark defaulted `PartialEq`/`PartialOrd` methods as const

2 years agorustc_codegen_llvm: Give each codegen unit a unique DWARF name on all
Patrick Walton [Fri, 17 Dec 2021 04:39:41 +0000 (20:39 -0800)]
rustc_codegen_llvm: Give each codegen unit a unique DWARF name on all
platforms, not just Apple ones.

To avoid breaking split DWARF, we need to ensure that each codegen unit has a
unique `DW_AT_name`. This is because there's a remote chance that different
codegen units for the same module will have entirely identical DWARF entries
for the purpose of the DWO ID, which would violate Appendix F ("Split Dwarf
Object Files") of the DWARF 5 specification. LLVM uses the algorithm specified
in section 7.32 "Type Signature Computation" to compute the DWO ID, which does
not include any fields that would distinguish compilation units. So we must
embed the codegen unit name into the `DW_AT_name`.

Closes #88521.

2 years agoUpdate cargo
Eric Huss [Fri, 17 Dec 2021 04:35:44 +0000 (20:35 -0800)]
Update cargo

2 years agoEliminate duplicate codes of expected_found_bool
lzh [Fri, 17 Dec 2021 03:17:43 +0000 (11:17 +0800)]
Eliminate duplicate codes of expected_found_bool

2 years agoRemove P: Unpin bound on impl Stream for Pin
Folyd [Fri, 17 Dec 2021 03:14:02 +0000 (11:14 +0800)]
Remove P: Unpin bound on impl Stream for Pin

2 years agoFix typo in "new region bound" suggestion
Esteban Kuber [Fri, 17 Dec 2021 02:10:12 +0000 (02:10 +0000)]
Fix typo in "new region bound" suggestion

The lifetime name shoud always appear in text surrounded by `.

2 years agoImprove suggestion to change struct field to &mut
Lucas Kent [Sat, 4 Dec 2021 07:57:31 +0000 (18:57 +1100)]
Improve suggestion to change struct field to &mut

2 years agoAuto merge of #91672 - b-naber:merge-normalize-erasing-regions-queries, r=jackh726
bors [Fri, 17 Dec 2021 02:03:10 +0000 (02:03 +0000)]
Auto merge of #91672 - b-naber:merge-normalize-erasing-regions-queries, r=jackh726

Implement normalize_erasing_regions queries in terms of 'try' version

Attempt to lessen performance regression caused by https://github.com/rust-lang/rust/pull/91255

r? `@jackh726`

2 years agobuiltin_macros: allow external consumers for AsmArgs parsing
Caleb Cartwright [Fri, 17 Dec 2021 00:40:07 +0000 (18:40 -0600)]
builtin_macros: allow external consumers for AsmArgs parsing

2 years agoOnly cache local adt_def results on disk
Aaron Hill [Thu, 16 Dec 2021 23:32:00 +0000 (18:32 -0500)]
Only cache local adt_def results on disk

An `AdtDef` contains `Span`s, and we don't appear
to actually encode the `SourceFile` for foreign
spans in the incremental cache in some cases.

2 years agoAuto merge of #92003 - matthiaskrgr:rollup-obgv0rt, r=matthiaskrgr
bors [Thu, 16 Dec 2021 23:08:02 +0000 (23:08 +0000)]
Auto merge of #92003 - matthiaskrgr:rollup-obgv0rt, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91172 (Warn when a `#[test]`-like built-in attribute macro is present multiple times.)
 - #91796 (Fix since attribute for const_manually_drop feature)
 - #91879 (Remove `in_band_lifetimes` from `rustc_borrowck`)
 - #91947 (Add `io::Error::other`)
 - #91967 (Pull in libdevstat on FreeBSD)
 - #91987 (Add module documentation for rustdoc passes)
 - #92001 (Fix default_method_body_is_const when used across crates)

Failed merges:

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

2 years agoMake loop more clear by renaming variables
Guillaume Gomez [Thu, 16 Dec 2021 22:17:03 +0000 (23:17 +0100)]
Make loop more clear by renaming variables

2 years agoRevert "socket ancillary data implementation for dragonflybsd."
David CARLIER [Thu, 16 Dec 2021 21:32:53 +0000 (21:32 +0000)]
Revert "socket ancillary data implementation for dragonflybsd."

2 years agoAuto merge of #91616 - saethlin:sort_unchecked-sb-fix, r=Mark-Simulacrum
bors [Thu, 16 Dec 2021 19:56:45 +0000 (19:56 +0000)]
Auto merge of #91616 - saethlin:sort_unchecked-sb-fix, r=Mark-Simulacrum

Fix #91306 by deriving all access from a single *mut T

Fixes #91306.

The previous code is invalid because the first argument to `copy_nonoverlapping` is invalidated by the mutable borrow taken out to construct the second argument.

I believe this patch fixes that, and this code should now pass Miri with `-Ztag-raw-pointers`, ~~but I'm currently stuck trying to run my reproducer with a this patched version of the standard library (alternatively, running Miri on the standard library tests itself would suffice).~~ Ralf walked me through this on Zulip.

I've also added fixes for 7 more problems other than those I reported. Most of them are easy to hit by calling sort_unstable on random arrays. I don't have reproducers for every change, but they seem pretty clear-cut to me. But I did only start learning stacked borrows 2 days ago so that might be a large dash of Dunning-Kruger.

2 years agoClean up search code and unify function returned values
Guillaume Gomez [Wed, 15 Dec 2021 19:52:37 +0000 (20:52 +0100)]
Clean up search code and unify function returned values

2 years agoRemove `in_band_lifetimes` from `rustc_codegen_llvm`
LegionMammal978 [Tue, 14 Dec 2021 18:49:49 +0000 (13:49 -0500)]
Remove `in_band_lifetimes` from `rustc_codegen_llvm`

See #91867 for more information.

2 years agoRemove `in_band_lifetimes` from `rustc_mir_dataflow`
LegionMammal978 [Tue, 14 Dec 2021 17:02:45 +0000 (12:02 -0500)]
Remove `in_band_lifetimes` from `rustc_mir_dataflow`

See #91867 for more information.

2 years agoUpdate Cranelift to 0.79.0
bjorn3 [Thu, 16 Dec 2021 17:57:25 +0000 (18:57 +0100)]
Update Cranelift to 0.79.0

2 years agoRollup merge of #92001 - fee1-dead:dmbic-xcrate-fix, r=oli-obk
Matthias Krüger [Thu, 16 Dec 2021 16:23:13 +0000 (17:23 +0100)]
Rollup merge of #92001 - fee1-dead:dmbic-xcrate-fix, r=oli-obk

Fix default_method_body_is_const when used across crates

r? `@oli-obk`

unblocks #91439.

2 years agoRollup merge of #91987 - jsha:docdocgoose, r=jyn514
Matthias Krüger [Thu, 16 Dec 2021 16:23:12 +0000 (17:23 +0100)]
Rollup merge of #91987 - jsha:docdocgoose, r=jyn514

Add module documentation for rustdoc passes

These are currently documented at https://rustc-dev-guide.rust-lang.org/rustdoc-internals.html#hot-potato but can easily go out of date. We'd like to document them in place and link to https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/passes/index.html

[Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/moving.20pass.20docs/near/265058351).

r? `@camelid`

2 years agoRollup merge of #91967 - lnicola:freebsd-devstat, r=kennytm
Matthias Krüger [Thu, 16 Dec 2021 16:23:11 +0000 (17:23 +0100)]
Rollup merge of #91967 - lnicola:freebsd-devstat, r=kennytm

Pull in libdevstat on FreeBSD

Similar to https://github.com/rust-lang/rust/pull/90495, spotted in https://github.com/rust-lang/rust/pull/91909.

2 years agoRollup merge of #91947 - ibraheemdev:io-error-other, r=joshtriplett
Matthias Krüger [Thu, 16 Dec 2021 16:23:10 +0000 (17:23 +0100)]
Rollup merge of #91947 - ibraheemdev:io-error-other, r=joshtriplett

Add `io::Error::other`

This PR adds a small utility constructor, `io::Error::other`, a shorthand for `io::Error::new(io::ErrorKind::Other, err)`, something I find myself writing often.

For some concrete stats, a quick search on [grep.app](https://grep.app) shows that more than half of the uses of `io::Error::new` use `ErrorKind::Other`:
```
Error::new\((?:std::)?(?:io::)?ErrorKind:: => 3,898 results
Error::new\((?:std::)?(?:io::)?ErrorKind::Other => 2,186 results
```

2 years agoRollup merge of #91879 - bugadani:in_band_borrowck, r=wesleywiser
Matthias Krüger [Thu, 16 Dec 2021 16:23:09 +0000 (17:23 +0100)]
Rollup merge of #91879 - bugadani:in_band_borrowck, r=wesleywiser

Remove `in_band_lifetimes` from `rustc_borrowck`

See #91867 for more information.

2 years agoRollup merge of #91796 - not-my-profile:fix-const_manually_drop-since, r=kennytm
Matthias Krüger [Thu, 16 Dec 2021 16:23:08 +0000 (17:23 +0100)]
Rollup merge of #91796 - not-my-profile:fix-const_manually_drop-since, r=kennytm

Fix since attribute for const_manually_drop feature

const_manually_drop was stabilized in 1.32 as mentioned in
https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1320-2019-01-17

2 years agoRollup merge of #91172 - Ethiraric:ethiraric/fix90979, r=petrochenkov
Matthias Krüger [Thu, 16 Dec 2021 16:23:07 +0000 (17:23 +0100)]
Rollup merge of #91172 - Ethiraric:ethiraric/fix90979, r=petrochenkov

Warn when a `#[test]`-like built-in attribute macro is present multiple times.

Fixes #90979.

2 years agoFix SB problems in slice sorting
Ben Kimock [Tue, 7 Dec 2021 01:44:02 +0000 (20:44 -0500)]
Fix SB problems in slice sorting

Most of these problems originate in use of get_unchecked_mut.

When calling ptr::copy_nonoverlapping, using get_unchecked_mut for both
arguments causes the borrow created to make the second pointer to invalid the
first.

The pairs of identical MaybeUninit::slice_as_mut_ptr calls similarly
invalidate each other.

There was also a similar borrow invalidation problem with the use of
slice::get_unchecked_mut to derive the pointer for the CopyOnDrop.

2 years agoAuto merge of #91833 - klensy:rd-minus-alloc, r=jyn514
bors [Thu, 16 Dec 2021 15:18:08 +0000 (15:18 +0000)]
Auto merge of #91833 - klensy:rd-minus-alloc, r=jyn514

rustdoc: don't clone already owned `Path` and modify it inplace

2 years agoUpdate libc
bjorn3 [Thu, 16 Dec 2021 13:46:43 +0000 (14:46 +0100)]
Update libc

2 years agoFix default_method_body_is_const when used across crates
Deadbeef [Thu, 16 Dec 2021 13:38:54 +0000 (21:38 +0800)]
Fix default_method_body_is_const when used across crates

2 years agoRustc tests: ignore a couple more rustdoc tests
bjorn3 [Thu, 16 Dec 2021 13:36:02 +0000 (14:36 +0100)]
Rustc tests: ignore a couple more rustdoc tests

2 years agoRustup to rustc 1.59.0-nightly (c5ecc1570 2021-12-15)
bjorn3 [Thu, 16 Dec 2021 13:10:51 +0000 (14:10 +0100)]
Rustup to rustc 1.59.0-nightly (c5ecc1570 2021-12-15)

2 years agoSync from rust a090c8659c3be0cbc7dc93c4b2c11a9cdbf8b980
bjorn3 [Thu, 16 Dec 2021 12:52:12 +0000 (13:52 +0100)]
Sync from rust a090c8659c3be0cbc7dc93c4b2c11a9cdbf8b980

2 years agoFix unused crate warning
bjorn3 [Thu, 16 Dec 2021 12:51:18 +0000 (13:51 +0100)]
Fix unused crate warning

2 years agoAuto merge of #91996 - matthiaskrgr:rollup-8pdt8x7, r=matthiaskrgr
bors [Thu, 16 Dec 2021 11:35:37 +0000 (11:35 +0000)]
Auto merge of #91996 - matthiaskrgr:rollup-8pdt8x7, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #91901 (Remove `in_band_lifetimes` from `rustc_symbol_mangling`)
 - #91904 (Remove `in_band_lifetimes` from `rustc_trait_selection`)
 - #91951 (update stdarch)
 - #91958 (Apply rust-logo class only on default logo)
 - #91972 (link to pref_align_of tracking issue)
 - #91986 (Bump compiler-builtins to 0.1.66)

Failed merges:

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

2 years agoRollup merge of #91986 - ayrtonm:bump-builtins, r=Amanieu
Matthias Krüger [Thu, 16 Dec 2021 09:12:47 +0000 (10:12 +0100)]
Rollup merge of #91986 - ayrtonm:bump-builtins, r=Amanieu

Bump compiler-builtins to 0.1.66

Adds intrinsics for truncdfsf2 and truncdfsf2vsp on ARM.

r? `@Amanieu`

2 years agoRollup merge of #91972 - RalfJung:pref-align-of, r=Mark-Simulacrum
Matthias Krüger [Thu, 16 Dec 2021 09:12:46 +0000 (10:12 +0100)]
Rollup merge of #91972 - RalfJung:pref-align-of, r=Mark-Simulacrum

link to pref_align_of tracking issue

If we are not going to remove this intrinsic (https://github.com/rust-lang/rust/pull/90877), I think we should at least have a place to centralize discussion around it, so here we go. Intrinsics don't have their own separate features and usually we instead use the public method for tracking it, but this one does not have such a method... so the tracking issue is just a regular link. (And then we sue it for the const part as well.)

2 years agoRollup merge of #91958 - jsha:rust-logo, r=GuillaumeGomez
Matthias Krüger [Thu, 16 Dec 2021 09:12:45 +0000 (10:12 +0100)]
Rollup merge of #91958 - jsha:rust-logo, r=GuillaumeGomez

Apply rust-logo class only on default logo

Fixes #91653.

![image](https://user-images.githubusercontent.com/220205/146138145-a7a62ea6-3205-4bc7-8460-e985284d93ea.png)

Demo: https://rustdoc.crud.net/jsha/hashes/sha2/

r? ``@GuillaumeGomez``

2 years agoRollup merge of #91951 - SparrowLii:master, r=Amanieu
Matthias Krüger [Thu, 16 Dec 2021 09:12:43 +0000 (10:12 +0100)]
Rollup merge of #91951 - SparrowLii:master, r=Amanieu

update stdarch

2 commits in d219ad63c5075098fc224a57deb4852b9734327d..0716b22e902207efabe46879cbf28d0189ab7924
2021-12-9 23:50:37 +0000 to 2021-12-14 16:17:57 +0100
 * Fix a bunch of typos ([Fix a bunch of typos stdarch#1267](https://github.com/rust-lang/stdarch/pull/1267))
 * Stabilize armv8 neon instruction set on aarch64 ([Stabilize armv8 neon instruction set on aarch64 stdarch#1266](https://github.com/rust-lang/stdarch/pull/1266))

The update stabilizes armv8 neon instructions on aarch64. #90972

2 years agoRollup merge of #91904 - SylvanB:remove_in_band_lifetimes_rustc_trait_selection,...
Matthias Krüger [Thu, 16 Dec 2021 09:12:42 +0000 (10:12 +0100)]
Rollup merge of #91904 - SylvanB:remove_in_band_lifetimes_rustc_trait_selection, r=petrochenkov

Remove `in_band_lifetimes` from `rustc_trait_selection`

Another one for #91867

2 years agoRollup merge of #91901 - SylvanB:remove_in_band_lifetimes_rustc_symbol_mangling,...
Matthias Krüger [Thu, 16 Dec 2021 09:12:42 +0000 (10:12 +0100)]
Rollup merge of #91901 - SylvanB:remove_in_band_lifetimes_rustc_symbol_mangling, r=jackh726

Remove `in_band_lifetimes` from `rustc_symbol_mangling`

Helping out with  #91867

2 years agoAuto merge of #91527 - the8472:retain-opt, r=dtolnay
bors [Thu, 16 Dec 2021 07:58:36 +0000 (07:58 +0000)]
Auto merge of #91527 - the8472:retain-opt, r=dtolnay

Optimize `vec::retain` performance

This simply moves the loops into the inner function which leads to better results.

```
old:

test vec::bench_retain_100000                            ... bench:     203,828 ns/iter (+/- 2,101)
test vec::bench_retain_iter_100000                       ... bench:      63,324 ns/iter (+/- 12,305)
test vec::bench_retain_whole_100000                      ... bench:      42,989 ns/iter (+/- 291)

new:

test vec::bench_retain_100000                            ... bench:      42,180 ns/iter (+/- 451)
test vec::bench_retain_iter_100000                       ... bench:      65,167 ns/iter (+/- 11,971)
test vec::bench_retain_whole_100000                      ... bench:      33,736 ns/iter (+/- 12,404)
```

Measured on x86_64-unknown-linux-gnu, Zen2

Fixes #91497

2 years agoAdd module documentation for rustdoc passes
Jacob Hoffman-Andrews [Thu, 16 Dec 2021 02:59:00 +0000 (18:59 -0800)]
Add module documentation for rustdoc passes

These are currently documented at
https://rustc-dev-guide.rust-lang.org/rustdoc-internals.html#hot-potato
but can easily go out of date. We'd like to document them in place and
link to
https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/passes/index.html

2 years agorustdoc: remove `--passes` and `--no-defaults`
Peter Jaszkowiak [Tue, 14 Dec 2021 06:49:29 +0000 (23:49 -0700)]
rustdoc: remove `--passes` and `--no-defaults`

- flags no longer function, see #44136
- adjust tests to match new behavior
- removed test issue-42875 (covered regression with --no-defaults)
- moved input-format to removed flags
- move all removed flags to bottom
- note flag removal in command help
- remove DefaultPassOption enum (now redundant with `show_coverage`)

2 years agoRemove `in_band_lifetimes` for `rustc_passes`
Peter Jaszkowiak [Tue, 14 Dec 2021 05:16:36 +0000 (22:16 -0700)]
Remove `in_band_lifetimes` for `rustc_passes`

2 years agosuggest adding a `#[cfg(test)]` to test modules
Takayuki Maeda [Sat, 23 Oct 2021 09:55:02 +0000 (18:55 +0900)]
suggest adding a `#[cfg(test)]` to test modules

remove a empty line

import `module_to_string`

use `contains("test")`

show a suggestion in case module starts_with/ends_with "test"

replace `parent` with `containing`

2 years agoAuto merge of #89836 - pierwill:fix-85142-crate-hash, r=wesleywiser
bors [Thu, 16 Dec 2021 02:21:30 +0000 (02:21 +0000)]
Auto merge of #89836 - pierwill:fix-85142-crate-hash, r=wesleywiser

Include rustc version in `rustc_span::StableCrateId`

`rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design.

In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable.

In the UI tests, I had to truncate a significant amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See https://github.com/rust-lang/rust/issues/90116.)

Closes #85142.

2 years agoBump compiler-builtins to 0.1.66
Ayrton [Thu, 16 Dec 2021 02:00:06 +0000 (21:00 -0500)]
Bump compiler-builtins to 0.1.66

Adds intrinsics for truncdfsf2 and truncdfsf2vsp on ARM.

2 years agoRun x.py fmt
Aaron Hill [Thu, 16 Dec 2021 00:48:59 +0000 (19:48 -0500)]
Run x.py fmt

2 years agoRemove `in_band_lifetimes` from `rustc_middle`
Aaron Hill [Thu, 16 Dec 2021 00:32:30 +0000 (19:32 -0500)]
Remove `in_band_lifetimes` from `rustc_middle`

See #91867

This was mostly straightforward. In several places, I take advantage
of the fact that lifetimes are non-hygenic: a macro declares the
'tcx' lifetime, which is then used in types passed in as macro
arguments.

2 years agomiri: lift restriction on extern types being the only field in a struct
Tomasz Miąsko [Tue, 14 Dec 2021 00:00:00 +0000 (00:00 +0000)]
miri: lift restriction on extern types being the only field in a struct

2 years agoAdd a lint for duplicated attributes.
Ethiraric [Wed, 24 Nov 2021 09:20:23 +0000 (10:20 +0100)]
Add a lint for duplicated attributes.

2 years agoAuto merge of #86986 - lcnr:simplify_type, r=nikomatsakis,oli-obk
bors [Wed, 15 Dec 2021 22:32:56 +0000 (22:32 +0000)]
Auto merge of #86986 - lcnr:simplify_type, r=nikomatsakis,oli-obk

extend `simplify_type`

might cause a slight perf inprovement and imo more accurately represents what types there are.

considering that I was going to use this in #85048 it seems like we might need this in the future anyways :shrug:

2 years agoRemove `in_band_lifetimes` from `rustc_symbol_mangling`
Sylvan Bowdler [Tue, 14 Dec 2021 08:01:32 +0000 (08:01 +0000)]
Remove `in_band_lifetimes` from `rustc_symbol_mangling`

2 years agoCache adt_def query result on disk
Aaron Hill [Wed, 15 Dec 2021 22:01:09 +0000 (17:01 -0500)]
Cache adt_def query result on disk

2 years agoRemove `in_band_lifetimes` from `rustc_trait_selection`
Sylvan Bowdler [Tue, 14 Dec 2021 09:44:49 +0000 (09:44 +0000)]
Remove `in_band_lifetimes` from `rustc_trait_selection`

2 years agoFully serialize AdtDef
Aaron Hill [Tue, 14 Dec 2021 17:37:04 +0000 (12:37 -0500)]
Fully serialize AdtDef

This avoids needing to invoke the `adt_def` query during
the decoding of another query's result.

2 years agoApply rust-logo class only on default logo
Jacob Hoffman-Andrews [Wed, 15 Dec 2021 06:54:42 +0000 (22:54 -0800)]
Apply rust-logo class only on default logo

Also replace ' with " in rustdoc template

2 years agoMove generator check earlier in inlining.
Camille GILLOT [Mon, 13 Dec 2021 18:25:36 +0000 (19:25 +0100)]
Move generator check earlier in inlining.

2 years agolink to pref_align_of tracking issue
Ralf Jung [Wed, 15 Dec 2021 17:38:51 +0000 (18:38 +0100)]
link to pref_align_of tracking issue

2 years agoFix crash when struct argument size is not a multiple of the pointer size
bjorn3 [Wed, 15 Dec 2021 15:53:35 +0000 (16:53 +0100)]
Fix crash when struct argument size is not a multiple of the pointer size

Fixes #1200

2 years agoPull in libdevstat on FreeBSD
Laurențiu Nicola [Wed, 15 Dec 2021 14:16:26 +0000 (16:16 +0200)]
Pull in libdevstat on FreeBSD

2 years agoAuto merge of #91962 - matthiaskrgr:rollup-2g082jw, r=matthiaskrgr
bors [Wed, 15 Dec 2021 12:41:42 +0000 (12:41 +0000)]
Auto merge of #91962 - matthiaskrgr:rollup-2g082jw, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91880 (fix clippy::single_char_pattern perf findings)
 - #91885 (Remove `in_band_lifetimes` from `rustc_codegen_ssa`)
 - #91898 (Make `TyS::is_suggestable` check for non-suggestable types structually)
 - #91915 (Add another regression test for unnormalized fn args with Self)
 - #91916 (Fix a bunch of typos)
 - #91918 (Constify `bool::then{,_some}`)
 - #91920 (Use `tcx.def_path_hash` in `ExistentialPredicate.stable_cmp`)

Failed merges:

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

2 years agoAuto merge of #7978 - smoelius:master, r=llogiq
bors [Wed, 15 Dec 2021 10:46:43 +0000 (10:46 +0000)]
Auto merge of #7978 - smoelius:master, r=llogiq

Add `unnecessary_to_owned` lint

This PR adds a lint to check for unnecessary calls to `ToOwned::to_owned` and other similar functions (e.g., `Cow::into_owned`, `ToString::to_string`, etc.).

The lint checks for expressions of the form `&receiver.to_owned_like()` used in a position requiring type `&T` where one of the following is true:
* `receiver`'s type is `T` exactly
* `receiver`'s type implements `Deref<Target = T>`
* `receiver`'s type implements `AsRef<T>`

The lint additionally checks for expressions of the form `receiver.to_owned_like()` used as arguments of type `impl AsRef<T>`.

It would be nice if the lint could also check for expressions used as arguments to functions like the following:
```
fn foo<T: AsRef<str>>(x: T) { ... }
```
However, I couldn't figure out how to determine whether a function input type was instantiated from a parameter with a trait bound.

If someone could offer me some guidance, I would be happy to add such functionality.

Closes #7933

changelog: Add [`unnecessary_to_owned`] lint

2 years agoExpand `is_clone_like` comment
Samuel E. Moelius III [Wed, 15 Dec 2021 10:25:47 +0000 (05:25 -0500)]
Expand `is_clone_like` comment

2 years agoRollup merge of #91920 - Aaron1011:pred-stable-cmp, r=oli-obk
Matthias Krüger [Wed, 15 Dec 2021 09:57:04 +0000 (10:57 +0100)]
Rollup merge of #91920 - Aaron1011:pred-stable-cmp, r=oli-obk

Use `tcx.def_path_hash` in `ExistentialPredicate.stable_cmp`

This avoids a needless query invocation

2 years agoRollup merge of #91918 - fee1-dead:constification0-the-great-constification-begins...
Matthias Krüger [Wed, 15 Dec 2021 09:57:03 +0000 (10:57 +0100)]
Rollup merge of #91918 - fee1-dead:constification0-the-great-constification-begins, r=oli-obk

Constify `bool::then{,_some}`

Note on `~const Drop`: it has no effect when called from runtime functions, when called from const contexts, the trait system ensures that the type can be dropped in const contexts.