about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-12-09Print constness in TraitPredPrintModifiersAndPathMichael Goulet-5/+5
2023-12-09Don't print host effect param in pretty path_generic_argsMichael Goulet-2/+2
2023-12-09Rollup merge of #118775 - Young-Flash:fix, r=compiler-errorsGuillaume Gomez-3/+69
chore: add test case for type with generic follow up https://github.com/rust-lang/rust/pull/118502
2023-12-09Rollup merge of #118774 - lcnr:region-refactor-uwu, r=compiler-errorsGuillaume Gomez-4/+57
add test for inductive cycle hangs the same pattern is already tested for coinductive cycles, but I now understand the underlying issue and want to make sure we also test it for inductive ones r? `@compiler-errors`
2023-12-09report_not_const_evaluatable_error to avoid ICEing on ConstKind::ExprLenko Donchev-0/+89
2023-12-09Auto merge of #118780 - GuillaumeGomez:rollup-nd0syaf, r=GuillaumeGomezbors-77/+673
Rollup of 6 pull requests Successful merges: - #117953 (Add more SIMD platform-intrinsics) - #118057 (dedup for duplicate suggestions) - #118638 (More `rustc_mir_dataflow` cleanups) - #118702 (Strengthen well known check-cfg names and values test) - #118734 (Unescaping cleanups) - #118766 (Lower some forgotten spans) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-09use different revisions for testing colors on windowsjyn-6/+81
this is kinda jank because it means people need both machines to bless the tests
2023-12-09Rollup merge of #118734 - nnethercote:literal-cleanups, r=fee1-deadGuillaume Gomez-0/+0
Unescaping cleanups Minor improvements I found while working on #118699. r? `@fee1-dead`
2023-12-09Rollup merge of #118702 - Urgau:check-cfg-strengthen-well-known, r=nnethercoteGuillaume Gomez-77/+295
Strengthen well known check-cfg names and values test https://github.com/rust-lang/rust/pull/118494 is changing the implementation of how we expect well known check-cfg names and values, but we currently don't have a test that checks every well known only some of them. This PR therefore strengthen our well known names/values test to include all of the configs to at least avoid unintended regressions and validate new entry. *this PR also contains some drive-by consolidation of unexpected `target_os`, `target_arch` into a single file* r? `@nnethercote` (maybe? feel free to re-assign)
2023-12-09Rollup merge of #118057 - bvanjoi:fix-118048, r=cjgillotGuillaume Gomez-0/+31
dedup for duplicate suggestions Fixes #118048 An easy fix.
2023-12-09Rollup merge of #117953 - farnoy:masked-load-store, r=workingjubileeGuillaume Gomez-0/+347
Add more SIMD platform-intrinsics - [x] simd_masked_load - [x] LLVM codegen - llvm.masked.load - [x] cranelift codegen - implemented but untested - [ ] simd_masked_store - [x] LLVM codegen - llvm.masked.store - [ ] cranelift codegen Also added a run-pass test to test both intrinsics, and additional build-fail & check-fail to cover validation for both intrinsics
2023-12-09Auto merge of #116170 - matthewjasper:remove-thir-destruction-scopes, r=cjgillotbors-306/+163
Don't include destruction scopes in THIR They are not used by anyone, and add memory/performance overhead.
2023-12-09Add simd_masked_{load,store} platform-intrinsicsJakub Okoński-0/+347
This maps to the LLVM intrinsics: llvm.masked.load and llvm.masked.store
2023-12-09Avoid target_os and target_arch in some check-cfg testsUrgau-21/+4
as they unnecessarily clutter the diagnostic output and make the experience of adding a new target to the compiler more painful than it should be. target_os and target_arch are still being tested in the well-known-values.rs test, but in one place.
2023-12-09Strengthen well known check-cfg names and values testUrgau-56/+291
2023-12-09add test for inductive cycle hangslcnr-4/+57
2023-12-09chore: add test case for type with genericYoung-Flash-3/+69
2023-12-09Rollup merge of #118764 - compiler-errors:fused-async-iterator, r=eholkJubilee-0/+4
Make async generators fused by default I actually changed my mind about this since the implementation PR landed. I think it's beneficial for `async gen` blocks to be "fused" by default -- i.e., for them to repeatedly return `Poll::Ready(None)` -- rather than panic. We have [`FusedStream`](https://docs.rs/futures/latest/futures/stream/trait.FusedStream.html) in futures-rs to represent streams with this capability already anyways. r? eholk cc ```@rust-lang/wg-async,``` would like to know if anyone else has opinions about this.
2023-12-09Rollup merge of #118666 - Zalathar:body-closure, r=cjgillotJubilee-0/+67
coverage: Simplify the heuristic for ignoring `async fn` return spans The code for extracting coverage spans from MIR has a special heuristic for dealing with `async fn`, so that the function's closing brace does not have a confusing double count. The code implementing that heuristic is currently mixed in with the code for flushing remaining spans after the main refinement loop, making the refinement code harder to understand. We can solve that by hoisting the heuristic to an earlier stage, after the spans have been extracted and sorted but before they have been processed by the refinement loop. The coverage tests verify that the heuristic is still effective, so coverage mappings/reports for `async fn` have not changed. --- This PR also has the side-effect of fixing the `None some_prev` panic that started appearing after #118525. The old code assumed that `prev` would always be present after the refinement loop. That was only true if the list of collected spans was non-empty, but prior to #118525 that didn't seem to come up in practice. After that change, the list of collected spans could be empty in some specific circumstances, leading to panics. The new code uses an `if let` to inspect `prev`, which correctly does nothing if there is no span present.
2023-12-09Rollup merge of #118610 - krasimirgg:llvm-18-dec, r=nikicJubilee-2/+2
update target feature following LLVM API change LLVM commit https://github.com/llvm/llvm-project/commit/e81796671890b59c110f8e41adc7ca26f8484d20 renamed* the `unaligned-scalar-mem` target feature to `fast-unaligned-access`. (*) technically the commit folded two previous features into one, but there are no references to the other one in rust.
2023-12-09Rollup merge of #118512 - spastorino:add-implied-bounds-related-tests, ↵Jubilee-8/+202
r=jackh726 Add tests related to normalization in implied bounds Getting ```@aliemjay's``` tests from #109763, so we can better track what's going on in every different example. r? ```@jackh726```
2023-12-09Rollup merge of #118198 - Zalathar:if-not, r=cjgillotJubilee-5/+119
coverage: Use `SpanMarker` to improve coverage spans for `if !` expressions Coverage instrumentation works by extracting source code spans from MIR. However, some kinds of syntax are effectively erased during MIR building, so their spans don't necessarily exist anywhere in MIR, making them invisible to the coverage instrumentor (unless we resort to various heuristics and hacks to recover them). This PR introduces `CoverageKind::SpanMarker`, which is a new variant of `StatementKind::Coverage`. Its sole purpose is to represent spans that would otherwise not appear in MIR, so that the coverage instrumentor can extract them. When coverage is enabled, the MIR builder can insert these dummy statements as needed, to improve the accuracy of spans used by coverage mappings. Fixes #115468. --- ```@rustbot``` label +A-code-coverage
2023-12-09Don't warn an empty pattern unreachable if we're not sure the data is validNadrieril-615/+93
2023-12-09Test empty types betterNadrieril-502/+2606
2023-12-08Do not parenthesize exterior struct lit inside match guardsDavid Tolnay-1/+1
2023-12-08Add if_let_guard and let_chains pretty printer testsDavid Tolnay-1/+20
2023-12-08Add Bevy related test casesSantiago Pastorino-0/+97
2023-12-09Tweak the `no-nuls.rs` test.Nicholas Nethercote-0/+0
The `empty!` macro calls should be outside the `cfg(FALSE)` function.
2023-12-08Make async generators fused by defaultMichael Goulet-0/+4
2023-12-08Rollup merge of #118736 - aliemjay:revert-ice-on-ambig, r=compiler-errorsMatthias Krüger-0/+24
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-172/+172
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-13/+82
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-5/+139
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-0/+73
fix: correct the arg for 'suggest to use associated function syntax' diagnostic close https://github.com/rust-lang/rust/issues/118469
2023-12-08Add tests related to normalization in implied boundsSantiago Pastorino-8/+105
2023-12-08Support bare unit structs in destructuring assignmentsMichael Goulet-24/+40
2023-12-08use magenta instead of bold for highlightingjyn-10/+56
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-08Auto merge of #118420 - compiler-errors:async-gen, r=eholkbors-16/+132
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-08Add testsMichael Goulet-10/+132
2023-12-08Support async gen fnMichael Goulet-13/+7
2023-12-08coro_kind -> coroutine_kindMichael Goulet-1/+1
2023-12-08Auto merge of #118527 - Nadrieril:never_patterns_parse, r=compiler-errorsbors-45/+435
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-08privacy: visit trait def id of projectionsDavid Wood-13/+82
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-08Auto merge of #118689 - compiler-errors:const-drop, r=fee1-deadbors-34/+3
Fix const drop checking Fixes confirmation of `~const Destruct` and const drops. r? fee1-dead
2023-12-08update target feature following LLVM API changeKrasimir Georgiev-2/+2
LLVM commit https://github.com/llvm/llvm-project/commit/e81796671890b59c110f8e41adc7ca26f8484d20 renamed the `unaligned-scalar-mem` target feature to `fast-unaligned-access`.
2023-12-08coverage: Regression test for unwrapping `prev` when there are no spansZalathar-0/+67
2023-12-08coverage: Use `SpanMarker` to mark the full condition of `if !`Zalathar-12/+12
When MIR is built for an if-not expression, the `!` part of the condition doesn't correspond to any MIR statement, so coverage instrumentation normally can't see it. We can fix that by deliberately injecting a dummy statement whose sole purpose is to associate that span with its enclosing block.
2023-12-08coverage: Add a dedicated test for coverage of `if !`Zalathar-0/+114
2023-12-08Auto merge of #118668 - fmease:resolve-assoc-item-bindings-by-namespace, ↵bors-81/+199
r=compiler-errors Resolve associated item bindings by namespace This is the 3rd commit split off from #118360 with tests reblessed (they no longer contain duplicated diags which were caused by 4c0addc80af4666f26d7ad51fe34a0e2dd0b8b74) & slightly adapted (removed supertraits from a UI test, cc #118040). > * Resolve all assoc item bindings (type, const, fn (feature `return_type_notation`)) by namespace instead of trying to resolve a type first (in the non-RTN case) and falling back to consts afterwards. This is consistent with RTN. E.g., for `Tr<K = {…}>` we now always try to look up assoc consts (this extends to supertrait bounds). This gets rid of assoc tys shadowing assoc consts in assoc item bindings which is undesirable & inconsistent (types and consts live in different namespaces after all) > * Consolidate the resolution of assoc {ty, const} bindings and RTN (dedup, better diags for RTN) > * Fix assoc consts being labeled as assoc *types* in several diagnostics > * Make a bunch of diagnostics translatable Fixes #112560 (error → pass). As discussed r? `@compiler-errors` --- **Addendum**: What I call “associated item bindings” are commonly referred to as “type bindings” for historical reasons. Nowadays, “type bindings” include assoc type bindings, assoc const bindings and RTN (return type notation) which is why I prefer not to use this outdated term.
2023-12-08temporarily revert "ice on ambguity in mir typeck"Ali MJ Al-Nasrawy-0/+24
Reverts #116530