Commit graph

215179 commits

Author SHA1 Message Date
Arthur Carcano 797f247997 Mark ZST as FFI-safe if all its fields are PhantomData
Modify the linting behavior and add the corresponding
regression test
2023-01-12 12:21:35 +01:00
bors 606c390725 Auto merge of #106760 - compiler-errors:rollup-0bogyco, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #103236 (doc: rewrite doc for signed int::{carrying_add,borrowing_sub})
 - #103800 (Stabilize `::{core,std}::pin::pin!`)
 - #106097 (Migrate mir_build diagnostics 2 of 3)
 - #106170 (Move autoderef to `rustc_hir_analysis`)
 - #106323 (Stabilize f16c_target_feature)
 - #106360 (Tweak E0277 `&`-removal suggestions)
 - #106524 (Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch)
 - #106739 (Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-12 10:46:19 +00:00
Guillaume Gomez 0482a48dab Remove dead code in rustdoc stripper 2023-01-12 11:34:26 +01:00
Oli Scherer 58782a8842 Harden the pre-tyctxt query system against accidental recomputation 2023-01-12 09:26:28 +00:00
bors 2b8590ef3b Auto merge of #106757 - matthiaskrgr:rollup-9j8830g, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #106167 (Fix invalid syntax and incomplete suggestion in impl Trait parameter type suggestions for E0311)
 - #106309 (Prefer non-`[type error]` candidates during selection)
 - #106532 (Allow codegen to unsize `dyn*` to `dyn`)
 - #106596 (Hide more of long types in E0271)
 - #106638 (std tests: use __OsLocalKeyInner from realstd)
 - #106676 (Test that we cannot use trait impl methods arguments as defining uses)
 - #106702 (Conserve cause of `ImplDerivedObligation` in E0599)
 - #106732 (rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.)
 - #106733 (Revert "warn newer available version of the x tool")
 - #106748 (Clean up `OnUnimplementedFormatString::verify`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-12 07:40:32 +00:00
Maybe Waffle 22b4c68895 Make // SAFETY comment part of the doctest, and not surrounding code 2023-01-12 07:28:43 +00:00
Maybe Waffle f1a63bc2dd Remove unused mut from a doctest 2023-01-12 07:27:51 +00:00
Maybe Waffle a513c84a5b Add AtomicPtr::as_mut_ptr 2023-01-12 07:27:36 +00:00
Maybe Waffle fb0ecc0288 Add WaffleLapkin to compiler reviewers 2023-01-12 06:53:06 +00:00
Michael Goulet 9ec36f5668
Rollup merge of #106739 - WaffleLapkin:astconv, r=estebank
Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`

This removes the need for <>><><><<>> dances and makes the code a bit nicer.

Not sure if `astconv` is the best name though, maybe someone has a better idea?
2023-01-11 22:25:50 -08:00
Michael Goulet d7113948d3
Rollup merge of #106524 - compiler-errors:constructor-note, r=cjgillot
Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch

Fixes #106516
2023-01-11 22:25:49 -08:00
Michael Goulet 54f6fea818
Rollup merge of #106360 - estebank:remove-borrow-suggestion, r=compiler-errors
Tweak E0277 `&`-removal suggestions

Fix #64068, fix #84837.
2023-01-11 22:25:49 -08:00
Michael Goulet 244b90edee
Rollup merge of #106323 - starkat99:stabilize-f16c_target_feature, r=petrochenkov
Stabilize f16c_target_feature

Resolves https://github.com/rust-lang/stdarch/issues/1234

Library PR for stabilizing corresponding intrinsics: https://github.com/rust-lang/stdarch/pull/1366

See also #44839 tracking issue for target_feature
2023-01-11 22:25:48 -08:00
Michael Goulet 9928b14772
Rollup merge of #106170 - compiler-errors:autoderef-to-analysis, r=lcnr
Move autoderef to `rustc_hir_analysis`

Not sure if this is a change we actually want, but autoderef really is only (functionally) used by `rustc_hir_analysis` and `rustc_hir_typeck`, so it probably should live there.

Instead, implement a separate autoderef helper in `TypeErrCtxt` for the one use-case that  goes against the ordering of the crate graph..
2023-01-11 22:25:48 -08:00
Michael Goulet 83d3b76ac2
Rollup merge of #106097 - mejrs:mir_build2, r=oli-obk
Migrate mir_build diagnostics 2 of 3

The first three commits are fairly boring, however I've made some changes to the output of the match checking diagnostics.
2023-01-11 22:25:47 -08:00
Michael Goulet 2e17a5d406
Rollup merge of #103800 - danielhenrymantilla:stabilize-pin-macro, r=dtolnay
Stabilize `::{core,std}::pin::pin!`

As discussed [over here](https://github.com/rust-lang/rust/issues/93178#issuecomment-1295843548), it looks like a decent time to stabilize the `pin!` macro.

### Public API

```rust
// in module `core::pin`

