about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-12-08Make async generators fused by defaultMichael Goulet-11/+37
2023-12-08Rollup merge of #118736 - aliemjay:revert-ice-on-ambig, r=compiler-errorsMatthias Krüger-12/+28
temporarily revert "ice on ambguity in mir typeck" Reverts #116530 as a temporary measure to fix #117577. That issue should be ultimately fixed by checking WF of type annotations prior to normalization, which is implemented in #104098 but this PR is intended to be backported to beta. r? ``@compiler-errors`` (the reviewer of the reverted PR)
2023-12-08Rollup merge of #118730 - jyn514:cmp_refs, r=estebank,compiler-errorsMatthias Krüger-214/+224
recurse into refs when comparing tys for diagnostics before: ![image](https://github.com/rust-lang/rust/assets/23638587/bf6abd62-c7f3-4c09-a47e-31b6e129de19) after: ![image](https://github.com/rust-lang/rust/assets/23638587/b704d728-ddba-4204-aebe-c07dcbbcb55c) this diff from the test suite is also quite nice imo: ```diff `@@` -4,8 +4,8 `@@` error[E0308]: mismatched types LL | debug_assert_eq!(iter.next(), Some(value)); | ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>` | - = note: expected enum `Option<<I as Iterator>::Item>` - found enum `Option<&<I as Iterator>::Item>` + = note: expected enum `Option<_>` + found enum `Option<&_>` ```
2023-12-08Rollup merge of #118715 - ↵Matthias Krüger-19/+89
davidtwco:issue-117997-privacy-visit-trait-ref-and-args, r=TaKO8Ki privacy: visit trait def id of projections Fixes #117997. A refactoring in #117076 changed the `DefIdVisitorSkeleton` to avoid calling `visit_projection_ty` for `ty::Projection` aliases, and instead just iterate over the args - this makes sense, as `visit_projection_ty` will indirectly visit all of the same args, but in doing so, will also create a `TraitRef` containing the trait's `DefId`, which also gets visited. The trait's `DefId` isn't visited when we only visit the arguments without separating them into `TraitRef` and own args first. Eventually this influences the reachability set and whether a function is encoded into the metadata.
2023-12-08Rollup merge of #118694 - celinval:smir-alloc-methods, r=ouz-aMatthias Krüger-29/+458
Add instance evaluation and methods to read an allocation in StableMIR The instance evaluation is needed to handle intrinsics such as `type_id` and `type_name`. Since we now use Allocation to represent all evaluated constants, provide a few methods to help process the data inside an allocation. I've also started to add a structured way to get information about the compilation target machine. For now, I've only added information needed to process an allocation. r? ``````@ouz-a``````
2023-12-08Rollup merge of #118502 - Young-Flash:fix, r=compiler-errorsMatthias Krüger-3/+78
fix: correct the arg for 'suggest to use associated function syntax' diagnostic close https://github.com/rust-lang/rust/issues/118469
2023-12-08Rollup merge of #117586 - compiler-errors:the-canonicalizer, r=lcnrMatthias Krüger-261/+477
Uplift the (new solver) canonicalizer into `rustc_next_trait_solver` Uplifts the new trait solver's canonicalizer into a new crate called `rustc_next_trait_solver`. The crate name is literally a bikeshed-avoidance name, so let's not block this PR on that -- renames are welcome later. There are a host of other changes that were required to make this possible: * Expose a `ConstTy` trait to get the `Interner::Ty` from a `Interner::Const`. * Expose some constructor methods to construct `Bound` variants. These are currently methods defined on the interner themselves, but they could be pulled into traits later. * Expose a `IntoKind` trait to turn a `Ty`/`Const`/`Region` into their corresponding `*Kind`s. * Some minor tweaks to other APIs in `rustc_type_ir`. The canonicalizer code itself is best reviewed **with whitespace ignored.** r? ``@lcnr``
2023-12-08Auto merge of #117681 - Zoxc:tcx-sync, r=compiler-errorsbors-1/+13
Explicitly implement `DynSync` and `DynSend` for `TyCtxt` This is an attempt to short circuit trait resolution. It should get a perf run for bootstrap impact.
2023-12-08Rename some more coro_kind -> coroutine_kindMichael Goulet-8/+9
2023-12-08More nitsMichael Goulet-4/+4
2023-12-08Introduce closure_id method on CoroutineKindMichael Goulet-24/+24
2023-12-08Fix x86 SSE4.1 ptestnzcEduardo Sánchez Muñoz-36/+41
`(op & mask) == 0` and `(op & mask) == mask` need each to be calculated for the whole vector. For example, given * `op = [0b100, 0b010]` * `mask = [0b100, 0b110]` The correct result would be: * `op & mask = [0b100, 0b010]` Comparisons are done on the vector as a whole: * `all_zero = (op & mask) == [0, 0] = false` * `masked_set = (op & mask) == mask = false` * `!all_zero && !masked_set = true` The previous method: `op & mask = [0b100, 0b010]` Comparisons are done element-wise: * `all_zero = (op & mask) == [0, 0] = [true, true]` * `masked_set = (op & mask) == mask = [true, false]` * `!all_zero && !masked_set = [true, false]` After folding with AND, the final result would be `false`, which is incorrect.
2023-12-08Add tests related to normalization in implied boundsSantiago Pastorino-8/+105
2023-12-08Support bare unit structs in destructuring assignmentsMichael Goulet-24/+42
2023-12-08Auto merge of #16060 - Veykril:format-args-orphans, r=Veykrilbors-8/+187
fix: Fix completion failing in `format_args!` with invalid template
2023-12-08fix: Fix fragment parser replacing matches with dummies on incomplete parsesLukas Wirth-25/+82
2023-12-08Auto merge of #3214 - eduardosm:move-x86-code, r=RalfJungbors-265/+304
Move some x86 intrinsics code to helper functions in `shims::x86` To make them reusable for intrinsics of other x86 features. Splitted from https://github.com/rust-lang/miri/pull/3192
2023-12-08fix: Fix completion failing in format_args! with invalid templateLukas Wirth-8/+187
2023-12-08use magenta instead of bold for highlightingjyn-12/+58
according to a poll of gay people in my phone, purple is the most popular color to use for highlighting | color | percentage | | ---------- | ---------- | | bold white | 6% | | blue | 14% | | cyan | 26% | | purple | 37% | | magenta | 17% | unfortunately, purple is not supported by 16-color terminals, which rustc apparently wants to support for some reason. until we require support for full 256-color terms (e.g. by doing the same feature detection as we currently do for urls), we can't use it. instead, i have collapsed the purple votes into magenta on the theory that they're close, and also because magenta is pretty.
2023-12-08Simplify and comment the special-casing for Windows colorsjyn-10/+10
2023-12-08Auto merge of #118420 - compiler-errors:async-gen, r=eholkbors-6/+7
Introduce support for `async gen` blocks I'm delighted to demonstrate that `async gen` block are not very difficult to support. They're simply coroutines that yield `Poll<Option<T>>` and return `()`. **This PR is WIP and in draft mode for now** -- I'm mostly putting it up to show folks that it's possible. This PR needs a lang-team experiment associated with it or possible an RFC, since I don't think it falls under the jurisdiction of the `gen` RFC that was recently authored by oli (https://github.com/rust-lang/rfcs/pull/3513, https://github.com/rust-lang/rust/issues/117078). ### Technical note on the pre-generator-transform yield type: The reason that the underlying coroutines yield `Poll<Option<T>>` and not `Poll<T>` (which would make more sense, IMO, for the pre-transformed coroutine), is because the `TransformVisitor` that is used to turn coroutines into built-in state machine functions would have to destructure and reconstruct the latter into the former, which requires at least inserting a new basic block (for a `switchInt` terminator, to match on the `Poll` discriminant). This does mean that the desugaring (at the `rustc_ast_lowering` level) of `async gen` blocks is a bit more involved. However, since we already need to intercept both `.await` and `yield` operators, I don't consider it much of a technical burden. r? `@ghost`
2023-12-08Auto merge of #118420 - compiler-errors:async-gen, r=eholkbors-355/+1118
Introduce support for `async gen` blocks I'm delighted to demonstrate that `async gen` block are not very difficult to support. They're simply coroutines that yield `Poll<Option<T>>` and return `()`. **This PR is WIP and in draft mode for now** -- I'm mostly putting it up to show folks that it's possible. This PR needs a lang-team experiment associated with it or possible an RFC, since I don't think it falls under the jurisdiction of the `gen` RFC that was recently authored by oli (https://github.com/rust-lang/rfcs/pull/3513, https://github.com/rust-lang/rust/issues/117078). ### Technical note on the pre-generator-transform yield type: The reason that the underlying coroutines yield `Poll<Option<T>>` and not `Poll<T>` (which would make more sense, IMO, for the pre-transformed coroutine), is because the `TransformVisitor` that is used to turn coroutines into built-in state machine functions would have to destructure and reconstruct the latter into the former, which requires at least inserting a new basic block (for a `switchInt` terminator, to match on the `Poll` discriminant). This does mean that the desugaring (at the `rustc_ast_lowering` level) of `async gen` blocks is a bit more involved. However, since we already need to intercept both `.await` and `yield` operators, I don't consider it much of a technical burden. r? `@ghost`
2023-12-08Move implementation of SSE4.1 dpps/dppd to helper functionEduardo Sánchez Muñoz-37/+52
2023-12-08Move implementation of SSE4.1 `ptest*` into a helper functionEduardo Sánchez Muñoz-21/+41
2023-12-08Auto merge of #16058 - Veykril:macro-diagnostics, r=Veykrilbors-18/+99
fix: Smaller spans for unresolved field and method diagnostics
2023-12-08fix: Smaller spans for unresolved field and method diagnosticsLukas Wirth-18/+99
2023-12-08Make it not depend on nightly conditionallyMichael Goulet-1/+7
2023-12-08FeedbackMichael Goulet-229/+205
- Take more things by self, not &self - Clone more things - Rework namespacing so we can use `ty::` in the canonicalizer
2023-12-08Uplift canonicalizer into new trait solver crateMichael Goulet-272/+506
2023-12-08Make some matches exhaustive to avoid bugs, fix toolsMichael Goulet-1/+2
2023-12-08Add testsMichael Goulet-19/+148
2023-12-08HACK: constrain yield type in check_fn so that projection is successful even ↵Michael Goulet-3/+23
with no yield
2023-12-08Make some matches exhaustive to avoid bugs, fix toolsMichael Goulet-46/+72
2023-12-08Support async gen fnMichael Goulet-104/+115
2023-12-08coro_kind -> coroutine_kindMichael Goulet-5/+5
2023-12-08coro_kind -> coroutine_kindMichael Goulet-75/+100
2023-12-08Implement `async gen` blocksMichael Goulet-54/+563
2023-12-08Rework coroutine transform to be more flexible in preparation for async ↵Michael Goulet-80/+123
generators
2023-12-08Auto merge of #118527 - Nadrieril:never_patterns_parse, r=compiler-errorsbors-236/+772
never_patterns: Parse match arms with no body Never patterns are meant to signal unreachable cases, and thus don't take bodies: ```rust let ptr: *const Option<!> = ...; match *ptr { None => { foo(); } Some(!), } ``` This PR makes rustc accept the above, and enforces that an arm has a body xor is a never pattern. This affects parsing of match arms even with the feature off, so this is delicate. (Plus this is my first non-trivial change to the parser). ~~The last commit is optional; it introduces a bit of churn to allow the new suggestions to be machine-applicable. There may be a better solution? I'm not sure.~~ EDIT: I removed that commit r? `@compiler-errors`
2023-12-08Auto merge of #118527 - Nadrieril:never_patterns_parse, r=compiler-errorsbors-3/+7
never_patterns: Parse match arms with no body Never patterns are meant to signal unreachable cases, and thus don't take bodies: ```rust let ptr: *const Option<!> = ...; match *ptr { None => { foo(); } Some(!), } ``` This PR makes rustc accept the above, and enforces that an arm has a body xor is a never pattern. This affects parsing of match arms even with the feature off, so this is delicate. (Plus this is my first non-trivial change to the parser). ~~The last commit is optional; it introduces a bit of churn to allow the new suggestions to be machine-applicable. There may be a better solution? I'm not sure.~~ EDIT: I removed that commit r? `@compiler-errors`
2023-12-08new lint: `uninhabited_reference`Samuel Tardieu-2/+151
2023-12-08Auto merge of #16055 - Veykril:field-fallback-method, r=Veykrilbors-72/+140
Fallback to method resolution on unresolved field access with matching method name Allows typing out a method name without having to add calling parentheses to do IDE things on it. The inverse of this we already have.
2023-12-08Fallback to method resolution on unresolved field access with matching ↵Lukas Wirth-72/+140
method name
2023-12-08Remove extra check-cfg handled by libc directlyUrgau-2/+0
2023-12-08Auto merge of #16054 - Veykril:fix-downmapping, r=Veykrilbors-131/+164
fix: Fix token downmapping being quadratic Fixes https://github.com/rust-lang/rust-analyzer/issues/16050
2023-12-08fix: Fix token downmapping being quadraticLukas Wirth-131/+164
2023-12-08privacy: visit trait def id of projectionsDavid Wood-19/+89
A refactoring in #117076 changed the `DefIdVisitorSkeleton` to avoid calling `visit_projection_ty` for `ty::Projection` aliases, and instead just iterate over the args - this makes sense, as `visit_projection_ty` will indirectly visit all of the same args, but in doing so, will also create a `TraitRef` containing the trait's `DefId`, which also gets visited. The trait's `DefId` isn't visited when we only visit the arguments without separating them into `TraitRef` and own args first. Signed-off-by: David Wood <david@davidtw.co>
2023-12-08only return true in `fallback_types' if fallback has occurredlcnr-11/+10
2023-12-08Auto merge of #118689 - compiler-errors:const-drop, r=fee1-deadbors-67/+57
Fix const drop checking Fixes confirmation of `~const Destruct` and const drops. r? fee1-dead
2023-12-08Auto merge of #11907 - cocodery:issue11885, r=y21,xFrednetbors-52/+147
Add a function to check whether binary oprands are nontrivial fixes [#issue11885](https://github.com/rust-lang/rust-clippy/issues/11885) It's hard to check whether operator is overrided through context of lint. So, assume non-trivial structure like tuple, array or sturt, using a overrided binary operator in this lint, which might cause a side effict. This is not detected before. Althrough this might weaken the ability of this lint, it may more useful than before. Maybe this lint will cause an error, but now, it not. And assuming side effect of non-trivial structure with operator is not a bad thing, right? changelog: Fix: [`no_effect`] check if binary operands are nontrivial