Commit Graph

163875 Commits

Author SHA1 Message Date
Camille GILLOT 969f8735dc Bless test. 2022-03-03 18:22:31 +01:00
Camille GILLOT 71838827b6 Force ensure stability_index. 2022-03-03 18:22:31 +01:00
Camille GILLOT 6f8e9f416a Move query providers. 2022-03-03 18:22:31 +01:00
Camille GILLOT 1b4b5e066b Remove useless map. 2022-03-03 18:14:34 +01:00
Camille GILLOT fbcf7d415b Move the set of features to the `features` query. 2022-03-03 18:08:30 +01:00
bors 4566094913 Auto merge of #94512 - RalfJung:sdiv-ub, r=oli-obk
Miri/CTFE: properly treat overflow in (signed) division/rem as UB

To my surprise, it looks like LLVM treats overflow of signed div/rem as UB. From what I can tell, MIR `Div`/`Rem` directly lowers to the corresponding LLVM operation, so to make that correct we also have to consider these overflows UB in the CTFE/Miri interpreter engine.

r? `@oli-obk`
2022-03-03 12:56:24 +00:00
bors 06460fe72c Auto merge of #94548 - matthiaskrgr:rollup-spa38z8, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #93562 (Update the documentation for `{As,Into,From}Raw{Fd,Handle,Socket}`.)
 - #94101 (rustdoc: add test cases for hidden enum variants)
 - #94484 (8 - Make more use of `let_chains`)
 - #94522 (Remove out-of-context line at end of E0284 message)
 - #94534 (Re-export (unstable) core::ffi types from std::ffi)
 - #94536 (Move transmute_undefined_repr back to nursery again)
 - #94537 (Use ? operator in one instance instead of manual match)
 - #94544 (Add some examples to comments in mbe code)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-03 10:14:04 +00:00
Matthias Krüger 88aa75ba8e
Rollup merge of #94544 - mark-i-m:macro-comments, r=petrochenkov
Add some examples to comments in mbe code

I found these things non-obvious when re-familiarizing myself with the code.

r? `@petrochenkov`
2022-03-03 11:02:56 +01:00
Matthias Krüger 98c9ee8917
Rollup merge of #94537 - est31:master, r=notriddle
Use ? operator in one instance instead of manual match

