Commit Graph

165419 Commits

Author SHA1 Message Date
bors
63b8f01bb5 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.
2022-03-24 20:22:27 +00:00
InfRandomness
645620b3b3 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.
2022-03-24 20:35:35 +01:00
Ralf Jung
189409bea9 update Miri 2022-03-24 15:05:35 -04:00
lightning1141
85e67b9a59
Fix ice when error reporting recursion errors
Fixes: #90319, #92148, #93955
2022-03-25 02:53:30 +08:00
bors
4b133a7e27 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>
2022-03-24 17:32:40 +00:00
Max Baumann
64ad96dd9a
add diagnostic items for clippy's 2022-03-24 18:18:44 +01:00
Santiago Pastorino
f4bd1e14bd
Normalize both trait and inherent 2022-03-24 14:17:54 -03:00
Santiago Pastorino
22b311bd82
Extract impl_subject_and_oglibations fn and make equate receive subjects 2022-03-24 12:44:06 -03:00
Jendrik
dcdde01aa3 add #[must_use] to functions of slice and its iterators. 2022-03-24 15:21:03 +01:00
flip1995
3365e9a120
Merge commit 'd0cf3481a84e3aa68c2f185c460e282af36ebc42' into clippyup 2022-03-24 14:50:04 +01:00
bors
d0cf3481a8 Auto merge of #8580 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

Nice small sync with only typo fixes

changelog: none
2022-03-24 13:29:13 +00:00
flip1995
c995a8b501
Bump nightly version -> 2022-03-24 2022-03-24 14:22:43 +01:00
flip1995
1147b2c481
Merge remote-tracking branch 'upstream/master' into rustup 2022-03-24 14:22:35 +01:00
bors
e29b3b55a4 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`]
2022-03-24 12:57:08 +00:00
bors
8d8135f003 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`
2022-03-24 12:50:00 +00:00
Yoav Lavi
b60a7fb7b6
unnecessary_join lint 2022-03-24 13:18:18 +01:00
Oli Scherer
440946af11 update clippy stderr file 2022-03-24 11:27:07 +00:00
bors
d2df372bca 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.
2022-03-24 10:24:54 +00:00
Michael Woerister
e169261a6f 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.
2022-03-24 11:12:41 +01:00
bors
600a80dedf Auto merge of #95233 - compiler-errors:chalk-up, r=jackh726
Upgrade chalk to `0.80.0`

r? `@jackh726`
2022-03-24 06:05:30 +00:00
Michael Goulet
376d100e74 make rustc work again 2022-03-23 21:52:17 -07:00
Esteban Kuber
5fd37862d9 Properly track ImplObligations
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.
2022-03-24 02:08:49 +00:00
bors
6970f88db3 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`
2022-03-24 01:43:21 +00:00
Thom Chiovoloni
09d83e292d
Add a compile_fail doctest to check that io::Error: !UnwindSafe 2022-03-23 17:29:19 -07:00
Thom Chiovoloni
b898ad499f
Ensure io::Error's bitpacked repr doesn't accidentally impl UnwindSafe 2022-03-23 17:12:47 -07:00
bors
37b55c8a0c 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
2022-03-23 23:02:17 +00:00
Jakob Degen
26d7b8ddb2 Clarify more MIR docs 2022-03-23 18:34:08 -04:00
Jakob Degen
fe40240e4d 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.
2022-03-23 18:34:08 -04:00
Matthias Krüger
fab7a6a9fd
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`
2022-03-23 22:13:26 +01:00
Matthias Krüger
1f346bd6a5
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
2022-03-23 22:13:25 +01:00
Matthias Krüger
23ef234bf7
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. 🎉

r? `@oli-obk`
2022-03-23 22:13:24 +01:00
Matthias Krüger
0c79c862f0
Rollup merge of #95069 - GuillaumeGomez:auto-traits-rustdoc, r=oli-obk
Fix auto traits in rustdoc

Fixes #90324.

cc `@matthewjasper`
r? `@Aaron1011`
2022-03-23 22:13:23 +01:00
Matthias Krüger
af19a50a26
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?
2022-03-23 22:13:22 +01:00
bors
9f4dc0b4db 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`
2022-03-23 20:18:53 +00:00
The 8472
29e29ce65d fix some links, clarify documentation based on review feedback 2022-03-23 20:57:49 +01:00
b-naber
19041d995d dont use a query for lit_to_constant 2022-03-23 20:18:34 +01:00
Andreas Molzer
d489ea777d Refactor set_ptr_value as with_metadata_of
By reversing the arguments we achieve several clarifications:

- The function closely resembles `cast` but with an argument to
  initialized the metadata. This is easier to teach and answers an long
  outstanding question that had restricted cast to `Sized` targets
  initially. See multiples reviews of
  <https://github.com/rust-lang/rust/pull/47631>
- The 'object identity', in the form or provenance, is now preserved
  from the call receiver to the result. This helps explain the method as
  a builder-style, instead of some kind of setter that would modify
  something in-place. Ensuring that the result has the identity of the
  `self` argument is also beneficial for an intuition of effects.
- An outstanding concern, 'Correct argument type', is avoided by not
  committing to any specific argument type. This is consistent with cast
  which does not require its receiver to be a raw address.
2022-03-23 19:59:37 +01:00
Josh Stone
cbe2216709 Update to LLVM 14.0.0 final 2022-03-23 11:42:13 -07:00
Oli Scherer
2dcf55d10d Address rebase fallout 2022-03-23 17:01:04 +00:00
bors
547369d3d8 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
2022-03-23 16:53:47 +00:00
Oli Scherer
c7efad044c Update allocation id 2022-03-23 16:50:42 +00:00
Carl Scherer
695c2e3e53 Remove line instead of just commenting out
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-03-23 16:50:42 +00:00
Carl Scherer
c2f9278b40 remove optimizations from const_prop_lint 2022-03-23 16:50:42 +00:00
Carl Scherer
5e4ff26618 separate const prop lint from optimizations 2022-03-23 16:50:41 +00:00
antoyo
a22e15b954
Merge pull request #143 from yvt/sysroot-profile
Add `--release-sysroot` flag to `build.sh`
2022-03-23 12:11:28 -04:00
yvt
842a5fba1c Add --release-sysroot flag to build.sh
When this flag is present, `build.sh` will pass `--release` to
`build_sysroot.sh`.
2022-03-23 23:18:33 +09:00
yvt
72306608e0 Add a simple argument parser to build.sh 2022-03-23 23:16:45 +09:00
bors
9280445570 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.
2022-03-23 14:04:38 +00:00
Takayuki Maeda
925857d8dc stop emitting E0026 for struct enums with underscores 2022-03-23 22:54:02 +09:00
bors
c99b42cf14 Auto merge of #95235 - asquared31415:ptr_eq_typo, r=Dylan-DPC
Fix `core::ptr::guaranteed_eq` and `guaranteed_ne` docs typo
2022-03-23 11:21:04 +00:00