]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoReplace wait-for instructions for rustdoc GUI tests with wait-for-css
Guillaume Gomez [Mon, 21 Mar 2022 14:50:05 +0000 (15:50 +0100)]
Replace wait-for instructions for rustdoc GUI tests with wait-for-css

2 years agoUpdate browser-ui-test version to 0.8.4
Guillaume Gomez [Fri, 25 Mar 2022 20:08:59 +0000 (21:08 +0100)]
Update browser-ui-test version to 0.8.4

2 years agoAuto merge of #95282 - RalfJung:miri, r=RalfJung
bors [Fri, 25 Mar 2022 16:45:08 +0000 (16:45 +0000)]
Auto merge of #95282 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/95258
r? `@ghost`

2 years agoAuto merge of #95280 - InfRandomness:infrandomness/Dtorck_clarification, r=oli-obk
bors [Fri, 25 Mar 2022 14:16:13 +0000 (14:16 +0000)]
Auto merge of #95280 - InfRandomness:infrandomness/Dtorck_clarification, r=oli-obk

Swap DtorckConstraint to DropckConstraint

This change was made as per suspicion that this struct was never renamed after consistent use of DropCk.

This also clarifies the meaning behind the name of this structure.

Fixes https://github.com/rust-lang/rust/issues/94310

2 years agoAuto merge of #95255 - petrochenkov:suggresolve, r=michaelwoerister
bors [Fri, 25 Mar 2022 11:35:19 +0000 (11:35 +0000)]
Auto merge of #95255 - petrochenkov:suggresolve, r=michaelwoerister

resolve: Do not build expensive suggestions if they are not actually used

And remove a bunch of (conditionally) unused parameters from path resolution functions.

This helps with performance issues in https://github.com/rust-lang/rust/pull/94857, and should be helpful in general even without that.

2 years agoAuto merge of #95082 - spastorino:overlap-inherent-impls, r=nikomatsakis
bors [Fri, 25 Mar 2022 09:09:48 +0000 (09:09 +0000)]
Auto merge of #95082 - spastorino:overlap-inherent-impls, r=nikomatsakis

Overlap inherent impls

r? `@nikomatsakis`

Closes #94526

2 years agoAuto merge of #95259 - nnethercote:more-macro-expansion-optimizations, r=petrochenkov
bors [Fri, 25 Mar 2022 06:28:58 +0000 (06:28 +0000)]
Auto merge of #95259 - nnethercote:more-macro-expansion-optimizations, r=petrochenkov

More macro expansion optimizations

A few nice wins for macro-heavy crates.

r? `@petrochenkov`

2 years agoAuto merge of #92361 - vacuus:doctest-run-test-out-lines, r=CraftSpider
bors [Fri, 25 Mar 2022 04:01:00 +0000 (04:01 +0000)]
Auto merge of #92361 - vacuus:doctest-run-test-out-lines, r=CraftSpider

Remove `collect` in `doctest::run_test`

2 years agoShrink `MatcherPosRepetition`.
Nicholas Nethercote [Wed, 23 Mar 2022 05:04:33 +0000 (16:04 +1100)]
Shrink `MatcherPosRepetition`.

Currently it copies a `KleeneOp` and a `Token` out of a
`SequenceRepetition`. It's better to store a reference to the
`SequenceRepetition`, which is now possible due to #95159 having changed
the lifetimes.

2 years agoShrink `NamedMatchVec` to one inline element.
Nicholas Nethercote [Wed, 23 Mar 2022 02:09:55 +0000 (13:09 +1100)]
Shrink `NamedMatchVec` to one inline element.

This counters the `NamedMatchVec` size increase from the previous
commit, leaving `NamedMatchVec` smaller than before.

2 years agoSplit `NamedMatch::MatchNonterminal` in two.
Nicholas Nethercote [Wed, 23 Mar 2022 00:46:22 +0000 (11:46 +1100)]
Split `NamedMatch::MatchNonterminal` in two.

The `Lrc` is only relevant within `transcribe()`. There, the `Lrc` is
helpful for the non-`NtTT` cases, because the entire nonterminal is
cloned. But for the `NtTT` cases the inner token tree is cloned (a full
clone) and so the `Lrc` is of no help.

This commit splits the `NtTT` and non-`NtTT` cases, avoiding the useless
`Lrc` in the former case, for the following effect on macro-heavy
crates.
- It reduces the total number of allocations a lot.
- It increases the size of some of the remaining allocations.
- It doesn't affect *peak* memory usage, because the larger allocations
  are short-lived.

This overall gives a speed win.

2 years agoAuto merge of #95291 - Dylan-DPC:rollup-vrb4wlw, r=Dylan-DPC
bors [Fri, 25 Mar 2022 01:20:01 +0000 (01:20 +0000)]
Auto merge of #95291 - Dylan-DPC:rollup-vrb4wlw, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #94391 (Fix ice when error reporting recursion errors)
 - #94655 (Clarify which kinds of MIR are allowed during which phases.)
 - #95179 (Try to evaluate in try unify and postpone resolution of constants that contain inference variables)
 - #95270 (debuginfo: Fix debuginfo for Box<T> where T is unsized.)
 - #95276 (add diagnostic items for clippy's `trim_split_whitespace`)

