Commit Graph

21127 Commits

Author SHA1 Message Date
Tomasz Miąsko
955e7fbb16 Consistently use dominates instead of is_dominated_by
There is a number of APIs that answer dominance queries. Previously they
were named either "dominates" or "is_dominated_by". Consistently use the
"dominates" form.

No functional changes.
2023-01-21 12:15:02 +01:00
bors
b22aa57fd5 Auto merge of #106884 - clubby789:fieldless-enum-debug, r=michaelwoerister
Simplify `derive(Debug)` output for fieldless enums

Fixes #106875
2023-01-21 07:49:09 +00:00
Michael Goulet
7168aa5eb1
Rollup merge of #107112 - eltociear:patch-19, r=albertlarsan68
Fix typo in opaque_types.rs

paramters -> parameters
2023-01-20 21:33:23 -05:00
Michael Goulet
3452104715
Rollup merge of #107061 - compiler-errors:new-solver-new-candidates-3, r=lcnr
Implement some more new solver candidates and fix some bugs

First, fix some bugs:

1. `IndexVec::drain_enumerated(a..b)` does not give us an iterator of index keys + items enumerated from `a..b`, but from `0..(b-a)`... That caused a bug. See first commit for the fix.
2. Implement the `_: Trait` ambiguity hack. I put it in assemble, let me know if it should live elsewhere. This is important, since we otherwise consider `_: Sized` to have no solutions, and nothing passes!
3. Swap `Ambiguity` and `Unimplemented` cases for the new solver. Sorry for accidentally swapping them 😄
4. Check GATs' own predicates during projection confirmation.

Then implement a few builtin traits:

5. Implement `PointerSized`. Pretty independent.
6. Implement `Fn` family of traits for fnptr, fndef, and closures. Closures are currently broken because `FulfillCtxt::relationships` is intentionally left unimplemented. See comment in the test.

r? ```@lcnr```
2023-01-20 21:33:22 -05:00
Michael Goulet
bf75f8177b
Rollup merge of #104347 - notriddle:notriddle/import-macro-from-self-fixup, r=TaKO8Ki
diagnostics: suggest changing `s@self::{macro}@::macro` for exported

Fixes #99695
2023-01-20 21:33:21 -05:00
Michael Goulet
e6400693b8
Rollup merge of #104154 - timrobertsdev:deny-by-default-bindings_with_variant_name, r=scottmcm
Change `bindings_with_variant_name` to deny-by-default

Changed the `bindings_with_variant_name` lint to deny-by-default and fixed up the affected tests.

