]> git.lizzy.rs Git - rust.git/log
rust.git
17 months agoBump nightly version -> 2023-01-12
Philipp Krones [Thu, 12 Jan 2023 18:00:16 +0000 (19:00 +0100)]
Bump nightly version -> 2023-01-12

17 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Thu, 12 Jan 2023 17:59:59 +0000 (18:59 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

17 months agoExclude formatting commit from blame
Ingvar Stepanyan [Thu, 12 Jan 2023 17:40:48 +0000 (17:40 +0000)]
Exclude formatting commit from blame

Excludes https://github.com/rust-lang/rust/commit/c34fbfaad38cf5829ef5cfe780dc9d58480adeaa to make Git blame a bit more useful.

17 months agoAuto merge of #10149 - jyn514:duplicate-sysroot, r=flip1995
bors [Thu, 12 Jan 2023 17:36:00 +0000 (17:36 +0000)]
Auto merge of #10149 - jyn514:duplicate-sysroot, r=flip1995

Don't pass `--sysroot` twice if SYSROOT is set

This is useful for rust-lang/rust to allow setting a sysroot that's *only* for build scripts, different from the regular sysroot passed in RUSTFLAGS (since cargo doesn't apply RUSTFLAGS to build scripts or proc-macros).

That said, the exact motivation is not particularly important: this fixes a regression from
https://github.com/rust-lang/rust-clippy/pull/9881/commits/5907e9155ed7f1312d108aa2110853472da3b029#r1060215684.

Note that only RUSTFLAGS is tested in the new integration test; passing --sysroot through `clippy-driver` never worked as far as I can tell, and no one is using it, so I didn't fix it here.

Helps with https://github.com/rust-lang/rust/pull/106394.

---