Failed merges:

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

2 years agoRollup merge of #95276 - FoseFx:clippy_trim_split_whitespace, r=flip1995
Dylan DPC [Fri, 25 Mar 2022 00:34:32 +0000 (01:34 +0100)]
Rollup merge of #95276 - FoseFx:clippy_trim_split_whitespace, r=flip1995

add diagnostic items for clippy's `trim_split_whitespace`

Adding the following diagnostic items:
 * str_split_whitespace,
 * str_trim,
 * str_trim_start,
 * str_trim_end

They are needed for https://github.com/rust-lang/rust-clippy/pull/8575

r? `@flip1995`

2 years agoRollup merge of #95270 - michaelwoerister:fix-box-unsized-debuginfo, r=wesleywiser
Dylan DPC [Fri, 25 Mar 2022 00:34:31 +0000 (01:34 +0100)]
Rollup merge of #95270 - michaelwoerister:fix-box-unsized-debuginfo, r=wesleywiser

debuginfo: Fix debuginfo for Box<T> where T is unsized.

Before this fix, the debuginfo for the fields was generated from the struct defintion of Box<T>, but (at least at the moment) the compiler pretends that Box<T> is just a (fat) pointer, so the fields need to be `pointer` and `vtable` instead of `__0: Unique<T>` and `__1: Allocator`.

This is meant as a temporary mitigation until we can make sure that simply treating Box as a regular struct in debuginfo does not cause too much breakage in the ecosystem.

r? ````@wesleywiser````

2 years agoRollup merge of #95179 - b-naber:eval-in-try-unify, r=lcnr
Dylan DPC [Fri, 25 Mar 2022 00:34:30 +0000 (01:34 +0100)]
Rollup merge of #95179 - b-naber:eval-in-try-unify, r=lcnr

Try to evaluate in try unify and postpone resolution of constants that contain inference variables