Addresses #103442.
2023-01-20 21:33:20 -05:00
Michael Howell
c07a722847 diagnostics: remvoe unnecessary use of source_map.start_point 2023-01-20 14:53:34 -07:00
Michael Howell
dca160a06a diagnostics: use module_path to check crate import instead of strings 2023-01-20 14:53:34 -07:00
Michael Howell
e237690a28 diagnostics: add }; only if { was added too 2023-01-20 14:53:33 -07:00
Michael Howell
e9d8d238ef diagnostics: suggest changing s@self::{macro}@::macro for exported
Fixes #99695
2023-01-20 14:52:24 -07:00
bors
94a300b9b8 Auto merge of #105102 - compiler-errors:copy-impl-considering-regions, r=lcnr
Check ADT fields for copy implementations considering regions

Fixes #88901
r? `@ghost`
2023-01-20 21:29:52 +00:00
bors
a6269dad38 Auto merge of #107106 - matthiaskrgr:rollup-g7r1ep0, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #106699 ([drop tracking] Visit break expressions )
 - #106738 (Fix known-bug annotations)
 - #106891 (Tweak "borrow closure argument" suggestion)
 - #106928 (add raw identifier for keyword in suggestion)
 - #107065 (Clippy: Make sure to include in beta: Move `unchecked_duration_subtraction` to pedantic)
 - #107068 (autoderive Subdiagnostic for AddtoExternBlockSuggestion)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-20 15:28:40 +00:00
bors
04a41f889f Auto merge of #107105 - matthiaskrgr:rollup-rkz9t7r, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #106783 (Recover labels written as identifiers)
 - #106973 (Don't treat closures from other crates as local)
 - #106979 (Document how to get the type of a default associated type)
 - #107053 (signal update string representation for haiku.)
 - #107058 (Recognise double-equals homoglyph)
 - #107067 (Custom MIR: Support storage statements)
 - #107076 (Added const-generic ui test case for issue #106419)
 - #107091 (Fix broken format strings in `infer.ftl`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-20 12:58:13 +00:00
Ikko Eltociear Ashimine
1adb4d6e5f
Fix typo in opaque_types.rs
paramters -> parameters
2023-01-20 17:56:29 +09:00
--global
1cbce729c7 Add compile_fail to doctest for bindings_with_variant_name 2023-01-20 02:26:12 -05:00
--global
734f375019 Change bindings_with_variant_name to deny-by-default 2023-01-20 02:26:12 -05:00
Matthias Krüger
c44c60caba
Rollup merge of #107068 - mejrs:use_derive, r=estebank
autoderive Subdiagnostic for AddtoExternBlockSuggestion
2023-01-20 07:25:30 +01:00
Matthias Krüger
da7a0c0b30
Rollup merge of #106928 - bvanjoi:print-keyword-raw-identifier, r=petrochenkov
add raw identifier for keyword in suggestion

fix https://github.com/rust-lang/rust/issues/106841
2023-01-20 07:25:29 +01:00
Matthias Krüger
5f2ad80e18
Rollup merge of #106891 - estebank:issue-45727, r=petrochenkov
Tweak "borrow closure argument" suggestion

Fix #45727.
2023-01-20 07:25:28 +01:00
Matthias Krüger
3d79cbc3c1
Rollup merge of #106699 - eholk:await-chains-drop-tracking, r=wesleywiser
[drop tracking] Visit break expressions

This fixes https://github.com/rust-lang/rust/issues/102383 by remembering to visit the expression in `break expr` when building the drop tracking CFG. Missing this step was causing an off-by-one error which meant after a number of awaits we'd be
looking for dropped values at the wrong point in the code.

Additionally, this changes the order of traversal for assignment expressions to visit the rhs and then the lhs. This matches what is done elsewhere.

Finally, this improves some of the debugging output (for example, the CFG visualizer) to make it easier to figure out these sorts of issues.
2023-01-20 07:25:27 +01:00
Matthias Krüger
c42fad8ff3
Rollup merge of #107091 - clubby789:infer-ftl-missing-dollar, r=compiler-errors
Fix broken format strings in `infer.ftl`

Fixes #107088
2023-01-20 07:16:12 +01:00
Matthias Krüger
66a9006759
Rollup merge of #107067 - tmiasko:custom-mir-storage-statements, r=oli-obk
Custom MIR: Support storage statements

r? `@oli-obk` `@JakobDegen`
2023-01-20 07:16:11 +01:00
Matthias Krüger
3693399ffc
Rollup merge of #107058 - clubby789:eqeq-homoglyph, r=wesleywiser
Recognise double-equals homoglyph

Recognise `⩵` as a homoglyph for `==`.

The first commit switches `char` to `&str`, as all previous homoglyphs corresponded to a single ASCII character, while the second implements the fix.

`@rustbot` label +A-diagnostics +A-parser
2023-01-20 07:16:10 +01:00
Matthias Krüger
a2712cb4b6
Rollup merge of #106979 - Nilstrieb:type-of-default-assoc-type, r=petrochenkov
Document how to get the type of a default associated type
2023-01-20 07:16:09 +01:00
Matthias Krüger
240cc81768
Rollup merge of #106973 - oli-obk:tait_ice_closure_in_impl_header, r=lcnr
Don't treat closures from other crates as local

fixes #104817

r? `@lcnr`

Specialization can prefer an impl for an opaque type over a blanket impls that also matches. If the blanket impl only applies if an auto-trait applies, we look at the hidden type of the opaque type to see if that implements the auto trait. The hidden type can be a closure or generator, and thus we will end up seeing these types in coherence and have to handle them properly.
2023-01-20 07:16:09 +01:00
Matthias Krüger
df88f7e02c
Rollup merge of #106783 - WaffleLapkin:break-my-ident, r=wesleywiser
Recover labels written as identifiers

This adds recovery for `break label expr` and `continue label`, as well as a test for `break label`.
2023-01-20 07:16:08 +01:00
bors
56ee85274e Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb
Remove some `ref` patterns from the compiler

Previous PR: https://github.com/rust-lang/rust/pull/105368

r? `@Nilstrieb`
2023-01-20 04:52:28 +00:00
clubby789
f3cde8e9da Fix broken format strings in infer.ftl 2023-01-19 23:13:01 +00:00
Esteban Küber
33e11a3b2e Tweak "borrow closure argument" suggestion
Fix #45727.
2023-01-19 19:35:49 +00:00
bors
4c83bd03a9 Auto merge of #107038 - compiler-errors:dont-wfcheck-non-local-rpit, r=oli-obk
Don't wf-check non-local RPITs

We were using `ty::is_impl_trait_defn(..).is_none()` to check if we need to add WF obligations for an opaque type.

This is *supposed* to be checking if the type is a TAIT, since RPITs' wfness is implied by wf checking its parent item, but since `is_impl_trait_defn` returns `None` for non-local RPIT and async futures, we unnecessarily consider wf predicates for an RPIT if it is coming from a foreign crate.

Fixes #107036

r? `@oli-obk` but feel free to reassign
2023-01-19 16:49:06 +00:00
bohan
97ae79ac9d add raw identifier for keyword in suggestion 2023-01-20 00:36:20 +08:00
Michael Goulet
ed6aebbfec trait solver: Implement Fn traits and tuple trait 2023-01-19 16:15:28 +00:00
Michael Goulet
69890b2df4 trait solver: PointerSized 2023-01-19 16:15:28 +00:00
Michael Goulet
f53f5b4463 swap Ambiguity and Unimplemented in new trait engine 2023-01-19 16:15:28 +00:00
Michael Goulet
aee75f25cb Assert goal is fully normalized during assemble 2023-01-19 16:15:28 +00:00
Michael Goulet
7e0b1f1115 Conditionally encode boolean 2023-01-19 16:09:10 +00:00
clubby789
95a824c02c Special case derive(Debug) for fieldless enums 2023-01-19 15:53:31 +00:00
Michael Goulet
200f466d1a Encode whether foreign opaques are TAITs or not 2023-01-19 15:45:49 +00:00
clubby789
97cf1713d1 Add enum for fieldless unification 2023-01-19 15:41:11 +00:00
Michael Goulet
c9c8e294d2 HACK: self ty ambiguity hack 2023-01-19 15:31:57 +00:00
Michael Goulet
280f69d858 Fix IndexVec::drain_enumerated 2023-01-19 15:25:33 +00:00
bors
19423b5944 Auto merge of #106910 - aliemjay:alias-ty-in-regionck, r=oli-obk
even more unify Projection/Opaque handling in region outlives code

edit: This continues ate the same pace as #106829. New changes are described in https://github.com/rust-lang/rust/pull/106910#issuecomment-1383251254.

~This touches `OutlivesBound`, `Component`, `GenericKind` enums.~

r? `@oli-obk` (because of overlap with #95474)
2023-01-19 14:05:07 +00:00
mejrs
cc5af33d64 Autoderive ExternBlockSuggestion 2023-01-19 13:52:15 +01:00
Ali MJ Al-Nasrawy
a7a842027c even more unify Projection/Opaque in outlives code 2023-01-19 15:31:53 +03:00
Oli Scherer
42f1f54a5e Don't treat closures from other crates as local 2023-01-19 11:29:40 +00:00
Tomasz Miąsko
ca3d55e32d Custom MIR: Support storage statements 2023-01-19 11:53:33 +01:00
Guillaume Gomez
dee88e0fa2
Rollup merge of #107037 - tmiasko:rank, r=oli-obk
Fix Dominators::rank_partial_cmp to match documentation

The only use site is also updated accordingly and there is no change in end-to-end behaviour.
2023-01-19 11:19:36 +01:00
Guillaume Gomez
246daa49ee
Rollup merge of #106931 - Ezrashaw:docs-e0208, r=compiler-errors
document + UI test `E0208` and make its output more user-friendly

Cleans up `E0208`'s output a lot. It could actually be useful for someone learning about variance now. I also added a UI test for it in `tests/ui/error-codes/` and wrote some docs for it.

r? `@GuillaumeGomez` another error code, can't be bothered to find the issue :P. Obviously there's some compiler stuff, so you'll have to hand it off.

Part of https://github.com/rust-lang/rust/issues/61137.
2023-01-19 11:19:35 +01:00
Guillaume Gomez
1a878df2b8
Rollup merge of #106927 - Ezrashaw:e0606-make-machine-applicable, r=estebank
make `CastError::NeedsDeref` create a `MachineApplicable` suggestion

Fixes #106903

Simple impl for the linked issue. I also made some other small changes:
- `CastError::ErrorGuaranteed` now owns an actual `ErrorGuaranteed`. This better enforces the static guarantees of `ErrorGuaranteed`.
- `CastError::NeedDeref` code simplified a bit, we now just suggest the `*`, instead of the whole expression as well.
2023-01-19 11:19:34 +01:00
Guillaume Gomez
30ddeefcf0
Rollup merge of #105977 - Swatinem:async-mir-context, r=oli-obk
Transform async `ResumeTy` in generator transform

- Eliminates all the `get_context` calls that async lowering created.
- Replace all `Local` `ResumeTy` types with `&mut Context<'_>`.

The `Local`s that have their types replaced are:
- The `resume` argument itself.
- The argument to `get_context`.
- The yielded value of a `yield`.

The `ResumeTy` hides a `&mut Context<'_>` behind an unsafe raw pointer, and the `get_context` function is being used to convert that back to a `&mut Context<'_>`.

Ideally the async lowering would not use the `ResumeTy`/`get_context` indirection, but rather directly use `&mut Context<'_>`, however that would currently lead to higher-kinded lifetime errors.
See <https://github.com/rust-lang/rust/issues/105501>.

The async lowering step and the type / lifetime inference / checking are still using the `ResumeTy` indirection for the time being, and that indirection is removed here. After this transform, the generator body only knows about `&mut Context<'_>`.

---

Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1330 CC `@bjorn3`

r? `@compiler-errors`
2023-01-19 11:19:34 +01:00