/// API: `fn pin<T>($value: T) -> Pin<&'local mut T>`
pub macro pin($value:expr $(,)?) {
    …
}
```

  - Tracking issue: #93178

(now all this needs is an FCP by the proper team?)
2023-01-11 22:25:47 -08:00
Michael Goulet e23b0fd318
Rollup merge of #103236 - tspiteri:redoc-int-adc-sbb, r=m-ou-se
doc: rewrite doc for signed int::{carrying_add,borrowing_sub}

Reword the documentation for bigint helper methods, signed `int::{carrying_add,borrowing_sub}` (#85532).

This change is a follow-up to #101889, which was for the unsigned methods.
2023-01-11 22:25:46 -08:00
Michael Goulet 0a2b55d4c8 Revert "Make nested RPITIT inherit the parent opaque's generics." and adjust test
This reverts commit e2d41f4c97.
2023-01-12 06:07:53 +00:00
Matthias Krüger e8ef83e4c0
Rollup merge of #106748 - clubby789:on-unimplemented-fmt-verify, r=compiler-errors
Clean up `OnUnimplementedFormatString::verify`

Lift the always-allowed symbols to a static array and replace a `match iter().find(...)` with `iter().any(...)`
2023-01-12 06:52:39 +01:00
Matthias Krüger be76526707
Rollup merge of #106733 - DebugSteven:revert-104552-warn-newer-x, r=jyn514
Revert "warn newer available version of the x tool"

Reverts rust-lang/rust#104552

Running the x executable directly created an [issue](https://github.com/rust-lang/rust/issues/106469) here. There are other options for warning a user that a newer version of x exists in the issue's discussion as well.

r? `@jyn514`
2023-01-12 06:52:39 +01:00
Matthias Krüger a90742ac98
Rollup merge of #106732 - durin42:dmitrig-arrayref-ctor, r=nikic
rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.

LLVM upstream has deprecated llvm::makeArrayRef and will remove it.
2023-01-12 06:52:38 +01:00
Matthias Krüger 8a13157c16
Rollup merge of #106702 - estebank:trait-bounds, r=compiler-errors
Conserve cause of `ImplDerivedObligation` in E0599

CC #86377.
2023-01-12 06:52:38 +01:00
Matthias Krüger d42d952afc
Rollup merge of #106676 - oli-obk:tait_test, r=dtolnay
Test that we cannot use trait impl methods arguments as defining uses

Addresses https://github.com/rust-lang/rust/issues/63063#issuecomment-1360053614

r? `@dtolnay`
2023-01-12 06:52:37 +01:00
Matthias Krüger db8301b7f8
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
std tests: use __OsLocalKeyInner from realstd

This is basically the same as https://github.com/rust-lang/rust/pull/100201, but for __OsLocalKeyInner:

Some std tests are failing in Miri on Windows because [this static](a377893da2/library/std/src/sys/windows/thread_local_key.rs (L234-L239)) is getting duplicated, and Miri does not handle that properly -- Miri does not support this magic `.CRT$XLB` linker section, but instead just looks up this particular hard-coded static in the standard library. This PR lets the test suite use the std static instead of having its own copy.

Fixes https://github.com/rust-lang/miri/issues/2754
r? `@thomcc`
2023-01-12 06:52:37 +01:00
Matthias Krüger 890bc3ca90
Rollup merge of #106596 - estebank:verbose-e0271, r=compiler-errors
Hide more of long types in E0271

Fix #40186.
2023-01-12 06:52:36 +01:00
Matthias Krüger e664cb2154
Rollup merge of #106532 - compiler-errors:dyn-star-to-dyn, r=jackh726
Allow codegen to unsize `dyn*` to `dyn`

`dyn* Trait` is just another type that implements `Trait`, so we should be able to unsize `&dyn* Trait` into `&dyn Trait` perfectly fine, same for `Box` and other unsizeable types.

Fixes #106488
2023-01-12 06:52:35 +01:00
Matthias Krüger 9b538e8e62
Rollup merge of #106309 - compiler-errors:prefer-non-err-candidates, r=oli-obk
Prefer non-`[type error]` candidates during selection

Fixes #102130
Fixes #106351

r? types

note: Alternatively we could filter out error where-clauses during param-env construction? But we still need to filter out impls with errors during `match_impl`, I think.
2023-01-12 06:52:34 +01:00
Matthias Krüger a8bd0c04b4
Rollup merge of #106167 - yanchen4791:issue-105544-fix, r=oli-obk
Fix invalid syntax and incomplete suggestion in impl Trait parameter type suggestions for E0311

Fixes #105544

The problems: The suggestion given for E0311 has invalid syntax when the synthetic type parameter is used for Trait type in function declaration:
```rust
fn foo(d: impl Sized) -> impl Sized
```
instead of explicitly specified like the following:
```rust
fn foo<T: Sized>(d: T) -> impl Sized
```
In addition to the syntax error, the suggestions given for E0311 are not complete when multiple elided lifetimes are involved in lifetime bounds, not all involved parameters are given the named lifetime in the suggestions. For the following test case:
```
fn foo(d: impl Sized, p: &mut ()) -> impl Sized + '_ {
    (d, p)
}
```
a good suggestion should add the lifetime 'a to both d and p, instead of d only:
```
fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ {
    (d, p)
}
```

The Solution: Fix the syntax problem in the suggestions when synthetic type parameter is used, and also add lifetimes for all involved parameters.
2023-01-12 06:52:34 +01:00
bors 4887cb18dc Auto merge of #106711 - albertlarsan68:use-ci-llvm-when-lld, r=jyn514
Use CI LLVM in `test-various` builder

It was disabled because it needs `lld`, but since #104748 was merged it is no longer needed.

This will speed this test, since it no longer needs to build LLVM.
2023-01-12 04:58:03 +00:00
Deadbeef 42a50bac31 move to correct test 2023-01-12 04:20:00 +00:00
clubby789 740f6aaf95 Fix rendering 'const' for intrinsics 2023-01-12 03:19:08 +00:00
Ibraheem Ahmed 8917e99362 rework and document backoff behavior of sync::mpsc 2023-01-11 21:29:14 -05:00
Deadbeef ca1eb4309e test use in libcore 2023-01-12 02:28:38 +00:00
Deadbeef b0aa859c24 fix fmt and bless 2023-01-12 02:28:38 +00:00
Deadbeef f6725c0a98 fix fn_sig ice 2023-01-12 02:28:38 +00:00
Deadbeef 6e63f7be54 attempt to make a minimal example work 2023-01-12 02:28:37 +00:00
Deadbeef 23718a3cc2 suggest adding const_trait_impl if error because of that 2023-01-12 02:28:37 +00:00
Deadbeef e7fea8c7e6 gate const closures 2023-01-12 02:28:37 +00:00
Deadbeef 4fb10c0ce4 parse const closures 2023-01-12 02:28:37 +00:00
bors d4203eda5f Auto merge of #106537 - fmease:recover-where-clause-before-tuple-struct-body, r=estebank
Recover from where clauses placed before tuple struct bodies

Open to any suggestions regarding the phrasing of the diagnostic.

Fixes #100790.
`@rustbot` label A-diagnostics
r? diagnostics
2023-01-12 02:16:16 +00:00
Nicholas Bishop 46f9e878f6 Stabilize abi_efiapi feature
Tracking issue: https://github.com/rust-lang/rust/issues/65815
2023-01-11 20:42:13 -05:00
Ezra Shaw 02005e9f22
remove unreachable error code E0490 2023-01-12 14:15:21 +13:00
bors a95286b852 Auto merge of #10189 - Alexendoo:copy-packed-struct, r=giraffate
expl_impl_clone_on_copy: ignore packed structs with type/const params

changelog: [`expl_impl_clone_on_copy`]: Ignore `#[repr(packed)]` structs with type or const paramaters