We want code like that in [`ui/const-generics/generic_const_exprs/eval-try-unify.rs`](https://github.com/rust-lang/rust/compare/master...b-naber:eval-in-try-unify?expand=1#diff-8027038201cf07a6c96abf3cbf0b0f4fdd8a64ce6292435f01c8ed995b87fe9b) to compile. To do that we need to try to evaluate constants in `try_unify_abstract_consts`, this requires us to be more careful about what constants we try to resolve, specifically we cannot try to resolve constants that still contain inference variables.

r? `@lcnr`

2 years agoRollup merge of #94655 - JakobDegen:mir-phase-docs, r=oli-obk
Dylan DPC [Fri, 25 Mar 2022 00:34:29 +0000 (01:34 +0100)]
Rollup merge of #94655 - JakobDegen:mir-phase-docs, r=oli-obk

Clarify which kinds of MIR are allowed during which phases.

This enhances documentation with these details and extends the validator to check these requirements more thoroughly. Most of these conditions were already being checked.

There was also some disagreement between the `MirPhase` docs and validator as to what it meant for the `body.phase` field to have a certain value. This PR resolves those disagreements in favor of the `MirPhase` docs (which is what the pass manager implemented), adjusting the validator accordingly. The result is now that the `DropLowering` phase begins with the end of the elaborate drops pass, and lasts until the beginning of the generator lowring pass. This doesn't feel entirely natural to me, but as long as it's documented accurately it should be ok.

r? rust-lang/mir-opt

2 years agoRollup merge of #94391 - light4:issue-90319, r=estebank
Dylan DPC [Fri, 25 Mar 2022 00:34:28 +0000 (01:34 +0100)]
Rollup merge of #94391 - light4:issue-90319, r=estebank

Fix ice when error reporting recursion errors

Fixes: #90319, #92148, #93955
2 years agoresolve: Rename `CrateLint` to `Finalize`
Vadim Petrochenkov [Wed, 23 Mar 2022 23:55:22 +0000 (02:55 +0300)]
resolve: Rename `CrateLint` to `Finalize`

And `crate_lint`/`record_used` to `finalize`

2 years agoresolve: Stop passing unused spans and node ids to path resolution functions
Vadim Petrochenkov [Wed, 23 Mar 2022 21:32:00 +0000 (00:32 +0300)]
resolve: Stop passing unused spans and node ids to path resolution functions

2 years agoresolve: Optimize path resolution for rustdoc
Vadim Petrochenkov [Wed, 23 Mar 2022 21:03:12 +0000 (00:03 +0300)]
resolve: Optimize path resolution for rustdoc

Do not construct or pass unused data

2 years agoresolve: Do not build expensive suggestions if they are not actually used
Vadim Petrochenkov [Wed, 23 Mar 2022 19:47:19 +0000 (22:47 +0300)]
resolve: Do not build expensive suggestions if they are not actually used

Also remove a redundant parameter from `fn resolve_path(_with_ribs)`, `crate_lint: CrateLint` is a more detailed version of `record_used: bool` with `CrateLint::No` meaning `false` and anything else meaning `true`.

2 years agoAuto merge of #95273 - flip1995:clippyup, r=manishearth
bors [Thu, 24 Mar 2022 22:52:34 +0000 (22:52 +0000)]
Auto merge of #95273 - flip1995:clippyup, r=manishearth

Update Clippy

r? `@Manishearth`

2 years agoImplement impl_subject_and_oblig instead of repeating the impls
Santiago Pastorino [Thu, 24 Mar 2022 21:41:30 +0000 (18:41 -0300)]
Implement impl_subject_and_oblig instead of repeating the impls

2 years agoWhere bounds are checked on inherent impls
Santiago Pastorino [Thu, 24 Mar 2022 20:47:10 +0000 (17:47 -0300)]
Where bounds are checked on inherent impls

2 years agoAuto merge of #94934 - Lireer:const-prop-lint, r=oli-obk
bors [Thu, 24 Mar 2022 20:22:27 +0000 (20:22 +0000)]
Auto merge of #94934 - Lireer:const-prop-lint, r=oli-obk

Separate const prop lints from optimizations

r? `@oli-obk`

Separates lints and optimizations during const prop by moving the lints into their own file and checking them during post borrowck cleanup.
Thanks to `@oli-obk` for mentoring me.

2 years agoSwap DtorckConstraint to DropckConstraint
InfRandomness [Thu, 24 Mar 2022 18:21:41 +0000 (19:21 +0100)]
Swap DtorckConstraint to DropckConstraint

This change was made as per suspicion that this struct was never renamed after consistent use of DropCk.

This also clarifies the meaning behind the name of this structure.

2 years agoupdate Miri
Ralf Jung [Thu, 24 Mar 2022 19:05:27 +0000 (15:05 -0400)]
update Miri

2 years agoFix ice when error reporting recursion errors
lightning1141 [Sat, 26 Feb 2022 03:55:07 +0000 (11:55 +0800)]
Fix ice when error reporting recursion errors

Fixes: #90319, #92148, #93955
2 years agoAuto merge of #94517 - aDotInTheVoid:inline_wrapping_next_power_two, r=yaahc
bors [Thu, 24 Mar 2022 17:32:40 +0000 (17:32 +0000)]
Auto merge of #94517 - aDotInTheVoid:inline_wrapping_next_power_two, r=yaahc

Mark `uint::wrapping_next_power_of_two` as `#[inline]`

This brings it in line with `next_power_of_two` and `checked_next_power_of_two`

https://godbolt.org/z/Tr18GnqKj

<details>
<summary> Output as of `rustc 1.61.0-nightly (4ce374923 2022-02-28)` </summary>

```asm
example::npot:
        lea     eax, [rdi - 1]
        movzx   eax, al
        lzcnt   ecx, eax
        add     ecx, -24
        mov     al, -1
        shr     al, cl
        inc     al
        cmp     dil, 2
        movzx   ecx, al
        mov     eax, 1
        cmovae  eax, ecx
        ret

example::cnpot:
        lea     eax, [rdi - 1]
        movzx   eax, al
        lzcnt   ecx, eax
        add     ecx, -24
        mov     al, -1
        shr     al, cl
        xor     ecx, ecx
        cmp     dil, 2
        movzx   edx, al
        cmovb   edx, ecx
        inc     dl
        setne   al
        ret

example::wrapping_next_power_of_two:
        jmp     qword ptr [rip + _ZN4core3num20_$LT$impl$u20$u8$GT$26wrapping_next_power_of_two17hd879a85055735264E@GOTPCREL]
```

</details>

2 years agoadd diagnostic items for clippy's
Max Baumann [Thu, 24 Mar 2022 16:05:47 +0000 (17:05 +0100)]
add diagnostic items for clippy's

2 years agoNormalize both trait and inherent
Santiago Pastorino [Thu, 24 Mar 2022 17:17:54 +0000 (14:17 -0300)]
Normalize both trait and inherent

2 years agoExtract impl_subject_and_oglibations fn and make equate receive subjects
Santiago Pastorino [Thu, 24 Mar 2022 15:27:09 +0000 (12:27 -0300)]
Extract impl_subject_and_oglibations fn and make equate receive subjects

2 years agoMerge commit 'd0cf3481a84e3aa68c2f185c460e282af36ebc42' into clippyup
flip1995 [Thu, 24 Mar 2022 13:50:04 +0000 (14:50 +0100)]
Merge commit 'd0cf3481a84e3aa68c2f185c460e282af36ebc42' into clippyup

2 years agoAuto merge of #8580 - flip1995:rustup, r=flip1995
bors [Thu, 24 Mar 2022 13:29:13 +0000 (13:29 +0000)]
Auto merge of #8580 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

Nice small sync with only typo fixes

changelog: none

2 years agoBump nightly version -> 2022-03-24
flip1995 [Thu, 24 Mar 2022 13:22:43 +0000 (14:22 +0100)]
Bump nightly version -> 2022-03-24

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 24 Mar 2022 13:13:37 +0000 (14:13 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #8579 - yoav-lavi:squashed-master, r=flip1995
bors [Thu, 24 Mar 2022 12:57:08 +0000 (12:57 +0000)]
Auto merge of #8579 - yoav-lavi:squashed-master, r=flip1995

`unnecessary_join` lint

changelog: Adds a lint called ``[`unnecessary_join`]`` that detects cases of `.collect::<Vec<String>>.join("")` or `.collect::<Vec<_>>.join("")` on an iterator, suggesting `.collect::<String>()` instead

Fixes: https://github.com/rust-lang/rust-clippy/issues/8570
This is a reopen of https://github.com/rust-lang/rust-clippy/pull/8573

changelog: add lint [`unnecessary_join`]

2 years agoAuto merge of #94876 - b-naber:thir-abstract-const-changes, r=lcnr
bors [Thu, 24 Mar 2022 12:50:00 +0000 (12:50 +0000)]
Auto merge of #94876 - b-naber:thir-abstract-const-changes, r=lcnr

Change Thir to lazily create constants

To allow `AbstractConst`s to work with the previous thir changes we made and those we want to make, i.e. to avoid problems due to `ValTree` and `ConstValue` conversions, we instead switch to a thir representation for constants that allows us to lazily create constants.

r? `@oli-obk`

2 years ago`unnecessary_join` lint
Yoav Lavi [Thu, 24 Mar 2022 12:18:18 +0000 (13:18 +0100)]
`unnecessary_join` lint

2 years agoupdate clippy stderr file
Oli Scherer [Thu, 24 Mar 2022 11:27:07 +0000 (11:27 +0000)]
update clippy stderr file

2 years agoAuto merge of #91030 - estebank:trait-bounds-are-tricky-2, r=oli-obk
bors [Thu, 24 Mar 2022 10:24:54 +0000 (10:24 +0000)]
Auto merge of #91030 - estebank:trait-bounds-are-tricky-2, r=oli-obk

Properly track `ImplObligations`

Instead of probing for all possible `impl`s that could have caused an
`ImplObligation`, keep track of its `DefId` and obligation spans for
accurate error reporting.

Follow to #89580. Addresses #89418.

2 years agodebuginfo: Fix debuginfo for Box<T> where T is unsized.
Michael Woerister [Thu, 24 Mar 2022 09:59:28 +0000 (10:59 +0100)]
debuginfo: Fix debuginfo for Box<T> where T is unsized.

Before this fix, the debuginfo for the fields was generated from the
struct defintion of Box<T>, but (at least at the moment) the compiler
pretends that Box<T> is just a (fat) pointer, so the fields need to be
`pointer` and `vtable` instead of `__0: Unique<T>` and `__1: Allocator`.

This is meant as a temporary mitigation until we can make sure that
simply treating Box as a regular struct in debuginfo does not cause too
much breakage in the ecosystem.

2 years agoAuto merge of #95233 - compiler-errors:chalk-up, r=jackh726
bors [Thu, 24 Mar 2022 06:05:30 +0000 (06:05 +0000)]
Auto merge of #95233 - compiler-errors:chalk-up, r=jackh726

Upgrade chalk to `0.80.0`

r? `@jackh726`

2 years agomake rustc work again
Michael Goulet [Thu, 24 Mar 2022 04:52:17 +0000 (21:52 -0700)]
make rustc work again

2 years agoProperly track `ImplObligation`s
Esteban Kuber [Wed, 13 Oct 2021 13:58:41 +0000 (13:58 +0000)]
Properly track `ImplObligation`s

Instead of probing for all possible impls that could have caused an
`ImplObligation`, keep track of its `DefId` and obligation spans for
accurate error reporting.

Follow up to #89580. Addresses #89418.

Remove some unnecessary clones.

Tweak output for auto trait impl obligations.

2 years agoAuto merge of #87667 - the8472:document-in-place-iter, r=yaahc
bors [Thu, 24 Mar 2022 01:43:21 +0000 (01:43 +0000)]
Auto merge of #87667 - the8472:document-in-place-iter, r=yaahc

add module-level documentation for vec's in-place iteration

As requested in the last libs team meeting and during previous reviews.

Feel free to point out any gaps you encounter, after all non-obvious things may with hindsight seem obvious to me.

r? `@yaahc`

CC `@steffahn`

2 years agoAuto merge of #95250 - matthiaskrgr:rollup-ma4zl69, r=matthiaskrgr
bors [Wed, 23 Mar 2022 23:02:17 +0000 (23:02 +0000)]
Auto merge of #95250 - matthiaskrgr:rollup-ma4zl69, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #94249 (Better errors when a Copy impl on a Struct is not self-consistent)
 - #95069 (Fix auto traits in rustdoc)
 - #95221 (interpret/memory: simplify check_and_deref_ptr)
 - #95225 (remove `[async output]` from `impl Future` pretty-printing)
 - #95238 (Stop emitting E0026 for struct enums with underscores)

Failed merges:

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

2 years agoClarify more MIR docs
Jakob Degen [Sun, 6 Mar 2022 20:53:23 +0000 (15:53 -0500)]
Clarify more MIR docs

2 years agoClarify which kinds of MIR are allowed during which phases.
Jakob Degen [Sun, 6 Mar 2022 01:37:04 +0000 (20:37 -0500)]
Clarify which kinds of MIR are allowed during which phases.

This enhances documentation with these details and extends the validator to check these requirements
more thoroughly. As a part of this, we add a new `Deaggregated` phase, and rename other phases so
that their names more naturally correspond to what they represent.

2 years agoRollup merge of #95238 - TaKO8Ki:stop-emitting-E0026-for-struct-enum-with-underscore...
Matthias Krüger [Wed, 23 Mar 2022 21:13:26 +0000 (22:13 +0100)]
Rollup merge of #95238 - TaKO8Ki:stop-emitting-E0026-for-struct-enum-with-underscore, r=estebank

Stop emitting E0026 for struct enums with underscores

This patch resolves a part of #83263;

r? `@estebank`

2 years agoRollup merge of #95225 - compiler-errors:impl-future-generator-ty, r=oli-obk
Matthias Krüger [Wed, 23 Mar 2022 21:13:25 +0000 (22:13 +0100)]
Rollup merge of #95225 - compiler-errors:impl-future-generator-ty, r=oli-obk

remove `[async output]` from `impl Future` pretty-printing

self-explanatory, guess it's not as helpful as I thought when I added it 4 months ago
re https://github.com/rust-lang/rust/issues/95089#issuecomment-1075482851

2 years agoRollup merge of #95221 - RalfJung:check_and_deref_ptr, r=oli-obk
Matthias Krüger [Wed, 23 Mar 2022 21:13:24 +0000 (22:13 +0100)]
Rollup merge of #95221 - RalfJung:check_and_deref_ptr, r=oli-obk

interpret/memory: simplify check_and_deref_ptr

*Finally* I saw a way to make this code simpler. The odd preprocessing in `let ptr_or_addr =` has bothered me since forever, but it actually became unnecessary in the last provenance refactoring. :)

This also leads to slightly more explicit error messages as a nice side-effect. :tada:

r? `@oli-obk`

2 years agoRollup merge of #95069 - GuillaumeGomez:auto-traits-rustdoc, r=oli-obk
Matthias Krüger [Wed, 23 Mar 2022 21:13:23 +0000 (22:13 +0100)]
Rollup merge of #95069 - GuillaumeGomez:auto-traits-rustdoc, r=oli-obk

Fix auto traits in rustdoc

Fixes #90324.

cc `@matthewjasper`
r? `@Aaron1011`

2 years agoRollup merge of #94249 - compiler-errors:better-copy-errors, r=davidtwco
Matthias Krüger [Wed, 23 Mar 2022 21:13:22 +0000 (22:13 +0100)]
Rollup merge of #94249 - compiler-errors:better-copy-errors, r=davidtwco

Better errors when a Copy impl on a Struct is not self-consistent

As discovered in a Zulip thread with `@nnethercote` and `@Mark-Simulacrum,` it's not immediately obvious why a field on an ADT doesn't implement `Copy`.  This PR attempts to give slightly more detailed information by spinning up a fulfillment context to try to dig down and discover transitive fulfillment errors that cause `is_copy_modulo_regions` to fail on a ADT field.

The error message still kinda sucks, but should only show up in the case that an existing error message was totally missing... so I think it's a good compromise for now?

2 years agoAuto merge of #95247 - cuviper:llvm14, r=nikic
bors [Wed, 23 Mar 2022 20:18:53 +0000 (20:18 +0000)]
Auto merge of #95247 - cuviper:llvm14, r=nikic

Update to LLVM 14.0.0 final

This is a simple rebase of the submodule onto the `llvmorg-14.0.0` release tag.

r? `@nikic`

2 years agofix some links, clarify documentation based on review feedback
The 8472 [Wed, 23 Mar 2022 19:57:49 +0000 (20:57 +0100)]
fix some links, clarify documentation based on review feedback

2 years agodont use a query for lit_to_constant
b-naber [Wed, 23 Mar 2022 18:41:35 +0000 (19:41 +0100)]
dont use a query for lit_to_constant

2 years agoUpdate to LLVM 14.0.0 final
Josh Stone [Wed, 23 Mar 2022 18:42:13 +0000 (11:42 -0700)]
Update to LLVM 14.0.0 final

2 years agoAddress rebase fallout
Oli Scherer [Wed, 23 Mar 2022 17:01:04 +0000 (17:01 +0000)]
Address rebase fallout

2 years agoAuto merge of #95220 - rust-lang:notriddle/ast-validation-semicolon, r=Dylan-DPC
bors [Wed, 23 Mar 2022 16:53:47 +0000 (16:53 +0000)]
Auto merge of #95220 - rust-lang:notriddle/ast-validation-semicolon, r=Dylan-DPC

diagnostics: do not suggest `fn foo({ <body> }`

Instead of suggesting that the body always replace the last character on the line, presuming it must be a semicolon, the parser should instead check what the last character is, and append the body if it is anything else.

Fixes #83104

2 years agoUpdate allocation id
Oli Scherer [Tue, 15 Mar 2022 16:30:54 +0000 (16:30 +0000)]
Update allocation id

2 years agoRemove line instead of just commenting out
Carl Scherer [Mon, 14 Mar 2022 16:26:09 +0000 (17:26 +0100)]
Remove line instead of just commenting out

Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2 years agoremove optimizations from const_prop_lint
Carl Scherer [Fri, 11 Mar 2022 14:52:58 +0000 (14:52 +0000)]
remove optimizations from const_prop_lint

2 years agoseparate const prop lint from optimizations
Carl Scherer [Tue, 8 Mar 2022 17:20:31 +0000 (17:20 +0000)]
separate const prop lint from optimizations

2 years agoAuto merge of #94901 - fee1-dead:destructable, r=oli-obk
bors [Wed, 23 Mar 2022 14:04:38 +0000 (14:04 +0000)]
Auto merge of #94901 - fee1-dead:destructable, r=oli-obk

Rename `~const Drop` to `~const Destruct`

r? `@oli-obk`

Completely switching to `~const Destructible` would be rather complicated, so it seems best to add it for now and wait for it to be backported to beta in the next release.

The rationale is to prevent complications such as #92149 and #94803 by introducing an entirely new trait. And `~const Destructible` reads a bit better than `~const Drop`. Name Bikesheddable.

2 years agostop emitting E0026 for struct enums with underscores
Takayuki Maeda [Wed, 23 Mar 2022 13:54:02 +0000 (22:54 +0900)]
stop emitting E0026 for struct enums with underscores

2 years agoAuto merge of #95235 - asquared31415:ptr_eq_typo, r=Dylan-DPC
bors [Wed, 23 Mar 2022 11:21:04 +0000 (11:21 +0000)]
Auto merge of #95235 - asquared31415:ptr_eq_typo, r=Dylan-DPC

Fix `core::ptr::guaranteed_eq` and `guaranteed_ne` docs typo

2 years agoadd test for treating ExprKind::ConstParam as temp
b-naber [Wed, 23 Mar 2022 07:54:07 +0000 (08:54 +0100)]
add test for treating ExprKind::ConstParam as temp

2 years agouse NonHirLiteral instead of ScalarLiteral, move pattern related code to pat_is_poly...
b-naber [Wed, 23 Mar 2022 07:47:11 +0000 (08:47 +0100)]
use NonHirLiteral instead of ScalarLiteral, move pattern related code to pat_is_poly in IsThirPolymorphic

2 years agomove ExprKind::Repeat arm to expr_is_poly
b-naber [Wed, 16 Mar 2022 08:25:17 +0000 (09:25 +0100)]
move ExprKind::Repeat arm to expr_is_poly

2 years agouse ParamConst in ExprKind::ConstParam
b-naber [Tue, 15 Mar 2022 15:32:40 +0000 (16:32 +0100)]
use ParamConst in ExprKind::ConstParam

2 years agoremove thir::Visitor::visit_const
b-naber [Tue, 15 Mar 2022 15:20:46 +0000 (16:20 +0100)]
remove thir::Visitor::visit_const

2 years agochange thir to lazily create constants
b-naber [Fri, 11 Mar 2022 11:07:53 +0000 (12:07 +0100)]
change thir to lazily create constants

2 years agoAuto merge of #95232 - lnicola:rust-analyzer-2022-03-23, r=lnicola
bors [Wed, 23 Mar 2022 08:54:31 +0000 (08:54 +0000)]
Auto merge of #95232 - lnicola:rust-analyzer-2022-03-23, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoptr::guaranteed_eq doc typo
asquared31415 [Wed, 23 Mar 2022 08:21:50 +0000 (04:21 -0400)]
ptr::guaranteed_eq doc typo

2 years agoupgrade chalk
Michael Goulet [Wed, 23 Mar 2022 06:39:11 +0000 (23:39 -0700)]
upgrade chalk

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Wed, 23 Mar 2022 06:24:14 +0000 (08:24 +0200)]
:arrow_up: rust-analyzer