As suggested [here](https://github.com/rust-lang/rust/pull/94139#discussion_r818102403).

r? `@notriddle`
2022-03-03 11:02:55 +01:00
Matthias Krüger 250e7e1efe
Rollup merge of #94536 - dtolnay:transmute, r=Manishearth
Move transmute_undefined_repr back to nursery again

This PR reapplies #94014, which was reverted unintentionally I think by #94329. The combination of https://github.com/rust-lang/rust-clippy/pull/8432 + https://github.com/rust-lang/rust-clippy/pull/8497 in clippy should prevent this from happening again.

r? `@Manishearth`
2022-03-03 11:02:54 +01:00
Matthias Krüger 6f1730c9e3
Rollup merge of #94534 - bstrie:cffistd, r=Mark-Simulacrum
Re-export (unstable) core::ffi types from std::ffi
2022-03-03 11:02:53 +01:00
Matthias Krüger 845516cd3b
Rollup merge of #94522 - thinety:fix-e0284-message, r=Dylan-DPC
Remove out-of-context line at end of E0284 message

Removed the last line of E0284 message because it was out of context (probably kept by accident when changing whole error message).
2022-03-03 11:02:52 +01:00
Matthias Krüger dbf0372b72
Rollup merge of #94484 - c410-f3r:more-let-chains, r=jackh726
8 - Make more use of `let_chains`

Continuation of #94376.

cc #53667
2022-03-03 11:02:51 +01:00
Matthias Krüger 850511d483
Rollup merge of #94101 - notriddle:notriddle/strip-test-cases, r=GuillaumeGomez
rustdoc: add test cases for hidden enum variants
2022-03-03 11:02:50 +01:00
Matthias Krüger afd6f5c478
Rollup merge of #93562 - sunfishcode:sunfishcode/io-docs, r=joshtriplett
Update the documentation for `{As,Into,From}Raw{Fd,Handle,Socket}`.

This change weakens the descriptions of the
`{as,into,from}_raw_{fd,handle,socket}` descriptions from saying that
they *do* express ownership relations to say that they are *typically used*
in ways that express ownership relations. This is needed since, for
example, std's own [`RawFd`] implements `{As,From,Into}Fd` without any of
the ownership relationships.

This adds proper `# Safety` comments to `from_raw_{fd,handle,socket}`,
adds the requirement that raw handles be not opened with the
`FILE_FLAG_OVERLAPPED` flag, and merges the `OwnedHandle::from_raw_handle`
comment into the main `FromRawHandle::from_raw_handle` comment.

And, this changes `HandleOrNull` and `HandleOrInvalid` to not implement
`FromRawHandle`, since they are intended for limited use in FFI situations,
and not for generic use, and they have constraints that are stronger than
the those of `FromRawHandle`.

[`RawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/type.RawFd.html
2022-03-03 11:02:49 +01:00
bors 2f8d1a835b Auto merge of #94541 - Dylan-DPC:rollup-564wbq3, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #92061 (update char signess for openbsd)
 - #93072 (Compatible variants suggestion with desugaring)
 - #93354 (Add documentation about `BorrowedFd::to_owned`.)
 - #93663 (Rename `BorrowedFd::borrow_raw_fd` to `BorrowedFd::borrow_raw`.)
 - #94375 (Adt copy suggestions)
 - #94433 (Improve allowness of the unexpected_cfgs lint)
 - #94499 (Documentation was missed when demoting Windows XP to no_std only)
 - #94505 (Restore the local filter on mono item sorting)
 - #94529 (Unused doc comments blocks)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-03 04:28:08 +00:00
mark 88b99224c1 add some examples to comments in mbe code 2022-03-02 21:33:43 -06:00
Dan Gohman 8253cfef7a Remove the comment about `FILE_FLAG_OVERLAPPED`.
There may eventually be something to say about `FILE_FLAG_OVERLAPPED` here,
however this appears to be independent of the other changes in this PR,
so remove them from this PR so that it can be discussed separately.
2022-03-02 16:25:31 -08:00
Ralf Jung 24fc1151ee bless clippy 2022-03-02 19:20:27 -05:00
Dylan DPC 878a4ff90e
Rollup merge of #94529 - GuillaumeGomez:unused-doc-comments-blocks, r=estebank
Unused doc comments blocks

Fixes #77030.
2022-03-03 01:09:15 +01:00
Dylan DPC 3e6abf0c35
Rollup merge of #94505 - cuviper:mono-item-sort-local, r=michaelwoerister,davidtwco
Restore the local filter on mono item sorting

In `CodegenUnit::items_in_deterministic_order`, there's a comment that
only local HirIds should be taken into account, but #90408 removed the
`as_local` call that sets others to None. Restoring that check fixes the
s390x hangs seen in [RHBZ 2058803].

[RHBZ 2058803]: https://bugzilla.redhat.com/show_bug.cgi?id=2058803
2022-03-03 01:09:14 +01:00
Dylan DPC 293fa7a32b
Rollup merge of #94499 - RandomInsano:patch-1, r=Dylan-DPC
Documentation was missed when demoting Windows XP to no_std only

After a quick discussion on #81250 which removed special casing for mutexes added [here](10b103af48) to support Windows XP, we can't say that the standard library can build for it.

This change modifies the tier 3 non-ARM targets to show the standard library will no longer build for these and there is no work being done to change that.
2022-03-03 01:09:13 +01:00
Dylan DPC 493ed7a6af
Rollup merge of #94433 - Urgau:check-cfg-allowness, r=petrochenkov
Improve allowness of the unexpected_cfgs lint

This pull-request improve the allowness (`#[allow(...)]`) of the `unexpected_cfgs` lint.

Before this PR only crate level `#![allow(unexpected_cfgs)]` worked, now with this PR it also work when put around `cfg!` or if it is in a upper level. Making it work ~for the attributes `cfg`, `cfg_attr`, ...~ for the same level is awkward as the current code is design to give "Some parent node that is close to this macro call" (cf. https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/struct.ExpansionData.html) meaning that allow on the same line as an attribute won't work. I'm note even sure if this would be possible.

Found while working on https://github.com/rust-lang/rust/pull/94298.
r? ````````@petrochenkov````````
2022-03-03 01:09:12 +01:00
Dylan DPC 7537b2036a
Rollup merge of #94375 - WaffleLapkin:copy-suggestion, r=estebank
Adt copy suggestions

Previously we've only suggested adding `Copy` bounds when the type being moved/copied is a type parameter (generic). With this PR we also suggest adding bounds when a type
- Can be copy
- All predicates that need to be satisfied for that are based on type params

i.e. we will suggest `T: Copy` for `Option<T>`, but won't suggest anything for `Option<String>`.

An example:
```rust
fn duplicate<T>(t: Option<T>) -> (Option<T>, Option<T>) {
    (t, t)
}
```
New error (current compiler doesn't provide `help`:):
```text
error[E0382]: use of moved value: `t`
 --> t.rs:2:9
  |
1 | fn duplicate<T>(t: Option<T>) -> (Option<T>, Option<T>) {
  |                 - move occurs because `t` has type `Option<T>`, which does not implement the `Copy` trait
2 |     (t, t)
  |      -  ^ value used here after move
  |      |
  |      value moved here
  |
help: consider restricting type parameter `T`
  |
1 | fn duplicate<T: Copy>(t: Option<T>) -> (Option<T>, Option<T>) {
  |               ++++++
```

Fixes #93623
r? ``````````@estebank``````````
``````````@rustbot`````````` label +A-diagnostics +A-suggestion-diagnostics +C-enhancement

----

I'm not at all sure if this is the right implementation for this kind of suggestion, but it seems to work :')
2022-03-03 01:09:11 +01:00
Dylan DPC c9dc44be24
Rollup merge of #93663 - sunfishcode:sunfishcode/as-raw-name, r=joshtriplett
Rename `BorrowedFd::borrow_raw_fd` to `BorrowedFd::borrow_raw`.

Also, rename `BorrowedHandle::borrow_raw_handle` and
`BorrowedSocket::borrow_raw_socket` to `BorrowedHandle::borrow_raw` and
`BorrowedSocket::borrow_raw`.

This is just a minor rename to reduce redundancy in the user code calling
these functions, and to eliminate an inessential difference between
`BorrowedFd` code and `BorrowedHandle`/`BorrowedSocket` code.

While here, add a simple test exercising `BorrowedFd::borrow_raw_fd`.

r? ``````@joshtriplett``````
2022-03-03 01:09:10 +01:00
Dylan DPC bc1a8905d6
Rollup merge of #93354 - sunfishcode:sunfishcode/document-borrowedfd-toowned, r=joshtriplett
Add documentation about `BorrowedFd::to_owned`.

Following up on #88564, this adds documentation explaining why
`BorrowedFd::to_owned` returns another `BorrowedFd` rather than an
`OwnedFd`. And similar for `BorrowedHandle` and `BorrowedSocket`.

r? `````@joshtriplett`````
2022-03-03 01:09:09 +01:00
Dylan DPC bdad4a7be7
Rollup merge of #93072 - m-ou-se:compatible-variants-suggestion-with-desugaring, r=estebank
Compatible variants suggestion with desugaring

This fixes #90553 for `for` loops and other desugarings.

r? ```@estebank```
2022-03-03 01:09:08 +01:00
Dylan DPC a83021bda9
Rollup merge of #92061 - semarie:openbsd-archs, r=joshtriplett
update char signess for openbsd

it adds more archs support for openbsd: arm, mips64, powerpc, powerpc64, and riscv64.
2022-03-03 01:09:07 +01:00
est31 fe78bd4920 Use ? operator in one instance instead of manual match 2022-03-02 22:10:35 +01:00
flip1995 76f0305f83
Move transmute_undefined_repr back to nursery
There's still open discussion if this lint is ready to be enabled by
default. We want to give us more time to figure this out and prevent
this lint from getting to stable as an enabled-by-default lint.
2022-03-02 13:07:00 -08:00
Dan Gohman af642bb466 Fix a broken doc link on Windows. 2022-03-02 12:39:36 -08:00
bors 8769f4ef2f Auto merge of #92214 - ehuss:submodule-bg-exit, r=Mark-Simulacrum
Error if submodule fetch fails.

In CI, if fetching a submodule fails, the script would exit successfully. Later parts of the build will fail due to the missing files, but it is a bit confusing, and I think it would be better to error out earlier.

The reason is that in bash, `wait` without arguments will exit 0 even if a background job exits with an error. The solution here is to wait on each individual job, which will return the exit code of the job.

This was encountered in #92177.
2022-03-02 19:50:55 +00:00
Guillaume Gomez 6f0eb2a4e1 Update stdarch submodule 2022-03-02 20:06:46 +01:00
Guillaume Gomez fce6cecf7a Update unused_doc_comments ui test 2022-03-02 20:06:46 +01:00
Guillaume Gomez 628fbdf9b7 Fix unused_doc_comments lint errors 2022-03-02 20:06:35 +01:00
Caio 658ff942b0 8 - Make more use of `let_chains` 2022-03-02 16:02:37 -03:00
bstrie 9aed829fe6 Re-export core::ffi types from std::ffi 2022-03-02 13:52:31 -05:00
Mara Bos b32cabf458 Update test output. 2022-03-02 19:30:25 +01:00
Mara Bos 85cc4710ef Add more tests for mismatched Option/Result return types. 2022-03-02 19:26:54 +01:00
Mara Bos 003c892f9f Fix Ok(()) suggestion when desugaring is involved. 2022-03-02 19:26:53 +01:00
Guillaume Gomez ac891ea374 Extend unused_doc_comments lint to check on blocks 2022-03-02 18:02:06 +01:00
bors 08504c64aa Auto merge of #93244 - mark-i-m:doomed, r=oli-obk
Rename `ErrorReported` -> `ErrorGuaranteed`

r? `@eddyb`

cc https://github.com/rust-lang/rust/pull/93222 https://github.com/rust-lang/rust/issues/69426

The idea is that we would like to use it for both errors and `delay_span_bug`. Its semantics indicate a _guarantee_ that compilation will fail.
2022-03-02 16:13:38 +00:00
mark e489a94dee rename ErrorReported -> ErrorGuaranteed 2022-03-02 09:45:25 -06:00
Thiago Trannin bc31b3e5ef Remove out-of-context line at end of E0284 message 2022-03-02 10:09:02 -03:00
Sébastien Marie fa8e1bedd3 merge the char signess list of archs with freebsd as it is the same 2022-03-02 12:12:28 +00:00
Sébastien Marie 3768f0b813 update char signess for openbsd
adds more archs for openbsd: arm, mips64, powerpc, powerpc64, and riscv64.
2022-03-02 10:33:50 +00:00
bors c42d846add Auto merge of #94229 - erikdesjardins:rem2, r=nikic
Remove LLVM attribute removal

This was necessary before, because `declare_raw_fn` would always apply
the default optimization attributes to every declared function.
Then `attributes::from_fn_attrs` would have to remove the default
attributes in the case of, e.g. `#[optimize(speed)]` in a `-Os` build.
(see [`src/test/codegen/optimize-attr-1.rs`](03a8cc7df1/src/test/codegen/optimize-attr-1.rs (L33)))

However, every relevant callsite of `declare_raw_fn` (i.e. where we
actually generate code for the function, and not e.g. a call to an
intrinsic, where optimization attributes don't [?] matter)
calls `from_fn_attrs`, so we can remove the attribute setting
from `declare_raw_fn`, and rely on `from_fn_attrs` to apply the correct
attributes all at once.

r? `@ghost` (blocked on #94221)
`@rustbot` label S-blocked
2022-03-02 08:48:33 +00:00
bors 2a280de64f Auto merge of #94514 - matthiaskrgr:rollup-pdzn82h, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #94464 (Suggest adding a new lifetime parameter when two elided lifetimes should match up for traits and impls.)
 - #94476 (7 - Make more use of `let_chains`)
 - #94478 (Fix panic when handling intra doc links generated from macro)
 - #94482 (compiler: fix some typos)
 - #94490 (Update books)
 - #94496 (tests: accept llvm intrinsic in align-checking test)
 - #94498 (9 - Make more use of `let_chains`)
 - #94503 (Provide C FFI types via core::ffi, not just in std)
 - #94513 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-02 05:32:00 +00:00
Matthias Krüger e89ab08f11
Rollup merge of #94513 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/94474
r? `@ghost`
2022-03-02 04:30:13 +01:00
Matthias Krüger 3ea9eebb73
Rollup merge of #94503 - joshtriplett:core-ffi-c, r=Amanieu
Provide C FFI types via core::ffi, not just in std

Tracking issue: https://github.com/rust-lang/rust/issues/94501

The ability to interoperate with C code via FFI is not limited to crates
using std; this allows using these types without std.

The existing types in `std::os::raw` become type aliases for the ones in
`core::ffi`. This uses type aliases rather than re-exports, to allow the
std types to remain stable while the core types are unstable.

This also moves the currently unstable `NonZero_` variants and
`c_size_t`/`c_ssize_t`/`c_ptrdiff_t` types to `core::ffi`, while leaving
them unstable.

Historically, we didn't do this because these types are target-dependent.
However, `core` itself is also target-dependent. `core` should not call
any OS services, but it knows the target and the target's ABI.
2022-03-02 04:30:12 +01:00