Fixes #10188

A more involved solution that checks if any bound on the trait impl aren't present on the struct definition would be ideal, but I couldn't see a nice way to go about that
2023-01-12 00:29:30 +00:00
clubby789 a3d6bc3468 Emit a single error for contiguous sequences of Unicode homoglyphs 2023-01-12 00:15:32 +00:00
bors 56ee65aeb6 Auto merge of #106743 - matthiaskrgr:rollup-q5dpxms, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #106620 (Detect struct literal needing parentheses)
 - #106622 (Detect out of bounds range pattern value)
 - #106703 (Note predicate span on `ImplDerivedObligation`)
 - #106705 (Report fulfillment errors in new trait solver)
 - #106726 (Fix some typos in code comments.)
 - #106734 (Deny having src/test exisiting in tidy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-11 23:05:58 +00:00
clubby789 b78a571ce1 Clean up OnUnimplementedFormatString::verify 2023-01-11 22:54:46 +00:00
yanchen4791 621d412241
Fix invalid syntax in impl Trait parameter type suggestions for E0311 2023-01-11 14:49:55 -08:00
mejrs 372ac9c1a2
Translate Overlap eagerly 2023-01-11 14:40:13 -08:00
mejrs 3d260fa63c
Some cleanup, oops 2023-01-11 14:40:10 -08:00
mejrs 8476c517c0
Don't recommend if let if let else works 2023-01-11 14:40:07 -08:00