2 years agoAuto merge of #95173 - m-ou-se:sys-locks-module, r=dtolnay
bors [Wed, 23 Mar 2022 06:01:48 +0000 (06:01 +0000)]
Auto merge of #95173 - m-ou-se:sys-locks-module, r=dtolnay

Move std::sys::{mutex, condvar, rwlock} to std::sys::locks.

This cleans up the the std::sys modules a bit by putting the locks in a single module called `locks` rather than spread over the three modules `mutex`, `condvar`, and `rwlock`. This makes it easier to organise lock implementations, which helps with https://github.com/rust-lang/rust/issues/93740.

2 years agoAuto merge of #95223 - Dylan-DPC:rollup-idpb7ka, r=Dylan-DPC
bors [Wed, 23 Mar 2022 03:31:20 +0000 (03:31 +0000)]
Auto merge of #95223 - Dylan-DPC:rollup-idpb7ka, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #91608 (Fold aarch64 feature +fp into +neon)
 - #92955 (add perf side effect docs to `Iterator::cloned()`)
 - #94713 (Add u16::is_utf16_surrogate)
 - #95212 (Replace `this.clone()` with `this.create_snapshot_for_diagnostic()`)
 - #95219 (Modernize `alloc-no-oom-handling` test)
 - #95222 (interpret/validity: improve clarity)

