about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-09-05Auto merge of #114843 - Zalathar:test-coverage-map, r=oli-obkbors-0/+5744
coverage: Explicitly test the coverage maps produced by codegen/LLVM Our existing coverage tests verify the output of end-to-end coverage reports, but we don't have any way to test the specific mapping information (code regions and their associated counters) that are emitted by `rustc_codegen_llvm` and LLVM. That makes it harder to to be confident in changes that would modify those mappings (whether deliberately or accidentally). This PR addresses that by adding a new `coverage-map` test suite that does the following: - Compiles test files to LLVM IR assembly (`.ll`) - Feeds those IR files to a custom tool (`src/tools/coverage-dump`) that extracts and decodes coverage mappings, and prints them in a more human-readable format - Checks the output of that tool against known-good snapshots --- I recommend excluding the last commit while reviewing the main changes, because that last commit is just ~40 test files copied over from `tests/run-coverage`, plus their blessed coverage-map snapshots and a readme file. Those snapshots aren't really intended to be checked by hand; they're mostly there to increase the chances that an unintended change to coverage maps will be observable (even if it requires relatively specific circumstances to manifest).
2023-09-05Rollup merge of #115540 - cjgillot:custom-debuginfo, r=oli-obkMatthias Krüger-0/+123
Support debuginfo for custom MIR.
2023-09-05Auto merge of #115553 - matthiaskrgr:rollup-c0045hz, r=matthiaskrgrbors-6/+121
Rollup of 5 pull requests Successful merges: - #115353 (Emit error instead of ICE when optimized MIR is missing) - #115488 (Take `&mut Results` in `ResultsVisitor`) - #115492 (Allow `large_assignments` for Box/Arc/Rc initialization) - #115519 (Don't ICE on associated type projection without feature gate in new solver) - #115534 (Expose more information with DefId in smir) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-05Rollup merge of #115519 - compiler-errors:next-solver-assoc-ice, r=lcnrMatthias Krüger-0/+40
Don't ICE on associated type projection without feature gate in new solver Self-explanatory, we should avoid ICEs when the feature gate is not enabled. Continue to ICE when the feature gate *is* enabled, though. Fixes #115500
2023-09-05Rollup merge of #115492 - Enselic:large-box-move, r=oli-obkMatthias Krüger-6/+56
Allow `large_assignments` for Box/Arc/Rc initialization Does the `stop linting in box/arc initialization` task of #83518. r? `@oli-obk` who is E-mentor.
2023-09-05Rollup merge of #115353 - Enselic:no-optimized-mir, r=oli-obkMatthias Krüger-0/+25
Emit error instead of ICE when optimized MIR is missing Closes #51388
2023-09-05Auto merge of #115531 - RalfJung:read_via_copy, r=scottmcmbors-4/+28
read_via_copy: don't prematurely optimize away the read Always do the read to ensure consistent UB error messages in const-eval/Miri. r? `@scottmcm`
2023-09-05Copy most of `tests/run-coverage` into `tests/coverage-map/status-quo`Zalathar-0/+5527
The output of these tests is too complicated to comfortably verify by hand, but we can still use them to observe changes to the underlying mappings produced by codegen/LLVM. If these tests fail due to non-coverage changes (e.g. in HIR-to-MIR lowering or MIR optimizations), it should usually be OK to just `--bless` them, as long as the `run-coverage` test suite still works.
2023-09-05Add test suite `coverage-map` to test coverage mappings emitted by LLVMZalathar-0/+217
We compile each test file to LLVM IR assembly, and then pass that IR to a dedicated program that can decode LLVM coverage maps and print them in a more human-readable format. We can then check that output against known-good snapshots. This test suite has some advantages over the existing `run-coverage` tests: - We can test coverage instrumentation without needing to run target binaries. - We can observe subtle improvements/regressions in the underlying coverage mappings that don't make a visible difference to coverage reports.
2023-09-05Auto merge of #115467 - compiler-errors:assoc-ty-object-safety, r=oli-obkbors-22/+59
Do not require associated types with Self: Sized to uphold bounds when confirming object candidate RPITITs and associated types that have `Self: Sized` bounds are opted out of the `dyn Trait` well-formedness check that happens during confirmation. This ensures that we can actually *use* `dyn Trait`s that have associated types that, e.g., have GATs and RPITITs and other naughty things as long as those are opted-out of object safety via a `Self: Sized` bound. Fixes #115464 This seems like a natural part of https://github.com/rust-lang/rust/pull/112319#issuecomment-1592574451, and I don't think needs re-litigation. r? `@oli-obk`
2023-09-04read_via_copy: don't prematurely optimize away the readRalf Jung-4/+28
2023-09-04Add help to allow lint for the implied by suggestionUrgau-1/+16
2023-09-04Auto merge of #115513 - Urgau:normalize-msg-after-translate, r=petrochenkovbors-0/+16
Don't forget to normalize the translated message This PR adds a missing call to `normalize_whitespace` after translating an label. Fixes https://github.com/rust-lang/rust/issues/115498
2023-09-03Don't ICE on associated type projection without feature gateMichael Goulet-0/+40
2023-09-03Auto merge of #115270 - sebastiantoh:issue-105479, r=Nadrierilbors-4/+80
Add note on non-exhaustiveness when matching on str and nested non-exhaustive enums Fixes https://github.com/rust-lang/rust/issues/105479 r? `@Nadrieril`
2023-09-03Don't forget to normalize the translated messageUrgau-0/+16
2023-09-03Rollup merge of #115503 - GuillaumeGomez:migrate-gui-test-color-38, r=notriddleGuillaume Gomez-3/+15
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-09-03Rollup merge of #115478 - gurry:115462-exprfield-no-warn, r=compiler-errorsGuillaume Gomez-4/+52
Emit unused doc comment warnings for pat and expr fields Fixes #115462
2023-09-03Improve clarity of diagnostic message on non-exhaustive matchesSebastian Toh-8/+8
2023-09-03Migrate GUI colors test to original CSS color formatGuillaume Gomez-6/+6
2023-09-03Use named arguments in `code-color.goml` GUI testGuillaume Gomez-3/+15
2023-09-03Allow `large_assignments` for Box/Arc/Rc initializationMartin Nordholts-6/+56
Does the `stop linting in box/arc initialization` task of 83518.
2023-09-03Emit unused doc comment warnings for pat and expr fieldsGurinder Singh-4/+52
2023-09-03Auto merge of #115436 - GuillaumeGomez:fix-type-based-search, r=notriddlebors-0/+67
[rustdoc] Fix type based search Fixes https://github.com/rust-lang/rust/issues/114522. The problem was a bit more tricky than I originally thought it would be: we only kept type ID and generics in short, but as soon as there was a full path in the user query, the element didn't get an ID anymore because the ID map didn't know about `x::y` (although it knew about `y`). So for this first problem, I instead always pass the element name to get the ID. Then a new problem occurred: we actually needed to check if paths matched, otherwise whatever the path, as long as the "end types" match, it's all good. meaning, we needed to add path information, but to do so, we needed it to be added into the search index directly as there was no mapping between `"p"` and `"q"`. I hope this explanation makes sense to someone else than me. ^^' r? `@notriddle`
2023-09-03Auto merge of #115484 - GuillaumeGomez:migrate-gui-test-color-37, r=notriddlebors-9/+9
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-09-02Correctly handle paths from foreign itemsGuillaume Gomez-0/+19
2023-09-02Migrate GUI colors test to original CSS color formatGuillaume Gomez-9/+9
2023-09-02Auto merge of #115273 - the8472:take-fold, r=cuviperbors-0/+15
Optimize Take::{fold, for_each} when wrapping TrustedRandomAccess iterators
2023-09-02restrict test to x86-64The 8472-0/+1
2023-09-02Auto merge of #115429 - compiler-errors:assoc-ct-lt-fallthrough, r=cjgillotbors-0/+59
Fall through when resolving elided assoc const lifetimes `@QuineDot` makes a good point in https://github.com/rust-lang/rust/issues/115010#issuecomment-1702127634 that we probably should not accept *more* code due to #115011 even though that code will eventually become a forbid-warning in a few versions (https://github.com/rust-lang/rust/issues/115010#issuecomment-1701598067). Fall through when walking thru the `AnonymousWarnToStatic` (renamed to `AnonymousWarn`) rib so that we can resolve as a fresh lifetime like we did before.
2023-09-02Do not require associated types with Self: Sized to uphold bounds when ↵Michael Goulet-22/+48
confirming object candidate
2023-09-02RPITITs are considered object-safe, they're always on Self:Sized methodsMichael Goulet-18/+29
2023-09-02Auto merge of #115286 - saethlin:detangler, r=petrochenkovbors-1/+1
Skip rendering metadata strings from include_str!/include_bytes! The const rendering code in rustdoc completely ignores consts from expansions, but the compiler was rendering all consts. So some consts (namely those from `include_bytes!`) were rendered then ignored. Most of the diff here is from moving `print_const_expr` from rustdoc into `rustc_hir_pretty` so that it can be used in rustdoc and when building rmeta files.
2023-09-02Auto merge of #113295 - clarfonthey:ascii-step, r=cuviperbors-1/+1
Implement Step for ascii::Char This allows iterating over ranges of `ascii::Char`, similarly to ranges of `char`. Note that `ascii::Char` is still unstable, tracked in #110998.
2023-09-01Auto merge of #115276 - fmease:rustdoc-obj-lt-defs-handle-self-ty-params, ↵bors-0/+34
r=GuillaumeGomez rustdoc: correctly deal with self ty params when eliding default object lifetimes Fixes #115179.
2023-09-01Reuse const rendering from rustdoc in rmeta encodingBen Kimock-1/+1
2023-09-01Rollup merge of #115424 - notriddle:notriddle/issue-106413, r=oli-obkMatthias Krüger-0/+159
diagnostics: avoid wrong `unused_parens` on `x as (T) < y` Fixes #106413 Fixes #80636
2023-09-01Support debuginfo for custom MIR.Camille GILLOT-0/+123
2023-09-01rustdoc: correctly deal with self ty params when eliding default object ↵León Orell Valerian Liehr-0/+34
lifetimes
2023-09-01Add tests for type-based searchGuillaume Gomez-0/+48
2023-09-01Auto merge of #113126 - Bryanskiy:delete_old, r=petrochenkovbors-1173/+798
Replace old private-in-public diagnostic with type privacy lints Next part of RFC https://github.com/rust-lang/rust/issues/48054. r? `@petrochenkov`
2023-09-01Auto merge of #111752 - dingxiangfei2009:lower-or-pattern, r=cjgillotbors-590/+931
Lower `Or` pattern without allocating place cc `@azizghuloum` `@cjgillot` Related to #111583 and #111644 While reviewing #111644, it occurs to me that while we directly lower conjunctive predicates, which are connected with `&&`, into the desirable control flow, today we don't directly lower the disjunctive predicates, which are connected with `||`, in the similar fashion. Instead, we allocate a place for the boolean temporary to hold the result of evaluating the `||` expression. Usually I would expect optimization at later stages to "inline" the evaluation of boolean predicates into simple CFG, but #111583 is an example where `&&` is failing to be optimized away and the assembly shows that both the expensive operands are evaluated. Therefore, I would like to make a small change to make the CFG a bit more straight-forward without invoking the `as_temp` machinery, and plus avoid allocating the place to hold the boolean result as well.
2023-09-01Fall through when resolving elided assoc const lifetimesMichael Goulet-0/+59
2023-09-01Auto merge of #113201 - oli-obk:recursive_type_alias, r=estebank,compiler-errorsbors-13/+70
Permit recursive weak type aliases I saw #63097 and thought "we can do ~~better~~ funnier". So here it is. It's not useful, but it's certainly something. This may actually become feasible with lazy norm (so in 5 years (constant, not reducing over time)). r? `@estebank` cc `@GuillaumeGomez`
2023-09-01Auto merge of #115400 - gurry:issue-115264-ice, r=compiler-errorsbors-0/+36
Return ident for ExprField and PatField HIR nodes Fixes #115264
2023-08-31diagnostics: avoid wrong `unused_parens` on `x as (T) < y`Michael Howell-0/+159
2023-09-01Return ident for ExprField and PatField HIR nodesGurinder Singh-0/+36
2023-08-31Auto merge of #115366 - ↵bors-0/+19
compiler-errors:associated-type-bound-implicit-lifetimes, r=jackh726 Capture lifetimes for associated type bounds destined to be lowered to opaques Some associated type bounds get lowered to opaques, but they're not represented in the AST as opaques. That means that we never collect lifetimes for them (`record_lifetime_params_for_impl_trait`) which are used currently for RPITITs, which capture all of their in-scope lifetimes[^1]. This means that the nested RPITITs that arise from some type like `impl Foo<Type: Bar>` (~> `impl Foo<Type = impl Bar>`) don't capture any lifetimes, leading to ICEs. This PR makes sure we collect the lifetimes for associated type bounds as well, and make sure that they are set up correctly for opaque type lowering later. Fixes #115360 [^1]: #114489
2023-09-01update tests that are ignored by debugDing Xiang Fei-278/+326
2023-08-31Auto merge of #115389 - bvanjoi:fix-115380, r=petrochenkovbors-1/+1
fix(resolve): update def if binding is warning ambiguity Fixes #115380