Commit Graph

197264 Commits

Author SHA1 Message Date
Dylan DPC
d910e5376b
Rollup merge of #100221 - compiler-errors:impossible-trait-items, r=lcnr,notriddle,camelid
Don't document impossible to call default trait items on impls

Closes #100176

This only skips documenting _default_ trait items on impls, not ones that are written inside the impl block. This is a conservative approach, since I think we should document all items written in an impl block (I guess unless hidden or whatever), but the existence of this new query I added makes this easy to extend to other rustdoc cases.
2022-08-09 17:34:54 +05:30
Dylan DPC
7efe24c3ed
Rollup merge of #100181 - RalfJung:alloc-ref-mutability, r=jackh726
add method to get the mutability of an AllocId

Miri needs this for https://github.com/rust-lang/miri/issues/2463.
2022-08-09 17:34:52 +05:30
Dylan DPC
e41be25f06
Rollup merge of #99787 - aDotInTheVoid:rdj-dyn, r=camelid,notriddle,GuillaumeGomez
Rustdoc-Json: Document HRTB's on DynTrait

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

Probably best reviewed commit by commit.

`@rustbot` modify labels: +A-rustdoc-json

cc `@Enselic`

r? `@CraftSpider`
2022-08-09 17:34:51 +05:30
Dylan DPC
1dc4858914
Rollup merge of #96478 - WaffleLapkin:rustc_default_body_unstable, r=Aaron1011
Implement `#[rustc_default_body_unstable]`

This PR implements a new stability attribute — `#[rustc_default_body_unstable]`.

`#[rustc_default_body_unstable]` controls the stability of default bodies in traits.
For example:
```rust
pub trait Trait {
    #[rustc_default_body_unstable(feature = "feat", isssue = "none")]
    fn item() {}
}
```
In order to implement `Trait` user needs to either
- implement `item` (even though it has a default implementation)
- enable `#![feature(feat)]`