Failed merges:

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

2 years agoAdd a size assertion for `NamedMatchVec`.
Nicholas Nethercote [Wed, 23 Mar 2022 00:44:13 +0000 (11:44 +1100)]
Add a size assertion for `NamedMatchVec`.

2 years agoremove [async output] from impl Future
Michael Goulet [Wed, 23 Mar 2022 02:25:43 +0000 (19:25 -0700)]
remove [async output] from impl Future

2 years agobless 32bit
Ralf Jung [Wed, 23 Mar 2022 02:19:50 +0000 (22:19 -0400)]
bless 32bit

2 years agoRollup merge of #95222 - RalfJung:validity, r=Dylan-DPC
Dylan DPC [Wed, 23 Mar 2022 02:05:34 +0000 (03:05 +0100)]
Rollup merge of #95222 - RalfJung:validity, r=Dylan-DPC

interpret/validity: improve clarity

I was confused by my own (ancient) comment in `validity.rs` so I figured I'd clarify. (And I don't think ZST-ness is relevant at all inside that branch, no idea where that comment comes from.)

Also `extend` seems more clear than `clone_from`.

2 years agoRollup merge of #95219 - ojeda:update-alloc-no-oom-handling-test, r=Dylan-DPC
Dylan DPC [Wed, 23 Mar 2022 02:05:33 +0000 (03:05 +0100)]
Rollup merge of #95219 - ojeda:update-alloc-no-oom-handling-test, r=Dylan-DPC