changelog: other: `SYSROOT` and `--sysroot` can now be set at the same time
[#10149](https://github.com/rust-lang/rust-clippy/pull/10149)
<!-- changelog_checked -->

17 months agoAdd cargo-clippy sysroot test
Philipp Krones [Thu, 12 Jan 2023 17:30:51 +0000 (18:30 +0100)]
Add cargo-clippy sysroot test

Whne SYSROOT is defined, clippy-driver will insert a --sysroot argument
when calling rustc. However, when a sysroot argument is already defined,
e.g. through RUSTFLAGS=--sysroot=... the `cargo clippy` call would
error. This tests that the sysroot argument is only passed once and that
SYSROOT is ignored in this case.

17 months agoDon't pass `--sysroot` twice if SYSROOT is set
Joshua Nelson [Tue, 3 Jan 2023 18:04:28 +0000 (18:04 +0000)]
Don't pass `--sysroot` twice if SYSROOT is set

This is useful for rust-lang/rust to allow setting a sysroot that's
*only* for build scripts, different from the regular sysroot passed in
RUSTFLAGS (since cargo doesn't apply RUSTFLAGS to build scripts or
proc-macros).

That said, the exact motivation is not particularly important: this
fixes a regression from
https://github.com/rust-lang/rust-clippy/pull/9881/commits/5907e9155ed7f1312d108aa2110853472da3b029#r1060215684.

Note that only RUSTFLAGS is tested in the new integration test; passing
--sysroot through `clippy-driver` never worked as far as I can tell, and
no one is using it, so I didn't fix it here.

17 months agoFeed the `features_query` instead of grabbing it from the session lazily
Oli Scherer [Mon, 5 Dec 2022 17:52:17 +0000 (17:52 +0000)]
Feed the `features_query` instead of grabbing it from the session lazily

17 months agoRemove `output_filenames` field from TyCtxt and feed the query instead
Oli Scherer [Mon, 5 Dec 2022 17:00:26 +0000 (17:00 +0000)]
Remove `output_filenames` field from TyCtxt and feed the query instead

17 months agoRemove `untracked_crate` field and instead pass it along with the resolver.
Oli Scherer [Mon, 5 Dec 2022 16:43:06 +0000 (16:43 +0000)]
Remove `untracked_crate` field and instead pass it along with the resolver.

17 months agoFeed `crate_name` query
Oli Scherer [Mon, 5 Dec 2022 16:37:44 +0000 (16:37 +0000)]
Feed `crate_name` query

17 months agoFeed `resolutions` query instead of it being a thin wrapper around an untracked field
Oli Scherer [Mon, 5 Dec 2022 16:19:14 +0000 (16:19 +0000)]
Feed `resolutions` query instead of it being a thin wrapper around an untracked field

17 months agoAuto merge of #106773 - Nilstrieb:rollup-sq73pyg, r=Nilstrieb
bors [Thu, 12 Jan 2023 17:11:03 +0000 (17:11 +0000)]
Auto merge of #106773 - Nilstrieb:rollup-sq73pyg, r=Nilstrieb

Rollup of 6 pull requests

Successful merges:

 - #105806 (Support eager subdiagnostics again)
 - #106322 (Handle inference variables in `CollectAllMismatches` correctly)
 - #106579 (Suggest making private tuple struct field public)
 - #106714 (remove unreachable error code `E0490`)
 - #106751 (Fix rendering 'const' in header for intrinsics)
 - #106761 (Add `WaffleLapkin` to compiler reviewers)

Failed merges:

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

17 months agoFix mir-opt tests for big-endian platforms
Ulrich Weigand [Thu, 22 Dec 2022 15:33:12 +0000 (16:33 +0100)]
Fix mir-opt tests for big-endian platforms

The test cases src/test/mir-opt/building/custom/consts.rs and
src/test/mir-opt/const_prop/mutable_variable_no_prop.rs are
currently failing on big-endian platforms as the binary encoding
of some constants is hard-coded in the MIR test files.  Fix this
by choosing constant values that have the same encoding on big-
and little-endian platforms.

The test case src/test/mir-opt/issues/issue_75439.rs is failing
as well, but since the purpose of the test is to validate handling
of big-endian integer encodings on a little-endian platform, it does
not make much sense to run it on big-endian platforms in the first
place - we can just ignore it there.

Fixed part of https://github.com/rust-lang/rust/issues/105383.

17 months agoAdd test for displayed re-export of `doc(hidden)`
Guillaume Gomez [Thu, 12 Jan 2023 17:03:50 +0000 (18:03 +0100)]
Add test for displayed re-export of `doc(hidden)`

17 months agoFix not displayed re-export of `doc(hidden)` item
Guillaume Gomez [Wed, 11 Jan 2023 19:41:07 +0000 (20:41 +0100)]
Fix not displayed re-export of `doc(hidden)` item

17 months agoAuto merge of #10184 - robertbastian:master, r=xFrednet
bors [Thu, 12 Jan 2023 14:59:41 +0000 (14:59 +0000)]
Auto merge of #10184 - robertbastian:master, r=xFrednet

Allow implementing `Hash` with derived `PartialEq` (`derive_hash_xor_eq`

This is a common pattern and is totally allowed by the `Hash` trait.

Fixes #2627

changelog: Move: Renamed `derive_hash_xor_eq` to [`derived_hash_with_manual_eq`]
[#10184](https://github.com/rust-lang/rust-clippy/pull/10184)
changelog: Enhancement: [`derived_hash_with_manual_eq`]: Now allows `#[derive(PartialEq)]` with custom `Hash` implementations
[#10184](https://github.com/rust-lang/rust-clippy/pull/10184)
<!-- changelog_checked -->

17 months agoRollup merge of #106761 - WaffleLapkin:waffle-is-CompilerReviewer, r=oli-obk
nils [Thu, 12 Jan 2023 14:44:53 +0000 (15:44 +0100)]
Rollup merge of #106761 - WaffleLapkin:waffle-is-CompilerReviewer, r=oli-obk

Add `WaffleLapkin` to compiler reviewers

r? ``@wesleywiser``

17 months agoRollup merge of #106751 - clubby789:const-intrinsic, r=GuillaumeGomez
nils [Thu, 12 Jan 2023 14:44:53 +0000 (15:44 +0100)]
Rollup merge of #106751 - clubby789:const-intrinsic, r=GuillaumeGomez

Fix rendering 'const' in header for intrinsics

Fixes #99398

17 months agoRollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
nils [Thu, 12 Jan 2023 14:44:52 +0000 (15:44 +0100)]
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco

remove unreachable error code `E0490`

AFAIK, the untested and undocumented error code `E0490` is now unreachable, it was from the days of the original borrow checker.

cc ``@GuillaumeGomez`` #61137

17 months agoRollup merge of #106579 - estebank:issue-52144, r=Nilstrieb
nils [Thu, 12 Jan 2023 14:44:51 +0000 (15:44 +0100)]
Rollup merge of #106579 - estebank:issue-52144, r=Nilstrieb

Suggest making private tuple struct field public

Fix #52144.

17 months agoRollup merge of #106322 - compiler-errors:CollectAllMismatches-infer-vars, r=oli-obk
nils [Thu, 12 Jan 2023 14:44:51 +0000 (15:44 +0100)]
Rollup merge of #106322 - compiler-errors:CollectAllMismatches-infer-vars, r=oli-obk

Handle inference variables in `CollectAllMismatches` correctly

1. Fix #106240
2. Treat int/float type variables correctly (see `src/test/ui/iterators/invalid-iterator-chain-with-int-infer.rs`), so we can point out things like "`Iterator::Item` changed to `{integer}` here"

17 months agoRollup merge of #105806 - mejrs:eager2, r=davidtwco
nils [Thu, 12 Jan 2023 14:44:50 +0000 (15:44 +0100)]
Rollup merge of #105806 - mejrs:eager2, r=davidtwco

Support eager subdiagnostics again

See https://github.com/rust-lang/rust/pull/104941#discussion_r1051135746

I'm not sure how to add a test for this. But I did pick some of the diagnostic structs in the mentioned PR and it works with them.

17 months agoAdd mw to triagebot.toml
Michael Woerister [Thu, 12 Jan 2023 14:36:15 +0000 (15:36 +0100)]
Add mw to triagebot.toml

17 months agoadd note for float iterator
Petar Dambovaliev [Wed, 11 Jan 2023 19:28:56 +0000 (20:28 +0100)]
add note for float iterator

17 months agoAuto merge of #105603 - oli-obk:non_repeatable_queries, r=petrochenkov
bors [Thu, 12 Jan 2023 13:59:30 +0000 (13:59 +0000)]
Auto merge of #105603 - oli-obk:non_repeatable_queries, r=petrochenkov

Harden the pre-tyctxt query system against accidental recomputation

While the current compiler has no issues where we `take` and then compute the query again, in https://github.com/rust-lang/rust/pull/105462 I accidentally introduced such a case.

I also took the opportunity to remove `peek_mut`, which is only ever used for `global_tcx` to then invoke `enter`. I added an `enter` method directly on the query.

17 months agofix
Robert Bastian [Thu, 12 Jan 2023 13:22:18 +0000 (14:22 +0100)]
fix

17 months agotake care when there is no args in method call
yukang [Sat, 7 Jan 2023 16:32:40 +0000 (00:32 +0800)]
take care when there is no args in method call

17 months agoProvide help on closures capturing self causing borrow checker errors
yukang [Sat, 7 Jan 2023 06:02:59 +0000 (14:02 +0800)]
Provide help on closures capturing self causing borrow checker errors

17 months agoAuto merge of #10179 - llogiq:trim-suspicious-to-owned-paths, r=xFrednet
bors [Thu, 12 Jan 2023 12:10:56 +0000 (12:10 +0000)]
Auto merge of #10179 - llogiq:trim-suspicious-to-owned-paths, r=xFrednet

trim paths in `suspicious_to_owned`

This continues my path trimming spree. I'm not going to add yet another changelog entry, we should have one "trim paths in some applicable lints" entry instead.

---

changelog: none

17 months ago[RFC 2397] Deny incorrect locations
Caio [Thu, 12 Jan 2023 11:41:21 +0000 (08:41 -0300)]
[RFC 2397] Deny incorrect locations

17 months agoMark ZST as FFI-safe if all its fields are PhantomData
Arthur Carcano [Tue, 10 Jan 2023 10:38:53 +0000 (11:38 +0100)]
Mark ZST as FFI-safe if all its fields are PhantomData

Modify the linting behavior and add the corresponding
regression test

17 months agoAuto merge of #106760 - compiler-errors:rollup-0bogyco, r=compiler-errors
bors [Thu, 12 Jan 2023 10:46:19 +0000 (10:46 +0000)]
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

17 months agoRemove dead code in rustdoc stripper
Guillaume Gomez [Thu, 12 Jan 2023 10:34:26 +0000 (11:34 +0100)]
Remove dead code in rustdoc stripper

17 months agoHarden the pre-tyctxt query system against accidental recomputation
Oli Scherer [Mon, 12 Dec 2022 10:48:02 +0000 (10:48 +0000)]
Harden the pre-tyctxt query system against accidental recomputation

17 months agoAuto merge of #106757 - matthiaskrgr:rollup-9j8830g, r=matthiaskrgr
bors [Thu, 12 Jan 2023 07:40:32 +0000 (07:40 +0000)]
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

17 months agoMake `// SAFETY` comment part of the doctest, and not surrounding code
Maybe Waffle [Thu, 12 Jan 2023 07:28:43 +0000 (07:28 +0000)]
Make `// SAFETY` comment part of the doctest, and not surrounding code

17 months agoRemove unused `mut` from a doctest
Maybe Waffle [Thu, 12 Jan 2023 07:27:51 +0000 (07:27 +0000)]
Remove unused `mut` from a doctest

17 months agoAdd `AtomicPtr::as_mut_ptr`
Maybe Waffle [Thu, 12 Jan 2023 07:27:36 +0000 (07:27 +0000)]
Add `AtomicPtr::as_mut_ptr`

17 months agoAdd `WaffleLapkin` to compiler reviewers
Maybe Waffle [Thu, 12 Jan 2023 06:53:06 +0000 (06:53 +0000)]
Add `WaffleLapkin` to compiler reviewers

17 months agoRollup merge of #106739 - WaffleLapkin:astconv, r=estebank
Michael Goulet [Thu, 12 Jan 2023 06:25:50 +0000 (22:25 -0800)]
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?

17 months agoRollup merge of #106524 - compiler-errors:constructor-note, r=cjgillot
Michael Goulet [Thu, 12 Jan 2023 06:25:49 +0000 (22:25 -0800)]
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

17 months agoRollup merge of #106360 - estebank:remove-borrow-suggestion, r=compiler-errors
Michael Goulet [Thu, 12 Jan 2023 06:25:49 +0000 (22:25 -0800)]
Rollup merge of #106360 - estebank:remove-borrow-suggestion, r=compiler-errors

Tweak E0277 `&`-removal suggestions

Fix #64068, fix #84837.

17 months agoRollup merge of #106323 - starkat99:stabilize-f16c_target_feature, r=petrochenkov
Michael Goulet [Thu, 12 Jan 2023 06:25:48 +0000 (22:25 -0800)]
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

17 months agoRollup merge of #106170 - compiler-errors:autoderef-to-analysis, r=lcnr
Michael Goulet [Thu, 12 Jan 2023 06:25:48 +0000 (22:25 -0800)]
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..

17 months agoRollup merge of #106097 - mejrs:mir_build2, r=oli-obk
Michael Goulet [Thu, 12 Jan 2023 06:25:47 +0000 (22:25 -0800)]
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.

17 months agoRollup merge of #103800 - danielhenrymantilla:stabilize-pin-macro, r=dtolnay
Michael Goulet [Thu, 12 Jan 2023 06:25:47 +0000 (22:25 -0800)]
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?)

17 months agoRollup merge of #103236 - tspiteri:redoc-int-adc-sbb, r=m-ou-se
Michael Goulet [Thu, 12 Jan 2023 06:25:46 +0000 (22:25 -0800)]
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.

17 months agoRevert "Make nested RPITIT inherit the parent opaque's generics." and adjust test
Michael Goulet [Thu, 12 Jan 2023 06:07:53 +0000 (06:07 +0000)]
Revert "Make nested RPITIT inherit the parent opaque's generics." and adjust test

This reverts commit e2d41f4c974f0cc09e5aafb02883f222487610f9.

17 months agoRollup merge of #106748 - clubby789:on-unimplemented-fmt-verify, r=compiler-errors
Matthias Krüger [Thu, 12 Jan 2023 05:52:39 +0000 (06:52 +0100)]
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(...)`

17 months agoRollup merge of #106733 - DebugSteven:revert-104552-warn-newer-x, r=jyn514
Matthias Krüger [Thu, 12 Jan 2023 05:52:39 +0000 (06:52 +0100)]
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`

17 months agoRollup merge of #106732 - durin42:dmitrig-arrayref-ctor, r=nikic
Matthias Krüger [Thu, 12 Jan 2023 05:52:38 +0000 (06:52 +0100)]
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.

17 months agoRollup merge of #106702 - estebank:trait-bounds, r=compiler-errors
Matthias Krüger [Thu, 12 Jan 2023 05:52:38 +0000 (06:52 +0100)]
Rollup merge of #106702 - estebank:trait-bounds, r=compiler-errors

Conserve cause of `ImplDerivedObligation` in E0599

CC #86377.

17 months agoRollup merge of #106676 - oli-obk:tait_test, r=dtolnay
Matthias Krüger [Thu, 12 Jan 2023 05:52:37 +0000 (06:52 +0100)]
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`

17 months agoRollup merge of #106638 - RalfJung:realstd, r=thomcc
Matthias Krüger [Thu, 12 Jan 2023 05:52:37 +0000 (06:52 +0100)]
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](https://github.com/rust-lang/rust/blob/a377893da2cd7124e5a18c7116cbb70e16dd5541/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`

17 months agoRollup merge of #106596 - estebank:verbose-e0271, r=compiler-errors
Matthias Krüger [Thu, 12 Jan 2023 05:52:36 +0000 (06:52 +0100)]
Rollup merge of #106596 - estebank:verbose-e0271, r=compiler-errors

Hide more of long types in E0271

Fix #40186.

17 months agoRollup merge of #106532 - compiler-errors:dyn-star-to-dyn, r=jackh726
Matthias Krüger [Thu, 12 Jan 2023 05:52:35 +0000 (06:52 +0100)]
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

17 months agoRollup merge of #106309 - compiler-errors:prefer-non-err-candidates, r=oli-obk
Matthias Krüger [Thu, 12 Jan 2023 05:52:34 +0000 (06:52 +0100)]
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.

17 months agoRollup merge of #106167 - yanchen4791:issue-105544-fix, r=oli-obk
Matthias Krüger [Thu, 12 Jan 2023 05:52:34 +0000 (06:52 +0100)]
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.

17 months agoAuto merge of #106711 - albertlarsan68:use-ci-llvm-when-lld, r=jyn514
bors [Thu, 12 Jan 2023 04:58:03 +0000 (04:58 +0000)]
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.

17 months agomove to correct test
Deadbeef [Thu, 12 Jan 2023 04:20:00 +0000 (04:20 +0000)]
move to correct test

17 months agoFix rendering 'const' for intrinsics
clubby789 [Thu, 12 Jan 2023 03:19:08 +0000 (03:19 +0000)]
Fix rendering 'const' for intrinsics

17 months agorework and document backoff behavior of `sync::mpsc`
Ibraheem Ahmed [Thu, 12 Jan 2023 02:29:14 +0000 (21:29 -0500)]
rework and document backoff behavior of `sync::mpsc`

17 months agotest use in libcore
Deadbeef [Mon, 26 Dec 2022 10:48:54 +0000 (10:48 +0000)]
test use in libcore

17 months agofix fmt and bless
Deadbeef [Thu, 22 Dec 2022 18:15:15 +0000 (18:15 +0000)]
fix fmt and bless

17 months agofix fn_sig ice
Deadbeef [Thu, 22 Dec 2022 07:19:15 +0000 (07:19 +0000)]
fix fn_sig ice

17 months agoattempt to make a minimal example work
Deadbeef [Wed, 21 Dec 2022 16:32:16 +0000 (16:32 +0000)]
attempt to make a minimal example work

17 months agosuggest adding const_trait_impl if error because of that
Deadbeef [Wed, 21 Dec 2022 15:47:33 +0000 (15:47 +0000)]
suggest adding const_trait_impl if error because of that

17 months agogate const closures
Deadbeef [Wed, 21 Dec 2022 14:51:02 +0000 (14:51 +0000)]
gate const closures

17 months agoparse const closures
Deadbeef [Tue, 20 Dec 2022 16:15:55 +0000 (16:15 +0000)]
parse const closures

17 months agoAuto merge of #106537 - fmease:recover-where-clause-before-tuple-struct-body, r=estebank
bors [Thu, 12 Jan 2023 02:16:16 +0000 (02:16 +0000)]
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

17 months agoStabilize `abi_efiapi` feature
Nicholas Bishop [Fri, 16 Dec 2022 20:02:22 +0000 (15:02 -0500)]
Stabilize `abi_efiapi` feature

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

17 months agoremove unreachable error code `E0490`
Ezra Shaw [Wed, 11 Jan 2023 09:46:14 +0000 (22:46 +1300)]
remove unreachable error code `E0490`

17 months agoAuto merge of #10189 - Alexendoo:copy-packed-struct, r=giraffate
bors [Thu, 12 Jan 2023 00:29:30 +0000 (00:29 +0000)]
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

17 months agoEmit a single error for contiguous sequences of Unicode homoglyphs
clubby789 [Sat, 7 Jan 2023 16:33:05 +0000 (16:33 +0000)]
Emit a single error for contiguous sequences of Unicode homoglyphs

17 months agoAuto merge of #106743 - matthiaskrgr:rollup-q5dpxms, r=matthiaskrgr
bors [Wed, 11 Jan 2023 23:05:58 +0000 (23:05 +0000)]
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

17 months agoClean up `OnUnimplementedFormatString::verify`
clubby789 [Wed, 11 Jan 2023 22:54:46 +0000 (22:54 +0000)]
Clean up `OnUnimplementedFormatString::verify`

17 months agoFix invalid syntax in impl Trait parameter type suggestions for E0311
yanchen4791 [Mon, 26 Dec 2022 23:43:31 +0000 (15:43 -0800)]
Fix invalid syntax in impl Trait parameter type suggestions for E0311

17 months agoTranslate `Overlap` eagerly
mejrs [Mon, 9 Jan 2023 21:37:56 +0000 (22:37 +0100)]
Translate `Overlap` eagerly

17 months agoSome cleanup, oops
mejrs [Fri, 23 Dec 2022 21:26:12 +0000 (22:26 +0100)]
Some cleanup, oops

17 months agoDon't recommend `if let` if `let else` works
mejrs [Fri, 23 Dec 2022 21:23:37 +0000 (22:23 +0100)]
Don't recommend `if let` if `let else` works

17 months agoMigrate pattern matching
mejrs [Fri, 23 Dec 2022 20:02:23 +0000 (21:02 +0100)]
Migrate pattern matching

17 months agoMigrate usefulness.rs
mejrs [Tue, 20 Dec 2022 20:24:18 +0000 (21:24 +0100)]
Migrate usefulness.rs

17 months agoMigrate deconstruct_pat.rs
mejrs [Tue, 20 Dec 2022 15:43:34 +0000 (16:43 +0100)]
Migrate deconstruct_pat.rs

17 months agoTranslate const_to_pat.rs
mejrs [Mon, 19 Dec 2022 23:28:33 +0000 (00:28 +0100)]
Translate const_to_pat.rs

17 months agoadd checks for the signature of the lang item
asquared31415 [Fri, 23 Dec 2022 18:54:14 +0000 (13:54 -0500)]
add checks for the signature of the  lang item

17 months agoSupport eager subdiagnostics again
mejrs [Sun, 8 Jan 2023 23:00:41 +0000 (00:00 +0100)]
Support eager subdiagnostics again

17 months agoStabilize `::{core,std}::pin::pin!`
Daniel Henry-Mantilla [Mon, 31 Oct 2022 12:07:40 +0000 (13:07 +0100)]
Stabilize `::{core,std}::pin::pin!`

17 months agoTest that we cannot use trait impl methods arguments as defining uses
Oli Scherer [Tue, 10 Jan 2023 11:23:58 +0000 (11:23 +0000)]
Test that we cannot use trait impl methods arguments as defining uses

17 months agoHide more of long types in E0271
Esteban Küber [Sun, 8 Jan 2023 18:41:09 +0000 (18:41 +0000)]
Hide more of long types in E0271

Fix #40186.

17 months agoUse the root trait predicate to determine whether to remove references
Esteban Küber [Mon, 9 Jan 2023 04:43:18 +0000 (04:43 +0000)]
Use the root trait predicate to determine whether to remove references

Fix #84837.

17 months agofix rebase
Esteban Küber [Sat, 7 Jan 2023 19:35:40 +0000 (19:35 +0000)]
fix rebase

17 months agoAccount for type params
Esteban Küber [Mon, 2 Jan 2023 03:35:53 +0000 (19:35 -0800)]
Account for type params

17 months agoMake `&`-removal suggestion verbose
Esteban Küber [Mon, 2 Jan 2023 02:43:47 +0000 (18:43 -0800)]
Make `&`-removal suggestion verbose

17 months agoreview comments: Tweak output
Esteban Küber [Tue, 10 Jan 2023 20:57:02 +0000 (20:57 +0000)]
review comments: Tweak output

* Account for `struct S(pub(super)Ty);` in suggestion
* Suggest changing field visibility in E0603 too

17 months agoreview comment
Esteban Küber [Sun, 8 Jan 2023 07:18:07 +0000 (07:18 +0000)]
review comment

17 months agoSuggest making private tuple struct field public
Esteban Küber [Sun, 8 Jan 2023 01:15:28 +0000 (01:15 +0000)]
Suggest making private tuple struct field public

Fix #52144.

17 months agoreview comments: account for generics
Esteban Küber [Sun, 8 Jan 2023 20:51:40 +0000 (20:51 +0000)]
review comments: account for generics

17 months agoreview comments
Esteban Küber [Sun, 8 Jan 2023 07:24:36 +0000 (07:24 +0000)]
review comments

17 months agoWhen suggesting writing a fully qualified path probe for appropriate types
Esteban Küber [Sun, 8 Jan 2023 06:54:52 +0000 (06:54 +0000)]
When suggesting writing a fully qualified path probe for appropriate types

Fix #46585.

17 months agoMove autoderef to rustc_hir_analysis
Michael Goulet [Tue, 27 Dec 2022 00:39:36 +0000 (00:39 +0000)]
Move autoderef to rustc_hir_analysis