This is useful in conjunction with [`#[rustc_must_implement_one_of]`](https://github.com/rust-lang/rust/pull/92164), we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way — making implementation of only `PartialEq::ne` unstable.

r? `@Aaron1011`
cc `@nrc` (iirc you were interested in this wrt `read_buf`), `@danielhenrymantilla` (you were interested in the related `#[rustc_must_implement_one_of]`)
P.S. This is my first time working with stability attributes, so I'm not sure if I did everything right 😅
2022-08-09 17:34:50 +05:30
Kjetil Kjeka
22930b7b25 Remove logic related to deprecated nvptx-nvidia-cuda (32-bit) target 2022-08-09 13:29:18 +02:00
bors
cc4dd6fc9f Auto merge of #100089 - JakobDegen:no-invalidate-visitor, r=tmiasko
Add option to `mir::MutVisitor` to not invalidate CFG.

This also applies that option to some uses of the visitor. I had considered a design more similar to #100087 in which we detect if the CFG needs to be invalidated, but that is more difficult with the visitor API and so I decided against it. Another alternative to this design is to offer an API for "saving" and "restoring" CFG caches across arbitrary code. Such an API is more general, and so we may eventually want it anyway, but it seems overkill for this use case.

r? `@tmiasko`
2022-08-09 11:05:42 +00:00
lcnr
f25cb83296 don't normalize wf predicates
this allows us to soundly use unnormalized projections for wf
2022-08-09 12:54:32 +02:00
Nikita Popov
b2f247e1bd Explicitly disable zstd support
Make sure we don't pick up a libzstd.so dependency if it happens
to be installed on the system.
2022-08-09 12:39:59 +02:00
Nikita Popov
e77ec2f482 Fix coverage-llvmir test on Windows
@__llvm_profile_runtime is how an external hidden global.
2022-08-09 12:39:59 +02:00
Nikita Popov
1db81713f6 Link libatomic on 32-bit targets
This is needed since https://reviews.llvm.org/D128070.
2022-08-09 12:39:59 +02:00
Nikita Popov
89582e8193 Pass +atomics-32 feature for thumbv6m target
https://reviews.llvm.org/D120026 changed atomics on thumbv6m to
use libatomic, to ensure that atomic load/store are compatible with
atomic RMW/CAS. However, Rust wants to expose only load/store
without libcalls.

https://reviews.llvm.org/D130480 added support for this behind
the +atomics-32 target feature, so enable that feature.
2022-08-09 12:39:59 +02:00
Nikita Popov
9d97606193 Allow old toolchain on some images
LLVM 16 will require GCC >= 7.1. For now, set the flag that
allows using an older toolchain.
2022-08-09 12:39:59 +02:00
Nikita Popov
8c1f9d04e8 Update LLVM submodule 2022-08-09 12:39:59 +02:00
Michael Goulet
ca7e3c4a83 Keep going if normalized projection has unevaluated consts in QueryNormalizer 2022-08-09 09:41:28 +00:00
Mary
a725250806 Add support for link-flavor rust-lld for macOS
Also refactor iOS, watchOS and tvOS common code.
2022-08-09 11:04:48 +02:00
Jakob Degen
7547084ff6 Add option to mir::MutVisitor to not invalidate CFG.
This also applies that option to some uses of the visitor
2022-08-09 01:51:10 -07:00
bors
5af97e8b0b Auto merge of #100304 - matthiaskrgr:rollup-gs56vlw, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #100163 (Refactor: remove an unnecessary string search)
 - #100212 (Remove more Clean trait implementations)
 - #100238 (Further improve error message for E0081)
 - #100268 (Add regression test for #79148)
 - #100294 (Update Duration::as_secs doc to point to as_secs_f64/32 for including fractional part)
 - #100303 (⬆️ rust-analyzer)

Failed merges:

 - #100281 (Remove more Clean trait implementations)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-09 08:03:08 +00:00
Eric Huss
2462bd17a0 compiletest: Add warning and comment about running tests without RUSTC 2022-08-08 22:51:16 -07:00
Nicholas Nethercote
c32969d8e6 Move JSON tests into a directory.
To get around the "following path contains more than 968 entries, you
should move the test to some relevant subdirectory" tidy error.
2022-08-09 15:34:06 +10:00
Takayuki Maeda
56ec5bec1e suggest adding an appropriate missing pattern excluding comments 2022-08-09 14:27:26 +09:00
Matthias Krüger
cacd37ac3c
Rollup merge of #100303 - lnicola:rust-analyzer-2022-08-09, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-08-09 07:06:02 +02:00
Matthias Krüger
e20fabb6d5
Rollup merge of #100294 - theli-ua:master, r=thomcc
Update Duration::as_secs doc to point to as_secs_f64/32 for including fractional part

Rather than suggesting to calculate manually
2022-08-09 07:06:01 +02:00
Matthias Krüger
89835a018e
Rollup merge of #100268 - TaKO8Ki:add-regression-test-for-79148, r=Mark-Simulacrum
Add regression test for #79148

closes #79148
2022-08-09 07:05:59 +02:00
Matthias Krüger
d63d2bd67f
Rollup merge of #100238 - Bryysen:master, r=cjgillot
Further improve error message for E0081

Closes #97533
2022-08-09 07:05:58 +02:00
Matthias Krüger
65cc68b3fd
Rollup merge of #100212 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPC
Remove more Clean trait implementations

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? `@notriddle`
2022-08-09 07:05:56 +02:00
Matthias Krüger
a1829bbed0
Rollup merge of #100163 - TaKO8Ki:remove-unnecessary-string-search, r=wesleywiser
Refactor: remove an unnecessary string search
2022-08-09 07:05:55 +02:00
bors
8d1fa7105b Auto merge of #100205 - cjgillot:noice-doc, r=camelid
Avoid ICE in rustdoc when using `Fn` bounds

Fixes https://github.com/rust-lang/rust/issues/100143
2022-08-09 05:05:46 +00:00
Laurențiu Nicola
f1e801be71 ⬆️ rust-analyzer 2022-08-09 07:23:57 +03:00
bors
f7e2cb4470 Auto merge of #9308 - daxpedda:missing-const-for-fn, r=Jarcho
Use `check_proc_macro` for `missing_const_for_fn`

This uses `@Jarcho's` #8694 implementation to fix `missing_const_for_fn` linting in proc-macros.
I'm not 100% sure what I'm doing here, any feedback is appreciated.

Previously: https://github.com/Jarcho/rust-clippy/pull/1.
Fixes #8854.

changelog: [`missing_const_for_fn`]: No longer lints in proc-macros
2022-08-09 03:44:21 +00:00
Takayuki Maeda
abbd34d00e avoid &str to String conversions 2022-08-09 12:27:53 +09:00
dAxpeDDa
fd60581628
Address review take 2 2022-08-09 05:14:03 +02:00
dAxpeDDa
6f5d64842b
Address review 2022-08-09 04:56:04 +02:00
BlackHoleFox
0cf9503751 Replace pointer casting in hashmap_random_keys with safe code
The old code was unnecessarily unsafe and relied on the layout
of tuples always being the same as an array of the same size.
2022-08-08 18:49:17 -07:00
dAxpeDDa
8d4f2ac381
Use check_proc_macro for missing_const_for_fn 2022-08-09 03:41:59 +02:00
Anton Romanov
63be9a95b6 Update Duration::as_secs doc to point to as_secs_f64/32 for including fractional part
Rather than suggesting to calculate manually
2022-08-08 18:32:16 -07:00
bors
3af9072bc6 Auto merge of #9288 - lukaslueg:partialeqnone, r=Jarcho
Add partialeq_to_none lint

Initial implementation of #9275, adding lint `partialeq_to_none`. This is my first time working on `clippy`, so please review carefully.

I'm unsure especially about the `Sugg`, as it covers the entire `BinOp`, instead of just covering one of the sides and the operator (see the multi-line example). I was unsure if pinpointing the suggestion wouldn't be brittle...

changelog: [`PARTIALEQ_TO_NONE`]: Initial commit
2022-08-09 00:12:29 +00:00
Noah Lev
28e4b9e64e Add regression test comment 2022-08-08 14:09:55 -07:00
Josh Stone
013986be1b linux: Use pthread_setname_np instead of prctl
This function is available on Linux since glibc 2.12, musl 1.1.16, and
uClibc 1.0.20. The main advantage over `prctl` is that it properly
represents the pointer argument, rather than a multi-purpose `long`,
so we're better representing strict provenance (#95496).
2022-08-08 13:27:09 -07:00
Joshua Nelson
775c3c0493 Add x.sh and x.ps1 shell scripts
This is a more ambitious version of https://github.com/rust-lang/rust/pull/98716.
It still changes the shebang back to python3, for compatibility with non-Unix systems,
but also adds alternative entrypoints for systems without `python3` installed.

These scripts will be necessary for the rust entrypoint (#94829), so I see
little downside in adding them early.
2022-08-08 14:48:11 -05:00
Bryysen
74e71da547 Fix plural form of variant in error message not formatting correctly
due to ordering, added/improved comments and removed redundant test
already caught by `E0081.rs`
2022-08-08 21:34:55 +02:00
Camille GILLOT
eab3b05b62 Synthetize a trait ref when none is available. 2022-08-08 21:09:09 +02:00
Luqman Aden
75cc9cddf7 Add test for #100246. 2022-08-08 11:52:04 -07:00
Luqman Aden
fb8636fc48 Set tainted errors bit before emitting coerce suggestions. 2022-08-08 11:52:04 -07:00
Lukas Lueg
657b0da912 Add partialeq_to_none lint
Fixes #9275
2022-08-08 20:17:13 +02:00
bors
8f390610a5 Auto merge of #9306 - guerinoni:rename-logic-bug, r=llogiq,xFrednet
Rename `logic_bug` to `overly_complex_bool_expr`

Closes #1916

changelog: Rename `logic_bug` to [`overly_complex_bool_expr`]
2022-08-08 17:04:06 +00:00
Federico Guerinoni
f6cab94bd0 Rename logic_bug to overly_complex_bool_expr
Closes #1916
2022-08-08 18:38:39 +02:00
Guillaume Gomez
daa0e8fecc remove Clean trait implementation for hir::Generics 2022-08-08 17:48:17 +02:00
Guillaume Gomez
bed8e93f40 remove Clean trait implementation for hir::ImplItem 2022-08-08 17:25:38 +02:00
bors
4912c0ece4 Auto merge of #9126 - Jarcho:auto_deref_sugg, r=Manishearth
`explicit_auto_deref` changes

fixes #9123
fixes #9109
fixes #9143
fixes #9101

This avoid suggesting code which hits a rustc bug. Basically `&{x}` won't use auto-deref if the target type is `Sized`.

changelog: Don't suggest using auto deref for block expressions when the target type is `Sized`
changelog: Include the borrow in the suggestion for `explicit_auto_deref`
changelog: Don't lint `explicit_auto_deref` on `dyn Trait` return
changelog: Don't lint `explicit_auto_deref` when other adjustments are required
changelog: Lint `explicit_auto_deref` in implicit return positions for closures
2022-08-08 15:20:24 +00:00
Jason Newcomb
ecb51fe6a5 Lint explicit_auto_deref in implicit return positions for closures 2022-08-08 10:25:05 -04:00