Modernize `alloc-no-oom-handling` test

  - The edition should be 2021 to avoid warnings.

  - The `external_crate` feature was removed in commit 45bf1ed1a112 ("rustc: Allow changing the default allocator").

    Note that commit d620ae10709c ("Auto merge of #84266") removed the old test, but the new one introduced passed the `--cfg` like in the old one.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---

This is intended to align this test to the new `no_rc` and `no_sync` ones being added in https://github.com/rust-lang/rust/pull/89891, but it makes sense on its own too.

2 years agoRollup merge of #95212 - TaKO8Ki:replace-this-clone-with-this-create-snapshot-for...
Dylan DPC [Wed, 23 Mar 2022 02:05:32 +0000 (03:05 +0100)]
Rollup merge of #95212 - TaKO8Ki:replace-this-clone-with-this-create-snapshot-for-diagnostic, r=Dylan-DPC

Replace `this.clone()` with `this.create_snapshot_for_diagnostic()`

Use [`create_snapshot_for_diagnostic`](https://github.com/rust-lang/rust/blob/cd119057160cedea245aa2679add56723f3dc784/compiler/rustc_parse/src/parser/diagnostics.rs#L214-L223) I implemented in https://github.com/rust-lang/rust/pull/94731 instead of `this.clone()` to avoid duplicate errors about unclosed delims being emitted when the `Parser` is dropped.

2 years agoRollup merge of #94713 - clarfonthey:is_char_surrogate, r=scottmcm
Dylan DPC [Wed, 23 Mar 2022 02:05:31 +0000 (03:05 +0100)]
Rollup merge of #94713 - clarfonthey:is_char_surrogate, r=scottmcm

Add u16::is_utf16_surrogate

Right now, there are methods in the standard library for encoding and decoding UTF-16, but at least for the moment, there aren't any methods specifically for `u16` to help work with UTF-16 data. Since the full logic already exists, this wouldn't really add any code, just expose what's already there.

This method in particular is useful for working with the data returned by Windows `OsStrExt::encode_wide`. Initially, I was planning to also offer a `TryFrom<u16> for char`, but decided against it for now. There is plenty of code in rustc that could be rewritten to use this method, but I only checked within the standard library to replace them.

I think that offering more UTF-16-related methods to u16 would be useful, but I think this one is a good start. For example, one useful method might be `u16::is_pattern_whitespace`, which would check if something is the Unicode `Pattern_Whitespace` category. We can get away with this because all of the `Pattern_Whitespace` characters are in the basic multilingual plane, and hence we don't need to check for surrogates.

2 years agoRollup merge of #92955 - llogiq:cloned-side-effect-doc, r=yaahc
Dylan DPC [Wed, 23 Mar 2022 02:05:28 +0000 (03:05 +0100)]
Rollup merge of #92955 - llogiq:cloned-side-effect-doc, r=yaahc

add perf side effect docs to `Iterator::cloned()`

Now that #90209 has been closed, as the current state of affairs is neither here nor there, this at least adds a paragraph + example on what to expect performance-wise and how to deal with it to the .cloned() docs.

cc `@the8472`

2 years agoRollup merge of #91608 - workingjubilee:fold-neon-fp, r=nagisa,Amanieu
Dylan DPC [Wed, 23 Mar 2022 02:05:28 +0000 (03:05 +0100)]
Rollup merge of #91608 - workingjubilee:fold-neon-fp, r=nagisa,Amanieu

Fold aarch64 feature +fp into +neon

Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64:
The Neon unit, which handles both floating point and SIMD instructions.
Moreover, a configuration for AArch64 must include both or neither.
Arm says "entirely proprietary" toolchains may omit floating point:
https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point
In the Programmer's Guide for Armv8-A, Arm says AArch64 can have
both FP and Neon or neither in custom implementations:
https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON

In "Bare metal boot code for Armv8-A", enabling Neon and FP
is just disabling the same trap flag:
https://developer.arm.com/documentation/dai0527/a

In an unlikely future where "Neon and FP" become unrelated,
we can add "[+-]fp" as its own feature flag.
Until then, we can simplify programming with Rust on AArch64 by
folding both into "[+-]neon", which is valid as it supersets both.

"[+-]neon" is retained for niche uses such as firmware, kernels,
"I just hate floats", and so on.

I am... pretty sure no one is relying on this.

An argument could be made that, as we are not an "entirely proprietary" toolchain, we should not support AArch64 without floats at all. I think that's a bit excessive. However, I want to recognize the intent: programming for AArch64 should be simplified where possible. For x86-64, programmers regularly set up illegal feature configurations because it's hard to understand them, see https://github.com/rust-lang/rust/issues/89586. And per the above notes, plus the discussion in https://github.com/rust-lang/rust/issues/86941, there should be no real use cases for leaving these features split: the two should in fact always go together.

- Fixes rust-lang/rust#95002.
- Fixes rust-lang/rust#95064.
- Fixes rust-lang/rust#95122.

2 years agoFixup aarch64 smoke test
Jubilee Young [Wed, 23 Mar 2022 01:11:21 +0000 (18:11 -0700)]
Fixup aarch64 smoke test

2 years agobetter errors when a Copy impl is not coherent
Michael Goulet [Tue, 22 Feb 2022 05:26:37 +0000 (21:26 -0800)]
better errors when a Copy impl is not coherent

2 years agoAuto merge of #95088 - bjorn3:fix_test_variadic_fnptr, r=dtolnay
bors [Wed, 23 Mar 2022 00:50:33 +0000 (00:50 +0000)]
Auto merge of #95088 - bjorn3:fix_test_variadic_fnptr, r=dtolnay

Don't declare test_variadic_fnptr with two conflicting signatures

It is UB for LLVM and results in a compile error for Cranelift.

cc https://github.com/bjorn3/rustc_codegen_cranelift/issues/806
Fixes https://github.com/rust-lang/rust/issues/66690

2 years agointerpret/memory: simplify check_and_deref_ptr
Ralf Jung [Tue, 22 Mar 2022 22:58:54 +0000 (18:58 -0400)]
interpret/memory: simplify check_and_deref_ptr

2 years agointerpret/validity: improve clarity
Ralf Jung [Tue, 22 Mar 2022 22:58:23 +0000 (18:58 -0400)]
interpret/validity: improve clarity

2 years agoTest SVE2 includes NEON and not vice versa
Jubilee Young [Tue, 22 Mar 2022 22:03:59 +0000 (15:03 -0700)]
Test SVE2 includes NEON and not vice versa

Required by https://github.com/rust-lang/rust/issues/95122

2 years agodiagnostics: do not suggest `fn foo({ <body> }`
Michael Howell [Tue, 22 Mar 2022 22:29:07 +0000 (15:29 -0700)]
diagnostics: do not suggest `fn foo({ <body> }`

Instead of suggesting that the body always replace the last character on the
line, presuming it must be a semicolon, the parser should instead check what
the last character is, and append the body if it is anything else.

Fixes #83104

2 years agoTest NEON compiles
Jubilee Young [Tue, 22 Mar 2022 21:24:59 +0000 (14:24 -0700)]
Test NEON compiles

Required by https://github.com/rust-lang/rust/issues/95002

2 years agoFilter for all features instead of any
Jubilee Young [Sun, 20 Mar 2022 02:36:42 +0000 (19:36 -0700)]
Filter for all features instead of any

Adds regression tests for feature logic
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
Co-authored-by: Simonas Kazlauskas <git@kazlauskas.me>
2 years agoFold aarch64 feature +fp into +neon
Jubilee Young [Sat, 4 Dec 2021 01:56:59 +0000 (17:56 -0800)]
Fold aarch64 feature +fp into +neon

Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64:
The Neon unit, which handles both floating point and SIMD instructions.
Moreover, a configuration for AArch64 must include both or neither.
Arm says "entirely proprietary" toolchains may omit floating point:
https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point
In the Programmer's Guide for Armv8-A, Arm says AArch64 can have
both FP and Neon or neither in custom implementations:
https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON

In "Bare metal boot code for Armv8-A", enabling Neon and FP
is just disabling the same trap flag:
https://developer.arm.com/documentation/dai0527/a

In an unlikely future where "Neon and FP" become unrelated,
we can add "[+-]fp" as its own feature flag.
Until then, we can simplify programming with Rust on AArch64 by
folding both into "[+-]neon", which is valid as it supersets both.

"[+-]neon" is retained for niche uses such as firmware, kernels,
"I just hate floats", and so on.

2 years agoAuto merge of #95159 - nnethercote:TtParser, r=petrochenkov
bors [Tue, 22 Mar 2022 21:46:57 +0000 (21:46 +0000)]
Auto merge of #95159 - nnethercote:TtParser, r=petrochenkov

Introduce `TtParser`

These commits make a number of changes to declarative macro expansion, resulting in code that is shorter, simpler, and faster.

Best reviewed one commit at a time.

r? `@petrochenkov`

2 years agoLimit test_variadic_fnptr to unix
bjorn3 [Tue, 22 Mar 2022 21:27:13 +0000 (22:27 +0100)]
Limit test_variadic_fnptr to unix