Commit Graph

23498 Commits

Author SHA1 Message Date
bors
66f8dd1255 Auto merge of #110069 - ndrewxie:issue-104212-fix, r=cjgillot
Switched provisional evaluation cache map to FxIndexMap, and replaced map.drain_filter with map.retain

Switching ProvisionalEvaluationCache's map field from FxHashMap to FxIndexMap was previously blocked because doing so caused performance regressions that could be mitigated by the stabilization of drain_filter for FxIndexMap (#104212). However, the only use of drain_filter can be replaced with a retain, so I made the modification and put in a PR to see if this causes a performance regression as well.

This PR is part of a broader effort (#84447) of removing iteration through FxHashMaps, as the iteration order is unstable and can cause issues in incremental compilation.
2023-04-08 11:20:58 +00:00
bors
131211acd2 Auto merge of #110043 - ickk:fix_infer_message, r=eholk
Fix help message for `infer_source_kind_subdiag_let`

I discovered there's a double "the" in the help message for E0282.
2023-04-08 03:26:54 +00:00
bors
0f0dc29264 Auto merge of #109971 - WaffleLapkin:yeet_ownership, r=Nilstrieb
Yeet `owning_ref`

Based on the discussions from https://github.com/rust-lang/rust/pull/109948

This replaces `owning_ref` with a far simpler & safer abstraction.

Fixes #109974
2023-04-08 01:08:26 +00:00
Andrew Xie
9920baba5f Switched provisional evaluation cache map to FxIndexMap, and replaced map.drain_filter with map.retain 2023-04-07 19:41:08 -04:00
bors
23ee2af2f7 Auto merge of #109788 - compiler-errors:trait-item-from-non-trait, r=petrochenkov
More descriptive error when qself path doesnt have a trait on the RHS of `as`

`<Ty as Enum>::Assoc` should report that `Enum` is a trait. Main question is whether to eagerly report the error, or raise it with `return Err(..)` -- i'll note that in an inline comment though.

cc `@GuillaumeGomez` who said this came up at a Paris Rust meetup.

r? `@petrochenkov`
2023-04-07 20:40:05 +00:00
bors
94524020ea Auto merge of #110036 - jackh726:placeholder_boundvar, r=nnethercote
Remove u32 on BrAnon and BoundTyKind::Anon in favor of BoundVar on Placeholder types

r? `@nnethercote`

Better alternative to #110025
2023-04-07 14:26:24 +00:00
Nicholas Nethercote
f08f15481a Add a size assertion for RegionKind. 2023-04-07 09:15:38 -04:00
bors
da14081468 Auto merge of #102906 - nbdd0121:mir, r=wesleywiser,tmiasko
Refactor unwind in MIR

This makes unwinding from current `Option<BasicBlock>` into
```rust
enum UnwindAction {
	Continue,
	Cleanup(BasicBlock),
	Unreachable,
	Terminate,
}
```

cc `@JakobDegen` `@RalfJung` `@Amanieu`
2023-04-07 10:31:14 +00:00
Maybe Waffle
fbe0591c68 Mark OwnedSlice::{deref, borrow} as #[inline] 2023-04-07 10:14:50 +00:00
bors
b6f6104a1f Auto merge of #110019 - jplatte:jplatte/stabilize-is-some-and, r=Amanieu
Stabilize is_some_and

This stabilizes the following public API:

```rust
impl<T> Option<T> {
    pub fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool;
}

impl<T, E> Result<T, E> {
    pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool;
    pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool;
}
```

Closes #93050 (tracking issue).

`@rustbot` label +T-libs-api -T-libs
2023-04-07 08:09:20 +00:00
ickk
726598ed9a fix infer_source_kind_subdiag_let help message - remove double "the" 2023-04-07 17:42:17 +10:00
Michael Goulet
d5b1ef1c3f Use smart-resolve when checking for trait in RHS of UFCS 2023-04-07 05:33:52 +00:00
bors
32ea4bb9e3 Auto merge of #109663 - fee1-dead-contrib:rustc_macros-syn-2.0, r=Nilstrieb
migrate rustc_macros to syn 2.0

WIP at this point since I need to work on migrating the code that heavily uses `NestedMeta` for parsing. Perhaps a full refactor would be nice..
2023-04-07 03:37:21 +00:00
Jack Huey
b15195a304 Remove u32 on BoundTyKind::Anon 2023-04-06 23:08:04 -04:00
Jack Huey
f0edcc8a6f Remove index from BrAnon 2023-04-06 23:01:40 -04:00
Jack Huey
e4edf00f12 Don't use BrAnon index in diagnostics 2023-04-06 23:01:38 -04:00
Jack Huey
167b70692b Remove expect_anon and expect_anon_placeholder in favor of var 2023-04-06 23:01:38 -04:00
Jack Huey
4646b3df6a Use BoundTy and BoundRegion instead of kind of PlaceholderTy and PlaceholderRegion 2023-04-06 23:01:35 -04:00
Matthias Krüger
903b439cac
Rollup merge of #110022 - Ezrashaw:fix-parser-ident-regression, r=compiler-errors
fix: fix regression in #109203

Fixes #110014

r? `@compiler-errors`
2023-04-07 00:00:26 +02:00
Matthias Krüger
e70818983b
Rollup merge of #110013 - compiler-errors:non-exhaustive-privacy-reason, r=WaffleLapkin
Label `non_exhaustive` attribute on privacy errors from non-local items

Label when an ADT is `non_exhaustive` and we get a privacy error, help with confusion in a case like this:

```rust
#[non_exhaustive]
pub struct Foo;

// other crate
let x = Foo;
//~^ ERROR unit struct `Foo` is private
```
2023-04-07 00:00:25 +02:00
Matthias Krüger
e63586f386
Rollup merge of #109957 - fmease:fix-109905, r=petrochenkov
diagnostics: account for self type when looking for source of unsolved type variable

Fixes #109905.

When searching for the source of an unsolved infer var inside of a list of generic args, we look through the `tcx.generics_of(…).own_substs(…)` which *skips* the self type if present. However, the computed `argument_index` is later[^1] used to index into `tcx.generics_of(…).params` which may still contain the self type. In such case, we are off by one when indexing into the parameters.

From now on, we account for this immediately after calling `own_substs` which keeps things local.

This also fixes the wrong output in the preexisting UI test `inference/need_type_info/concrete-impl.rs` which was overlooked. It used to claim that the *type of type parameter `Self`* couldn't be inferred in `<Struct as Ambiguous<_>>::method()` which of course isn't true: `Self` equals `Struct` here, `A` couldn't be inferred.

`@rustbot` label A-diagnostics

[^1]: f98a271814/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs (L471)
2023-04-07 00:00:24 +02:00
Gary Guo
1499a6faad UnwindAction::Terminate edge is also critical edge 2023-04-06 22:24:47 +01:00
Jonas Platte
443928f7e3
Stabilize is_some_and 2023-04-06 23:14:23 +02:00
Ezra Shaw
9dbf20ef27
fix: fix regression in #109203 2023-04-07 08:54:13 +12:00
bors
de74dab880 Auto merge of #110012 - matthiaskrgr:rollup-sgmm5xv, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #109395 (Fix issue when there are multiple candidates for edit_distance_with_substrings)
 - #109755 (Implement support for `GeneratorWitnessMIR` in new solver)
 - #109782 (Don't leave a comma at the start of argument list when removing arguments)
 - #109977 (rustdoc: avoid including line numbers in Google SERP snippets)
 - #109980 (Derive String's PartialEq implementation)
 - #109984 (Remove f32 & f64 from MemDecoder/MemEncoder)
 - #110004 (add `dont_check_failure_status` option in the compiler test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-06 18:48:42 +00:00
Maybe Waffle
2733c29bb1 Support multithreaded mode in OwnedSlice tests 2023-04-06 18:13:07 +00:00
Maybe Waffle
e0e39caf84 Add basic tests for OwnedSlice 2023-04-06 17:33:55 +00:00
Maybe Waffle
b6970d0e26 Use FnOnce for slice_owned instead of Fn 2023-04-06 17:03:42 +00:00
Michael Goulet
8ed2dc0bce Make span a bit better 2023-04-06 16:52:17 +00:00
Michael Goulet
00d54c879b Label non_exhaustive on privacy errors 2023-04-06 16:49:43 +00:00
Matthias Krüger
4ecfb7fc04
Rollup merge of #109984 - scottmcm:less-float, r=Nilstrieb
Remove f32 & f64 from MemDecoder/MemEncoder

r? ```@Nilstrieb```
since they said (maybe joked) on discord that it's a bug if the compiler uses f32 anywhere 🙃
2023-04-06 18:42:59 +02:00
Matthias Krüger
b153e2bd12
Rollup merge of #109782 - WaffleLapkin:nocommawhenremovingarguments, r=oli-obk
Don't leave a comma at the start of argument list when removing arguments

Fixes #109425

Quite a dirty hack, but at least it works ig.
2023-04-06 18:42:58 +02:00
Matthias Krüger
c86c9339e6
Rollup merge of #109755 - compiler-errors:new-solver-generator-witness-mir, r=cjgillot
Implement support for `GeneratorWitnessMIR` in new solver

r? ```@cjgillot```

I mostly want this to cut down the number of failing UI tests when running the UI test suite with `--compare-mode=next-solver`, but there doesn't seem like much reason to block implementing this since it adds minimal complexity to the existing structural traits impl in the new solver.

If others are against adding this for some reason, then maybe we should just make `GeneratorWitnessMIR` return `NoSolution` for these traits. Anything but an ICE please 😸 🧊
2023-04-06 18:42:57 +02:00
Matthias Krüger
3e21d6875f
Rollup merge of #109395 - chenyukang:yukang/fix-109291, r=cjgillot
Fix issue when there are multiple candidates for edit_distance_with_substrings

Fixes #109291
2023-04-06 18:42:57 +02:00
bors
f5b8f44e5d Auto merge of #109333 - Zoxc:erase-query-cache-values, r=cjgillot
Erase query cache values

This replaces most concrete query values `V` with `MaybeUninit<[u8; { size_of::<V>() }]>` without introducing dynamic dispatch like https://github.com/rust-lang/rust/pull/108638 does. This is split out of https://github.com/rust-lang/rust/pull/108638 so the performance impact of only this change can be measured.

r? `@cjgillot`
2023-04-06 16:29:36 +00:00
bors
0534655d9b Auto merge of #108504 - cjgillot:thir-pattern, r=compiler-errors,Nilstrieb
Check pattern refutability on THIR

The current `check_match` query is based on HIR, but partially re-lowers HIR into THIR.
This PR proposed to use the results of the `thir_body` query to check matches, instead of re-building THIR.

Most of the diagnostic changes are spans getting shorter, or commas/semicolons not getting removed.

This PR degrades the diagnostic for confusing constants in patterns (`let A = foo()` where `A` resolves to a `const A` somewhere): it does not point ot the definition of `const A` any more.
2023-04-06 12:42:01 +00:00
Gary Guo
c5829c2ee5 Fix new usage of old api 2023-04-06 09:34:16 +01:00
Gary Guo
e29b5badbc Fix mir interp of TerminatorKind::Terminate 2023-04-06 09:34:16 +01:00
Gary Guo
5ae3a53a44 Revert box_free unwind action 2023-04-06 09:34:16 +01:00
Gary Guo
de3f8a1578 Fix MSVC build 2023-04-06 09:34:16 +01:00
Gary Guo
bf6b84b10a Fix new usage of old api 2023-04-06 09:34:16 +01:00
Gary Guo
5cbda2a55e Fix tools 2023-04-06 09:34:16 +01:00
Gary Guo
3af45d6c57 Address review feedback 2023-04-06 09:34:16 +01:00
Gary Guo
e3f2edc75b Rename Abort terminator to Terminate
Unify terminology used in unwind action and terminator, and reflect
the fact that a nounwind panic is triggered instead of an immediate
abort is triggered for this terminator.
2023-04-06 09:34:16 +01:00
Gary Guo
0a5dac3062 Add UnwindAction::Terminate 2023-04-06 09:34:16 +01:00
Gary Guo
5e6ed132fa Add UnwindAction::Unreachable
This also makes eval machine's `StackPopUnwind`
redundant so that is replaced.
2023-04-06 09:34:16 +01:00
Gary Guo
daeb844e0c Refactor unwind from Option to a new enum 2023-04-06 09:34:16 +01:00
Scott McMurray
5cb23e4a43 Remove f32 & f64 from MemDecoder/MemEncoder 2023-04-06 00:54:07 -07:00
bors
2824db39f1 Auto merge of #109915 - scottmcm:layout-indexvec, r=oli-obk
Use `FieldIdx` in `FieldsShape`

Finally got to the main motivating example from https://github.com/rust-lang/compiler-team/issues/606 :)
2023-04-06 07:38:58 +00:00
John Kåre Alsaker
0110073d03 Fully erase query values 2023-04-06 08:25:54 +02:00