summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/assembly/asm/arm-types.rs1
-rw-r--r--tests/assembly/closure-inherit-target-feature.rs2
-rw-r--r--tests/assembly/dwarf5.rs2
-rw-r--r--tests/assembly/libs/issue-115339-zip-arrays.rs25
-rw-r--r--tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs406
-rw-r--r--tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs414
-rw-r--r--tests/assembly/stack-protector/stack-protector-heuristics-effect.rs5
-rw-r--r--tests/assembly/x86_64-array-pair-load-store-merge.rs20
-rw-r--r--tests/codegen-units/item-collection/asm-sym.rs3
-rw-r--r--tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs2
-rw-r--r--tests/codegen-units/item-collection/cross-crate-trait-method.rs2
-rw-r--r--tests/codegen-units/item-collection/items-within-generic-items.rs2
-rw-r--r--tests/codegen-units/item-collection/unreferenced-const-fn.rs1
-rw-r--r--tests/codegen/array-codegen.rs22
-rw-r--r--tests/codegen/array-optimized.rs33
-rw-r--r--tests/codegen/asm-sanitize-llvm.rs2
-rw-r--r--tests/codegen/async-fn-debug-awaitee-field.rs4
-rw-r--r--tests/codegen/async-fn-debug-msvc.rs2
-rw-r--r--tests/codegen/char-ascii-branchless.rs47
-rw-r--r--tests/codegen/coroutine-debug-msvc.rs (renamed from tests/codegen/generator-debug-msvc.rs)12
-rw-r--r--tests/codegen/coroutine-debug.rs (renamed from tests/codegen/generator-debug.rs)14
-rw-r--r--tests/codegen/cross-crate-inlining/always-inline.rs13
-rw-r--r--tests/codegen/cross-crate-inlining/auxiliary/always.rs20
-rw-r--r--tests/codegen/cross-crate-inlining/auxiliary/leaf.rs20
-rw-r--r--tests/codegen/cross-crate-inlining/auxiliary/never.rs20
-rw-r--r--tests/codegen/cross-crate-inlining/leaf-inlining.rs20
-rw-r--r--tests/codegen/cross-crate-inlining/never-inline.rs13
-rw-r--r--tests/codegen/debug-fndef-size.rs18
-rw-r--r--tests/codegen/debug-linkage-name.rs4
-rw-r--r--tests/codegen/default-requires-uwtable.rs2
-rw-r--r--tests/codegen/drop.rs2
-rw-r--r--tests/codegen/force-frame-pointers.rs2
-rw-r--r--tests/codegen/force-unwind-tables.rs2
-rw-r--r--tests/codegen/inline-function-args-debug-info.rs5
-rw-r--r--tests/codegen/instrument-coverage-off.rs23
-rw-r--r--tests/codegen/instrument-coverage.rs9
-rw-r--r--tests/codegen/instrument-mcount.rs2
-rw-r--r--tests/codegen/instrument-xray/basic.rs2
-rw-r--r--tests/codegen/instrument-xray/options-combine.rs6
-rw-r--r--tests/codegen/instrument-xray/options-override.rs4
-rw-r--r--tests/codegen/issue-97217.rs22
-rw-r--r--tests/codegen/panic-unwind-default-uwtable.rs2
-rw-r--r--tests/codegen/personality_lifetimes.rs2
-rw-r--r--tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs2
-rw-r--r--tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs2
-rw-r--r--tests/codegen/sanitizer/cfi-generalize-pointers.rs2
-rw-r--r--tests/codegen/sanitizer/cfi-normalize-integers.rs2
-rw-r--r--tests/codegen/sanitizer/kasan-emits-instrumentation.rs2
-rw-r--r--tests/codegen/sanitizer/memtag-attr-check.rs2
-rw-r--r--tests/codegen/sanitizer/no-sanitize.rs2
-rw-r--r--tests/codegen/sanitizer/safestack-attr-check.rs2
-rw-r--r--tests/codegen/simd/simd-wide-sum.rs26
-rw-r--r--tests/codegen/simd/unpadded-simd.rs9
-rw-r--r--tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs2
-rw-r--r--tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs2
-rw-r--r--tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs2
-rw-r--r--tests/codegen/target-cpu-on-functions.rs3
-rw-r--r--tests/codegen/target-feature-inline-closure.rs4
-rw-r--r--tests/codegen/tied-features-strength.rs8
-rw-r--r--tests/codegen/tune-cpu-on-functions.rs2
-rw-r--r--tests/codegen/unchecked_shifts.rs2
-rw-r--r--tests/codegen/unwind-landingpad-cold.rs16
-rw-r--r--tests/codegen/unwind-landingpad-inline.rs39
-rw-r--r--tests/codegen/vec-reserve-extend.rs14
-rw-r--r--tests/codegen/vec_pop_push_noop.rs24
-rw-r--r--tests/coverage-map/README.md13
-rw-r--r--tests/coverage-map/if.cov-map15
-rw-r--r--tests/coverage-map/if.rs9
-rw-r--r--tests/coverage-map/status-quo/closure_bug.cov-map148
-rw-r--r--tests/coverage-map/status-quo/conditions.cov-map261
-rw-r--r--tests/coverage-map/status-quo/continue.cov-map85
-rw-r--r--tests/coverage-map/status-quo/generator.cov-map58
-rw-r--r--tests/coverage-map/status-quo/generator.rs30
-rw-r--r--tests/coverage-map/status-quo/lazy_boolean.cov-map223
-rw-r--r--tests/coverage-map/status-quo/loops_branches.cov-map185
-rw-r--r--tests/coverage-map/status-quo/overflow.rs63
-rw-r--r--tests/coverage-map/status-quo/simple_loop.cov-map28
-rw-r--r--tests/coverage-map/status-quo/simple_match.cov-map36
-rw-r--r--tests/coverage-map/status-quo/sort_groups.rs23
-rw-r--r--tests/coverage-map/status-quo/yield.cov-map72
-rw-r--r--tests/coverage-map/status-quo/yield.rs37
-rw-r--r--tests/coverage-run-rustdoc/auxiliary/doctest_crate.rs (renamed from tests/run-coverage-rustdoc/auxiliary/doctest_crate.rs)0
-rw-r--r--tests/coverage-run-rustdoc/doctest.coverage (renamed from tests/run-coverage-rustdoc/doctest.coverage)0
-rw-r--r--tests/coverage-run-rustdoc/doctest.rs (renamed from tests/run-coverage-rustdoc/doctest.rs)0
-rw-r--r--tests/coverage/README.md16
-rw-r--r--tests/coverage/abort.cov-map (renamed from tests/coverage-map/status-quo/abort.cov-map)0
-rw-r--r--tests/coverage/abort.coverage (renamed from tests/run-coverage/abort.coverage)0
-rw-r--r--tests/coverage/abort.rs (renamed from tests/coverage-map/status-quo/abort.rs)0
-rw-r--r--tests/coverage/assert.cov-map (renamed from tests/coverage-map/status-quo/assert.cov-map)0
-rw-r--r--tests/coverage/assert.coverage (renamed from tests/run-coverage/assert.coverage)0
-rw-r--r--tests/coverage/assert.rs (renamed from tests/coverage-map/status-quo/assert.rs)0
-rw-r--r--tests/coverage/async.cov-map (renamed from tests/coverage-map/status-quo/async.cov-map)90
-rw-r--r--tests/coverage/async.coverage (renamed from tests/run-coverage/async.coverage)0
-rw-r--r--tests/coverage/async.rs (renamed from tests/coverage-map/status-quo/async.rs)0
-rw-r--r--tests/coverage/async2.cov-map (renamed from tests/coverage-map/status-quo/async2.cov-map)28
-rw-r--r--tests/coverage/async2.coverage (renamed from tests/run-coverage/async2.coverage)0
-rw-r--r--tests/coverage/async2.rs (renamed from tests/coverage-map/status-quo/async2.rs)0
-rw-r--r--tests/coverage/auxiliary/inline_always_with_dead_code.rs (renamed from tests/run-coverage/auxiliary/inline_always_with_dead_code.rs)0
-rw-r--r--tests/coverage/auxiliary/macro_name_span_helper.rs (renamed from tests/run-coverage/auxiliary/macro_name_span_helper.rs)0
-rw-r--r--tests/coverage/auxiliary/unused_mod_helper.rs (renamed from tests/run-coverage/auxiliary/unused_mod_helper.rs)0
-rw-r--r--tests/coverage/auxiliary/used_crate.rs (renamed from tests/run-coverage/auxiliary/used_crate.rs)0
-rw-r--r--tests/coverage/auxiliary/used_inline_crate.rs (renamed from tests/run-coverage/auxiliary/used_inline_crate.rs)0
-rw-r--r--tests/coverage/bad_counter_ids.cov-map98
-rw-r--r--tests/coverage/bad_counter_ids.coverage69
-rw-r--r--tests/coverage/bad_counter_ids.rs66
-rw-r--r--tests/coverage/closure.cov-map (renamed from tests/coverage-map/status-quo/closure.cov-map)185
-rw-r--r--tests/coverage/closure.coverage (renamed from tests/run-coverage/closure.coverage)0
-rw-r--r--tests/coverage/closure.rs (renamed from tests/coverage-map/status-quo/closure.rs)0
-rw-r--r--tests/coverage/closure_bug.cov-map133
-rw-r--r--tests/coverage/closure_bug.coverage (renamed from tests/run-coverage/closure_bug.coverage)0
-rw-r--r--tests/coverage/closure_bug.rs (renamed from tests/coverage-map/status-quo/closure_bug.rs)0
-rw-r--r--tests/coverage/closure_macro.cov-map (renamed from tests/coverage-map/status-quo/closure_macro.cov-map)22
-rw-r--r--tests/coverage/closure_macro.coverage (renamed from tests/run-coverage/closure_macro.coverage)0
-rw-r--r--tests/coverage/closure_macro.rs (renamed from tests/coverage-map/status-quo/closure_macro.rs)0
-rw-r--r--tests/coverage/closure_macro_async.cov-map (renamed from tests/coverage-map/status-quo/closure_macro_async.cov-map)22
-rw-r--r--tests/coverage/closure_macro_async.coverage (renamed from tests/run-coverage/closure_macro_async.coverage)0
-rw-r--r--tests/coverage/closure_macro_async.rs (renamed from tests/coverage-map/status-quo/closure_macro_async.rs)0
-rw-r--r--tests/coverage/conditions.cov-map259
-rw-r--r--tests/coverage/conditions.coverage (renamed from tests/run-coverage/conditions.coverage)0
-rw-r--r--tests/coverage/conditions.rs (renamed from tests/coverage-map/status-quo/conditions.rs)0
-rw-r--r--tests/coverage/continue.cov-map79
-rw-r--r--tests/coverage/continue.coverage (renamed from tests/run-coverage/continue.coverage)0
-rw-r--r--tests/coverage/continue.rs (renamed from tests/coverage-map/status-quo/continue.rs)0
-rw-r--r--tests/coverage/coroutine.cov-map53
-rw-r--r--tests/coverage/coroutine.coverage (renamed from tests/run-coverage/generator.coverage)16
-rw-r--r--tests/coverage/coroutine.rs (renamed from tests/run-coverage/generator.rs)16
-rw-r--r--tests/coverage/dead_code.cov-map (renamed from tests/coverage-map/status-quo/dead_code.cov-map)8
-rw-r--r--tests/coverage/dead_code.coverage (renamed from tests/run-coverage/dead_code.coverage)0
-rw-r--r--tests/coverage/dead_code.rs (renamed from tests/coverage-map/status-quo/dead_code.rs)0
-rw-r--r--tests/coverage/drop_trait.cov-map (renamed from tests/coverage-map/status-quo/drop_trait.cov-map)0
-rw-r--r--tests/coverage/drop_trait.coverage (renamed from tests/run-coverage/drop_trait.coverage)0
-rw-r--r--tests/coverage/drop_trait.rs (renamed from tests/coverage-map/status-quo/drop_trait.rs)0
-rw-r--r--tests/coverage/fn_sig_into_try.cov-map53
-rw-r--r--tests/coverage/fn_sig_into_try.coverage45
-rw-r--r--tests/coverage/fn_sig_into_try.rs41
-rw-r--r--tests/coverage/generics.cov-map (renamed from tests/coverage-map/status-quo/generics.cov-map)0
-rw-r--r--tests/coverage/generics.coverage (renamed from tests/run-coverage/generics.coverage)0
-rw-r--r--tests/coverage/generics.rs (renamed from tests/coverage-map/status-quo/generics.rs)0
-rw-r--r--tests/coverage/if.cov-map (renamed from tests/coverage-map/status-quo/if.cov-map)0
-rw-r--r--tests/coverage/if.coverage (renamed from tests/run-coverage/if.coverage)0
-rw-r--r--tests/coverage/if.rs (renamed from tests/coverage-map/status-quo/if.rs)0
-rw-r--r--tests/coverage/if_else.cov-map (renamed from tests/coverage-map/status-quo/if_else.cov-map)0
-rw-r--r--tests/coverage/if_else.coverage (renamed from tests/run-coverage/if_else.coverage)0
-rw-r--r--tests/coverage/if_else.rs (renamed from tests/coverage-map/status-quo/if_else.rs)0
-rw-r--r--tests/coverage/inline-dead.cov-map (renamed from tests/coverage-map/status-quo/inline-dead.cov-map)36
-rw-r--r--tests/coverage/inline-dead.coverage (renamed from tests/run-coverage/inline-dead.coverage)0
-rw-r--r--tests/coverage/inline-dead.rs (renamed from tests/coverage-map/status-quo/inline-dead.rs)0
-rw-r--r--tests/coverage/inline.cov-map (renamed from tests/coverage-map/status-quo/inline.cov-map)26
-rw-r--r--tests/coverage/inline.coverage (renamed from tests/run-coverage/inline.coverage)0
-rw-r--r--tests/coverage/inline.rs (renamed from tests/coverage-map/status-quo/inline.rs)0
-rw-r--r--tests/coverage/inner_items.cov-map (renamed from tests/coverage-map/status-quo/inner_items.cov-map)0
-rw-r--r--tests/coverage/inner_items.coverage (renamed from tests/run-coverage/inner_items.coverage)0
-rw-r--r--tests/coverage/inner_items.rs (renamed from tests/coverage-map/status-quo/inner_items.rs)0
-rw-r--r--tests/coverage/issue-83601.cov-map (renamed from tests/coverage-map/status-quo/issue-83601.cov-map)0
-rw-r--r--tests/coverage/issue-83601.coverage (renamed from tests/run-coverage/issue-83601.coverage)0
-rw-r--r--tests/coverage/issue-83601.rs (renamed from tests/coverage-map/status-quo/issue-83601.rs)0
-rw-r--r--tests/coverage/issue-84561.cov-map (renamed from tests/coverage-map/status-quo/issue-84561.cov-map)67
-rw-r--r--tests/coverage/issue-84561.coverage (renamed from tests/run-coverage/issue-84561.coverage)2
-rw-r--r--tests/coverage/issue-84561.rs (renamed from tests/coverage-map/status-quo/issue-84561.rs)0
-rw-r--r--tests/coverage/issue-85461.cov-map8
-rw-r--r--tests/coverage/issue-85461.coverage (renamed from tests/run-coverage/issue-85461.coverage)0
-rw-r--r--tests/coverage/issue-85461.rs (renamed from tests/run-coverage/issue-85461.rs)0
-rw-r--r--tests/coverage/issue-93054.cov-map (renamed from tests/coverage-map/status-quo/issue-93054.cov-map)8
-rw-r--r--tests/coverage/issue-93054.coverage (renamed from tests/run-coverage/issue-93054.coverage)0
-rw-r--r--tests/coverage/issue-93054.rs (renamed from tests/coverage-map/status-quo/issue-93054.rs)0
-rw-r--r--tests/coverage/lazy_boolean.cov-map219
-rw-r--r--tests/coverage/lazy_boolean.coverage (renamed from tests/run-coverage/lazy_boolean.coverage)0
-rw-r--r--tests/coverage/lazy_boolean.rs (renamed from tests/coverage-map/status-quo/lazy_boolean.rs)0
-rw-r--r--tests/coverage/long_and_wide.cov-map (renamed from tests/coverage-map/long_and_wide.cov-map)0
-rw-r--r--tests/coverage/long_and_wide.coverage151
-rw-r--r--tests/coverage/long_and_wide.rs (renamed from tests/coverage-map/long_and_wide.rs)0
-rw-r--r--tests/coverage/loop_break_value.cov-map (renamed from tests/coverage-map/status-quo/loop_break_value.cov-map)0
-rw-r--r--tests/coverage/loop_break_value.coverage (renamed from tests/run-coverage/loop_break_value.coverage)0
-rw-r--r--tests/coverage/loop_break_value.rs (renamed from tests/coverage-map/status-quo/loop_break_value.rs)0
-rw-r--r--tests/coverage/loops_branches.cov-map183
-rw-r--r--tests/coverage/loops_branches.coverage (renamed from tests/run-coverage/loops_branches.coverage)0
-rw-r--r--tests/coverage/loops_branches.rs (renamed from tests/coverage-map/status-quo/loops_branches.rs)0
-rw-r--r--tests/coverage/macro_name_span.cov-map16
-rw-r--r--tests/coverage/macro_name_span.coverage (renamed from tests/run-coverage/macro_name_span.coverage)0
-rw-r--r--tests/coverage/macro_name_span.rs (renamed from tests/run-coverage/macro_name_span.rs)0
-rw-r--r--tests/coverage/match_or_pattern.cov-map (renamed from tests/coverage-map/status-quo/match_or_pattern.cov-map)0
-rw-r--r--tests/coverage/match_or_pattern.coverage (renamed from tests/run-coverage/match_or_pattern.coverage)0
-rw-r--r--tests/coverage/match_or_pattern.rs (renamed from tests/coverage-map/status-quo/match_or_pattern.rs)0
-rw-r--r--tests/coverage/nested_loops.cov-map (renamed from tests/coverage-map/status-quo/nested_loops.cov-map)0
-rw-r--r--tests/coverage/nested_loops.coverage (renamed from tests/run-coverage/nested_loops.coverage)0
-rw-r--r--tests/coverage/nested_loops.rs (renamed from tests/coverage-map/status-quo/nested_loops.rs)0
-rw-r--r--tests/coverage/no_cov_crate.cov-map (renamed from tests/coverage-map/status-quo/no_cov_crate.cov-map)4
-rw-r--r--tests/coverage/no_cov_crate.coverage (renamed from tests/run-coverage/no_cov_crate.coverage)0
-rw-r--r--tests/coverage/no_cov_crate.rs (renamed from tests/coverage-map/status-quo/no_cov_crate.rs)0
-rw-r--r--tests/coverage/overflow.cov-map (renamed from tests/coverage-map/status-quo/overflow.cov-map)8
-rw-r--r--tests/coverage/overflow.coverage (renamed from tests/run-coverage/overflow.coverage)1
-rw-r--r--tests/coverage/overflow.rs (renamed from tests/run-coverage/overflow.rs)1
-rw-r--r--tests/coverage/panic_unwind.cov-map (renamed from tests/coverage-map/status-quo/panic_unwind.cov-map)0
-rw-r--r--tests/coverage/panic_unwind.coverage (renamed from tests/run-coverage/panic_unwind.coverage)0
-rw-r--r--tests/coverage/panic_unwind.rs (renamed from tests/coverage-map/status-quo/panic_unwind.rs)0
-rw-r--r--tests/coverage/partial_eq.cov-map (renamed from tests/coverage-map/status-quo/partial_eq.cov-map)12
-rw-r--r--tests/coverage/partial_eq.coverage (renamed from tests/run-coverage/partial_eq.coverage)0
-rw-r--r--tests/coverage/partial_eq.rs (renamed from tests/coverage-map/status-quo/partial_eq.rs)0
-rw-r--r--tests/coverage/simple_loop.cov-map27
-rw-r--r--tests/coverage/simple_loop.coverage (renamed from tests/run-coverage/simple_loop.coverage)0
-rw-r--r--tests/coverage/simple_loop.rs (renamed from tests/coverage-map/status-quo/simple_loop.rs)0
-rw-r--r--tests/coverage/simple_match.cov-map33
-rw-r--r--tests/coverage/simple_match.coverage (renamed from tests/run-coverage/simple_match.coverage)0
-rw-r--r--tests/coverage/simple_match.rs (renamed from tests/coverage-map/status-quo/simple_match.rs)0
-rw-r--r--tests/coverage/sort_groups.cov-map (renamed from tests/coverage-map/status-quo/sort_groups.cov-map)21
-rw-r--r--tests/coverage/sort_groups.coverage (renamed from tests/run-coverage/sort_groups.coverage)2
-rw-r--r--tests/coverage/sort_groups.rs (renamed from tests/run-coverage/sort_groups.rs)2
-rw-r--r--tests/coverage/test_harness.cov-map (renamed from tests/coverage-map/status-quo/test_harness.cov-map)4
-rw-r--r--tests/coverage/test_harness.coverage (renamed from tests/run-coverage/test_harness.coverage)0
-rw-r--r--tests/coverage/test_harness.rs (renamed from tests/coverage-map/status-quo/test_harness.rs)0
-rw-r--r--tests/coverage/tight_inf_loop.cov-map (renamed from tests/coverage-map/status-quo/tight_inf_loop.cov-map)6
-rw-r--r--tests/coverage/tight_inf_loop.coverage (renamed from tests/run-coverage/tight_inf_loop.coverage)0
-rw-r--r--tests/coverage/tight_inf_loop.rs (renamed from tests/coverage-map/status-quo/tight_inf_loop.rs)0
-rw-r--r--tests/coverage/trivial.cov-map (renamed from tests/coverage-map/trivial.cov-map)0
-rw-r--r--tests/coverage/trivial.coverage4
-rw-r--r--tests/coverage/trivial.rs (renamed from tests/coverage-map/trivial.rs)0
-rw-r--r--tests/coverage/try_error_result.cov-map (renamed from tests/coverage-map/status-quo/try_error_result.cov-map)166
-rw-r--r--tests/coverage/try_error_result.coverage (renamed from tests/run-coverage/try_error_result.coverage)0
-rw-r--r--tests/coverage/try_error_result.rs (renamed from tests/coverage-map/status-quo/try_error_result.rs)0
-rw-r--r--tests/coverage/unreachable.cov-map24
-rw-r--r--tests/coverage/unreachable.coverage38
-rw-r--r--tests/coverage/unreachable.rs37
-rw-r--r--tests/coverage/unused.cov-map (renamed from tests/coverage-map/status-quo/unused.cov-map)16
-rw-r--r--tests/coverage/unused.coverage (renamed from tests/run-coverage/unused.coverage)0
-rw-r--r--tests/coverage/unused.rs (renamed from tests/coverage-map/status-quo/unused.rs)0
-rw-r--r--tests/coverage/unused_mod.cov-map16
-rw-r--r--tests/coverage/unused_mod.coverage (renamed from tests/run-coverage/unused_mod.coverage)0
-rw-r--r--tests/coverage/unused_mod.rs (renamed from tests/run-coverage/unused_mod.rs)0
-rw-r--r--tests/coverage/uses_crate.cov-map40
-rw-r--r--tests/coverage/uses_crate.coverage (renamed from tests/run-coverage/uses_crate.coverage)0
-rw-r--r--tests/coverage/uses_crate.rs (renamed from tests/run-coverage/uses_crate.rs)0
-rw-r--r--tests/coverage/uses_inline_crate.cov-map55
-rw-r--r--tests/coverage/uses_inline_crate.coverage (renamed from tests/run-coverage/uses_inline_crate.coverage)0
-rw-r--r--tests/coverage/uses_inline_crate.rs (renamed from tests/run-coverage/uses_inline_crate.rs)0
-rw-r--r--tests/coverage/while.cov-map (renamed from tests/coverage-map/status-quo/while.cov-map)10
-rw-r--r--tests/coverage/while.coverage (renamed from tests/run-coverage/while.coverage)0
-rw-r--r--tests/coverage/while.rs (renamed from tests/coverage-map/status-quo/while.rs)0
-rw-r--r--tests/coverage/while_early_ret.cov-map (renamed from tests/coverage-map/status-quo/while_early_ret.cov-map)0
-rw-r--r--tests/coverage/while_early_ret.coverage (renamed from tests/run-coverage/while_early_ret.coverage)0
-rw-r--r--tests/coverage/while_early_ret.rs (renamed from tests/coverage-map/status-quo/while_early_ret.rs)0
-rw-r--r--tests/coverage/yield.cov-map62
-rw-r--r--tests/coverage/yield.coverage (renamed from tests/run-coverage/yield.coverage)24
-rw-r--r--tests/coverage/yield.rs37
-rw-r--r--tests/debuginfo/coroutine-locals.rs (renamed from tests/debuginfo/generator-locals.rs)4
-rw-r--r--tests/debuginfo/coroutine-objects.rs (renamed from tests/debuginfo/generator-objects.rs)30
-rw-r--r--tests/debuginfo/function-names.rs20
-rw-r--r--tests/debuginfo/issue-57822.rs10
-rw-r--r--tests/debuginfo/simple-struct.rs2
-rw-r--r--tests/incremental/hashes/for_loops.rs6
-rw-r--r--tests/incremental/hashes/loop_expressions.rs4
-rw-r--r--tests/incremental/hashes/while_loops.rs10
-rw-r--r--tests/mir-opt/README.md18
-rw-r--r--tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir60
-rw-r--r--tests/mir-opt/address_of.rs1
-rw-r--r--tests/mir-opt/array_index_is_temporary.rs7
-rw-r--r--tests/mir-opt/asm_unwind_panic_abort.rs3
-rw-r--r--tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir4
-rw-r--r--tests/mir-opt/basic_assignment.rs18
-rw-r--r--tests/mir-opt/bool_compare.rs28
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir71
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir71
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.diff89
-rw-r--r--tests/mir-opt/box_expr.rs17
-rw-r--r--tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir (renamed from tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir)10
-rw-r--r--tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir (renamed from tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir)86
-rw-r--r--tests/mir-opt/building/async_await.rs7
-rw-r--r--tests/mir-opt/building/custom/aggregate_exprs.rs1
-rw-r--r--tests/mir-opt/building/custom/arbitrary_let.rs1
-rw-r--r--tests/mir-opt/building/custom/arrays.rs1
-rw-r--r--tests/mir-opt/building/custom/as_cast.rs1
-rw-r--r--tests/mir-opt/building/custom/composite_return.rs1
-rw-r--r--tests/mir-opt/building/custom/consts.rs1
-rw-r--r--tests/mir-opt/building/custom/consts.statics.built.after.mir8
-rw-r--r--tests/mir-opt/building/custom/debuginfo.rs1
-rw-r--r--tests/mir-opt/building/custom/enums.rs1
-rw-r--r--tests/mir-opt/building/custom/operators.rs1
-rw-r--r--tests/mir-opt/building/custom/projections.rs1
-rw-r--r--tests/mir-opt/building/custom/references.rs1
-rw-r--r--tests/mir-opt/building/custom/simple_assign.rs1
-rw-r--r--tests/mir-opt/building/custom/terminators.rs1
-rw-r--r--tests/mir-opt/building/enum_cast.rs1
-rw-r--r--tests/mir-opt/building/issue_101867.main.built.after.mir6
-rw-r--r--tests/mir-opt/building/issue_101867.rs1
-rw-r--r--tests/mir-opt/building/issue_110508.rs1
-rw-r--r--tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir4
-rw-r--r--tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir4
-rw-r--r--tests/mir-opt/building/issue_49232.main.built.after.mir2
-rw-r--r--tests/mir-opt/building/issue_49232.rs1
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.rs1
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir4
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir3
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir3
-rw-r--r--tests/mir-opt/building/match_false_edges.main.built.after.mir2
-rw-r--r--tests/mir-opt/building/match_false_edges.rs1
-rw-r--r--tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir8
-rw-r--r--tests/mir-opt/building/receiver_ptr_mutability.rs1
-rw-r--r--tests/mir-opt/building/shifts.rs1
-rw-r--r--tests/mir-opt/building/simple_match.match_bool.built.after.mir2
-rw-r--r--tests/mir-opt/building/simple_match.rs1
-rw-r--r--tests/mir-opt/building/storage_live_dead_in_statics.rs1
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.rs1
-rw-r--r--tests/mir-opt/building/while_storage.rs60
-rw-r--r--tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir70
-rw-r--r--tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir70
-rw-r--r--tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir2
-rw-r--r--tests/mir-opt/byte_slice.rs1
-rw-r--r--tests/mir-opt/casts.redundant.PreCodegen.after.mir14
-rw-r--r--tests/mir-opt/casts.roundtrip.PreCodegen.after.mir15
-rw-r--r--tests/mir-opt/casts.rs17
-rw-r--r--tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir36
-rw-r--r--tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir40
-rw-r--r--tests/mir-opt/const_allocation.rs1
-rw-r--r--tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir34
-rw-r--r--tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir36
-rw-r--r--tests/mir-opt/const_allocation2.rs1
-rw-r--r--tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir20
-rw-r--r--tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir18
-rw-r--r--tests/mir-opt/const_allocation3.rs1
-rw-r--r--tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff79
-rw-r--r--tests/mir-opt/const_debuginfo.rs16
-rw-r--r--tests/mir-opt/const_goto.rs1
-rw-r--r--tests/mir-opt/const_goto_const_eval_fail.rs1
-rw-r--r--tests/mir-opt/const_goto_storage.rs1
-rw-r--r--tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir4
-rw-r--r--tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff4
-rw-r--r--tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir4
-rw-r--r--tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff4
-rw-r--r--tests/mir-opt/const_promotion_extern_static.rs1
-rw-r--r--tests/mir-opt/const_prop/address_of_pair.rs1
-rw-r--r--tests/mir-opt/const_prop/aggregate.rs1
-rw-r--r--tests/mir-opt/const_prop/array_index.rs1
-rw-r--r--tests/mir-opt/const_prop/bad_op_div_by_zero.rs1
-rw-r--r--tests/mir-opt/const_prop/bad_op_mod_by_zero.rs1
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs1
-rw-r--r--tests/mir-opt/const_prop/boolean_identities.rs1
-rw-r--r--tests/mir-opt/const_prop/boxes.rs1
-rw-r--r--tests/mir-opt/const_prop/cast.rs1
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_prop/checked_add.rs1
-rw-r--r--tests/mir-opt/const_prop/const_prop_fails_gracefully.rs1
-rw-r--r--tests/mir-opt/const_prop/control_flow_simplification.rs1
-rw-r--r--tests/mir-opt/const_prop/discriminant.rs1
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_prop/indirect.rs1
-rw-r--r--tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff (renamed from tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff)0
-rw-r--r--tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff (renamed from tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff)0
-rw-r--r--tests/mir-opt/const_prop/indirect_mutation.rs41
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.rs1
-rw-r--r--tests/mir-opt/const_prop/invalid_constant.rs1
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/issue_66971.rs1
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff6
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff6
-rw-r--r--tests/mir-opt/const_prop/issue_67019.rs1
-rw-r--r--tests/mir-opt/const_prop/large_array_index.rs1
-rw-r--r--tests/mir-opt/const_prop/mult_by_zero.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff4
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff4
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_no_prop.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs1
-rw-r--r--tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff56
-rw-r--r--tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff56
-rw-r--r--tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff50
-rw-r--r--tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff50
-rw-r--r--tests/mir-opt/const_prop/offset_of.rs20
-rw-r--r--tests/mir-opt/const_prop/overwrite_with_const_with_params.rs26
-rw-r--r--tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff20
-rw-r--r--tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff6
-rw-r--r--tests/mir-opt/const_prop/read_immutable_static.rs1
-rw-r--r--tests/mir-opt/const_prop/ref_deref.rs1
-rw-r--r--tests/mir-opt/const_prop/ref_deref_project.rs1
-rw-r--r--tests/mir-opt/const_prop/reify_fn_ptr.rs1
-rw-r--r--tests/mir-opt/const_prop/repeat.rs1
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir2
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir2
-rw-r--r--tests/mir-opt/const_prop/return_place.rs1
-rw-r--r--tests/mir-opt/const_prop/scalar_literal_propagation.rs1
-rw-r--r--tests/mir-opt/const_prop/slice_len.rs1
-rw-r--r--tests/mir-opt/const_prop/switch_int.rs1
-rw-r--r--tests/mir-opt/const_prop/transmute.rs22
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff3
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff3
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff6
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff6
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.rs1
-rw-r--r--tests/mir-opt/const_prop/while_let_loops.rs1
-rw-r--r--tests/mir-opt/const_prop_miscompile.rs23
-rw-r--r--tests/mir-opt/copy-prop/borrowed_local.rs1
-rw-r--r--tests/mir-opt/copy-prop/branch.rs1
-rw-r--r--tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff21
-rw-r--r--tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff24
-rw-r--r--tests/mir-opt/copy-prop/calls.rs44
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.rs1
-rw-r--r--tests/mir-opt/copy-prop/custom_move_arg.rs1
-rw-r--r--tests/mir-opt/copy-prop/cycle.rs1
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_79191.rs1
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_better.rs1
-rw-r--r--tests/mir-opt/copy-prop/issue_107511.rs1
-rw-r--r--tests/mir-opt/copy-prop/move_arg.rs1
-rw-r--r--tests/mir-opt/copy-prop/move_projection.rs1
-rw-r--r--tests/mir-opt/copy-prop/mutate_through_pointer.rs1
-rw-r--r--tests/mir-opt/copy-prop/non_dominate.rs1
-rw-r--r--tests/mir-opt/copy-prop/partial_init.rs1
-rw-r--r--tests/mir-opt/copy-prop/reborrow.rs1
-rw-r--r--tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-abort.mir (renamed from tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir)10
-rw-r--r--tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-unwind.mir (renamed from tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir)10
-rw-r--r--tests/mir-opt/coroutine_drop_cleanup.rs15
-rw-r--r--tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir (renamed from tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir)4
-rw-r--r--tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir (renamed from tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir)4
-rw-r--r--tests/mir-opt/coroutine_storage_dead_unwind.rs (renamed from tests/mir-opt/generator_storage_dead_unwind.rs)7
-rw-r--r--tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir (renamed from tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir)22
-rw-r--r--tests/mir-opt/coroutine_tiny.rs (renamed from tests/mir-opt/generator_tiny.rs)7
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/boolean_identities.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/cast.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/checked.rs3
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff7
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff7
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff19
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff19
-rw-r--r--tests/mir-opt/dataflow-const-prop/if.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/issue_81605.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/mult_by_zero.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/ref_without_sb.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff13
-rw-r--r--tests/mir-opt/dataflow-const-prop/repr_transparent.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/self_assign.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/self_assign_add.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/sibling_ptr.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff228
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff228
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.rs26
-rw-r--r--tests/mir-opt/dataflow-const-prop/terminator.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.rs22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff (renamed from tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff)45
-rw-r--r--tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff112
-rw-r--r--tests/mir-opt/dataflow-const-prop/tuple.rs4
-rw-r--r--tests/mir-opt/dead-store-elimination/call_arg_copy.rs1
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff29
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff73
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff73
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.rs38
-rw-r--r--tests/mir-opt/dead-store-elimination/place_mention.rs1
-rw-r--r--tests/mir-opt/dead-store-elimination/provenance_soundness.rs1
-rw-r--r--tests/mir-opt/deduplicate_blocks.rs1
-rw-r--r--tests/mir-opt/deref-patterns/string.rs1
-rw-r--r--tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff2
-rw-r--r--tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff2
-rw-r--r--tests/mir-opt/derefer_complex_case.rs1
-rw-r--r--tests/mir-opt/derefer_inline_test.rs1
-rw-r--r--tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff10
-rw-r--r--tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff10
-rw-r--r--tests/mir-opt/derefer_terminator_test.rs1
-rw-r--r--tests/mir-opt/derefer_test.rs1
-rw-r--r--tests/mir-opt/derefer_test_multiple.rs1
-rw-r--r--tests/mir-opt/dest-prop/branch.rs1
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.rs1
-rw-r--r--tests/mir-opt/dest-prop/cycle.rs1
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_79191.rs1
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir7
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir7
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.rs1
-rw-r--r--tests/mir-opt/dest-prop/simple.rs1
-rw-r--r--tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff17
-rw-r--r--tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff17
-rw-r--r--tests/mir-opt/dest-prop/union.rs1
-rw-r--r--tests/mir-opt/dest-prop/unreachable.rs1
-rw-r--r--tests/mir-opt/dont_inline_type_id.rs1
-rw-r--r--tests/mir-opt/dont_yeet_assert.rs11
-rw-r--r--tests/mir-opt/early_otherwise_branch.rs1
-rw-r--r--tests/mir-opt/early_otherwise_branch_3_element_tuple.rs1
-rw-r--r--tests/mir-opt/early_otherwise_branch_68867.rs1
-rw-r--r--tests/mir-opt/early_otherwise_branch_noopt.rs1
-rw-r--r--tests/mir-opt/early_otherwise_branch_soundness.rs1
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff2
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff2
-rw-r--r--tests/mir-opt/enum_opt.rs1
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff2
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff2
-rw-r--r--tests/mir-opt/equal_true.opt.InstSimplify.diff36
-rw-r--r--tests/mir-opt/equal_true.rs11
-rw-r--r--tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir2
-rw-r--r--tests/mir-opt/exponential_or.rs1
-rw-r--r--tests/mir-opt/fn_ptr_shim.rs1
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff124
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff124
-rw-r--r--tests/mir-opt/funky_arms.rs1
-rw-r--r--tests/mir-opt/generator_drop_cleanup.rs14
-rw-r--r--tests/mir-opt/graphviz.rs1
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff121
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff121
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff308
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff308
-rw-r--r--tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff66
-rw-r--r--tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff66
-rw-r--r--tests/mir-opt/gvn.cast.GVN.panic-abort.diff291
-rw-r--r--tests/mir-opt/gvn.cast.GVN.panic-unwind.diff291
-rw-r--r--tests/mir-opt/gvn.comparison.GVN.panic-abort.diff94
-rw-r--r--tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff94
-rw-r--r--tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff32
-rw-r--r--tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff32
-rw-r--r--tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff38
-rw-r--r--tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff38
-rw-r--r--tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff118
-rw-r--r--tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff118
-rw-r--r--tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff19
-rw-r--r--tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff19
-rw-r--r--tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff136
-rw-r--r--tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff136
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-abort.diff79
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-unwind.diff101
-rw-r--r--tests/mir-opt/gvn.repeat.GVN.panic-abort.diff79
-rw-r--r--tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff79
-rw-r--r--tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff19
-rw-r--r--tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff19
-rw-r--r--tests/mir-opt/gvn.rs488
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-abort.diff136
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-unwind.diff136
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff1091
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff1091
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff22
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff22
-rw-r--r--tests/mir-opt/if_condition_int.rs1
-rw-r--r--tests/mir-opt/inline/asm_unwind.rs5
-rw-r--r--tests/mir-opt/inline/caller_with_trivial_bound.rs5
-rw-r--r--tests/mir-opt/inline/cycle.rs10
-rw-r--r--tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs2
-rw-r--r--tests/mir-opt/inline/dyn_trait.rs8
-rw-r--r--tests/mir-opt/inline/exponential_runtime.rs9
-rw-r--r--tests/mir-opt/inline/inline_any_operand.rs2
-rw-r--r--tests/mir-opt/inline/inline_async.rs3
-rw-r--r--tests/mir-opt/inline/inline_box_fn.rs2
-rw-r--r--tests/mir-opt/inline/inline_closure.rs3
-rw-r--r--tests/mir-opt/inline/inline_closure_borrows_arg.rs3
-rw-r--r--tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir4
-rw-r--r--tests/mir-opt/inline/inline_closure_captures.rs3
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff21
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff21
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff21
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff21
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff22
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff22
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff19
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff19
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff19
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff19
-rw-r--r--tests/mir-opt/inline/inline_compatibility.rs63
-rw-r--r--tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff (renamed from tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff)34
-rw-r--r--tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff (renamed from tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff)34
-rw-r--r--tests/mir-opt/inline/inline_coroutine.rs20
-rw-r--r--tests/mir-opt/inline/inline_cycle.rs1
-rw-r--r--tests/mir-opt/inline/inline_cycle_generic.rs1
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff4
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/inline_diverging.rs7
-rw-r--r--tests/mir-opt/inline/inline_generator.rs17
-rw-r--r--tests/mir-opt/inline/inline_instruction_set.rs10
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff10
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff10
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.rs2
-rw-r--r--tests/mir-opt/inline/inline_options.rs3
-rw-r--r--tests/mir-opt/inline/inline_retag.rs11
-rw-r--r--tests/mir-opt/inline/inline_shims.rs4
-rw-r--r--tests/mir-opt/inline/inline_specialization.rs2
-rw-r--r--tests/mir-opt/inline/inline_trait_method.rs3
-rw-r--r--tests/mir-opt/inline/inline_trait_method_2.rs3
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff2
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/issue_106141.rs7
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir4
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir4
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs8
-rw-r--r--tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir6
-rw-r--r--tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs10
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff22
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff31
-rw-r--r--tests/mir-opt/inline/issue_78442.rs5
-rw-r--r--tests/mir-opt/inline/polymorphic_recursion.rs1
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.rs10
-rw-r--r--tests/mir-opt/inline/unit_test.rs19
-rw-r--r--tests/mir-opt/inline/unsized_argument.caller.Inline.diff24
-rw-r--r--tests/mir-opt/inline/unsized_argument.rs2
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.rs2
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff18
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff30
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir19
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir19
-rw-r--r--tests/mir-opt/inline_generically_if_sized.rs1
-rw-r--r--tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff4
-rw-r--r--tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff17
-rw-r--r--tests/mir-opt/instrument_coverage.rs1
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff (renamed from tests/mir-opt/bool_compare.opt3.InstSimplify.diff)6
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff (renamed from tests/mir-opt/bool_compare.opt4.InstSimplify.diff)6
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff (renamed from tests/mir-opt/not_equal_false.opt.InstSimplify.diff)6
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff (renamed from tests/mir-opt/bool_compare.opt1.InstSimplify.diff)6
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.rs68
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff36
-rw-r--r--tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff (renamed from tests/mir-opt/bool_compare.opt2.InstSimplify.diff)6
-rw-r--r--tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff (renamed from tests/mir-opt/casts.redundant.InstSimplify.diff)19
-rw-r--r--tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff26
-rw-r--r--tests/mir-opt/instsimplify/casts.rs25
-rw-r--r--tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff (renamed from tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff (renamed from tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_array_len.rs (renamed from tests/mir-opt/combine_array_len.rs)4
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.rs (renamed from tests/mir-opt/combine_clone_of_primitives.rs)6
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff (renamed from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff)6
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff (renamed from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff)6
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff (renamed from tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff (renamed from tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff (renamed from tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.rs (renamed from tests/mir-opt/combine_transmutes.rs)22
-rw-r--r--tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff (renamed from tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff)0
-rw-r--r--tests/mir-opt/instsimplify/duplicate_switch_targets.rs (renamed from tests/mir-opt/instsimplify_duplicate_switch_targets.rs)8
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff (renamed from tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff)14
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff (renamed from tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff)6
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff (renamed from tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff)14
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff (renamed from tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff)14
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.rs (renamed from tests/mir-opt/intrinsic_asserts.rs)22
-rw-r--r--tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff1
-rw-r--r--tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff1
-rw-r--r--tests/mir-opt/issue_101973.rs1
-rw-r--r--tests/mir-opt/issue_104451_unwindable_intrinsics.rs1
-rw-r--r--tests/mir-opt/issue_38669.rs1
-rw-r--r--tests/mir-opt/issue_41110.rs1
-rw-r--r--tests/mir-opt/issue_41697.rs1
-rw-r--r--tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir4
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff41
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff41
-rw-r--r--tests/mir-opt/issue_41888.rs1
-rw-r--r--tests/mir-opt/issue_62289.rs1
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir1
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir1
-rw-r--r--tests/mir-opt/issue_72181.rs1
-rw-r--r--tests/mir-opt/issue_72181_1.f.built.after.mir1
-rw-r--r--tests/mir-opt/issue_72181_1.main.built.after.mir4
-rw-r--r--tests/mir-opt/issue_72181_1.rs1
-rw-r--r--tests/mir-opt/issue_76432.rs1
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff47
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff47
-rw-r--r--tests/mir-opt/issue_78192.rs1
-rw-r--r--tests/mir-opt/issue_91633.rs1
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.32bit.mir10
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.64bit.mir10
-rw-r--r--tests/mir-opt/issue_99325.rs1
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir42
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir42
-rw-r--r--tests/mir-opt/issues/issue_59352.rs1
-rw-r--r--tests/mir-opt/issues/issue_75439.rs1
-rw-r--r--tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff57
-rw-r--r--tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff57
-rw-r--r--tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff68
-rw-r--r--tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff68
-rw-r--r--tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff59
-rw-r--r--tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff59
-rw-r--r--tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff45
-rw-r--r--tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff45
-rw-r--r--tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff139
-rw-r--r--tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff139
-rw-r--r--tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff54
-rw-r--r--tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff54
-rw-r--r--tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff56
-rw-r--r--tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff56
-rw-r--r--tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff26
-rw-r--r--tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff26
-rw-r--r--tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff57
-rw-r--r--tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff57
-rw-r--r--tests/mir-opt/jump_threading.rs480
-rw-r--r--tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff98
-rw-r--r--tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff98
-rw-r--r--tests/mir-opt/loop_test.rs1
-rw-r--r--tests/mir-opt/lower_array_len.rs14
-rw-r--r--tests/mir-opt/lower_intrinsics.rs87
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff3
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff3
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff1
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff1
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff1
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff1
-rw-r--r--tests/mir-opt/lower_slice_len.rs4
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff2
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff2
-rw-r--r--tests/mir-opt/match_arm_scopes.rs1
-rw-r--r--tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir2
-rw-r--r--tests/mir-opt/match_test.rs1
-rw-r--r--tests/mir-opt/matches_reduce_branches.rs1
-rw-r--r--tests/mir-opt/matches_u8.rs1
-rw-r--r--tests/mir-opt/multiple_return_terminators.rs1
-rw-r--r--tests/mir-opt/nll/named_lifetimes_basic.rs1
-rw-r--r--tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir16
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir4
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir4
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.rs1
-rw-r--r--tests/mir-opt/no_drop_for_inactive_variant.rs1
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.rs1
-rw-r--r--tests/mir-opt/not_equal_false.rs10
-rw-r--r--tests/mir-opt/nrvo_miscompile_111005.rs1
-rw-r--r--tests/mir-opt/nrvo_simple.rs1
-rw-r--r--tests/mir-opt/packed_struct_drop_aligned.rs1
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir43
-rw-r--r--tests/mir-opt/pre-codegen/duplicate_switch_targets.rs1
-rw-r--r--tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir11
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.rs1
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff123
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff92
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff123
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff92
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs15
-rw-r--r--tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir23
-rw-r--r--tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir99
-rw-r--r--tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir46
-rw-r--r--tests/mir-opt/pre-codegen/loops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.rs1
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.rs1
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir115
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir115
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir64
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir64
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir6
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir252
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir14
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir14
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir6
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir6
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir131
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir131
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir49
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir49
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir25
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir25
-rw-r--r--tests/mir-opt/pre-codegen/spans.rs1
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.rs1
-rw-r--r--tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff22
-rw-r--r--tests/mir-opt/reference_prop.rs333
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff3
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff3
-rw-r--r--tests/mir-opt/remove_fake_borrows.rs1
-rw-r--r--tests/mir-opt/remove_never_const.rs1
-rw-r--r--tests/mir-opt/remove_storage_markers.rs1
-rw-r--r--tests/mir-opt/remove_unneeded_drops.rs1
-rw-r--r--tests/mir-opt/remove_zsts.rs1
-rw-r--r--tests/mir-opt/retag.rs1
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir4
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir4
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir4
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir4
-rw-r--r--tests/mir-opt/return_an_array.rs1
-rw-r--r--tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff8
-rw-r--r--tests/mir-opt/separate_const_switch.rs1
-rw-r--r--tests/mir-opt/simplify_arm.rs1
-rw-r--r--tests/mir-opt/simplify_arm_identity.rs1
-rw-r--r--tests/mir-opt/simplify_cfg.rs1
-rw-r--r--tests/mir-opt/simplify_duplicate_unreachable_blocks.rs1
-rw-r--r--tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff8
-rw-r--r--tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff8
-rw-r--r--tests/mir-opt/simplify_if.rs1
-rw-r--r--tests/mir-opt/simplify_locals.rs1
-rw-r--r--tests/mir-opt/simplify_locals_fixedpoint.rs1
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_consts.rs1
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs1
-rw-r--r--tests/mir-opt/simplify_match.rs1
-rw-r--r--tests/mir-opt/simplify_try_if_let.rs1
-rw-r--r--tests/mir-opt/slice_drop_shim.rs1
-rw-r--r--tests/mir-opt/spanview_block.main.built.after.html6
-rw-r--r--tests/mir-opt/spanview_block.rs1
-rw-r--r--tests/mir-opt/spanview_statement.main.built.after.html6
-rw-r--r--tests/mir-opt/spanview_statement.rs1
-rw-r--r--tests/mir-opt/spanview_terminator.main.built.after.html4
-rw-r--r--tests/mir-opt/spanview_terminator.rs1
-rw-r--r--tests/mir-opt/sroa/lifetimes.rs1
-rw-r--r--tests/mir-opt/sroa/structs.rs1
-rw-r--r--tests/mir-opt/ssa_unreachable_116212.rs1
-rw-r--r--tests/mir-opt/storage_ranges.main.nll.0.mir2
-rw-r--r--tests/mir-opt/storage_ranges.rs1
-rw-r--r--tests/mir-opt/switch_to_self.rs1
-rw-r--r--tests/mir-opt/tls_access.rs1
-rw-r--r--tests/mir-opt/uninhabited_enum.rs1
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff (renamed from tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff)26
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff48
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir60
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.rs69
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff (renamed from tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff)39
-rw-r--r--tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir85
-rw-r--r--tests/mir-opt/uninhabited_enum_branching2.rs34
-rw-r--r--tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff6
-rw-r--r--tests/mir-opt/uninhabited_fallthrough_elimination.rs1
-rw-r--r--tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff45
-rw-r--r--tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff45
-rw-r--r--tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff (renamed from tests/mir-opt/unreachable.main.UnreachablePropagation.panic-abort.diff)35
-rw-r--r--tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff (renamed from tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff)35
-rw-r--r--tests/mir-opt/unreachable.rs49
-rw-r--r--tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff6
-rw-r--r--tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff6
-rw-r--r--tests/mir-opt/unreachable_diverging.rs19
-rw-r--r--tests/mir-opt/unusual_item_types.rs1
-rw-r--r--tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir4
-rw-r--r--tests/mir-opt/while_storage.rs20
-rw-r--r--tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir46
-rw-r--r--tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir46
-rw-r--r--tests/pretty/format-args-str-escape.pp21
-rw-r--r--tests/pretty/format-args-str-escape.rs10
-rw-r--r--tests/pretty/hir-fn-variadic.pp15
-rw-r--r--tests/pretty/hir-fn-variadic.rs13
-rw-r--r--tests/run-coverage/abort.rs66
-rw-r--r--tests/run-coverage/assert.rs32
-rw-r--r--tests/run-coverage/async.rs128
-rw-r--r--tests/run-coverage/async2.rs57
-rw-r--r--tests/run-coverage/closure.rs220
-rw-r--r--tests/run-coverage/closure_bug.rs44
-rw-r--r--tests/run-coverage/closure_macro.rs40
-rw-r--r--tests/run-coverage/closure_macro_async.rs77
-rw-r--r--tests/run-coverage/conditions.rs86
-rw-r--r--tests/run-coverage/continue.rs69
-rw-r--r--tests/run-coverage/dead_code.rs37
-rw-r--r--tests/run-coverage/drop_trait.rs33
-rw-r--r--tests/run-coverage/generics.rs44
-rw-r--r--tests/run-coverage/if.rs28
-rw-r--r--tests/run-coverage/if_else.rs40
-rw-r--r--tests/run-coverage/inline-dead.rs27
-rw-r--r--tests/run-coverage/inline.rs51
-rw-r--r--tests/run-coverage/inner_items.rs57
-rw-r--r--tests/run-coverage/issue-83601.rs14
-rw-r--r--tests/run-coverage/issue-84561.rs182
-rw-r--r--tests/run-coverage/issue-93054.rs30
-rw-r--r--tests/run-coverage/lazy_boolean.rs61
-rw-r--r--tests/run-coverage/loop_break_value.rs13
-rw-r--r--tests/run-coverage/loops_branches.rs60
-rw-r--r--tests/run-coverage/match_or_pattern.rs43
-rw-r--r--tests/run-coverage/nested_loops.rs25
-rw-r--r--tests/run-coverage/no_cov_crate.rs88
-rw-r--r--tests/run-coverage/panic_unwind.rs31
-rw-r--r--tests/run-coverage/partial_eq.rs46
-rw-r--r--tests/run-coverage/simple_loop.rs35
-rw-r--r--tests/run-coverage/simple_match.rs43
-rw-r--r--tests/run-coverage/test_harness.rs10
-rw-r--r--tests/run-coverage/tight_inf_loop.rs5
-rw-r--r--tests/run-coverage/try_error_result.rs118
-rw-r--r--tests/run-coverage/unused.rs41
-rw-r--r--tests/run-coverage/while.rs5
-rw-r--r--tests/run-coverage/while_early_ret.rs42
-rw-r--r--tests/run-coverage/yield.rs37
-rw-r--r--tests/run-make-fulldeps/issue-19371/foo.rs4
-rw-r--r--tests/run-make/const_fn_mir/Makefile7
-rw-r--r--tests/run-make/coverage-llvmir/filecheck.testprog.txt6
-rw-r--r--tests/run-make/crate-hash-rustc-version/Makefile2
-rw-r--r--tests/run-make/dump-ice-to-disk/check.sh6
-rw-r--r--tests/run-make/emit-stack-sizes/foo.rs1
-rw-r--r--tests/run-make/intrinsic-unreachable/exit-ret.rs1
-rw-r--r--tests/run-make/intrinsic-unreachable/exit-unreachable.rs1
-rw-r--r--tests/run-make/issue-71519/Makefile8
-rw-r--r--tests/run-make/issue-71519/main.rs4
-rw-r--r--tests/run-make/issue-96498/Makefile8
-rw-r--r--tests/run-make/metadata-dep-info/Makefile6
-rw-r--r--tests/run-make/overwrite-input/Makefile10
-rw-r--r--tests/run-make/raw-dylib-alt-calling-convention/Makefile12
-rw-r--r--tests/run-make/raw-dylib-import-name-type/Makefile7
-rw-r--r--tests/run-make/raw-dylib-inline-cross-dylib/Makefile7
-rw-r--r--tests/run-make/raw-dylib-link-ordinal/Makefile7
-rw-r--r--tests/run-make/raw-dylib-stdcall-ordinal/Makefile7
-rw-r--r--tests/run-make/remap-path-prefix-dwarf/Makefile37
-rw-r--r--tests/run-make/remap-path-prefix/Makefile32
-rw-r--r--tests/run-make/rust-lld-custom-target/Makefile7
-rw-r--r--tests/run-make/rust-lld-custom-target/custom-target.json57
-rw-r--r--tests/run-make/rust-lld-custom-target/lib.rs9
-rw-r--r--tests/run-make/silly-file-names/Makefile12
-rw-r--r--tests/run-make/silly-file-names/silly-file-names.rs4
-rw-r--r--tests/run-make/silly-file-names/silly-file-names.run.stdout2
-rw-r--r--tests/run-make/split-debuginfo/Makefile64
-rw-r--r--tests/run-make/tools.mk22
-rw-r--r--tests/run-make/unknown-mod-stdin/Makefile11
-rw-r--r--tests/run-make/unknown-mod-stdin/unknown-mod.stderr1
-rw-r--r--tests/run-make/use-extern-for-plugins/Makefile17
-rw-r--r--tests/run-make/use-extern-for-plugins/bar.rs9
-rw-r--r--tests/run-make/use-extern-for-plugins/baz.rs8
-rw-r--r--tests/run-make/use-extern-for-plugins/foo.rs8
-rw-r--r--tests/run-make/wasm-override-linker/Makefile13
-rw-r--r--tests/run-make/wasm-override-linker/foo.rs6
-rw-r--r--tests/run-make/windows-safeseh/Makefile19
-rw-r--r--tests/run-make/windows-safeseh/bar.rs1
-rw-r--r--tests/run-make/windows-safeseh/baz.rs4
-rw-r--r--tests/run-make/windows-safeseh/foo.rs (renamed from tests/run-make/issue-96498/foo.rs)0
-rw-r--r--tests/rustdoc-gui/anchors.goml2
-rw-r--r--tests/rustdoc-gui/code-tags.goml2
-rw-r--r--tests/rustdoc-gui/huge-logo.goml4
-rw-r--r--tests/rustdoc-gui/impl_on_foreign_order.goml6
-rw-r--r--tests/rustdoc-gui/item-decl-colors.goml2
-rw-r--r--tests/rustdoc-gui/no-docblock.goml2
-rw-r--r--tests/rustdoc-gui/rust-logo.goml15
-rw-r--r--tests/rustdoc-gui/search-result-impl-disambiguation.goml43
-rw-r--r--tests/rustdoc-gui/search-tab.goml4
-rw-r--r--tests/rustdoc-gui/setting-auto-hide-content-large-items.goml2
-rw-r--r--tests/rustdoc-gui/sidebar-mobile.goml4
-rw-r--r--tests/rustdoc-gui/sidebar-source-code-display.goml4
-rw-r--r--tests/rustdoc-gui/sidebar.goml37
-rw-r--r--tests/rustdoc-gui/source-anchor-scroll.goml8
-rw-r--r--tests/rustdoc-gui/source-code-page.goml21
-rw-r--r--tests/rustdoc-gui/src/lib2/lib.rs9
-rw-r--r--tests/rustdoc-gui/src/staged_api/lib.rs2
-rw-r--r--tests/rustdoc-gui/src/test_docs/lib.rs64
-rw-r--r--tests/rustdoc-gui/trait-sidebar-item-order.goml2
-rw-r--r--tests/rustdoc-gui/type-declation-overflow.goml2
-rw-r--r--tests/rustdoc-gui/type-impls.goml86
-rw-r--r--tests/rustdoc-js-std/simd-type-signatures.js70
-rw-r--r--tests/rustdoc-js/auxiliary/equivalent.rs15
-rw-r--r--tests/rustdoc-js/impl-trait.js19
-rw-r--r--tests/rustdoc-js/impl-trait.rs6
-rw-r--r--tests/rustdoc-js/search-method-disambiguate.js28
-rw-r--r--tests/rustdoc-js/search-method-disambiguate.rs22
-rw-r--r--tests/rustdoc-js/search-non-local-trait-impl.js9
-rw-r--r--tests/rustdoc-js/search-non-local-trait-impl.rs8
-rw-r--r--tests/rustdoc-json/doc_hidden_failure.rs3
-rw-r--r--tests/rustdoc-json/enums/field_hidden.rs3
-rw-r--r--tests/rustdoc-json/enums/kind.rs3
-rw-r--r--tests/rustdoc-json/enums/tuple_fields_hidden.rs3
-rw-r--r--tests/rustdoc-json/enums/use_glob.rs3
-rw-r--r--tests/rustdoc-json/enums/use_variant.rs3
-rw-r--r--tests/rustdoc-json/fn_pointer/generics.rs3
-rw-r--r--tests/rustdoc-json/fns/extern_c_variadic.rs3
-rw-r--r--tests/rustdoc-json/fns/generic_args.rs3
-rw-r--r--tests/rustdoc-json/fns/generic_returns.rs3
-rw-r--r--tests/rustdoc-json/fns/generics.rs3
-rw-r--r--tests/rustdoc-json/generic-associated-types/gats.rs6
-rw-r--r--tests/rustdoc-json/glob_import.rs3
-rw-r--r--tests/rustdoc-json/impls/auto.rs9
-rw-r--r--tests/rustdoc-json/impls/impl_item_visibility.rs7
-rw-r--r--tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs6
-rw-r--r--tests/rustdoc-json/impls/impl_item_visibility_show_private.rs6
-rw-r--r--tests/rustdoc-json/impls/import_from_private.rs14
-rw-r--r--tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs8
-rw-r--r--tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs3
-rw-r--r--tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs12
-rw-r--r--tests/rustdoc-json/impls/local_for_local.rs5
-rw-r--r--tests/rustdoc-json/impls/local_for_local_primitive.rs2
-rw-r--r--tests/rustdoc-json/lifetime/longest.rs9
-rw-r--r--tests/rustdoc-json/lifetime/outlives.rs3
-rw-r--r--tests/rustdoc-json/methods/abi.rs2
-rw-r--r--tests/rustdoc-json/non_lifetime_binders.rs11
-rw-r--r--tests/rustdoc-json/primitives/primitive_overloading.rs6
-rw-r--r--tests/rustdoc-json/reexport/export_extern_crate_as_self.rs3
-rw-r--r--tests/rustdoc-json/reexport/glob_collision.rs3
-rw-r--r--tests/rustdoc-json/reexport/glob_extern.rs3
-rw-r--r--tests/rustdoc-json/reexport/glob_private.rs3
-rw-r--r--tests/rustdoc-json/reexport/in_root_and_mod.rs3
-rw-r--r--tests/rustdoc-json/reexport/in_root_and_mod_pub.rs3
-rw-r--r--tests/rustdoc-json/reexport/macro.rs3
-rw-r--r--tests/rustdoc-json/reexport/mod_not_included.rs3
-rw-r--r--tests/rustdoc-json/reexport/private_twice_one_inline.rs4
-rw-r--r--tests/rustdoc-json/reexport/private_two_names.rs3
-rw-r--r--tests/rustdoc-json/reexport/pub_use_doc_hidden.rs8
-rw-r--r--tests/rustdoc-json/reexport/reexport_of_hidden.rs10
-rw-r--r--tests/rustdoc-json/reexport/rename_private.rs3
-rw-r--r--tests/rustdoc-json/reexport/rename_public.rs3
-rw-r--r--tests/rustdoc-json/reexport/same_name_different_types.rs3
-rw-r--r--tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs2
-rw-r--r--tests/rustdoc-json/reexport/simple_private.rs2
-rw-r--r--tests/rustdoc-json/reexport/simple_public.rs3
-rw-r--r--tests/rustdoc-json/return_private.rs3
-rw-r--r--tests/rustdoc-json/stripped_modules.rs3
-rw-r--r--tests/rustdoc-json/traits/implementors.rs29
-rw-r--r--tests/rustdoc-json/traits/private_supertrait.rs4
-rw-r--r--tests/rustdoc-json/traits/supertrait.rs4
-rw-r--r--tests/rustdoc-json/type/inherent_associated_type.rs2
-rw-r--r--tests/rustdoc-json/type/inherent_associated_type_bound.rs2
-rw-r--r--tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs2
-rw-r--r--tests/rustdoc-ui/check-cfg/check-cfg.rs2
-rw-r--r--tests/rustdoc-ui/check-cfg/check-cfg.stderr2
-rw-r--r--tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr2
-rw-r--r--tests/rustdoc-ui/doctest/check-cfg-test.rs2
-rw-r--r--tests/rustdoc-ui/doctest/check-cfg-test.stderr2
-rw-r--r--tests/rustdoc-ui/error-in-impl-trait/closure.rs2
-rw-r--r--tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs3
-rw-r--r--tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.stderr17
-rw-r--r--tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs3
-rw-r--r--tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.stderr17
-rw-r--r--tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs (renamed from tests/rustdoc/issue-31808.rs)5
-rw-r--r--tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.stderr1
-rw-r--r--tests/rustdoc-ui/invalid_const_in_lifetime_position.rs5
-rw-r--r--tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr84
-rw-r--r--tests/rustdoc-ui/issues/issue-105742.rs8
-rw-r--r--tests/rustdoc-ui/issues/issue-105742.stderr250
-rw-r--r--tests/rustdoc-ui/issues/issue-107918.rs2
-rw-r--r--tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout4
-rw-r--r--tests/rustdoc-ui/issues/issue-96287.stderr7
-rw-r--r--tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs7
-rw-r--r--tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr26
-rw-r--r--tests/rustdoc-ui/not-wf-ambiguous-normalization.rs (renamed from tests/rustdoc/not-wf-ambiguous-normalization.rs)1
-rw-r--r--tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr9
-rw-r--r--tests/rustdoc-ui/recursive-deref-ice.rs5
-rw-r--r--tests/rustdoc-ui/unable-fulfill-trait.rs3
-rw-r--r--tests/rustdoc-ui/unable-fulfill-trait.stderr23
-rw-r--r--tests/rustdoc-ui/unescaped_backticks.stderr3
-rw-r--r--tests/rustdoc/anchor-id-duplicate-method-name-25001.rs (renamed from tests/rustdoc/issue-25001.rs)3
-rw-r--r--tests/rustdoc/anchor-id-trait-tymethod-28478.rs (renamed from tests/rustdoc/issue-28478.rs)3
-rw-r--r--tests/rustdoc/async-trait-sig.rs1
-rw-r--r--tests/rustdoc/async-trait.rs1
-rw-r--r--tests/rustdoc/auxiliary/async-trait-dep.rs1
-rw-r--r--tests/rustdoc/auxiliary/enum-variant.rs48
-rw-r--r--tests/rustdoc/blanket-impl-29503.rs (renamed from tests/rustdoc/issue-29503.rs)3
-rw-r--r--tests/rustdoc/blanket-reexport-item.rs2
-rw-r--r--tests/rustdoc/const-effect-param.rs2
-rw-r--r--tests/rustdoc/const-generics/add-impl.rs2
-rw-r--r--tests/rustdoc/const-generics/const-impl.rs6
-rw-r--r--tests/rustdoc/const-rendering-macros-33302.rs (renamed from tests/rustdoc/issue-33302.rs)3
-rw-r--r--tests/rustdoc/crate-version-escape.rs2
-rw-r--r--tests/rustdoc/crate-version-extra.rs7
-rw-r--r--tests/rustdoc/crate-version.rs2
-rw-r--r--tests/rustdoc/decl-trailing-whitespace.declaration.html14
-rw-r--r--tests/rustdoc/decl-trailing-whitespace.rs8
-rw-r--r--tests/rustdoc/deduplicate-glob-import-impl-21474.rs (renamed from tests/rustdoc/issue-21474.rs)3
-rw-r--r--tests/rustdoc/deduplicate-trait-impl-22025.rs (renamed from tests/rustdoc/issue-22025.rs)3
-rw-r--r--tests/rustdoc/deprecated-future-staged-api.rs6
-rw-r--r--tests/rustdoc/deref/deref-mut-methods.rs2
-rw-r--r--tests/rustdoc/deref/deref-recursive-pathbuf.rs4
-rw-r--r--tests/rustdoc/disambiguate-anchors-32890.rs (renamed from tests/rustdoc/issue-32890.rs)3
-rw-r--r--tests/rustdoc/disambiguate-anchors-header-29449.rs (renamed from tests/rustdoc/issue-29449.rs)3
-rw-r--r--tests/rustdoc/doc-hidden-trait-implementors-33069.rs (renamed from tests/rustdoc/issue-33069.rs)3
-rw-r--r--tests/rustdoc/doctest-cfg-feature-30252.rs (renamed from tests/rustdoc/issue-30252.rs)3
-rw-r--r--tests/rustdoc/doctest-hide-empty-line-23106.rs10
-rw-r--r--tests/rustdoc/doctest-ignore-32556.rs (renamed from tests/rustdoc/issue-32556.rs)3
-rw-r--r--tests/rustdoc/doctest-markdown-inline-parse-23744.rs (renamed from tests/rustdoc/issue-23744.rs)3
-rw-r--r--tests/rustdoc/doctest-multi-line-string-literal-25944.rs (renamed from tests/rustdoc/issue-25944.rs)3
-rw-r--r--tests/rustdoc/enum-variant-value.rs191
-rw-r--r--tests/rustdoc/extern-fn-22038.rs (renamed from tests/rustdoc/issue-22038.rs)3
-rw-r--r--tests/rustdoc/generic-impl.rs4
-rw-r--r--tests/rustdoc/hidden-extern-34025.rs (renamed from tests/rustdoc/issue-34025.rs)1
-rw-r--r--tests/rustdoc/hidden-impls.rs2
-rw-r--r--tests/rustdoc/hide-complex-unevaluated-const-arguments.rs11
-rw-r--r--tests/rustdoc/html-no-source.rs12
-rw-r--r--tests/rustdoc/ice-reexport-crate-root-28927.rs (renamed from tests/rustdoc/issue-28927.rs)3
-rw-r--r--tests/rustdoc/impl-assoc-type-21092.rs (renamed from tests/rustdoc/issue-21092.rs)3
-rw-r--r--tests/rustdoc/impl-parts-crosscrate.rs2
-rw-r--r--tests/rustdoc/impl-type-parameter-33592.rs (renamed from tests/rustdoc/issue-33592.rs)1
-rw-r--r--tests/rustdoc/implementor-stable-version.rs16
-rw-r--r--tests/rustdoc/inline_cross/attributes.rs7
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/async-fn.rs1
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/attributes.rs2
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs16
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/const-fn.rs5
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs45
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/fn-type.rs1
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs2
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/issue-21801.rs (renamed from tests/rustdoc/auxiliary/issue-21801.rs)0
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/issue-23207-1.rs (renamed from tests/rustdoc/auxiliary/issue-23207-1.rs)0
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/issue-23207-2.rs (renamed from tests/rustdoc/auxiliary/issue-23207-2.rs)0
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs (renamed from tests/rustdoc/auxiliary/issue-27362-aux.rs)0
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/issue-29584.rs (renamed from tests/rustdoc/auxiliary/issue-29584.rs)0
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs10
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/repr.rs22
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs2
-rw-r--r--tests/rustdoc/inline_cross/const-effect-param.rs29
-rw-r--r--tests/rustdoc/inline_cross/const-fn-27362.rs (renamed from tests/rustdoc/issue-27362.rs)3
-rw-r--r--tests/rustdoc/inline_cross/const-fn.rs10
-rw-r--r--tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs (renamed from tests/rustdoc/issue-23207.rs)3
-rw-r--r--tests/rustdoc/inline_cross/default-generic-args.rs104
-rw-r--r--tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs (renamed from tests/rustdoc/issue-29584.rs)3
-rw-r--r--tests/rustdoc/inline_cross/dyn_trait.rs8
-rw-r--r--tests/rustdoc/inline_cross/fn-type.rs12
-rw-r--r--tests/rustdoc/inline_cross/impl_trait.rs6
-rw-r--r--tests/rustdoc/inline_cross/implementors-js.rs10
-rw-r--r--tests/rustdoc/inline_cross/non_lifetime_binders.rs13
-rw-r--r--tests/rustdoc/inline_cross/repr.rs21
-rw-r--r--tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs (renamed from tests/rustdoc/issue-21801.rs)3
-rw-r--r--tests/rustdoc/intra-doc/prim-associated-traits.rs2
-rw-r--r--tests/rustdoc/issue-115295-macro-const-display.rs40
-rw-r--r--tests/rustdoc/issue-23106.rs7
-rw-r--r--tests/rustdoc/issue-43701.rs2
-rw-r--r--tests/rustdoc/issue-78701.rs2
-rw-r--r--tests/rustdoc/link-extern-crate-33178.rs (renamed from tests/rustdoc/issue-33178.rs)3
-rw-r--r--tests/rustdoc/link-extern-crate-item-30109.rs (renamed from tests/rustdoc/issue-30109.rs)3
-rw-r--r--tests/rustdoc/link-extern-crate-title-33178.rs (renamed from tests/rustdoc/issue-33178-1.rs)3
-rw-r--r--tests/rustdoc/logo-class-default.rs6
-rw-r--r--tests/rustdoc/logo-class-rust.rs7
-rw-r--r--tests/rustdoc/logo-class.rs2
-rw-r--r--tests/rustdoc/macro-doc-comment-23812.rs (renamed from tests/rustdoc/issue-23812.rs)3
-rw-r--r--tests/rustdoc/markdown-table-escape-pipe-27862.rs (renamed from tests/rustdoc/issue-27862.rs)3
-rw-r--r--tests/rustdoc/normalize-assoc-item.rs4
-rw-r--r--tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs11
-rw-r--r--tests/rustdoc/primitive/primitive-generic-impl.rs2
-rw-r--r--tests/rustdoc/render-enum-variant-structlike-32395.rs (renamed from tests/rustdoc/issue-32395.rs)3
-rw-r--r--tests/rustdoc/repr.rs29
-rw-r--r--tests/rustdoc/search-index-primitive-inherent-method-23511.rs (renamed from tests/rustdoc/issue-23511.rs)3
-rw-r--r--tests/rustdoc/sidebar-items.rs7
-rw-r--r--tests/rustdoc/sidebar-links-to-foreign-impl.rs4
-rw-r--r--tests/rustdoc/source-version-separator.rs10
-rw-r--r--tests/rustdoc/src-link-external-macro-26606.rs (renamed from tests/rustdoc/issue-26606.rs)5
-rw-r--r--tests/rustdoc/src-links-auto-impls.rs4
-rw-r--r--tests/rustdoc/src-links-inlined-34274.rs (renamed from tests/rustdoc/issue-34274.rs)1
-rw-r--r--tests/rustdoc/src-mod-path-absolute-26995.rs (renamed from tests/rustdoc/issue-26995.rs)3
-rw-r--r--tests/rustdoc/staged-api-deprecated-unstable-32374.rs (renamed from tests/rustdoc/issue-32374.rs)2
-rw-r--r--tests/rustdoc/staged-api-feature-issue-27759.rs (renamed from tests/rustdoc/issue-27759.rs)3
-rw-r--r--tests/rustdoc/strip-enum-variant.no-not-shown.html2
-rw-r--r--tests/rustdoc/strip-enum-variant.rs2
-rw-r--r--tests/rustdoc/strip-priv-imports-pass-27104.rs (renamed from tests/rustdoc/issue-27104.rs)3
-rw-r--r--tests/rustdoc/summary-codeblock-31899.rs (renamed from tests/rustdoc/issue-31899.rs)3
-rw-r--r--tests/rustdoc/summary-reference-link-30366.rs (renamed from tests/rustdoc/issue-30366.rs)3
-rw-r--r--tests/rustdoc/titles.rs3
-rw-r--r--tests/rustdoc/trait-object-safe.rs27
-rw-r--r--tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs9
-rw-r--r--tests/rustdoc/type-alias/cross-crate-115718.rs34
-rw-r--r--tests/rustdoc/type-alias/deeply-nested-112515.rs (renamed from tests/rustdoc/issue-112515-impl-ty-alias.rs)0
-rw-r--r--tests/rustdoc/type-alias/deref-32077.rs (renamed from tests/rustdoc/issue-32077-type-alias-impls.rs)20
-rw-r--r--tests/rustdoc/type-alias/same-crate-115718.rs34
-rw-r--r--tests/rustdoc/version-separator-without-source.rs12
-rw-r--r--tests/rustdoc/where-clause-order.rs13
-rw-r--r--tests/rustdoc/whitespace-after-where-clause.enum.html2
-rw-r--r--tests/rustdoc/whitespace-after-where-clause.enum2.html2
-rw-r--r--tests/rustdoc/whitespace-after-where-clause.rs15
-rw-r--r--tests/rustdoc/whitespace-after-where-clause.struct.html2
-rw-r--r--tests/rustdoc/whitespace-after-where-clause.struct2.html2
-rw-r--r--tests/rustdoc/whitespace-after-where-clause.union.html2
-rw-r--r--tests/rustdoc/whitespace-after-where-clause.union2.html2
-rw-r--r--tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs15
-rw-r--r--tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.stderr14
-rw-r--r--tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs4
-rw-r--r--tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr4
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs9
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs61
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs43
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs43
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs33
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs52
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs5
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs11
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs10
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs10
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs24
-rw-r--r--tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs12
-rw-r--r--tests/ui-fulldeps/plugin/feature-gate-plugin.rs8
-rw-r--r--tests/ui-fulldeps/plugin/feature-gate-plugin.stderr20
-rw-r--r--tests/ui-fulldeps/plugin/gated-plugin.rs8
-rw-r--r--tests/ui-fulldeps/plugin/gated-plugin.stderr20
-rw-r--r--tests/ui-fulldeps/plugin/issue-15778-fail.rs9
-rw-r--r--tests/ui-fulldeps/plugin/issue-15778-fail.stderr22
-rw-r--r--tests/ui-fulldeps/plugin/issue-40001.rs10
-rw-r--r--tests/ui-fulldeps/plugin/issue-40001.stderr10
-rw-r--r--tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs17
-rw-r--r--tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr28
-rw-r--r--tests/ui-fulldeps/plugin/lint-group-plugin.rs17
-rw-r--r--tests/ui-fulldeps/plugin/lint-group-plugin.stderr26
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs12
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr10
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs13
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr18
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs13
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr22
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs13
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr18
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs16
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr41
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs15
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr35
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin.rs13
-rw-r--r--tests/ui-fulldeps/plugin/lint-plugin.stderr18
-rw-r--r--tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs12
-rw-r--r--tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr34
-rw-r--r--tests/ui-fulldeps/plugin/lint-tool-test.rs36
-rw-r--r--tests/ui-fulldeps/plugin/lint-tool-test.stderr95
-rw-r--r--tests/ui-fulldeps/plugin/lto-syntax-extension.rs15
-rw-r--r--tests/ui-fulldeps/plugin/lto-syntax-extension.stderr10
-rw-r--r--tests/ui-fulldeps/plugin/macro-crate-rlib.rs9
-rw-r--r--tests/ui-fulldeps/plugin/macro-crate-rlib.stderr9
-rw-r--r--tests/ui-fulldeps/plugin/multiple-plugins.rs12
-rw-r--r--tests/ui-fulldeps/plugin/multiple-plugins.stderr16
-rw-r--r--tests/ui-fulldeps/plugin/outlive-expansion-phase.rs8
-rw-r--r--tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr10
-rw-r--r--tests/ui-fulldeps/plugin/plugin-args.rs9
-rw-r--r--tests/ui-fulldeps/plugin/plugin-args.stderr17
-rw-r--r--tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs10
-rw-r--r--tests/ui-fulldeps/pprust-expr-roundtrip.rs6
-rw-r--r--tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr2
-rw-r--r--tests/ui-fulldeps/stable-mir/check_instance.rs122
-rw-r--r--tests/ui-fulldeps/stable-mir/compilation-result.rs19
-rw-r--r--tests/ui-fulldeps/stable-mir/crate-info.rs129
-rw-r--r--tests/ui-fulldeps/stable-mir/smir_internal.rs64
-rw-r--r--tests/ui-fulldeps/stable-mir/smir_visitor.rs148
-rw-r--r--tests/ui/abi/compatibility.rs1
-rw-r--r--tests/ui/allocator/not-an-allocator.stderr3
-rw-r--r--tests/ui/array-slice-vec/vector-no-ann.stderr2
-rw-r--r--tests/ui/asm/aarch64/interpolated-idents.stderr7
-rw-r--r--tests/ui/asm/x86_64/interpolated-idents.stderr7
-rw-r--r--tests/ui/asm/x86_64/issue-96797.rs9
-rw-r--r--tests/ui/associated-consts/associated-const-ambiguity-report.stderr8
-rw-r--r--tests/ui/associated-consts/defaults-not-assumed-fail.stderr1
-rw-r--r--tests/ui/associated-consts/issue-105330.rs10
-rw-r--r--tests/ui/associated-consts/issue-105330.stderr82
-rw-r--r--tests/ui/associated-consts/issue-58022.rs1
-rw-r--r--tests/ui/associated-consts/issue-58022.stderr22
-rw-r--r--tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr14
-rw-r--r--tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr2
-rw-r--r--tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr2
-rw-r--r--tests/ui/associated-inherent-types/generic-associated-types-bad.rs1
-rw-r--r--tests/ui/associated-inherent-types/issue-109071.no_gate.stderr2
-rw-r--r--tests/ui/associated-inherent-types/issue-109789.stderr1
-rw-r--r--tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr2
-rw-r--r--tests/ui/associated-inherent-types/regionck-1.stderr11
-rw-r--r--tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr2
-rw-r--r--tests/ui/associated-item/associated-item-duplicate-names-3.stderr2
-rw-r--r--tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs28
-rw-r--r--tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.stderr18
-rw-r--r--tests/ui/associated-type-bounds/duplicate.rs132
-rw-r--r--tests/ui/associated-type-bounds/duplicate.stderr144
-rw-r--r--tests/ui/associated-type-bounds/elision.stderr2
-rw-r--r--tests/ui/associated-type-bounds/issue-71443-1.stderr2
-rw-r--r--tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/equality.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/missing.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/missing.stderr2
-rw-r--r--tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.fixed14
-rw-r--r--tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.rs14
-rw-r--r--tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.stderr16
-rw-r--r--tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr24
-rw-r--r--tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr12
-rw-r--r--tests/ui/associated-types/associated-types-coherence-failure.stderr8
-rw-r--r--tests/ui/associated-types/associated-types-in-ambiguous-context.stderr6
-rw-r--r--tests/ui/associated-types/associated-types-incomplete-object.rs6
-rw-r--r--tests/ui/associated-types/associated-types-incomplete-object.stderr6
-rw-r--r--tests/ui/associated-types/associated-types-issue-20346.stderr2
-rw-r--r--tests/ui/associated-types/associated-types-no-suitable-supertrait.rs1
-rw-r--r--tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr14
-rw-r--r--tests/ui/associated-types/associated-types-path-1.stderr4
-rw-r--r--tests/ui/associated-types/hr-associated-type-bound-2.stderr6
-rw-r--r--tests/ui/associated-types/hr-associated-type-bound-param-2.stderr1
-rw-r--r--tests/ui/associated-types/hr-associated-type-projection-1.stderr4
-rw-r--r--tests/ui/associated-types/impl-wf-cycle-1.stderr8
-rw-r--r--tests/ui/associated-types/impl-wf-cycle-2.stderr7
-rw-r--r--tests/ui/associated-types/issue-22560.stderr2
-rw-r--r--tests/ui/associated-types/issue-23595-1.stderr2
-rw-r--r--tests/ui/associated-types/missing-associated-types.stderr10
-rw-r--r--tests/ui/async-await/async-await-let-else.stderr6
-rw-r--r--tests/ui/async-await/async-trait-fn.current.stderr42
-rw-r--r--tests/ui/async-await/async-trait-fn.next.stderr42
-rw-r--r--tests/ui/async-await/async-trait-fn.rs7
-rw-r--r--tests/ui/async-await/async-trait-fn.stderr42
-rw-r--r--tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr2
-rw-r--r--tests/ui/async-await/async-unsafe-fn-call-in-safe.rs8
-rw-r--r--tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr18
-rw-r--r--tests/ui/async-await/coroutine-desc.rs (renamed from tests/ui/async-await/generator-desc.rs)0
-rw-r--r--tests/ui/async-await/coroutine-desc.stderr (renamed from tests/ui/async-await/generator-desc.stderr)20
-rw-r--r--tests/ui/async-await/coroutine-not-future.rs (renamed from tests/ui/async-await/generator-not-future.rs)24
-rw-r--r--tests/ui/async-await/coroutine-not-future.stderr81
-rw-r--r--tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs10
-rw-r--r--tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr23
-rw-r--r--tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr1
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.current.stderr98
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.next.stderr98
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.rs1
-rw-r--r--tests/ui/async-await/edition-deny-async-fns-2015.stderr24
-rw-r--r--tests/ui/async-await/feature-gate-async_fn_in_trait.rs25
-rw-r--r--tests/ui/async-await/feature-gate-async_fn_in_trait.stderr42
-rw-r--r--tests/ui/async-await/future-sizes/async-awaiting-fut.stdout6
-rw-r--r--tests/ui/async-await/generator-not-future.stderr81
-rw-r--r--tests/ui/async-await/in-trait/async-associated-types.rs5
-rw-r--r--tests/ui/async-await/in-trait/async-default-fn-overridden.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr6
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-extra.rs5
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared-manual.stderr2
-rw-r--r--tests/ui/async-await/in-trait/async-example-desugared.rs5
-rw-r--r--tests/ui/async-await/in-trait/async-example.rs6
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-generics-and-bounds.stderr38
-rw-r--r--tests/ui/async-await/in-trait/async-generics.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-generics.stderr38
-rw-r--r--tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-lifetimes.rs4
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-recursive-generic.stderr4
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.rs3
-rw-r--r--tests/ui/async-await/in-trait/async-recursive.stderr4
-rw-r--r--tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs2
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.rs1
-rw-r--r--tests/ui/async-await/in-trait/bad-signatures.stderr4
-rw-r--r--tests/ui/async-await/in-trait/coherence-constrained.rs26
-rw-r--r--tests/ui/async-await/in-trait/coherence-constrained.stderr25
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs1
-rw-r--r--tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr12
-rw-r--r--tests/ui/async-await/in-trait/early-bound-1.rs4
-rw-r--r--tests/ui/async-await/in-trait/early-bound-2.rs2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err.rs1
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err.stderr2
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.rs3
-rw-r--r--tests/ui/async-await/in-trait/fn-not-async-err2.stderr12
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.rs1
-rw-r--r--tests/ui/async-await/in-trait/generics-mismatch.stderr2
-rw-r--r--tests/ui/async-await/in-trait/implied-bounds.rs3
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs2
-rw-r--r--tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr6
-rw-r--r--tests/ui/async-await/in-trait/issue-102138.rs3
-rw-r--r--tests/ui/async-await/in-trait/issue-102219.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-102310.rs2
-rw-r--r--tests/ui/async-await/in-trait/issue-104678.rs2
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.rs1
-rw-r--r--tests/ui/async-await/in-trait/lifetime-mismatch.stderr2
-rw-r--r--tests/ui/async-await/in-trait/missing-feature-flag.rs1
-rw-r--r--tests/ui/async-await/in-trait/missing-feature-flag.stderr16
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.rs1
-rw-r--r--tests/ui/async-await/in-trait/missing-send-bound.stderr6
-rw-r--r--tests/ui/async-await/in-trait/nested-rpit.rs3
-rw-r--r--tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs2
-rw-r--r--tests/ui/async-await/in-trait/object-safety.rs1
-rw-r--r--tests/ui/async-await/in-trait/object-safety.stderr4
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-pair.rs1
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-pair.stderr8
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs1
-rw-r--r--tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr2
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.rs1
-rw-r--r--tests/ui/async-await/in-trait/return-type-suggestion.stderr2
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed1
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs1
-rw-r--r--tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr8
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs2
-rw-r--r--tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr6
-rw-r--r--tests/ui/async-await/in-trait/unconstrained-impl-region.rs19
-rw-r--r--tests/ui/async-await/in-trait/unconstrained-impl-region.stderr9
-rw-r--r--tests/ui/async-await/in-trait/warn.rs22
-rw-r--r--tests/ui/async-await/in-trait/warn.stderr20
-rw-r--r--tests/ui/async-await/issue-108572.fixed16
-rw-r--r--tests/ui/async-await/issue-108572.rs7
-rw-r--r--tests/ui/async-await/issue-108572.stderr9
-rw-r--r--tests/ui/async-await/issue-60709.rs2
-rw-r--r--tests/ui/async-await/issue-61793.rs2
-rw-r--r--tests/ui/async-await/issue-62658.rs2
-rw-r--r--tests/ui/async-await/issue-64130-3-other.stderr2
-rw-r--r--tests/ui/async-await/issue-66312.rs2
-rw-r--r--tests/ui/async-await/issue-66312.stderr11
-rw-r--r--tests/ui/async-await/issue-68112.stderr2
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.stderr2
-rw-r--r--tests/ui/async-await/issue-73137.rs2
-rw-r--r--tests/ui/async-await/issues/issue-51719.rs4
-rw-r--r--tests/ui/async-await/issues/issue-59972.rs2
-rw-r--r--tests/ui/async-await/issues/issue-60655-latebound-regions.rs2
-rw-r--r--tests/ui/async-await/issues/issue-64477-2.rs2
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs4
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs4
-rw-r--r--tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs (renamed from tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs)10
-rw-r--r--tests/ui/async-await/issues/issue-67893.stderr6
-rw-r--r--tests/ui/async-await/issues/issue-95307.rs3
-rw-r--r--tests/ui/async-await/issues/issue-95307.stderr18
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr8
-rw-r--r--tests/ui/async-await/no-async-const.rs1
-rw-r--r--tests/ui/async-await/no-async-const.stderr11
-rw-r--r--tests/ui/async-await/no-unsafe-async.rs2
-rw-r--r--tests/ui/async-await/no-unsafe-async.stderr5
-rw-r--r--tests/ui/async-await/non-trivial-drop.rs2
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.rs2
-rw-r--r--tests/ui/async-await/partial-drop-partial-reinit.stderr4
-rw-r--r--tests/ui/async-await/pin-needed-to-poll.stderr8
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.stderr4
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.rs1
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-early.stderr9
-rw-r--r--tests/ui/async-await/return-type-notation/issue-110963-late.rs1
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr8
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr2
-rw-r--r--tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs1
-rw-r--r--tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.current.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.next.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/supertrait-bound.stderr6
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr3
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr6
-rw-r--r--tests/ui/async-await/send-bound-async-closure.rs2
-rw-r--r--tests/ui/async-await/task-context-arg.rs2
-rw-r--r--tests/ui/async-await/unnecessary-await.rs5
-rw-r--r--tests/ui/async-await/unnecessary-await.stderr15
-rw-r--r--tests/ui/atomic-from-mut-not-available.stderr4
-rw-r--r--tests/ui/attributes/const-stability-on-macro.rs2
-rw-r--r--tests/ui/attributes/const-stability-on-macro.stderr4
-rw-r--r--tests/ui/attributes/statement-attribute-validation.rs39
-rw-r--r--tests/ui/attributes/statement-attribute-validation.stderr56
-rw-r--r--tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr8
-rw-r--r--tests/ui/auto-traits/has-arguments.rs10
-rw-r--r--tests/ui/auto-traits/has-arguments.stderr11
-rw-r--r--tests/ui/auto-traits/pre-cfg.rs8
-rw-r--r--tests/ui/auto-traits/pre-cfg.stderr13
-rw-r--r--tests/ui/binding/issue-53114-borrow-checks.rs13
-rw-r--r--tests/ui/binding/issue-53114-borrow-checks.stderr81
-rw-r--r--tests/ui/binop/false-binop-caused-by-missing-semi.fixed10
-rw-r--r--tests/ui/binop/false-binop-caused-by-missing-semi.rs10
-rw-r--r--tests/ui/binop/false-binop-caused-by-missing-semi.stderr17
-rw-r--r--tests/ui/block-result/block-must-not-have-result-res.stderr2
-rw-r--r--tests/ui/block-result/issue-20862.stderr2
-rw-r--r--tests/ui/block-result/issue-22645.stderr2
-rw-r--r--tests/ui/block-result/issue-5500.stderr2
-rw-r--r--tests/ui/borrowck/alias-liveness/escaping-bounds-2.rs14
-rw-r--r--tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr19
-rw-r--r--tests/ui/borrowck/alias-liveness/escaping-bounds.rs22
-rw-r--r--tests/ui/borrowck/alias-liveness/gat-static.rs29
-rw-r--r--tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.rs16
-rw-r--r--tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr16
-rw-r--r--tests/ui/borrowck/alias-liveness/higher-ranked.rs16
-rw-r--r--tests/ui/borrowck/alias-liveness/opaque-capture.rs17
-rw-r--r--tests/ui/borrowck/alias-liveness/opaque-type-param.rs14
-rw-r--r--tests/ui/borrowck/alias-liveness/opaque-type-param.stderr13
-rw-r--r--tests/ui/borrowck/alias-liveness/rpit-static.rs22
-rw-r--r--tests/ui/borrowck/alias-liveness/rpitit-static.rs18
-rw-r--r--tests/ui/borrowck/alias-liveness/rtn-static.rs23
-rw-r--r--tests/ui/borrowck/alias-liveness/rtn-static.stderr11
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-match.rs10
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-match.stderr40
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs10
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr138
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs10
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr50
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs10
-rw-r--r--tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr138
-rw-r--r--tests/ui/borrowck/issue-62107-match-arm-scopes.rs2
-rw-r--r--tests/ui/borrowck/issue-62107-match-arm-scopes.stderr5
-rw-r--r--tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs4
-rw-r--r--tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr6
-rw-r--r--tests/ui/borrowck/let_underscore_temporary.rs38
-rw-r--r--tests/ui/borrowck/let_underscore_temporary.stderr40
-rw-r--r--tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr1
-rw-r--r--tests/ui/bounds-lifetime.rs2
-rw-r--r--tests/ui/bounds-lifetime.stderr4
-rw-r--r--tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr7
-rw-r--r--tests/ui/c-variadic/issue-86053-1.stderr10
-rw-r--r--tests/ui/cast/ptr-to-ptr-different-regions.rs24
-rw-r--r--tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr2
-rw-r--r--tests/ui/check-cfg/allow-at-crate-level.rs2
-rw-r--r--tests/ui/check-cfg/allow-macro-cfg.rs2
-rw-r--r--tests/ui/check-cfg/allow-same-level.rs2
-rw-r--r--tests/ui/check-cfg/allow-same-level.stderr3
-rw-r--r--tests/ui/check-cfg/allow-top-level.rs2
-rw-r--r--tests/ui/check-cfg/allow-upper-level.rs2
-rw-r--r--tests/ui/check-cfg/compact-names.rs2
-rw-r--r--tests/ui/check-cfg/compact-names.stderr3
-rw-r--r--tests/ui/check-cfg/compact-values.rs2
-rw-r--r--tests/ui/check-cfg/compact-values.stderr2
-rw-r--r--tests/ui/check-cfg/concat-values.rs13
-rw-r--r--tests/ui/check-cfg/concat-values.stderr19
-rw-r--r--tests/ui/check-cfg/diagnotics.rs2
-rw-r--r--tests/ui/check-cfg/diagnotics.stderr13
-rw-r--r--tests/ui/check-cfg/empty-names.rs10
-rw-r--r--tests/ui/check-cfg/empty-names.stderr10
-rw-r--r--tests/ui/check-cfg/empty-values.rs10
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr25
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr25
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.feature.stderr33
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.full.stderr33
-rw-r--r--tests/ui/check-cfg/exhaustive-names-values.rs34
-rw-r--r--tests/ui/check-cfg/exhaustive-names.empty_names.stderr15
-rw-r--r--tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr15
-rw-r--r--tests/ui/check-cfg/exhaustive-names.rs12
-rw-r--r--tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr17
-rw-r--r--tests/ui/check-cfg/exhaustive-values.empty_values.stderr (renamed from tests/ui/check-cfg/empty-values.stderr)4
-rw-r--r--tests/ui/check-cfg/exhaustive-values.rs13
-rw-r--r--tests/ui/check-cfg/exhaustive-values.without_names.stderr13
-rw-r--r--tests/ui/check-cfg/invalid-arguments.any_values.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.anything_else.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.giberich.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.mixed_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.multiple_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.multiple_values.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.rs34
-rw-r--r--tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.unterminated.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr2
-rw-r--r--tests/ui/check-cfg/invalid-cfg-name.rs14
-rw-r--r--tests/ui/check-cfg/invalid-cfg-value.rs18
-rw-r--r--tests/ui/check-cfg/mix.cfg.stderr (renamed from tests/ui/check-cfg/mix.stderr)106
-rw-r--r--tests/ui/check-cfg/mix.names_values.stderr192
-rw-r--r--tests/ui/check-cfg/mix.rs6
-rw-r--r--tests/ui/check-cfg/no-expected-values.empty.stderr (renamed from tests/ui/check-cfg/no-values.stderr)8
-rw-r--r--tests/ui/check-cfg/no-expected-values.mixed.stderr23
-rw-r--r--tests/ui/check-cfg/no-expected-values.rs20
-rw-r--r--tests/ui/check-cfg/no-expected-values.simple.stderr23
-rw-r--r--tests/ui/check-cfg/no-expected-values.values.stderr23
-rw-r--r--tests/ui/check-cfg/no-values.rs14
-rw-r--r--tests/ui/check-cfg/order-independant.names_after.stderr4
-rw-r--r--tests/ui/check-cfg/order-independant.names_before.stderr4
-rw-r--r--tests/ui/check-cfg/stmt-no-ice.rs2
-rw-r--r--tests/ui/check-cfg/stmt-no-ice.stderr3
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-name.exhaustive.stderr (renamed from tests/ui/check-cfg/invalid-cfg-name.stderr)4
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-name.names.stderr10
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-name.rs16
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-value.cfg.stderr (renamed from tests/ui/check-cfg/invalid-cfg-value.stderr)8
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-value.rs22
-rw-r--r--tests/ui/check-cfg/unexpected-cfg-value.values.stderr25
-rw-r--r--tests/ui/check-cfg/unknown-values.rs17
-rw-r--r--tests/ui/check-cfg/values-target-json.stderr2
-rw-r--r--tests/ui/check-cfg/well-known-names.rs2
-rw-r--r--tests/ui/check-cfg/well-known-names.stderr14
-rw-r--r--tests/ui/check-cfg/well-known-values.rs2
-rw-r--r--tests/ui/check-cfg/well-known-values.stderr10
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs3
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.stderr12
-rw-r--r--tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr4
-rw-r--r--tests/ui/closures/add_semicolon_non_block_closure.stderr2
-rw-r--r--tests/ui/closures/binder/implicit-return.stderr4
-rw-r--r--tests/ui/closures/binder/implicit-stuff.stderr4
-rw-r--r--tests/ui/closures/closure-expected.rs2
-rw-r--r--tests/ui/closures/closure-expected.stderr4
-rw-r--r--tests/ui/closures/coerce-unsafe-to-closure.stderr2
-rw-r--r--tests/ui/closures/infer-signature-from-impl.next.stderr16
-rw-r--r--tests/ui/closures/infer-signature-from-impl.rs20
-rw-r--r--tests/ui/closures/issue-25439.rs2
-rw-r--r--tests/ui/closures/issue-25439.stderr2
-rw-r--r--tests/ui/codegen/issue-79865-llvm-miscompile.rs2
-rw-r--r--tests/ui/codemap_tests/tab.stderr2
-rw-r--r--tests/ui/coercion/issue-53475.stderr7
-rw-r--r--tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs1
-rw-r--r--tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr13
-rw-r--r--tests/ui/coherence/coherence-negative-outlives-lifetimes.rs2
-rw-r--r--tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr11
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.next.stderr2
-rw-r--r--tests/ui/coherence/coherence-overlap-downstream.old.stderr2
-rw-r--r--tests/ui/coherence/coherence-overlap-trait-alias.rs4
-rw-r--r--tests/ui/coherence/coherence-overlap-trait-alias.stderr16
-rw-r--r--tests/ui/coherence/coherence-overlap-upstream.stderr2
-rw-r--r--tests/ui/coherence/coherence-overlap-with-regions.rs8
-rw-r--r--tests/ui/coherence/coherence-overlap-with-regions.stderr11
-rw-r--r--tests/ui/coherence/coherence-wasm-bindgen.stderr14
-rw-r--r--tests/ui/coherence/coherence-with-coroutine.rs (renamed from tests/ui/coherence/coherence-with-generator.rs)10
-rw-r--r--tests/ui/coherence/coherence-with-coroutine.stock.stderr (renamed from tests/ui/coherence/coherence-with-generator.stock.stderr)8
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr11
-rw-r--r--tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr11
-rw-r--r--tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr12
-rw-r--r--tests/ui/coherence/negative-coherence-considering-regions.rs29
-rw-r--r--tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr12
-rw-r--r--tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr38
-rw-r--r--tests/ui/compare-method/bad-self-type.stderr4
-rw-r--r--tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr1
-rw-r--r--tests/ui/const-generics/assoc_const_eq_diagnostic.stderr1
-rw-r--r--tests/ui/const-generics/const-arg-in-const-arg.rs2
-rw-r--r--tests/ui/const-generics/const-argument-if-length.full.stderr16
-rw-r--r--tests/ui/const-generics/defaults/default-annotation.rs6
-rw-r--r--tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs2
-rw-r--r--tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr19
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-80742.rs1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-80742.stderr4
-rw-r--r--tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr8
-rw-r--r--tests/ui/const-generics/generic_const_exprs/type_mismatch.rs13
-rw-r--r--tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr12
-rw-r--r--tests/ui/const-generics/issues/issue-100313.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-67945-1.full.stderr2
-rw-r--r--tests/ui/const-generics/issues/issue-74950.min.stderr4
-rw-r--r--tests/ui/const-generics/issues/issue-83249.stderr15
-rw-r--r--tests/ui/const-generics/occurs-check/unused-substs-1.stderr2
-rw-r--r--tests/ui/const-ptr/allowed_slices.rs2
-rw-r--r--tests/ui/const-ptr/forbidden_slices.rs14
-rw-r--r--tests/ui/const-ptr/forbidden_slices.stderr114
-rw-r--r--tests/ui/const-ptr/out_of_bounds_read.stderr6
-rw-r--r--tests/ui/const_prop/overwrite_with_const_with_params.rs21
-rw-r--r--tests/ui/consts/assert-type-intrinsics.rs1
-rw-r--r--tests/ui/consts/assert-type-intrinsics.stderr12
-rw-r--r--tests/ui/consts/const-adt-align-mismatch.rs2
-rw-r--r--tests/ui/consts/const-blocks/fn-call-in-non-const.stderr6
-rw-r--r--tests/ui/consts/const-blocks/trait-error.stderr6
-rw-r--r--tests/ui/consts/const-compare-bytes-ub.stderr8
-rw-r--r--tests/ui/consts/const-deref-ptr.rs1
-rw-r--r--tests/ui/consts/const-deref-ptr.stderr2
-rw-r--r--tests/ui/consts/const-err-late.stderr2
-rw-r--r--tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs14
-rw-r--r--tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr4
-rw-r--r--tests/ui/consts/const-eval/dangling.rs10
-rw-r--r--tests/ui/consts/const-eval/dangling.stderr9
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs2
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr10
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr6
-rw-r--r--tests/ui/consts/const-eval/issue-114994-fail.rs14
-rw-r--r--tests/ui/consts/const-eval/issue-114994-fail.stderr21
-rw-r--r--tests/ui/consts/const-eval/issue-114994.rs18
-rw-r--r--tests/ui/consts/const-eval/issue-44578.stderr1
-rw-r--r--tests/ui/consts/const-eval/issue-49296.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr21
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.normal.stderr (renamed from tests/ui/consts/const-eval/issue-50814-2.stderr)6
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.rs2
-rw-r--r--tests/ui/consts/const-eval/nonnull_as_ref_ub.rs2
-rw-r--r--tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr11
-rw-r--r--tests/ui/consts/const-eval/nrvo.rs3
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.stderr2
-rw-r--r--tests/ui/consts/const-eval/partial_ptr_overwrite.stderr2
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.32bit.stderr10
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.64bit.stderr10
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.rs4
-rw-r--r--tests/ui/consts/const-eval/raw-pointer-ub.rs45
-rw-r--r--tests/ui/consts/const-eval/raw-pointer-ub.stderr42
-rw-r--r--tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr1
-rw-r--r--tests/ui/consts/const-eval/ub-enum.rs2
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr40
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr40
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.rs10
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.rs2
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.rs2
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-upvars.32bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-upvars.64bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.rs20
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.stderr67
-rw-r--r--tests/ui/consts/const-eval/union-const-eval-field.rs2
-rw-r--r--tests/ui/consts/const-eval/union-const-eval-field.stderr8
-rw-r--r--tests/ui/consts/const-eval/unused-broken-const-late.rs20
-rw-r--r--tests/ui/consts/const-eval/unused-broken-const-late.stderr11
-rw-r--r--tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs1
-rw-r--r--tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr10
-rw-r--r--tests/ui/consts/const-fn-in-vec.rs8
-rw-r--r--tests/ui/consts/const-fn-in-vec.stderr44
-rw-r--r--tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr20
-rw-r--r--tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr20
-rw-r--r--tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs9
-rw-r--r--tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr26
-rw-r--r--tests/ui/consts/const-points-to-static.32bit.stderr2
-rw-r--r--tests/ui/consts/const-points-to-static.64bit.stderr2
-rw-r--r--tests/ui/consts/const-unsized.rs4
-rw-r--r--tests/ui/consts/const-unsized.stderr44
-rw-r--r--tests/ui/consts/const_discriminant.rs1
-rw-r--r--tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs32
-rw-r--r--tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr34
-rw-r--r--tests/ui/consts/const_in_pattern/issue-44333.rs4
-rw-r--r--tests/ui/consts/const_in_pattern/issue-44333.stderr4
-rw-r--r--tests/ui/consts/const_in_pattern/issue-78057.rs1
-rw-r--r--tests/ui/consts/const_in_pattern/issue-78057.stderr17
-rw-r--r--tests/ui/consts/const_in_pattern/reject_non_structural.rs5
-rw-r--r--tests/ui/consts/const_in_pattern/reject_non_structural.stderr33
-rw-r--r--tests/ui/consts/copy-intrinsic.stderr4
-rw-r--r--tests/ui/consts/enum-discr-type-err.stderr1
-rw-r--r--tests/ui/consts/extra-const-ub/detect-extra-ub.rs13
-rw-r--r--tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr8
-rw-r--r--tests/ui/consts/fn_trait_refs.stderr10
-rw-r--r--tests/ui/consts/invalid-union.32bit.stderr4
-rw-r--r--tests/ui/consts/invalid-union.64bit.stderr4
-rw-r--r--tests/ui/consts/issue-102117.stderr15
-rw-r--r--tests/ui/consts/issue-116186.rs12
-rw-r--r--tests/ui/consts/issue-116186.stderr21
-rw-r--r--tests/ui/consts/issue-17718-const-bad-values.stderr1
-rw-r--r--tests/ui/consts/issue-34784.rs21
-rw-r--r--tests/ui/consts/issue-39974.rs1
-rw-r--r--tests/ui/consts/issue-39974.stderr13
-rw-r--r--tests/ui/consts/issue-63952.32bit.stderr2
-rw-r--r--tests/ui/consts/issue-63952.64bit.stderr2
-rw-r--r--tests/ui/consts/issue-67696-const-prop-ice.rs2
-rw-r--r--tests/ui/consts/issue-79690.64bit.stderr2
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const.stderr2
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const_2.stderr2
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr4
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr4
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr9
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr9
-rw-r--r--tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr6
-rw-r--r--tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr6
-rw-r--r--tests/ui/consts/miri_unleashed/ptr_arith.rs1
-rw-r--r--tests/ui/consts/miri_unleashed/ptr_arith.stderr6
-rw-r--r--tests/ui/consts/missing_span_in_backtrace.rs2
-rw-r--r--tests/ui/consts/missing_span_in_backtrace.stderr2
-rw-r--r--tests/ui/consts/offset_from_ub.stderr6
-rw-r--r--tests/ui/consts/offset_ub.rs2
-rw-r--r--tests/ui/consts/offset_ub.stderr8
-rw-r--r--tests/ui/consts/uninhabited-const-issue-61744.stderr2
-rw-r--r--tests/ui/coroutine/addassign-yield.rs (renamed from tests/ui/generator/addassign-yield.rs)2
-rw-r--r--tests/ui/coroutine/async-coroutine-issue-67158.rs6
-rw-r--r--tests/ui/coroutine/async-coroutine-issue-67158.stderr (renamed from tests/ui/generator/async-generator-issue-67158.stderr)4
-rw-r--r--tests/ui/coroutine/auto-trait-regions.rs (renamed from tests/ui/generator/auto-trait-regions.rs)6
-rw-r--r--tests/ui/coroutine/auto-trait-regions.stderr (renamed from tests/ui/generator/auto-trait-regions.stderr)0
-rw-r--r--tests/ui/coroutine/auxiliary/metadata-sufficient-for-layout.rs11
-rw-r--r--tests/ui/coroutine/auxiliary/unwind-aux.rs11
-rw-r--r--tests/ui/coroutine/auxiliary/xcrate-reachable.rs14
-rw-r--r--tests/ui/coroutine/auxiliary/xcrate.rs18
-rw-r--r--tests/ui/coroutine/borrow-in-tail-expr.rs (renamed from tests/ui/generator/borrow-in-tail-expr.rs)2
-rw-r--r--tests/ui/coroutine/borrowing.rs (renamed from tests/ui/generator/borrowing.rs)4
-rw-r--r--tests/ui/coroutine/borrowing.stderr (renamed from tests/ui/generator/borrowing.stderr)4
-rw-r--r--tests/ui/coroutine/clone-impl-async.rs (renamed from tests/ui/generator/clone-impl-async.rs)6
-rw-r--r--tests/ui/coroutine/clone-impl-async.stderr (renamed from tests/ui/generator/clone-impl-async.stderr)0
-rw-r--r--tests/ui/coroutine/clone-impl-static.rs (renamed from tests/ui/generator/clone-impl-static.rs)6
-rw-r--r--tests/ui/coroutine/clone-impl-static.stderr (renamed from tests/ui/generator/clone-impl-static.stderr)8
-rw-r--r--tests/ui/coroutine/clone-impl.rs (renamed from tests/ui/generator/clone-impl.rs)6
-rw-r--r--tests/ui/coroutine/clone-impl.stderr (renamed from tests/ui/generator/clone-impl.stderr)40
-rw-r--r--tests/ui/coroutine/conditional-drop.rs (renamed from tests/ui/generator/conditional-drop.rs)4
-rw-r--r--tests/ui/coroutine/control-flow.rs (renamed from tests/ui/generator/control-flow.rs)10
-rw-r--r--tests/ui/coroutine/coroutine-region-requirements.migrate.stderr (renamed from tests/ui/generator/generator-region-requirements.migrate.stderr)0
-rw-r--r--tests/ui/coroutine/coroutine-region-requirements.rs (renamed from tests/ui/generator/generator-region-requirements.rs)8
-rw-r--r--tests/ui/coroutine/coroutine-region-requirements.stderr (renamed from tests/ui/generator/generator-region-requirements.stderr)4
-rw-r--r--tests/ui/coroutine/coroutine-resume-after-panic.rs (renamed from tests/ui/generator/generator-resume-after-panic.rs)8
-rw-r--r--tests/ui/coroutine/coroutine-with-nll.rs (renamed from tests/ui/generator/generator-with-nll.rs)4
-rw-r--r--tests/ui/coroutine/coroutine-with-nll.stderr (renamed from tests/ui/generator/generator-with-nll.stderr)4
-rw-r--r--tests/ui/coroutine/coroutine-yielding-or-returning-itself.rs35
-rw-r--r--tests/ui/coroutine/coroutine-yielding-or-returning-itself.stderr (renamed from tests/ui/generator/generator-yielding-or-returning-itself.stderr)32
-rw-r--r--tests/ui/coroutine/derived-drop-parent-expr.rs (renamed from tests/ui/generator/derived-drop-parent-expr.rs)2
-rw-r--r--tests/ui/coroutine/discriminant.rs (renamed from tests/ui/generator/discriminant.rs)14
-rw-r--r--tests/ui/coroutine/drop-and-replace.rs (renamed from tests/ui/generator/drop-and-replace.rs)10
-rw-r--r--tests/ui/coroutine/drop-control-flow.rs (renamed from tests/ui/generator/drop-control-flow.rs)6
-rw-r--r--tests/ui/coroutine/drop-env.rs (renamed from tests/ui/generator/drop-env.rs)4
-rw-r--r--tests/ui/coroutine/drop-track-addassign-yield.rs (renamed from tests/ui/generator/drop-track-addassign-yield.rs)2
-rw-r--r--tests/ui/coroutine/drop-tracking-parent-expression.rs (renamed from tests/ui/generator/drop-tracking-parent-expression.rs)2
-rw-r--r--tests/ui/coroutine/drop-tracking-parent-expression.stderr (renamed from tests/ui/generator/drop-tracking-parent-expression.stderr)24
-rw-r--r--tests/ui/coroutine/drop-tracking-yielding-in-match-guards.rs (renamed from tests/ui/generator/drop-tracking-yielding-in-match-guards.rs)2
-rw-r--r--tests/ui/coroutine/drop-yield-twice.rs (renamed from tests/ui/generator/drop-yield-twice.rs)4
-rw-r--r--tests/ui/coroutine/drop-yield-twice.stderr (renamed from tests/ui/generator/drop-yield-twice.stderr)8
-rw-r--r--tests/ui/coroutine/dropck-resume.rs (renamed from tests/ui/generator/dropck-resume.rs)8
-rw-r--r--tests/ui/coroutine/dropck-resume.stderr (renamed from tests/ui/generator/dropck-resume.stderr)2
-rw-r--r--tests/ui/coroutine/dropck.rs (renamed from tests/ui/generator/dropck.rs)6
-rw-r--r--tests/ui/coroutine/dropck.stderr (renamed from tests/ui/generator/dropck.stderr)8
-rw-r--r--tests/ui/coroutine/gen_block.e2024.stderr19
-rw-r--r--tests/ui/coroutine/gen_block.none.stderr49
-rw-r--r--tests/ui/coroutine/gen_block.rs17
-rw-r--r--tests/ui/coroutine/gen_block_is_coro.rs18
-rw-r--r--tests/ui/coroutine/gen_block_is_coro.stderr21
-rw-r--r--tests/ui/coroutine/gen_block_is_iter.rs19
-rw-r--r--tests/ui/coroutine/gen_block_is_no_future.rs8
-rw-r--r--tests/ui/coroutine/gen_block_is_no_future.stderr12
-rw-r--r--tests/ui/coroutine/gen_block_iterate.rs35
-rw-r--r--tests/ui/coroutine/gen_block_move.fixed17
-rw-r--r--tests/ui/coroutine/gen_block_move.rs17
-rw-r--r--tests/ui/coroutine/gen_block_move.stderr30
-rw-r--r--tests/ui/coroutine/gen_block_panic.rs26
-rw-r--r--tests/ui/coroutine/gen_block_panic.stderr12
-rw-r--r--tests/ui/coroutine/gen_fn.e2024.stderr10
-rw-r--r--tests/ui/coroutine/gen_fn.none.stderr8
-rw-r--r--tests/ui/coroutine/gen_fn.rs8
-rw-r--r--tests/ui/coroutine/issue-102645.rs (renamed from tests/ui/generator/issue-102645.rs)4
-rw-r--r--tests/ui/coroutine/issue-102645.stderr (renamed from tests/ui/generator/issue-102645.stderr)2
-rw-r--r--tests/ui/coroutine/issue-105084.rs (renamed from tests/ui/generator/issue-105084.rs)12
-rw-r--r--tests/ui/coroutine/issue-105084.stderr (renamed from tests/ui/generator/issue-105084.stderr)10
-rw-r--r--tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs (renamed from tests/ui/generator/issue-110929-generator-conflict-error-ice.rs)2
-rw-r--r--tests/ui/coroutine/issue-113279.rs (renamed from tests/ui/generator/issue-113279.rs)6
-rw-r--r--tests/ui/coroutine/issue-113279.stderr (renamed from tests/ui/generator/issue-113279.stderr)0
-rw-r--r--tests/ui/coroutine/issue-44197.rs (renamed from tests/ui/generator/issue-44197.rs)12
-rw-r--r--tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr (renamed from tests/ui/generator/issue-45729-unsafe-in-generator.mir.stderr)2
-rw-r--r--tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs (renamed from tests/ui/generator/issue-45729-unsafe-in-generator.rs)2
-rw-r--r--tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr (renamed from tests/ui/generator/issue-45729-unsafe-in-generator.thir.stderr)2
-rw-r--r--tests/ui/coroutine/issue-48048.rs (renamed from tests/ui/generator/issue-48048.rs)4
-rw-r--r--tests/ui/coroutine/issue-48048.stderr (renamed from tests/ui/generator/issue-48048.stderr)2
-rw-r--r--tests/ui/coroutine/issue-52304.rs11
-rw-r--r--tests/ui/coroutine/issue-52398.rs (renamed from tests/ui/generator/issue-52398.rs)6
-rw-r--r--tests/ui/coroutine/issue-52398.stderr (renamed from tests/ui/generator/issue-52398.stderr)8
-rw-r--r--tests/ui/coroutine/issue-53548-1.rs (renamed from tests/ui/generator/issue-53548-1.rs)2
-rw-r--r--tests/ui/coroutine/issue-53548.rs (renamed from tests/ui/generator/issue-53548.rs)4
-rw-r--r--tests/ui/coroutine/issue-57017.rs (renamed from tests/ui/generator/issue-57017.rs)2
-rw-r--r--tests/ui/coroutine/issue-57084.rs (renamed from tests/ui/generator/issue-57084.rs)8
-rw-r--r--tests/ui/coroutine/issue-57084.stderr (renamed from tests/ui/generator/issue-57084.stderr)4
-rw-r--r--tests/ui/coroutine/issue-57478.rs (renamed from tests/ui/generator/issue-57478.rs)2
-rw-r--r--tests/ui/coroutine/issue-58888.rs (renamed from tests/ui/generator/issue-58888.rs)6
-rw-r--r--tests/ui/coroutine/issue-61442-stmt-expr-with-drop.rs (renamed from tests/ui/generator/issue-61442-stmt-expr-with-drop.rs)4
-rw-r--r--tests/ui/coroutine/issue-62506-two_awaits.rs (renamed from tests/ui/generator/issue-62506-two_awaits.rs)2
-rw-r--r--tests/ui/coroutine/issue-64620-yield-array-element.rs9
-rw-r--r--tests/ui/coroutine/issue-64620-yield-array-element.stderr (renamed from tests/ui/generator/issue-64620-yield-array-element.stderr)2
-rw-r--r--tests/ui/coroutine/issue-68112.rs (renamed from tests/ui/generator/issue-68112.rs)26
-rw-r--r--tests/ui/coroutine/issue-68112.stderr (renamed from tests/ui/generator/issue-68112.stderr)24
-rw-r--r--tests/ui/coroutine/issue-69017.rs (renamed from tests/ui/generator/issue-69017.rs)8
-rw-r--r--tests/ui/coroutine/issue-69039.rs (renamed from tests/ui/generator/issue-69039.rs)12
-rw-r--r--tests/ui/coroutine/issue-87142.rs32
-rw-r--r--tests/ui/coroutine/issue-88653.rs (renamed from tests/ui/generator/issue-88653.rs)12
-rw-r--r--tests/ui/coroutine/issue-88653.stderr (renamed from tests/ui/generator/issue-88653.stderr)8
-rw-r--r--tests/ui/coroutine/issue-91477.rs (renamed from tests/ui/generator/issue-91477.rs)2
-rw-r--r--tests/ui/coroutine/issue-91477.stderr (renamed from tests/ui/generator/issue-91477.stderr)2
-rw-r--r--tests/ui/coroutine/issue-93161.rs (renamed from tests/ui/generator/issue-93161.rs)0
-rw-r--r--tests/ui/coroutine/iterator-count.rs (renamed from tests/ui/generator/iterator-count.rs)14
-rw-r--r--tests/ui/coroutine/layout-error.rs (renamed from tests/ui/generator/layout-error.rs)2
-rw-r--r--tests/ui/coroutine/layout-error.stderr (renamed from tests/ui/generator/layout-error.stderr)0
-rw-r--r--tests/ui/coroutine/live-upvar-across-yield.rs (renamed from tests/ui/generator/live-upvar-across-yield.rs)4
-rw-r--r--tests/ui/coroutine/match-bindings.rs (renamed from tests/ui/generator/match-bindings.rs)4
-rw-r--r--tests/ui/coroutine/match-bindings.stderr (renamed from tests/ui/generator/match-bindings.stderr)4
-rw-r--r--tests/ui/coroutine/metadata-sufficient-for-layout.rs (renamed from tests/ui/generator/metadata-sufficient-for-layout.rs)10
-rw-r--r--tests/ui/coroutine/metadata-sufficient-for-layout.stderr (renamed from tests/ui/generator/metadata-sufficient-for-layout.stderr)0
-rw-r--r--tests/ui/coroutine/nested_coroutine.rs21
-rw-r--r--tests/ui/coroutine/niche-in-coroutine.rs (renamed from tests/ui/generator/niche-in-generator.rs)4
-rw-r--r--tests/ui/coroutine/non-static-is-unpin.rs (renamed from tests/ui/generator/non-static-is-unpin.rs)4
-rw-r--r--tests/ui/coroutine/not-send-sync.rs (renamed from tests/ui/generator/not-send-sync.rs)6
-rw-r--r--tests/ui/coroutine/not-send-sync.stderr (renamed from tests/ui/generator/not-send-sync.stderr)16
-rw-r--r--tests/ui/coroutine/overlap-locals.rs (renamed from tests/ui/generator/overlap-locals.rs)2
-rw-r--r--tests/ui/coroutine/panic-drops-resume.rs (renamed from tests/ui/generator/panic-drops-resume.rs)6
-rw-r--r--tests/ui/coroutine/panic-drops.rs (renamed from tests/ui/generator/panic-drops.rs)4
-rw-r--r--tests/ui/coroutine/panic-safe.rs (renamed from tests/ui/generator/panic-safe.rs)4
-rw-r--r--tests/ui/coroutine/parent-expression.rs (renamed from tests/ui/generator/parent-expression.rs)2
-rw-r--r--tests/ui/coroutine/parent-expression.stderr (renamed from tests/ui/generator/parent-expression.stderr)24
-rw-r--r--tests/ui/coroutine/partial-drop.rs (renamed from tests/ui/generator/partial-drop.rs)2
-rw-r--r--tests/ui/coroutine/partial-initialization-across-yield.rs (renamed from tests/ui/generator/partial-initialization-across-yield.rs)4
-rw-r--r--tests/ui/coroutine/partial-initialization-across-yield.stderr (renamed from tests/ui/generator/partial-initialization-across-yield.stderr)0
-rw-r--r--tests/ui/coroutine/pattern-borrow.rs (renamed from tests/ui/generator/pattern-borrow.rs)4
-rw-r--r--tests/ui/coroutine/pattern-borrow.stderr (renamed from tests/ui/generator/pattern-borrow.stderr)2
-rw-r--r--tests/ui/coroutine/pin-box-coroutine.rs13
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-1.rs (renamed from tests/ui/generator/print/generator-print-verbose-1.rs)24
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-1.stderr (renamed from tests/ui/generator/print/generator-print-verbose-1.stderr)42
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-2.rs (renamed from tests/ui/generator/print/generator-print-verbose-2.rs)8
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-2.stderr (renamed from tests/ui/generator/print/generator-print-verbose-2.stderr)24
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-3.rs (renamed from tests/ui/generator/print/generator-print-verbose-3.rs)4
-rw-r--r--tests/ui/coroutine/print/coroutine-print-verbose-3.stderr (renamed from tests/ui/generator/print/generator-print-verbose-3.stderr)8
-rw-r--r--tests/ui/coroutine/reborrow-mut-upvar.rs (renamed from tests/ui/generator/reborrow-mut-upvar.rs)4
-rw-r--r--tests/ui/coroutine/reborrow-mut-upvar.stderr (renamed from tests/ui/generator/reborrow-mut-upvar.stderr)4
-rw-r--r--tests/ui/coroutine/ref-escapes-but-not-over-yield.rs (renamed from tests/ui/generator/ref-escapes-but-not-over-yield.rs)6
-rw-r--r--tests/ui/coroutine/ref-escapes-but-not-over-yield.stderr (renamed from tests/ui/generator/ref-escapes-but-not-over-yield.stderr)8
-rw-r--r--tests/ui/coroutine/ref-upvar-not-send.rs (renamed from tests/ui/generator/ref-upvar-not-send.rs)12
-rw-r--r--tests/ui/coroutine/ref-upvar-not-send.stderr (renamed from tests/ui/generator/ref-upvar-not-send.stderr)10
-rw-r--r--tests/ui/coroutine/reinit-in-match-guard.rs (renamed from tests/ui/generator/reinit-in-match-guard.rs)2
-rw-r--r--tests/ui/coroutine/resume-after-return.rs (renamed from tests/ui/generator/resume-after-return.rs)8
-rw-r--r--tests/ui/coroutine/resume-arg-late-bound.rs (renamed from tests/ui/generator/resume-arg-late-bound.rs)8
-rw-r--r--tests/ui/coroutine/resume-arg-late-bound.stderr (renamed from tests/ui/generator/resume-arg-late-bound.stderr)6
-rw-r--r--tests/ui/coroutine/resume-arg-size.rs (renamed from tests/ui/generator/resume-arg-size.rs)8
-rw-r--r--tests/ui/coroutine/resume-live-across-yield.rs (renamed from tests/ui/generator/resume-live-across-yield.rs)8
-rw-r--r--tests/ui/coroutine/retain-resume-ref.rs (renamed from tests/ui/generator/retain-resume-ref.rs)6
-rw-r--r--tests/ui/coroutine/retain-resume-ref.stderr (renamed from tests/ui/generator/retain-resume-ref.stderr)0
-rw-r--r--tests/ui/coroutine/self_referential_gen_block.rs17
-rw-r--r--tests/ui/coroutine/self_referential_gen_block.stderr11
-rw-r--r--tests/ui/coroutine/size-moved-locals.rs (renamed from tests/ui/generator/size-moved-locals.rs)14
-rw-r--r--tests/ui/coroutine/sized-yield.rs14
-rw-r--r--tests/ui/coroutine/sized-yield.stderr26
-rw-r--r--tests/ui/coroutine/smoke-resume-args.rs (renamed from tests/ui/generator/smoke-resume-args.rs)10
-rw-r--r--tests/ui/coroutine/smoke.rs (renamed from tests/ui/generator/smoke.rs)32
-rw-r--r--tests/ui/coroutine/static-coroutine.rs20
-rw-r--r--tests/ui/coroutine/static-mut-reference-across-yield.rs (renamed from tests/ui/generator/static-mut-reference-across-yield.rs)2
-rw-r--r--tests/ui/coroutine/static-not-unpin.current.stderr (renamed from tests/ui/generator/static-not-unpin.current.stderr)6
-rw-r--r--tests/ui/coroutine/static-not-unpin.next.stderr (renamed from tests/ui/generator/static-not-unpin.next.stderr)6
-rw-r--r--tests/ui/coroutine/static-not-unpin.rs (renamed from tests/ui/generator/static-not-unpin.rs)6
-rw-r--r--tests/ui/coroutine/static-reference-across-yield.rs (renamed from tests/ui/generator/static-reference-across-yield.rs)2
-rw-r--r--tests/ui/coroutine/too-live-local-in-immovable-gen.rs (renamed from tests/ui/generator/too-live-local-in-immovable-gen.rs)8
-rw-r--r--tests/ui/coroutine/too-live-local-in-immovable-gen.stderr (renamed from tests/ui/generator/too-live-local-in-immovable-gen.stderr)6
-rw-r--r--tests/ui/coroutine/too-many-parameters.rs8
-rw-r--r--tests/ui/coroutine/too-many-parameters.stderr (renamed from tests/ui/generator/too-many-parameters.stderr)2
-rw-r--r--tests/ui/coroutine/type-mismatch-error.rs (renamed from tests/ui/generator/type-mismatch-error.rs)6
-rw-r--r--tests/ui/coroutine/type-mismatch-error.stderr (renamed from tests/ui/generator/type-mismatch-error.stderr)0
-rw-r--r--tests/ui/coroutine/type-mismatch-signature-deduction.rs (renamed from tests/ui/generator/type-mismatch-signature-deduction.rs)6
-rw-r--r--tests/ui/coroutine/type-mismatch-signature-deduction.stderr (renamed from tests/ui/generator/type-mismatch-signature-deduction.stderr)4
-rw-r--r--tests/ui/coroutine/unresolved-ct-var.rs (renamed from tests/ui/generator/unresolved-ct-var.rs)0
-rw-r--r--tests/ui/coroutine/unresolved-ct-var.stderr (renamed from tests/ui/generator/unresolved-ct-var.stderr)0
-rw-r--r--tests/ui/coroutine/unsized-capture-across-yield.rs (renamed from tests/ui/generator/unsized-capture-across-yield.rs)8
-rw-r--r--tests/ui/coroutine/unsized-capture-across-yield.stderr (renamed from tests/ui/generator/unsized-capture-across-yield.stderr)0
-rw-r--r--tests/ui/coroutine/unsized-local-across-yield.rs (renamed from tests/ui/generator/unsized-local-across-yield.rs)8
-rw-r--r--tests/ui/coroutine/unsized-local-across-yield.stderr (renamed from tests/ui/generator/unsized-local-across-yield.stderr)0
-rw-r--r--tests/ui/coroutine/unwind-abort-mix.rs13
-rw-r--r--tests/ui/coroutine/witness-ignore-fake-reads.rs (renamed from tests/ui/generator/witness-ignore-fake-reads.rs)0
-rw-r--r--tests/ui/coroutine/xcrate-reachable.rs (renamed from tests/ui/generator/xcrate-reachable.rs)4
-rw-r--r--tests/ui/coroutine/xcrate.rs (renamed from tests/ui/generator/xcrate.rs)10
-rw-r--r--tests/ui/coroutine/yield-in-args-rev.rs (renamed from tests/ui/generator/yield-in-args-rev.rs)4
-rw-r--r--tests/ui/coroutine/yield-in-args-rev.stderr (renamed from tests/ui/generator/yield-in-args-rev.stderr)4
-rw-r--r--tests/ui/coroutine/yield-in-args.rs (renamed from tests/ui/generator/yield-in-args.rs)2
-rw-r--r--tests/ui/coroutine/yield-in-args.stderr (renamed from tests/ui/generator/yield-in-args.stderr)2
-rw-r--r--tests/ui/coroutine/yield-in-const.rs (renamed from tests/ui/generator/yield-in-const.rs)2
-rw-r--r--tests/ui/coroutine/yield-in-const.stderr (renamed from tests/ui/generator/yield-in-const.stderr)2
-rw-r--r--tests/ui/coroutine/yield-in-function.rs (renamed from tests/ui/generator/yield-in-function.rs)2
-rw-r--r--tests/ui/coroutine/yield-in-function.stderr (renamed from tests/ui/generator/yield-in-function.stderr)2
-rw-r--r--tests/ui/coroutine/yield-in-initializer.rs (renamed from tests/ui/generator/yield-in-initializer.rs)4
-rw-r--r--tests/ui/coroutine/yield-in-initializer.stderr (renamed from tests/ui/generator/yield-in-initializer.stderr)4
-rw-r--r--tests/ui/coroutine/yield-in-static.rs (renamed from tests/ui/generator/yield-in-static.rs)2
-rw-r--r--tests/ui/coroutine/yield-in-static.stderr (renamed from tests/ui/generator/yield-in-static.stderr)2
-rw-r--r--tests/ui/coroutine/yield-outside-coroutine-issue-78653.rs (renamed from tests/ui/generator/yield-outside-generator-issue-78653.rs)4
-rw-r--r--tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr (renamed from tests/ui/generator/yield-outside-generator-issue-78653.stderr)6
-rw-r--r--tests/ui/coroutine/yield-subtype.rs (renamed from tests/ui/generator/yield-subtype.rs)4
-rw-r--r--tests/ui/coroutine/yield-subtype.stderr (renamed from tests/ui/generator/yield-subtype.stderr)4
-rw-r--r--tests/ui/coroutine/yield-while-iterating.rs (renamed from tests/ui/generator/yield-while-iterating.rs)6
-rw-r--r--tests/ui/coroutine/yield-while-iterating.stderr (renamed from tests/ui/generator/yield-while-iterating.stderr)4
-rw-r--r--tests/ui/coroutine/yield-while-local-borrowed.rs (renamed from tests/ui/generator/yield-while-local-borrowed.rs)16
-rw-r--r--tests/ui/coroutine/yield-while-local-borrowed.stderr (renamed from tests/ui/generator/yield-while-local-borrowed.stderr)12
-rw-r--r--tests/ui/coroutine/yield-while-ref-reborrowed.rs (renamed from tests/ui/generator/yield-while-ref-reborrowed.rs)8
-rw-r--r--tests/ui/coroutine/yield-while-ref-reborrowed.stderr (renamed from tests/ui/generator/yield-while-ref-reborrowed.stderr)4
-rw-r--r--tests/ui/coroutine/yielding-in-match-guards.rs (renamed from tests/ui/generator/yielding-in-match-guards.rs)2
-rw-r--r--tests/ui/crate-loading/invalid-rlib.rs1
-rw-r--r--tests/ui/crate-loading/invalid-rlib.stderr1
-rw-r--r--tests/ui/debuginfo/sroa-fragment-debuginfo.rs2
-rw-r--r--tests/ui/deduplicate-diagnostics.duplicate.stderr4
-rw-r--r--tests/ui/deprecation/deprecation-sanity.stderr10
-rw-r--r--tests/ui/deprecation/staged-deprecation-in-future.rs6
-rw-r--r--tests/ui/derives/deriving-bounds.stderr2
-rw-r--r--tests/ui/derives/deriving-meta-unknown-trait.stderr2
-rw-r--r--tests/ui/derives/deriving-primitive.stderr2
-rw-r--r--tests/ui/derives/deriving-with-repr-packed-move-errors.rs96
-rw-r--r--tests/ui/derives/deriving-with-repr-packed-move-errors.stderr174
-rw-r--r--tests/ui/derives/deriving-with-repr-packed.stderr1
-rw-r--r--tests/ui/derives/issue-36617.stderr40
-rw-r--r--tests/ui/deriving/deriving-all-codegen.stdout15
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs8
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr83
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs20
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr43
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs18
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr47
-rw-r--r--tests/ui/did_you_mean/auxiliary/doc-hidden-fields.rs6
-rw-r--r--tests/ui/did_you_mean/bad-assoc-ty.stderr2
-rw-r--r--tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs38
-rw-r--r--tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.stderr27
-rw-r--r--tests/ui/did_you_mean/dont-suggest-hygienic-fields.rs47
-rw-r--r--tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr50
-rw-r--r--tests/ui/did_you_mean/issue-105225-named-args.rs10
-rw-r--r--tests/ui/did_you_mean/issue-105225-named-args.stderr22
-rw-r--r--tests/ui/did_you_mean/issue-105225.fixed21
-rw-r--r--tests/ui/did_you_mean/issue-105225.rs21
-rw-r--r--tests/ui/did_you_mean/issue-105225.stderr72
-rw-r--r--tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs24
-rw-r--r--tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr19
-rw-r--r--tests/ui/drop/dynamic-drop.rs14
-rw-r--r--tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr4
-rw-r--r--tests/ui/error-codes/E0004.stderr6
-rw-r--r--tests/ui/error-codes/E0030-teach.stderr2
-rw-r--r--tests/ui/error-codes/E0030.stderr2
-rw-r--r--tests/ui/error-codes/E0034.stderr4
-rw-r--r--tests/ui/error-codes/E0191.stderr2
-rw-r--r--tests/ui/error-codes/E0220.stderr2
-rw-r--r--tests/ui/error-codes/E0221.stderr6
-rw-r--r--tests/ui/error-codes/E0223.stderr2
-rw-r--r--tests/ui/error-codes/E0282.rs2
-rw-r--r--tests/ui/error-codes/E0282.stderr6
-rw-r--r--tests/ui/error-codes/E0283.rs8
-rw-r--r--tests/ui/error-codes/E0283.stderr6
-rw-r--r--tests/ui/error-codes/E0311.fixed2
-rw-r--r--tests/ui/error-codes/E0311.stderr20
-rw-r--r--tests/ui/error-codes/E0374.stderr5
-rw-r--r--tests/ui/error-codes/E0377.stderr2
-rw-r--r--tests/ui/error-codes/E0396-fixed.stderr2
-rw-r--r--tests/ui/error-codes/E0396.rs2
-rw-r--r--tests/ui/error-codes/E0396.stderr24
-rw-r--r--tests/ui/error-codes/E0401.stderr14
-rw-r--r--tests/ui/error-codes/E0452.stderr6
-rw-r--r--tests/ui/error-codes/E0453.stderr2
-rw-r--r--tests/ui/error-codes/E0463.rs7
-rw-r--r--tests/ui/error-codes/E0463.stderr9
-rw-r--r--tests/ui/error-codes/E0476.stderr4
-rw-r--r--tests/ui/error-codes/E0583.stderr1
-rw-r--r--tests/ui/error-codes/E0602.stderr2
-rw-r--r--tests/ui/error-codes/E0719.stderr8
-rw-r--r--tests/ui/error-codes/E0789.stderr2
-rw-r--r--tests/ui/errors/remap-path-prefix-macro.normal.run.stdout1
-rw-r--r--tests/ui/errors/remap-path-prefix-macro.rs12
-rw-r--r--tests/ui/errors/remap-path-prefix-macro.with-macro-scope.run.stdout1
-rw-r--r--tests/ui/errors/remap-path-prefix-macro.without-macro-scope.run.stdout1
-rw-r--r--tests/ui/errors/remap-path-prefix.normal.stderr (renamed from tests/ui/errors/remap-path-prefix.stderr)2
-rw-r--r--tests/ui/errors/remap-path-prefix.rs3
-rw-r--r--tests/ui/errors/remap-path-prefix.with-diagnostic-scope.stderr9
-rw-r--r--tests/ui/errors/remap-path-prefix.without-diagnostic-scope.stderr9
-rw-r--r--tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.rs10
-rw-r--r--tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr27
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_fn_call.fixed10
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_fn_call.rs10
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_fn_call.stderr38
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_let_binding.rs6
-rw-r--r--tests/ui/expr/malformed_closure/missing_block_in_let_binding.stderr16
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.fixed9
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.rs9
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.stderr36
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.rs7
-rw-r--r--tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr25
-rw-r--r--tests/ui/extern/extern-wrong-value-type.rs2
-rw-r--r--tests/ui/extern/extern-wrong-value-type.stderr4
-rw-r--r--tests/ui/feature-gates/doc-rust-logo.rs5
-rw-r--r--tests/ui/feature-gates/doc-rust-logo.stderr12
-rw-r--r--tests/ui/feature-gates/feature-gate-associated_type_bounds.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr6
-rw-r--r--tests/ui/feature-gates/feature-gate-closure_track_caller.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-closure_track_caller.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr28
-rw-r--r--tests/ui/feature-gates/feature-gate-coroutines.none.stderr66
-rw-r--r--tests/ui/feature-gates/feature-gate-coroutines.rs18
-rw-r--r--tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr28
-rw-r--r--tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr9
-rw-r--r--tests/ui/feature-gates/feature-gate-gen_blocks.rs15
-rw-r--r--tests/ui/feature-gates/feature-gate-generators.rs10
-rw-r--r--tests/ui/feature-gates/feature-gate-generators.stderr37
-rw-r--r--tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-lint-reasons.stderr1
-rw-r--r--tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs18
-rw-r--r--tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr109
-rw-r--r--tests/ui/feature-gates/feature-gate-offset-of-enum.rs15
-rw-r--r--tests/ui/feature-gates/feature-gate-offset-of-enum.stderr37
-rw-r--r--tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs10
-rw-r--r--tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr18
-rw-r--r--tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs18
-rw-r--r--tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr30
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-staged_api.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-staged_api.stderr8
-rw-r--r--tests/ui/feature-gates/feature-gate-strict_provenance.stderr4
-rw-r--r--tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr2
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-bench.stderr6
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs6
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr96
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr6
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-test.stderr6
-rw-r--r--tests/ui/fn/fn-trait-formatting.rs2
-rw-r--r--tests/ui/fn/fn-trait-formatting.stderr4
-rw-r--r--tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr6
-rw-r--r--tests/ui/for/issue-20605.next.stderr12
-rw-r--r--tests/ui/generator/async-generator-issue-67158.rs6
-rw-r--r--tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs11
-rw-r--r--tests/ui/generator/auxiliary/xcrate-reachable.rs14
-rw-r--r--tests/ui/generator/auxiliary/xcrate.rs18
-rw-r--r--tests/ui/generator/generator-yielding-or-returning-itself.rs35
-rw-r--r--tests/ui/generator/issue-52304.rs11
-rw-r--r--tests/ui/generator/issue-64620-yield-array-element.rs9
-rw-r--r--tests/ui/generator/issue-87142.rs32
-rw-r--r--tests/ui/generator/nested_generators.rs21
-rw-r--r--tests/ui/generator/pin-box-generator.rs13
-rw-r--r--tests/ui/generator/sized-yield.rs14
-rw-r--r--tests/ui/generator/sized-yield.stderr26
-rw-r--r--tests/ui/generator/static-generators.rs20
-rw-r--r--tests/ui/generator/too-many-parameters.rs8
-rw-r--r--tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs18
-rw-r--r--tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr24
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-100013.rs8
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-100013.stderr8
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-91762.stderr5
-rw-r--r--tests/ui/generic-associated-types/gat-in-trait-path.base.stderr3
-rw-r--r--tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr1
-rw-r--r--tests/ui/generic-associated-types/higher-ranked-self-impl-requirement.rs20
-rw-r--r--tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs2
-rw-r--r--tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-68643-broken-mir.rs2
-rw-r--r--tests/ui/generic-associated-types/issue-68643-broken-mir.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-68644-codegen-selection.rs2
-rw-r--r--tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs2
-rw-r--r--tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-68648-2.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-68656-unsized-values.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-76535.base.stderr4
-rw-r--r--tests/ui/generic-associated-types/issue-79422.base.stderr6
-rw-r--r--tests/ui/generic-associated-types/issue-84931.rs3
-rw-r--r--tests/ui/generic-associated-types/issue-84931.stderr35
-rw-r--r--tests/ui/generic-associated-types/issue-86787.rs4
-rw-r--r--tests/ui/generic-associated-types/issue-86787.stderr21
-rw-r--r--tests/ui/generic-associated-types/issue-88360.stderr2
-rw-r--r--tests/ui/generic-associated-types/issue-91139.stderr2
-rw-r--r--tests/ui/generic-associated-types/missing-bounds.stderr6
-rw-r--r--tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs1
-rw-r--r--tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr34
-rw-r--r--tests/ui/generic-const-items/inference-failure.stderr2
-rw-r--r--tests/ui/generic-const-items/unsatisfied-bounds.stderr2
-rw-r--r--tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr1
-rw-r--r--tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr4
-rw-r--r--tests/ui/higher-ranked/trait-bounds/fn-ptr.rs2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr1
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr4
-rw-r--r--tests/ui/hygiene/panic-location.run.stderr2
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs25
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr18
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs32
-rw-r--r--tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr18
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs28
-rw-r--r--tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr13
-rw-r--r--tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr2
-rw-r--r--tests/ui/impl-trait/async_scope_creep.rs13
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.next.stderr (renamed from tests/ui/impl-trait/auto-trait.stderr)2
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.old.stderr12
-rw-r--r--tests/ui/impl-trait/auto-trait-coherence.rs (renamed from tests/ui/impl-trait/auto-trait.rs)3
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.rs2
-rw-r--r--tests/ui/impl-trait/auto-trait-leak.stderr68
-rw-r--r--tests/ui/impl-trait/bivariant-lifetime-liveness.rs15
-rw-r--r--tests/ui/impl-trait/bounds_regression.rs10
-rw-r--r--tests/ui/impl-trait/cross-return-site-inference.rs4
-rw-r--r--tests/ui/impl-trait/cross-return-site-inference.stderr27
-rw-r--r--tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr14
-rw-r--r--tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr14
-rw-r--r--tests/ui/impl-trait/erased-regions-in-hidden-ty.rs23
-rw-r--r--tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/async-and-ret-ref.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr14
-rw-r--r--tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match-works.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/deep-match.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-with-rpit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/default-body.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/default-method-constraint.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/doesnt-satisfy.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/early.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/encode.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr1
-rw-r--r--tests/ui/impl-trait/in-trait/gat-outlives.rs17
-rw-r--r--tests/ui/impl-trait/in-trait/gat-outlives.stderr24
-rw-r--r--tests/ui/impl-trait/in-trait/generics-mismatch.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/generics-mismatch.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102140.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102301.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/issue-102571.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/nested-rpitit.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety-sized.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/object-safety.stderr20
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-in-impl.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/opaque-variances.rs14
-rw-r--r--tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/refine.rs12
-rw-r--r--tests/ui/impl-trait/in-trait/refine.stderr14
-rw-r--r--tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/reveal.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/sibling-function-constraint.rs21
-rw-r--r--tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr17
-rw-r--r--tests/ui/impl-trait/in-trait/signature-mismatch.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-broken.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-broken.stderr10
-rw-r--r--tests/ui/impl-trait/in-trait/specialization-substs-remap.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/success.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.fixed5
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.rs5
-rw-r--r--tests/ui/impl-trait/in-trait/suggest-missing-item.stderr6
-rw-r--r--tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs3
-rw-r--r--tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/unconstrained-lt.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/variance.rs2
-rw-r--r--tests/ui/impl-trait/in-trait/variances-of-gat.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/wf-bounds.rs1
-rw-r--r--tests/ui/impl-trait/in-trait/wf-bounds.stderr12
-rw-r--r--tests/ui/impl-trait/in-trait/where-clause.rs1
-rw-r--r--tests/ui/impl-trait/issue-55872-2.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-54600.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-54600.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-54840.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-54840.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-58504.rs10
-rw-r--r--tests/ui/impl-trait/issues/issue-58504.stderr4
-rw-r--r--tests/ui/impl-trait/issues/issue-58956.rs4
-rw-r--r--tests/ui/impl-trait/issues/issue-58956.stderr4
-rw-r--r--tests/ui/impl-trait/issues/issue-62742.stderr5
-rw-r--r--tests/ui/impl-trait/issues/issue-70971.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-70971.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-79099.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-79099.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs4
-rw-r--r--tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr4
-rw-r--r--tests/ui/impl-trait/issues/issue-84073.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-84919.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-84919.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-86642.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-86642.stderr2
-rw-r--r--tests/ui/impl-trait/issues/issue-87295.rs2
-rw-r--r--tests/ui/impl-trait/issues/issue-87295.stderr2
-rw-r--r--tests/ui/impl-trait/lifetimes.rs4
-rw-r--r--tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr7
-rw-r--r--tests/ui/impl-trait/negative-reasoning.stderr2
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait2.stderr23
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.rs4
-rw-r--r--tests/ui/impl-trait/nested-return-type2-tait3.stderr25
-rw-r--r--tests/ui/impl-trait/nested_impl_trait.rs2
-rw-r--r--tests/ui/impl-trait/nested_impl_trait.stderr2
-rw-r--r--tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr6
-rw-r--r--tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr6
-rw-r--r--tests/ui/impl-trait/recursive-coroutine.rs (renamed from tests/ui/impl-trait/recursive-generator.rs)10
-rw-r--r--tests/ui/impl-trait/recursive-coroutine.stderr (renamed from tests/ui/impl-trait/recursive-generator.stderr)6
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs14
-rw-r--r--tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr16
-rw-r--r--tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs2
-rw-r--r--tests/ui/impl-trait/type_parameters_captured.stderr7
-rw-r--r--tests/ui/impl-trait/unactionable_diagnostic.fixed2
-rw-r--r--tests/ui/impl-trait/unactionable_diagnostic.rs2
-rw-r--r--tests/ui/impl-trait/unactionable_diagnostic.stderr5
-rw-r--r--tests/ui/impl-trait/universal-mismatched-type.stderr2
-rw-r--r--tests/ui/impl-trait/where-allowed-2.stderr6
-rw-r--r--tests/ui/impl-trait/where-allowed.rs79
-rw-r--r--tests/ui/impl-trait/where-allowed.stderr146
-rw-r--r--tests/ui/impl-unused-tps.rs5
-rw-r--r--tests/ui/impl-unused-tps.stderr37
-rw-r--r--tests/ui/implied-bounds/issue-100690.rs4
-rw-r--r--tests/ui/implied-bounds/issue-100690.stderr4
-rw-r--r--tests/ui/imports/ambiguous-9.stderr1
-rw-r--r--tests/ui/imports/issue-28134.stderr5
-rw-r--r--tests/ui/imports/issue-55457.stderr2
-rw-r--r--tests/ui/imports/issue-56125.stderr12
-rw-r--r--tests/ui/imports/pub-reexport-empty.rs25
-rw-r--r--tests/ui/imports/pub-reexport-empty.stderr20
-rw-r--r--tests/ui/imports/reexports.rs5
-rw-r--r--tests/ui/imports/reexports.stderr34
-rw-r--r--tests/ui/indexing/index-help.stderr3
-rw-r--r--tests/ui/indexing/indexing-requires-a-uint.stderr3
-rw-r--r--tests/ui/inference/cannot-infer-closure-circular.stderr3
-rw-r--r--tests/ui/inference/issue-104649.stderr2
-rw-r--r--tests/ui/inference/issue-107090.rs6
-rw-r--r--tests/ui/inference/issue-107090.stderr17
-rw-r--r--tests/ui/inference/issue-71584.rs1
-rw-r--r--tests/ui/inference/issue-71584.stderr2
-rw-r--r--tests/ui/inference/issue-72690.stderr16
-rw-r--r--tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.rs61
-rw-r--r--tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr98
-rw-r--r--tests/ui/inference/multiple-impl-apply.rs48
-rw-r--r--tests/ui/inference/multiple-impl-apply.stderr23
-rw-r--r--tests/ui/inference/need_type_info/concrete-impl.rs2
-rw-r--r--tests/ui/inference/need_type_info/concrete-impl.stderr11
-rw-r--r--tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr14
-rw-r--r--tests/ui/inference/question-mark-type-infer.stderr7
-rw-r--r--tests/ui/infinite/infinite-struct.stderr6
-rw-r--r--tests/ui/inline-const/expr-unsafe.thir.stderr3
-rw-r--r--tests/ui/inline-const/pat-unsafe-err.rs14
-rw-r--r--tests/ui/inline-const/pat-unsafe-err.thir.stderr19
-rw-r--r--tests/ui/inline-const/pat-unsafe.rs15
-rw-r--r--tests/ui/inline-const/pat-unsafe.thir.stderr20
-rw-r--r--tests/ui/instrument-coverage/bad-value.bad.stderr2
-rw-r--r--tests/ui/instrument-coverage/bad-value.blank.stderr2
-rw-r--r--tests/ui/instrument-coverage/bad-value.rs5
-rw-r--r--tests/ui/instrument-coverage/off-values.rs9
-rw-r--r--tests/ui/instrument-coverage/on-values.rs11
-rw-r--r--tests/ui/instrument-coverage/unstable.branch.stderr2
-rw-r--r--tests/ui/instrument-coverage/unstable.except-unused-functions.stderr2
-rw-r--r--tests/ui/instrument-coverage/unstable.except-unused-generics.stderr2
-rw-r--r--tests/ui/instrument-coverage/unstable.rs6
-rw-r--r--tests/ui/integral-indexing.stderr24
-rw-r--r--tests/ui/intrinsics/const-eval-select-bad.rs4
-rw-r--r--tests/ui/intrinsics/const-eval-select-bad.stderr8
-rw-r--r--tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr2
-rw-r--r--tests/ui/invalid-compile-flags/invalid-llvm-passes.rs (renamed from tests/ui/invalid/invalid-llvm-passes.rs)0
-rw-r--r--tests/ui/invalid-compile-flags/invalid-llvm-passes.stderr (renamed from tests/ui/invalid/invalid-llvm-passes.stderr)0
-rw-r--r--tests/ui/invalid-module-declaration/invalid-module-declaration.stderr1
-rw-r--r--tests/ui/invalid/invalid-plugin-attr.rs7
-rw-r--r--tests/ui/invalid/invalid-plugin-attr.stderr22
-rw-r--r--tests/ui/invalid_dispatch_from_dyn_impls.stderr24
-rw-r--r--tests/ui/issues/issue-12187-1.stderr4
-rw-r--r--tests/ui/issues/issue-12187-2.stderr4
-rw-r--r--tests/ui/issues/issue-12567.stderr12
-rw-r--r--tests/ui/issues/issue-16966.stderr13
-rw-r--r--tests/ui/issues/issue-17551.stderr2
-rw-r--r--tests/ui/issues/issue-19380.rs1
-rw-r--r--tests/ui/issues/issue-19380.stderr27
-rw-r--r--tests/ui/issues/issue-19482.rs2
-rw-r--r--tests/ui/issues/issue-19482.stderr2
-rw-r--r--tests/ui/issues/issue-20225.stderr6
-rw-r--r--tests/ui/issues/issue-21950.stderr2
-rw-r--r--tests/ui/issues/issue-22034.rs2
-rw-r--r--tests/ui/issues/issue-22034.stderr4
-rw-r--r--tests/ui/issues/issue-22434.rs2
-rw-r--r--tests/ui/issues/issue-22434.stderr2
-rw-r--r--tests/ui/issues/issue-23024.rs2
-rw-r--r--tests/ui/issues/issue-23024.stderr2
-rw-r--r--tests/ui/issues/issue-23966.stderr4
-rw-r--r--tests/ui/issues/issue-24036.stderr9
-rw-r--r--tests/ui/issues/issue-24446.rs2
-rw-r--r--tests/ui/issues/issue-24446.stderr49
-rw-r--r--tests/ui/issues/issue-28344.stderr4
-rw-r--r--tests/ui/issues/issue-33571.stderr1
-rw-r--r--tests/ui/issues/issue-34334.stderr3
-rw-r--r--tests/ui/issues/issue-37534.rs6
-rw-r--r--tests/ui/issues/issue-37534.stderr12
-rw-r--r--tests/ui/issues/issue-40000.stderr1
-rw-r--r--tests/ui/issues/issue-43355.stderr2
-rw-r--r--tests/ui/issues/issue-45801.stderr1
-rw-r--r--tests/ui/issues/issue-46101.stderr2
-rw-r--r--tests/ui/issues/issue-47715.rs8
-rw-r--r--tests/ui/issues/issue-47715.stderr8
-rw-r--r--tests/ui/issues/issue-51154.stderr2
-rw-r--r--tests/ui/issues/issue-53251.stderr1
-rw-r--r--tests/ui/issues/issue-59494.rs2
-rw-r--r--tests/ui/issues/issue-59494.stderr4
-rw-r--r--tests/ui/issues/issue-66667-function-cmp-cycle.stderr6
-rw-r--r--tests/ui/issues/issue-66923-show-error-for-correct-call.stderr6
-rw-r--r--tests/ui/issues/issue-69306.stderr12
-rw-r--r--tests/ui/issues/issue-77919.rs2
-rw-r--r--tests/ui/issues/issue-77919.stderr2
-rw-r--r--tests/ui/issues/issue-87199.rs6
-rw-r--r--tests/ui/issues/issue-87199.stderr18
-rw-r--r--tests/ui/iterators/collect-into-slice.stderr20
-rw-r--r--tests/ui/iterators/invalid-iterator-chain-fixable.fixed42
-rw-r--r--tests/ui/iterators/invalid-iterator-chain-fixable.rs42
-rw-r--r--tests/ui/iterators/invalid-iterator-chain-fixable.stderr157
-rw-r--r--tests/ui/iterators/invalid-iterator-chain.stderr32
-rw-r--r--tests/ui/lang-items/start_lang_item_args.main_ret.stderr2
-rw-r--r--tests/ui/lang-items/start_lang_item_args.missing_ret.stderr4
-rw-r--r--tests/ui/layout/cannot-transmute-unnormalizable-type.rs3
-rw-r--r--tests/ui/layout/cannot-transmute-unnormalizable-type.stderr14
-rw-r--r--tests/ui/layout/issue-84108.rs2
-rw-r--r--tests/ui/layout/issue-84108.stderr24
-rw-r--r--tests/ui/layout/too-big-with-padding.rs18
-rw-r--r--tests/ui/layout/too-big-with-padding.stderr8
-rw-r--r--tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs22
-rw-r--r--tests/ui/lifetimes/borrowck-let-suggestion.stderr4
-rw-r--r--tests/ui/lifetimes/issue-105675.stderr1
-rw-r--r--tests/ui/lifetimes/issue-26638.stderr4
-rw-r--r--tests/ui/lifetimes/issue-76168-hr-outlives-3.rs19
-rw-r--r--tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr51
-rw-r--r--tests/ui/lifetimes/issue-77175.rs2
-rw-r--r--tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr49
-rw-r--r--tests/ui/lifetimes/lifetime-errors/issue_74400.stderr7
-rw-r--r--tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed2
-rw-r--r--tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr20
-rw-r--r--tests/ui/limits/issue-55878.stderr1
-rw-r--r--tests/ui/linkage-attr/link-self-contained-consistency.many.stderr2
-rw-r--r--tests/ui/linkage-attr/link-self-contained-consistency.one.stderr2
-rw-r--r--tests/ui/linkage-attr/link-self-contained-consistency.rs10
-rw-r--r--tests/ui/linkage-attr/unstable-flavor.bpf.stderr2
-rw-r--r--tests/ui/linkage-attr/unstable-flavor.ptx.stderr2
-rw-r--r--tests/ui/linkage-attr/unstable-flavor.rs8
-rw-r--r--tests/ui/lint/bare-trait-objects-path.stderr2
-rw-r--r--tests/ui/lint/cli-unknown-force-warn.stderr2
-rw-r--r--tests/ui/lint/command-line-register-unknown-lint-tool.stderr1
-rw-r--r--tests/ui/lint/crate_level_only_lint.stderr12
-rw-r--r--tests/ui/lint/forbid-group-group-2.stderr8
-rw-r--r--tests/ui/lint/forbid-group-member.stderr2
-rw-r--r--tests/ui/lint/forbid-member-group.stderr2
-rw-r--r--tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr2
-rw-r--r--tests/ui/lint/force-warn/cap-lints-allow.stderr2
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr2
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr2
-rw-r--r--tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr2
-rw-r--r--tests/ui/lint/force-warn/warnings-lint-group.stderr2
-rw-r--r--tests/ui/lint/issue-80988.stderr2
-rw-r--r--tests/ui/lint/lint-forbid-attr.stderr2
-rw-r--r--tests/ui/lint/lint-forbid-cmdline.stderr1
-rw-r--r--tests/ui/lint/lint-malformed.stderr6
-rw-r--r--tests/ui/lint/lint-removed-cmdline-deny.stderr2
-rw-r--r--tests/ui/lint/lint-removed-cmdline.stderr2
-rw-r--r--tests/ui/lint/lint-renamed-cmdline-deny.stderr2
-rw-r--r--tests/ui/lint/lint-renamed-cmdline.stderr2
-rw-r--r--tests/ui/lint/lint-stability-deprecated.stderr6
-rw-r--r--tests/ui/lint/lint-type-overflow.stderr42
-rw-r--r--tests/ui/lint/lint-unexported-no-mangle.stderr4
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr4
-rw-r--r--tests/ui/lint/lint-unknown-lint-cmdline.stderr4
-rw-r--r--tests/ui/lint/lint-unnecessary-parens.fixed8
-rw-r--r--tests/ui/lint/lint-unnecessary-parens.rs8
-rw-r--r--tests/ui/lint/lint-unnecessary-parens.stderr74
-rw-r--r--tests/ui/lint/missing-copy-implementations-non-exhaustive.rs25
-rw-r--r--tests/ui/lint/must_not_suspend/gated.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/tuple-mismatch.rs4
-rw-r--r--tests/ui/lint/reasons-erroneous.rs28
-rw-r--r--tests/ui/lint/reasons-erroneous.stderr94
-rw-r--r--tests/ui/lint/reference_casting.rs8
-rw-r--r--tests/ui/lint/reference_casting.stderr60
-rw-r--r--tests/ui/lint/register-tool-lint.stderr1
-rw-r--r--tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs30
-rw-r--r--tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs8
-rw-r--r--tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr30
-rw-r--r--tests/ui/lint/unaligned_references.rs23
-rw-r--r--tests/ui/lint/unaligned_references.stderr52
-rw-r--r--tests/ui/lint/unused/issue-117284-arg-in-macro.rs17
-rw-r--r--tests/ui/lint/unused/issue-117284-arg-in-macro.stderr29
-rw-r--r--tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs6
-rw-r--r--tests/ui/lint/unused/lint-unused-imports.rs2
-rw-r--r--tests/ui/lint/unused/unused-closure.rs4
-rw-r--r--tests/ui/liveness/liveness-upvars.rs8
-rw-r--r--tests/ui/loops/loop-break-value.stderr2
-rw-r--r--tests/ui/lub-glb/old-lub-glb-object.stderr1
-rw-r--r--tests/ui/macros/assert-long-condition.rs9
-rw-r--r--tests/ui/macros/assert-long-condition.run.stderr4
-rw-r--r--tests/ui/macros/builtin-std-paths-fail.stderr8
-rw-r--r--tests/ui/macros/meta-item-absolute-path.stderr2
-rw-r--r--tests/ui/macros/stringify.rs1066
-rw-r--r--tests/ui/malformed/do-not-ice-on-note_and_explain.rs7
-rw-r--r--tests/ui/malformed/do-not-ice-on-note_and_explain.stderr79
-rw-r--r--tests/ui/malformed/malformed-plugin-1.rs5
-rw-r--r--tests/ui/malformed/malformed-plugin-1.stderr16
-rw-r--r--tests/ui/malformed/malformed-plugin-2.rs5
-rw-r--r--tests/ui/malformed/malformed-plugin-2.stderr16
-rw-r--r--tests/ui/malformed/malformed-plugin-3.rs5
-rw-r--r--tests/ui/malformed/malformed-plugin-3.stderr17
-rw-r--r--tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr7
-rw-r--r--tests/ui/match/match-range-fail-2.stderr6
-rw-r--r--tests/ui/match/match_non_exhaustive.stderr4
-rw-r--r--tests/ui/match/validate-range-endpoints.rs59
-rw-r--r--tests/ui/match/validate-range-endpoints.stderr84
-rw-r--r--tests/ui/methods/disambiguate-multiple-blanket-impl.rs38
-rw-r--r--tests/ui/methods/disambiguate-multiple-blanket-impl.stderr63
-rw-r--r--tests/ui/methods/disambiguate-multiple-impl.rs37
-rw-r--r--tests/ui/methods/disambiguate-multiple-impl.stderr63
-rw-r--r--tests/ui/methods/disambiguate-multiple-trait-2.rs54
-rw-r--r--tests/ui/methods/disambiguate-multiple-trait-2.stderr132
-rw-r--r--tests/ui/methods/disambiguate-multiple-trait.rs32
-rw-r--r--tests/ui/methods/disambiguate-multiple-trait.stderr63
-rw-r--r--tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr2
-rw-r--r--tests/ui/methods/method-ambig-two-traits-from-bounds.stderr8
-rw-r--r--tests/ui/methods/method-ambig-two-traits-from-impls2.stderr4
-rw-r--r--tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr4
-rw-r--r--tests/ui/mir/alignment/addrof_alignment.rs (renamed from tests/ui/mir/addrof_alignment.rs)3
-rw-r--r--tests/ui/mir/alignment/i686-pc-windows-msvc.rs (renamed from tests/ui/mir/mir_alignment_check_i686-pc-windows-msvc.rs)4
-rw-r--r--tests/ui/mir/alignment/misaligned_lhs.rs (renamed from tests/ui/mir/mir_alignment_check.rs)4
-rw-r--r--tests/ui/mir/alignment/misaligned_rhs.rs13
-rw-r--r--tests/ui/mir/alignment/packed.rs29
-rw-r--r--tests/ui/mir/alignment/place_computation.rs16
-rw-r--r--tests/ui/mir/alignment/place_without_read.rs9
-rw-r--r--tests/ui/mir/alignment/two_pointers.rs15
-rw-r--r--tests/ui/mir/build-async-error-body-correctly.rs8
-rw-r--r--tests/ui/mir/build-async-error-body-correctly.stderr17
-rw-r--r--tests/ui/mir/issue-71793-inline-args-storage.rs2
-rw-r--r--tests/ui/mir/mir_match_test.rs1
-rw-r--r--tests/ui/mir/remove-zsts-query-cycle.rs2
-rw-r--r--tests/ui/mismatched_types/async-unwrap-suggestion.rs22
-rw-r--r--tests/ui/mismatched_types/async-unwrap-suggestion.stderr25
-rw-r--r--tests/ui/mismatched_types/issue-19109.stderr2
-rw-r--r--tests/ui/mismatched_types/issue-35030.stderr2
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-dont-suggest.rs23
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-dont-suggest.stderr55
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-unwrap-expect.fixed31
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-unwrap-expect.rs31
-rw-r--r--tests/ui/mismatched_types/mismatch-ty-unwrap-expect.stderr93
-rw-r--r--tests/ui/mismatched_types/recovered-block.rs6
-rw-r--r--tests/ui/mismatched_types/recovered-block.stderr8
-rw-r--r--tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs4
-rw-r--r--tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr6
-rw-r--r--tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr1
-rw-r--r--tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr1
-rw-r--r--tests/ui/modules/special_module_name.stderr2
-rw-r--r--tests/ui/native-library-link-flags/modifiers-override.stderr2
-rw-r--r--tests/ui/never_type/never-from-impl-is-reserved.stderr2
-rw-r--r--tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr1
-rw-r--r--tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr1
-rw-r--r--tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr5
-rw-r--r--tests/ui/nll/coroutine-distinct-lifetime.rs (renamed from tests/ui/nll/generator-distinct-lifetime.rs)4
-rw-r--r--tests/ui/nll/coroutine-upvar-mutability.rs (renamed from tests/ui/nll/generator-upvar-mutability.rs)4
-rw-r--r--tests/ui/nll/coroutine-upvar-mutability.stderr (renamed from tests/ui/nll/generator-upvar-mutability.stderr)2
-rw-r--r--tests/ui/nll/extra-unused-mut.rs4
-rw-r--r--tests/ui/nll/issue-48623-coroutine.rs (renamed from tests/ui/nll/issue-48623-generator.rs)6
-rw-r--r--tests/ui/nll/issue-48623-coroutine.stderr (renamed from tests/ui/nll/issue-48623-generator.stderr)6
-rw-r--r--tests/ui/nll/issue-55850.rs10
-rw-r--r--tests/ui/nll/issue-55850.stderr2
-rw-r--r--tests/ui/nll/issue-97997.stderr1
-rw-r--r--tests/ui/nll/issue-98589-closures-relate-named-regions.stderr8
-rw-r--r--tests/ui/nll/issue-98693.stderr7
-rw-r--r--tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr10
-rw-r--r--tests/ui/nll/missing-universe-cause-issue-114907.stderr3
-rw-r--r--tests/ui/nll/move-errors.stderr2
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr36
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr36
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs33
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr40
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr40
-rw-r--r--tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs20
-rw-r--r--tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr2
-rw-r--r--tests/ui/nll/ty-outlives/impl-trait-outlives.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/projection-implied-bounds.stderr7
-rw-r--r--tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr22
-rw-r--r--tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr22
-rw-r--r--tests/ui/nll/ty-outlives/projection-one-region-closure.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr12
-rw-r--r--tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr6
-rw-r--r--tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr6
-rw-r--r--tests/ui/nll/ty-outlives/projection-where-clause-none.stderr5
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr4
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr10
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-fn-body.stderr4
-rw-r--r--tests/ui/nll/ty-outlives/ty-param-fn.stderr10
-rw-r--r--tests/ui/nll/type-check-pointer-comparisons.stderr4
-rw-r--r--tests/ui/nll/user-annotations/normalization-2.stderr2
-rw-r--r--tests/ui/nll/user-annotations/normalization-infer.stderr49
-rw-r--r--tests/ui/noexporttypeexe.stderr4
-rw-r--r--tests/ui/numbers-arithmetic/saturating-float-casts-wasm.stderr6
-rw-r--r--tests/ui/object-safety/assoc_type_bounds.rs4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds.stderr4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds2.rs4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds2.stderr4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_implicit_sized.fixed10
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_implicit_sized.rs10
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_implicit_sized.stderr20
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_others.rs4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_others.stderr4
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr2
-rw-r--r--tests/ui/object-safety/assoc_type_bounds_sized_used.stderr4
-rw-r--r--tests/ui/object-safety/issue-19538.stderr2
-rw-r--r--tests/ui/object-safety/object-safety-issue-22040.stderr1
-rw-r--r--tests/ui/object-safety/object-safety-no-static.curr.stderr1
-rw-r--r--tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr1
-rw-r--r--tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr8
-rw-r--r--tests/ui/offset-of/offset-of-enum.rs9
-rw-r--r--tests/ui/offset-of/offset-of-enum.stderr40
-rw-r--r--tests/ui/offset-of/offset-of-output-type.stderr2
-rw-r--r--tests/ui/offset-of/offset-of-private.rs13
-rw-r--r--tests/ui/offset-of/offset-of-private.stderr22
-rw-r--r--tests/ui/on-unimplemented/impl-substs.stderr3
-rw-r--r--tests/ui/on-unimplemented/on-impl.stderr3
-rw-r--r--tests/ui/on-unimplemented/slice-index.stderr3
-rw-r--r--tests/ui/or-patterns/exhaustiveness-pass.rs6
-rw-r--r--tests/ui/or-patterns/missing-bindings.stderr84
-rw-r--r--tests/ui/or-patterns/or-patterns-syntactic-fail.stderr8
-rw-r--r--tests/ui/packed/packed-struct-drop-aligned.rs8
-rw-r--r--tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs (renamed from tests/ui/parser/assoc-const-underscore-semantic-fail.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr (renamed from tests/ui/parser/assoc-const-underscore-semantic-fail.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs (renamed from tests/ui/parser/assoc-const-underscore-syntactic-pass.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-1.rs (renamed from tests/ui/parser/assoc-oddities-1.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-1.stderr (renamed from tests/ui/parser/assoc-oddities-1.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-2.rs (renamed from tests/ui/parser/assoc-oddities-2.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-oddities-2.stderr (renamed from tests/ui/parser/assoc-oddities-2.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-static-semantic-fail.rs (renamed from tests/ui/parser/assoc-static-semantic-fail.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-static-semantic-fail.stderr (renamed from tests/ui/parser/assoc-static-semantic-fail.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-static-syntactic-fail.rs (renamed from tests/ui/parser/assoc-static-syntactic-fail.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr (renamed from tests/ui/parser/assoc-static-syntactic-fail.stderr)0
-rw-r--r--tests/ui/parser/assoc/assoc-type-in-type-arg.rs (renamed from tests/ui/parser/assoc-type-in-type-arg.rs)0
-rw-r--r--tests/ui/parser/assoc/assoc-type-in-type-arg.stderr (renamed from tests/ui/parser/assoc-type-in-type-arg.stderr)0
-rw-r--r--tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs (renamed from tests/ui/parser/associated-types-project-from-hrtb-explicit.rs)0
-rw-r--r--tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr (renamed from tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-2.rs (renamed from tests/ui/parser/attr-bad-meta-2.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-2.stderr (renamed from tests/ui/parser/attr-bad-meta-2.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-3.rs (renamed from tests/ui/parser/attr-bad-meta-3.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-3.stderr (renamed from tests/ui/parser/attr-bad-meta-3.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta.rs (renamed from tests/ui/parser/attr-bad-meta.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta.stderr (renamed from tests/ui/parser/attr-bad-meta.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-before-eof.rs (renamed from tests/ui/parser/attr-before-eof.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-before-eof.stderr (renamed from tests/ui/parser/attr-before-eof.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-dangling-in-fn.rs (renamed from tests/ui/parser/attr-dangling-in-fn.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-dangling-in-fn.stderr (renamed from tests/ui/parser/attr-dangling-in-fn.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-dangling-in-mod.rs (renamed from tests/ui/parser/attr-dangling-in-mod.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-dangling-in-mod.stderr (renamed from tests/ui/parser/attr-dangling-in-mod.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr-stmt-expr-attr-bad.rs (renamed from tests/ui/parser/attr-stmt-expr-attr-bad.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr (renamed from tests/ui/parser/attr-stmt-expr-attr-bad.stderr)1
-rw-r--r--tests/ui/parser/attribute/attr-with-a-semicolon.rs (renamed from tests/ui/parser/attr-with-a-semicolon.rs)0
-rw-r--r--tests/ui/parser/attribute/attr-with-a-semicolon.stderr (renamed from tests/ui/parser/attr-with-a-semicolon.stderr)0
-rw-r--r--tests/ui/parser/attribute/attr.rs (renamed from tests/ui/parser/attr.rs)0
-rw-r--r--tests/ui/parser/attribute/attr.stderr (renamed from tests/ui/parser/attr.stderr)0
-rw-r--r--tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.rs (renamed from tests/ui/parser/attribute-with-no-generics-in-parameter-list.rs)0
-rw-r--r--tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.stderr (renamed from tests/ui/parser/attribute-with-no-generics-in-parameter-list.stderr)0
-rw-r--r--tests/ui/parser/attribute/attrs-after-extern-mod.rs (renamed from tests/ui/parser/attrs-after-extern-mod.rs)0
-rw-r--r--tests/ui/parser/attribute/attrs-after-extern-mod.stderr (renamed from tests/ui/parser/attrs-after-extern-mod.stderr)0
-rw-r--r--tests/ui/parser/break-in-unlabeled-block-in-macro.rs43
-rw-r--r--tests/ui/parser/break-in-unlabeled-block-in-macro.stderr69
-rw-r--r--tests/ui/parser/break-in-unlabeled-block.fixed11
-rw-r--r--tests/ui/parser/break-in-unlabeled-block.rs11
-rw-r--r--tests/ui/parser/break-in-unlabeled-block.stderr27
-rw-r--r--tests/ui/parser/deep-unmatched-angle-brackets.rs17
-rw-r--r--tests/ui/parser/deep-unmatched-angle-brackets.stderr13
-rw-r--r--tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs9
-rw-r--r--tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr18
-rw-r--r--tests/ui/parser/diff-markers/unclosed-delims.rs14
-rw-r--r--tests/ui/parser/diff-markers/unclosed-delims.stderr18
-rw-r--r--tests/ui/parser/doc-comment-in-stmt.fixed27
-rw-r--r--tests/ui/parser/doc-comment-in-stmt.rs11
-rw-r--r--tests/ui/parser/doc-comment-in-stmt.stderr45
-rw-r--r--tests/ui/parser/emoji-identifiers.stderr6
-rw-r--r--tests/ui/parser/fn-header-semantic-fail.rs10
-rw-r--r--tests/ui/parser/fn-header-semantic-fail.stderr77
-rw-r--r--tests/ui/parser/issue-116781.rs8
-rw-r--r--tests/ui/parser/issue-116781.stderr16
-rw-r--r--tests/ui/parser/issues/issue-100197-mut-let.fixed (renamed from tests/ui/parser/issue-100197-mut-let.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-100197-mut-let.rs (renamed from tests/ui/parser/issue-100197-mut-let.rs)0
-rw-r--r--tests/ui/parser/issues/issue-100197-mut-let.stderr (renamed from tests/ui/parser/issue-100197-mut-let.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-101477-enum.fixed (renamed from tests/ui/parser/issue-101477-enum.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-101477-enum.rs (renamed from tests/ui/parser/issue-101477-enum.rs)0
-rw-r--r--tests/ui/parser/issues/issue-101477-enum.stderr (renamed from tests/ui/parser/issue-101477-enum.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-101477-let.fixed (renamed from tests/ui/parser/issue-101477-let.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-101477-let.rs (renamed from tests/ui/parser/issue-101477-let.rs)0
-rw-r--r--tests/ui/parser/issues/issue-101477-let.stderr (renamed from tests/ui/parser/issue-101477-let.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-102806.rs (renamed from tests/ui/parser/issue-102806.rs)0
-rw-r--r--tests/ui/parser/issues/issue-102806.stderr (renamed from tests/ui/parser/issue-102806.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103143.rs (renamed from tests/ui/parser/issue-103143.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103143.stderr (renamed from tests/ui/parser/issue-103143.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103381.fixed (renamed from tests/ui/parser/issue-103381.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-103381.rs (renamed from tests/ui/parser/issue-103381.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103381.stderr (renamed from tests/ui/parser/issue-103381.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103425.rs (renamed from tests/ui/parser/issue-103425.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103425.stderr (renamed from tests/ui/parser/issue-103425.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103451.rs (renamed from tests/ui/parser/issue-103451.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103451.stderr (renamed from tests/ui/parser/issue-103451.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs (renamed from tests/ui/parser/issue-103748-ICE-wrong-braces.rs)0
-rw-r--r--tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr (renamed from tests/ui/parser/issue-103748-ICE-wrong-braces.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-104620.rs (renamed from tests/ui/parser/issue-104620.rs)0
-rw-r--r--tests/ui/parser/issues/issue-104620.stderr (renamed from tests/ui/parser/issue-104620.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec-2.rs (renamed from tests/ui/parser/issue-104867-inc-dec-2.rs)0
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec-2.stderr (renamed from tests/ui/parser/issue-104867-inc-dec-2.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec.rs (renamed from tests/ui/parser/issue-104867-inc-dec.rs)0
-rw-r--r--tests/ui/parser/issues/issue-104867-inc-dec.stderr (renamed from tests/ui/parser/issue-104867-inc-dec.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-105366.fixed (renamed from tests/ui/parser/issue-105366.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-105366.rs (renamed from tests/ui/parser/issue-105366.rs)0
-rw-r--r--tests/ui/parser/issues/issue-105366.stderr (renamed from tests/ui/parser/issue-105366.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-105634.rs (renamed from tests/ui/parser/issue-105634.rs)0
-rw-r--r--tests/ui/parser/issues/issue-107705.rs (renamed from tests/ui/parser/issue-107705.rs)0
-rw-r--r--tests/ui/parser/issues/issue-107705.stderr (renamed from tests/ui/parser/issue-107705.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-missing-params.fixed9
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-missing-params.rs9
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-missing-params.stderr14
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed8
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs8
-rw-r--r--tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr11
-rw-r--r--tests/ui/parser/issues/issue-108495-dec.rs (renamed from tests/ui/parser/issue-108495-dec.rs)0
-rw-r--r--tests/ui/parser/issues/issue-108495-dec.stderr (renamed from tests/ui/parser/issue-108495-dec.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-112188.fixed (renamed from tests/ui/parser/issue-112188.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-112188.rs (renamed from tests/ui/parser/issue-112188.rs)0
-rw-r--r--tests/ui/parser/issues/issue-112188.stderr (renamed from tests/ui/parser/issue-112188.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-113342.rs (renamed from tests/ui/parser/issue-113342.rs)0
-rw-r--r--tests/ui/parser/issues/issue-113342.stderr (renamed from tests/ui/parser/issue-113342.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-15980.rs3
-rw-r--r--tests/ui/parser/issues/issue-15980.stderr13
-rw-r--r--tests/ui/parser/issues/issue-17718-parse-const.rs (renamed from tests/ui/parser/issue-17718-parse-const.rs)0
-rw-r--r--tests/ui/parser/issues/issue-32505.rs1
-rw-r--r--tests/ui/parser/issues/issue-32505.stderr18
-rw-r--r--tests/ui/parser/issues/issue-39616.rs (renamed from tests/ui/parser/issue-39616.rs)0
-rw-r--r--tests/ui/parser/issues/issue-39616.stderr (renamed from tests/ui/parser/issue-39616.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-49257.rs (renamed from tests/ui/parser/issue-49257.rs)0
-rw-r--r--tests/ui/parser/issues/issue-49257.stderr (renamed from tests/ui/parser/issue-49257.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-52496.stderr9
-rw-r--r--tests/ui/parser/issues/issue-61858.rs (renamed from tests/ui/parser/issue-61858.rs)0
-rw-r--r--tests/ui/parser/issues/issue-61858.stderr (renamed from tests/ui/parser/issue-61858.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs (renamed from tests/ui/parser/issue-68091-unicode-ident-after-if.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr (renamed from tests/ui/parser/issue-68091-unicode-ident-after-if.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs (renamed from tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr (renamed from tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs (renamed from tests/ui/parser/issue-68987-unmatch-issue-1.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr (renamed from tests/ui/parser/issue-68987-unmatch-issue-1.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs (renamed from tests/ui/parser/issue-68987-unmatch-issue-2.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr (renamed from tests/ui/parser/issue-68987-unmatch-issue-2.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs (renamed from tests/ui/parser/issue-68987-unmatch-issue-3.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr (renamed from tests/ui/parser/issue-68987-unmatch-issue-3.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue.rs (renamed from tests/ui/parser/issue-68987-unmatch-issue.rs)0
-rw-r--r--tests/ui/parser/issues/issue-68987-unmatch-issue.stderr (renamed from tests/ui/parser/issue-68987-unmatch-issue.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-81804.rs (renamed from tests/ui/parser/issue-81804.rs)0
-rw-r--r--tests/ui/parser/issues/issue-81804.stderr (renamed from tests/ui/parser/issue-81804.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-81827.rs (renamed from tests/ui/parser/issue-81827.rs)0
-rw-r--r--tests/ui/parser/issues/issue-81827.stderr (renamed from tests/ui/parser/issue-81827.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-84117.stderr3
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs5
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr11
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs22
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr28
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs5
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr11
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs2
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs2
-rw-r--r--tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs2
-rw-r--r--tests/ui/parser/issues/issue-87694-duplicated-pub.rs (renamed from tests/ui/parser/issue-87694-duplicated-pub.rs)0
-rw-r--r--tests/ui/parser/issues/issue-87694-duplicated-pub.stderr (renamed from tests/ui/parser/issue-87694-duplicated-pub.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-87694-misplaced-pub.rs (renamed from tests/ui/parser/issue-87694-misplaced-pub.rs)0
-rw-r--r--tests/ui/parser/issues/issue-87694-misplaced-pub.stderr (renamed from tests/ui/parser/issue-87694-misplaced-pub.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-89396.fixed4
-rw-r--r--tests/ui/parser/issues/issue-89396.rs4
-rw-r--r--tests/ui/parser/issues/issue-89396.stderr4
-rw-r--r--tests/ui/parser/issues/issue-90728.rs (renamed from tests/ui/parser/issue-90728.rs)0
-rw-r--r--tests/ui/parser/issues/issue-90728.stderr (renamed from tests/ui/parser/issue-90728.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-91421.rs (renamed from tests/ui/parser/issue-91421.rs)0
-rw-r--r--tests/ui/parser/issues/issue-91421.stderr (renamed from tests/ui/parser/issue-91421.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed (renamed from tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs (renamed from tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.rs)0
-rw-r--r--tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr (renamed from tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.stderr)0
-rw-r--r--tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed (renamed from tests/ui/parser/issue-99910-const-let-mutually-exclusive.fixed)0
-rw-r--r--tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs (renamed from tests/ui/parser/issue-99910-const-let-mutually-exclusive.rs)0
-rw-r--r--tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr (renamed from tests/ui/parser/issue-99910-const-let-mutually-exclusive.stderr)0
-rw-r--r--tests/ui/parser/macro/macro-repeat.stderr2
-rw-r--r--tests/ui/parser/missing-fat-arrow.rs38
-rw-r--r--tests/ui/parser/missing-fat-arrow.stderr78
-rw-r--r--tests/ui/parser/mod_file_not_exist.stderr1
-rw-r--r--tests/ui/parser/mod_file_not_exist_windows.stderr1
-rw-r--r--tests/ui/parser/recover-missing-semi-before-item.fixed2
-rw-r--r--tests/ui/parser/recover-missing-semi-before-item.rs2
-rw-r--r--tests/ui/parser/recover-quantified-closure.stderr4
-rw-r--r--tests/ui/parser/removed-syntax-fn-sigil.rs3
-rw-r--r--tests/ui/parser/removed-syntax-fn-sigil.stderr14
-rw-r--r--tests/ui/parser/removed-syntax-with-2.stderr5
-rw-r--r--tests/ui/parser/semi-in-let-chain.rs27
-rw-r--r--tests/ui/parser/semi-in-let-chain.stderr50
-rw-r--r--tests/ui/parser/ternary_operator.rs59
-rw-r--r--tests/ui/parser/ternary_operator.stderr91
-rw-r--r--tests/ui/parser/unsafe-mod.stderr1
-rw-r--r--tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs6
-rw-r--r--tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr13
-rw-r--r--tests/ui/parser/variadic-ffi-semantic-restrictions.rs17
-rw-r--r--tests/ui/parser/variadic-ffi-semantic-restrictions.stderr103
-rw-r--r--tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr2
-rw-r--r--tests/ui/pattern/incorrect-placement-of-pattern-modifiers.fixed18
-rw-r--r--tests/ui/pattern/incorrect-placement-of-pattern-modifiers.rs18
-rw-r--r--tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr58
-rw-r--r--tests/ui/pattern/issue-115599.rs7
-rw-r--r--tests/ui/pattern/issue-115599.stderr11
-rw-r--r--tests/ui/pattern/issue-94866.stderr4
-rw-r--r--tests/ui/pattern/non-structural-match-types.mir.stderr14
-rw-r--r--tests/ui/pattern/non-structural-match-types.rs7
-rw-r--r--tests/ui/pattern/non-structural-match-types.stderr14
-rw-r--r--tests/ui/pattern/non-structural-match-types.thir.stderr14
-rw-r--r--tests/ui/pattern/patkind-litrange-no-expr.stderr2
-rw-r--r--tests/ui/pattern/slice-patterns-irrefutable.stderr3
-rw-r--r--tests/ui/pattern/usefulness/conflicting_bindings.rs24
-rw-r--r--tests/ui/pattern/usefulness/conflicting_bindings.stderr66
-rw-r--r--tests/ui/pattern/usefulness/consts-opaque.rs55
-rw-r--r--tests/ui/pattern/usefulness/consts-opaque.stderr184
-rw-r--r--tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr18
-rw-r--r--tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr94
-rw-r--r--tests/ui/pattern/usefulness/empty-match.normal.stderr94
-rw-r--r--tests/ui/pattern/usefulness/empty-match.rs18
-rw-r--r--tests/ui/pattern/usefulness/floats.rs40
-rw-r--r--tests/ui/pattern/usefulness/floats.stderr52
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs20
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr53
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr2
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr140
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs6
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs10
-rw-r--r--tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr18
-rw-r--r--tests/ui/pattern/usefulness/issue-35609.stderr3
-rw-r--r--tests/ui/pattern/usefulness/issue-39362.stderr6
-rw-r--r--tests/ui/pattern/usefulness/issue-40221.stderr6
-rw-r--r--tests/ui/pattern/usefulness/issue-56379.stderr10
-rw-r--r--tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs16
-rw-r--r--tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr68
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs18
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr54
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr4
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-match.stderr8
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs53
-rw-r--r--tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr75
-rw-r--r--tests/ui/pattern/usefulness/refutable-pattern-errors.rs4
-rw-r--r--tests/ui/pattern/usefulness/refutable-pattern-errors.stderr4
-rw-r--r--tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs2
-rw-r--r--tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr2
-rw-r--r--tests/ui/pattern/usefulness/slice_of_empty.rs22
-rw-r--r--tests/ui/pattern/usefulness/slice_of_empty.stderr39
-rw-r--r--tests/ui/pattern/usefulness/stable-gated-patterns.stderr6
-rw-r--r--tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr6
-rw-r--r--tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr10
-rw-r--r--tests/ui/pattern/usefulness/unstable-gated-patterns.stderr6
-rw-r--r--tests/ui/polymorphization/coroutine.rs (renamed from tests/ui/polymorphization/generators.rs)24
-rw-r--r--tests/ui/polymorphization/coroutine.stderr (renamed from tests/ui/polymorphization/generators.stderr)12
-rw-r--r--tests/ui/print_type_sizes/coroutine.rs (renamed from tests/ui/print_type_sizes/generator.rs)8
-rw-r--r--tests/ui/print_type_sizes/coroutine.stdout (renamed from tests/ui/print_type_sizes/generator.stdout)2
-rw-r--r--tests/ui/print_type_sizes/coroutine_discr_placement.rs (renamed from tests/ui/print_type_sizes/generator_discr_placement.rs)4
-rw-r--r--tests/ui/print_type_sizes/coroutine_discr_placement.stdout (renamed from tests/ui/print_type_sizes/generator_discr_placement.stdout)2
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.rs2
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.stderr4
-rw-r--r--tests/ui/privacy/effective_visibilities.stderr4
-rw-r--r--tests/ui/privacy/effective_visibilities_full_priv.stderr2
-rw-r--r--tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs4
-rw-r--r--tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr38
-rw-r--r--tests/ui/privacy/privacy1.stderr1
-rw-r--r--tests/ui/privacy/private-in-public-warn.stderr2
-rw-r--r--tests/ui/privacy/private-in-public.rs8
-rw-r--r--tests/ui/privacy/private-in-public.stderr22
-rw-r--r--tests/ui/privacy/private-variant-reexport.rs4
-rw-r--r--tests/ui/privacy/private-variant-reexport.stderr8
-rw-r--r--tests/ui/privacy/sealed-traits/sealed-trait-local.rs40
-rw-r--r--tests/ui/privacy/sealed-traits/sealed-trait-local.stderr44
-rw-r--r--tests/ui/privacy/suggest-box-new.fixed15
-rw-r--r--tests/ui/privacy/suggest-box-new.rs15
-rw-r--r--tests/ui/privacy/suggest-box-new.stderr20
-rw-r--r--tests/ui/privacy/where-priv-type.stderr7
-rw-r--r--tests/ui/privacy/where-pub-type-impls-priv-trait.stderr7
-rw-r--r--tests/ui/proc-macro/bad-projection.rs2
-rw-r--r--tests/ui/proc-macro/bad-projection.stderr30
-rw-r--r--tests/ui/proc-macro/issue-37788.stderr2
-rw-r--r--tests/ui/proc-macro/issue-75930-derive-cfg.rs30
-rw-r--r--tests/ui/proc-macro/issue-75930-derive-cfg.stderr5
-rw-r--r--tests/ui/proc-macro/issue-75930-derive-cfg.stdout768
-rw-r--r--tests/ui/proc-macro/macro-namespace-reserved-2.stderr1
-rw-r--r--tests/ui/proc-macro/pretty-print-hack-show.local.stderr6
-rw-r--r--tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr6
-rw-r--r--tests/ui/proc-macro/resolve-error.stderr8
-rw-r--r--tests/ui/proc-macro/resolved-located-at.stderr2
-rw-r--r--tests/ui/proc-macro/span-preservation.stderr8
-rw-r--r--tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr4
-rw-r--r--tests/ui/reachable/reachable-unnameable-type-alias.rs4
-rw-r--r--tests/ui/recursion_limit/empty.stderr2
-rw-r--r--tests/ui/recursion_limit/invalid_digit.stderr2
-rw-r--r--tests/ui/recursion_limit/overflow.stderr2
-rw-r--r--tests/ui/regions/closure-in-projection-issue-97405.rs2
-rw-r--r--tests/ui/regions/closure-in-projection-issue-97405.stderr12
-rw-r--r--tests/ui/regions/regions-close-associated-type-into-object.stderr40
-rw-r--r--tests/ui/regions/regions-close-object-into-object-4.stderr29
-rw-r--r--tests/ui/regions/regions-close-object-into-object-5.stderr29
-rw-r--r--tests/ui/regions/regions-close-over-type-parameter-1.stderr11
-rw-r--r--tests/ui/regions/regions-close-param-into-object.stderr24
-rw-r--r--tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr5
-rw-r--r--tests/ui/regions/regions-infer-bound-from-trait-self.stderr11
-rw-r--r--tests/ui/regions/regions-infer-bound-from-trait.stderr8
-rw-r--r--tests/ui/repr/16-bit-repr-c-enum.rs6
-rw-r--r--tests/ui/repr/repr-align-assign.stderr4
-rw-r--r--tests/ui/repr/repr-align.stderr12
-rw-r--r--tests/ui/resolve/fn-new-doesnt-exist.rs5
-rw-r--r--tests/ui/resolve/fn-new-doesnt-exist.stderr14
-rw-r--r--tests/ui/resolve/issue-116164.rs19
-rw-r--r--tests/ui/resolve/issue-116164.stderr14
-rw-r--r--tests/ui/resolve/issue-55673.fixed21
-rw-r--r--tests/ui/resolve/issue-55673.rs9
-rw-r--r--tests/ui/resolve/issue-55673.stderr24
-rw-r--r--tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs2
-rw-r--r--tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr31
-rw-r--r--tests/ui/resolve/issue-82865.stderr7
-rw-r--r--tests/ui/resolve/resolve-inconsistent-names.stderr42
-rw-r--r--tests/ui/return/return-impl-trait-bad.stderr8
-rw-r--r--tests/ui/return/return-impl-trait.stderr4
-rw-r--r--tests/ui/return/return-struct.stderr4
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs30
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr93
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs9
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr15
-rw-r--r--tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr1
-rw-r--r--tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs1
-rw-r--r--tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr20
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr75
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr31
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs53
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs85
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr125
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs8
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr12
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs40
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr7
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr13
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr8
-rw-r--r--tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr5
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs12
-rw-r--r--tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr21
-rw-r--r--tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr10
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs12
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs28
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr26
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs18
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs504
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr32
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs18
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr59
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs27
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr69
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs11
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs9
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr20
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr34
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr32
-rw-r--r--tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr1
-rw-r--r--tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr7
-rw-r--r--tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr2
-rw-r--r--tests/ui/rust-2018/edition-lint-nested-paths.stderr2
-rw-r--r--tests/ui/rust-2018/edition-lint-paths.stderr2
-rw-r--r--tests/ui/rust-2018/uniform-paths/cross-crate.stderr1
-rw-r--r--tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr2
-rw-r--r--tests/ui/sanitize/issue-111184-coroutine-witness.rs (renamed from tests/ui/sanitize/issue-111184-generator-witness.rs)2
-rw-r--r--tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr2
-rw-r--r--tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr2
-rw-r--r--tests/ui/self/arbitrary-self-from-method-substs.default.stderr13
-rw-r--r--tests/ui/self/arbitrary-self-from-method-substs.feature.stderr (renamed from tests/ui/self/arbitrary-self-from-method-substs.stderr)2
-rw-r--r--tests/ui/self/arbitrary-self-from-method-substs.rs8
-rw-r--r--tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr2
-rw-r--r--tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr1
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed3
-rw-r--r--tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr10
-rw-r--r--tests/ui/self/self-impl.stderr4
-rw-r--r--tests/ui/self/self_type_keyword.rs2
-rw-r--r--tests/ui/self/self_type_keyword.stderr27
-rw-r--r--tests/ui/simd/array-trait.rs1
-rw-r--r--tests/ui/simd/array-trait.stderr9
-rw-r--r--tests/ui/sized/unsized-binding.rs5
-rw-r--r--tests/ui/sized/unsized-binding.stderr13
-rw-r--r--tests/ui/span/issue-37767.stderr8
-rw-r--r--tests/ui/span/issue-39698.stderr34
-rw-r--r--tests/ui/span/issue-43927-non-ADT-derive.stderr8
-rw-r--r--tests/ui/span/lint-unused-unsafe-thir.rs61
-rw-r--r--tests/ui/span/lint-unused-unsafe-thir.stderr50
-rw-r--r--tests/ui/span/lint-unused-unsafe.mir.stderr376
-rw-r--r--tests/ui/span/lint-unused-unsafe.rs8
-rw-r--r--tests/ui/span/lint-unused-unsafe.thir.stderr1402
-rw-r--r--tests/ui/specialization/issue-52050.stderr10
-rw-r--r--tests/ui/specialization/min_specialization/issue-79224.rs1
-rw-r--r--tests/ui/specialization/min_specialization/issue-79224.stderr14
-rw-r--r--tests/ui/stability-attribute/stability-attribute-issue-43027.rs8
-rw-r--r--tests/ui/stability-attribute/stability-attribute-sanity-4.rs5
-rw-r--r--tests/ui/stability-attribute/stability-attribute-sanity-4.stderr13
-rw-r--r--tests/ui/stability-attribute/stability-attribute-sanity.rs33
-rw-r--r--tests/ui/stability-attribute/stability-attribute-sanity.stderr66
-rw-r--r--tests/ui/stability-attribute/stability-attribute-trait-impl.rs4
-rw-r--r--tests/ui/stability-attribute/stability-attribute-trait-impl.stderr2
-rw-r--r--tests/ui/str/str-idx.stderr9
-rw-r--r--tests/ui/str/str-mut-idx.stderr9
-rw-r--r--tests/ui/structs/method-chain-expression-failure.rs31
-rw-r--r--tests/ui/structs/method-chain-expression-failure.stderr15
-rw-r--r--tests/ui/structs/struct-path-associated-type.stderr6
-rw-r--r--tests/ui/suggestions/chain-method-call-mutation-in-place.stderr5
-rw-r--r--tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr2
-rw-r--r--tests/ui/suggestions/deref-path-method.stderr7
-rw-r--r--tests/ui/suggestions/dont-suggest-ref/simple.stderr8
-rw-r--r--tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr4
-rw-r--r--tests/ui/suggestions/impl-trait-missing-lifetime.stderr6
-rw-r--r--tests/ui/suggestions/issue-101623.stderr3
-rw-r--r--tests/ui/suggestions/issue-102972.fixed41
-rw-r--r--tests/ui/suggestions/issue-102972.rs25
-rw-r--r--tests/ui/suggestions/issue-102972.stderr56
-rw-r--r--tests/ui/suggestions/issue-104961.fixed4
-rw-r--r--tests/ui/suggestions/issue-104961.rs4
-rw-r--r--tests/ui/suggestions/issue-104961.stderr4
-rw-r--r--tests/ui/suggestions/issue-109291.stderr7
-rw-r--r--tests/ui/suggestions/issue-61963.stderr5
-rw-r--r--tests/ui/suggestions/issue-62843.stderr2
-rw-r--r--tests/ui/suggestions/issue-81839.stderr15
-rw-r--r--tests/ui/suggestions/issue-83892.stderr2
-rw-r--r--tests/ui/suggestions/issue-84973-blacklist.rs2
-rw-r--r--tests/ui/suggestions/issue-84973-blacklist.stderr4
-rw-r--r--tests/ui/suggestions/lifetimes/issue-105544.fixed14
-rw-r--r--tests/ui/suggestions/lifetimes/issue-105544.rs6
-rw-r--r--tests/ui/suggestions/lifetimes/issue-105544.stderr104
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed7
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs7
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr23
-rw-r--r--tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr99
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-bound-scope.fixed47
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-bound-scope.rs47
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-bound-scope.stderr71
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-missing-lifetime.fixed52
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-missing-lifetime.rs52
-rw-r--r--tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr66
-rw-r--r--tests/ui/suggestions/missing-lifetime-specifier.stderr8
-rw-r--r--tests/ui/suggestions/path-display.stderr2
-rw-r--r--tests/ui/suggestions/restrict-existing-type-bounds.stderr4
-rw-r--r--tests/ui/suggestions/return-closures.stderr4
-rw-r--r--tests/ui/suggestions/silenced-binding-typo.fixed5
-rw-r--r--tests/ui/suggestions/silenced-binding-typo.rs5
-rw-r--r--tests/ui/suggestions/silenced-binding-typo.stderr14
-rw-r--r--tests/ui/suggestions/slice-issue-87994.stderr8
-rw-r--r--tests/ui/suggestions/suggest-dereferencing-index.stderr3
-rw-r--r--tests/ui/suggestions/suggest-impl-trait-lifetime.fixed3
-rw-r--r--tests/ui/suggestions/suggest-impl-trait-lifetime.rs3
-rw-r--r--tests/ui/suggestions/suggest-impl-trait-lifetime.stderr7
-rw-r--r--tests/ui/suggestions/suggest-ret-on-async-w-late.fixed14
-rw-r--r--tests/ui/suggestions/suggest-ret-on-async-w-late.rs3
-rw-r--r--tests/ui/suggestions/suggest-ret-on-async-w-late.stderr4
-rw-r--r--tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr2
-rw-r--r--tests/ui/suggestions/trait-hidden-method.stderr2
-rw-r--r--tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr2
-rw-r--r--tests/ui/suggestions/unnamable-types.rs2
-rw-r--r--tests/ui/suggestions/unnamable-types.stderr2
-rw-r--r--tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/bad-value.bad.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/bad-value.blank.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/bad-value.no-value.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/bad-value.rs6
-rw-r--r--tests/ui/symbol-mangling-version/stable.rs5
-rw-r--r--tests/ui/symbol-mangling-version/unstable.legacy.stderr2
-rw-r--r--tests/ui/symbol-mangling-version/unstable.rs6
-rw-r--r--tests/ui/target-feature/gate.rs1
-rw-r--r--tests/ui/target-feature/gate.stderr2
-rw-r--r--tests/ui/target-feature/similar-feature-suggestion.stderr4
-rw-r--r--tests/ui/target-feature/unstable-feature.rs6
-rw-r--r--tests/ui/target-feature/unstable-feature.stderr6
-rw-r--r--tests/ui/thread-local/thread-local-static.mir.stderr (renamed from tests/ui/thread-local/thread-local-static.stderr)10
-rw-r--r--tests/ui/thread-local/thread-local-static.rs3
-rw-r--r--tests/ui/thread-local/thread-local-static.thir.stderr44
-rw-r--r--tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs2
-rw-r--r--tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr2
-rw-r--r--tests/ui/tool_lints.stderr1
-rw-r--r--tests/ui/trait-bounds/impl-bound-with-references-error.stderr7
-rw-r--r--tests/ui/trait-bounds/mismatch-fn-trait.stderr20
-rw-r--r--tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.fixed11
-rw-r--r--tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.rs11
-rw-r--r--tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr20
-rw-r--r--tests/ui/traits/alias/object-fail.stderr2
-rw-r--r--tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs43
-rw-r--r--tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr109
-rw-r--r--tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs2
-rw-r--r--tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr4
-rw-r--r--tests/ui/traits/associated_type_bound/impl-is-shadowed.rs21
-rw-r--r--tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs4
-rw-r--r--tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr4
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-static.rs2
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-static.stderr19
-rw-r--r--tests/ui/traits/coercion-generic-bad.stderr1
-rw-r--r--tests/ui/traits/copy-guessing.stderr2
-rw-r--r--tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs4
-rw-r--r--tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr16
-rw-r--r--tests/ui/traits/issue-33140-hack-boundaries.stderr2
-rw-r--r--tests/ui/traits/issue-38404.stderr1
-rw-r--r--tests/ui/traits/issue-38604.stderr2
-rw-r--r--tests/ui/traits/issue-52893.stderr2
-rw-r--r--tests/ui/traits/issue-59029-1.stderr6
-rw-r--r--tests/ui/traits/issue-77982.rs1
-rw-r--r--tests/ui/traits/issue-77982.stderr32
-rw-r--r--tests/ui/traits/item-privacy.stderr26
-rw-r--r--tests/ui/traits/multidispatch-convert-ambig-dest.rs1
-rw-r--r--tests/ui/traits/multidispatch-convert-ambig-dest.stderr16
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.rs1
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.stderr40
-rw-r--r--tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr11
-rw-r--r--tests/ui/traits/new-solver/coherence/issue-102048.stderr12
-rw-r--r--tests/ui/traits/new-solver/coroutine.fail.stderr64
-rw-r--r--tests/ui/traits/new-solver/coroutine.rs32
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs3
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr11
-rw-r--r--tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs10
-rw-r--r--tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr2
-rw-r--r--tests/ui/traits/new-solver/fn-trait.rs8
-rw-r--r--tests/ui/traits/new-solver/fn-trait.stderr14
-rw-r--r--tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr15
-rw-r--r--tests/ui/traits/new-solver/generator.fail.stderr64
-rw-r--r--tests/ui/traits/new-solver/generator.rs32
-rw-r--r--tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs9
-rw-r--r--tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr14
-rw-r--r--tests/ui/traits/new-solver/object-unsafety.stderr2
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs3
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr11
-rw-r--r--tests/ui/traits/new-solver/specialization-transmute.rs2
-rw-r--r--tests/ui/traits/new-solver/specialization-transmute.stderr11
-rw-r--r--tests/ui/traits/new-solver/specialization-unconstrained.stderr12
-rw-r--r--tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr11
-rw-r--r--tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr11
-rw-r--r--tests/ui/traits/non-lifetime-via-dyn-builtin.rs16
-rw-r--r--tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr12
-rw-r--r--tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs19
-rw-r--r--tests/ui/traits/non_lifetime_binders/on-rpit.rs16
-rw-r--r--tests/ui/traits/non_lifetime_binders/on-rpit.stderr11
-rw-r--r--tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr3
-rw-r--r--tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs4
-rw-r--r--tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr16
-rw-r--r--tests/ui/traits/object/object-unsafe-missing-assoc-type.rs7
-rw-r--r--tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr18
-rw-r--r--tests/ui/traits/object/print_vtable_sizes.stdout22
-rw-r--r--tests/ui/traits/object/safety.stderr2
-rw-r--r--tests/ui/traits/object/with-self-in-projection-output-bad.rs4
-rw-r--r--tests/ui/traits/object/with-self-in-projection-output-bad.stderr4
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.fixed2
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.rs2
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.stderr4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.stderr16
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr32
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr36
-rw-r--r--tests/ui/traits/test-2.stderr9
-rw-r--r--tests/ui/try-block/try-block-bad-type.stderr1
-rw-r--r--tests/ui/try-trait/bad-interconversion.stderr9
-rw-r--r--tests/ui/tuple/tuple-struct-fields/test2.stderr2
-rw-r--r--tests/ui/tuple/tuple-struct-fields/test3.stderr2
-rw-r--r--tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr12
-rw-r--r--tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr1
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr48
-rw-r--r--tests/ui/type-alias-impl-trait/closure_parent_substs.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs13
-rw-r--r--tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait2.rs15
-rw-r--r--tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained.stderr23
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained2.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr48
-rw-r--r--tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/inference-cycle.rs7
-rw-r--r--tests/ui/type-alias-impl-trait/inference-cycle.stderr50
-rw-r--r--tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs8
-rw-r--r--tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs22
-rw-r--r--tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs22
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs39
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs39
-rw-r--r--tests/ui/type-alias-impl-trait/issue-58662-simplified.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63279.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/issue-63279.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/issue-94429.rs12
-rw-r--r--tests/ui/type-alias-impl-trait/issue-94429.stderr6
-rw-r--r--tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs27
-rw-r--r--tests/ui/type-alias-impl-trait/nested_impl_trait_in_assoc_ty.rs44
-rw-r--r--tests/ui/type-alias-impl-trait/not_well_formed.fixed19
-rw-r--r--tests/ui/type-alias-impl-trait/not_well_formed.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/not_well_formed.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-fn-tait.rs17
-rw-r--r--tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/reveal_local.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/reveal_local.stderr73
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr2
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs14
-rw-r--r--tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr17
-rw-r--r--tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/wf-nested.fail.stderr7
-rw-r--r--tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr7
-rw-r--r--tests/ui/type-inference/sort_by_key.stderr11
-rw-r--r--tests/ui/type/type-check/cannot_infer_local_or_vec.stderr2
-rw-r--r--tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs6
-rw-r--r--tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.stderr15
-rw-r--r--tests/ui/type/type-check/point-at-inference-issue-116155.rs17
-rw-r--r--tests/ui/type/type-check/point-at-inference-issue-116155.stderr18
-rw-r--r--tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr1
-rw-r--r--tests/ui/typeck/bad-index-due-to-nested.stderr4
-rw-r--r--tests/ui/typeck/escaping_bound_vars.rs16
-rw-r--r--tests/ui/typeck/escaping_bound_vars.stderr10
-rw-r--r--tests/ui/typeck/issue-104513-ice.rs2
-rw-r--r--tests/ui/typeck/issue-104513-ice.stderr2
-rw-r--r--tests/ui/typeck/issue-107087.stderr2
-rw-r--r--tests/ui/typeck/issue-110052.stderr2
-rw-r--r--tests/ui/typeck/issue-114529-illegal-break-with-value.rs20
-rw-r--r--tests/ui/typeck/issue-114529-illegal-break-with-value.stderr29
-rw-r--r--tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs2
-rw-r--r--tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr8
-rw-r--r--tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs96
-rw-r--r--tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr237
-rw-r--r--tests/ui/typeck/issue-13853.stderr2
-rw-r--r--tests/ui/typeck/issue-36708.stderr7
-rw-r--r--tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr2
-rw-r--r--tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr2
-rw-r--r--tests/ui/typeck/issue-91267.stderr2
-rw-r--r--tests/ui/typeck/issue-91334.rs2
-rw-r--r--tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr4
-rw-r--r--tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr2
-rw-r--r--tests/ui/ufcs/ufcs-explicit-self-bad.rs1
-rw-r--r--tests/ui/ufcs/ufcs-explicit-self-bad.stderr31
-rw-r--r--tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs2
-rw-r--r--tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr2
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr4
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.rs23
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr44
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs32
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr123
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr6
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr12
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr6
-rw-r--r--tests/ui/uninhabited/diverging-guard.rs10
-rw-r--r--tests/ui/union/issue-81199.rs1
-rw-r--r--tests/ui/union/issue-81199.stderr19
-rw-r--r--tests/ui/union/union-unsafe.mir.stderr28
-rw-r--r--tests/ui/union/union-unsafe.rs14
-rw-r--r--tests/ui/union/union-unsafe.thir.stderr30
-rw-r--r--tests/ui/union/union-unsized.mirunsafeck.stderr31
-rw-r--r--tests/ui/union/union-unsized.rs2
-rw-r--r--tests/ui/union/union-unsized.thirunsafeck.stderr31
-rw-r--r--tests/ui/unknown-lint-tool-name.stderr2
-rw-r--r--tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr2
-rw-r--r--tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr2
-rw-r--r--tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr2
-rw-r--r--tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr2
-rw-r--r--tests/ui/unresolved/auxiliary/library.rs1
-rw-r--r--tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.rs31
-rw-r--r--tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr25
-rw-r--r--tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.fixed19
-rw-r--r--tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.rs19
-rw-r--r--tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr14
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr (renamed from tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr)4
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs10
-rw-r--r--tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr16
-rw-r--r--tests/ui/unsafe/initializing-ranged-via-ctor.stderr2
-rw-r--r--tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr6
-rw-r--r--tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr10
-rw-r--r--tests/ui/unsafe/ranged_ints2.rs1
-rw-r--r--tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr10
-rw-r--r--tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr16
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed (renamed from tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed)19
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr (renamed from tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr)26
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.rs19
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed73
-rw-r--r--tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr99
-rw-r--r--tests/ui/unsized/maybe-bounds-where.rs4
-rw-r--r--tests/ui/unsized/maybe-bounds-where.stderr16
-rw-r--r--tests/ui/unsized/unsize-coerce-multiple-adt-params.rs29
-rw-r--r--tests/ui/unsized/unsized-trait-impl-self-type.rs1
-rw-r--r--tests/ui/unsized/unsized-trait-impl-self-type.stderr14
-rw-r--r--tests/ui/unsized/unsized-trait-impl-trait-arg.rs1
-rw-r--r--tests/ui/unsized/unsized-trait-impl-trait-arg.stderr14
-rw-r--r--tests/ui/unsized/unsized7.rs1
-rw-r--r--tests/ui/unsized/unsized7.stderr14
-rw-r--r--tests/ui/use/use-super-global-path.stderr2
-rw-r--r--tests/ui/weird-exprs.rs2
-rw-r--r--tests/ui/wf/hir-wf-check-erase-regions.rs1
-rw-r--r--tests/ui/wf/hir-wf-check-erase-regions.stderr16
-rw-r--r--tests/ui/wf/issue-110157.rs1
-rw-r--r--tests/ui/wf/issue-110157.stderr25
-rw-r--r--tests/ui/wf/unnormalized-projection-guides-inference.rs24
-rw-r--r--tests/ui/wf/wf-const-type.rs1
-rw-r--r--tests/ui/wf/wf-const-type.stderr20
-rw-r--r--tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr3
-rw-r--r--tests/ui/wf/wf-convert-unsafe-trait-obj.stderr3
-rw-r--r--tests/ui/wf/wf-fn-where-clause.stderr18
-rw-r--r--tests/ui/wf/wf-impl-associated-type-region.stderr4
-rw-r--r--tests/ui/wf/wf-in-fn-type-static.stderr14
-rw-r--r--tests/ui/wf/wf-in-obj-type-static.stderr7
-rw-r--r--tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr8
-rw-r--r--tests/ui/wf/wf-static-type.rs1
-rw-r--r--tests/ui/wf/wf-static-type.stderr20
-rw-r--r--tests/ui/wf/wf-trait-associated-type-region.stderr11
-rw-r--r--tests/ui/wf/wf-unsafe-trait-obj-match.stderr10
3287 files changed, 37441 insertions, 19211 deletions
diff --git a/tests/assembly/asm/arm-types.rs b/tests/assembly/asm/arm-types.rs
index b22a26ce3..9520f9327 100644
--- a/tests/assembly/asm/arm-types.rs
+++ b/tests/assembly/asm/arm-types.rs
@@ -1,6 +1,7 @@
// assembly-output: emit-asm
// compile-flags: --target armv7-unknown-linux-gnueabihf
// compile-flags: -C target-feature=+neon
+// compile-flags: -C opt-level=0
// needs-llvm-components: arm
#![feature(no_core, lang_items, rustc_attrs, repr_simd)]
diff --git a/tests/assembly/closure-inherit-target-feature.rs b/tests/assembly/closure-inherit-target-feature.rs
index 65728a155..7acda76e2 100644
--- a/tests/assembly/closure-inherit-target-feature.rs
+++ b/tests/assembly/closure-inherit-target-feature.rs
@@ -1,4 +1,5 @@
// only-x86_64
+// ignore-sgx Tests incompatible with LVI mitigations
// assembly-output: emit-asm
// make sure the feature is not enabled at compile-time
// compile-flags: -C opt-level=3 -C target-feature=-sse4.1 -C llvm-args=-x86-asm-syntax=intel
@@ -22,6 +23,7 @@ pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128) -> __m128 {
f(x, y)
}
+#[no_mangle]
#[target_feature(enable = "sse4.1")]
pub fn sse41_blend_noinline(x: __m128, y: __m128) -> __m128 {
let f = {
diff --git a/tests/assembly/dwarf5.rs b/tests/assembly/dwarf5.rs
index f41e6bd55..253baafb8 100644
--- a/tests/assembly/dwarf5.rs
+++ b/tests/assembly/dwarf5.rs
@@ -1,6 +1,6 @@
// Makes sure that `-Z dwarf-version=5` causes `rustc` to emit DWARF version 5.
// assembly-output: emit-asm
-// compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=5
+// compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=5 -Copt-level=0
// needs-llvm-components: x86
#![feature(no_core, lang_items)]
diff --git a/tests/assembly/libs/issue-115339-zip-arrays.rs b/tests/assembly/libs/issue-115339-zip-arrays.rs
new file mode 100644
index 000000000..26b7b9770
--- /dev/null
+++ b/tests/assembly/libs/issue-115339-zip-arrays.rs
@@ -0,0 +1,25 @@
+// assembly-output: emit-asm
+// # zen3 previously exhibited odd vectorization
+// compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -O
+// only-x86_64
+// ignore-sgx
+
+use std::iter;
+
+// previously this produced a long chain of
+// 56: vpextrb $6, %xmm0, %ecx
+// 57: orb %cl, 22(%rsi)
+// 58: vpextrb $7, %xmm0, %ecx
+// 59: orb %cl, 23(%rsi)
+// [...]
+
+// CHECK-LABEL: zip_arrays:
+#[no_mangle]
+pub fn zip_arrays(mut a: [u8; 32], b: [u8; 32]) -> [u8; 32] {
+ // CHECK-NOT: vpextrb
+ // CHECK-NOT: orb %cl
+ // CHECK: vorps
+ iter::zip(&mut a, b).for_each(|(a, b)| *a |= b);
+ // CHECK: retq
+ a
+}
diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs b/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs
new file mode 100644
index 000000000..fca2c85d5
--- /dev/null
+++ b/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs
@@ -0,0 +1,406 @@
+// revisions: all strong basic none missing
+// assembly-output: emit-asm
+// only-windows
+// only-msvc
+// ignore-64bit 64-bit table based SEH has slightly different behaviors than classic SEH
+// [all] compile-flags: -Z stack-protector=all
+// [strong] compile-flags: -Z stack-protector=strong
+// [basic] compile-flags: -Z stack-protector=basic
+// [none] compile-flags: -Z stack-protector=none
+// compile-flags: -C opt-level=2 -Z merge-functions=disabled
+
+#![crate_type = "lib"]
+
+#![allow(incomplete_features)]
+
+#![feature(unsized_locals, unsized_fn_params)]
+
+
+// CHECK-LABEL: emptyfn:
+#[no_mangle]
+pub fn emptyfn() {
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: array_char
+#[no_mangle]
+pub fn array_char(f: fn(*const char)) {
+ let a = ['c'; 1];
+ let b = ['d'; 3];
+ let c = ['e'; 15];
+
+ f(&a as *const _);
+ f(&b as *const _);
+ f(&c as *const _);
+
+ // Any type of local array variable leads to stack protection with the
+ // "strong" heuristic. The 'basic' heuristic only adds stack protection to
+ // functions with local array variables of a byte-sized type, however. Since
+ // 'char' is 4 bytes in Rust, this function is not protected by the 'basic'
+ // heuristic
+ //
+ // (This test *also* takes the address of the local stack variables. We
+ // cannot know that this isn't what triggers the `strong` heuristic.
+ // However, the test strategy of passing the address of a stack array to an
+ // external function is sufficient to trigger the `basic` heuristic (see
+ // test `array_u8_large()`). Since the `basic` heuristic only checks for the
+ // presence of stack-local array variables, we can be confident that this
+ // test also captures this part of the `strong` heuristic specification.)
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: array_u8_1
+#[no_mangle]
+pub fn array_u8_1(f: fn(*const u8)) {
+ let a = [0u8; 1];
+ f(&a as *const _);
+
+ // The 'strong' heuristic adds stack protection to functions with local
+ // array variables regardless of their size.
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: array_u8_small:
+#[no_mangle]
+pub fn array_u8_small(f: fn(*const u8)) {
+ let a = [0u8; 2];
+ let b = [0u8; 7];
+ f(&a as *const _);
+ f(&b as *const _);
+
+ // Small arrays do not lead to stack protection by the 'basic' heuristic.
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: array_u8_large:
+#[no_mangle]
+pub fn array_u8_large(f: fn(*const u8)) {
+ let a = [0u8; 9];
+ f(&a as *const _);
+
+ // Since `a` is a byte array with size greater than 8, the basic heuristic
+ // will also protect this function.
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+#[derive(Copy, Clone)]
+pub struct ByteSizedNewtype(u8);
+
+// CHECK-LABEL: array_bytesizednewtype_9:
+#[no_mangle]
+pub fn array_bytesizednewtype_9(f: fn(*const ByteSizedNewtype)) {
+ let a = [ByteSizedNewtype(0); 9];
+ f(&a as *const _);
+
+ // Since `a` is a byte array in the LLVM output, the basic heuristic will
+ // also protect this function.
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: local_var_addr_used_indirectly
+#[no_mangle]
+pub fn local_var_addr_used_indirectly(f: fn(bool)) {
+ let a = 5;
+ let a_addr = &a as *const _ as usize;
+ f(a_addr & 0x10 == 0);
+
+ // This function takes the address of a local variable taken. Although this
+ // address is never used as a way to refer to stack memory, the `strong`
+ // heuristic adds stack smash protection. This is also the case in C++:
+ // ```
+ // cat << EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
+ // #include <cstdint>
+ // void f(void (*g)(bool)) {
+ // int32_t x;
+ // g((reinterpret_cast<uintptr_t>(&x) & 0x10U) == 0);
+ // }
+ // EOF
+ // ```
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+
+// CHECK-LABEL: local_string_addr_taken
+#[no_mangle]
+pub fn local_string_addr_taken(f: fn(&String)) {
+ let x = String::new();
+ f(&x);
+
+ // Taking the address of the local variable `x` leads to stack smash
+ // protection with the `strong` heuristic, but not with the `basic`
+ // heuristic. It does not matter that the reference is not mut.
+ //
+ // An interesting note is that a similar function in C++ *would* be
+ // protected by the `basic` heuristic, because `std::string` has a char
+ // array internally as a small object optimization:
+ // ```
+ // cat <<EOF | clang++ -O2 -fstack-protector -S -x c++ - -o - | grep stack_chk
+ // #include <string>
+ // void f(void (*g)(const std::string&)) {
+ // std::string x;
+ // g(x);
+ // }
+ // EOF
+ // ```
+ //
+
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+pub trait SelfByRef {
+ fn f(&self) -> i32;
+}
+
+impl SelfByRef for i32 {
+ fn f(&self) -> i32 {
+ return self + 1;
+ }
+}
+
+// CHECK-LABEL: local_var_addr_taken_used_locally_only
+#[no_mangle]
+pub fn local_var_addr_taken_used_locally_only(factory: fn() -> i32, sink: fn(i32)) {
+ let x = factory();
+ let g = x.f();
+ sink(g);
+
+ // Even though the local variable conceptually has its address taken, as
+ // it's passed by reference to the trait function, the use of the reference
+ // is easily inlined. There is therefore no stack smash protection even with
+ // the `strong` heuristic.
+
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+pub struct Gigastruct {
+ does: u64,
+ not: u64,
+ have: u64,
+ array: u64,
+ members: u64
+}
+
+// CHECK-LABEL: local_large_var_moved
+#[no_mangle]
+pub fn local_large_var_moved(f: fn(Gigastruct)) {
+ let x = Gigastruct { does: 0, not: 1, have: 2, array: 3, members: 4 };
+ f(x);
+
+ // Even though the local variable conceptually doesn't have its address
+ // taken, it's so large that the "move" is implemented with a reference to a
+ // stack-local variable in the ABI. Consequently, this function *is*
+ // protected by the `strong` heuristic. This is also the case for
+ // rvalue-references in C++, regardless of struct size:
+ // ```
+ // cat <<EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
+ // #include <cstdint>
+ // #include <utility>
+ // void f(void (*g)(uint64_t&&)) {
+ // uint64_t x;
+ // g(std::move(x));
+ // }
+ // EOF
+ // ```
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: local_large_var_cloned
+#[no_mangle]
+pub fn local_large_var_cloned(f: fn(Gigastruct)) {
+ f(Gigastruct { does: 0, not: 1, have: 2, array: 3, members: 4 });
+
+ // A new instance of `Gigastruct` is passed to `f()`, without any apparent
+ // connection to this stack frame. Still, since instances of `Gigastruct`
+ // are sufficiently large, it is allocated in the caller stack frame and
+ // passed as a pointer. As such, this function is *also* protected by the
+ // `strong` heuristic, just like `local_large_var_moved`. This is also the
+ // case for pass-by-value of sufficiently large structs in C++:
+ // ```
+ // cat <<EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
+ // #include <cstdint>
+ // #include <utility>
+ // struct Gigastruct { uint64_t a, b, c, d, e; };
+ // void f(void (*g)(Gigastruct)) {
+ // g(Gigastruct{});
+ // }
+ // EOF
+ // ```
+
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+
+extern "C" {
+ // A call to an external `alloca` function is *not* recognized as an
+ // `alloca(3)` operation. This function is a compiler built-in, as the
+ // man page explains. Clang translates it to an LLVM `alloca`
+ // instruction with a count argument, which is also what the LLVM stack
+ // protector heuristics looks for. The man page for `alloca(3)` details
+ // a way to avoid using the compiler built-in: pass a -std=c11
+ // argument, *and* don't include <alloca.h>. Though this leads to an
+ // external alloca() function being called, it doesn't lead to stack
+ // protection being included. It even fails with a linker error
+ // "undefined reference to `alloca'". Example:
+ // ```
+ // cat<<EOF | clang -fstack-protector-strong -x c -std=c11 - -o /dev/null
+ // #include <stdlib.h>
+ // void * alloca(size_t);
+ // void f(void (*g)(void*)) {
+ // void * p = alloca(10);
+ // g(p);
+ // }
+ // int main() { return 0; }
+ // EOF
+ // ```
+ // The following tests demonstrate that calls to an external `alloca`
+ // function in Rust also doesn't trigger stack protection.
+
+ fn alloca(size: usize) -> *mut ();
+}
+
+// CHECK-LABEL: alloca_small_compile_time_constant_arg
+#[no_mangle]
+pub fn alloca_small_compile_time_constant_arg(f: fn(*mut ())) {
+ f(unsafe { alloca(8) });
+
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: alloca_large_compile_time_constant_arg
+#[no_mangle]
+pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {
+ f(unsafe { alloca(9) });
+
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+
+// CHECK-LABEL: alloca_dynamic_arg
+#[no_mangle]
+pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
+ f(unsafe { alloca(n) });
+
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// The question then is: in what ways can Rust code generate array-`alloca`
+// LLVM instructions? This appears to only be generated by
+// rustc_codegen_ssa::traits::Builder::array_alloca() through
+// rustc_codegen_ssa::mir::operand::OperandValue::store_unsized(). FWICT
+// this is support for the "unsized locals" unstable feature:
+// https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html.
+
+
+// CHECK-LABEL: unsized_fn_param
+#[no_mangle]
+pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
+ let n = if l { 1 } else { 2 };
+ f(*Box::<[u8]>::from(&s[0..n])); // slice-copy with Box::from
+
+ // Even though slices are conceptually passed by-value both into this
+ // function and into `f()`, this is implemented with pass-by-reference
+ // using a suitably constructed fat-pointer (as if the functions
+ // accepted &[u8]). This function therefore doesn't need dynamic array
+ // alloca, and is therefore not protected by the `strong` or `basic`
+ // heuristics.
+
+
+ // We should have a __security_check_cookie call in `all` and `strong` modes but
+ // LLVM does not support generating stack protectors in functions with funclet
+ // based EH personalities.
+ // https://github.com/llvm/llvm-project/blob/37fd3c96b917096d8a550038f6e61cdf0fc4174f/llvm/lib/CodeGen/StackProtector.cpp#L103C1-L109C4
+ // all-NOT: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: unsized_local
+#[no_mangle]
+pub fn unsized_local(s: &[u8], l: bool, f: fn(&mut [u8])) {
+ let n = if l { 1 } else { 2 };
+ let mut a: [u8] = *Box::<[u8]>::from(&s[0..n]); // slice-copy with Box::from
+ f(&mut a);
+
+ // This function allocates a slice as a local variable in its stack
+ // frame. Since the size is not a compile-time constant, an array
+ // alloca is required, and the function is protected by both the
+ // `strong` and `basic` heuristic.
+
+ // We should have a __security_check_cookie call in `all`, `strong` and `basic` modes but
+ // LLVM does not support generating stack protectors in functions with funclet
+ // based EH personalities.
+ // https://github.com/llvm/llvm-project/blob/37fd3c96b917096d8a550038f6e61cdf0fc4174f/llvm/lib/CodeGen/StackProtector.cpp#L103C1-L109C4
+ // all-NOT: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs b/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs
new file mode 100644
index 000000000..d9abf554a
--- /dev/null
+++ b/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs
@@ -0,0 +1,414 @@
+// revisions: all strong basic none missing
+// assembly-output: emit-asm
+// only-windows
+// only-msvc
+// ignore-32bit 64-bit table based SEH has slightly different behaviors than classic SEH
+// [all] compile-flags: -Z stack-protector=all
+// [strong] compile-flags: -Z stack-protector=strong
+// [basic] compile-flags: -Z stack-protector=basic
+// [none] compile-flags: -Z stack-protector=none
+// compile-flags: -C opt-level=2 -Z merge-functions=disabled
+
+#![crate_type = "lib"]
+
+#![allow(incomplete_features)]
+
+#![feature(unsized_locals, unsized_fn_params)]
+
+
+// CHECK-LABEL: emptyfn:
+#[no_mangle]
+pub fn emptyfn() {
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: array_char
+#[no_mangle]
+pub fn array_char(f: fn(*const char)) {
+ let a = ['c'; 1];
+ let b = ['d'; 3];
+ let c = ['e'; 15];
+
+ f(&a as *const _);
+ f(&b as *const _);
+ f(&c as *const _);
+
+ // Any type of local array variable leads to stack protection with the
+ // "strong" heuristic. The 'basic' heuristic only adds stack protection to
+ // functions with local array variables of a byte-sized type, however. Since
+ // 'char' is 4 bytes in Rust, this function is not protected by the 'basic'
+ // heuristic
+ //
+ // (This test *also* takes the address of the local stack variables. We
+ // cannot know that this isn't what triggers the `strong` heuristic.
+ // However, the test strategy of passing the address of a stack array to an
+ // external function is sufficient to trigger the `basic` heuristic (see
+ // test `array_u8_large()`). Since the `basic` heuristic only checks for the
+ // presence of stack-local array variables, we can be confident that this
+ // test also captures this part of the `strong` heuristic specification.)
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: array_u8_1
+#[no_mangle]
+pub fn array_u8_1(f: fn(*const u8)) {
+ let a = [0u8; 1];
+ f(&a as *const _);
+
+ // The 'strong' heuristic adds stack protection to functions with local
+ // array variables regardless of their size.
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: array_u8_small:
+#[no_mangle]
+pub fn array_u8_small(f: fn(*const u8)) {
+ let a = [0u8; 2];
+ let b = [0u8; 7];
+ f(&a as *const _);
+ f(&b as *const _);
+
+ // Small arrays do not lead to stack protection by the 'basic' heuristic.
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: array_u8_large:
+#[no_mangle]
+pub fn array_u8_large(f: fn(*const u8)) {
+ let a = [0u8; 9];
+ f(&a as *const _);
+
+ // Since `a` is a byte array with size greater than 8, the basic heuristic
+ // will also protect this function.
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+#[derive(Copy, Clone)]
+pub struct ByteSizedNewtype(u8);
+
+// CHECK-LABEL: array_bytesizednewtype_9:
+#[no_mangle]
+pub fn array_bytesizednewtype_9(f: fn(*const ByteSizedNewtype)) {
+ let a = [ByteSizedNewtype(0); 9];
+ f(&a as *const _);
+
+ // Since `a` is a byte array in the LLVM output, the basic heuristic will
+ // also protect this function.
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: local_var_addr_used_indirectly
+#[no_mangle]
+pub fn local_var_addr_used_indirectly(f: fn(bool)) {
+ let a = 5;
+ let a_addr = &a as *const _ as usize;
+ f(a_addr & 0x10 == 0);
+
+ // This function takes the address of a local variable taken. Although this
+ // address is never used as a way to refer to stack memory, the `strong`
+ // heuristic adds stack smash protection. This is also the case in C++:
+ // ```
+ // cat << EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
+ // #include <cstdint>
+ // void f(void (*g)(bool)) {
+ // int32_t x;
+ // g((reinterpret_cast<uintptr_t>(&x) & 0x10U) == 0);
+ // }
+ // EOF
+ // ```
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+
+// CHECK-LABEL: local_string_addr_taken
+#[no_mangle]
+pub fn local_string_addr_taken(f: fn(&String)) {
+ // CHECK-DAG: .seh_endprologue
+ let x = String::new();
+ f(&x);
+
+ // Taking the address of the local variable `x` leads to stack smash
+ // protection with the `strong` heuristic, but not with the `basic`
+ // heuristic. It does not matter that the reference is not mut.
+ //
+ // An interesting note is that a similar function in C++ *would* be
+ // protected by the `basic` heuristic, because `std::string` has a char
+ // array internally as a small object optimization:
+ // ```
+ // cat <<EOF | clang++ -O2 -fstack-protector -S -x c++ - -o - | grep stack_chk
+ // #include <string>
+ // void f(void (*g)(const std::string&)) {
+ // std::string x;
+ // g(x);
+ // }
+ // EOF
+ // ```
+ //
+
+ // We should have a __security_check_cookie call in `all` and `strong` modes but
+ // LLVM does not support generating stack protectors in functions with funclet
+ // based EH personalities.
+ // https://github.com/llvm/llvm-project/blob/37fd3c96b917096d8a550038f6e61cdf0fc4174f/llvm/lib/CodeGen/StackProtector.cpp#L103C1-L109C4
+ // all-NOT: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+
+ // CHECK-DAG: .seh_endproc
+}
+
+pub trait SelfByRef {
+ fn f(&self) -> i32;
+}
+
+impl SelfByRef for i32 {
+ fn f(&self) -> i32 {
+ return self + 1;
+ }
+}
+
+// CHECK-LABEL: local_var_addr_taken_used_locally_only
+#[no_mangle]
+pub fn local_var_addr_taken_used_locally_only(factory: fn() -> i32, sink: fn(i32)) {
+ let x = factory();
+ let g = x.f();
+ sink(g);
+
+ // Even though the local variable conceptually has its address taken, as
+ // it's passed by reference to the trait function, the use of the reference
+ // is easily inlined. There is therefore no stack smash protection even with
+ // the `strong` heuristic.
+
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+pub struct Gigastruct {
+ does: u64,
+ not: u64,
+ have: u64,
+ array: u64,
+ members: u64
+}
+
+// CHECK-LABEL: local_large_var_moved
+#[no_mangle]
+pub fn local_large_var_moved(f: fn(Gigastruct)) {
+ let x = Gigastruct { does: 0, not: 1, have: 2, array: 3, members: 4 };
+ f(x);
+
+ // Even though the local variable conceptually doesn't have its address
+ // taken, it's so large that the "move" is implemented with a reference to a
+ // stack-local variable in the ABI. Consequently, this function *is*
+ // protected by the `strong` heuristic. This is also the case for
+ // rvalue-references in C++, regardless of struct size:
+ // ```
+ // cat <<EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
+ // #include <cstdint>
+ // #include <utility>
+ // void f(void (*g)(uint64_t&&)) {
+ // uint64_t x;
+ // g(std::move(x));
+ // }
+ // EOF
+ // ```
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: local_large_var_cloned
+#[no_mangle]
+pub fn local_large_var_cloned(f: fn(Gigastruct)) {
+ f(Gigastruct { does: 0, not: 1, have: 2, array: 3, members: 4 });
+
+ // A new instance of `Gigastruct` is passed to `f()`, without any apparent
+ // connection to this stack frame. Still, since instances of `Gigastruct`
+ // are sufficiently large, it is allocated in the caller stack frame and
+ // passed as a pointer. As such, this function is *also* protected by the
+ // `strong` heuristic, just like `local_large_var_moved`. This is also the
+ // case for pass-by-value of sufficiently large structs in C++:
+ // ```
+ // cat <<EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
+ // #include <cstdint>
+ // #include <utility>
+ // struct Gigastruct { uint64_t a, b, c, d, e; };
+ // void f(void (*g)(Gigastruct)) {
+ // g(Gigastruct{});
+ // }
+ // EOF
+ // ```
+
+
+ // all: __security_check_cookie
+ // strong: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+
+extern "C" {
+ // A call to an external `alloca` function is *not* recognized as an
+ // `alloca(3)` operation. This function is a compiler built-in, as the
+ // man page explains. Clang translates it to an LLVM `alloca`
+ // instruction with a count argument, which is also what the LLVM stack
+ // protector heuristics looks for. The man page for `alloca(3)` details
+ // a way to avoid using the compiler built-in: pass a -std=c11
+ // argument, *and* don't include <alloca.h>. Though this leads to an
+ // external alloca() function being called, it doesn't lead to stack
+ // protection being included. It even fails with a linker error
+ // "undefined reference to `alloca'". Example:
+ // ```
+ // cat<<EOF | clang -fstack-protector-strong -x c -std=c11 - -o /dev/null
+ // #include <stdlib.h>
+ // void * alloca(size_t);
+ // void f(void (*g)(void*)) {
+ // void * p = alloca(10);
+ // g(p);
+ // }
+ // int main() { return 0; }
+ // EOF
+ // ```
+ // The following tests demonstrate that calls to an external `alloca`
+ // function in Rust also doesn't trigger stack protection.
+
+ fn alloca(size: usize) -> *mut ();
+}
+
+// CHECK-LABEL: alloca_small_compile_time_constant_arg
+#[no_mangle]
+pub fn alloca_small_compile_time_constant_arg(f: fn(*mut ())) {
+ f(unsafe { alloca(8) });
+
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: alloca_large_compile_time_constant_arg
+#[no_mangle]
+pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {
+ f(unsafe { alloca(9) });
+
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+
+// CHECK-LABEL: alloca_dynamic_arg
+#[no_mangle]
+pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
+ f(unsafe { alloca(n) });
+
+ // all: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// The question then is: in what ways can Rust code generate array-`alloca`
+// LLVM instructions? This appears to only be generated by
+// rustc_codegen_ssa::traits::Builder::array_alloca() through
+// rustc_codegen_ssa::mir::operand::OperandValue::store_unsized(). FWICT
+// this is support for the "unsized locals" unstable feature:
+// https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html.
+
+
+// CHECK-LABEL: unsized_fn_param
+#[no_mangle]
+pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
+ let n = if l { 1 } else { 2 };
+ f(*Box::<[u8]>::from(&s[0..n])); // slice-copy with Box::from
+
+ // Even though slices are conceptually passed by-value both into this
+ // function and into `f()`, this is implemented with pass-by-reference
+ // using a suitably constructed fat-pointer (as if the functions
+ // accepted &[u8]). This function therefore doesn't need dynamic array
+ // alloca, and is therefore not protected by the `strong` or `basic`
+ // heuristics.
+
+
+ // We should have a __security_check_cookie call in `all` and `strong` modes but
+ // LLVM does not support generating stack protectors in functions with funclet
+ // based EH personalities.
+ // https://github.com/llvm/llvm-project/blob/37fd3c96b917096d8a550038f6e61cdf0fc4174f/llvm/lib/CodeGen/StackProtector.cpp#L103C1-L109C4
+ // all-NOT: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+
+ // basic-NOT: __security_check_cookie
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
+
+// CHECK-LABEL: unsized_local
+#[no_mangle]
+pub fn unsized_local(s: &[u8], l: bool, f: fn(&mut [u8])) {
+ let n = if l { 1 } else { 2 };
+ let mut a: [u8] = *Box::<[u8]>::from(&s[0..n]); // slice-copy with Box::from
+ f(&mut a);
+
+ // This function allocates a slice as a local variable in its stack
+ // frame. Since the size is not a compile-time constant, an array
+ // alloca is required, and the function is protected by both the
+ // `strong` and `basic` heuristic.
+
+ // We should have a __security_check_cookie call in `all`, `strong` and `basic` modes but
+ // LLVM does not support generating stack protectors in functions with funclet
+ // based EH personalities.
+ // https://github.com/llvm/llvm-project/blob/37fd3c96b917096d8a550038f6e61cdf0fc4174f/llvm/lib/CodeGen/StackProtector.cpp#L103C1-L109C4
+ // all-NOT: __security_check_cookie
+ // strong-NOT: __security_check_cookie
+ // basic-NOT: __security_check_cookie
+
+ // none-NOT: __security_check_cookie
+ // missing-NOT: __security_check_cookie
+}
diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs b/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs
index a7c9e4845..ca566b6e4 100644
--- a/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs
+++ b/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs
@@ -1,7 +1,7 @@
// revisions: all strong basic none missing
// assembly-output: emit-asm
// ignore-macos slightly different policy on stack protection of arrays
-// ignore-windows stack check code uses different function names
+// ignore-msvc stack check code uses different function names
// ignore-nvptx64 stack protector is not supported
// ignore-wasm32-bare
// [all] compile-flags: -Z stack-protector=all
@@ -9,6 +9,7 @@
// [basic] compile-flags: -Z stack-protector=basic
// [none] compile-flags: -Z stack-protector=none
// compile-flags: -C opt-level=2 -Z merge-functions=disabled
+// min-llvm-version: 17.0.2
#![crate_type = "lib"]
@@ -371,7 +372,7 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
// all: __stack_chk_fail
- // strong: __stack_chk_fail
+ // strong-NOT: __stack_chk_fail
// basic-NOT: __stack_chk_fail
// none-NOT: __stack_chk_fail
// missing-NOT: __stack_chk_fail
diff --git a/tests/assembly/x86_64-array-pair-load-store-merge.rs b/tests/assembly/x86_64-array-pair-load-store-merge.rs
new file mode 100644
index 000000000..55e317e91
--- /dev/null
+++ b/tests/assembly/x86_64-array-pair-load-store-merge.rs
@@ -0,0 +1,20 @@
+// assembly-output: emit-asm
+// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
+// only-x86_64
+// ignore-sgx
+// ignore-macos (manipulates rsp too)
+
+// Depending on various codegen choices, this might end up copying
+// a `<2 x i8>`, an `i16`, or two `i8`s.
+// Regardless of those choices, make sure the instructions use (2-byte) words.
+
+// CHECK-LABEL: array_copy_2_elements:
+#[no_mangle]
+pub fn array_copy_2_elements(a: &[u8; 2], p: &mut [u8; 2]) {
+ // CHECK-NOT: byte
+ // CHECK-NOT: mov
+ // CHECK: mov{{.+}}, word ptr
+ // CHECK-NEXT: mov word ptr
+ // CHECK-NEXT: ret
+ *p = *a;
+}
diff --git a/tests/codegen-units/item-collection/asm-sym.rs b/tests/codegen-units/item-collection/asm-sym.rs
index 8bafb95bc..4b05b771a 100644
--- a/tests/codegen-units/item-collection/asm-sym.rs
+++ b/tests/codegen-units/item-collection/asm-sym.rs
@@ -6,15 +6,18 @@ pub unsafe fn f() {
//~ MONO_ITEM static f::S @@ asm_sym-cgu.0[External]
static S: usize = 1;
//~ MONO_ITEM fn f::fun @@ asm_sym-cgu.0[External]
+ #[inline(never)]
fn fun() {}
core::arch::asm!("/* {0} {1} */", sym S, sym fun);
}
//~ MONO_ITEM fn g @@ asm_sym-cgu.0[External]
+#[inline(never)]
pub unsafe fn g() {
//~ MONO_ITEM static g::S @@ asm_sym-cgu.0[Internal]
static S: usize = 2;
//~ MONO_ITEM fn g::fun @@ asm_sym-cgu.0[Internal]
+ #[inline(never)]
fn fun() {}
core::arch::asm!("/* {0} {1} */", sym S, sym fun);
}
diff --git a/tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs b/tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs
index ecea26dc4..e94dded55 100644
--- a/tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs
+++ b/tests/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs
@@ -1,3 +1,5 @@
+// compile-flags: -Copt-level=0
+
#![crate_type = "lib"]
pub trait Trait : Sized {
diff --git a/tests/codegen-units/item-collection/cross-crate-trait-method.rs b/tests/codegen-units/item-collection/cross-crate-trait-method.rs
index b7216a143..778b3820f 100644
--- a/tests/codegen-units/item-collection/cross-crate-trait-method.rs
+++ b/tests/codegen-units/item-collection/cross-crate-trait-method.rs
@@ -1,4 +1,4 @@
-// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no
+// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no -Copt-level=0
#![deny(dead_code)]
#![feature(start)]
diff --git a/tests/codegen-units/item-collection/items-within-generic-items.rs b/tests/codegen-units/item-collection/items-within-generic-items.rs
index d37d7f7d9..bb1a3be36 100644
--- a/tests/codegen-units/item-collection/items-within-generic-items.rs
+++ b/tests/codegen-units/item-collection/items-within-generic-items.rs
@@ -1,4 +1,4 @@
-// compile-flags:-Zprint-mono-items=eager
+// compile-flags:-Zprint-mono-items=eager -Copt-level=0
#![deny(dead_code)]
#![feature(start)]
diff --git a/tests/codegen-units/item-collection/unreferenced-const-fn.rs b/tests/codegen-units/item-collection/unreferenced-const-fn.rs
index 17b92eae0..5f59d8015 100644
--- a/tests/codegen-units/item-collection/unreferenced-const-fn.rs
+++ b/tests/codegen-units/item-collection/unreferenced-const-fn.rs
@@ -4,6 +4,7 @@
#![crate_type = "rlib"]
//~ MONO_ITEM fn foo @@ unreferenced_const_fn-cgu.0[External]
+#[inline(never)]
pub const fn foo(x: u32) -> u32 {
x + 0xf00
}
diff --git a/tests/codegen/array-codegen.rs b/tests/codegen/array-codegen.rs
index ba0d444f9..bf5ae7467 100644
--- a/tests/codegen/array-codegen.rs
+++ b/tests/codegen/array-codegen.rs
@@ -32,3 +32,25 @@ pub fn array_copy(a: &[u8; 4], p: &mut [u8; 4]) {
// CHECK: store <4 x i8> %[[TEMP2]], ptr %p, align 1
*p = *a;
}
+
+// CHECK-LABEL: @array_copy_1_element
+#[no_mangle]
+pub fn array_copy_1_element(a: &[u8; 1], p: &mut [u8; 1]) {
+ // CHECK: %[[LOCAL:.+]] = alloca [1 x i8], align 1
+ // CHECK: %[[TEMP1:.+]] = load i8, ptr %a, align 1
+ // CHECK: store i8 %[[TEMP1]], ptr %[[LOCAL]], align 1
+ // CHECK: %[[TEMP2:.+]] = load i8, ptr %[[LOCAL]], align 1
+ // CHECK: store i8 %[[TEMP2]], ptr %p, align 1
+ *p = *a;
+}
+
+// CHECK-LABEL: @array_copy_2_elements
+#[no_mangle]
+pub fn array_copy_2_elements(a: &[u8; 2], p: &mut [u8; 2]) {
+ // CHECK: %[[LOCAL:.+]] = alloca [2 x i8], align 1
+ // CHECK: %[[TEMP1:.+]] = load <2 x i8>, ptr %a, align 1
+ // CHECK: store <2 x i8> %[[TEMP1]], ptr %[[LOCAL]], align 1
+ // CHECK: %[[TEMP2:.+]] = load <2 x i8>, ptr %[[LOCAL]], align 1
+ // CHECK: store <2 x i8> %[[TEMP2]], ptr %p, align 1
+ *p = *a;
+}
diff --git a/tests/codegen/array-optimized.rs b/tests/codegen/array-optimized.rs
new file mode 100644
index 000000000..27448fdcf
--- /dev/null
+++ b/tests/codegen/array-optimized.rs
@@ -0,0 +1,33 @@
+// compile-flags: -O
+
+#![crate_type = "lib"]
+
+// CHECK-LABEL: @array_copy_1_element
+#[no_mangle]
+pub fn array_copy_1_element(a: &[u8; 1], p: &mut [u8; 1]) {
+ // CHECK-NOT: alloca
+ // CHECK: %[[TEMP:.+]] = load i8, ptr %a, align 1
+ // CHECK: store i8 %[[TEMP]], ptr %p, align 1
+ // CHECK: ret
+ *p = *a;
+}
+
+// CHECK-LABEL: @array_copy_2_elements
+#[no_mangle]
+pub fn array_copy_2_elements(a: &[u8; 2], p: &mut [u8; 2]) {
+ // CHECK-NOT: alloca
+ // CHECK: %[[TEMP:.+]] = load <2 x i8>, ptr %a, align 1
+ // CHECK: store <2 x i8> %[[TEMP]], ptr %p, align 1
+ // CHECK: ret
+ *p = *a;
+}
+
+// CHECK-LABEL: @array_copy_4_elements
+#[no_mangle]
+pub fn array_copy_4_elements(a: &[u8; 4], p: &mut [u8; 4]) {
+ // CHECK-NOT: alloca
+ // CHECK: %[[TEMP:.+]] = load <4 x i8>, ptr %a, align 1
+ // CHECK: store <4 x i8> %[[TEMP]], ptr %p, align 1
+ // CHECK: ret
+ *p = *a;
+}
diff --git a/tests/codegen/asm-sanitize-llvm.rs b/tests/codegen/asm-sanitize-llvm.rs
index 6dcacd08c..41bed9803 100644
--- a/tests/codegen/asm-sanitize-llvm.rs
+++ b/tests/codegen/asm-sanitize-llvm.rs
@@ -1,5 +1,5 @@
// FIXME(nagisa): remove the flags below once all targets support `asm!`.
-// compile-flags: --target x86_64-unknown-linux-gnu
+// compile-flags: --target x86_64-unknown-linux-gnu -Copt-level=0
// needs-llvm-components: x86
// Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't
diff --git a/tests/codegen/async-fn-debug-awaitee-field.rs b/tests/codegen/async-fn-debug-awaitee-field.rs
index 690505fd7..03cc46cdc 100644
--- a/tests/codegen/async-fn-debug-awaitee-field.rs
+++ b/tests/codegen/async-fn-debug-awaitee-field.rs
@@ -1,9 +1,9 @@
-// This test makes sure that the generator field capturing the awaitee in a `.await` expression
+// This test makes sure that the coroutine field capturing the awaitee in a `.await` expression
// is called "__awaitee" in debuginfo. This name must not be changed since debuggers and debugger
// extensions rely on the field having this name.
// ignore-tidy-linelength
-// compile-flags: -C debuginfo=2 --edition=2018
+// compile-flags: -C debuginfo=2 --edition=2018 -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/async-fn-debug-msvc.rs b/tests/codegen/async-fn-debug-msvc.rs
index 73c652c9d..707a0d277 100644
--- a/tests/codegen/async-fn-debug-msvc.rs
+++ b/tests/codegen/async-fn-debug-msvc.rs
@@ -1,4 +1,4 @@
-// Verify debuginfo for generators:
+// Verify debuginfo for coroutines:
// - Each variant points to the file and line of its yield point
// - The discriminants are marked artificial
// - Other fields are not marked artificial
diff --git a/tests/codegen/char-ascii-branchless.rs b/tests/codegen/char-ascii-branchless.rs
new file mode 100644
index 000000000..b612b24c7
--- /dev/null
+++ b/tests/codegen/char-ascii-branchless.rs
@@ -0,0 +1,47 @@
+// Checks that these functions are branchless.
+//
+// compile-flags: -O
+
+#![crate_type = "lib"]
+
+// CHECK-LABEL: @is_ascii_alphanumeric_char
+#[no_mangle]
+pub fn is_ascii_alphanumeric_char(x: char) -> bool {
+ // CHECK-NOT: br
+ x.is_ascii_alphanumeric()
+}
+
+// CHECK-LABEL: @is_ascii_alphanumeric_u8
+#[no_mangle]
+pub fn is_ascii_alphanumeric_u8(x: u8) -> bool {
+ // CHECK-NOT: br
+ x.is_ascii_alphanumeric()
+}
+
+// CHECK-LABEL: @is_ascii_hexdigit_char
+#[no_mangle]
+pub fn is_ascii_hexdigit_char(x: char) -> bool {
+ // CHECK-NOT: br
+ x.is_ascii_hexdigit()
+}
+
+// CHECK-LABEL: @is_ascii_hexdigit_u8
+#[no_mangle]
+pub fn is_ascii_hexdigit_u8(x: u8) -> bool {
+ // CHECK-NOT: br
+ x.is_ascii_hexdigit()
+}
+
+// CHECK-LABEL: @is_ascii_punctuation_char
+#[no_mangle]
+pub fn is_ascii_punctuation_char(x: char) -> bool {
+ // CHECK-NOT: br
+ x.is_ascii_punctuation()
+}
+
+// CHECK-LABEL: @is_ascii_punctuation_u8
+#[no_mangle]
+pub fn is_ascii_punctuation_u8(x: u8) -> bool {
+ // CHECK-NOT: br
+ x.is_ascii_punctuation()
+}
diff --git a/tests/codegen/generator-debug-msvc.rs b/tests/codegen/coroutine-debug-msvc.rs
index 9d70ccdef..6d16e7576 100644
--- a/tests/codegen/generator-debug-msvc.rs
+++ b/tests/codegen/coroutine-debug-msvc.rs
@@ -1,4 +1,4 @@
-// Verify debuginfo for generators:
+// Verify debuginfo for coroutines:
// - Each variant points to the file and line of its yield point
// - The discriminants are marked artificial
// - Other fields are not marked artificial
@@ -7,10 +7,10 @@
// compile-flags: -C debuginfo=2
// only-msvc
-#![feature(generators, generator_trait)]
-use std::ops::Generator;
+#![feature(coroutines, coroutine_trait)]
+use std::ops::Coroutine;
-fn generator_test() -> impl Generator<Yield = i32, Return = ()> {
+fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|| {
yield 0;
let s = String::from("foo");
@@ -20,7 +20,7 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> {
// FIXME: No way to reliably check the filename.
-// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<generator_debug_msvc::generator_test::generator_env$0>"
+// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<coroutine_debug_msvc::coroutine_test::coroutine_env$0>"
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", scope: [[GEN]],
// For brevity, we only check the struct name and members of the last variant.
// CHECK-SAME: file: [[FILE:![0-9]*]], line: 14,
@@ -55,5 +55,5 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> {
// CHECK-NOT: flags: DIFlagArtificial
fn main() {
- let _dummy = generator_test();
+ let _dummy = coroutine_test();
}
diff --git a/tests/codegen/generator-debug.rs b/tests/codegen/coroutine-debug.rs
index 3ec860f2c..b060f3bfa 100644
--- a/tests/codegen/generator-debug.rs
+++ b/tests/codegen/coroutine-debug.rs
@@ -1,4 +1,4 @@
-// Verify debuginfo for generators:
+// Verify debuginfo for coroutines:
// - Each variant points to the file and line of its yield point
// - The discriminants are marked artificial
// - Other fields are not marked artificial
@@ -7,10 +7,10 @@
// compile-flags: -C debuginfo=2 --edition=2018
// ignore-msvc
-#![feature(generators, generator_trait)]
-use std::ops::Generator;
+#![feature(coroutines, coroutine_trait)]
+use std::ops::Coroutine;
-fn generator_test() -> impl Generator<Yield = i32, Return = ()> {
+fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> {
|| {
yield 0;
let s = String::from("foo");
@@ -20,8 +20,8 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> {
// FIXME: No way to reliably check the filename.
-// CHECK-DAG: [[GEN_FN:!.*]] = !DINamespace(name: "generator_test"
-// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{generator_env#0}", scope: [[GEN_FN]]
+// CHECK-DAG: [[GEN_FN:!.*]] = !DINamespace(name: "coroutine_test"
+// CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "{coroutine_env#0}", scope: [[GEN_FN]]
// CHECK: [[VARIANT:!.*]] = !DICompositeType(tag: DW_TAG_variant_part, scope: [[GEN]],
// CHECK-NOT: flags: DIFlagArtificial
// CHECK-SAME: discriminator: [[DISC:![0-9]*]]
@@ -58,5 +58,5 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> {
// CHECK-SAME: flags: DIFlagArtificial
fn main() {
- let _dummy = generator_test();
+ let _dummy = coroutine_test();
}
diff --git a/tests/codegen/cross-crate-inlining/always-inline.rs b/tests/codegen/cross-crate-inlining/always-inline.rs
new file mode 100644
index 000000000..f3f08bf11
--- /dev/null
+++ b/tests/codegen/cross-crate-inlining/always-inline.rs
@@ -0,0 +1,13 @@
+// compile-flags: -O
+// aux-build:always.rs
+
+#![crate_type = "lib"]
+
+extern crate always;
+
+// Check that we inline a cross-crate call, even though it isn't a leaf
+#[no_mangle]
+pub fn outer() -> String {
+ // CHECK-NOT: call {{.*}}stem_fn
+ always::stem_fn()
+}
diff --git a/tests/codegen/cross-crate-inlining/auxiliary/always.rs b/tests/codegen/cross-crate-inlining/auxiliary/always.rs
new file mode 100644
index 000000000..3670307ec
--- /dev/null
+++ b/tests/codegen/cross-crate-inlining/auxiliary/always.rs
@@ -0,0 +1,20 @@
+// compile-flags: -O -Zcross-crate-inline-threshold=always
+
+#![crate_type = "lib"]
+
+// This function *looks* like it contains a call, but that call will be optimized out by MIR
+// optimizations.
+pub fn leaf_fn() -> String {
+ String::new()
+}
+
+// This function contains a call, even after MIR optimizations. It is only eligible for
+// cross-crate-inlining with "always".
+pub fn stem_fn() -> String {
+ inner()
+}
+
+#[inline(never)]
+fn inner() -> String {
+ String::from("test")
+}
diff --git a/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs b/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs
new file mode 100644
index 000000000..963f087f2
--- /dev/null
+++ b/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs
@@ -0,0 +1,20 @@
+// compile-flags: -O
+
+#![crate_type = "lib"]
+
+// This function *looks* like it contains a call, but that call will be optimized out by MIR
+// optimizations.
+pub fn leaf_fn() -> String {
+ String::new()
+}
+
+// This function contains a call, even after MIR optimizations. It is only eligible for
+// cross-crate-inlining with "always".
+pub fn stem_fn() -> String {
+ inner()
+}
+
+#[inline(never)]
+fn inner() -> String {
+ String::from("test")
+}
diff --git a/tests/codegen/cross-crate-inlining/auxiliary/never.rs b/tests/codegen/cross-crate-inlining/auxiliary/never.rs
new file mode 100644
index 000000000..e222a6dea
--- /dev/null
+++ b/tests/codegen/cross-crate-inlining/auxiliary/never.rs
@@ -0,0 +1,20 @@
+// compile-flags: -O -Zcross-crate-inline-threshold=never
+
+#![crate_type = "lib"]
+
+// This function *looks* like it contains a call, but that call will be optimized out by MIR
+// optimizations.
+pub fn leaf_fn() -> String {
+ String::new()
+}
+
+// This function contains a call, even after MIR optimizations. It is only eligible for
+// cross-crate-inlining with "always".
+pub fn stem_fn() -> String {
+ inner()
+}
+
+#[inline(never)]
+fn inner() -> String {
+ String::from("test")
+}
diff --git a/tests/codegen/cross-crate-inlining/leaf-inlining.rs b/tests/codegen/cross-crate-inlining/leaf-inlining.rs
new file mode 100644
index 000000000..73b1a520b
--- /dev/null
+++ b/tests/codegen/cross-crate-inlining/leaf-inlining.rs
@@ -0,0 +1,20 @@
+// compile-flags: -O -Zcross-crate-inline-threshold=yes
+// aux-build:leaf.rs
+
+#![crate_type = "lib"]
+
+extern crate leaf;
+
+// Check that we inline a leaf cross-crate call
+#[no_mangle]
+pub fn leaf_outer() -> String {
+ // CHECK-NOT: call {{.*}}leaf_fn
+ leaf::leaf_fn()
+}
+
+// Check that we do not inline a non-leaf cross-crate call
+#[no_mangle]
+pub fn stem_outer() -> String {
+ // CHECK: call {{.*}}stem_fn
+ leaf::stem_fn()
+}
diff --git a/tests/codegen/cross-crate-inlining/never-inline.rs b/tests/codegen/cross-crate-inlining/never-inline.rs
new file mode 100644
index 000000000..4e7bc3e51
--- /dev/null
+++ b/tests/codegen/cross-crate-inlining/never-inline.rs
@@ -0,0 +1,13 @@
+// compile-flags: -O
+// aux-build:never.rs
+
+#![crate_type = "lib"]
+
+extern crate never;
+
+// Check that we do not inline a cross-crate call, even though it is a leaf
+#[no_mangle]
+pub fn outer() -> String {
+ // CHECK: call {{.*}}leaf_fn
+ never::leaf_fn()
+}
diff --git a/tests/codegen/debug-fndef-size.rs b/tests/codegen/debug-fndef-size.rs
new file mode 100644
index 000000000..80eb35fa3
--- /dev/null
+++ b/tests/codegen/debug-fndef-size.rs
@@ -0,0 +1,18 @@
+// Verify that `i32::cmp` FnDef type is declared with size 0 and align 1 in LLVM debuginfo.
+// compile-flags: -O -g -Cno-prepopulate-passes
+// ignore-msvc the types are mangled differently
+
+use std::cmp::Ordering;
+
+fn foo<F: FnOnce(&i32, &i32) -> Ordering>(v1: i32, v2: i32, compare: F) -> Ordering {
+ compare(&v1, &v2)
+}
+
+pub fn main() {
+ foo(0, 1, i32::cmp);
+}
+
+// CHECK: %compare.dbg.spill = alloca {}, align 1
+// CHECK: call void @llvm.dbg.declare(metadata ptr %compare.dbg.spill, metadata ![[VAR:.*]], metadata !DIExpression()), !dbg !{{.*}}
+// CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 1, dwarfAddressSpace: {{.*}})
+// CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 1)
diff --git a/tests/codegen/debug-linkage-name.rs b/tests/codegen/debug-linkage-name.rs
index 9011a7da5..9bf4d521f 100644
--- a/tests/codegen/debug-linkage-name.rs
+++ b/tests/codegen/debug-linkage-name.rs
@@ -1,8 +1,8 @@
// Verifies that linkage name is omitted when it is
// the same as variable / function name.
//
-// compile-flags: -C no-prepopulate-passes
-// compile-flags: -C debuginfo=2
+// compile-flags: -C no-prepopulate-passes -Copt-level=0
+// compile-flags: -C debuginfo=2 -Copt-level=0
#![crate_type = "lib"]
pub mod xyz {
diff --git a/tests/codegen/default-requires-uwtable.rs b/tests/codegen/default-requires-uwtable.rs
index 5d77d3f14..26424f035 100644
--- a/tests/codegen/default-requires-uwtable.rs
+++ b/tests/codegen/default-requires-uwtable.rs
@@ -1,5 +1,5 @@
// revisions: WINDOWS ANDROID
-// compile-flags: -C panic=abort
+// compile-flags: -C panic=abort -Copt-level=0
// [WINDOWS] compile-flags: --target=x86_64-pc-windows-msvc
// [WINDOWS] needs-llvm-components: x86
// [ANDROID] compile-flags: --target=armv7-linux-androideabi
diff --git a/tests/codegen/drop.rs b/tests/codegen/drop.rs
index 3615ef47b..14b5840e2 100644
--- a/tests/codegen/drop.rs
+++ b/tests/codegen/drop.rs
@@ -7,10 +7,12 @@
struct SomeUniqueName;
impl Drop for SomeUniqueName {
+ #[inline(never)]
fn drop(&mut self) {
}
}
+#[inline(never)]
pub fn possibly_unwinding() {
}
diff --git a/tests/codegen/force-frame-pointers.rs b/tests/codegen/force-frame-pointers.rs
index 637c42346..5791ae479 100644
--- a/tests/codegen/force-frame-pointers.rs
+++ b/tests/codegen/force-frame-pointers.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y
+// compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y -Copt-level=0
#![crate_type="lib"]
diff --git a/tests/codegen/force-unwind-tables.rs b/tests/codegen/force-unwind-tables.rs
index 4c0a5602c..c904978c9 100644
--- a/tests/codegen/force-unwind-tables.rs
+++ b/tests/codegen/force-unwind-tables.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C no-prepopulate-passes -C force-unwind-tables=y
+// compile-flags: -C no-prepopulate-passes -C force-unwind-tables=y -Copt-level=0
#![crate_type="lib"]
diff --git a/tests/codegen/inline-function-args-debug-info.rs b/tests/codegen/inline-function-args-debug-info.rs
index e3d8caa49..ffae99e0f 100644
--- a/tests/codegen/inline-function-args-debug-info.rs
+++ b/tests/codegen/inline-function-args-debug-info.rs
@@ -6,6 +6,7 @@
#![crate_type = "lib"]
+#[inline(never)]
pub fn outer_function(x: usize, y: usize) -> usize {
inner_function(x, y) + 1
}
@@ -13,8 +14,8 @@ pub fn outer_function(x: usize, y: usize) -> usize {
#[inline]
fn inner_function(aaaa: usize, bbbb: usize) -> usize {
// CHECK: !DILocalVariable(name: "aaaa", arg: 1
- // CHECK-SAME: line: 14
+ // CHECK-SAME: line: 15
// CHECK: !DILocalVariable(name: "bbbb", arg: 2
- // CHECK-SAME: line: 14
+ // CHECK-SAME: line: 15
aaaa + bbbb
}
diff --git a/tests/codegen/instrument-coverage-off.rs b/tests/codegen/instrument-coverage-off.rs
new file mode 100644
index 000000000..ca803beec
--- /dev/null
+++ b/tests/codegen/instrument-coverage-off.rs
@@ -0,0 +1,23 @@
+// Test that `-Cinstrument-coverage=off` does not add coverage instrumentation to LLVM IR.
+
+// needs-profiler-support
+// revisions: n no off false zero
+// [n] compile-flags: -Cinstrument-coverage=n
+// [no] compile-flags: -Cinstrument-coverage=no
+// [off] compile-flags: -Cinstrument-coverage=off
+// [false] compile-flags: -Cinstrument-coverage=false
+// [zero] compile-flags: -Cinstrument-coverage=0
+
+// CHECK-NOT: __llvm_profile_filename
+// CHECK-NOT: __llvm_coverage_mapping
+
+#![crate_type="lib"]
+
+#[inline(never)]
+fn some_function() {
+
+}
+
+pub fn some_other_function() {
+ some_function();
+}
diff --git a/tests/codegen/instrument-coverage.rs b/tests/codegen/instrument-coverage.rs
index 78f8875a2..f8437dac4 100644
--- a/tests/codegen/instrument-coverage.rs
+++ b/tests/codegen/instrument-coverage.rs
@@ -1,9 +1,16 @@
// Test that `-Cinstrument-coverage` creates expected __llvm_profile_filename symbol in LLVM IR.
// needs-profiler-support
-// compile-flags: -Cinstrument-coverage
+// revisions: default y yes on true all
+// [default] compile-flags: -Cinstrument-coverage
+// [y] compile-flags: -Cinstrument-coverage=y
+// [yes] compile-flags: -Cinstrument-coverage=yes
+// [on] compile-flags: -Cinstrument-coverage=on
+// [true] compile-flags: -Cinstrument-coverage=true
+// [all] compile-flags: -Cinstrument-coverage=all
// CHECK: @__llvm_profile_filename = {{.*}}"default_%m_%p.profraw\00"{{.*}}
+// CHECK: @__llvm_coverage_mapping
#![crate_type="lib"]
diff --git a/tests/codegen/instrument-mcount.rs b/tests/codegen/instrument-mcount.rs
index b26076e7a..50823775a 100644
--- a/tests/codegen/instrument-mcount.rs
+++ b/tests/codegen/instrument-mcount.rs
@@ -1,5 +1,5 @@
//
-// compile-flags: -Z instrument-mcount
+// compile-flags: -Z instrument-mcount -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/instrument-xray/basic.rs b/tests/codegen/instrument-xray/basic.rs
index d3e49d531..5da878474 100644
--- a/tests/codegen/instrument-xray/basic.rs
+++ b/tests/codegen/instrument-xray/basic.rs
@@ -1,7 +1,7 @@
// Checks that `-Z instrument-xray` produces expected instrumentation.
//
// needs-xray
-// compile-flags: -Z instrument-xray=always
+// compile-flags: -Z instrument-xray=always -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/instrument-xray/options-combine.rs b/tests/codegen/instrument-xray/options-combine.rs
index f7e500b65..d1e565862 100644
--- a/tests/codegen/instrument-xray/options-combine.rs
+++ b/tests/codegen/instrument-xray/options-combine.rs
@@ -1,9 +1,9 @@
// Checks that `-Z instrument-xray` options can be specified multiple times.
//
// needs-xray
-// compile-flags: -Z instrument-xray=skip-exit
-// compile-flags: -Z instrument-xray=instruction-threshold=123
-// compile-flags: -Z instrument-xray=instruction-threshold=456
+// compile-flags: -Z instrument-xray=skip-exit -Copt-level=0
+// compile-flags: -Z instrument-xray=instruction-threshold=123 -Copt-level=0
+// compile-flags: -Z instrument-xray=instruction-threshold=456 -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/instrument-xray/options-override.rs b/tests/codegen/instrument-xray/options-override.rs
index 00f818379..b1fc4c966 100644
--- a/tests/codegen/instrument-xray/options-override.rs
+++ b/tests/codegen/instrument-xray/options-override.rs
@@ -1,8 +1,8 @@
// Checks that the last `-Z instrument-xray` option wins.
//
// needs-xray
-// compile-flags: -Z instrument-xray=always
-// compile-flags: -Z instrument-xray=never
+// compile-flags: -Z instrument-xray=always -Copt-level=0
+// compile-flags: -Z instrument-xray=never -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/issue-97217.rs b/tests/codegen/issue-97217.rs
new file mode 100644
index 000000000..af7345442
--- /dev/null
+++ b/tests/codegen/issue-97217.rs
@@ -0,0 +1,22 @@
+// compile-flags: -C opt-level=3
+// ignore-debug: the debug assertions get in the way
+// min-llvm-version: 17.0.2
+#![crate_type = "lib"]
+
+// Regression test for issue 97217 (the following should result in no allocations)
+
+// CHECK-LABEL: @issue97217
+#[no_mangle]
+pub fn issue97217() -> i32 {
+ // drop_in_place should be inlined and never appear
+ // CHECK-NOT: drop_in_place
+
+ // __rust_alloc should be optimized out
+ // CHECK-NOT: __rust_alloc
+
+ let v1 = vec![5, 6, 7];
+ let v1_iter = v1.iter();
+ let total: i32 = v1_iter.sum();
+ println!("{}",total);
+ total
+}
diff --git a/tests/codegen/panic-unwind-default-uwtable.rs b/tests/codegen/panic-unwind-default-uwtable.rs
index 4c85008cf..b78b159d2 100644
--- a/tests/codegen/panic-unwind-default-uwtable.rs
+++ b/tests/codegen/panic-unwind-default-uwtable.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C panic=unwind -C no-prepopulate-passes
+// compile-flags: -C panic=unwind -C no-prepopulate-passes -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/personality_lifetimes.rs b/tests/codegen/personality_lifetimes.rs
index 47243bece..b39718a8d 100644
--- a/tests/codegen/personality_lifetimes.rs
+++ b/tests/codegen/personality_lifetimes.rs
@@ -9,10 +9,12 @@
struct S;
impl Drop for S {
+ #[inline(never)]
fn drop(&mut self) {
}
}
+#[inline(never)]
fn might_unwind() {
}
diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs
index 084d8bf80..f16890afa 100644
--- a/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs
+++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-attr-cfi-encoding.rs
@@ -1,7 +1,7 @@
// Verifies that user-defined CFI encoding for types are emitted.
//
// needs-sanitizer-cfi
-// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi
+// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0
#![crate_type="lib"]
#![feature(cfi_encoding, extern_types)]
diff --git a/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs b/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs
index 2d8b13e20..4ed7c27fc 100644
--- a/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs
+++ b/tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs
@@ -1,7 +1,7 @@
// Verifies that type metadata identifiers for functions are emitted correctly.
//
// needs-sanitizer-cfi
-// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi
+// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0
#![crate_type="lib"]
#![allow(dead_code)]
diff --git a/tests/codegen/sanitizer/cfi-generalize-pointers.rs b/tests/codegen/sanitizer/cfi-generalize-pointers.rs
index 677ebdb27..17cb42d3e 100644
--- a/tests/codegen/sanitizer/cfi-generalize-pointers.rs
+++ b/tests/codegen/sanitizer/cfi-generalize-pointers.rs
@@ -1,7 +1,7 @@
// Verifies that pointer types are generalized.
//
// needs-sanitizer-cfi
-// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers
+// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0
#![crate_type="lib"]
diff --git a/tests/codegen/sanitizer/cfi-normalize-integers.rs b/tests/codegen/sanitizer/cfi-normalize-integers.rs
index aa3913cb8..9663aa54c 100644
--- a/tests/codegen/sanitizer/cfi-normalize-integers.rs
+++ b/tests/codegen/sanitizer/cfi-normalize-integers.rs
@@ -1,7 +1,7 @@
// Verifies that integer types are normalized.
//
// needs-sanitizer-cfi
-// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers
+// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Copt-level=0
#![crate_type="lib"]
diff --git a/tests/codegen/sanitizer/kasan-emits-instrumentation.rs b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs
index 783bc47b9..29d50d8df 100644
--- a/tests/codegen/sanitizer/kasan-emits-instrumentation.rs
+++ b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs
@@ -1,6 +1,6 @@
// Verifies that `-Zsanitizer=kernel-address` emits sanitizer instrumentation.
-// compile-flags: -Zsanitizer=kernel-address
+// compile-flags: -Zsanitizer=kernel-address -Copt-level=0
// revisions: aarch64 riscv64imac riscv64gc x86_64
//[aarch64] compile-flags: --target aarch64-unknown-none
//[aarch64] needs-llvm-components: aarch64
diff --git a/tests/codegen/sanitizer/memtag-attr-check.rs b/tests/codegen/sanitizer/memtag-attr-check.rs
index 2fd362656..3e5e14e84 100644
--- a/tests/codegen/sanitizer/memtag-attr-check.rs
+++ b/tests/codegen/sanitizer/memtag-attr-check.rs
@@ -2,7 +2,7 @@
// applied when enabling the memtag sanitizer.
//
// needs-sanitizer-memtag
-// compile-flags: -Zsanitizer=memtag -Ctarget-feature=+mte
+// compile-flags: -Zsanitizer=memtag -Ctarget-feature=+mte -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/sanitizer/no-sanitize.rs b/tests/codegen/sanitizer/no-sanitize.rs
index d0b692434..029cf8e7f 100644
--- a/tests/codegen/sanitizer/no-sanitize.rs
+++ b/tests/codegen/sanitizer/no-sanitize.rs
@@ -2,7 +2,7 @@
// selectively disable sanitizer instrumentation.
//
// needs-sanitizer-address
-// compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
+// compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0
#![crate_type="lib"]
#![feature(no_sanitize)]
diff --git a/tests/codegen/sanitizer/safestack-attr-check.rs b/tests/codegen/sanitizer/safestack-attr-check.rs
index b73ed00e7..b19e2d131 100644
--- a/tests/codegen/sanitizer/safestack-attr-check.rs
+++ b/tests/codegen/sanitizer/safestack-attr-check.rs
@@ -1,7 +1,7 @@
// This tests that the safestack attribute is applied when enabling the safe-stack sanitizer.
//
// needs-sanitizer-safestack
-// compile-flags: -Zsanitizer=safestack
+// compile-flags: -Zsanitizer=safestack -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/simd/simd-wide-sum.rs b/tests/codegen/simd/simd-wide-sum.rs
index 3116f9597..6e7d3d931 100644
--- a/tests/codegen/simd/simd-wide-sum.rs
+++ b/tests/codegen/simd/simd-wide-sum.rs
@@ -11,14 +11,14 @@
#![feature(portable_simd)]
use std::simd::{Simd, SimdUint};
-const N: usize = 8;
+const N: usize = 16;
#[no_mangle]
// CHECK-LABEL: @wider_reduce_simd
pub fn wider_reduce_simd(x: Simd<u8, N>) -> u16 {
- // CHECK: zext <8 x i8>
- // CHECK-SAME: to <8 x i16>
- // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
+ // CHECK: zext <16 x i8>
+ // CHECK-SAME: to <16 x i16>
+ // CHECK: call i16 @llvm.vector.reduce.add.v16i16(<16 x i16>
let x: Simd<u16, N> = x.cast();
x.reduce_sum()
}
@@ -26,9 +26,9 @@ pub fn wider_reduce_simd(x: Simd<u8, N>) -> u16 {
#[no_mangle]
// CHECK-LABEL: @wider_reduce_loop
pub fn wider_reduce_loop(x: Simd<u8, N>) -> u16 {
- // CHECK: zext <8 x i8>
- // CHECK-SAME: to <8 x i16>
- // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
+ // CHECK: zext <16 x i8>
+ // CHECK-SAME: to <16 x i16>
+ // CHECK: call i16 @llvm.vector.reduce.add.v16i16(<16 x i16>
let mut sum = 0_u16;
for i in 0..N {
sum += u16::from(x[i]);
@@ -39,9 +39,9 @@ pub fn wider_reduce_loop(x: Simd<u8, N>) -> u16 {
#[no_mangle]
// CHECK-LABEL: @wider_reduce_iter
pub fn wider_reduce_iter(x: Simd<u8, N>) -> u16 {
- // CHECK: zext <8 x i8>
- // CHECK-SAME: to <8 x i16>
- // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
+ // CHECK: zext <16 x i8>
+ // CHECK-SAME: to <16 x i16>
+ // CHECK: call i16 @llvm.vector.reduce.add.v16i16(<16 x i16>
x.as_array().iter().copied().map(u16::from).sum()
}
@@ -52,8 +52,8 @@ pub fn wider_reduce_iter(x: Simd<u8, N>) -> u16 {
#[no_mangle]
// CHECK-LABEL: @wider_reduce_into_iter
pub fn wider_reduce_into_iter(x: Simd<u8, N>) -> u16 {
- // CHECK: zext <8 x i8>
- // CHECK-SAME: to <8 x i16>
- // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
+ // FIXME: It would be nice if this was exactly the same as the above tests,
+ // but at the time of writing this comment, that didn't happen on LLVM main.
+ // CHECK: call i16 @llvm.vector.reduce.add
x.to_array().into_iter().map(u16::from).sum()
}
diff --git a/tests/codegen/simd/unpadded-simd.rs b/tests/codegen/simd/unpadded-simd.rs
index eb44dbd93..797bca38f 100644
--- a/tests/codegen/simd/unpadded-simd.rs
+++ b/tests/codegen/simd/unpadded-simd.rs
@@ -5,10 +5,15 @@
#![crate_type = "lib"]
#![feature(repr_simd)]
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone)]
#[repr(simd)]
pub struct int16x4_t(pub i16, pub i16, pub i16, pub i16);
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone)]
pub struct int16x4x2_t(pub int16x4_t, pub int16x4_t);
+
// CHECK: %int16x4x2_t = type { <4 x i16>, <4 x i16> }
+#[no_mangle]
+fn takes_int16x4x2_t(t: int16x4x2_t) -> int16x4x2_t {
+ t
+}
diff --git a/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs b/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
index 64be11277..6ef0f0406 100644
--- a/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
+++ b/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
@@ -1,4 +1,4 @@
-// compile-flags: -g -Z src-hash-algorithm=md5
+// compile-flags: -g -Z src-hash-algorithm=md5 -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs b/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
index 54e071521..ebfa3040a 100644
--- a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
+++ b/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs
@@ -1,4 +1,4 @@
-// compile-flags: -g -Z src-hash-algorithm=sha1
+// compile-flags: -g -Z src-hash-algorithm=sha1 -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs b/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
index dc7db8e23..5ec678d55 100644
--- a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
+++ b/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs
@@ -1,4 +1,4 @@
-// compile-flags: -g -Z src-hash-algorithm=sha256
+// compile-flags: -g -Z src-hash-algorithm=sha256 -Copt-level=0
#![crate_type = "lib"]
diff --git a/tests/codegen/target-cpu-on-functions.rs b/tests/codegen/target-cpu-on-functions.rs
index c043eceb5..d5250f22c 100644
--- a/tests/codegen/target-cpu-on-functions.rs
+++ b/tests/codegen/target-cpu-on-functions.rs
@@ -15,7 +15,8 @@ pub extern "C" fn exported() {
// CHECK-LABEL: ; target_cpu_on_functions::not_exported
// CHECK-NEXT: ; Function Attrs:
-// CHECK-NEXT: define {{.*}}() {{.*}} #0
+// CHECK-NEXT: define {{.*}}() {{.*}} #1
+#[inline(never)]
fn not_exported() {}
// CHECK: attributes #0 = {{.*}} "target-cpu"="{{.*}}"
diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen/target-feature-inline-closure.rs
index d07570617..54cb27242 100644
--- a/tests/codegen/target-feature-inline-closure.rs
+++ b/tests/codegen/target-feature-inline-closure.rs
@@ -31,3 +31,7 @@ unsafe fn without_avx(x: __m256) -> __m256 {
};
add(x, x)
}
+
+// Don't allow the above CHECK-NOT to accidentally match a commit hash in the
+// compiler version.
+// CHECK-LABEL: rustc version
diff --git a/tests/codegen/tied-features-strength.rs b/tests/codegen/tied-features-strength.rs
index 51334c121..71cea48c4 100644
--- a/tests/codegen/tied-features-strength.rs
+++ b/tests/codegen/tied-features-strength.rs
@@ -7,16 +7,16 @@
// are targeting older LLVM versions. Once the min supported version
// is LLVM-14 we can remove the optional regex matching for this feature.
-// [ENABLE_SVE] compile-flags: -C target-feature=+sve
+// [ENABLE_SVE] compile-flags: -C target-feature=+sve -Copt-level=0
// ENABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+sve,?)|(\+neon,?))*}}" }
-// [DISABLE_SVE] compile-flags: -C target-feature=-sve
+// [DISABLE_SVE] compile-flags: -C target-feature=-sve -Copt-level=0
// DISABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(-sve,?)|(\+neon,?))*}}" }
-// [DISABLE_NEON] compile-flags: -C target-feature=-neon
+// [DISABLE_NEON] compile-flags: -C target-feature=-neon -Copt-level=0
// DISABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(-fp-armv8,?)|(-neon,?))*}}" }
-// [ENABLE_NEON] compile-flags: -C target-feature=+neon
+// [ENABLE_NEON] compile-flags: -C target-feature=+neon -Copt-level=0
// ENABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+fp-armv8,?)|(\+neon,?))*}}" }
diff --git a/tests/codegen/tune-cpu-on-functions.rs b/tests/codegen/tune-cpu-on-functions.rs
index ed8dc0e93..116f0772d 100644
--- a/tests/codegen/tune-cpu-on-functions.rs
+++ b/tests/codegen/tune-cpu-on-functions.rs
@@ -3,7 +3,7 @@
// no-prefer-dynamic
//
-// compile-flags: -C no-prepopulate-passes -C panic=abort -C linker-plugin-lto -Cpasses=name-anon-globals -Z tune-cpu=generic
+// compile-flags: -C no-prepopulate-passes -C panic=abort -C linker-plugin-lto -Cpasses=name-anon-globals -Z tune-cpu=generic -Copt-level=0
#![crate_type = "staticlib"]
diff --git a/tests/codegen/unchecked_shifts.rs b/tests/codegen/unchecked_shifts.rs
index d5f53bedd..aca9bec77 100644
--- a/tests/codegen/unchecked_shifts.rs
+++ b/tests/codegen/unchecked_shifts.rs
@@ -2,7 +2,7 @@
// ignore-debug (because unchecked is checked in debug)
#![crate_type = "lib"]
-#![feature(unchecked_math)]
+#![feature(unchecked_shifts)]
// CHECK-LABEL: @unchecked_shl_unsigned_same
#[no_mangle]
diff --git a/tests/codegen/unwind-landingpad-cold.rs b/tests/codegen/unwind-landingpad-cold.rs
new file mode 100644
index 000000000..3a902a7d7
--- /dev/null
+++ b/tests/codegen/unwind-landingpad-cold.rs
@@ -0,0 +1,16 @@
+// compile-flags: -Cno-prepopulate-passes
+// needs-unwind
+// min-llvm-version: 17.0.2
+#![crate_type = "lib"]
+
+// This test checks that drop calls in unwind landing pads
+// get the `cold` attribute.
+
+// CHECK-LABEL: @check_cold
+// CHECK: {{(call|invoke) void .+}}drop_in_place{{.+}} [[ATTRIBUTES:#[0-9]+]]
+// CHECK: attributes [[ATTRIBUTES]] = { cold }
+#[no_mangle]
+pub fn check_cold(f: fn(), x: Box<u32>) {
+ // this may unwind
+ f();
+}
diff --git a/tests/codegen/unwind-landingpad-inline.rs b/tests/codegen/unwind-landingpad-inline.rs
new file mode 100644
index 000000000..0774cefdd
--- /dev/null
+++ b/tests/codegen/unwind-landingpad-inline.rs
@@ -0,0 +1,39 @@
+// min-llvm-version: 17.0.2
+// compile-flags: -Copt-level=3
+// ignore-debug: the debug assertions get in the way
+#![crate_type = "lib"]
+
+// This test checks that we can inline drop_in_place in
+// unwind landing pads.
+
+// Without inlining, the box pointers escape via the call to drop_in_place,
+// and LLVM will not optimize out the pointer comparison.
+// With inlining, everything should be optimized out.
+// See https://github.com/rust-lang/rust/issues/46515
+// CHECK-LABEL: @check_no_escape_in_landingpad
+// CHECK: start:
+// CHECK-NEXT: __rust_no_alloc_shim_is_unstable
+// CHECK-NEXT: __rust_no_alloc_shim_is_unstable
+// CHECK-NEXT: ret void
+#[no_mangle]
+pub fn check_no_escape_in_landingpad(f: fn()) {
+ let x = &*Box::new(0);
+ let y = &*Box::new(0);
+
+ if x as *const _ == y as *const _ {
+ f();
+ }
+}
+
+// Without inlining, the compiler can't tell that
+// dropping an empty string (in a landing pad) does nothing.
+// With inlining, the landing pad should be optimized out.
+// See https://github.com/rust-lang/rust/issues/87055
+// CHECK-LABEL: @check_eliminate_noop_drop
+// CHECK: call void %g()
+// CHECK-NEXT: ret void
+#[no_mangle]
+pub fn check_eliminate_noop_drop(g: fn()) {
+ let _var = String::new();
+ g();
+}
diff --git a/tests/codegen/vec-reserve-extend.rs b/tests/codegen/vec-reserve-extend.rs
new file mode 100644
index 000000000..d95220104
--- /dev/null
+++ b/tests/codegen/vec-reserve-extend.rs
@@ -0,0 +1,14 @@
+// compile-flags: -O
+
+#![crate_type = "lib"]
+
+// CHECK-LABEL: @should_reserve_once
+#[no_mangle]
+pub fn should_reserve_once(v: &mut Vec<u8>) {
+ // CHECK: tail call void @llvm.assume
+ v.try_reserve(3).unwrap();
+ // CHECK-NOT: call {{.*}}reserve
+ // CHECK-NOT: call {{.*}}do_reserve_and_handle
+ // CHECK-NOT: call {{.*}}__rust_alloc(
+ v.extend([1, 2, 3]);
+}
diff --git a/tests/codegen/vec_pop_push_noop.rs b/tests/codegen/vec_pop_push_noop.rs
new file mode 100644
index 000000000..8bc7b68a8
--- /dev/null
+++ b/tests/codegen/vec_pop_push_noop.rs
@@ -0,0 +1,24 @@
+// compile-flags: -O
+
+#![crate_type = "lib"]
+
+#[no_mangle]
+// CHECK-LABEL: @noop(
+pub fn noop(v: &mut Vec<u8>) {
+ // CHECK-NOT: reserve_for_push
+ // CHECK-NOT: call
+ // CHECK: tail call void @llvm.assume
+ // CHECK-NOT: reserve_for_push
+ // CHECK-NOT: call
+ // CHECK: ret
+ if let Some(x) = v.pop() {
+ v.push(x)
+ }
+}
+
+#[no_mangle]
+// CHECK-LABEL: @push_byte(
+pub fn push_byte(v: &mut Vec<u8>) {
+ // CHECK: call {{.*}}reserve_for_push
+ v.push(3);
+}
diff --git a/tests/coverage-map/README.md b/tests/coverage-map/README.md
deleted file mode 100644
index 60d1352cd..000000000
--- a/tests/coverage-map/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-The tests in `./status-quo` were copied from `tests/run-coverage` in order to
-capture the current behavior of the instrumentor on non-trivial programs.
-The actual mappings have not been closely inspected.
-
-## Maintenance note
-
-These tests can be sensitive to small changes in MIR spans or MIR control flow,
-especially in HIR-to-MIR lowering or MIR optimizations.
-
-If you haven't touched the coverage code directly, and the `run-coverage` test
-suite still works, then it should usually be OK to just `--bless` these
-coverage mapping tests as necessary, without worrying too much about the exact
-changes.
diff --git a/tests/coverage-map/if.cov-map b/tests/coverage-map/if.cov-map
deleted file mode 100644
index 3cedb5ffb..000000000
--- a/tests/coverage-map/if.cov-map
+++ /dev/null
@@ -1,15 +0,0 @@
-Function name: if::main
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 02, 02, 06, 00, 07, 07, 01, 05, 01, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 2
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12)
-- Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6)
-- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
- = (c0 - c1)
-- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 1, 2)
- = (c1 + (c0 - c1))
-
diff --git a/tests/coverage-map/if.rs b/tests/coverage-map/if.rs
deleted file mode 100644
index ed3f69bdc..000000000
--- a/tests/coverage-map/if.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// compile-flags: --edition=2021
-
-fn main() {
- let cond = std::env::args().len() == 1;
- if cond {
- println!("true");
- }
- println!("done");
-}
diff --git a/tests/coverage-map/status-quo/closure_bug.cov-map b/tests/coverage-map/status-quo/closure_bug.cov-map
deleted file mode 100644
index 4fe2e5ad2..000000000
--- a/tests/coverage-map/status-quo/closure_bug.cov-map
+++ /dev/null
@@ -1,148 +0,0 @@
-Function name: closure_bug::main
-Raw bytes (241): 0x[01, 01, 34, 01, 00, 01, 05, 05, ce, 01, 01, 05, cb, 01, 00, 05, ce, 01, 01, 05, cb, 01, 09, 05, ce, 01, 01, 05, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, c3, 01, 00, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, bb, 01, 00, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, bb, 01, 11, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, 11, b6, 01, bb, 01, 11, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, 11, 01, 06, 01, 03, 0a, 03, 09, 05, 01, 0e, 05, 01, 0f, 00, 17, ce, 01, 00, 17, 00, 18, cb, 01, 02, 09, 00, 0a, 13, 06, 05, 01, 0e, 09, 01, 0f, 00, 17, c6, 01, 00, 17, 00, 18, c3, 01, 02, 09, 00, 0a, 3b, 06, 05, 01, 0e, 0d, 01, 0f, 00, 17, be, 01, 00, 17, 00, 18, bb, 01, 02, 09, 00, 0a, 7b, 06, 05, 01, 0e, 11, 01, 0f, 00, 17, b6, 01, 00, 17, 00, 18, b3, 01, 01, 01, 00, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 52
-- expression 0 operands: lhs = Counter(0), rhs = Zero
-- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 2 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 3 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 4 operands: lhs = Expression(50, Add), rhs = Zero
-- expression 5 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 6 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 7 operands: lhs = Expression(50, Add), rhs = Counter(2)
-- expression 8 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 9 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 10 operands: lhs = Counter(2), rhs = Expression(49, Sub)
-- expression 11 operands: lhs = Expression(50, Add), rhs = Counter(2)
-- expression 12 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 13 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 14 operands: lhs = Expression(48, Add), rhs = Zero
-- expression 15 operands: lhs = Counter(2), rhs = Expression(49, Sub)
-- expression 16 operands: lhs = Expression(50, Add), rhs = Counter(2)
-- expression 17 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 18 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 19 operands: lhs = Expression(48, Add), rhs = Counter(3)
-- expression 20 operands: lhs = Counter(2), rhs = Expression(49, Sub)
-- expression 21 operands: lhs = Expression(50, Add), rhs = Counter(2)
-- expression 22 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 23 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 24 operands: lhs = Counter(3), rhs = Expression(47, Sub)
-- expression 25 operands: lhs = Expression(48, Add), rhs = Counter(3)
-- expression 26 operands: lhs = Counter(2), rhs = Expression(49, Sub)
-- expression 27 operands: lhs = Expression(50, Add), rhs = Counter(2)
-- expression 28 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 29 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 30 operands: lhs = Expression(46, Add), rhs = Zero
-- expression 31 operands: lhs = Counter(3), rhs = Expression(47, Sub)
-- expression 32 operands: lhs = Expression(48, Add), rhs = Counter(3)
-- expression 33 operands: lhs = Counter(2), rhs = Expression(49, Sub)
-- expression 34 operands: lhs = Expression(50, Add), rhs = Counter(2)
-- expression 35 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 36 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 37 operands: lhs = Expression(46, Add), rhs = Counter(4)
-- expression 38 operands: lhs = Counter(3), rhs = Expression(47, Sub)
-- expression 39 operands: lhs = Expression(48, Add), rhs = Counter(3)
-- expression 40 operands: lhs = Counter(2), rhs = Expression(49, Sub)
-- expression 41 operands: lhs = Expression(50, Add), rhs = Counter(2)
-- expression 42 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 43 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 44 operands: lhs = Counter(4), rhs = Expression(45, Sub)
-- expression 45 operands: lhs = Expression(46, Add), rhs = Counter(4)
-- expression 46 operands: lhs = Counter(3), rhs = Expression(47, Sub)
-- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(3)
-- expression 48 operands: lhs = Counter(2), rhs = Expression(49, Sub)
-- expression 49 operands: lhs = Expression(50, Add), rhs = Counter(2)
-- expression 50 operands: lhs = Counter(1), rhs = Expression(51, Sub)
-- expression 51 operands: lhs = Counter(0), rhs = Counter(1)
-Number of file 0 mappings: 17
-- Code(Counter(0)) at (prev + 6, 1) to (start + 3, 10)
-- Code(Expression(0, Add)) at (prev + 9, 5) to (start + 1, 14)
- = (c0 + Zero)
-- Code(Counter(1)) at (prev + 1, 15) to (start + 0, 23)
-- Code(Expression(51, Sub)) at (prev + 0, 23) to (start + 0, 24)
- = (c0 - c1)
-- Code(Expression(50, Add)) at (prev + 2, 9) to (start + 0, 10)
- = (c1 + (c0 - c1))
-- Code(Expression(4, Add)) at (prev + 6, 5) to (start + 1, 14)
- = ((c1 + (c0 - c1)) + Zero)
-- Code(Counter(2)) at (prev + 1, 15) to (start + 0, 23)
-- Code(Expression(49, Sub)) at (prev + 0, 23) to (start + 0, 24)
- = ((c1 + (c0 - c1)) - c2)
-- Code(Expression(48, Add)) at (prev + 2, 9) to (start + 0, 10)
- = (c2 + ((c1 + (c0 - c1)) - c2))
-- Code(Expression(14, Add)) at (prev + 6, 5) to (start + 1, 14)
- = ((c2 + ((c1 + (c0 - c1)) - c2)) + Zero)
-- Code(Counter(3)) at (prev + 1, 15) to (start + 0, 23)
-- Code(Expression(47, Sub)) at (prev + 0, 23) to (start + 0, 24)
- = ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)
-- Code(Expression(46, Add)) at (prev + 2, 9) to (start + 0, 10)
- = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
-- Code(Expression(30, Add)) at (prev + 6, 5) to (start + 1, 14)
- = ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) + Zero)
-- Code(Counter(4)) at (prev + 1, 15) to (start + 0, 23)
-- Code(Expression(45, Sub)) at (prev + 0, 23) to (start + 0, 24)
- = ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)
-- Code(Expression(44, Add)) at (prev + 1, 1) to (start + 0, 2)
- = (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4))
-
-Function name: closure_bug::main::{closure#0}
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0d, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 2
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 13, 9) to (start + 0, 18)
-- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
-- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
- = (c0 - c1)
-- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
- = (c1 + (c0 - c1))
-
-Function name: closure_bug::main::{closure#1}
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 16, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 2
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 22, 9) to (start + 0, 18)
-- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
-- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
- = (c0 - c1)
-- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
- = (c1 + (c0 - c1))
-
-Function name: closure_bug::main::{closure#2}
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 1f, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 2
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 31, 9) to (start + 0, 18)
-- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
-- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
- = (c0 - c1)
-- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
- = (c1 + (c0 - c1))
-
-Function name: closure_bug::main::{closure#3}
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 28, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 2
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 40, 9) to (start + 0, 18)
-- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
-- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
- = (c0 - c1)
-- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
- = (c1 + (c0 - c1))
-
diff --git a/tests/coverage-map/status-quo/conditions.cov-map b/tests/coverage-map/status-quo/conditions.cov-map
deleted file mode 100644
index d82b8389b..000000000
--- a/tests/coverage-map/status-quo/conditions.cov-map
+++ /dev/null
@@ -1,261 +0,0 @@
-Function name: conditions::main
-Raw bytes (793): 0x[01, 01, 90, 01, 09, 33, 37, 41, 3b, 3d, 35, 39, 05, 00, bf, 04, 09, 05, 00, 0d, 35, 26, 39, 0d, 35, 3b, 3d, 35, 39, 37, 41, 3b, 3d, 35, 39, ba, 04, 0d, bf, 04, 09, 05, 00, 03, 00, 45, 00, 87, 01, 49, 45, 00, 82, 01, 31, 87, 01, 49, 45, 00, 7e, 4d, 82, 01, 31, 87, 01, 49, 45, 00, 7a, 51, 7e, 4d, 82, 01, 31, 87, 01, 49, 45, 00, ab, 01, 55, 4d, 51, a7, 01, 59, ab, 01, 55, 4d, 51, 49, a3, 01, a7, 01, 59, ab, 01, 55, 4d, 51, 61, 00, e7, 01, 65, 61, 00, e2, 01, 2d, e7, 01, 65, 61, 00, de, 01, 69, e2, 01, 2d, e7, 01, 65, 61, 00, da, 01, 6d, de, 01, 69, e2, 01, 2d, e7, 01, 65, 61, 00, 8f, 02, 71, 69, 6d, 8b, 02, 75, 8f, 02, 71, 69, 6d, 83, 02, 00, 65, 87, 02, 8b, 02, 75, 8f, 02, 71, 69, 6d, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, 79, 00, db, 02, 7d, 79, 00, d6, 02, 29, db, 02, 7d, 79, 00, d2, 02, 81, 01, d6, 02, 29, db, 02, 7d, 79, 00, ce, 02, 85, 01, d2, 02, 81, 01, d6, 02, 29, db, 02, 7d, 79, 00, fb, 03, 89, 01, 81, 01, 85, 01, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, 11, 9b, 04, 9f, 04, 21, a3, 04, 1d, 15, 19, ef, 03, 00, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, ef, 03, 11, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, ea, 03, 25, ef, 03, 11, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, e6, 03, 15, ea, 03, 25, ef, 03, 11, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, e2, 03, 19, e6, 03, 15, ea, 03, 25, ef, 03, 11, 7d, f3, 03, f7, 03, 8d, 01, fb, 03, 89, 01, 81, 01, 85, 01, a3, 04, 1d, 15, 19, 9f, 04, 21, a3, 04, 1d, 15, 19, 97, 04, a7, 04, 11, 9b, 04, 9f, 04, 21, a3, 04, 1d, 15, 19, ab, 04, b6, 04, af, 04, b3, 04, 25, 29, 2d, 31, ba, 04, 0d, bf, 04, 09, 05, 00, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 06, 00, 07, 03, 03, 09, 00, 0a, bf, 04, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, ba, 04, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 26, 00, 1d, 00, 2a, 22, 00, 2e, 00, 3c, 37, 00, 3d, 02, 0a, 41, 02, 0a, 00, 0b, 33, 01, 09, 01, 12, b6, 04, 03, 09, 00, 0f, 4b, 03, 09, 01, 0c, 45, 01, 0d, 02, 06, 00, 02, 06, 00, 07, 87, 01, 02, 08, 00, 15, 49, 00, 16, 02, 06, 82, 01, 02, 0f, 00, 1c, 7e, 01, 0c, 00, 19, 7a, 00, 1d, 00, 2a, 76, 00, 2e, 00, 3c, a7, 01, 00, 3d, 02, 0a, 59, 02, 0a, 00, 0b, a3, 01, 01, 09, 00, 17, 31, 02, 09, 00, 0f, 9f, 01, 03, 08, 00, 0c, 5d, 01, 0d, 01, 10, 61, 01, 11, 02, 0a, 00, 02, 0a, 00, 0b, e7, 01, 02, 0c, 00, 19, 65, 00, 1a, 02, 0a, e2, 01, 03, 11, 00, 1e, de, 01, 01, 10, 00, 1d, da, 01, 00, 21, 00, 2e, d6, 01, 00, 32, 00, 40, 8b, 02, 00, 41, 02, 0e, 75, 02, 0e, 00, 0f, 87, 02, 01, 0d, 00, 1b, 2d, 02, 0d, 00, 13, 00, 02, 06, 00, 07, ff, 01, 02, 09, 01, 0c, 79, 01, 0d, 02, 06, 00, 02, 06, 00, 07, ef, 03, 02, 09, 00, 0a, db, 02, 00, 10, 00, 1d, 7d, 00, 1e, 02, 06, d6, 02, 02, 0f, 00, 1c, d2, 02, 01, 0c, 00, 19, ce, 02, 00, 1d, 00, 2a, ca, 02, 00, 2e, 00, 3c, f7, 03, 00, 3d, 02, 0a, 8d, 01, 02, 0a, 00, 0b, f3, 03, 01, 09, 00, 17, 29, 02, 0d, 02, 0f, 97, 04, 05, 09, 00, 0a, 83, 03, 00, 10, 00, 1d, 11, 00, 1e, 02, 06, ea, 03, 02, 0f, 00, 1c, e6, 03, 01, 0c, 00, 19, e2, 03, 00, 1d, 00, 2a, de, 03, 00, 2e, 00, 3c, 9f, 04, 00, 3d, 02, 0a, 21, 02, 0a, 00, 0b, 9b, 04, 01, 09, 00, 17, 25, 02, 09, 00, 0f, 93, 04, 02, 01, 00, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 144
-- expression 0 operands: lhs = Counter(2), rhs = Expression(12, Add)
-- expression 1 operands: lhs = Expression(13, Add), rhs = Counter(16)
-- expression 2 operands: lhs = Expression(14, Add), rhs = Counter(15)
-- expression 3 operands: lhs = Counter(13), rhs = Counter(14)
-- expression 4 operands: lhs = Counter(1), rhs = Zero
-- expression 5 operands: lhs = Expression(143, Add), rhs = Counter(2)
-- expression 6 operands: lhs = Counter(1), rhs = Zero
-- expression 7 operands: lhs = Counter(3), rhs = Counter(13)
-- expression 8 operands: lhs = Expression(9, Sub), rhs = Counter(14)
-- expression 9 operands: lhs = Counter(3), rhs = Counter(13)
-- expression 10 operands: lhs = Expression(14, Add), rhs = Counter(15)
-- expression 11 operands: lhs = Counter(13), rhs = Counter(14)
-- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(16)
-- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(15)
-- expression 14 operands: lhs = Counter(13), rhs = Counter(14)
-- expression 15 operands: lhs = Expression(142, Sub), rhs = Counter(3)
-- expression 16 operands: lhs = Expression(143, Add), rhs = Counter(2)
-- expression 17 operands: lhs = Counter(1), rhs = Zero
-- expression 18 operands: lhs = Expression(0, Add), rhs = Zero
-- expression 19 operands: lhs = Counter(17), rhs = Zero
-- expression 20 operands: lhs = Expression(33, Add), rhs = Counter(18)
-- expression 21 operands: lhs = Counter(17), rhs = Zero
-- expression 22 operands: lhs = Expression(32, Sub), rhs = Counter(12)
-- expression 23 operands: lhs = Expression(33, Add), rhs = Counter(18)
-- expression 24 operands: lhs = Counter(17), rhs = Zero
-- expression 25 operands: lhs = Expression(31, Sub), rhs = Counter(19)
-- expression 26 operands: lhs = Expression(32, Sub), rhs = Counter(12)
-- expression 27 operands: lhs = Expression(33, Add), rhs = Counter(18)
-- expression 28 operands: lhs = Counter(17), rhs = Zero
-- expression 29 operands: lhs = Expression(30, Sub), rhs = Counter(20)
-- expression 30 operands: lhs = Expression(31, Sub), rhs = Counter(19)
-- expression 31 operands: lhs = Expression(32, Sub), rhs = Counter(12)
-- expression 32 operands: lhs = Expression(33, Add), rhs = Counter(18)
-- expression 33 operands: lhs = Counter(17), rhs = Zero
-- expression 34 operands: lhs = Expression(42, Add), rhs = Counter(21)
-- expression 35 operands: lhs = Counter(19), rhs = Counter(20)
-- expression 36 operands: lhs = Expression(41, Add), rhs = Counter(22)
-- expression 37 operands: lhs = Expression(42, Add), rhs = Counter(21)
-- expression 38 operands: lhs = Counter(19), rhs = Counter(20)
-- expression 39 operands: lhs = Counter(18), rhs = Expression(40, Add)
-- expression 40 operands: lhs = Expression(41, Add), rhs = Counter(22)
-- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(21)
-- expression 42 operands: lhs = Counter(19), rhs = Counter(20)
-- expression 43 operands: lhs = Counter(24), rhs = Zero
-- expression 44 operands: lhs = Expression(57, Add), rhs = Counter(25)
-- expression 45 operands: lhs = Counter(24), rhs = Zero
-- expression 46 operands: lhs = Expression(56, Sub), rhs = Counter(11)
-- expression 47 operands: lhs = Expression(57, Add), rhs = Counter(25)
-- expression 48 operands: lhs = Counter(24), rhs = Zero
-- expression 49 operands: lhs = Expression(55, Sub), rhs = Counter(26)
-- expression 50 operands: lhs = Expression(56, Sub), rhs = Counter(11)
-- expression 51 operands: lhs = Expression(57, Add), rhs = Counter(25)
-- expression 52 operands: lhs = Counter(24), rhs = Zero
-- expression 53 operands: lhs = Expression(54, Sub), rhs = Counter(27)
-- expression 54 operands: lhs = Expression(55, Sub), rhs = Counter(26)
-- expression 55 operands: lhs = Expression(56, Sub), rhs = Counter(11)
-- expression 56 operands: lhs = Expression(57, Add), rhs = Counter(25)
-- expression 57 operands: lhs = Counter(24), rhs = Zero
-- expression 58 operands: lhs = Expression(67, Add), rhs = Counter(28)
-- expression 59 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 60 operands: lhs = Expression(66, Add), rhs = Counter(29)
-- expression 61 operands: lhs = Expression(67, Add), rhs = Counter(28)
-- expression 62 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 63 operands: lhs = Expression(64, Add), rhs = Zero
-- expression 64 operands: lhs = Counter(25), rhs = Expression(65, Add)
-- expression 65 operands: lhs = Expression(66, Add), rhs = Counter(29)
-- expression 66 operands: lhs = Expression(67, Add), rhs = Counter(28)
-- expression 67 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 68 operands: lhs = Counter(31), rhs = Expression(124, Add)
-- expression 69 operands: lhs = Expression(125, Add), rhs = Counter(35)
-- expression 70 operands: lhs = Expression(126, Add), rhs = Counter(34)
-- expression 71 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 72 operands: lhs = Counter(30), rhs = Zero
-- expression 73 operands: lhs = Expression(86, Add), rhs = Counter(31)
-- expression 74 operands: lhs = Counter(30), rhs = Zero
-- expression 75 operands: lhs = Expression(85, Sub), rhs = Counter(10)
-- expression 76 operands: lhs = Expression(86, Add), rhs = Counter(31)
-- expression 77 operands: lhs = Counter(30), rhs = Zero
-- expression 78 operands: lhs = Expression(84, Sub), rhs = Counter(32)
-- expression 79 operands: lhs = Expression(85, Sub), rhs = Counter(10)
-- expression 80 operands: lhs = Expression(86, Add), rhs = Counter(31)
-- expression 81 operands: lhs = Counter(30), rhs = Zero
-- expression 82 operands: lhs = Expression(83, Sub), rhs = Counter(33)
-- expression 83 operands: lhs = Expression(84, Sub), rhs = Counter(32)
-- expression 84 operands: lhs = Expression(85, Sub), rhs = Counter(10)
-- expression 85 operands: lhs = Expression(86, Add), rhs = Counter(31)
-- expression 86 operands: lhs = Counter(30), rhs = Zero
-- expression 87 operands: lhs = Expression(126, Add), rhs = Counter(34)
-- expression 88 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 89 operands: lhs = Expression(125, Add), rhs = Counter(35)
-- expression 90 operands: lhs = Expression(126, Add), rhs = Counter(34)
-- expression 91 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 92 operands: lhs = Counter(4), rhs = Expression(134, Add)
-- expression 93 operands: lhs = Expression(135, Add), rhs = Counter(8)
-- expression 94 operands: lhs = Expression(136, Add), rhs = Counter(7)
-- expression 95 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 96 operands: lhs = Expression(123, Add), rhs = Zero
-- expression 97 operands: lhs = Counter(31), rhs = Expression(124, Add)
-- expression 98 operands: lhs = Expression(125, Add), rhs = Counter(35)
-- expression 99 operands: lhs = Expression(126, Add), rhs = Counter(34)
-- expression 100 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 101 operands: lhs = Expression(123, Add), rhs = Counter(4)
-- expression 102 operands: lhs = Counter(31), rhs = Expression(124, Add)
-- expression 103 operands: lhs = Expression(125, Add), rhs = Counter(35)
-- expression 104 operands: lhs = Expression(126, Add), rhs = Counter(34)
-- expression 105 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 106 operands: lhs = Expression(122, Sub), rhs = Counter(9)
-- expression 107 operands: lhs = Expression(123, Add), rhs = Counter(4)
-- expression 108 operands: lhs = Counter(31), rhs = Expression(124, Add)
-- expression 109 operands: lhs = Expression(125, Add), rhs = Counter(35)
-- expression 110 operands: lhs = Expression(126, Add), rhs = Counter(34)
-- expression 111 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 112 operands: lhs = Expression(121, Sub), rhs = Counter(5)
-- expression 113 operands: lhs = Expression(122, Sub), rhs = Counter(9)
-- expression 114 operands: lhs = Expression(123, Add), rhs = Counter(4)
-- expression 115 operands: lhs = Counter(31), rhs = Expression(124, Add)
-- expression 116 operands: lhs = Expression(125, Add), rhs = Counter(35)
-- expression 117 operands: lhs = Expression(126, Add), rhs = Counter(34)
-- expression 118 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 119 operands: lhs = Expression(120, Sub), rhs = Counter(6)
-- expression 120 operands: lhs = Expression(121, Sub), rhs = Counter(5)
-- expression 121 operands: lhs = Expression(122, Sub), rhs = Counter(9)
-- expression 122 operands: lhs = Expression(123, Add), rhs = Counter(4)
-- expression 123 operands: lhs = Counter(31), rhs = Expression(124, Add)
-- expression 124 operands: lhs = Expression(125, Add), rhs = Counter(35)
-- expression 125 operands: lhs = Expression(126, Add), rhs = Counter(34)
-- expression 126 operands: lhs = Counter(32), rhs = Counter(33)
-- expression 127 operands: lhs = Expression(136, Add), rhs = Counter(7)
-- expression 128 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 129 operands: lhs = Expression(135, Add), rhs = Counter(8)
-- expression 130 operands: lhs = Expression(136, Add), rhs = Counter(7)
-- expression 131 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 132 operands: lhs = Expression(133, Add), rhs = Expression(137, Add)
-- expression 133 operands: lhs = Counter(4), rhs = Expression(134, Add)
-- expression 134 operands: lhs = Expression(135, Add), rhs = Counter(8)
-- expression 135 operands: lhs = Expression(136, Add), rhs = Counter(7)
-- expression 136 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 137 operands: lhs = Expression(138, Add), rhs = Expression(141, Sub)
-- expression 138 operands: lhs = Expression(139, Add), rhs = Expression(140, Add)
-- expression 139 operands: lhs = Counter(9), rhs = Counter(10)
-- expression 140 operands: lhs = Counter(11), rhs = Counter(12)
-- expression 141 operands: lhs = Expression(142, Sub), rhs = Counter(3)
-- expression 142 operands: lhs = Expression(143, Add), rhs = Counter(2)
-- expression 143 operands: lhs = Counter(1), rhs = Zero
-Number of file 0 mappings: 68
-- Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12)
-- Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6)
-- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
-- Code(Expression(0, Add)) at (prev + 3, 9) to (start + 0, 10)
- = (c2 + (((c13 + c14) + c15) + c16))
-- Code(Expression(143, Add)) at (prev + 0, 16) to (start + 0, 29)
- = (c1 + Zero)
-- Code(Counter(2)) at (prev + 1, 9) to (start + 1, 10)
-- Code(Expression(142, Sub)) at (prev + 2, 15) to (start + 0, 28)
- = ((c1 + Zero) - c2)
-- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 25)
-- Code(Expression(9, Sub)) at (prev + 0, 29) to (start + 0, 42)
- = (c3 - c13)
-- Code(Expression(8, Sub)) at (prev + 0, 46) to (start + 0, 60)
- = ((c3 - c13) - c14)
-- Code(Expression(13, Add)) at (prev + 0, 61) to (start + 2, 10)
- = ((c13 + c14) + c15)
-- Code(Counter(16)) at (prev + 2, 10) to (start + 0, 11)
-- Code(Expression(12, Add)) at (prev + 1, 9) to (start + 1, 18)
- = (((c13 + c14) + c15) + c16)
-- Code(Expression(141, Sub)) at (prev + 3, 9) to (start + 0, 15)
- = (((c1 + Zero) - c2) - c3)
-- Code(Expression(18, Add)) at (prev + 3, 9) to (start + 1, 12)
- = ((c2 + (((c13 + c14) + c15) + c16)) + Zero)
-- Code(Counter(17)) at (prev + 1, 13) to (start + 2, 6)
-- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
-- Code(Expression(33, Add)) at (prev + 2, 8) to (start + 0, 21)
- = (c17 + Zero)
-- Code(Counter(18)) at (prev + 0, 22) to (start + 2, 6)
-- Code(Expression(32, Sub)) at (prev + 2, 15) to (start + 0, 28)
- = ((c17 + Zero) - c18)
-- Code(Expression(31, Sub)) at (prev + 1, 12) to (start + 0, 25)
- = (((c17 + Zero) - c18) - c12)
-- Code(Expression(30, Sub)) at (prev + 0, 29) to (start + 0, 42)
- = ((((c17 + Zero) - c18) - c12) - c19)
-- Code(Expression(29, Sub)) at (prev + 0, 46) to (start + 0, 60)
- = (((((c17 + Zero) - c18) - c12) - c19) - c20)
-- Code(Expression(41, Add)) at (prev + 0, 61) to (start + 2, 10)
- = ((c19 + c20) + c21)
-- Code(Counter(22)) at (prev + 2, 10) to (start + 0, 11)
-- Code(Expression(40, Add)) at (prev + 1, 9) to (start + 0, 23)
- = (((c19 + c20) + c21) + c22)
-- Code(Counter(12)) at (prev + 2, 9) to (start + 0, 15)
-- Code(Expression(39, Add)) at (prev + 3, 8) to (start + 0, 12)
- = (c18 + (((c19 + c20) + c21) + c22))
-- Code(Counter(23)) at (prev + 1, 13) to (start + 1, 16)
-- Code(Counter(24)) at (prev + 1, 17) to (start + 2, 10)
-- Code(Zero) at (prev + 2, 10) to (start + 0, 11)
-- Code(Expression(57, Add)) at (prev + 2, 12) to (start + 0, 25)
- = (c24 + Zero)
-- Code(Counter(25)) at (prev + 0, 26) to (start + 2, 10)
-- Code(Expression(56, Sub)) at (prev + 3, 17) to (start + 0, 30)
- = ((c24 + Zero) - c25)
-- Code(Expression(55, Sub)) at (prev + 1, 16) to (start + 0, 29)
- = (((c24 + Zero) - c25) - c11)
-- Code(Expression(54, Sub)) at (prev + 0, 33) to (start + 0, 46)
- = ((((c24 + Zero) - c25) - c11) - c26)
-- Code(Expression(53, Sub)) at (prev + 0, 50) to (start + 0, 64)
- = (((((c24 + Zero) - c25) - c11) - c26) - c27)
-- Code(Expression(66, Add)) at (prev + 0, 65) to (start + 2, 14)
- = ((c26 + c27) + c28)
-- Code(Counter(29)) at (prev + 2, 14) to (start + 0, 15)
-- Code(Expression(65, Add)) at (prev + 1, 13) to (start + 0, 27)
- = (((c26 + c27) + c28) + c29)
-- Code(Counter(11)) at (prev + 2, 13) to (start + 0, 19)
-- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
-- Code(Expression(63, Add)) at (prev + 2, 9) to (start + 1, 12)
- = ((c25 + (((c26 + c27) + c28) + c29)) + Zero)
-- Code(Counter(30)) at (prev + 1, 13) to (start + 2, 6)
-- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
-- Code(Expression(123, Add)) at (prev + 2, 9) to (start + 0, 10)
- = (c31 + (((c32 + c33) + c34) + c35))
-- Code(Expression(86, Add)) at (prev + 0, 16) to (start + 0, 29)
- = (c30 + Zero)
-- Code(Counter(31)) at (prev + 0, 30) to (start + 2, 6)
-- Code(Expression(85, Sub)) at (prev + 2, 15) to (start + 0, 28)
- = ((c30 + Zero) - c31)
-- Code(Expression(84, Sub)) at (prev + 1, 12) to (start + 0, 25)
- = (((c30 + Zero) - c31) - c10)
-- Code(Expression(83, Sub)) at (prev + 0, 29) to (start + 0, 42)
- = ((((c30 + Zero) - c31) - c10) - c32)
-- Code(Expression(82, Sub)) at (prev + 0, 46) to (start + 0, 60)
- = (((((c30 + Zero) - c31) - c10) - c32) - c33)
-- Code(Expression(125, Add)) at (prev + 0, 61) to (start + 2, 10)
- = ((c32 + c33) + c34)
-- Code(Counter(35)) at (prev + 2, 10) to (start + 0, 11)
-- Code(Expression(124, Add)) at (prev + 1, 9) to (start + 0, 23)
- = (((c32 + c33) + c34) + c35)
-- Code(Counter(10)) at (prev + 2, 13) to (start + 2, 15)
-- Code(Expression(133, Add)) at (prev + 5, 9) to (start + 0, 10)
- = (c4 + (((c5 + c6) + c7) + c8))
-- Code(Expression(96, Add)) at (prev + 0, 16) to (start + 0, 29)
- = ((c31 + (((c32 + c33) + c34) + c35)) + Zero)
-- Code(Counter(4)) at (prev + 0, 30) to (start + 2, 6)
-- Code(Expression(122, Sub)) at (prev + 2, 15) to (start + 0, 28)
- = ((c31 + (((c32 + c33) + c34) + c35)) - c4)
-- Code(Expression(121, Sub)) at (prev + 1, 12) to (start + 0, 25)
- = (((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9)
-- Code(Expression(120, Sub)) at (prev + 0, 29) to (start + 0, 42)
- = ((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5)
-- Code(Expression(119, Sub)) at (prev + 0, 46) to (start + 0, 60)
- = (((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5) - c6)
-- Code(Expression(135, Add)) at (prev + 0, 61) to (start + 2, 10)
- = ((c5 + c6) + c7)
-- Code(Counter(8)) at (prev + 2, 10) to (start + 0, 11)
-- Code(Expression(134, Add)) at (prev + 1, 9) to (start + 0, 23)
- = (((c5 + c6) + c7) + c8)
-- Code(Counter(9)) at (prev + 2, 9) to (start + 0, 15)
-- Code(Expression(132, Add)) at (prev + 2, 1) to (start + 0, 2)
- = ((c4 + (((c5 + c6) + c7) + c8)) + (((c9 + c10) + (c11 + c12)) + (((c1 + Zero) - c2) - c3)))
-
diff --git a/tests/coverage-map/status-quo/continue.cov-map b/tests/coverage-map/status-quo/continue.cov-map
deleted file mode 100644
index c78cf2930..000000000
--- a/tests/coverage-map/status-quo/continue.cov-map
+++ /dev/null
@@ -1,85 +0,0 @@
-Function name: continue::main
-Raw bytes (216): 0x[01, 01, 1f, 01, 07, 05, 09, 03, 0d, 0d, 1f, 11, 15, 1b, 19, 0d, 1f, 11, 15, 15, 00, 19, 37, 1d, 21, 33, 25, 19, 37, 1d, 21, 1d, 00, 25, 4f, 29, 2d, 4b, 31, 25, 4f, 29, 2d, 31, 67, 35, 39, 5f, 3d, 31, 67, 35, 39, 35, 39, 3d, 41, 73, 45, 3d, 41, 41, 00, 49, 45, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 23, 03, 09, 00, 0e, 33, 02, 0e, 00, 13, 2e, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 3b, 03, 09, 00, 0e, 4b, 02, 0e, 00, 13, 46, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 5f, 03, 0e, 00, 13, 5a, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 67, 04, 09, 00, 0e, 73, 02, 0e, 00, 13, 6e, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 49, 04, 11, 00, 16, 77, 03, 09, 00, 0e, 7b, 02, 0d, 01, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 31
-- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 3 operands: lhs = Counter(3), rhs = Expression(7, Add)
-- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(6)
-- expression 6 operands: lhs = Counter(3), rhs = Expression(7, Add)
-- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 8 operands: lhs = Counter(5), rhs = Zero
-- expression 9 operands: lhs = Counter(6), rhs = Expression(13, Add)
-- expression 10 operands: lhs = Counter(7), rhs = Counter(8)
-- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(9)
-- expression 12 operands: lhs = Counter(6), rhs = Expression(13, Add)
-- expression 13 operands: lhs = Counter(7), rhs = Counter(8)
-- expression 14 operands: lhs = Counter(7), rhs = Zero
-- expression 15 operands: lhs = Counter(9), rhs = Expression(19, Add)
-- expression 16 operands: lhs = Counter(10), rhs = Counter(11)
-- expression 17 operands: lhs = Expression(18, Add), rhs = Counter(12)
-- expression 18 operands: lhs = Counter(9), rhs = Expression(19, Add)
-- expression 19 operands: lhs = Counter(10), rhs = Counter(11)
-- expression 20 operands: lhs = Counter(12), rhs = Expression(25, Add)
-- expression 21 operands: lhs = Counter(13), rhs = Counter(14)
-- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(15)
-- expression 23 operands: lhs = Counter(12), rhs = Expression(25, Add)
-- expression 24 operands: lhs = Counter(13), rhs = Counter(14)
-- expression 25 operands: lhs = Counter(13), rhs = Counter(14)
-- expression 26 operands: lhs = Counter(15), rhs = Counter(16)
-- expression 27 operands: lhs = Expression(28, Add), rhs = Counter(17)
-- expression 28 operands: lhs = Counter(15), rhs = Counter(16)
-- expression 29 operands: lhs = Counter(16), rhs = Zero
-- expression 30 operands: lhs = Counter(18), rhs = Counter(17)
-Number of file 0 mappings: 30
-- Code(Counter(0)) at (prev + 3, 1) to (start + 3, 18)
-- Code(Expression(0, Add)) at (prev + 4, 14) to (start + 0, 19)
- = (c0 + (c1 + c2))
-- Code(Expression(2, Sub)) at (prev + 1, 15) to (start + 0, 22)
- = ((c0 + (c1 + c2)) - c3)
-- Code(Counter(1)) at (prev + 2, 17) to (start + 0, 25)
-- Code(Counter(2)) at (prev + 2, 18) to (start + 4, 14)
-- Code(Expression(6, Add)) at (prev + 6, 14) to (start + 0, 19)
- = (c3 + (c4 + c5))
-- Code(Expression(5, Sub)) at (prev + 1, 15) to (start + 0, 22)
- = ((c3 + (c4 + c5)) - c6)
-- Code(Counter(5)) at (prev + 1, 22) to (start + 2, 14)
-- Code(Counter(4)) at (prev + 4, 17) to (start + 0, 25)
-- Code(Expression(8, Add)) at (prev + 3, 9) to (start + 0, 14)
- = (c5 + Zero)
-- Code(Expression(12, Add)) at (prev + 2, 14) to (start + 0, 19)
- = (c6 + (c7 + c8))
-- Code(Expression(11, Sub)) at (prev + 1, 15) to (start + 0, 22)
- = ((c6 + (c7 + c8)) - c9)
-- Code(Counter(7)) at (prev + 1, 21) to (start + 2, 14)
-- Code(Counter(8)) at (prev + 4, 17) to (start + 0, 25)
-- Code(Expression(14, Add)) at (prev + 3, 9) to (start + 0, 14)
- = (c7 + Zero)
-- Code(Expression(18, Add)) at (prev + 2, 14) to (start + 0, 19)
- = (c9 + (c10 + c11))
-- Code(Expression(17, Sub)) at (prev + 1, 12) to (start + 0, 19)
- = ((c9 + (c10 + c11)) - c12)
-- Code(Counter(10)) at (prev + 1, 13) to (start + 0, 21)
-- Code(Counter(11)) at (prev + 1, 10) to (start + 1, 14)
-- Code(Expression(23, Add)) at (prev + 3, 14) to (start + 0, 19)
- = (c12 + (c13 + c14))
-- Code(Expression(22, Sub)) at (prev + 1, 15) to (start + 0, 22)
- = ((c12 + (c13 + c14)) - c15)
-- Code(Counter(14)) at (prev + 1, 22) to (start + 2, 14)
-- Code(Counter(13)) at (prev + 3, 18) to (start + 2, 14)
-- Code(Expression(25, Add)) at (prev + 4, 9) to (start + 0, 14)
- = (c13 + c14)
-- Code(Expression(28, Add)) at (prev + 2, 14) to (start + 0, 19)
- = (c15 + c16)
-- Code(Expression(27, Sub)) at (prev + 1, 15) to (start + 0, 22)
- = ((c15 + c16) - c17)
-- Code(Counter(16)) at (prev + 1, 22) to (start + 2, 14)
-- Code(Counter(18)) at (prev + 4, 17) to (start + 0, 22)
-- Code(Expression(29, Add)) at (prev + 3, 9) to (start + 0, 14)
- = (c16 + Zero)
-- Code(Expression(30, Add)) at (prev + 2, 13) to (start + 1, 2)
- = (c18 + c17)
-
diff --git a/tests/coverage-map/status-quo/generator.cov-map b/tests/coverage-map/status-quo/generator.cov-map
deleted file mode 100644
index a66c1af30..000000000
--- a/tests/coverage-map/status-quo/generator.cov-map
+++ /dev/null
@@ -1,58 +0,0 @@
-Function name: generator::get_u32
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0b, 01, 01, 0b, 05, 01, 0e, 00, 13, 02, 00, 1d, 00, 3c, 07, 01, 01, 00, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 2
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 11, 1) to (start + 1, 11)
-- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 19)
-- Code(Expression(0, Sub)) at (prev + 0, 29) to (start + 0, 60)
- = (c0 - c1)
-- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
- = (c1 + (c0 - c1))
-
-Function name: generator::main
-Raw bytes (71): 0x[01, 01, 0b, 01, 00, 05, 0b, 09, 0d, 11, 00, 11, 15, 2a, 19, 11, 15, 15, 19, 26, 00, 2a, 19, 11, 15, 09, 01, 0f, 01, 02, 16, 03, 07, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 07, 01, 0e, 00, 35, 0f, 02, 0b, 00, 2e, 2a, 01, 22, 00, 27, 26, 00, 2c, 00, 2e, 1f, 01, 0e, 00, 35, 23, 02, 01, 00, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 11
-- expression 0 operands: lhs = Counter(0), rhs = Zero
-- expression 1 operands: lhs = Counter(1), rhs = Expression(2, Add)
-- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 3 operands: lhs = Counter(4), rhs = Zero
-- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 5 operands: lhs = Expression(10, Sub), rhs = Counter(6)
-- expression 6 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 7 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 8 operands: lhs = Expression(9, Sub), rhs = Zero
-- expression 9 operands: lhs = Expression(10, Sub), rhs = Counter(6)
-- expression 10 operands: lhs = Counter(4), rhs = Counter(5)
-Number of file 0 mappings: 9
-- Code(Counter(0)) at (prev + 15, 1) to (start + 2, 22)
-- Code(Expression(0, Add)) at (prev + 7, 11) to (start + 0, 46)
- = (c0 + Zero)
-- Code(Counter(4)) at (prev + 1, 43) to (start + 0, 45)
-- Code(Expression(1, Add)) at (prev + 1, 14) to (start + 0, 53)
- = (c1 + (c2 + c3))
-- Code(Expression(3, Add)) at (prev + 2, 11) to (start + 0, 46)
- = (c4 + Zero)
-- Code(Expression(10, Sub)) at (prev + 1, 34) to (start + 0, 39)
- = (c4 - c5)
-- Code(Expression(9, Sub)) at (prev + 0, 44) to (start + 0, 46)
- = ((c4 - c5) - c6)
-- Code(Expression(7, Add)) at (prev + 1, 14) to (start + 0, 53)
- = (c5 + c6)
-- Code(Expression(8, Add)) at (prev + 2, 1) to (start + 0, 2)
- = (((c4 - c5) - c6) + Zero)
-
-Function name: generator::main::{closure#0}
-Raw bytes (14): 0x[01, 01, 00, 02, 01, 11, 1c, 01, 1f, 05, 02, 10, 01, 06]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 2
-- Code(Counter(0)) at (prev + 17, 28) to (start + 1, 31)
-- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)
-
diff --git a/tests/coverage-map/status-quo/generator.rs b/tests/coverage-map/status-quo/generator.rs
deleted file mode 100644
index 431999102..000000000
--- a/tests/coverage-map/status-quo/generator.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-#![feature(generators, generator_trait)]
-
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
-
-// The following implementation of a function called from a `yield` statement
-// (apparently requiring the Result and the `String` type or constructor)
-// creates conditions where the `generator::StateTransform` MIR transform will
-// drop all `Counter` `Coverage` statements from a MIR. `simplify.rs` has logic
-// to handle this condition, and still report dead block coverage.
-fn get_u32(val: bool) -> Result<u32, String> {
- if val { Ok(1) } else { Err(String::from("some error")) }
-}
-
-fn main() {
- let is_true = std::env::args().len() == 1;
- let mut generator = || {
- yield get_u32(is_true);
- return "foo";
- };
-
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Yielded(Ok(1)) => {}
- _ => panic!("unexpected return from resume"),
- }
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Complete("foo") => {}
- _ => panic!("unexpected return from resume"),
- }
-}
diff --git a/tests/coverage-map/status-quo/lazy_boolean.cov-map b/tests/coverage-map/status-quo/lazy_boolean.cov-map
deleted file mode 100644
index b18a96404..000000000
--- a/tests/coverage-map/status-quo/lazy_boolean.cov-map
+++ /dev/null
@@ -1,223 +0,0 @@
-Function name: lazy_boolean::main
-Raw bytes (646): 0x[01, 01, a8, 01, 01, 05, 09, 9a, 05, 9f, 05, 09, 05, 02, 05, 02, 9f, 05, 09, 05, 02, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 97, 05, 00, 09, 9a, 05, 9f, 05, 09, 05, 02, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 8f, 05, 00, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 87, 05, 00, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, ff, 04, 00, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, ef, 04, 21, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 21, ea, 04, ef, 04, 21, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, e7, 04, 25, 21, ea, 04, ef, 04, 21, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 25, e2, 04, e7, 04, 25, 21, ea, 04, ef, 04, 21, 1d, f2, 04, f7, 04, 1d, 19, fa, 04, ff, 04, 19, 15, 82, 05, 87, 05, 15, 11, 8a, 05, 8f, 05, 11, 0d, 92, 05, 97, 05, 0d, 09, 9a, 05, 9f, 05, 09, 05, 02, 1c, 01, 03, 01, 07, 0f, 05, 07, 10, 04, 06, 02, 04, 06, 00, 07, 97, 05, 02, 09, 00, 11, 9f, 05, 02, 0d, 00, 12, 9a, 05, 02, 0d, 00, 12, 8f, 05, 03, 09, 00, 11, 33, 02, 0d, 00, 12, 92, 05, 02, 0d, 00, 12, 87, 05, 02, 09, 00, 11, 6f, 00, 14, 00, 19, 11, 00, 1d, 00, 22, ff, 04, 01, 09, 00, 11, ab, 01, 00, 14, 00, 19, 15, 00, 1d, 00, 22, cb, 01, 04, 09, 00, 10, fa, 04, 01, 05, 03, 06, 19, 03, 06, 00, 07, f7, 04, 03, 09, 00, 10, 1d, 01, 05, 03, 06, f2, 04, 05, 05, 03, 06, ef, 04, 05, 09, 00, 10, ea, 04, 00, 11, 02, 06, 21, 02, 06, 00, 07, e7, 04, 02, 08, 00, 0f, 25, 00, 10, 02, 06, e2, 04, 02, 0c, 02, 06, df, 04, 03, 01, 00, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 168
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 2 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 3 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 4 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 5 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 6 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 7 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 8 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 9 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 10 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 11 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 12 operands: lhs = Expression(165, Add), rhs = Zero
-- expression 13 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 14 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 15 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 16 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 17 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 18 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 19 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 20 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 21 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 22 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 23 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 24 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 25 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 26 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 27 operands: lhs = Expression(163, Add), rhs = Zero
-- expression 28 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 29 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 30 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 31 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 32 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 33 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 34 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 35 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 36 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 37 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 38 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 39 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 40 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 41 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 42 operands: lhs = Expression(161, Add), rhs = Zero
-- expression 43 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 44 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 45 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 46 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 47 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 48 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 49 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 50 operands: lhs = Expression(159, Add), rhs = Zero
-- expression 51 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 52 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 53 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 54 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 55 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 56 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 57 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 58 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 59 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 60 operands: lhs = Expression(159, Add), rhs = Counter(6)
-- expression 61 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 62 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 63 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 64 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 65 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 66 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 67 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 68 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 69 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 70 operands: lhs = Counter(6), rhs = Expression(158, Sub)
-- expression 71 operands: lhs = Expression(159, Add), rhs = Counter(6)
-- expression 72 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 73 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 74 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 75 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 76 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 77 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 78 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 79 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 80 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 81 operands: lhs = Expression(157, Add), rhs = Counter(7)
-- expression 82 operands: lhs = Counter(6), rhs = Expression(158, Sub)
-- expression 83 operands: lhs = Expression(159, Add), rhs = Counter(6)
-- expression 84 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 85 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 86 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 87 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 88 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 89 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 90 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 91 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 92 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 93 operands: lhs = Counter(7), rhs = Expression(156, Sub)
-- expression 94 operands: lhs = Expression(157, Add), rhs = Counter(7)
-- expression 95 operands: lhs = Counter(6), rhs = Expression(158, Sub)
-- expression 96 operands: lhs = Expression(159, Add), rhs = Counter(6)
-- expression 97 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 98 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 99 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 100 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 101 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 102 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 103 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 104 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 105 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 106 operands: lhs = Expression(155, Add), rhs = Counter(8)
-- expression 107 operands: lhs = Counter(7), rhs = Expression(156, Sub)
-- expression 108 operands: lhs = Expression(157, Add), rhs = Counter(7)
-- expression 109 operands: lhs = Counter(6), rhs = Expression(158, Sub)
-- expression 110 operands: lhs = Expression(159, Add), rhs = Counter(6)
-- expression 111 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 112 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 113 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 114 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 115 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 116 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 117 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 118 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 119 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 120 operands: lhs = Counter(8), rhs = Expression(154, Sub)
-- expression 121 operands: lhs = Expression(155, Add), rhs = Counter(8)
-- expression 122 operands: lhs = Counter(7), rhs = Expression(156, Sub)
-- expression 123 operands: lhs = Expression(157, Add), rhs = Counter(7)
-- expression 124 operands: lhs = Counter(6), rhs = Expression(158, Sub)
-- expression 125 operands: lhs = Expression(159, Add), rhs = Counter(6)
-- expression 126 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 127 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 128 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 129 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 130 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 131 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 132 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 133 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 134 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 135 operands: lhs = Expression(153, Add), rhs = Counter(9)
-- expression 136 operands: lhs = Counter(8), rhs = Expression(154, Sub)
-- expression 137 operands: lhs = Expression(155, Add), rhs = Counter(8)
-- expression 138 operands: lhs = Counter(7), rhs = Expression(156, Sub)
-- expression 139 operands: lhs = Expression(157, Add), rhs = Counter(7)
-- expression 140 operands: lhs = Counter(6), rhs = Expression(158, Sub)
-- expression 141 operands: lhs = Expression(159, Add), rhs = Counter(6)
-- expression 142 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 143 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 144 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 145 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 146 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 147 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 148 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 149 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 150 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 151 operands: lhs = Counter(9), rhs = Expression(152, Sub)
-- expression 152 operands: lhs = Expression(153, Add), rhs = Counter(9)
-- expression 153 operands: lhs = Counter(8), rhs = Expression(154, Sub)
-- expression 154 operands: lhs = Expression(155, Add), rhs = Counter(8)
-- expression 155 operands: lhs = Counter(7), rhs = Expression(156, Sub)
-- expression 156 operands: lhs = Expression(157, Add), rhs = Counter(7)
-- expression 157 operands: lhs = Counter(6), rhs = Expression(158, Sub)
-- expression 158 operands: lhs = Expression(159, Add), rhs = Counter(6)
-- expression 159 operands: lhs = Counter(5), rhs = Expression(160, Sub)
-- expression 160 operands: lhs = Expression(161, Add), rhs = Counter(5)
-- expression 161 operands: lhs = Counter(4), rhs = Expression(162, Sub)
-- expression 162 operands: lhs = Expression(163, Add), rhs = Counter(4)
-- expression 163 operands: lhs = Counter(3), rhs = Expression(164, Sub)
-- expression 164 operands: lhs = Expression(165, Add), rhs = Counter(3)
-- expression 165 operands: lhs = Counter(2), rhs = Expression(166, Sub)
-- expression 166 operands: lhs = Expression(167, Add), rhs = Counter(2)
-- expression 167 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-Number of file 0 mappings: 28
-- Code(Counter(0)) at (prev + 3, 1) to (start + 7, 15)
-- Code(Counter(1)) at (prev + 7, 16) to (start + 4, 6)
-- Code(Expression(0, Sub)) at (prev + 4, 6) to (start + 0, 7)
- = (c0 - c1)
-- Code(Expression(165, Add)) at (prev + 2, 9) to (start + 0, 17)
- = (c2 + ((c1 + (c0 - c1)) - c2))
-- Code(Expression(167, Add)) at (prev + 2, 13) to (start + 0, 18)
- = (c1 + (c0 - c1))
-- Code(Expression(166, Sub)) at (prev + 2, 13) to (start + 0, 18)
- = ((c1 + (c0 - c1)) - c2)
-- Code(Expression(163, Add)) at (prev + 3, 9) to (start + 0, 17)
- = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
-- Code(Expression(12, Add)) at (prev + 2, 13) to (start + 0, 18)
- = ((c2 + ((c1 + (c0 - c1)) - c2)) + Zero)
-- Code(Expression(164, Sub)) at (prev + 2, 13) to (start + 0, 18)
- = ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)
-- Code(Expression(161, Add)) at (prev + 2, 9) to (start + 0, 17)
- = (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4))
-- Code(Expression(27, Add)) at (prev + 0, 20) to (start + 0, 25)
- = ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) + Zero)
-- Code(Counter(4)) at (prev + 0, 29) to (start + 0, 34)
-- Code(Expression(159, Add)) at (prev + 1, 9) to (start + 0, 17)
- = (c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5))
-- Code(Expression(42, Add)) at (prev + 0, 20) to (start + 0, 25)
- = ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) + Zero)
-- Code(Counter(5)) at (prev + 0, 29) to (start + 0, 34)
-- Code(Expression(50, Add)) at (prev + 4, 9) to (start + 0, 16)
- = ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) + Zero)
-- Code(Expression(158, Sub)) at (prev + 1, 5) to (start + 3, 6)
- = ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)
-- Code(Counter(6)) at (prev + 3, 6) to (start + 0, 7)
-- Code(Expression(157, Add)) at (prev + 3, 9) to (start + 0, 16)
- = (c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6))
-- Code(Counter(7)) at (prev + 1, 5) to (start + 3, 6)
-- Code(Expression(156, Sub)) at (prev + 5, 5) to (start + 3, 6)
- = ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)
-- Code(Expression(155, Add)) at (prev + 5, 9) to (start + 0, 16)
- = (c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7))
-- Code(Expression(154, Sub)) at (prev + 0, 17) to (start + 2, 6)
- = ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)
-- Code(Counter(8)) at (prev + 2, 6) to (start + 0, 7)
-- Code(Expression(153, Add)) at (prev + 2, 8) to (start + 0, 15)
- = (c8 + ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8))
-- Code(Counter(9)) at (prev + 0, 16) to (start + 2, 6)
-- Code(Expression(152, Sub)) at (prev + 2, 12) to (start + 2, 6)
- = ((c8 + ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)) - c9)
-- Code(Expression(151, Add)) at (prev + 3, 1) to (start + 0, 2)
- = (c9 + ((c8 + ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)) - c9))
-
diff --git a/tests/coverage-map/status-quo/loops_branches.cov-map b/tests/coverage-map/status-quo/loops_branches.cov-map
deleted file mode 100644
index 480bbfd97..000000000
--- a/tests/coverage-map/status-quo/loops_branches.cov-map
+++ /dev/null
@@ -1,185 +0,0 @@
-Function name: <loops_branches::DebugTest as core::fmt::Debug>::fmt
-Raw bytes (251): 0x[01, 01, 32, 05, 09, 00, 02, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, c3, 01, c7, 01, 0d, 00, 11, 15, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, b6, 01, 1d, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, 00, b2, 01, b6, 01, 1d, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, af, 01, 11, 00, b2, 01, b6, 01, 1d, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, 25, a7, 01, aa, 01, 19, af, 01, 11, 00, b2, 01, b6, 01, 1d, ba, 01, 15, bf, 01, 19, c3, 01, c7, 01, 0d, 00, 11, 15, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0e, 00, 0f, 07, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, ba, 01, 03, 0d, 00, 0e, bf, 01, 00, 12, 00, 17, 27, 01, 10, 00, 14, b6, 01, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, b2, 01, 01, 12, 00, 13, af, 01, 01, 11, 00, 22, aa, 01, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 19, 03, 09, 00, 0f, a3, 01, 01, 05, 00, 06]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 50
-- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 1 operands: lhs = Zero, rhs = Expression(0, Sub)
-- expression 2 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 3 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
-- expression 4 operands: lhs = Counter(3), rhs = Zero
-- expression 5 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 6 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
-- expression 7 operands: lhs = Counter(3), rhs = Zero
-- expression 8 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 9 operands: lhs = Expression(46, Sub), rhs = Zero
-- expression 10 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 11 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
-- expression 12 operands: lhs = Counter(3), rhs = Zero
-- expression 13 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 14 operands: lhs = Expression(46, Sub), rhs = Counter(5)
-- expression 15 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 16 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
-- expression 17 operands: lhs = Counter(3), rhs = Zero
-- expression 18 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 19 operands: lhs = Expression(45, Sub), rhs = Counter(7)
-- expression 20 operands: lhs = Expression(46, Sub), rhs = Counter(5)
-- expression 21 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 22 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
-- expression 23 operands: lhs = Counter(3), rhs = Zero
-- expression 24 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 25 operands: lhs = Zero, rhs = Expression(44, Sub)
-- expression 26 operands: lhs = Expression(45, Sub), rhs = Counter(7)
-- expression 27 operands: lhs = Expression(46, Sub), rhs = Counter(5)
-- expression 28 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 29 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
-- expression 30 operands: lhs = Counter(3), rhs = Zero
-- expression 31 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 32 operands: lhs = Expression(43, Add), rhs = Counter(4)
-- expression 33 operands: lhs = Zero, rhs = Expression(44, Sub)
-- expression 34 operands: lhs = Expression(45, Sub), rhs = Counter(7)
-- expression 35 operands: lhs = Expression(46, Sub), rhs = Counter(5)
-- expression 36 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 37 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
-- expression 38 operands: lhs = Counter(3), rhs = Zero
-- expression 39 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 40 operands: lhs = Counter(9), rhs = Expression(41, Add)
-- expression 41 operands: lhs = Expression(42, Sub), rhs = Counter(6)
-- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(4)
-- expression 43 operands: lhs = Zero, rhs = Expression(44, Sub)
-- expression 44 operands: lhs = Expression(45, Sub), rhs = Counter(7)
-- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(5)
-- expression 46 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 47 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
-- expression 48 operands: lhs = Counter(3), rhs = Zero
-- expression 49 operands: lhs = Counter(4), rhs = Counter(5)
-Number of file 0 mappings: 20
-- Code(Counter(0)) at (prev + 9, 5) to (start + 1, 16)
-- Code(Counter(1)) at (prev + 2, 16) to (start + 0, 21)
-- Code(Zero) at (prev + 1, 23) to (start + 0, 27)
-- Code(Zero) at (prev + 0, 28) to (start + 0, 30)
-- Code(Expression(0, Sub)) at (prev + 1, 14) to (start + 0, 15)
- = (c1 - c2)
-- Code(Expression(1, Add)) at (prev + 1, 13) to (start + 0, 30)
- = (Zero + (c1 - c2))
-- Code(Counter(9)) at (prev + 0, 30) to (start + 0, 31)
-- Code(Zero) at (prev + 1, 16) to (start + 1, 10)
-- Code(Expression(46, Sub)) at (prev + 3, 13) to (start + 0, 14)
- = (((c3 + Zero) + (c4 + c5)) - c6)
-- Code(Expression(47, Add)) at (prev + 0, 18) to (start + 0, 23)
- = ((c3 + Zero) + (c4 + c5))
-- Code(Expression(9, Add)) at (prev + 1, 16) to (start + 0, 20)
- = ((((c3 + Zero) + (c4 + c5)) - c6) + Zero)
-- Code(Expression(45, Sub)) at (prev + 1, 20) to (start + 0, 25)
- = ((((c3 + Zero) + (c4 + c5)) - c6) - c5)
-- Code(Zero) at (prev + 1, 27) to (start + 0, 31)
-- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
-- Code(Expression(44, Sub)) at (prev + 1, 18) to (start + 0, 19)
- = (((((c3 + Zero) + (c4 + c5)) - c6) - c5) - c7)
-- Code(Expression(43, Add)) at (prev + 1, 17) to (start + 0, 34)
- = (Zero + (((((c3 + Zero) + (c4 + c5)) - c6) - c5) - c7))
-- Code(Expression(42, Sub)) at (prev + 0, 34) to (start + 0, 35)
- = ((Zero + (((((c3 + Zero) + (c4 + c5)) - c6) - c5) - c7)) - c4)
-- Code(Zero) at (prev + 1, 20) to (start + 1, 14)
-- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
-- Code(Expression(40, Add)) at (prev + 1, 5) to (start + 0, 6)
- = (c9 + (((Zero + (((((c3 + Zero) + (c4 + c5)) - c6) - c5) - c7)) - c4) + c6))
-
-Function name: <loops_branches::DisplayTest as core::fmt::Display>::fmt
-Raw bytes (255): 0x[01, 01, 34, 01, 05, 02, 09, 00, 0e, 02, 09, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, c7, 01, cb, 01, 05, 0d, 11, 15, be, 01, 00, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, ba, 01, 1d, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, 00, b6, 01, ba, 01, 1d, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, b3, 01, 15, 00, b6, 01, ba, 01, 1d, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, ae, 01, cf, 01, b3, 01, 15, 00, b6, 01, ba, 01, 1d, be, 01, 11, c3, 01, 19, c7, 01, cb, 01, 05, 0d, 11, 15, 19, 25, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 0e, 01, 0e, 00, 0f, 0b, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, be, 01, 02, 0d, 00, 0e, c3, 01, 00, 12, 00, 17, 2f, 01, 10, 00, 15, 00, 00, 16, 01, 0e, ba, 01, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, b6, 01, 01, 12, 00, 13, b3, 01, 01, 11, 00, 22, ae, 01, 00, 22, 00, 23, 19, 03, 09, 00, 0f, ab, 01, 01, 05, 00, 06]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 52
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(0, Sub), rhs = Counter(2)
-- expression 2 operands: lhs = Zero, rhs = Expression(3, Sub)
-- expression 3 operands: lhs = Expression(0, Sub), rhs = Counter(2)
-- expression 4 operands: lhs = Expression(48, Add), rhs = Counter(6)
-- expression 5 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
-- expression 6 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 8 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
-- expression 9 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 10 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 11 operands: lhs = Expression(47, Sub), rhs = Zero
-- expression 12 operands: lhs = Expression(48, Add), rhs = Counter(6)
-- expression 13 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
-- expression 14 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 15 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 16 operands: lhs = Expression(47, Sub), rhs = Counter(4)
-- expression 17 operands: lhs = Expression(48, Add), rhs = Counter(6)
-- expression 18 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
-- expression 19 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 20 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 21 operands: lhs = Expression(46, Sub), rhs = Counter(7)
-- expression 22 operands: lhs = Expression(47, Sub), rhs = Counter(4)
-- expression 23 operands: lhs = Expression(48, Add), rhs = Counter(6)
-- expression 24 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
-- expression 25 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 26 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 27 operands: lhs = Zero, rhs = Expression(45, Sub)
-- expression 28 operands: lhs = Expression(46, Sub), rhs = Counter(7)
-- expression 29 operands: lhs = Expression(47, Sub), rhs = Counter(4)
-- expression 30 operands: lhs = Expression(48, Add), rhs = Counter(6)
-- expression 31 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
-- expression 32 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 33 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 34 operands: lhs = Expression(44, Add), rhs = Counter(5)
-- expression 35 operands: lhs = Zero, rhs = Expression(45, Sub)
-- expression 36 operands: lhs = Expression(46, Sub), rhs = Counter(7)
-- expression 37 operands: lhs = Expression(47, Sub), rhs = Counter(4)
-- expression 38 operands: lhs = Expression(48, Add), rhs = Counter(6)
-- expression 39 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
-- expression 40 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 41 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 42 operands: lhs = Expression(43, Sub), rhs = Expression(51, Add)
-- expression 43 operands: lhs = Expression(44, Add), rhs = Counter(5)
-- expression 44 operands: lhs = Zero, rhs = Expression(45, Sub)
-- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(7)
-- expression 46 operands: lhs = Expression(47, Sub), rhs = Counter(4)
-- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(6)
-- expression 48 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
-- expression 49 operands: lhs = Counter(1), rhs = Counter(3)
-- expression 50 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 51 operands: lhs = Counter(6), rhs = Counter(9)
-Number of file 0 mappings: 20
-- Code(Counter(0)) at (prev + 34, 5) to (start + 1, 17)
-- Code(Zero) at (prev + 1, 18) to (start + 1, 10)
-- Code(Expression(0, Sub)) at (prev + 2, 16) to (start + 0, 21)
- = (c0 - c1)
-- Code(Zero) at (prev + 1, 23) to (start + 0, 27)
-- Code(Zero) at (prev + 0, 28) to (start + 0, 30)
-- Code(Expression(3, Sub)) at (prev + 1, 14) to (start + 0, 15)
- = ((c0 - c1) - c2)
-- Code(Expression(2, Add)) at (prev + 1, 13) to (start + 0, 30)
- = (Zero + ((c0 - c1) - c2))
-- Code(Counter(9)) at (prev + 0, 30) to (start + 0, 31)
-- Code(Expression(47, Sub)) at (prev + 2, 13) to (start + 0, 14)
- = (((c1 + c3) + (c4 + c5)) - c6)
-- Code(Expression(48, Add)) at (prev + 0, 18) to (start + 0, 23)
- = ((c1 + c3) + (c4 + c5))
-- Code(Expression(11, Add)) at (prev + 1, 16) to (start + 0, 21)
- = ((((c1 + c3) + (c4 + c5)) - c6) + Zero)
-- Code(Zero) at (prev + 0, 22) to (start + 1, 14)
-- Code(Expression(46, Sub)) at (prev + 2, 20) to (start + 0, 25)
- = ((((c1 + c3) + (c4 + c5)) - c6) - c4)
-- Code(Zero) at (prev + 1, 27) to (start + 0, 31)
-- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
-- Code(Expression(45, Sub)) at (prev + 1, 18) to (start + 0, 19)
- = (((((c1 + c3) + (c4 + c5)) - c6) - c4) - c7)
-- Code(Expression(44, Add)) at (prev + 1, 17) to (start + 0, 34)
- = (Zero + (((((c1 + c3) + (c4 + c5)) - c6) - c4) - c7))
-- Code(Expression(43, Sub)) at (prev + 0, 34) to (start + 0, 35)
- = ((Zero + (((((c1 + c3) + (c4 + c5)) - c6) - c4) - c7)) - c5)
-- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
-- Code(Expression(42, Add)) at (prev + 1, 5) to (start + 0, 6)
- = (((Zero + (((((c1 + c3) + (c4 + c5)) - c6) - c4) - c7)) - c5) + (c6 + c9))
-
-Function name: loops_branches::main
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 37, 01, 05, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 55, 1) to (start + 5, 2)
-
diff --git a/tests/coverage-map/status-quo/overflow.rs b/tests/coverage-map/status-quo/overflow.rs
deleted file mode 100644
index bbb65c1b3..000000000
--- a/tests/coverage-map/status-quo/overflow.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-#![allow(unused_assignments)]
-// failure-status: 101
-
-fn might_overflow(to_add: u32) -> u32 {
- if to_add > 5 {
- println!("this will probably overflow");
- }
- let add_to = u32::MAX - 5;
- println!("does {} + {} overflow?", add_to, to_add);
- let result = to_add + add_to;
- println!("continuing after overflow check");
- result
-}
-
-fn main() -> Result<(), u8> {
- let mut countdown = 10;
- while countdown > 0 {
- if countdown == 1 {
- let result = might_overflow(10);
- println!("Result: {}", result);
- } else if countdown < 5 {
- let result = might_overflow(1);
- println!("Result: {}", result);
- }
- countdown -= 1;
- }
- Ok(())
-}
-
-// Notes:
-// 1. Compare this program and its coverage results to those of the very similar test `assert.rs`,
-// and similar tests `panic_unwind.rs`, abort.rs` and `try_error_result.rs`.
-// 2. This test confirms the coverage generated when a program passes or fails a
-// compiler-generated `TerminatorKind::Assert` (based on an overflow check, in this case).
-// 3. Similar to how the coverage instrumentation handles `TerminatorKind::Call`,
-// compiler-generated assertion failures are assumed to be a symptom of a program bug, not
-// expected behavior. To simplify the coverage graphs and keep instrumented programs as
-// small and fast as possible, `Assert` terminators are assumed to always succeed, and
-// therefore are considered "non-branching" terminators. So, an `Assert` terminator does not
-// get its own coverage counter.
-// 4. After an unhandled panic or failed Assert, coverage results may not always be intuitive.
-// In this test, the final count for the statements after the `if` block in `might_overflow()`
-// is 4, even though the lines after `to_add + add_to` were executed only 3 times. Depending
-// on the MIR graph and the structure of the code, this count could have been 3 (which might
-// have been valid for the overflowed add `+`, but should have been 4 for the lines before
-// the overflow. The reason for this potential uncertainty is, a `CounterKind` is incremented
-// via StatementKind::Counter at the end of the block, but (as in the case in this test),
-// a CounterKind::Expression is always evaluated. In this case, the expression was based on
-// a `Counter` incremented as part of the evaluation of the `if` expression, which was
-// executed, and counted, 4 times, before reaching the overflow add.
-
-// If the program did not overflow, the coverage for `might_overflow()` would look like this:
-//
-// 4| |fn might_overflow(to_add: u32) -> u32 {
-// 5| 4| if to_add > 5 {
-// 6| 0| println!("this will probably overflow");
-// 7| 4| }
-// 8| 4| let add_to = u32::MAX - 5;
-// 9| 4| println!("does {} + {} overflow?", add_to, to_add);
-// 10| 4| let result = to_add + add_to;
-// 11| 4| println!("continuing after overflow check");
-// 12| 4| result
-// 13| 4|}
diff --git a/tests/coverage-map/status-quo/simple_loop.cov-map b/tests/coverage-map/status-quo/simple_loop.cov-map
deleted file mode 100644
index eb49c2324..000000000
--- a/tests/coverage-map/status-quo/simple_loop.cov-map
+++ /dev/null
@@ -1,28 +0,0 @@
-Function name: simple_loop::main
-Raw bytes (59): 0x[01, 01, 0a, 01, 05, 27, 09, 05, 02, 23, 09, 27, 09, 05, 02, 1e, 00, 23, 09, 27, 09, 05, 02, 07, 01, 03, 01, 09, 10, 05, 0a, 05, 05, 06, 02, 05, 06, 00, 07, 23, 05, 0d, 02, 0e, 1e, 04, 0d, 00, 12, 09, 02, 0a, 03, 0a, 1b, 06, 01, 00, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 10
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(9, Add), rhs = Counter(2)
-- expression 2 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 3 operands: lhs = Expression(8, Add), rhs = Counter(2)
-- expression 4 operands: lhs = Expression(9, Add), rhs = Counter(2)
-- expression 5 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 6 operands: lhs = Expression(7, Sub), rhs = Zero
-- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(2)
-- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(2)
-- expression 9 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-Number of file 0 mappings: 7
-- Code(Counter(0)) at (prev + 3, 1) to (start + 9, 16)
-- Code(Counter(1)) at (prev + 10, 5) to (start + 5, 6)
-- Code(Expression(0, Sub)) at (prev + 5, 6) to (start + 0, 7)
- = (c0 - c1)
-- Code(Expression(8, Add)) at (prev + 5, 13) to (start + 2, 14)
- = ((c1 + (c0 - c1)) + c2)
-- Code(Expression(7, Sub)) at (prev + 4, 13) to (start + 0, 18)
- = (((c1 + (c0 - c1)) + c2) - c2)
-- Code(Counter(2)) at (prev + 2, 10) to (start + 3, 10)
-- Code(Expression(6, Add)) at (prev + 6, 1) to (start + 0, 2)
- = ((((c1 + (c0 - c1)) + c2) - c2) + Zero)
-
diff --git a/tests/coverage-map/status-quo/simple_match.cov-map b/tests/coverage-map/status-quo/simple_match.cov-map
deleted file mode 100644
index d5389f04b..000000000
--- a/tests/coverage-map/status-quo/simple_match.cov-map
+++ /dev/null
@@ -1,36 +0,0 @@
-Function name: simple_match::main
-Raw bytes (82): 0x[01, 01, 0e, 01, 05, 2f, 33, 05, 02, 09, 0d, 2b, 11, 2f, 33, 05, 02, 09, 0d, 26, 00, 2b, 11, 2f, 33, 05, 02, 09, 0d, 09, 00, 0a, 01, 03, 01, 07, 0f, 05, 07, 10, 02, 06, 02, 02, 06, 00, 07, 2b, 05, 09, 00, 0d, 26, 05, 0d, 00, 16, 09, 02, 0d, 00, 0e, 23, 02, 11, 02, 12, 37, 04, 0d, 07, 0e, 0d, 0a, 0d, 00, 0f, 11, 03, 01, 00, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 14
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(11, Add), rhs = Expression(12, Add)
-- expression 2 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 4 operands: lhs = Expression(10, Add), rhs = Counter(4)
-- expression 5 operands: lhs = Expression(11, Add), rhs = Expression(12, Add)
-- expression 6 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 8 operands: lhs = Expression(9, Sub), rhs = Zero
-- expression 9 operands: lhs = Expression(10, Add), rhs = Counter(4)
-- expression 10 operands: lhs = Expression(11, Add), rhs = Expression(12, Add)
-- expression 11 operands: lhs = Counter(1), rhs = Expression(0, Sub)
-- expression 12 operands: lhs = Counter(2), rhs = Counter(3)
-- expression 13 operands: lhs = Counter(2), rhs = Zero
-Number of file 0 mappings: 10
-- Code(Counter(0)) at (prev + 3, 1) to (start + 7, 15)
-- Code(Counter(1)) at (prev + 7, 16) to (start + 2, 6)
-- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
- = (c0 - c1)
-- Code(Expression(10, Add)) at (prev + 5, 9) to (start + 0, 13)
- = ((c1 + (c0 - c1)) + (c2 + c3))
-- Code(Expression(9, Sub)) at (prev + 5, 13) to (start + 0, 22)
- = (((c1 + (c0 - c1)) + (c2 + c3)) - c4)
-- Code(Counter(2)) at (prev + 2, 13) to (start + 0, 14)
-- Code(Expression(8, Add)) at (prev + 2, 17) to (start + 2, 18)
- = ((((c1 + (c0 - c1)) + (c2 + c3)) - c4) + Zero)
-- Code(Expression(13, Add)) at (prev + 4, 13) to (start + 7, 14)
- = (c2 + Zero)
-- Code(Counter(3)) at (prev + 10, 13) to (start + 0, 15)
-- Code(Counter(4)) at (prev + 3, 1) to (start + 0, 2)
-
diff --git a/tests/coverage-map/status-quo/sort_groups.rs b/tests/coverage-map/status-quo/sort_groups.rs
deleted file mode 100644
index f89f9f3ec..000000000
--- a/tests/coverage-map/status-quo/sort_groups.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// compile-flags: --edition=2021
-
-// Demonstrate that `sort_subviews.py` can sort instantiation groups into a
-// predictable order, while preserving their heterogeneous contents.
-
-fn main() {
- let cond = std::env::args().len() > 1;
- generic_fn::<()>(cond);
- generic_fn::<&'static str>(!cond);
- if false {
- generic_fn::<char>(cond);
- }
- generic_fn::<i32>(cond);
- other_fn();
-}
-
-fn generic_fn<T>(cond: bool) {
- if cond {
- println!("{}", std::any::type_name::<T>());
- }
-}
-
-fn other_fn() {}
diff --git a/tests/coverage-map/status-quo/yield.cov-map b/tests/coverage-map/status-quo/yield.cov-map
deleted file mode 100644
index 16caa2db3..000000000
--- a/tests/coverage-map/status-quo/yield.cov-map
+++ /dev/null
@@ -1,72 +0,0 @@
-Function name: yield::main
-Raw bytes (118): 0x[01, 01, 11, 01, 00, 05, 09, 0d, 00, 0d, 11, 32, 15, 0d, 11, 11, 15, 2e, 00, 32, 15, 0d, 11, 2e, 00, 32, 15, 0d, 11, 19, 1d, 21, 00, 25, 29, 2d, 00, 10, 01, 07, 01, 01, 16, 03, 06, 0b, 00, 2e, 0d, 01, 27, 00, 29, 07, 01, 0e, 00, 34, 0b, 02, 0b, 00, 2e, 32, 01, 22, 00, 27, 2e, 00, 2c, 00, 2e, 1b, 01, 0e, 00, 34, 1f, 03, 09, 00, 16, 2b, 07, 0b, 00, 2e, 21, 01, 27, 00, 29, 37, 01, 0e, 00, 34, 3b, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 3f, 01, 0e, 00, 34, 43, 02, 01, 00, 02]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 17
-- expression 0 operands: lhs = Counter(0), rhs = Zero
-- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 2 operands: lhs = Counter(3), rhs = Zero
-- expression 3 operands: lhs = Counter(3), rhs = Counter(4)
-- expression 4 operands: lhs = Expression(12, Sub), rhs = Counter(5)
-- expression 5 operands: lhs = Counter(3), rhs = Counter(4)
-- expression 6 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 7 operands: lhs = Expression(11, Sub), rhs = Zero
-- expression 8 operands: lhs = Expression(12, Sub), rhs = Counter(5)
-- expression 9 operands: lhs = Counter(3), rhs = Counter(4)
-- expression 10 operands: lhs = Expression(11, Sub), rhs = Zero
-- expression 11 operands: lhs = Expression(12, Sub), rhs = Counter(5)
-- expression 12 operands: lhs = Counter(3), rhs = Counter(4)
-- expression 13 operands: lhs = Counter(6), rhs = Counter(7)
-- expression 14 operands: lhs = Counter(8), rhs = Zero
-- expression 15 operands: lhs = Counter(9), rhs = Counter(10)
-- expression 16 operands: lhs = Counter(11), rhs = Zero
-Number of file 0 mappings: 16
-- Code(Counter(0)) at (prev + 7, 1) to (start + 1, 22)
-- Code(Expression(0, Add)) at (prev + 6, 11) to (start + 0, 46)
- = (c0 + Zero)
-- Code(Counter(3)) at (prev + 1, 39) to (start + 0, 41)
-- Code(Expression(1, Add)) at (prev + 1, 14) to (start + 0, 52)
- = (c1 + c2)
-- Code(Expression(2, Add)) at (prev + 2, 11) to (start + 0, 46)
- = (c3 + Zero)
-- Code(Expression(12, Sub)) at (prev + 1, 34) to (start + 0, 39)
- = (c3 - c4)
-- Code(Expression(11, Sub)) at (prev + 0, 44) to (start + 0, 46)
- = ((c3 - c4) - c5)
-- Code(Expression(6, Add)) at (prev + 1, 14) to (start + 0, 52)
- = (c4 + c5)
-- Code(Expression(7, Add)) at (prev + 3, 9) to (start + 0, 22)
- = (((c3 - c4) - c5) + Zero)
-- Code(Expression(10, Add)) at (prev + 7, 11) to (start + 0, 46)
- = (((c3 - c4) - c5) + Zero)
-- Code(Counter(8)) at (prev + 1, 39) to (start + 0, 41)
-- Code(Expression(13, Add)) at (prev + 1, 14) to (start + 0, 52)
- = (c6 + c7)
-- Code(Expression(14, Add)) at (prev + 2, 11) to (start + 0, 46)
- = (c8 + Zero)
-- Code(Counter(11)) at (prev + 1, 39) to (start + 0, 41)
-- Code(Expression(15, Add)) at (prev + 1, 14) to (start + 0, 52)
- = (c9 + c10)
-- Code(Expression(16, Add)) at (prev + 2, 1) to (start + 0, 2)
- = (c11 + Zero)
-
-Function name: yield::main::{closure#0}
-Raw bytes (14): 0x[01, 01, 00, 02, 01, 08, 1c, 01, 10, 05, 02, 10, 01, 06]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 2
-- Code(Counter(0)) at (prev + 8, 28) to (start + 1, 16)
-- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)
-
-Function name: yield::main::{closure#1}
-Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 1c, 01, 10, 05, 02, 09, 00, 10, 09, 01, 09, 00, 10, 0d, 01, 10, 01, 06]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 22, 28) to (start + 1, 16)
-- Code(Counter(1)) at (prev + 2, 9) to (start + 0, 16)
-- Code(Counter(2)) at (prev + 1, 9) to (start + 0, 16)
-- Code(Counter(3)) at (prev + 1, 16) to (start + 1, 6)
-
diff --git a/tests/coverage-map/status-quo/yield.rs b/tests/coverage-map/status-quo/yield.rs
deleted file mode 100644
index 361275c92..000000000
--- a/tests/coverage-map/status-quo/yield.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#![feature(generators, generator_trait)]
-#![allow(unused_assignments)]
-
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
-
-fn main() {
- let mut generator = || {
- yield 1;
- return "foo";
- };
-
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Yielded(1) => {}
- _ => panic!("unexpected value from resume"),
- }
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Complete("foo") => {}
- _ => panic!("unexpected value from resume"),
- }
-
- let mut generator = || {
- yield 1;
- yield 2;
- yield 3;
- return "foo";
- };
-
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Yielded(1) => {}
- _ => panic!("unexpected value from resume"),
- }
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Yielded(2) => {}
- _ => panic!("unexpected value from resume"),
- }
-}
diff --git a/tests/run-coverage-rustdoc/auxiliary/doctest_crate.rs b/tests/coverage-run-rustdoc/auxiliary/doctest_crate.rs
index c3210146d..c3210146d 100644
--- a/tests/run-coverage-rustdoc/auxiliary/doctest_crate.rs
+++ b/tests/coverage-run-rustdoc/auxiliary/doctest_crate.rs
diff --git a/tests/run-coverage-rustdoc/doctest.coverage b/tests/coverage-run-rustdoc/doctest.coverage
index 5797784f4..5797784f4 100644
--- a/tests/run-coverage-rustdoc/doctest.coverage
+++ b/tests/coverage-run-rustdoc/doctest.coverage
diff --git a/tests/run-coverage-rustdoc/doctest.rs b/tests/coverage-run-rustdoc/doctest.rs
index 4006d723c..4006d723c 100644
--- a/tests/run-coverage-rustdoc/doctest.rs
+++ b/tests/coverage-run-rustdoc/doctest.rs
diff --git a/tests/coverage/README.md b/tests/coverage/README.md
new file mode 100644
index 000000000..c72aa69c0
--- /dev/null
+++ b/tests/coverage/README.md
@@ -0,0 +1,16 @@
+The tests in this directory are shared by two different test modes, and can be
+run in multiple different ways:
+
+- `./x.py test coverage-map` (compiles to LLVM IR and checks coverage mappings)
+- `./x.py test coverage-run` (runs a test binary and checks its coverage report)
+- `./x.py test coverage` (runs both `coverage-map` and `coverage-run`)
+
+## Maintenance note
+
+These tests can be sensitive to small changes in MIR spans or MIR control flow,
+especially in HIR-to-MIR lowering or MIR optimizations.
+
+If you haven't touched the coverage code directly, and the tests still pass in
+`coverage-run` mode, then it should usually be OK to just re-bless the mappings
+as necessary with `./x.py test coverage-map --bless`, without worrying too much
+about the exact changes.
diff --git a/tests/coverage-map/status-quo/abort.cov-map b/tests/coverage/abort.cov-map
index 45d3795ef..45d3795ef 100644
--- a/tests/coverage-map/status-quo/abort.cov-map
+++ b/tests/coverage/abort.cov-map
diff --git a/tests/run-coverage/abort.coverage b/tests/coverage/abort.coverage
index ceef63867..ceef63867 100644
--- a/tests/run-coverage/abort.coverage
+++ b/tests/coverage/abort.coverage
diff --git a/tests/coverage-map/status-quo/abort.rs b/tests/coverage/abort.rs
index 98264bdc1..98264bdc1 100644
--- a/tests/coverage-map/status-quo/abort.rs
+++ b/tests/coverage/abort.rs
diff --git a/tests/coverage-map/status-quo/assert.cov-map b/tests/coverage/assert.cov-map
index dd413123d..dd413123d 100644
--- a/tests/coverage-map/status-quo/assert.cov-map
+++ b/tests/coverage/assert.cov-map
diff --git a/tests/run-coverage/assert.coverage b/tests/coverage/assert.coverage
index 8b997724c..8b997724c 100644
--- a/tests/run-coverage/assert.coverage
+++ b/tests/coverage/assert.coverage
diff --git a/tests/coverage-map/status-quo/assert.rs b/tests/coverage/assert.rs
index 85e6662a6..85e6662a6 100644
--- a/tests/coverage-map/status-quo/assert.rs
+++ b/tests/coverage/assert.rs
diff --git a/tests/coverage-map/status-quo/async.cov-map b/tests/coverage/async.cov-map
index 5f28252ef..598791537 100644
--- a/tests/coverage-map/status-quo/async.cov-map
+++ b/tests/coverage/async.cov-map
@@ -38,42 +38,40 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 13, 20) to (start + 0, 25)
Function name: async::e (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 01, 00, 14]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 0f, 01, 00, 14]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 15, 1) to (start + 0, 20)
+- Code(Zero) at (prev + 15, 1) to (start + 0, 20)
Function name: async::e::{closure#0} (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 14, 00, 19]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 0f, 14, 00, 19]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 15, 20) to (start + 0, 25)
+- Code(Zero) at (prev + 15, 20) to (start + 0, 25)
Function name: async::executor::block_on::<core::pin::Pin<&mut async::i::{closure#0}>>
-Raw bytes (44): 0x[01, 01, 05, 0b, 05, 01, 05, 01, 05, 02, 00, 02, 00, 06, 01, 6e, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 0f, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 13, 02, 05, 00, 06]
+Raw bytes (40): 0x[01, 01, 03, 0b, 05, 01, 05, 01, 05, 06, 01, 6e, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 02, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 02, 02, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
+Number of expressions: 3
- expression 0 operands: lhs = Expression(2, Add), rhs = Counter(1)
- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
-- expression 4 operands: lhs = Expression(0, Sub), rhs = Zero
Number of file 0 mappings: 6
- Code(Counter(0)) at (prev + 110, 5) to (start + 10, 54)
- Code(Expression(0, Sub)) at (prev + 13, 32) to (start + 0, 35)
= ((c0 + c1) - c1)
- Code(Expression(2, Add)) at (prev + 0, 39) to (start + 0, 73)
= (c0 + c1)
-- Code(Expression(3, Add)) at (prev + 1, 23) to (start + 0, 26)
- = (((c0 + c1) - c1) + Zero)
+- Code(Expression(0, Sub)) at (prev + 1, 23) to (start + 0, 26)
+ = ((c0 + c1) - c1)
- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 15)
-- Code(Expression(4, Add)) at (prev + 2, 5) to (start + 0, 6)
- = (((c0 + c1) - c1) + Zero)
+- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 6)
+ = ((c0 + c1) - c1)
Function name: async::executor::block_on::VTABLE::{closure#0}
Raw bytes (9): 0x[01, 01, 00, 01, 01, 72, 11, 00, 33]
@@ -124,20 +122,20 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 17, 20) to (start + 0, 25)
Function name: async::foo (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 01, 00, 1e]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 13, 01, 00, 1e]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 19, 1) to (start + 0, 30)
+- Code(Zero) at (prev + 19, 1) to (start + 0, 30)
Function name: async::foo::{closure#0} (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 1e, 00, 2d]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 13, 1e, 00, 2d]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 19, 30) to (start + 0, 45)
+- Code(Zero) at (prev + 19, 30) to (start + 0, 45)
Function name: async::g
Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 00, 17]
@@ -148,14 +146,14 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 21, 1) to (start + 0, 23)
Function name: async::g::{closure#0} (unused)
-Raw bytes (69): 0x[01, 01, 00, 0d, 00, 15, 17, 01, 0c, 00, 02, 09, 00, 0a, 01, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 09, 00, 0a, 00, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
+Raw bytes (69): 0x[01, 01, 00, 0d, 00, 15, 17, 01, 0c, 00, 02, 09, 00, 0a, 00, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 09, 00, 0a, 00, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 13
- Code(Zero) at (prev + 21, 23) to (start + 1, 12)
- Code(Zero) at (prev + 2, 9) to (start + 0, 10)
-- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 17)
+- Code(Zero) at (prev + 0, 14) to (start + 0, 17)
- Code(Zero) at (prev + 0, 18) to (start + 0, 23)
- Code(Zero) at (prev + 0, 27) to (start + 0, 28)
- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
@@ -176,14 +174,14 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 29, 1) to (start + 0, 22)
Function name: async::h::{closure#0} (unused)
-Raw bytes (44): 0x[01, 01, 00, 08, 00, 1d, 16, 03, 0c, 00, 04, 09, 00, 0a, 01, 00, 0e, 00, 13, 00, 00, 14, 00, 19, 00, 00, 1a, 00, 1b, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
+Raw bytes (44): 0x[01, 01, 00, 08, 00, 1d, 16, 03, 0c, 00, 04, 09, 00, 0a, 00, 00, 0e, 00, 13, 00, 00, 14, 00, 19, 00, 00, 1a, 00, 1b, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 8
- Code(Zero) at (prev + 29, 22) to (start + 3, 12)
- Code(Zero) at (prev + 4, 9) to (start + 0, 10)
-- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 19)
+- Code(Zero) at (prev + 0, 14) to (start + 0, 19)
- Code(Zero) at (prev + 0, 20) to (start + 0, 25)
- Code(Zero) at (prev + 0, 26) to (start + 0, 27)
- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
@@ -199,58 +197,46 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 38, 1) to (start + 0, 19)
Function name: async::i::{closure#0}
-Raw bytes (84): 0x[01, 01, 05, 01, 00, 0d, 00, 1d, 00, 19, 13, 1d, 21, 0e, 01, 26, 13, 04, 0c, 0d, 05, 09, 00, 0a, 03, 00, 0e, 00, 12, 05, 00, 13, 00, 18, 09, 00, 1c, 00, 21, 07, 00, 27, 00, 2a, 15, 00, 2b, 00, 30, 1d, 01, 09, 00, 0a, 11, 00, 0e, 00, 11, 25, 00, 12, 00, 17, 29, 00, 1b, 00, 20, 0b, 00, 24, 00, 26, 21, 01, 0e, 00, 10, 0f, 02, 01, 00, 02]
+Raw bytes (78): 0x[01, 01, 02, 19, 07, 1d, 21, 0e, 01, 26, 13, 04, 0c, 0d, 05, 09, 00, 0a, 01, 00, 0e, 00, 12, 05, 00, 13, 00, 18, 09, 00, 1c, 00, 21, 0d, 00, 27, 00, 2a, 15, 00, 2b, 00, 30, 1d, 01, 09, 00, 0a, 11, 00, 0e, 00, 11, 25, 00, 12, 00, 17, 29, 00, 1b, 00, 20, 1d, 00, 24, 00, 26, 21, 01, 0e, 00, 10, 03, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
-- expression 0 operands: lhs = Counter(0), rhs = Zero
-- expression 1 operands: lhs = Counter(3), rhs = Zero
-- expression 2 operands: lhs = Counter(7), rhs = Zero
-- expression 3 operands: lhs = Counter(6), rhs = Expression(4, Add)
-- expression 4 operands: lhs = Counter(7), rhs = Counter(8)
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(6), rhs = Expression(1, Add)
+- expression 1 operands: lhs = Counter(7), rhs = Counter(8)
Number of file 0 mappings: 14
- Code(Counter(0)) at (prev + 38, 19) to (start + 4, 12)
- Code(Counter(3)) at (prev + 5, 9) to (start + 0, 10)
-- Code(Expression(0, Add)) at (prev + 0, 14) to (start + 0, 18)
- = (c0 + Zero)
+- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 18)
- Code(Counter(1)) at (prev + 0, 19) to (start + 0, 24)
- Code(Counter(2)) at (prev + 0, 28) to (start + 0, 33)
-- Code(Expression(1, Add)) at (prev + 0, 39) to (start + 0, 42)
- = (c3 + Zero)
+- Code(Counter(3)) at (prev + 0, 39) to (start + 0, 42)
- Code(Counter(5)) at (prev + 0, 43) to (start + 0, 48)
- Code(Counter(7)) at (prev + 1, 9) to (start + 0, 10)
- Code(Counter(4)) at (prev + 0, 14) to (start + 0, 17)
- Code(Counter(9)) at (prev + 0, 18) to (start + 0, 23)
- Code(Counter(10)) at (prev + 0, 27) to (start + 0, 32)
-- Code(Expression(2, Add)) at (prev + 0, 36) to (start + 0, 38)
- = (c7 + Zero)
+- Code(Counter(7)) at (prev + 0, 36) to (start + 0, 38)
- Code(Counter(8)) at (prev + 1, 14) to (start + 0, 16)
-- Code(Expression(3, Add)) at (prev + 2, 1) to (start + 0, 2)
+- Code(Expression(0, Add)) at (prev + 2, 1) to (start + 0, 2)
= (c6 + (c7 + c8))
Function name: async::j
-Raw bytes (59): 0x[01, 01, 05, 01, 00, 05, 00, 09, 00, 05, 13, 09, 0d, 09, 01, 31, 01, 13, 0c, 05, 14, 09, 00, 0a, 03, 00, 0e, 00, 1b, 07, 00, 1f, 00, 27, 09, 01, 09, 00, 0a, 11, 00, 0e, 00, 1a, 0b, 00, 1e, 00, 20, 0d, 01, 0e, 00, 10, 0f, 02, 01, 00, 02]
+Raw bytes (53): 0x[01, 01, 02, 05, 07, 09, 0d, 09, 01, 31, 01, 13, 0c, 05, 14, 09, 00, 0a, 01, 00, 0e, 00, 1b, 05, 00, 1f, 00, 27, 09, 01, 09, 00, 0a, 11, 00, 0e, 00, 1a, 09, 00, 1e, 00, 20, 0d, 01, 0e, 00, 10, 03, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
-- expression 0 operands: lhs = Counter(0), rhs = Zero
-- expression 1 operands: lhs = Counter(1), rhs = Zero
-- expression 2 operands: lhs = Counter(2), rhs = Zero
-- expression 3 operands: lhs = Counter(1), rhs = Expression(4, Add)
-- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(1), rhs = Expression(1, Add)
+- expression 1 operands: lhs = Counter(2), rhs = Counter(3)
Number of file 0 mappings: 9
- Code(Counter(0)) at (prev + 49, 1) to (start + 19, 12)
- Code(Counter(1)) at (prev + 20, 9) to (start + 0, 10)
-- Code(Expression(0, Add)) at (prev + 0, 14) to (start + 0, 27)
- = (c0 + Zero)
-- Code(Expression(1, Add)) at (prev + 0, 31) to (start + 0, 39)
- = (c1 + Zero)
+- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 27)
+- Code(Counter(1)) at (prev + 0, 31) to (start + 0, 39)
- Code(Counter(2)) at (prev + 1, 9) to (start + 0, 10)
- Code(Counter(4)) at (prev + 0, 14) to (start + 0, 26)
-- Code(Expression(2, Add)) at (prev + 0, 30) to (start + 0, 32)
- = (c2 + Zero)
+- Code(Counter(2)) at (prev + 0, 30) to (start + 0, 32)
- Code(Counter(3)) at (prev + 1, 14) to (start + 0, 16)
-- Code(Expression(3, Add)) at (prev + 2, 1) to (start + 0, 2)
+- Code(Expression(0, Add)) at (prev + 2, 1) to (start + 0, 2)
= (c1 + (c2 + c3))
Function name: async::j::c
@@ -285,12 +271,12 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 67, 5) to (start + 0, 23)
Function name: async::k (unused)
-Raw bytes (29): 0x[01, 01, 00, 05, 01, 4b, 01, 01, 0c, 00, 02, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
+Raw bytes (29): 0x[01, 01, 00, 05, 00, 4b, 01, 01, 0c, 00, 02, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 5
-- Code(Counter(0)) at (prev + 75, 1) to (start + 1, 12)
+- Code(Zero) at (prev + 75, 1) to (start + 1, 12)
- Code(Zero) at (prev + 2, 14) to (start + 0, 16)
- Code(Zero) at (prev + 1, 14) to (start + 0, 16)
- Code(Zero) at (prev + 1, 14) to (start + 0, 16)
@@ -323,12 +309,12 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 91, 1) to (start + 0, 25)
Function name: async::m::{closure#0} (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 5b, 19, 00, 22]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 5b, 19, 00, 22]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 91, 25) to (start + 0, 34)
+- Code(Zero) at (prev + 91, 25) to (start + 0, 34)
Function name: async::main
Raw bytes (9): 0x[01, 01, 00, 01, 01, 5d, 01, 08, 02]
diff --git a/tests/run-coverage/async.coverage b/tests/coverage/async.coverage
index 07bc16c2d..07bc16c2d 100644
--- a/tests/run-coverage/async.coverage
+++ b/tests/coverage/async.coverage
diff --git a/tests/coverage-map/status-quo/async.rs b/tests/coverage/async.rs
index efd9e62d6..efd9e62d6 100644
--- a/tests/coverage-map/status-quo/async.rs
+++ b/tests/coverage/async.rs
diff --git a/tests/coverage-map/status-quo/async2.cov-map b/tests/coverage/async2.cov-map
index fe74dcd88..cc7aed9ae 100644
--- a/tests/coverage-map/status-quo/async2.cov-map
+++ b/tests/coverage/async2.cov-map
@@ -38,48 +38,44 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 19, 36) to (start + 2, 2)
Function name: async2::executor::block_on::<async2::async_func::{closure#0}>
-Raw bytes (44): 0x[01, 01, 05, 0b, 05, 01, 05, 01, 05, 02, 00, 02, 00, 06, 01, 27, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 0f, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 13, 02, 05, 00, 06]
+Raw bytes (40): 0x[01, 01, 03, 0b, 05, 01, 05, 01, 05, 06, 01, 27, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 02, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 02, 02, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
+Number of expressions: 3
- expression 0 operands: lhs = Expression(2, Add), rhs = Counter(1)
- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
-- expression 4 operands: lhs = Expression(0, Sub), rhs = Zero
Number of file 0 mappings: 6
- Code(Counter(0)) at (prev + 39, 5) to (start + 10, 54)
- Code(Expression(0, Sub)) at (prev + 13, 32) to (start + 0, 35)
= ((c0 + c1) - c1)
- Code(Expression(2, Add)) at (prev + 0, 39) to (start + 0, 73)
= (c0 + c1)
-- Code(Expression(3, Add)) at (prev + 1, 23) to (start + 0, 26)
- = (((c0 + c1) - c1) + Zero)
+- Code(Expression(0, Sub)) at (prev + 1, 23) to (start + 0, 26)
+ = ((c0 + c1) - c1)
- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 15)
-- Code(Expression(4, Add)) at (prev + 2, 5) to (start + 0, 6)
- = (((c0 + c1) - c1) + Zero)
+- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 6)
+ = ((c0 + c1) - c1)
Function name: async2::executor::block_on::<async2::async_func_just_println::{closure#0}>
-Raw bytes (44): 0x[01, 01, 05, 0b, 05, 01, 05, 01, 05, 02, 00, 02, 00, 06, 01, 27, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 0f, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 13, 02, 05, 00, 06]
+Raw bytes (40): 0x[01, 01, 03, 0b, 05, 01, 05, 01, 05, 06, 01, 27, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 02, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 02, 02, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
+Number of expressions: 3
- expression 0 operands: lhs = Expression(2, Add), rhs = Counter(1)
- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
-- expression 4 operands: lhs = Expression(0, Sub), rhs = Zero
Number of file 0 mappings: 6
- Code(Counter(0)) at (prev + 39, 5) to (start + 10, 54)
- Code(Expression(0, Sub)) at (prev + 13, 32) to (start + 0, 35)
= ((c0 + c1) - c1)
- Code(Expression(2, Add)) at (prev + 0, 39) to (start + 0, 73)
= (c0 + c1)
-- Code(Expression(3, Add)) at (prev + 1, 23) to (start + 0, 26)
- = (((c0 + c1) - c1) + Zero)
+- Code(Expression(0, Sub)) at (prev + 1, 23) to (start + 0, 26)
+ = ((c0 + c1) - c1)
- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 15)
-- Code(Expression(4, Add)) at (prev + 2, 5) to (start + 0, 6)
- = (((c0 + c1) - c1) + Zero)
+- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 6)
+ = ((c0 + c1) - c1)
Function name: async2::executor::block_on::VTABLE::{closure#0}
Raw bytes (9): 0x[01, 01, 00, 01, 01, 2b, 11, 00, 33]
diff --git a/tests/run-coverage/async2.coverage b/tests/coverage/async2.coverage
index fcb0a3aed..fcb0a3aed 100644
--- a/tests/run-coverage/async2.coverage
+++ b/tests/coverage/async2.coverage
diff --git a/tests/coverage-map/status-quo/async2.rs b/tests/coverage/async2.rs
index 2884ff297..2884ff297 100644
--- a/tests/coverage-map/status-quo/async2.rs
+++ b/tests/coverage/async2.rs
diff --git a/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs b/tests/coverage/auxiliary/inline_always_with_dead_code.rs
index 9dc50dae2..9dc50dae2 100644
--- a/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs
+++ b/tests/coverage/auxiliary/inline_always_with_dead_code.rs
diff --git a/tests/run-coverage/auxiliary/macro_name_span_helper.rs b/tests/coverage/auxiliary/macro_name_span_helper.rs
index 6797c081d..6797c081d 100644
--- a/tests/run-coverage/auxiliary/macro_name_span_helper.rs
+++ b/tests/coverage/auxiliary/macro_name_span_helper.rs
diff --git a/tests/run-coverage/auxiliary/unused_mod_helper.rs b/tests/coverage/auxiliary/unused_mod_helper.rs
index 88c5dac65..88c5dac65 100644
--- a/tests/run-coverage/auxiliary/unused_mod_helper.rs
+++ b/tests/coverage/auxiliary/unused_mod_helper.rs
diff --git a/tests/run-coverage/auxiliary/used_crate.rs b/tests/coverage/auxiliary/used_crate.rs
index c086ef21e..c086ef21e 100644
--- a/tests/run-coverage/auxiliary/used_crate.rs
+++ b/tests/coverage/auxiliary/used_crate.rs
diff --git a/tests/run-coverage/auxiliary/used_inline_crate.rs b/tests/coverage/auxiliary/used_inline_crate.rs
index e8929de6b..e8929de6b 100644
--- a/tests/run-coverage/auxiliary/used_inline_crate.rs
+++ b/tests/coverage/auxiliary/used_inline_crate.rs
diff --git a/tests/coverage/bad_counter_ids.cov-map b/tests/coverage/bad_counter_ids.cov-map
new file mode 100644
index 000000000..0b8081acf
--- /dev/null
+++ b/tests/coverage/bad_counter_ids.cov-map
@@ -0,0 +1,98 @@
+Function name: <bad_counter_ids::Foo as core::cmp::PartialEq>::eq
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 11, 00, 1a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 12, 17) to (start + 0, 26)
+
+Function name: <bad_counter_ids::Foo as core::fmt::Debug>::fmt
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 0a, 00, 0f]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 12, 10) to (start + 0, 15)
+
+Function name: bad_counter_ids::eq_bad
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 23, 01, 02, 1f, 00, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 35, 1) to (start + 2, 31)
+- Code(Zero) at (prev + 3, 1) to (start + 0, 2)
+
+Function name: bad_counter_ids::eq_bad_message
+Raw bytes (21): 0x[01, 01, 01, 01, 00, 03, 01, 28, 01, 02, 0f, 02, 02, 20, 00, 2b, 00, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 40, 1) to (start + 2, 15)
+- Code(Expression(0, Sub)) at (prev + 2, 32) to (start + 0, 43)
+ = (c0 - Zero)
+- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
+
+Function name: bad_counter_ids::eq_good
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 0f, 01, 02, 1f, 05, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 15, 1) to (start + 2, 31)
+- Code(Counter(1)) at (prev + 3, 1) to (start + 0, 2)
+
+Function name: bad_counter_ids::eq_good_message
+Raw bytes (19): 0x[01, 01, 00, 03, 01, 14, 01, 02, 0f, 00, 02, 20, 00, 2b, 05, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 20, 1) to (start + 2, 15)
+- Code(Zero) at (prev + 2, 32) to (start + 0, 43)
+- Code(Counter(1)) at (prev + 1, 1) to (start + 0, 2)
+
+Function name: bad_counter_ids::ne_bad
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 2d, 01, 02, 1f, 00, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 45, 1) to (start + 2, 31)
+- Code(Zero) at (prev + 3, 1) to (start + 0, 2)
+
+Function name: bad_counter_ids::ne_bad_message
+Raw bytes (19): 0x[01, 01, 00, 03, 01, 32, 01, 02, 0f, 05, 02, 20, 00, 2b, 00, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 50, 1) to (start + 2, 15)
+- Code(Counter(1)) at (prev + 2, 32) to (start + 0, 43)
+- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
+
+Function name: bad_counter_ids::ne_good
+Raw bytes (16): 0x[01, 01, 01, 01, 00, 02, 01, 19, 01, 02, 1f, 02, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 25, 1) to (start + 2, 31)
+- Code(Expression(0, Sub)) at (prev + 3, 1) to (start + 0, 2)
+ = (c0 - Zero)
+
+Function name: bad_counter_ids::ne_good_message
+Raw bytes (21): 0x[01, 01, 01, 01, 00, 03, 01, 1e, 01, 02, 0f, 00, 02, 20, 00, 2b, 02, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 1
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 30, 1) to (start + 2, 15)
+- Code(Zero) at (prev + 2, 32) to (start + 0, 43)
+- Code(Expression(0, Sub)) at (prev + 1, 1) to (start + 0, 2)
+ = (c0 - Zero)
+
diff --git a/tests/coverage/bad_counter_ids.coverage b/tests/coverage/bad_counter_ids.coverage
new file mode 100644
index 000000000..d69ebf160
--- /dev/null
+++ b/tests/coverage/bad_counter_ids.coverage
@@ -0,0 +1,69 @@
+ LL| |#![feature(coverage_attribute)]
+ LL| |// compile-flags: --edition=2021 -Copt-level=0 -Zmir-opt-level=3
+ LL| |
+ LL| |// Regression test for <https://github.com/rust-lang/rust/issues/117012>.
+ LL| |//
+ LL| |// If some coverage counters were removed by MIR optimizations, we need to take
+ LL| |// care not to refer to those counter IDs in coverage mappings, and instead
+ LL| |// replace them with a constant zero value. If we don't, `llvm-cov` might see
+ LL| |// a too-large counter ID and silently discard the entire function from its
+ LL| |// coverage reports.
+ LL| |
+ LL| 8|#[derive(Debug, PartialEq, Eq)]
+ LL| |struct Foo(u32);
+ LL| |
+ LL| 1|fn eq_good() {
+ LL| 1| println!("a");
+ LL| 1| assert_eq!(Foo(1), Foo(1));
+ LL| 1|}
+ LL| |
+ LL| 1|fn eq_good_message() {
+ LL| 1| println!("b");
+ LL| 1| assert_eq!(Foo(1), Foo(1), "message b");
+ ^0
+ LL| 1|}
+ LL| |
+ LL| 1|fn ne_good() {
+ LL| 1| println!("c");
+ LL| 1| assert_ne!(Foo(1), Foo(3));
+ LL| 1|}
+ LL| |
+ LL| 1|fn ne_good_message() {
+ LL| 1| println!("d");
+ LL| 1| assert_ne!(Foo(1), Foo(3), "message d");
+ ^0
+ LL| 1|}
+ LL| |
+ LL| 1|fn eq_bad() {
+ LL| 1| println!("e");
+ LL| 1| assert_eq!(Foo(1), Foo(3));
+ LL| 0|}
+ LL| |
+ LL| 1|fn eq_bad_message() {
+ LL| 1| println!("f");
+ LL| 1| assert_eq!(Foo(1), Foo(3), "message f");
+ LL| 0|}
+ LL| |
+ LL| 1|fn ne_bad() {
+ LL| 1| println!("g");
+ LL| 1| assert_ne!(Foo(1), Foo(1));
+ LL| 0|}
+ LL| |
+ LL| 1|fn ne_bad_message() {
+ LL| 1| println!("h");
+ LL| 1| assert_ne!(Foo(1), Foo(1), "message h");
+ LL| 0|}
+ LL| |
+ LL| |#[coverage(off)]
+ LL| |fn main() {
+ LL| | eq_good();
+ LL| | eq_good_message();
+ LL| | ne_good();
+ LL| | ne_good_message();
+ LL| |
+ LL| | assert!(std::panic::catch_unwind(eq_bad).is_err());
+ LL| | assert!(std::panic::catch_unwind(eq_bad_message).is_err());
+ LL| | assert!(std::panic::catch_unwind(ne_bad).is_err());
+ LL| | assert!(std::panic::catch_unwind(ne_bad_message).is_err());
+ LL| |}
+
diff --git a/tests/coverage/bad_counter_ids.rs b/tests/coverage/bad_counter_ids.rs
new file mode 100644
index 000000000..ef5460102
--- /dev/null
+++ b/tests/coverage/bad_counter_ids.rs
@@ -0,0 +1,66 @@
+#![feature(coverage_attribute)]
+// compile-flags: --edition=2021 -Copt-level=0 -Zmir-opt-level=3
+
+// Regression test for <https://github.com/rust-lang/rust/issues/117012>.
+//
+// If some coverage counters were removed by MIR optimizations, we need to take
+// care not to refer to those counter IDs in coverage mappings, and instead
+// replace them with a constant zero value. If we don't, `llvm-cov` might see
+// a too-large counter ID and silently discard the entire function from its
+// coverage reports.
+
+#[derive(Debug, PartialEq, Eq)]
+struct Foo(u32);
+
+fn eq_good() {
+ println!("a");
+ assert_eq!(Foo(1), Foo(1));
+}
+
+fn eq_good_message() {
+ println!("b");
+ assert_eq!(Foo(1), Foo(1), "message b");
+}
+
+fn ne_good() {
+ println!("c");
+ assert_ne!(Foo(1), Foo(3));
+}
+
+fn ne_good_message() {
+ println!("d");
+ assert_ne!(Foo(1), Foo(3), "message d");
+}
+
+fn eq_bad() {
+ println!("e");
+ assert_eq!(Foo(1), Foo(3));
+}
+
+fn eq_bad_message() {
+ println!("f");
+ assert_eq!(Foo(1), Foo(3), "message f");
+}
+
+fn ne_bad() {
+ println!("g");
+ assert_ne!(Foo(1), Foo(1));
+}
+
+fn ne_bad_message() {
+ println!("h");
+ assert_ne!(Foo(1), Foo(1), "message h");
+}
+
+#[coverage(off)]
+fn main() {
+ eq_good();
+ eq_good_message();
+ ne_good();
+ ne_good_message();
+
+ assert!(std::panic::catch_unwind(eq_bad).is_err());
+ assert!(std::panic::catch_unwind(eq_bad_message).is_err());
+ assert!(std::panic::catch_unwind(ne_bad).is_err());
+ assert!(std::panic::catch_unwind(ne_bad_message).is_err());
+}
diff --git a/tests/coverage-map/status-quo/closure.cov-map b/tests/coverage/closure.cov-map
index 7dbf6ec83..522c1e73a 100644
--- a/tests/coverage-map/status-quo/closure.cov-map
+++ b/tests/coverage/closure.cov-map
@@ -1,77 +1,36 @@
Function name: closure::main
-Raw bytes (170): 0x[01, 01, 17, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 00, 01, 05, 05, 5a, 01, 05, 18, 01, 08, 01, 0f, 0d, 03, 16, 0e, 06, 0a, 07, 10, 05, 13, 0d, 0b, 1a, 0e, 06, 0a, 0f, 10, 05, 0c, 16, 13, 16, 05, 0d, 18, 17, 19, 09, 01, 1e, 1b, 04, 09, 00, 29, 1f, 01, 09, 00, 2d, 23, 01, 09, 00, 24, 27, 05, 09, 00, 24, 2b, 02, 09, 00, 21, 2f, 04, 09, 00, 21, 33, 04, 09, 00, 28, 37, 09, 09, 00, 32, 3b, 04, 09, 00, 33, 3f, 07, 09, 00, 4b, 43, 08, 09, 00, 48, 47, 0a, 09, 00, 47, 4b, 08, 09, 00, 44, 4f, 0a, 08, 00, 10, 05, 00, 11, 04, 06, 5a, 04, 06, 00, 07, 57, 01, 05, 03, 02]
+Raw bytes (128): 0x[01, 01, 02, 01, 05, 05, 02, 18, 01, 08, 01, 0f, 0d, 01, 16, 0e, 06, 0a, 01, 10, 05, 13, 0d, 01, 1a, 0e, 06, 0a, 01, 10, 05, 0c, 16, 01, 16, 05, 0d, 18, 01, 19, 09, 01, 1e, 01, 04, 09, 00, 29, 01, 01, 09, 00, 2d, 01, 01, 09, 00, 24, 01, 05, 09, 00, 24, 01, 02, 09, 00, 21, 01, 04, 09, 00, 21, 01, 04, 09, 00, 28, 01, 09, 09, 00, 32, 01, 04, 09, 00, 33, 01, 07, 09, 00, 4b, 01, 08, 09, 00, 48, 01, 0a, 09, 00, 47, 01, 08, 09, 00, 44, 01, 0a, 08, 00, 10, 05, 00, 11, 04, 06, 02, 04, 06, 00, 07, 07, 01, 05, 03, 02]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 23
-- expression 0 operands: lhs = Counter(0), rhs = Zero
-- expression 1 operands: lhs = Counter(0), rhs = Zero
-- expression 2 operands: lhs = Counter(0), rhs = Zero
-- expression 3 operands: lhs = Counter(0), rhs = Zero
-- expression 4 operands: lhs = Counter(0), rhs = Zero
-- expression 5 operands: lhs = Counter(0), rhs = Zero
-- expression 6 operands: lhs = Counter(0), rhs = Zero
-- expression 7 operands: lhs = Counter(0), rhs = Zero
-- expression 8 operands: lhs = Counter(0), rhs = Zero
-- expression 9 operands: lhs = Counter(0), rhs = Zero
-- expression 10 operands: lhs = Counter(0), rhs = Zero
-- expression 11 operands: lhs = Counter(0), rhs = Zero
-- expression 12 operands: lhs = Counter(0), rhs = Zero
-- expression 13 operands: lhs = Counter(0), rhs = Zero
-- expression 14 operands: lhs = Counter(0), rhs = Zero
-- expression 15 operands: lhs = Counter(0), rhs = Zero
-- expression 16 operands: lhs = Counter(0), rhs = Zero
-- expression 17 operands: lhs = Counter(0), rhs = Zero
-- expression 18 operands: lhs = Counter(0), rhs = Zero
-- expression 19 operands: lhs = Counter(0), rhs = Zero
-- expression 20 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 21 operands: lhs = Counter(1), rhs = Expression(22, Sub)
-- expression 22 operands: lhs = Counter(0), rhs = Counter(1)
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 24
- Code(Counter(0)) at (prev + 8, 1) to (start + 15, 13)
-- Code(Expression(0, Add)) at (prev + 22, 14) to (start + 6, 10)
- = (c0 + Zero)
-- Code(Expression(1, Add)) at (prev + 16, 5) to (start + 19, 13)
- = (c0 + Zero)
-- Code(Expression(2, Add)) at (prev + 26, 14) to (start + 6, 10)
- = (c0 + Zero)
-- Code(Expression(3, Add)) at (prev + 16, 5) to (start + 12, 22)
- = (c0 + Zero)
-- Code(Expression(4, Add)) at (prev + 22, 5) to (start + 13, 24)
- = (c0 + Zero)
-- Code(Expression(5, Add)) at (prev + 25, 9) to (start + 1, 30)
- = (c0 + Zero)
-- Code(Expression(6, Add)) at (prev + 4, 9) to (start + 0, 41)
- = (c0 + Zero)
-- Code(Expression(7, Add)) at (prev + 1, 9) to (start + 0, 45)
- = (c0 + Zero)
-- Code(Expression(8, Add)) at (prev + 1, 9) to (start + 0, 36)
- = (c0 + Zero)
-- Code(Expression(9, Add)) at (prev + 5, 9) to (start + 0, 36)
- = (c0 + Zero)
-- Code(Expression(10, Add)) at (prev + 2, 9) to (start + 0, 33)
- = (c0 + Zero)
-- Code(Expression(11, Add)) at (prev + 4, 9) to (start + 0, 33)
- = (c0 + Zero)
-- Code(Expression(12, Add)) at (prev + 4, 9) to (start + 0, 40)
- = (c0 + Zero)
-- Code(Expression(13, Add)) at (prev + 9, 9) to (start + 0, 50)
- = (c0 + Zero)
-- Code(Expression(14, Add)) at (prev + 4, 9) to (start + 0, 51)
- = (c0 + Zero)
-- Code(Expression(15, Add)) at (prev + 7, 9) to (start + 0, 75)
- = (c0 + Zero)
-- Code(Expression(16, Add)) at (prev + 8, 9) to (start + 0, 72)
- = (c0 + Zero)
-- Code(Expression(17, Add)) at (prev + 10, 9) to (start + 0, 71)
- = (c0 + Zero)
-- Code(Expression(18, Add)) at (prev + 8, 9) to (start + 0, 68)
- = (c0 + Zero)
-- Code(Expression(19, Add)) at (prev + 10, 8) to (start + 0, 16)
- = (c0 + Zero)
+- Code(Counter(0)) at (prev + 22, 14) to (start + 6, 10)
+- Code(Counter(0)) at (prev + 16, 5) to (start + 19, 13)
+- Code(Counter(0)) at (prev + 26, 14) to (start + 6, 10)
+- Code(Counter(0)) at (prev + 16, 5) to (start + 12, 22)
+- Code(Counter(0)) at (prev + 22, 5) to (start + 13, 24)
+- Code(Counter(0)) at (prev + 25, 9) to (start + 1, 30)
+- Code(Counter(0)) at (prev + 4, 9) to (start + 0, 41)
+- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 45)
+- Code(Counter(0)) at (prev + 1, 9) to (start + 0, 36)
+- Code(Counter(0)) at (prev + 5, 9) to (start + 0, 36)
+- Code(Counter(0)) at (prev + 2, 9) to (start + 0, 33)
+- Code(Counter(0)) at (prev + 4, 9) to (start + 0, 33)
+- Code(Counter(0)) at (prev + 4, 9) to (start + 0, 40)
+- Code(Counter(0)) at (prev + 9, 9) to (start + 0, 50)
+- Code(Counter(0)) at (prev + 4, 9) to (start + 0, 51)
+- Code(Counter(0)) at (prev + 7, 9) to (start + 0, 75)
+- Code(Counter(0)) at (prev + 8, 9) to (start + 0, 72)
+- Code(Counter(0)) at (prev + 10, 9) to (start + 0, 71)
+- Code(Counter(0)) at (prev + 8, 9) to (start + 0, 68)
+- Code(Counter(0)) at (prev + 10, 8) to (start + 0, 16)
- Code(Counter(1)) at (prev + 0, 17) to (start + 4, 6)
-- Code(Expression(22, Sub)) at (prev + 4, 6) to (start + 0, 7)
+- Code(Expression(0, Sub)) at (prev + 4, 6) to (start + 0, 7)
= (c0 - c1)
-- Code(Expression(21, Add)) at (prev + 1, 5) to (start + 3, 2)
+- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 3, 2)
= (c1 + (c0 - c1))
Function name: closure::main::{closure#0}
@@ -90,46 +49,45 @@ Number of file 0 mappings: 4
= (c1 + (c0 - c1))
Function name: closure::main::{closure#10} (unused)
-Raw bytes (10): 0x[01, 01, 00, 01, 01, 9a, 01, 07, 00, 21]
+Raw bytes (10): 0x[01, 01, 00, 01, 00, 9a, 01, 07, 00, 21]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 154, 7) to (start + 0, 33)
+- Code(Zero) at (prev + 154, 7) to (start + 0, 33)
Function name: closure::main::{closure#11} (unused)
-Raw bytes (10): 0x[01, 01, 00, 01, 01, 9e, 01, 07, 00, 21]
+Raw bytes (10): 0x[01, 01, 00, 01, 00, 9e, 01, 07, 00, 21]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 158, 7) to (start + 0, 33)
+- Code(Zero) at (prev + 158, 7) to (start + 0, 33)
Function name: closure::main::{closure#12} (unused)
-Raw bytes (10): 0x[01, 01, 00, 01, 01, a6, 01, 01, 00, 17]
+Raw bytes (10): 0x[01, 01, 00, 01, 00, a6, 01, 01, 00, 17]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 166, 1) to (start + 0, 23)
+- Code(Zero) at (prev + 166, 1) to (start + 0, 23)
Function name: closure::main::{closure#13} (unused)
-Raw bytes (10): 0x[01, 01, 00, 01, 01, ab, 01, 0d, 02, 0e]
+Raw bytes (10): 0x[01, 01, 00, 01, 00, ab, 01, 0d, 02, 0e]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 171, 13) to (start + 2, 14)
+- Code(Zero) at (prev + 171, 13) to (start + 2, 14)
Function name: closure::main::{closure#14}
-Raw bytes (38): 0x[01, 01, 04, 05, 0a, 01, 05, 01, 05, 03, 00, 05, 03, b2, 01, 0d, 00, 15, 01, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0a, 00, 2f, 00, 33, 0f, 01, 0d, 00, 0e]
+Raw bytes (36): 0x[01, 01, 03, 05, 0a, 01, 05, 01, 05, 05, 03, b2, 01, 0d, 00, 15, 01, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0a, 00, 2f, 00, 33, 03, 01, 0d, 00, 0e]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 4
+Number of expressions: 3
- expression 0 operands: lhs = Counter(1), rhs = Expression(2, Sub)
- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 3 operands: lhs = Expression(0, Add), rhs = Zero
Number of file 0 mappings: 5
- Code(Expression(0, Add)) at (prev + 178, 13) to (start + 0, 21)
= (c1 + (c0 - c1))
@@ -137,40 +95,36 @@ Number of file 0 mappings: 5
- Code(Counter(1)) at (prev + 1, 30) to (start + 0, 37)
- Code(Expression(2, Sub)) at (prev + 0, 47) to (start + 0, 51)
= (c0 - c1)
-- Code(Expression(3, Add)) at (prev + 1, 13) to (start + 0, 14)
- = ((c1 + (c0 - c1)) + Zero)
+- Code(Expression(0, Add)) at (prev + 1, 13) to (start + 0, 14)
+ = (c1 + (c0 - c1))
Function name: closure::main::{closure#15}
-Raw bytes (45): 0x[01, 01, 05, 05, 0e, 01, 05, 01, 00, 01, 05, 03, 00, 06, 01, ba, 01, 09, 00, 0a, 03, 01, 0d, 00, 15, 0b, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0e, 00, 2f, 00, 33, 13, 02, 09, 00, 0a]
+Raw bytes (41): 0x[01, 01, 03, 05, 0a, 01, 05, 01, 05, 06, 01, ba, 01, 09, 00, 0a, 03, 01, 0d, 00, 15, 01, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0a, 00, 2f, 00, 33, 03, 02, 09, 00, 0a]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
-- expression 0 operands: lhs = Counter(1), rhs = Expression(3, Sub)
+Number of expressions: 3
+- expression 0 operands: lhs = Counter(1), rhs = Expression(2, Sub)
- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 2 operands: lhs = Counter(0), rhs = Zero
-- expression 3 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 4 operands: lhs = Expression(0, Add), rhs = Zero
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
Number of file 0 mappings: 6
- Code(Counter(0)) at (prev + 186, 9) to (start + 0, 10)
- Code(Expression(0, Add)) at (prev + 1, 13) to (start + 0, 21)
= (c1 + (c0 - c1))
-- Code(Expression(2, Add)) at (prev + 1, 17) to (start + 1, 27)
- = (c0 + Zero)
+- Code(Counter(0)) at (prev + 1, 17) to (start + 1, 27)
- Code(Counter(1)) at (prev + 1, 30) to (start + 0, 37)
-- Code(Expression(3, Sub)) at (prev + 0, 47) to (start + 0, 51)
+- Code(Expression(2, Sub)) at (prev + 0, 47) to (start + 0, 51)
= (c0 - c1)
-- Code(Expression(4, Add)) at (prev + 2, 9) to (start + 0, 10)
- = ((c1 + (c0 - c1)) + Zero)
+- Code(Expression(0, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c1 + (c0 - c1))
Function name: closure::main::{closure#16}
-Raw bytes (38): 0x[01, 01, 04, 05, 0a, 01, 05, 01, 05, 03, 00, 05, 03, c4, 01, 0d, 00, 15, 01, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0a, 00, 2f, 00, 33, 0f, 01, 0d, 00, 0e]
+Raw bytes (36): 0x[01, 01, 03, 05, 0a, 01, 05, 01, 05, 05, 03, c4, 01, 0d, 00, 15, 01, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0a, 00, 2f, 00, 33, 03, 01, 0d, 00, 0e]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 4
+Number of expressions: 3
- expression 0 operands: lhs = Counter(1), rhs = Expression(2, Sub)
- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 3 operands: lhs = Expression(0, Add), rhs = Zero
Number of file 0 mappings: 5
- Code(Expression(0, Add)) at (prev + 196, 13) to (start + 0, 21)
= (c1 + (c0 - c1))
@@ -178,30 +132,27 @@ Number of file 0 mappings: 5
- Code(Counter(1)) at (prev + 1, 30) to (start + 0, 37)
- Code(Expression(2, Sub)) at (prev + 0, 47) to (start + 0, 51)
= (c0 - c1)
-- Code(Expression(3, Add)) at (prev + 1, 13) to (start + 0, 14)
- = ((c1 + (c0 - c1)) + Zero)
+- Code(Expression(0, Add)) at (prev + 1, 13) to (start + 0, 14)
+ = (c1 + (c0 - c1))
Function name: closure::main::{closure#17}
-Raw bytes (45): 0x[01, 01, 05, 05, 0e, 01, 05, 01, 00, 01, 05, 03, 00, 06, 01, cc, 01, 09, 00, 0a, 03, 01, 0d, 00, 15, 0b, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0e, 00, 2f, 00, 33, 13, 02, 09, 00, 0a]
+Raw bytes (41): 0x[01, 01, 03, 05, 0a, 01, 05, 01, 05, 06, 01, cc, 01, 09, 00, 0a, 03, 01, 0d, 00, 15, 01, 01, 11, 01, 1b, 05, 01, 1e, 00, 25, 0a, 00, 2f, 00, 33, 03, 02, 09, 00, 0a]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
-- expression 0 operands: lhs = Counter(1), rhs = Expression(3, Sub)
+Number of expressions: 3
+- expression 0 operands: lhs = Counter(1), rhs = Expression(2, Sub)
- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 2 operands: lhs = Counter(0), rhs = Zero
-- expression 3 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 4 operands: lhs = Expression(0, Add), rhs = Zero
+- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
Number of file 0 mappings: 6
- Code(Counter(0)) at (prev + 204, 9) to (start + 0, 10)
- Code(Expression(0, Add)) at (prev + 1, 13) to (start + 0, 21)
= (c1 + (c0 - c1))
-- Code(Expression(2, Add)) at (prev + 1, 17) to (start + 1, 27)
- = (c0 + Zero)
+- Code(Counter(0)) at (prev + 1, 17) to (start + 1, 27)
- Code(Counter(1)) at (prev + 1, 30) to (start + 0, 37)
-- Code(Expression(3, Sub)) at (prev + 0, 47) to (start + 0, 51)
+- Code(Expression(2, Sub)) at (prev + 0, 47) to (start + 0, 51)
= (c0 - c1)
-- Code(Expression(4, Add)) at (prev + 2, 9) to (start + 0, 10)
- = ((c1 + (c0 - c1)) + Zero)
+- Code(Expression(0, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c1 + (c0 - c1))
Function name: closure::main::{closure#18}
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 18, 0d, 02, 1c, 05, 02, 1d, 02, 12, 02, 02, 12, 00, 13, 07, 01, 11, 01, 0e]
@@ -264,23 +215,23 @@ Number of file 0 mappings: 4
= (c1 + (c0 - c1))
Function name: closure::main::{closure#3} (unused)
-Raw bytes (25): 0x[01, 01, 00, 04, 01, 80, 01, 05, 01, 14, 00, 01, 15, 02, 0a, 00, 02, 0a, 00, 0b, 00, 01, 09, 01, 06]
+Raw bytes (25): 0x[01, 01, 00, 04, 00, 80, 01, 05, 01, 14, 00, 01, 15, 02, 0a, 00, 02, 0a, 00, 0b, 00, 01, 09, 01, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 128, 5) to (start + 1, 20)
+- Code(Zero) at (prev + 128, 5) to (start + 1, 20)
- Code(Zero) at (prev + 1, 21) to (start + 2, 10)
- Code(Zero) at (prev + 2, 10) to (start + 0, 11)
- Code(Zero) at (prev + 1, 9) to (start + 1, 6)
Function name: closure::main::{closure#4} (unused)
-Raw bytes (10): 0x[01, 01, 00, 01, 01, 88, 01, 35, 00, 43]
+Raw bytes (10): 0x[01, 01, 00, 01, 00, 88, 01, 35, 00, 43]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 136, 53) to (start + 0, 67)
+- Code(Zero) at (prev + 136, 53) to (start + 0, 67)
Function name: closure::main::{closure#5}
Raw bytes (10): 0x[01, 01, 00, 01, 01, 8b, 01, 3d, 00, 4f]
@@ -299,26 +250,26 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 140, 65) to (start + 0, 87)
Function name: closure::main::{closure#7} (unused)
-Raw bytes (10): 0x[01, 01, 00, 01, 01, 8d, 01, 3b, 00, 51]
+Raw bytes (10): 0x[01, 01, 00, 01, 00, 8d, 01, 3b, 00, 51]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 141, 59) to (start + 0, 81)
+- Code(Zero) at (prev + 141, 59) to (start + 0, 81)
Function name: closure::main::{closure#8} (unused)
-Raw bytes (10): 0x[01, 01, 00, 01, 01, 92, 01, 3b, 00, 55]
+Raw bytes (10): 0x[01, 01, 00, 01, 00, 92, 01, 3b, 00, 55]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 146, 59) to (start + 0, 85)
+- Code(Zero) at (prev + 146, 59) to (start + 0, 85)
Function name: closure::main::{closure#9} (unused)
-Raw bytes (10): 0x[01, 01, 00, 01, 01, 94, 01, 38, 02, 06]
+Raw bytes (10): 0x[01, 01, 00, 01, 00, 94, 01, 38, 02, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 148, 56) to (start + 2, 6)
+- Code(Zero) at (prev + 148, 56) to (start + 2, 6)
diff --git a/tests/run-coverage/closure.coverage b/tests/coverage/closure.coverage
index 67014f792..67014f792 100644
--- a/tests/run-coverage/closure.coverage
+++ b/tests/coverage/closure.coverage
diff --git a/tests/coverage-map/status-quo/closure.rs b/tests/coverage/closure.rs
index 16a2c4e33..16a2c4e33 100644
--- a/tests/coverage-map/status-quo/closure.rs
+++ b/tests/coverage/closure.rs
diff --git a/tests/coverage/closure_bug.cov-map b/tests/coverage/closure_bug.cov-map
new file mode 100644
index 000000000..90eeb1a66
--- /dev/null
+++ b/tests/coverage/closure_bug.cov-map
@@ -0,0 +1,133 @@
+Function name: closure_bug::main
+Raw bytes (201): 0x[01, 01, 26, 01, 05, 05, 02, 05, 02, 97, 01, 09, 05, 02, 09, 92, 01, 97, 01, 09, 05, 02, 09, 92, 01, 97, 01, 09, 05, 02, 8f, 01, 0d, 09, 92, 01, 97, 01, 09, 05, 02, 0d, 8a, 01, 8f, 01, 0d, 09, 92, 01, 97, 01, 09, 05, 02, 0d, 8a, 01, 8f, 01, 0d, 09, 92, 01, 97, 01, 09, 05, 02, 87, 01, 11, 0d, 8a, 01, 8f, 01, 0d, 09, 92, 01, 97, 01, 09, 05, 02, 11, 82, 01, 87, 01, 11, 0d, 8a, 01, 8f, 01, 0d, 09, 92, 01, 97, 01, 09, 05, 02, 11, 01, 06, 01, 03, 0a, 01, 09, 05, 01, 0e, 05, 01, 0f, 00, 17, 02, 00, 17, 00, 18, 97, 01, 02, 09, 00, 0a, 97, 01, 06, 05, 01, 0e, 09, 01, 0f, 00, 17, 92, 01, 00, 17, 00, 18, 8f, 01, 02, 09, 00, 0a, 8f, 01, 06, 05, 01, 0e, 0d, 01, 0f, 00, 17, 8a, 01, 00, 17, 00, 18, 87, 01, 02, 09, 00, 0a, 87, 01, 06, 05, 01, 0e, 11, 01, 0f, 00, 17, 82, 01, 00, 17, 00, 18, 7f, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 38
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 2 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 3 operands: lhs = Expression(37, Add), rhs = Counter(2)
+- expression 4 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 5 operands: lhs = Counter(2), rhs = Expression(36, Sub)
+- expression 6 operands: lhs = Expression(37, Add), rhs = Counter(2)
+- expression 7 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 8 operands: lhs = Counter(2), rhs = Expression(36, Sub)
+- expression 9 operands: lhs = Expression(37, Add), rhs = Counter(2)
+- expression 10 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 11 operands: lhs = Expression(35, Add), rhs = Counter(3)
+- expression 12 operands: lhs = Counter(2), rhs = Expression(36, Sub)
+- expression 13 operands: lhs = Expression(37, Add), rhs = Counter(2)
+- expression 14 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 15 operands: lhs = Counter(3), rhs = Expression(34, Sub)
+- expression 16 operands: lhs = Expression(35, Add), rhs = Counter(3)
+- expression 17 operands: lhs = Counter(2), rhs = Expression(36, Sub)
+- expression 18 operands: lhs = Expression(37, Add), rhs = Counter(2)
+- expression 19 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 20 operands: lhs = Counter(3), rhs = Expression(34, Sub)
+- expression 21 operands: lhs = Expression(35, Add), rhs = Counter(3)
+- expression 22 operands: lhs = Counter(2), rhs = Expression(36, Sub)
+- expression 23 operands: lhs = Expression(37, Add), rhs = Counter(2)
+- expression 24 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 25 operands: lhs = Expression(33, Add), rhs = Counter(4)
+- expression 26 operands: lhs = Counter(3), rhs = Expression(34, Sub)
+- expression 27 operands: lhs = Expression(35, Add), rhs = Counter(3)
+- expression 28 operands: lhs = Counter(2), rhs = Expression(36, Sub)
+- expression 29 operands: lhs = Expression(37, Add), rhs = Counter(2)
+- expression 30 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 31 operands: lhs = Counter(4), rhs = Expression(32, Sub)
+- expression 32 operands: lhs = Expression(33, Add), rhs = Counter(4)
+- expression 33 operands: lhs = Counter(3), rhs = Expression(34, Sub)
+- expression 34 operands: lhs = Expression(35, Add), rhs = Counter(3)
+- expression 35 operands: lhs = Counter(2), rhs = Expression(36, Sub)
+- expression 36 operands: lhs = Expression(37, Add), rhs = Counter(2)
+- expression 37 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 17
+- Code(Counter(0)) at (prev + 6, 1) to (start + 3, 10)
+- Code(Counter(0)) at (prev + 9, 5) to (start + 1, 14)
+- Code(Counter(1)) at (prev + 1, 15) to (start + 0, 23)
+- Code(Expression(0, Sub)) at (prev + 0, 23) to (start + 0, 24)
+ = (c0 - c1)
+- Code(Expression(37, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c1 + (c0 - c1))
+- Code(Expression(37, Add)) at (prev + 6, 5) to (start + 1, 14)
+ = (c1 + (c0 - c1))
+- Code(Counter(2)) at (prev + 1, 15) to (start + 0, 23)
+- Code(Expression(36, Sub)) at (prev + 0, 23) to (start + 0, 24)
+ = ((c1 + (c0 - c1)) - c2)
+- Code(Expression(35, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+- Code(Expression(35, Add)) at (prev + 6, 5) to (start + 1, 14)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+- Code(Counter(3)) at (prev + 1, 15) to (start + 0, 23)
+- Code(Expression(34, Sub)) at (prev + 0, 23) to (start + 0, 24)
+ = ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)
+- Code(Expression(33, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
+- Code(Expression(33, Add)) at (prev + 6, 5) to (start + 1, 14)
+ = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
+- Code(Counter(4)) at (prev + 1, 15) to (start + 0, 23)
+- Code(Expression(32, Sub)) at (prev + 0, 23) to (start + 0, 24)
+ = ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)
+- Code(Expression(31, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4))
+
+Function name: closure_bug::main::{closure#0}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0d, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 13, 9) to (start + 0, 18)
+- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
+- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
+ = (c1 + (c0 - c1))
+
+Function name: closure_bug::main::{closure#1}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 16, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 22, 9) to (start + 0, 18)
+- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
+- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
+ = (c1 + (c0 - c1))
+
+Function name: closure_bug::main::{closure#2}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 1f, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 31, 9) to (start + 0, 18)
+- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
+- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
+ = (c1 + (c0 - c1))
+
+Function name: closure_bug::main::{closure#3}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 28, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 40, 9) to (start + 0, 18)
+- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25)
+- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42)
+ = (c1 + (c0 - c1))
+
diff --git a/tests/run-coverage/closure_bug.coverage b/tests/coverage/closure_bug.coverage
index f3299834b..f3299834b 100644
--- a/tests/run-coverage/closure_bug.coverage
+++ b/tests/coverage/closure_bug.coverage
diff --git a/tests/coverage-map/status-quo/closure_bug.rs b/tests/coverage/closure_bug.rs
index 739bc5f0b..739bc5f0b 100644
--- a/tests/coverage-map/status-quo/closure_bug.rs
+++ b/tests/coverage/closure_bug.rs
diff --git a/tests/coverage-map/status-quo/closure_macro.cov-map b/tests/coverage/closure_macro.cov-map
index ac017eb44..b02c7e2e4 100644
--- a/tests/coverage-map/status-quo/closure_macro.cov-map
+++ b/tests/coverage/closure_macro.cov-map
@@ -7,27 +7,23 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 29, 1) to (start + 2, 2)
Function name: closure_macro::main
-Raw bytes (49): 0x[01, 01, 05, 01, 05, 02, 00, 05, 00, 02, 00, 05, 02, 07, 01, 21, 01, 01, 21, 02, 02, 09, 00, 0f, 05, 00, 12, 00, 13, 07, 00, 12, 00, 13, 0b, 00, 54, 00, 55, 0f, 02, 09, 02, 0b, 13, 03, 01, 00, 02]
+Raw bytes (43): 0x[01, 01, 02, 01, 05, 05, 02, 07, 01, 21, 01, 01, 21, 02, 02, 09, 00, 0f, 05, 00, 12, 00, 13, 02, 00, 12, 00, 13, 05, 00, 54, 00, 55, 02, 02, 09, 02, 0b, 07, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
+Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(0, Sub), rhs = Zero
-- expression 2 operands: lhs = Counter(1), rhs = Zero
-- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
-- expression 4 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 7
- Code(Counter(0)) at (prev + 33, 1) to (start + 1, 33)
- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 15)
= (c0 - c1)
- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19)
-- Code(Expression(1, Add)) at (prev + 0, 18) to (start + 0, 19)
- = ((c0 - c1) + Zero)
-- Code(Expression(2, Add)) at (prev + 0, 84) to (start + 0, 85)
- = (c1 + Zero)
-- Code(Expression(3, Add)) at (prev + 2, 9) to (start + 2, 11)
- = ((c0 - c1) + Zero)
-- Code(Expression(4, Add)) at (prev + 3, 1) to (start + 0, 2)
+- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19)
+ = (c0 - c1)
+- Code(Counter(1)) at (prev + 0, 84) to (start + 0, 85)
+- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 2, 11)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 3, 1) to (start + 0, 2)
= (c1 + (c0 - c1))
Function name: closure_macro::main::{closure#0}
diff --git a/tests/run-coverage/closure_macro.coverage b/tests/coverage/closure_macro.coverage
index 0f2c917e0..0f2c917e0 100644
--- a/tests/run-coverage/closure_macro.coverage
+++ b/tests/coverage/closure_macro.coverage
diff --git a/tests/coverage-map/status-quo/closure_macro.rs b/tests/coverage/closure_macro.rs
index 9b289141c..9b289141c 100644
--- a/tests/coverage-map/status-quo/closure_macro.rs
+++ b/tests/coverage/closure_macro.rs
diff --git a/tests/coverage-map/status-quo/closure_macro_async.cov-map b/tests/coverage/closure_macro_async.cov-map
index c9a142e5a..7f8666948 100644
--- a/tests/coverage-map/status-quo/closure_macro_async.cov-map
+++ b/tests/coverage/closure_macro_async.cov-map
@@ -15,27 +15,23 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 33, 1) to (start + 0, 43)
Function name: closure_macro_async::test::{closure#0}
-Raw bytes (49): 0x[01, 01, 05, 01, 05, 02, 00, 05, 00, 02, 00, 05, 02, 07, 01, 21, 2b, 01, 21, 02, 02, 09, 00, 0f, 05, 00, 12, 00, 13, 07, 00, 12, 00, 13, 0b, 00, 54, 00, 55, 0f, 02, 09, 02, 0b, 13, 03, 01, 00, 02]
+Raw bytes (43): 0x[01, 01, 02, 01, 05, 05, 02, 07, 01, 21, 2b, 01, 21, 02, 02, 09, 00, 0f, 05, 00, 12, 00, 13, 02, 00, 12, 00, 13, 05, 00, 54, 00, 55, 02, 02, 09, 02, 0b, 07, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
+Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(0, Sub), rhs = Zero
-- expression 2 operands: lhs = Counter(1), rhs = Zero
-- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
-- expression 4 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 7
- Code(Counter(0)) at (prev + 33, 43) to (start + 1, 33)
- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 15)
= (c0 - c1)
- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19)
-- Code(Expression(1, Add)) at (prev + 0, 18) to (start + 0, 19)
- = ((c0 - c1) + Zero)
-- Code(Expression(2, Add)) at (prev + 0, 84) to (start + 0, 85)
- = (c1 + Zero)
-- Code(Expression(3, Add)) at (prev + 2, 9) to (start + 2, 11)
- = ((c0 - c1) + Zero)
-- Code(Expression(4, Add)) at (prev + 3, 1) to (start + 0, 2)
+- Code(Expression(0, Sub)) at (prev + 0, 18) to (start + 0, 19)
+ = (c0 - c1)
+- Code(Counter(1)) at (prev + 0, 84) to (start + 0, 85)
+- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 2, 11)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 3, 1) to (start + 0, 2)
= (c1 + (c0 - c1))
Function name: closure_macro_async::test::{closure#0}::{closure#0}
diff --git a/tests/run-coverage/closure_macro_async.coverage b/tests/coverage/closure_macro_async.coverage
index 74247f1bc..74247f1bc 100644
--- a/tests/run-coverage/closure_macro_async.coverage
+++ b/tests/coverage/closure_macro_async.coverage
diff --git a/tests/coverage-map/status-quo/closure_macro_async.rs b/tests/coverage/closure_macro_async.rs
index b4275599e..b4275599e 100644
--- a/tests/coverage-map/status-quo/closure_macro_async.rs
+++ b/tests/coverage/closure_macro_async.rs
diff --git a/tests/coverage/conditions.cov-map b/tests/coverage/conditions.cov-map
new file mode 100644
index 000000000..7600d2d96
--- /dev/null
+++ b/tests/coverage/conditions.cov-map
@@ -0,0 +1,259 @@
+Function name: conditions::main
+Raw bytes (784): 0x[01, 01, 8e, 01, 09, 33, 37, 41, 3b, 3d, 35, 39, 05, 00, b7, 04, 09, 05, 00, 0d, 35, 26, 39, 0d, 35, 3b, 3d, 35, 39, 37, 41, 3b, 3d, 35, 39, b2, 04, 0d, b7, 04, 09, 05, 00, 45, 00, 83, 01, 49, 45, 00, 7e, 31, 83, 01, 49, 45, 00, 7a, 4d, 7e, 31, 83, 01, 49, 45, 00, 76, 51, 7a, 4d, 7e, 31, 83, 01, 49, 45, 00, a7, 01, 55, 4d, 51, a3, 01, 59, a7, 01, 55, 4d, 51, 49, 9f, 01, a3, 01, 59, a7, 01, 55, 4d, 51, 61, 00, e3, 01, 65, 61, 00, de, 01, 2d, e3, 01, 65, 61, 00, da, 01, 69, de, 01, 2d, e3, 01, 65, 61, 00, d6, 01, 6d, da, 01, 69, de, 01, 2d, e3, 01, 65, 61, 00, 8b, 02, 71, 69, 6d, 87, 02, 75, 8b, 02, 71, 69, 6d, ff, 01, 00, 65, 83, 02, 87, 02, 75, 8b, 02, 71, 69, 6d, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 79, 00, d7, 02, 7d, 79, 00, d2, 02, 29, d7, 02, 7d, 79, 00, ce, 02, 81, 01, d2, 02, 29, d7, 02, 7d, 79, 00, ca, 02, 85, 01, ce, 02, 81, 01, d2, 02, 29, d7, 02, 7d, 79, 00, f3, 03, 89, 01, 81, 01, 85, 01, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 11, 93, 04, 97, 04, 21, 9b, 04, 1d, 15, 19, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, de, 03, 15, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, da, 03, 19, de, 03, 15, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 9b, 04, 1d, 15, 19, 97, 04, 21, 9b, 04, 1d, 15, 19, 8f, 04, 9f, 04, 11, 93, 04, 97, 04, 21, 9b, 04, 1d, 15, 19, a3, 04, ae, 04, a7, 04, ab, 04, 25, 29, 2d, 31, b2, 04, 0d, b7, 04, 09, 05, 00, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 06, 00, 07, 03, 03, 09, 00, 0a, b7, 04, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, b2, 04, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 26, 00, 1d, 00, 2a, 22, 00, 2e, 00, 3c, 37, 00, 3d, 02, 0a, 41, 02, 0a, 00, 0b, 33, 01, 09, 01, 12, ae, 04, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 45, 01, 0d, 02, 06, 00, 02, 06, 00, 07, 83, 01, 02, 08, 00, 15, 49, 00, 16, 02, 06, 7e, 02, 0f, 00, 1c, 7a, 01, 0c, 00, 19, 76, 00, 1d, 00, 2a, 72, 00, 2e, 00, 3c, a3, 01, 00, 3d, 02, 0a, 59, 02, 0a, 00, 0b, 9f, 01, 01, 09, 00, 17, 31, 02, 09, 00, 0f, 9b, 01, 03, 08, 00, 0c, 5d, 01, 0d, 01, 10, 61, 01, 11, 02, 0a, 00, 02, 0a, 00, 0b, e3, 01, 02, 0c, 00, 19, 65, 00, 1a, 02, 0a, de, 01, 03, 11, 00, 1e, da, 01, 01, 10, 00, 1d, d6, 01, 00, 21, 00, 2e, d2, 01, 00, 32, 00, 40, 87, 02, 00, 41, 02, 0e, 75, 02, 0e, 00, 0f, 83, 02, 01, 0d, 00, 1b, 2d, 02, 0d, 00, 13, 00, 02, 06, 00, 07, fb, 01, 02, 09, 01, 0c, 79, 01, 0d, 02, 06, 00, 02, 06, 00, 07, e7, 03, 02, 09, 00, 0a, d7, 02, 00, 10, 00, 1d, 7d, 00, 1e, 02, 06, d2, 02, 02, 0f, 00, 1c, ce, 02, 01, 0c, 00, 19, ca, 02, 00, 1d, 00, 2a, c6, 02, 00, 2e, 00, 3c, ef, 03, 00, 3d, 02, 0a, 8d, 01, 02, 0a, 00, 0b, eb, 03, 01, 09, 00, 17, 29, 02, 0d, 02, 0f, 8f, 04, 05, 09, 00, 0a, e7, 03, 00, 10, 00, 1d, 11, 00, 1e, 02, 06, e2, 03, 02, 0f, 00, 1c, de, 03, 01, 0c, 00, 19, da, 03, 00, 1d, 00, 2a, d6, 03, 00, 2e, 00, 3c, 97, 04, 00, 3d, 02, 0a, 21, 02, 0a, 00, 0b, 93, 04, 01, 09, 00, 17, 25, 02, 09, 00, 0f, 8b, 04, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 142
+- expression 0 operands: lhs = Counter(2), rhs = Expression(12, Add)
+- expression 1 operands: lhs = Expression(13, Add), rhs = Counter(16)
+- expression 2 operands: lhs = Expression(14, Add), rhs = Counter(15)
+- expression 3 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 4 operands: lhs = Counter(1), rhs = Zero
+- expression 5 operands: lhs = Expression(141, Add), rhs = Counter(2)
+- expression 6 operands: lhs = Counter(1), rhs = Zero
+- expression 7 operands: lhs = Counter(3), rhs = Counter(13)
+- expression 8 operands: lhs = Expression(9, Sub), rhs = Counter(14)
+- expression 9 operands: lhs = Counter(3), rhs = Counter(13)
+- expression 10 operands: lhs = Expression(14, Add), rhs = Counter(15)
+- expression 11 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(16)
+- expression 13 operands: lhs = Expression(14, Add), rhs = Counter(15)
+- expression 14 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 15 operands: lhs = Expression(140, Sub), rhs = Counter(3)
+- expression 16 operands: lhs = Expression(141, Add), rhs = Counter(2)
+- expression 17 operands: lhs = Counter(1), rhs = Zero
+- expression 18 operands: lhs = Counter(17), rhs = Zero
+- expression 19 operands: lhs = Expression(32, Add), rhs = Counter(18)
+- expression 20 operands: lhs = Counter(17), rhs = Zero
+- expression 21 operands: lhs = Expression(31, Sub), rhs = Counter(12)
+- expression 22 operands: lhs = Expression(32, Add), rhs = Counter(18)
+- expression 23 operands: lhs = Counter(17), rhs = Zero
+- expression 24 operands: lhs = Expression(30, Sub), rhs = Counter(19)
+- expression 25 operands: lhs = Expression(31, Sub), rhs = Counter(12)
+- expression 26 operands: lhs = Expression(32, Add), rhs = Counter(18)
+- expression 27 operands: lhs = Counter(17), rhs = Zero
+- expression 28 operands: lhs = Expression(29, Sub), rhs = Counter(20)
+- expression 29 operands: lhs = Expression(30, Sub), rhs = Counter(19)
+- expression 30 operands: lhs = Expression(31, Sub), rhs = Counter(12)
+- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(18)
+- expression 32 operands: lhs = Counter(17), rhs = Zero
+- expression 33 operands: lhs = Expression(41, Add), rhs = Counter(21)
+- expression 34 operands: lhs = Counter(19), rhs = Counter(20)
+- expression 35 operands: lhs = Expression(40, Add), rhs = Counter(22)
+- expression 36 operands: lhs = Expression(41, Add), rhs = Counter(21)
+- expression 37 operands: lhs = Counter(19), rhs = Counter(20)
+- expression 38 operands: lhs = Counter(18), rhs = Expression(39, Add)
+- expression 39 operands: lhs = Expression(40, Add), rhs = Counter(22)
+- expression 40 operands: lhs = Expression(41, Add), rhs = Counter(21)
+- expression 41 operands: lhs = Counter(19), rhs = Counter(20)
+- expression 42 operands: lhs = Counter(24), rhs = Zero
+- expression 43 operands: lhs = Expression(56, Add), rhs = Counter(25)
+- expression 44 operands: lhs = Counter(24), rhs = Zero
+- expression 45 operands: lhs = Expression(55, Sub), rhs = Counter(11)
+- expression 46 operands: lhs = Expression(56, Add), rhs = Counter(25)
+- expression 47 operands: lhs = Counter(24), rhs = Zero
+- expression 48 operands: lhs = Expression(54, Sub), rhs = Counter(26)
+- expression 49 operands: lhs = Expression(55, Sub), rhs = Counter(11)
+- expression 50 operands: lhs = Expression(56, Add), rhs = Counter(25)
+- expression 51 operands: lhs = Counter(24), rhs = Zero
+- expression 52 operands: lhs = Expression(53, Sub), rhs = Counter(27)
+- expression 53 operands: lhs = Expression(54, Sub), rhs = Counter(26)
+- expression 54 operands: lhs = Expression(55, Sub), rhs = Counter(11)
+- expression 55 operands: lhs = Expression(56, Add), rhs = Counter(25)
+- expression 56 operands: lhs = Counter(24), rhs = Zero
+- expression 57 operands: lhs = Expression(66, Add), rhs = Counter(28)
+- expression 58 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 59 operands: lhs = Expression(65, Add), rhs = Counter(29)
+- expression 60 operands: lhs = Expression(66, Add), rhs = Counter(28)
+- expression 61 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 62 operands: lhs = Expression(63, Add), rhs = Zero
+- expression 63 operands: lhs = Counter(25), rhs = Expression(64, Add)
+- expression 64 operands: lhs = Expression(65, Add), rhs = Counter(29)
+- expression 65 operands: lhs = Expression(66, Add), rhs = Counter(28)
+- expression 66 operands: lhs = Counter(26), rhs = Counter(27)
+- expression 67 operands: lhs = Counter(31), rhs = Expression(122, Add)
+- expression 68 operands: lhs = Expression(123, Add), rhs = Counter(35)
+- expression 69 operands: lhs = Expression(124, Add), rhs = Counter(34)
+- expression 70 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 71 operands: lhs = Counter(30), rhs = Zero
+- expression 72 operands: lhs = Expression(85, Add), rhs = Counter(31)
+- expression 73 operands: lhs = Counter(30), rhs = Zero
+- expression 74 operands: lhs = Expression(84, Sub), rhs = Counter(10)
+- expression 75 operands: lhs = Expression(85, Add), rhs = Counter(31)
+- expression 76 operands: lhs = Counter(30), rhs = Zero
+- expression 77 operands: lhs = Expression(83, Sub), rhs = Counter(32)
+- expression 78 operands: lhs = Expression(84, Sub), rhs = Counter(10)
+- expression 79 operands: lhs = Expression(85, Add), rhs = Counter(31)
+- expression 80 operands: lhs = Counter(30), rhs = Zero
+- expression 81 operands: lhs = Expression(82, Sub), rhs = Counter(33)
+- expression 82 operands: lhs = Expression(83, Sub), rhs = Counter(32)
+- expression 83 operands: lhs = Expression(84, Sub), rhs = Counter(10)
+- expression 84 operands: lhs = Expression(85, Add), rhs = Counter(31)
+- expression 85 operands: lhs = Counter(30), rhs = Zero
+- expression 86 operands: lhs = Expression(124, Add), rhs = Counter(34)
+- expression 87 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 88 operands: lhs = Expression(123, Add), rhs = Counter(35)
+- expression 89 operands: lhs = Expression(124, Add), rhs = Counter(34)
+- expression 90 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 91 operands: lhs = Counter(4), rhs = Expression(132, Add)
+- expression 92 operands: lhs = Expression(133, Add), rhs = Counter(8)
+- expression 93 operands: lhs = Expression(134, Add), rhs = Counter(7)
+- expression 94 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 95 operands: lhs = Counter(31), rhs = Expression(122, Add)
+- expression 96 operands: lhs = Expression(123, Add), rhs = Counter(35)
+- expression 97 operands: lhs = Expression(124, Add), rhs = Counter(34)
+- expression 98 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 99 operands: lhs = Expression(121, Add), rhs = Counter(4)
+- expression 100 operands: lhs = Counter(31), rhs = Expression(122, Add)
+- expression 101 operands: lhs = Expression(123, Add), rhs = Counter(35)
+- expression 102 operands: lhs = Expression(124, Add), rhs = Counter(34)
+- expression 103 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 104 operands: lhs = Expression(120, Sub), rhs = Counter(9)
+- expression 105 operands: lhs = Expression(121, Add), rhs = Counter(4)
+- expression 106 operands: lhs = Counter(31), rhs = Expression(122, Add)
+- expression 107 operands: lhs = Expression(123, Add), rhs = Counter(35)
+- expression 108 operands: lhs = Expression(124, Add), rhs = Counter(34)
+- expression 109 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 110 operands: lhs = Expression(119, Sub), rhs = Counter(5)
+- expression 111 operands: lhs = Expression(120, Sub), rhs = Counter(9)
+- expression 112 operands: lhs = Expression(121, Add), rhs = Counter(4)
+- expression 113 operands: lhs = Counter(31), rhs = Expression(122, Add)
+- expression 114 operands: lhs = Expression(123, Add), rhs = Counter(35)
+- expression 115 operands: lhs = Expression(124, Add), rhs = Counter(34)
+- expression 116 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 117 operands: lhs = Expression(118, Sub), rhs = Counter(6)
+- expression 118 operands: lhs = Expression(119, Sub), rhs = Counter(5)
+- expression 119 operands: lhs = Expression(120, Sub), rhs = Counter(9)
+- expression 120 operands: lhs = Expression(121, Add), rhs = Counter(4)
+- expression 121 operands: lhs = Counter(31), rhs = Expression(122, Add)
+- expression 122 operands: lhs = Expression(123, Add), rhs = Counter(35)
+- expression 123 operands: lhs = Expression(124, Add), rhs = Counter(34)
+- expression 124 operands: lhs = Counter(32), rhs = Counter(33)
+- expression 125 operands: lhs = Expression(134, Add), rhs = Counter(7)
+- expression 126 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 127 operands: lhs = Expression(133, Add), rhs = Counter(8)
+- expression 128 operands: lhs = Expression(134, Add), rhs = Counter(7)
+- expression 129 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 130 operands: lhs = Expression(131, Add), rhs = Expression(135, Add)
+- expression 131 operands: lhs = Counter(4), rhs = Expression(132, Add)
+- expression 132 operands: lhs = Expression(133, Add), rhs = Counter(8)
+- expression 133 operands: lhs = Expression(134, Add), rhs = Counter(7)
+- expression 134 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 135 operands: lhs = Expression(136, Add), rhs = Expression(139, Sub)
+- expression 136 operands: lhs = Expression(137, Add), rhs = Expression(138, Add)
+- expression 137 operands: lhs = Counter(9), rhs = Counter(10)
+- expression 138 operands: lhs = Counter(11), rhs = Counter(12)
+- expression 139 operands: lhs = Expression(140, Sub), rhs = Counter(3)
+- expression 140 operands: lhs = Expression(141, Add), rhs = Counter(2)
+- expression 141 operands: lhs = Counter(1), rhs = Zero
+Number of file 0 mappings: 68
+- Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12)
+- Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(0, Add)) at (prev + 3, 9) to (start + 0, 10)
+ = (c2 + (((c13 + c14) + c15) + c16))
+- Code(Expression(141, Add)) at (prev + 0, 16) to (start + 0, 29)
+ = (c1 + Zero)
+- Code(Counter(2)) at (prev + 1, 9) to (start + 1, 10)
+- Code(Expression(140, Sub)) at (prev + 2, 15) to (start + 0, 28)
+ = ((c1 + Zero) - c2)
+- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 25)
+- Code(Expression(9, Sub)) at (prev + 0, 29) to (start + 0, 42)
+ = (c3 - c13)
+- Code(Expression(8, Sub)) at (prev + 0, 46) to (start + 0, 60)
+ = ((c3 - c13) - c14)
+- Code(Expression(13, Add)) at (prev + 0, 61) to (start + 2, 10)
+ = ((c13 + c14) + c15)
+- Code(Counter(16)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(12, Add)) at (prev + 1, 9) to (start + 1, 18)
+ = (((c13 + c14) + c15) + c16)
+- Code(Expression(139, Sub)) at (prev + 3, 9) to (start + 0, 15)
+ = (((c1 + Zero) - c2) - c3)
+- Code(Expression(0, Add)) at (prev + 3, 9) to (start + 1, 12)
+ = (c2 + (((c13 + c14) + c15) + c16))
+- Code(Counter(17)) at (prev + 1, 13) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(32, Add)) at (prev + 2, 8) to (start + 0, 21)
+ = (c17 + Zero)
+- Code(Counter(18)) at (prev + 0, 22) to (start + 2, 6)
+- Code(Expression(31, Sub)) at (prev + 2, 15) to (start + 0, 28)
+ = ((c17 + Zero) - c18)
+- Code(Expression(30, Sub)) at (prev + 1, 12) to (start + 0, 25)
+ = (((c17 + Zero) - c18) - c12)
+- Code(Expression(29, Sub)) at (prev + 0, 29) to (start + 0, 42)
+ = ((((c17 + Zero) - c18) - c12) - c19)
+- Code(Expression(28, Sub)) at (prev + 0, 46) to (start + 0, 60)
+ = (((((c17 + Zero) - c18) - c12) - c19) - c20)
+- Code(Expression(40, Add)) at (prev + 0, 61) to (start + 2, 10)
+ = ((c19 + c20) + c21)
+- Code(Counter(22)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(39, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (((c19 + c20) + c21) + c22)
+- Code(Counter(12)) at (prev + 2, 9) to (start + 0, 15)
+- Code(Expression(38, Add)) at (prev + 3, 8) to (start + 0, 12)
+ = (c18 + (((c19 + c20) + c21) + c22))
+- Code(Counter(23)) at (prev + 1, 13) to (start + 1, 16)
+- Code(Counter(24)) at (prev + 1, 17) to (start + 2, 10)
+- Code(Zero) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(56, Add)) at (prev + 2, 12) to (start + 0, 25)
+ = (c24 + Zero)
+- Code(Counter(25)) at (prev + 0, 26) to (start + 2, 10)
+- Code(Expression(55, Sub)) at (prev + 3, 17) to (start + 0, 30)
+ = ((c24 + Zero) - c25)
+- Code(Expression(54, Sub)) at (prev + 1, 16) to (start + 0, 29)
+ = (((c24 + Zero) - c25) - c11)
+- Code(Expression(53, Sub)) at (prev + 0, 33) to (start + 0, 46)
+ = ((((c24 + Zero) - c25) - c11) - c26)
+- Code(Expression(52, Sub)) at (prev + 0, 50) to (start + 0, 64)
+ = (((((c24 + Zero) - c25) - c11) - c26) - c27)
+- Code(Expression(65, Add)) at (prev + 0, 65) to (start + 2, 14)
+ = ((c26 + c27) + c28)
+- Code(Counter(29)) at (prev + 2, 14) to (start + 0, 15)
+- Code(Expression(64, Add)) at (prev + 1, 13) to (start + 0, 27)
+ = (((c26 + c27) + c28) + c29)
+- Code(Counter(11)) at (prev + 2, 13) to (start + 0, 19)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(62, Add)) at (prev + 2, 9) to (start + 1, 12)
+ = ((c25 + (((c26 + c27) + c28) + c29)) + Zero)
+- Code(Counter(30)) at (prev + 1, 13) to (start + 2, 6)
+- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(121, Add)) at (prev + 2, 9) to (start + 0, 10)
+ = (c31 + (((c32 + c33) + c34) + c35))
+- Code(Expression(85, Add)) at (prev + 0, 16) to (start + 0, 29)
+ = (c30 + Zero)
+- Code(Counter(31)) at (prev + 0, 30) to (start + 2, 6)
+- Code(Expression(84, Sub)) at (prev + 2, 15) to (start + 0, 28)
+ = ((c30 + Zero) - c31)
+- Code(Expression(83, Sub)) at (prev + 1, 12) to (start + 0, 25)
+ = (((c30 + Zero) - c31) - c10)
+- Code(Expression(82, Sub)) at (prev + 0, 29) to (start + 0, 42)
+ = ((((c30 + Zero) - c31) - c10) - c32)
+- Code(Expression(81, Sub)) at (prev + 0, 46) to (start + 0, 60)
+ = (((((c30 + Zero) - c31) - c10) - c32) - c33)
+- Code(Expression(123, Add)) at (prev + 0, 61) to (start + 2, 10)
+ = ((c32 + c33) + c34)
+- Code(Counter(35)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(122, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (((c32 + c33) + c34) + c35)
+- Code(Counter(10)) at (prev + 2, 13) to (start + 2, 15)
+- Code(Expression(131, Add)) at (prev + 5, 9) to (start + 0, 10)
+ = (c4 + (((c5 + c6) + c7) + c8))
+- Code(Expression(121, Add)) at (prev + 0, 16) to (start + 0, 29)
+ = (c31 + (((c32 + c33) + c34) + c35))
+- Code(Counter(4)) at (prev + 0, 30) to (start + 2, 6)
+- Code(Expression(120, Sub)) at (prev + 2, 15) to (start + 0, 28)
+ = ((c31 + (((c32 + c33) + c34) + c35)) - c4)
+- Code(Expression(119, Sub)) at (prev + 1, 12) to (start + 0, 25)
+ = (((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9)
+- Code(Expression(118, Sub)) at (prev + 0, 29) to (start + 0, 42)
+ = ((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5)
+- Code(Expression(117, Sub)) at (prev + 0, 46) to (start + 0, 60)
+ = (((((c31 + (((c32 + c33) + c34) + c35)) - c4) - c9) - c5) - c6)
+- Code(Expression(133, Add)) at (prev + 0, 61) to (start + 2, 10)
+ = ((c5 + c6) + c7)
+- Code(Counter(8)) at (prev + 2, 10) to (start + 0, 11)
+- Code(Expression(132, Add)) at (prev + 1, 9) to (start + 0, 23)
+ = (((c5 + c6) + c7) + c8)
+- Code(Counter(9)) at (prev + 2, 9) to (start + 0, 15)
+- Code(Expression(130, Add)) at (prev + 2, 1) to (start + 0, 2)
+ = ((c4 + (((c5 + c6) + c7) + c8)) + (((c9 + c10) + (c11 + c12)) + (((c1 + Zero) - c2) - c3)))
+
diff --git a/tests/run-coverage/conditions.coverage b/tests/coverage/conditions.coverage
index 473335ff6..473335ff6 100644
--- a/tests/run-coverage/conditions.coverage
+++ b/tests/coverage/conditions.coverage
diff --git a/tests/coverage-map/status-quo/conditions.rs b/tests/coverage/conditions.rs
index fa7f2a116..fa7f2a116 100644
--- a/tests/coverage-map/status-quo/conditions.rs
+++ b/tests/coverage/conditions.rs
diff --git a/tests/coverage/continue.cov-map b/tests/coverage/continue.cov-map
new file mode 100644
index 000000000..82f3d7c60
--- /dev/null
+++ b/tests/coverage/continue.cov-map
@@ -0,0 +1,79 @@
+Function name: continue::main
+Raw bytes (210): 0x[01, 01, 1c, 01, 07, 05, 09, 03, 0d, 0d, 1f, 11, 15, 1b, 19, 0d, 1f, 11, 15, 19, 33, 1d, 21, 2f, 25, 19, 33, 1d, 21, 25, 47, 29, 2d, 43, 31, 25, 47, 29, 2d, 31, 5f, 35, 39, 57, 3d, 31, 5f, 35, 39, 35, 39, 3d, 41, 6b, 45, 3d, 41, 49, 45, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 15, 03, 09, 00, 0e, 2f, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 1d, 03, 09, 00, 0e, 43, 02, 0e, 00, 13, 3e, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 57, 03, 0e, 00, 13, 52, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 5f, 04, 09, 00, 0e, 6b, 02, 0e, 00, 13, 66, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 49, 04, 11, 00, 16, 41, 03, 09, 00, 0e, 6f, 02, 0d, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 28
+- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 3 operands: lhs = Counter(3), rhs = Expression(7, Add)
+- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(6)
+- expression 6 operands: lhs = Counter(3), rhs = Expression(7, Add)
+- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 8 operands: lhs = Counter(6), rhs = Expression(12, Add)
+- expression 9 operands: lhs = Counter(7), rhs = Counter(8)
+- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(9)
+- expression 11 operands: lhs = Counter(6), rhs = Expression(12, Add)
+- expression 12 operands: lhs = Counter(7), rhs = Counter(8)
+- expression 13 operands: lhs = Counter(9), rhs = Expression(17, Add)
+- expression 14 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 15 operands: lhs = Expression(16, Add), rhs = Counter(12)
+- expression 16 operands: lhs = Counter(9), rhs = Expression(17, Add)
+- expression 17 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 18 operands: lhs = Counter(12), rhs = Expression(23, Add)
+- expression 19 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 20 operands: lhs = Expression(21, Add), rhs = Counter(15)
+- expression 21 operands: lhs = Counter(12), rhs = Expression(23, Add)
+- expression 22 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 23 operands: lhs = Counter(13), rhs = Counter(14)
+- expression 24 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 25 operands: lhs = Expression(26, Add), rhs = Counter(17)
+- expression 26 operands: lhs = Counter(15), rhs = Counter(16)
+- expression 27 operands: lhs = Counter(18), rhs = Counter(17)
+Number of file 0 mappings: 30
+- Code(Counter(0)) at (prev + 3, 1) to (start + 3, 18)
+- Code(Expression(0, Add)) at (prev + 4, 14) to (start + 0, 19)
+ = (c0 + (c1 + c2))
+- Code(Expression(2, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c0 + (c1 + c2)) - c3)
+- Code(Counter(1)) at (prev + 2, 17) to (start + 0, 25)
+- Code(Counter(2)) at (prev + 2, 18) to (start + 4, 14)
+- Code(Expression(6, Add)) at (prev + 6, 14) to (start + 0, 19)
+ = (c3 + (c4 + c5))
+- Code(Expression(5, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c3 + (c4 + c5)) - c6)
+- Code(Counter(5)) at (prev + 1, 22) to (start + 2, 14)
+- Code(Counter(4)) at (prev + 4, 17) to (start + 0, 25)
+- Code(Counter(5)) at (prev + 3, 9) to (start + 0, 14)
+- Code(Expression(11, Add)) at (prev + 2, 14) to (start + 0, 19)
+ = (c6 + (c7 + c8))
+- Code(Expression(10, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c6 + (c7 + c8)) - c9)
+- Code(Counter(7)) at (prev + 1, 21) to (start + 2, 14)
+- Code(Counter(8)) at (prev + 4, 17) to (start + 0, 25)
+- Code(Counter(7)) at (prev + 3, 9) to (start + 0, 14)
+- Code(Expression(16, Add)) at (prev + 2, 14) to (start + 0, 19)
+ = (c9 + (c10 + c11))
+- Code(Expression(15, Sub)) at (prev + 1, 12) to (start + 0, 19)
+ = ((c9 + (c10 + c11)) - c12)
+- Code(Counter(10)) at (prev + 1, 13) to (start + 0, 21)
+- Code(Counter(11)) at (prev + 1, 10) to (start + 1, 14)
+- Code(Expression(21, Add)) at (prev + 3, 14) to (start + 0, 19)
+ = (c12 + (c13 + c14))
+- Code(Expression(20, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c12 + (c13 + c14)) - c15)
+- Code(Counter(14)) at (prev + 1, 22) to (start + 2, 14)
+- Code(Counter(13)) at (prev + 3, 18) to (start + 2, 14)
+- Code(Expression(23, Add)) at (prev + 4, 9) to (start + 0, 14)
+ = (c13 + c14)
+- Code(Expression(26, Add)) at (prev + 2, 14) to (start + 0, 19)
+ = (c15 + c16)
+- Code(Expression(25, Sub)) at (prev + 1, 15) to (start + 0, 22)
+ = ((c15 + c16) - c17)
+- Code(Counter(16)) at (prev + 1, 22) to (start + 2, 14)
+- Code(Counter(18)) at (prev + 4, 17) to (start + 0, 22)
+- Code(Counter(16)) at (prev + 3, 9) to (start + 0, 14)
+- Code(Expression(27, Add)) at (prev + 2, 13) to (start + 1, 2)
+ = (c18 + c17)
+
diff --git a/tests/run-coverage/continue.coverage b/tests/coverage/continue.coverage
index 4916cac00..4916cac00 100644
--- a/tests/run-coverage/continue.coverage
+++ b/tests/coverage/continue.coverage
diff --git a/tests/coverage-map/status-quo/continue.rs b/tests/coverage/continue.rs
index 624aa9834..624aa9834 100644
--- a/tests/coverage-map/status-quo/continue.rs
+++ b/tests/coverage/continue.rs
diff --git a/tests/coverage/coroutine.cov-map b/tests/coverage/coroutine.cov-map
new file mode 100644
index 000000000..2f4936d9a
--- /dev/null
+++ b/tests/coverage/coroutine.cov-map
@@ -0,0 +1,53 @@
+Function name: coroutine::get_u32
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0b, 01, 01, 0b, 05, 01, 0e, 00, 13, 02, 00, 1d, 00, 3c, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 11, 1) to (start + 1, 11)
+- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 19)
+- Code(Expression(0, Sub)) at (prev + 0, 29) to (start + 0, 60)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
+Function name: coroutine::main
+Raw bytes (65): 0x[01, 01, 08, 05, 07, 09, 0d, 11, 15, 1e, 19, 11, 15, 15, 19, 1e, 19, 11, 15, 09, 01, 0f, 01, 02, 16, 01, 07, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 1e, 01, 22, 00, 27, 1a, 00, 2c, 00, 2e, 17, 01, 0e, 00, 35, 1a, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 8
+- expression 0 operands: lhs = Counter(1), rhs = Expression(1, Add)
+- expression 1 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 3 operands: lhs = Expression(7, Sub), rhs = Counter(6)
+- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 5 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 6 operands: lhs = Expression(7, Sub), rhs = Counter(6)
+- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
+Number of file 0 mappings: 9
+- Code(Counter(0)) at (prev + 15, 1) to (start + 2, 22)
+- Code(Counter(0)) at (prev + 7, 11) to (start + 0, 46)
+- Code(Counter(4)) at (prev + 1, 43) to (start + 0, 45)
+- Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 53)
+ = (c1 + (c2 + c3))
+- Code(Counter(4)) at (prev + 2, 11) to (start + 0, 46)
+- Code(Expression(7, Sub)) at (prev + 1, 34) to (start + 0, 39)
+ = (c4 - c5)
+- Code(Expression(6, Sub)) at (prev + 0, 44) to (start + 0, 46)
+ = ((c4 - c5) - c6)
+- Code(Expression(5, Add)) at (prev + 1, 14) to (start + 0, 53)
+ = (c5 + c6)
+- Code(Expression(6, Sub)) at (prev + 2, 1) to (start + 0, 2)
+ = ((c4 - c5) - c6)
+
+Function name: coroutine::main::{closure#0}
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 11, 1c, 01, 1f, 05, 02, 10, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 17, 28) to (start + 1, 31)
+- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)
+
diff --git a/tests/run-coverage/generator.coverage b/tests/coverage/coroutine.coverage
index daba2bea8..3a9791a0d 100644
--- a/tests/run-coverage/generator.coverage
+++ b/tests/coverage/coroutine.coverage
@@ -1,11 +1,11 @@
- LL| |#![feature(generators, generator_trait)]
+ LL| |#![feature(coroutines, coroutine_trait)]
LL| |
- LL| |use std::ops::{Generator, GeneratorState};
+ LL| |use std::ops::{Coroutine, CoroutineState};
LL| |use std::pin::Pin;
LL| |
LL| |// The following implementation of a function called from a `yield` statement
LL| |// (apparently requiring the Result and the `String` type or constructor)
- LL| |// creates conditions where the `generator::StateTransform` MIR transform will
+ LL| |// creates conditions where the `coroutine::StateTransform` MIR transform will
LL| |// drop all `Counter` `Coverage` statements from a MIR. `simplify.rs` has logic
LL| |// to handle this condition, and still report dead block coverage.
LL| 1|fn get_u32(val: bool) -> Result<u32, String> {
@@ -15,17 +15,17 @@
LL| |
LL| 1|fn main() {
LL| 1| let is_true = std::env::args().len() == 1;
- LL| 1| let mut generator = || {
+ LL| 1| let mut coroutine = || {
LL| 1| yield get_u32(is_true);
LL| 1| return "foo";
LL| 1| };
LL| |
- LL| 1| match Pin::new(&mut generator).resume(()) {
- LL| 1| GeneratorState::Yielded(Ok(1)) => {}
+ LL| 1| match Pin::new(&mut coroutine).resume(()) {
+ LL| 1| CoroutineState::Yielded(Ok(1)) => {}
LL| 0| _ => panic!("unexpected return from resume"),
LL| | }
- LL| 1| match Pin::new(&mut generator).resume(()) {
- LL| 1| GeneratorState::Complete("foo") => {}
+ LL| 1| match Pin::new(&mut coroutine).resume(()) {
+ LL| 1| CoroutineState::Complete("foo") => {}
LL| 0| _ => panic!("unexpected return from resume"),
LL| | }
LL| 1|}
diff --git a/tests/run-coverage/generator.rs b/tests/coverage/coroutine.rs
index 431999102..86d19af6f 100644
--- a/tests/run-coverage/generator.rs
+++ b/tests/coverage/coroutine.rs
@@ -1,11 +1,11 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
// The following implementation of a function called from a `yield` statement
// (apparently requiring the Result and the `String` type or constructor)
-// creates conditions where the `generator::StateTransform` MIR transform will
+// creates conditions where the `coroutine::StateTransform` MIR transform will
// drop all `Counter` `Coverage` statements from a MIR. `simplify.rs` has logic
// to handle this condition, and still report dead block coverage.
fn get_u32(val: bool) -> Result<u32, String> {
@@ -14,17 +14,17 @@ fn get_u32(val: bool) -> Result<u32, String> {
fn main() {
let is_true = std::env::args().len() == 1;
- let mut generator = || {
+ let mut coroutine = || {
yield get_u32(is_true);
return "foo";
};
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Yielded(Ok(1)) => {}
+ match Pin::new(&mut coroutine).resume(()) {
+ CoroutineState::Yielded(Ok(1)) => {}
_ => panic!("unexpected return from resume"),
}
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Complete("foo") => {}
+ match Pin::new(&mut coroutine).resume(()) {
+ CoroutineState::Complete("foo") => {}
_ => panic!("unexpected return from resume"),
}
}
diff --git a/tests/coverage-map/status-quo/dead_code.cov-map b/tests/coverage/dead_code.cov-map
index 8d5f88e63..0b8a40a8c 100644
--- a/tests/coverage-map/status-quo/dead_code.cov-map
+++ b/tests/coverage/dead_code.cov-map
@@ -14,23 +14,23 @@ Number of file 0 mappings: 4
= (c1 + (c0 - c1))
Function name: dead_code::unused_fn (unused)
-Raw bytes (24): 0x[01, 01, 00, 04, 01, 0f, 01, 07, 0f, 00, 07, 10, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Raw bytes (24): 0x[01, 01, 00, 04, 00, 0f, 01, 07, 0f, 00, 07, 10, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 15, 1) to (start + 7, 15)
+- Code(Zero) at (prev + 15, 1) to (start + 7, 15)
- Code(Zero) at (prev + 7, 16) to (start + 2, 6)
- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
Function name: dead_code::unused_pub_fn_not_in_library (unused)
-Raw bytes (24): 0x[01, 01, 00, 04, 01, 03, 01, 07, 0f, 00, 07, 10, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Raw bytes (24): 0x[01, 01, 00, 04, 00, 03, 01, 07, 0f, 00, 07, 10, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 3, 1) to (start + 7, 15)
+- Code(Zero) at (prev + 3, 1) to (start + 7, 15)
- Code(Zero) at (prev + 7, 16) to (start + 2, 6)
- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
diff --git a/tests/run-coverage/dead_code.coverage b/tests/coverage/dead_code.coverage
index c4ee9f23f..c4ee9f23f 100644
--- a/tests/run-coverage/dead_code.coverage
+++ b/tests/coverage/dead_code.coverage
diff --git a/tests/coverage-map/status-quo/dead_code.rs b/tests/coverage/dead_code.rs
index 3492712a6..3492712a6 100644
--- a/tests/coverage-map/status-quo/dead_code.rs
+++ b/tests/coverage/dead_code.rs
diff --git a/tests/coverage-map/status-quo/drop_trait.cov-map b/tests/coverage/drop_trait.cov-map
index 203d1048b..203d1048b 100644
--- a/tests/coverage-map/status-quo/drop_trait.cov-map
+++ b/tests/coverage/drop_trait.cov-map
diff --git a/tests/run-coverage/drop_trait.coverage b/tests/coverage/drop_trait.coverage
index 2c9439a93..2c9439a93 100644
--- a/tests/run-coverage/drop_trait.coverage
+++ b/tests/coverage/drop_trait.coverage
diff --git a/tests/coverage-map/status-quo/drop_trait.rs b/tests/coverage/drop_trait.rs
index 7b062719c..7b062719c 100644
--- a/tests/coverage-map/status-quo/drop_trait.rs
+++ b/tests/coverage/drop_trait.rs
diff --git a/tests/coverage/fn_sig_into_try.cov-map b/tests/coverage/fn_sig_into_try.cov-map
new file mode 100644
index 000000000..6e26c61aa
--- /dev/null
+++ b/tests/coverage/fn_sig_into_try.cov-map
@@ -0,0 +1,53 @@
+Function name: fn_sig_into_try::a
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0a, 01, 04, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 10, 1) to (start + 4, 2)
+
+Function name: fn_sig_into_try::b
+Raw bytes (28): 0x[01, 01, 02, 01, 00, 00, 02, 04, 01, 10, 01, 02, 0f, 00, 02, 0f, 00, 10, 02, 01, 05, 00, 0c, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Zero, rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 16, 1) to (start + 2, 15)
+- Code(Zero) at (prev + 2, 15) to (start + 0, 16)
+- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 12)
+ = (c0 - Zero)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (Zero + (c0 - Zero))
+
+Function name: fn_sig_into_try::c
+Raw bytes (28): 0x[01, 01, 02, 01, 00, 00, 02, 04, 01, 16, 01, 02, 17, 00, 02, 17, 00, 18, 02, 01, 05, 00, 0c, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Zero, rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 22, 1) to (start + 2, 23)
+- Code(Zero) at (prev + 2, 23) to (start + 0, 24)
+- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 12)
+ = (c0 - Zero)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (Zero + (c0 - Zero))
+
+Function name: fn_sig_into_try::d
+Raw bytes (28): 0x[01, 01, 02, 01, 00, 00, 02, 04, 01, 1c, 01, 03, 0f, 00, 03, 0f, 00, 10, 02, 01, 05, 00, 0c, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Zero, rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 28, 1) to (start + 3, 15)
+- Code(Zero) at (prev + 3, 15) to (start + 0, 16)
+- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 12)
+ = (c0 - Zero)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (Zero + (c0 - Zero))
+
diff --git a/tests/coverage/fn_sig_into_try.coverage b/tests/coverage/fn_sig_into_try.coverage
new file mode 100644
index 000000000..f1ddb1da7
--- /dev/null
+++ b/tests/coverage/fn_sig_into_try.coverage
@@ -0,0 +1,45 @@
+ LL| |#![feature(coverage_attribute)]
+ LL| |// compile-flags: --edition=2021
+ LL| |
+ LL| |// Regression test for inconsistent handling of function signature spans that
+ LL| |// are followed by code using the `?` operator.
+ LL| |//
+ LL| |// For each of these similar functions, the line containing the function
+ LL| |// signature should be handled in the same way.
+ LL| |
+ LL| 1|fn a() -> Option<i32>
+ LL| 1|{
+ LL| 1| Some(7i32);
+ LL| 1| Some(0)
+ LL| 1|}
+ LL| |
+ LL| 1|fn b() -> Option<i32>
+ LL| 1|{
+ LL| 1| Some(7i32)?;
+ ^0
+ LL| 1| Some(0)
+ LL| 1|}
+ LL| |
+ LL| 1|fn c() -> Option<i32>
+ LL| 1|{
+ LL| 1| let _ = Some(7i32)?;
+ ^0
+ LL| 1| Some(0)
+ LL| 1|}
+ LL| |
+ LL| 1|fn d() -> Option<i32>
+ LL| 1|{
+ LL| 1| let _: () = ();
+ LL| 1| Some(7i32)?;
+ ^0
+ LL| 1| Some(0)
+ LL| 1|}
+ LL| |
+ LL| |#[coverage(off)]
+ LL| |fn main() {
+ LL| | a();
+ LL| | b();
+ LL| | c();
+ LL| | d();
+ LL| |}
+
diff --git a/tests/coverage/fn_sig_into_try.rs b/tests/coverage/fn_sig_into_try.rs
new file mode 100644
index 000000000..92850c8a1
--- /dev/null
+++ b/tests/coverage/fn_sig_into_try.rs
@@ -0,0 +1,41 @@
+#![feature(coverage_attribute)]
+// compile-flags: --edition=2021
+
+// Regression test for inconsistent handling of function signature spans that
+// are followed by code using the `?` operator.
+//
+// For each of these similar functions, the line containing the function
+// signature should be handled in the same way.
+
+fn a() -> Option<i32>
+{
+ Some(7i32);
+ Some(0)
+}
+
+fn b() -> Option<i32>
+{
+ Some(7i32)?;
+ Some(0)
+}
+
+fn c() -> Option<i32>
+{
+ let _ = Some(7i32)?;
+ Some(0)
+}
+
+fn d() -> Option<i32>
+{
+ let _: () = ();
+ Some(7i32)?;
+ Some(0)
+}
+
+#[coverage(off)]
+fn main() {
+ a();
+ b();
+ c();
+ d();
+}
diff --git a/tests/coverage-map/status-quo/generics.cov-map b/tests/coverage/generics.cov-map
index 6079a433c..6079a433c 100644
--- a/tests/coverage-map/status-quo/generics.cov-map
+++ b/tests/coverage/generics.cov-map
diff --git a/tests/run-coverage/generics.coverage b/tests/coverage/generics.coverage
index 098391835..098391835 100644
--- a/tests/run-coverage/generics.coverage
+++ b/tests/coverage/generics.coverage
diff --git a/tests/coverage-map/status-quo/generics.rs b/tests/coverage/generics.rs
index bf4c2d8d6..bf4c2d8d6 100644
--- a/tests/coverage-map/status-quo/generics.rs
+++ b/tests/coverage/generics.rs
diff --git a/tests/coverage-map/status-quo/if.cov-map b/tests/coverage/if.cov-map
index 391a69e0e..391a69e0e 100644
--- a/tests/coverage-map/status-quo/if.cov-map
+++ b/tests/coverage/if.cov-map
diff --git a/tests/run-coverage/if.coverage b/tests/coverage/if.coverage
index 2e6845190..2e6845190 100644
--- a/tests/run-coverage/if.coverage
+++ b/tests/coverage/if.coverage
diff --git a/tests/coverage-map/status-quo/if.rs b/tests/coverage/if.rs
index 8ad5042ff..8ad5042ff 100644
--- a/tests/coverage-map/status-quo/if.rs
+++ b/tests/coverage/if.rs
diff --git a/tests/coverage-map/status-quo/if_else.cov-map b/tests/coverage/if_else.cov-map
index da692ca3a..da692ca3a 100644
--- a/tests/coverage-map/status-quo/if_else.cov-map
+++ b/tests/coverage/if_else.cov-map
diff --git a/tests/run-coverage/if_else.coverage b/tests/coverage/if_else.coverage
index 0274401f0..0274401f0 100644
--- a/tests/run-coverage/if_else.coverage
+++ b/tests/coverage/if_else.coverage
diff --git a/tests/coverage-map/status-quo/if_else.rs b/tests/coverage/if_else.rs
index 3244e1e3a..3244e1e3a 100644
--- a/tests/coverage-map/status-quo/if_else.rs
+++ b/tests/coverage/if_else.rs
diff --git a/tests/coverage-map/status-quo/inline-dead.cov-map b/tests/coverage/inline-dead.cov-map
index dec43d3e8..958b423f2 100644
--- a/tests/coverage-map/status-quo/inline-dead.cov-map
+++ b/tests/coverage/inline-dead.cov-map
@@ -1,45 +1,45 @@
Function name: inline_dead::dead (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 19, 01, 02, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 19, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 25, 1) to (start + 2, 2)
+- Code(Zero) at (prev + 25, 1) to (start + 2, 2)
Function name: inline_dead::live::<false>
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 10, 01, 01, 09, 00, 02, 09, 00, 0f, 02, 02, 09, 00, 0a, 07, 02, 01, 00, 02]
+Raw bytes (28): 0x[01, 01, 02, 01, 00, 00, 02, 04, 01, 10, 01, 01, 09, 00, 02, 09, 00, 0f, 02, 02, 09, 00, 0a, 07, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Zero, rhs = Expression(0, Sub)
Number of file 0 mappings: 4
- Code(Counter(0)) at (prev + 16, 1) to (start + 1, 9)
- Code(Zero) at (prev + 2, 9) to (start + 0, 15)
- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 10)
- = (c0 - c1)
+ = (c0 - Zero)
- Code(Expression(1, Add)) at (prev + 2, 1) to (start + 0, 2)
- = (c1 + (c0 - c1))
+ = (Zero + (c0 - Zero))
Function name: inline_dead::main
-Raw bytes (16): 0x[01, 01, 01, 01, 00, 02, 01, 04, 01, 03, 0d, 03, 07, 06, 02, 02]
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 04, 01, 03, 0d, 01, 07, 06, 02, 02]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 1
-- expression 0 operands: lhs = Counter(0), rhs = Zero
+Number of expressions: 0
Number of file 0 mappings: 2
- Code(Counter(0)) at (prev + 4, 1) to (start + 3, 13)
-- Code(Expression(0, Add)) at (prev + 7, 6) to (start + 2, 2)
- = (c0 + Zero)
+- Code(Counter(0)) at (prev + 7, 6) to (start + 2, 2)
Function name: inline_dead::main::{closure#0}
-Raw bytes (16): 0x[01, 01, 01, 01, 05, 02, 00, 09, 0d, 00, 0e, 03, 02, 05, 00, 06]
+Raw bytes (23): 0x[01, 01, 02, 00, 06, 01, 00, 03, 01, 07, 17, 00, 18, 00, 02, 0d, 00, 0e, 03, 02, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 1
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-Number of file 0 mappings: 2
-- Code(Zero) at (prev + 9, 13) to (start + 0, 14)
+Number of expressions: 2
+- expression 0 operands: lhs = Zero, rhs = Expression(1, Sub)
+- expression 1 operands: lhs = Counter(0), rhs = Zero
+Number of file 0 mappings: 3
+- Code(Counter(0)) at (prev + 7, 23) to (start + 0, 24)
+- Code(Zero) at (prev + 2, 13) to (start + 0, 14)
- Code(Expression(0, Add)) at (prev + 2, 5) to (start + 0, 6)
- = (c0 + c1)
+ = (Zero + (c0 - Zero))
diff --git a/tests/run-coverage/inline-dead.coverage b/tests/coverage/inline-dead.coverage
index de96aa17a..de96aa17a 100644
--- a/tests/run-coverage/inline-dead.coverage
+++ b/tests/coverage/inline-dead.coverage
diff --git a/tests/coverage-map/status-quo/inline-dead.rs b/tests/coverage/inline-dead.rs
index 854fa0629..854fa0629 100644
--- a/tests/coverage-map/status-quo/inline-dead.rs
+++ b/tests/coverage/inline-dead.rs
diff --git a/tests/coverage-map/status-quo/inline.cov-map b/tests/coverage/inline.cov-map
index 57ae85623..72b10fd0c 100644
--- a/tests/coverage-map/status-quo/inline.cov-map
+++ b/tests/coverage/inline.cov-map
@@ -1,19 +1,17 @@
Function name: inline::display::<char>
-Raw bytes (35): 0x[01, 01, 03, 01, 05, 05, 00, 03, 05, 05, 01, 29, 01, 00, 22, 05, 01, 09, 00, 0a, 03, 00, 0e, 00, 10, 07, 00, 11, 02, 06, 0a, 03, 05, 01, 02]
+Raw bytes (33): 0x[01, 01, 02, 01, 05, 03, 05, 05, 01, 29, 01, 00, 22, 05, 01, 09, 00, 0a, 03, 00, 0e, 00, 10, 05, 00, 11, 02, 06, 06, 03, 05, 01, 02]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 3
+Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(1), rhs = Zero
-- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(0, Add), rhs = Counter(1)
Number of file 0 mappings: 5
- Code(Counter(0)) at (prev + 41, 1) to (start + 0, 34)
- Code(Counter(1)) at (prev + 1, 9) to (start + 0, 10)
- Code(Expression(0, Add)) at (prev + 0, 14) to (start + 0, 16)
= (c0 + c1)
-- Code(Expression(1, Add)) at (prev + 0, 17) to (start + 2, 6)
- = (c1 + Zero)
-- Code(Expression(2, Sub)) at (prev + 3, 5) to (start + 1, 2)
+- Code(Counter(1)) at (prev + 0, 17) to (start + 2, 6)
+- Code(Expression(1, Sub)) at (prev + 3, 5) to (start + 1, 2)
= ((c0 + c1) - c1)
Function name: inline::error
@@ -41,15 +39,14 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 5, 1) to (start + 2, 2)
Function name: inline::permutate::<char>
-Raw bytes (54): 0x[01, 01, 05, 01, 05, 02, 0d, 11, 00, 05, 13, 09, 0d, 08, 01, 0f, 01, 02, 0e, 05, 02, 0f, 02, 06, 02, 02, 0f, 00, 14, 11, 01, 0d, 00, 0e, 06, 00, 12, 00, 16, 0b, 00, 17, 04, 0a, 0d, 05, 0c, 02, 06, 0f, 03, 01, 00, 02]
+Raw bytes (52): 0x[01, 01, 04, 01, 05, 02, 0d, 05, 0f, 09, 0d, 08, 01, 0f, 01, 02, 0e, 05, 02, 0f, 02, 06, 02, 02, 0f, 00, 14, 11, 01, 0d, 00, 0e, 06, 00, 12, 00, 16, 11, 00, 17, 04, 0a, 0d, 05, 0c, 02, 06, 0b, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 5
+Number of expressions: 4
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Expression(0, Sub), rhs = Counter(3)
-- expression 2 operands: lhs = Counter(4), rhs = Zero
-- expression 3 operands: lhs = Counter(1), rhs = Expression(4, Add)
-- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 2 operands: lhs = Counter(1), rhs = Expression(3, Add)
+- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
Number of file 0 mappings: 8
- Code(Counter(0)) at (prev + 15, 1) to (start + 2, 14)
- Code(Counter(1)) at (prev + 2, 15) to (start + 2, 6)
@@ -58,10 +55,9 @@ Number of file 0 mappings: 8
- Code(Counter(4)) at (prev + 1, 13) to (start + 0, 14)
- Code(Expression(1, Sub)) at (prev + 0, 18) to (start + 0, 22)
= ((c0 - c1) - c3)
-- Code(Expression(2, Add)) at (prev + 0, 23) to (start + 4, 10)
- = (c4 + Zero)
+- Code(Counter(4)) at (prev + 0, 23) to (start + 4, 10)
- Code(Counter(3)) at (prev + 5, 12) to (start + 2, 6)
-- Code(Expression(3, Add)) at (prev + 3, 1) to (start + 0, 2)
+- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
= (c1 + (c2 + c3))
Function name: inline::permutations::<char>
diff --git a/tests/run-coverage/inline.coverage b/tests/coverage/inline.coverage
index 6efd9a083..6efd9a083 100644
--- a/tests/run-coverage/inline.coverage
+++ b/tests/coverage/inline.coverage
diff --git a/tests/coverage-map/status-quo/inline.rs b/tests/coverage/inline.rs
index 9cfab9ddb..9cfab9ddb 100644
--- a/tests/coverage-map/status-quo/inline.rs
+++ b/tests/coverage/inline.rs
diff --git a/tests/coverage-map/status-quo/inner_items.cov-map b/tests/coverage/inner_items.cov-map
index 3f39d74ef..3f39d74ef 100644
--- a/tests/coverage-map/status-quo/inner_items.cov-map
+++ b/tests/coverage/inner_items.cov-map
diff --git a/tests/run-coverage/inner_items.coverage b/tests/coverage/inner_items.coverage
index 65493bcd9..65493bcd9 100644
--- a/tests/run-coverage/inner_items.coverage
+++ b/tests/coverage/inner_items.coverage
diff --git a/tests/coverage-map/status-quo/inner_items.rs b/tests/coverage/inner_items.rs
index bcb62b303..bcb62b303 100644
--- a/tests/coverage-map/status-quo/inner_items.rs
+++ b/tests/coverage/inner_items.rs
diff --git a/tests/coverage-map/status-quo/issue-83601.cov-map b/tests/coverage/issue-83601.cov-map
index f5db3a897..f5db3a897 100644
--- a/tests/coverage-map/status-quo/issue-83601.cov-map
+++ b/tests/coverage/issue-83601.cov-map
diff --git a/tests/run-coverage/issue-83601.coverage b/tests/coverage/issue-83601.coverage
index 7995332ca..7995332ca 100644
--- a/tests/run-coverage/issue-83601.coverage
+++ b/tests/coverage/issue-83601.coverage
diff --git a/tests/coverage-map/status-quo/issue-83601.rs b/tests/coverage/issue-83601.rs
index 0b72a8194..0b72a8194 100644
--- a/tests/coverage-map/status-quo/issue-83601.rs
+++ b/tests/coverage/issue-83601.rs
diff --git a/tests/coverage-map/status-quo/issue-84561.cov-map b/tests/coverage/issue-84561.cov-map
index fe098fd39..82582b309 100644
--- a/tests/coverage-map/status-quo/issue-84561.cov-map
+++ b/tests/coverage/issue-84561.cov-map
@@ -1,22 +1,21 @@
Function name: <issue_84561::Foo as core::cmp::PartialEq>::eq
-Raw bytes (14): 0x[01, 01, 00, 02, 01, 04, 0a, 00, 13, 00, 00, 0a, 00, 13]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 04, 0a, 00, 13]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
-Number of file 0 mappings: 2
+Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 4, 10) to (start + 0, 19)
-- Code(Zero) at (prev + 0, 10) to (start + 0, 19)
Function name: <issue_84561::Foo as core::fmt::Debug>::fmt
-Raw bytes (29): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 89, 01, 09, 00, 25, 05, 00, 25, 00, 26, 02, 01, 09, 00, 0f, 07, 01, 05, 00, 06]
+Raw bytes (29): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 88, 01, 05, 01, 25, 05, 01, 25, 00, 26, 02, 01, 09, 00, 0f, 07, 01, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 137, 9) to (start + 0, 37)
-- Code(Counter(1)) at (prev + 0, 37) to (start + 0, 38)
+- Code(Counter(0)) at (prev + 136, 5) to (start + 1, 37)
+- Code(Counter(1)) at (prev + 1, 37) to (start + 0, 38)
- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 15)
= (c0 - c1)
- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 0, 6)
@@ -86,47 +85,47 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 165, 9) to (start + 2, 10)
Function name: issue_84561::test3
-Raw bytes (437): 0x[01, 01, 41, 05, 09, 0d, 11, 15, 19, 12, 1d, 15, 19, 21, 25, 1e, 29, 21, 25, 31, 39, 3d, 41, 2e, 45, 3d, 41, 42, 49, 45, 4d, 3f, 51, 42, 49, 45, 4d, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 59, 92, 01, 55, 51, 59, 8f, 01, 5d, 92, 01, 55, 51, 59, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 59, 82, 01, 65, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 59, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, 71, fe, 01, 82, 02, 71, 69, 6d, 69, 6d, 82, 02, 71, 69, 6d, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, ee, 01, 81, 01, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, 33, 01, 06, 01, 03, 1c, 05, 04, 09, 01, 1c, 02, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 06, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 12, 02, 05, 00, 1f, 0e, 01, 05, 00, 0f, 00, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 00, 03, 20, 00, 30, 00, 00, 33, 00, 41, 00, 00, 4b, 00, 5a, 1e, 01, 05, 00, 0f, 00, 05, 09, 03, 10, 00, 05, 0d, 00, 1b, 00, 02, 0d, 00, 1c, 1a, 04, 09, 05, 06, 31, 06, 05, 03, 06, 22, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 2e, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 2a, 05, 09, 03, 0a, 3f, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 00, 03, 0d, 00, 1d, 3a, 03, 09, 00, 13, 00, 03, 0d, 00, 1d, 87, 01, 03, 05, 00, 0f, 8f, 01, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 8a, 01, 02, 0d, 00, 13, 82, 01, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 7e, 02, 0d, 00, 13, f3, 01, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 75, 04, 0d, 00, 13, fb, 01, 02, 0d, 00, 17, 82, 02, 01, 14, 00, 1b, 71, 01, 15, 00, 1b, fe, 01, 02, 15, 00, 1b, f6, 01, 04, 0d, 00, 13, 7d, 03, 09, 00, 19, ee, 01, 02, 05, 00, 0f, ea, 01, 03, 09, 00, 22, 00, 02, 05, 00, 0f, 00, 03, 09, 00, 2c, 00, 02, 01, 00, 02]
+Raw bytes (436): 0x[01, 01, 41, 05, 09, 0d, 00, 15, 19, 12, 00, 15, 19, 21, 00, 1e, 00, 21, 00, 31, 00, 3d, 41, 2e, 45, 3d, 41, 42, 49, 45, 00, 3f, 51, 42, 49, 45, 00, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 00, 92, 01, 55, 51, 00, 8f, 01, 5d, 92, 01, 55, 51, 00, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 00, 82, 01, 65, 87, 01, 61, 5d, 8a, 01, 8f, 01, 5d, 92, 01, 55, 51, 00, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, 71, fe, 01, 82, 02, 71, 69, 6d, 69, 6d, 82, 02, 71, 69, 6d, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, ee, 01, 00, f3, 01, 7d, 75, f6, 01, fb, 01, 79, 71, fe, 01, 82, 02, 71, 69, 6d, 33, 01, 06, 01, 03, 1c, 05, 04, 09, 01, 1c, 02, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 06, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 12, 02, 05, 00, 1f, 0e, 01, 05, 00, 0f, 00, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 00, 03, 20, 00, 30, 00, 00, 33, 00, 41, 00, 00, 4b, 00, 5a, 1e, 01, 05, 00, 0f, 00, 05, 09, 03, 10, 00, 05, 0d, 00, 1b, 00, 02, 0d, 00, 1c, 1a, 04, 09, 05, 06, 31, 06, 05, 03, 06, 22, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 2e, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 2a, 05, 09, 03, 0a, 3f, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 00, 03, 0d, 00, 1d, 3a, 03, 09, 00, 13, 00, 03, 0d, 00, 1d, 87, 01, 03, 05, 00, 0f, 8f, 01, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 8a, 01, 02, 0d, 00, 13, 82, 01, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 7e, 02, 0d, 00, 13, f3, 01, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 75, 04, 0d, 00, 13, fb, 01, 02, 0d, 00, 17, 82, 02, 01, 14, 00, 1b, 71, 01, 15, 00, 1b, fe, 01, 02, 15, 00, 1b, f6, 01, 04, 0d, 00, 13, 7d, 03, 09, 00, 19, ee, 01, 02, 05, 00, 0f, ea, 01, 03, 09, 00, 22, 00, 02, 05, 00, 0f, 00, 03, 09, 00, 2c, 00, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 65
- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
-- expression 1 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 1 operands: lhs = Counter(3), rhs = Zero
- expression 2 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 3 operands: lhs = Expression(4, Sub), rhs = Counter(7)
+- expression 3 operands: lhs = Expression(4, Sub), rhs = Zero
- expression 4 operands: lhs = Counter(5), rhs = Counter(6)
-- expression 5 operands: lhs = Counter(8), rhs = Counter(9)
-- expression 6 operands: lhs = Expression(7, Sub), rhs = Counter(10)
-- expression 7 operands: lhs = Counter(8), rhs = Counter(9)
-- expression 8 operands: lhs = Counter(12), rhs = Counter(14)
+- expression 5 operands: lhs = Counter(8), rhs = Zero
+- expression 6 operands: lhs = Expression(7, Sub), rhs = Zero
+- expression 7 operands: lhs = Counter(8), rhs = Zero
+- expression 8 operands: lhs = Counter(12), rhs = Zero
- expression 9 operands: lhs = Counter(15), rhs = Counter(16)
- expression 10 operands: lhs = Expression(11, Sub), rhs = Counter(17)
- expression 11 operands: lhs = Counter(15), rhs = Counter(16)
- expression 12 operands: lhs = Expression(16, Sub), rhs = Counter(18)
-- expression 13 operands: lhs = Counter(17), rhs = Counter(19)
+- expression 13 operands: lhs = Counter(17), rhs = Zero
- expression 14 operands: lhs = Expression(15, Add), rhs = Counter(20)
- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(18)
-- expression 16 operands: lhs = Counter(17), rhs = Counter(19)
+- expression 16 operands: lhs = Counter(17), rhs = Zero
- expression 17 operands: lhs = Counter(23), rhs = Expression(34, Sub)
- expression 18 operands: lhs = Expression(35, Add), rhs = Counter(23)
- expression 19 operands: lhs = Expression(36, Sub), rhs = Counter(21)
-- expression 20 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 20 operands: lhs = Counter(20), rhs = Zero
- expression 21 operands: lhs = Expression(36, Sub), rhs = Counter(21)
-- expression 22 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 22 operands: lhs = Counter(20), rhs = Zero
- expression 23 operands: lhs = Expression(35, Add), rhs = Counter(23)
- expression 24 operands: lhs = Expression(36, Sub), rhs = Counter(21)
-- expression 25 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 25 operands: lhs = Counter(20), rhs = Zero
- expression 26 operands: lhs = Expression(33, Add), rhs = Counter(24)
- expression 27 operands: lhs = Counter(23), rhs = Expression(34, Sub)
- expression 28 operands: lhs = Expression(35, Add), rhs = Counter(23)
- expression 29 operands: lhs = Expression(36, Sub), rhs = Counter(21)
-- expression 30 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 30 operands: lhs = Counter(20), rhs = Zero
- expression 31 operands: lhs = Expression(32, Sub), rhs = Counter(25)
- expression 32 operands: lhs = Expression(33, Add), rhs = Counter(24)
- expression 33 operands: lhs = Counter(23), rhs = Expression(34, Sub)
- expression 34 operands: lhs = Expression(35, Add), rhs = Counter(23)
- expression 35 operands: lhs = Expression(36, Sub), rhs = Counter(21)
-- expression 36 operands: lhs = Counter(20), rhs = Counter(22)
+- expression 36 operands: lhs = Counter(20), rhs = Zero
- expression 37 operands: lhs = Counter(29), rhs = Expression(61, Sub)
- expression 38 operands: lhs = Expression(62, Add), rhs = Counter(30)
- expression 39 operands: lhs = Counter(28), rhs = Expression(63, Sub)
@@ -148,7 +147,7 @@ Number of expressions: 65
- expression 55 operands: lhs = Counter(28), rhs = Expression(63, Sub)
- expression 56 operands: lhs = Expression(64, Sub), rhs = Counter(28)
- expression 57 operands: lhs = Counter(26), rhs = Counter(27)
-- expression 58 operands: lhs = Expression(59, Sub), rhs = Counter(32)
+- expression 58 operands: lhs = Expression(59, Sub), rhs = Zero
- expression 59 operands: lhs = Expression(60, Add), rhs = Counter(31)
- expression 60 operands: lhs = Counter(29), rhs = Expression(61, Sub)
- expression 61 operands: lhs = Expression(62, Add), rhs = Counter(30)
@@ -162,27 +161,27 @@ Number of file 0 mappings: 51
= (c1 - c2)
- Code(Counter(3)) at (prev + 5, 5) to (start + 0, 31)
- Code(Expression(1, Sub)) at (prev + 1, 5) to (start + 0, 31)
- = (c3 - c4)
+ = (c3 - Zero)
- Code(Counter(5)) at (prev + 1, 9) to (start + 1, 28)
- Code(Expression(4, Sub)) at (prev + 2, 5) to (start + 0, 31)
= (c5 - c6)
- Code(Expression(3, Sub)) at (prev + 1, 5) to (start + 0, 15)
- = ((c5 - c6) - c7)
+ = ((c5 - c6) - Zero)
- Code(Zero) at (prev + 0, 32) to (start + 0, 48)
- Code(Counter(8)) at (prev + 1, 5) to (start + 3, 15)
- Code(Zero) at (prev + 3, 32) to (start + 0, 48)
- Code(Zero) at (prev + 0, 51) to (start + 0, 65)
- Code(Zero) at (prev + 0, 75) to (start + 0, 90)
- Code(Expression(7, Sub)) at (prev + 1, 5) to (start + 0, 15)
- = (c8 - c9)
+ = (c8 - Zero)
- Code(Zero) at (prev + 5, 9) to (start + 3, 16)
- Code(Zero) at (prev + 5, 13) to (start + 0, 27)
- Code(Zero) at (prev + 2, 13) to (start + 0, 28)
- Code(Expression(6, Sub)) at (prev + 4, 9) to (start + 5, 6)
- = ((c8 - c9) - c10)
+ = ((c8 - Zero) - Zero)
- Code(Counter(12)) at (prev + 6, 5) to (start + 3, 6)
- Code(Expression(8, Sub)) at (prev + 4, 5) to (start + 3, 6)
- = (c12 - c14)
+ = (c12 - Zero)
- Code(Counter(15)) at (prev + 4, 9) to (start + 4, 6)
- Code(Expression(11, Sub)) at (prev + 5, 8) to (start + 0, 15)
= (c15 - c16)
@@ -190,24 +189,24 @@ Number of file 0 mappings: 51
- Code(Expression(10, Sub)) at (prev + 5, 9) to (start + 3, 10)
= ((c15 - c16) - c17)
- Code(Expression(15, Add)) at (prev + 5, 8) to (start + 0, 15)
- = ((c17 - c19) + c18)
+ = ((c17 - Zero) + c18)
- Code(Counter(20)) at (prev + 1, 9) to (start + 0, 19)
- Code(Zero) at (prev + 3, 13) to (start + 0, 29)
- Code(Expression(14, Sub)) at (prev + 3, 9) to (start + 0, 19)
- = (((c17 - c19) + c18) - c20)
+ = (((c17 - Zero) + c18) - c20)
- Code(Zero) at (prev + 3, 13) to (start + 0, 29)
- Code(Expression(33, Add)) at (prev + 3, 5) to (start + 0, 15)
- = (c23 + (((c20 - c22) + c21) - c23))
+ = (c23 + (((c20 - Zero) + c21) - c23))
- Code(Expression(35, Add)) at (prev + 1, 12) to (start + 0, 19)
- = ((c20 - c22) + c21)
+ = ((c20 - Zero) + c21)
- Code(Counter(23)) at (prev + 1, 13) to (start + 0, 19)
- Code(Expression(34, Sub)) at (prev + 2, 13) to (start + 0, 19)
- = (((c20 - c22) + c21) - c23)
+ = (((c20 - Zero) + c21) - c23)
- Code(Expression(32, Sub)) at (prev + 4, 5) to (start + 2, 19)
- = ((c23 + (((c20 - c22) + c21) - c23)) - c24)
+ = ((c23 + (((c20 - Zero) + c21) - c23)) - c24)
- Code(Counter(25)) at (prev + 3, 13) to (start + 0, 19)
- Code(Expression(31, Sub)) at (prev + 2, 13) to (start + 0, 19)
- = (((c23 + (((c20 - c22) + c21) - c23)) - c24) - c25)
+ = (((c23 + (((c20 - Zero) + c21) - c23)) - c24) - c25)
- Code(Expression(60, Add)) at (prev + 3, 5) to (start + 0, 15)
= (c29 + ((c28 + ((c26 - c27) - c28)) - c30))
- Code(Counter(26)) at (prev + 1, 12) to (start + 0, 19)
@@ -226,7 +225,7 @@ Number of file 0 mappings: 51
- Code(Expression(59, Sub)) at (prev + 2, 5) to (start + 0, 15)
= ((c29 + ((c28 + ((c26 - c27) - c28)) - c30)) - c31)
- Code(Expression(58, Sub)) at (prev + 3, 9) to (start + 0, 34)
- = (((c29 + ((c28 + ((c26 - c27) - c28)) - c30)) - c31) - c32)
+ = (((c29 + ((c28 + ((c26 - c27) - c28)) - c30)) - c31) - Zero)
- Code(Zero) at (prev + 2, 5) to (start + 0, 15)
- Code(Zero) at (prev + 3, 9) to (start + 0, 44)
- Code(Zero) at (prev + 2, 1) to (start + 0, 2)
diff --git a/tests/run-coverage/issue-84561.coverage b/tests/coverage/issue-84561.coverage
index 222f877d3..e693866e2 100644
--- a/tests/run-coverage/issue-84561.coverage
+++ b/tests/coverage/issue-84561.coverage
@@ -135,7 +135,7 @@
LL| 0|}
LL| |
LL| |impl std::fmt::Debug for Foo {
- LL| | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ LL| 7| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
LL| 7| write!(f, "try and succeed")?;
^0
LL| 7| Ok(())
diff --git a/tests/coverage-map/status-quo/issue-84561.rs b/tests/coverage/issue-84561.rs
index facf5b5b4..facf5b5b4 100644
--- a/tests/coverage-map/status-quo/issue-84561.rs
+++ b/tests/coverage/issue-84561.rs
diff --git a/tests/coverage/issue-85461.cov-map b/tests/coverage/issue-85461.cov-map
new file mode 100644
index 000000000..d1c449b9a
--- /dev/null
+++ b/tests/coverage/issue-85461.cov-map
@@ -0,0 +1,8 @@
+Function name: issue_85461::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 08, 01, 03, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 8, 1) to (start + 3, 2)
+
diff --git a/tests/run-coverage/issue-85461.coverage b/tests/coverage/issue-85461.coverage
index cbc910664..cbc910664 100644
--- a/tests/run-coverage/issue-85461.coverage
+++ b/tests/coverage/issue-85461.coverage
diff --git a/tests/run-coverage/issue-85461.rs b/tests/coverage/issue-85461.rs
index 9d4c90a82..9d4c90a82 100644
--- a/tests/run-coverage/issue-85461.rs
+++ b/tests/coverage/issue-85461.rs
diff --git a/tests/coverage-map/status-quo/issue-93054.cov-map b/tests/coverage/issue-93054.cov-map
index 52fe7f58d..c2c6e9a65 100644
--- a/tests/coverage-map/status-quo/issue-93054.cov-map
+++ b/tests/coverage/issue-93054.cov-map
@@ -1,10 +1,10 @@
Function name: issue_93054::foo2 (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 16, 01, 00, 1d]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 16, 01, 00, 1d]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 22, 1) to (start + 0, 29)
+- Code(Zero) at (prev + 22, 1) to (start + 0, 29)
Function name: issue_93054::main
Raw bytes (9): 0x[01, 01, 00, 01, 01, 1e, 01, 00, 0d]
@@ -15,10 +15,10 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 30, 1) to (start + 0, 13)
Function name: issue_93054::make (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 1a, 01, 02, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 1a, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 26, 1) to (start + 2, 2)
+- Code(Zero) at (prev + 26, 1) to (start + 2, 2)
diff --git a/tests/run-coverage/issue-93054.coverage b/tests/coverage/issue-93054.coverage
index 15f225326..15f225326 100644
--- a/tests/run-coverage/issue-93054.coverage
+++ b/tests/coverage/issue-93054.coverage
diff --git a/tests/coverage-map/status-quo/issue-93054.rs b/tests/coverage/issue-93054.rs
index da546cfee..da546cfee 100644
--- a/tests/coverage-map/status-quo/issue-93054.rs
+++ b/tests/coverage/issue-93054.rs
diff --git a/tests/coverage/lazy_boolean.cov-map b/tests/coverage/lazy_boolean.cov-map
new file mode 100644
index 000000000..0ad393c40
--- /dev/null
+++ b/tests/coverage/lazy_boolean.cov-map
@@ -0,0 +1,219 @@
+Function name: lazy_boolean::main
+Raw bytes (636): 0x[01, 01, a4, 01, 01, 05, 09, 8a, 05, 8f, 05, 09, 05, 02, 05, 02, 8f, 05, 09, 05, 02, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 09, 8a, 05, 8f, 05, 09, 05, 02, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 21, da, 04, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, d7, 04, 25, 21, da, 04, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 25, d2, 04, d7, 04, 25, 21, da, 04, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 1c, 01, 03, 01, 07, 0f, 05, 07, 10, 04, 06, 02, 04, 06, 00, 07, 87, 05, 02, 09, 00, 11, 8f, 05, 02, 0d, 00, 12, 8a, 05, 02, 0d, 00, 12, ff, 04, 03, 09, 00, 11, 87, 05, 02, 0d, 00, 12, 82, 05, 02, 0d, 00, 12, f7, 04, 02, 09, 00, 11, ff, 04, 00, 14, 00, 19, 11, 00, 1d, 00, 22, ef, 04, 01, 09, 00, 11, f7, 04, 00, 14, 00, 19, 15, 00, 1d, 00, 22, ef, 04, 04, 09, 00, 10, ea, 04, 01, 05, 03, 06, 19, 03, 06, 00, 07, e7, 04, 03, 09, 00, 10, 1d, 01, 05, 03, 06, e2, 04, 05, 05, 03, 06, df, 04, 05, 09, 00, 10, da, 04, 00, 11, 02, 06, 21, 02, 06, 00, 07, d7, 04, 02, 08, 00, 0f, 25, 00, 10, 02, 06, d2, 04, 02, 0c, 02, 06, cf, 04, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 164
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 2 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 4 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 5 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 7 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 8 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 9 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 10 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 11 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 12 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 13 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 14 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 15 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 16 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 17 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 18 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 19 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 20 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 21 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 22 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 23 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 24 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 25 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 26 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 27 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 28 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 29 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 30 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 31 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 32 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 33 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 34 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 35 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 36 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 37 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 38 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 39 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 40 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 41 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 42 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 43 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 44 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 45 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 46 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 47 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 48 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 49 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 50 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 51 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 52 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 53 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 54 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 55 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 56 operands: lhs = Expression(155, Add), rhs = Counter(6)
+- expression 57 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 58 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 59 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 60 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 61 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 62 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 63 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 64 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 65 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 66 operands: lhs = Counter(6), rhs = Expression(154, Sub)
+- expression 67 operands: lhs = Expression(155, Add), rhs = Counter(6)
+- expression 68 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 69 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 70 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 71 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 72 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 73 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 74 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 75 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 76 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 77 operands: lhs = Expression(153, Add), rhs = Counter(7)
+- expression 78 operands: lhs = Counter(6), rhs = Expression(154, Sub)
+- expression 79 operands: lhs = Expression(155, Add), rhs = Counter(6)
+- expression 80 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 81 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 82 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 83 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 84 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 85 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 86 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 87 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 88 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 89 operands: lhs = Counter(7), rhs = Expression(152, Sub)
+- expression 90 operands: lhs = Expression(153, Add), rhs = Counter(7)
+- expression 91 operands: lhs = Counter(6), rhs = Expression(154, Sub)
+- expression 92 operands: lhs = Expression(155, Add), rhs = Counter(6)
+- expression 93 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 94 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 95 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 96 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 97 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 98 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 99 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 100 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 101 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 102 operands: lhs = Expression(151, Add), rhs = Counter(8)
+- expression 103 operands: lhs = Counter(7), rhs = Expression(152, Sub)
+- expression 104 operands: lhs = Expression(153, Add), rhs = Counter(7)
+- expression 105 operands: lhs = Counter(6), rhs = Expression(154, Sub)
+- expression 106 operands: lhs = Expression(155, Add), rhs = Counter(6)
+- expression 107 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 108 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 109 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 110 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 111 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 112 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 113 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 114 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 115 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 116 operands: lhs = Counter(8), rhs = Expression(150, Sub)
+- expression 117 operands: lhs = Expression(151, Add), rhs = Counter(8)
+- expression 118 operands: lhs = Counter(7), rhs = Expression(152, Sub)
+- expression 119 operands: lhs = Expression(153, Add), rhs = Counter(7)
+- expression 120 operands: lhs = Counter(6), rhs = Expression(154, Sub)
+- expression 121 operands: lhs = Expression(155, Add), rhs = Counter(6)
+- expression 122 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 123 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 124 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 125 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 126 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 127 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 128 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 129 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 130 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 131 operands: lhs = Expression(149, Add), rhs = Counter(9)
+- expression 132 operands: lhs = Counter(8), rhs = Expression(150, Sub)
+- expression 133 operands: lhs = Expression(151, Add), rhs = Counter(8)
+- expression 134 operands: lhs = Counter(7), rhs = Expression(152, Sub)
+- expression 135 operands: lhs = Expression(153, Add), rhs = Counter(7)
+- expression 136 operands: lhs = Counter(6), rhs = Expression(154, Sub)
+- expression 137 operands: lhs = Expression(155, Add), rhs = Counter(6)
+- expression 138 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 139 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 140 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 141 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 142 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 143 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 144 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 145 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 146 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 147 operands: lhs = Counter(9), rhs = Expression(148, Sub)
+- expression 148 operands: lhs = Expression(149, Add), rhs = Counter(9)
+- expression 149 operands: lhs = Counter(8), rhs = Expression(150, Sub)
+- expression 150 operands: lhs = Expression(151, Add), rhs = Counter(8)
+- expression 151 operands: lhs = Counter(7), rhs = Expression(152, Sub)
+- expression 152 operands: lhs = Expression(153, Add), rhs = Counter(7)
+- expression 153 operands: lhs = Counter(6), rhs = Expression(154, Sub)
+- expression 154 operands: lhs = Expression(155, Add), rhs = Counter(6)
+- expression 155 operands: lhs = Counter(5), rhs = Expression(156, Sub)
+- expression 156 operands: lhs = Expression(157, Add), rhs = Counter(5)
+- expression 157 operands: lhs = Counter(4), rhs = Expression(158, Sub)
+- expression 158 operands: lhs = Expression(159, Add), rhs = Counter(4)
+- expression 159 operands: lhs = Counter(3), rhs = Expression(160, Sub)
+- expression 160 operands: lhs = Expression(161, Add), rhs = Counter(3)
+- expression 161 operands: lhs = Counter(2), rhs = Expression(162, Sub)
+- expression 162 operands: lhs = Expression(163, Add), rhs = Counter(2)
+- expression 163 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 28
+- Code(Counter(0)) at (prev + 3, 1) to (start + 7, 15)
+- Code(Counter(1)) at (prev + 7, 16) to (start + 4, 6)
+- Code(Expression(0, Sub)) at (prev + 4, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(161, Add)) at (prev + 2, 9) to (start + 0, 17)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+- Code(Expression(163, Add)) at (prev + 2, 13) to (start + 0, 18)
+ = (c1 + (c0 - c1))
+- Code(Expression(162, Sub)) at (prev + 2, 13) to (start + 0, 18)
+ = ((c1 + (c0 - c1)) - c2)
+- Code(Expression(159, Add)) at (prev + 3, 9) to (start + 0, 17)
+ = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
+- Code(Expression(161, Add)) at (prev + 2, 13) to (start + 0, 18)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+- Code(Expression(160, Sub)) at (prev + 2, 13) to (start + 0, 18)
+ = ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)
+- Code(Expression(157, Add)) at (prev + 2, 9) to (start + 0, 17)
+ = (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4))
+- Code(Expression(159, Add)) at (prev + 0, 20) to (start + 0, 25)
+ = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
+- Code(Counter(4)) at (prev + 0, 29) to (start + 0, 34)
+- Code(Expression(155, Add)) at (prev + 1, 9) to (start + 0, 17)
+ = (c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5))
+- Code(Expression(157, Add)) at (prev + 0, 20) to (start + 0, 25)
+ = (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4))
+- Code(Counter(5)) at (prev + 0, 29) to (start + 0, 34)
+- Code(Expression(155, Add)) at (prev + 4, 9) to (start + 0, 16)
+ = (c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5))
+- Code(Expression(154, Sub)) at (prev + 1, 5) to (start + 3, 6)
+ = ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)
+- Code(Counter(6)) at (prev + 3, 6) to (start + 0, 7)
+- Code(Expression(153, Add)) at (prev + 3, 9) to (start + 0, 16)
+ = (c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6))
+- Code(Counter(7)) at (prev + 1, 5) to (start + 3, 6)
+- Code(Expression(152, Sub)) at (prev + 5, 5) to (start + 3, 6)
+ = ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)
+- Code(Expression(151, Add)) at (prev + 5, 9) to (start + 0, 16)
+ = (c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7))
+- Code(Expression(150, Sub)) at (prev + 0, 17) to (start + 2, 6)
+ = ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)
+- Code(Counter(8)) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(149, Add)) at (prev + 2, 8) to (start + 0, 15)
+ = (c8 + ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8))
+- Code(Counter(9)) at (prev + 0, 16) to (start + 2, 6)
+- Code(Expression(148, Sub)) at (prev + 2, 12) to (start + 2, 6)
+ = ((c8 + ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)) - c9)
+- Code(Expression(147, Add)) at (prev + 3, 1) to (start + 0, 2)
+ = (c9 + ((c8 + ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)) - c9))
+
diff --git a/tests/run-coverage/lazy_boolean.coverage b/tests/coverage/lazy_boolean.coverage
index 8f14082ef..8f14082ef 100644
--- a/tests/run-coverage/lazy_boolean.coverage
+++ b/tests/coverage/lazy_boolean.coverage
diff --git a/tests/coverage-map/status-quo/lazy_boolean.rs b/tests/coverage/lazy_boolean.rs
index bb6219e85..bb6219e85 100644
--- a/tests/coverage-map/status-quo/lazy_boolean.rs
+++ b/tests/coverage/lazy_boolean.rs
diff --git a/tests/coverage-map/long_and_wide.cov-map b/tests/coverage/long_and_wide.cov-map
index 97aebf9b1..97aebf9b1 100644
--- a/tests/coverage-map/long_and_wide.cov-map
+++ b/tests/coverage/long_and_wide.cov-map
diff --git a/tests/coverage/long_and_wide.coverage b/tests/coverage/long_and_wide.coverage
new file mode 100644
index 000000000..d7d29ca40
--- /dev/null
+++ b/tests/coverage/long_and_wide.coverage
@@ -0,0 +1,151 @@
+ LL| |// compile-flags: --edition=2021
+ LL| |// ignore-tidy-linelength
+ LL| |
+ LL| |// This file deliberately contains line and column numbers larger than 127,
+ LL| |// to verify that `coverage-dump`'s ULEB128 parser can handle them.
+ LL| |
+ LL| 1|fn main() {
+ LL| 1| wide_function();
+ LL| 1| long_function();
+ LL| 1| far_function();
+ LL| 1|}
+ LL| |
+ LL| |#[rustfmt::skip]
+ LL| 1|fn wide_function() { /* */ (); }
+ LL| |
+ LL| 1|fn long_function() {
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1| //
+ LL| 1|}
+ LL| |
+ LL| 1|fn far_function() {}
+
diff --git a/tests/coverage-map/long_and_wide.rs b/tests/coverage/long_and_wide.rs
index a7cbcd480..a7cbcd480 100644
--- a/tests/coverage-map/long_and_wide.rs
+++ b/tests/coverage/long_and_wide.rs
diff --git a/tests/coverage-map/status-quo/loop_break_value.cov-map b/tests/coverage/loop_break_value.cov-map
index 75018442d..75018442d 100644
--- a/tests/coverage-map/status-quo/loop_break_value.cov-map
+++ b/tests/coverage/loop_break_value.cov-map
diff --git a/tests/run-coverage/loop_break_value.coverage b/tests/coverage/loop_break_value.coverage
index 1f0630636..1f0630636 100644
--- a/tests/run-coverage/loop_break_value.coverage
+++ b/tests/coverage/loop_break_value.coverage
diff --git a/tests/coverage-map/status-quo/loop_break_value.rs b/tests/coverage/loop_break_value.rs
index dbc4fad7a..dbc4fad7a 100644
--- a/tests/coverage-map/status-quo/loop_break_value.rs
+++ b/tests/coverage/loop_break_value.rs
diff --git a/tests/coverage/loops_branches.cov-map b/tests/coverage/loops_branches.cov-map
new file mode 100644
index 000000000..813583a9d
--- /dev/null
+++ b/tests/coverage/loops_branches.cov-map
@@ -0,0 +1,183 @@
+Function name: <loops_branches::DebugTest as core::fmt::Debug>::fmt
+Raw bytes (249): 0x[01, 01, 31, 05, 00, 00, 02, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, bf, 01, c3, 01, 0d, 00, 11, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, 00, ae, 01, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, ab, 01, 11, 00, ae, 01, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, 25, a3, 01, a6, 01, 19, ab, 01, 11, 00, ae, 01, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0e, 00, 0f, 07, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, b6, 01, 03, 0d, 00, 0e, bb, 01, 00, 12, 00, 17, b6, 01, 01, 10, 00, 14, b2, 01, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, ae, 01, 01, 12, 00, 13, ab, 01, 01, 11, 00, 22, a6, 01, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 19, 03, 09, 00, 0f, 9f, 01, 01, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 49
+- expression 0 operands: lhs = Counter(1), rhs = Zero
+- expression 1 operands: lhs = Zero, rhs = Expression(0, Sub)
+- expression 2 operands: lhs = Expression(46, Add), rhs = Counter(6)
+- expression 3 operands: lhs = Expression(47, Add), rhs = Expression(48, Add)
+- expression 4 operands: lhs = Counter(3), rhs = Zero
+- expression 5 operands: lhs = Counter(4), rhs = Zero
+- expression 6 operands: lhs = Expression(47, Add), rhs = Expression(48, Add)
+- expression 7 operands: lhs = Counter(3), rhs = Zero
+- expression 8 operands: lhs = Counter(4), rhs = Zero
+- expression 9 operands: lhs = Expression(46, Add), rhs = Counter(6)
+- expression 10 operands: lhs = Expression(47, Add), rhs = Expression(48, Add)
+- expression 11 operands: lhs = Counter(3), rhs = Zero
+- expression 12 operands: lhs = Counter(4), rhs = Zero
+- expression 13 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 14 operands: lhs = Expression(46, Add), rhs = Counter(6)
+- expression 15 operands: lhs = Expression(47, Add), rhs = Expression(48, Add)
+- expression 16 operands: lhs = Counter(3), rhs = Zero
+- expression 17 operands: lhs = Counter(4), rhs = Zero
+- expression 18 operands: lhs = Expression(44, Sub), rhs = Zero
+- expression 19 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 20 operands: lhs = Expression(46, Add), rhs = Counter(6)
+- expression 21 operands: lhs = Expression(47, Add), rhs = Expression(48, Add)
+- expression 22 operands: lhs = Counter(3), rhs = Zero
+- expression 23 operands: lhs = Counter(4), rhs = Zero
+- expression 24 operands: lhs = Zero, rhs = Expression(43, Sub)
+- expression 25 operands: lhs = Expression(44, Sub), rhs = Zero
+- expression 26 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 27 operands: lhs = Expression(46, Add), rhs = Counter(6)
+- expression 28 operands: lhs = Expression(47, Add), rhs = Expression(48, Add)
+- expression 29 operands: lhs = Counter(3), rhs = Zero
+- expression 30 operands: lhs = Counter(4), rhs = Zero
+- expression 31 operands: lhs = Expression(42, Add), rhs = Counter(4)
+- expression 32 operands: lhs = Zero, rhs = Expression(43, Sub)
+- expression 33 operands: lhs = Expression(44, Sub), rhs = Zero
+- expression 34 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 35 operands: lhs = Expression(46, Add), rhs = Counter(6)
+- expression 36 operands: lhs = Expression(47, Add), rhs = Expression(48, Add)
+- expression 37 operands: lhs = Counter(3), rhs = Zero
+- expression 38 operands: lhs = Counter(4), rhs = Zero
+- expression 39 operands: lhs = Counter(9), rhs = Expression(40, Add)
+- expression 40 operands: lhs = Expression(41, Sub), rhs = Counter(6)
+- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(4)
+- expression 42 operands: lhs = Zero, rhs = Expression(43, Sub)
+- expression 43 operands: lhs = Expression(44, Sub), rhs = Zero
+- expression 44 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 45 operands: lhs = Expression(46, Add), rhs = Counter(6)
+- expression 46 operands: lhs = Expression(47, Add), rhs = Expression(48, Add)
+- expression 47 operands: lhs = Counter(3), rhs = Zero
+- expression 48 operands: lhs = Counter(4), rhs = Zero
+Number of file 0 mappings: 20
+- Code(Counter(0)) at (prev + 9, 5) to (start + 1, 16)
+- Code(Counter(1)) at (prev + 2, 16) to (start + 0, 21)
+- Code(Zero) at (prev + 1, 23) to (start + 0, 27)
+- Code(Zero) at (prev + 0, 28) to (start + 0, 30)
+- Code(Expression(0, Sub)) at (prev + 1, 14) to (start + 0, 15)
+ = (c1 - Zero)
+- Code(Expression(1, Add)) at (prev + 1, 13) to (start + 0, 30)
+ = (Zero + (c1 - Zero))
+- Code(Counter(9)) at (prev + 0, 30) to (start + 0, 31)
+- Code(Zero) at (prev + 1, 16) to (start + 1, 10)
+- Code(Expression(45, Sub)) at (prev + 3, 13) to (start + 0, 14)
+ = (((c3 + Zero) + (c4 + Zero)) - c6)
+- Code(Expression(46, Add)) at (prev + 0, 18) to (start + 0, 23)
+ = ((c3 + Zero) + (c4 + Zero))
+- Code(Expression(45, Sub)) at (prev + 1, 16) to (start + 0, 20)
+ = (((c3 + Zero) + (c4 + Zero)) - c6)
+- Code(Expression(44, Sub)) at (prev + 1, 20) to (start + 0, 25)
+ = ((((c3 + Zero) + (c4 + Zero)) - c6) - Zero)
+- Code(Zero) at (prev + 1, 27) to (start + 0, 31)
+- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
+- Code(Expression(43, Sub)) at (prev + 1, 18) to (start + 0, 19)
+ = (((((c3 + Zero) + (c4 + Zero)) - c6) - Zero) - Zero)
+- Code(Expression(42, Add)) at (prev + 1, 17) to (start + 0, 34)
+ = (Zero + (((((c3 + Zero) + (c4 + Zero)) - c6) - Zero) - Zero))
+- Code(Expression(41, Sub)) at (prev + 0, 34) to (start + 0, 35)
+ = ((Zero + (((((c3 + Zero) + (c4 + Zero)) - c6) - Zero) - Zero)) - c4)
+- Code(Zero) at (prev + 1, 20) to (start + 1, 14)
+- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
+- Code(Expression(39, Add)) at (prev + 1, 5) to (start + 0, 6)
+ = (c9 + (((Zero + (((((c3 + Zero) + (c4 + Zero)) - c6) - Zero) - Zero)) - c4) + c6))
+
+Function name: <loops_branches::DisplayTest as core::fmt::Display>::fmt
+Raw bytes (253): 0x[01, 01, 33, 01, 00, 02, 00, 00, 0e, 02, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, c3, 01, c7, 01, 00, 0d, 00, 15, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, b6, 01, 00, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, 00, b2, 01, b6, 01, 00, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, af, 01, 15, 00, b2, 01, b6, 01, 00, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, aa, 01, cb, 01, af, 01, 15, 00, b2, 01, b6, 01, 00, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, 19, 25, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 0e, 01, 0e, 00, 0f, 0b, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, ba, 01, 02, 0d, 00, 0e, bf, 01, 00, 12, 00, 17, ba, 01, 01, 10, 00, 15, 00, 00, 16, 01, 0e, b6, 01, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, b2, 01, 01, 12, 00, 13, af, 01, 01, 11, 00, 22, aa, 01, 00, 22, 00, 23, 19, 03, 09, 00, 0f, a7, 01, 01, 05, 00, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 51
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Expression(0, Sub), rhs = Zero
+- expression 2 operands: lhs = Zero, rhs = Expression(3, Sub)
+- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
+- expression 4 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 5 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 6 operands: lhs = Zero, rhs = Counter(3)
+- expression 7 operands: lhs = Zero, rhs = Counter(5)
+- expression 8 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 9 operands: lhs = Zero, rhs = Counter(3)
+- expression 10 operands: lhs = Zero, rhs = Counter(5)
+- expression 11 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 12 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 13 operands: lhs = Zero, rhs = Counter(3)
+- expression 14 operands: lhs = Zero, rhs = Counter(5)
+- expression 15 operands: lhs = Expression(46, Sub), rhs = Zero
+- expression 16 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 17 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 18 operands: lhs = Zero, rhs = Counter(3)
+- expression 19 operands: lhs = Zero, rhs = Counter(5)
+- expression 20 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 21 operands: lhs = Expression(46, Sub), rhs = Zero
+- expression 22 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 23 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 24 operands: lhs = Zero, rhs = Counter(3)
+- expression 25 operands: lhs = Zero, rhs = Counter(5)
+- expression 26 operands: lhs = Zero, rhs = Expression(44, Sub)
+- expression 27 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 28 operands: lhs = Expression(46, Sub), rhs = Zero
+- expression 29 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 30 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 31 operands: lhs = Zero, rhs = Counter(3)
+- expression 32 operands: lhs = Zero, rhs = Counter(5)
+- expression 33 operands: lhs = Expression(43, Add), rhs = Counter(5)
+- expression 34 operands: lhs = Zero, rhs = Expression(44, Sub)
+- expression 35 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 36 operands: lhs = Expression(46, Sub), rhs = Zero
+- expression 37 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 38 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 39 operands: lhs = Zero, rhs = Counter(3)
+- expression 40 operands: lhs = Zero, rhs = Counter(5)
+- expression 41 operands: lhs = Expression(42, Sub), rhs = Expression(50, Add)
+- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(5)
+- expression 43 operands: lhs = Zero, rhs = Expression(44, Sub)
+- expression 44 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 45 operands: lhs = Expression(46, Sub), rhs = Zero
+- expression 46 operands: lhs = Expression(47, Add), rhs = Counter(6)
+- expression 47 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 48 operands: lhs = Zero, rhs = Counter(3)
+- expression 49 operands: lhs = Zero, rhs = Counter(5)
+- expression 50 operands: lhs = Counter(6), rhs = Counter(9)
+Number of file 0 mappings: 20
+- Code(Counter(0)) at (prev + 34, 5) to (start + 1, 17)
+- Code(Zero) at (prev + 1, 18) to (start + 1, 10)
+- Code(Expression(0, Sub)) at (prev + 2, 16) to (start + 0, 21)
+ = (c0 - Zero)
+- Code(Zero) at (prev + 1, 23) to (start + 0, 27)
+- Code(Zero) at (prev + 0, 28) to (start + 0, 30)
+- Code(Expression(3, Sub)) at (prev + 1, 14) to (start + 0, 15)
+ = ((c0 - Zero) - Zero)
+- Code(Expression(2, Add)) at (prev + 1, 13) to (start + 0, 30)
+ = (Zero + ((c0 - Zero) - Zero))
+- Code(Counter(9)) at (prev + 0, 30) to (start + 0, 31)
+- Code(Expression(46, Sub)) at (prev + 2, 13) to (start + 0, 14)
+ = (((Zero + c3) + (Zero + c5)) - c6)
+- Code(Expression(47, Add)) at (prev + 0, 18) to (start + 0, 23)
+ = ((Zero + c3) + (Zero + c5))
+- Code(Expression(46, Sub)) at (prev + 1, 16) to (start + 0, 21)
+ = (((Zero + c3) + (Zero + c5)) - c6)
+- Code(Zero) at (prev + 0, 22) to (start + 1, 14)
+- Code(Expression(45, Sub)) at (prev + 2, 20) to (start + 0, 25)
+ = ((((Zero + c3) + (Zero + c5)) - c6) - Zero)
+- Code(Zero) at (prev + 1, 27) to (start + 0, 31)
+- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
+- Code(Expression(44, Sub)) at (prev + 1, 18) to (start + 0, 19)
+ = (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero)
+- Code(Expression(43, Add)) at (prev + 1, 17) to (start + 0, 34)
+ = (Zero + (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero))
+- Code(Expression(42, Sub)) at (prev + 0, 34) to (start + 0, 35)
+ = ((Zero + (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero)) - c5)
+- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
+- Code(Expression(41, Add)) at (prev + 1, 5) to (start + 0, 6)
+ = (((Zero + (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero)) - c5) + (c6 + c9))
+
+Function name: loops_branches::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 37, 01, 05, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 55, 1) to (start + 5, 2)
+
diff --git a/tests/run-coverage/loops_branches.coverage b/tests/coverage/loops_branches.coverage
index 8cd6f1be3..8cd6f1be3 100644
--- a/tests/run-coverage/loops_branches.coverage
+++ b/tests/coverage/loops_branches.coverage
diff --git a/tests/coverage-map/status-quo/loops_branches.rs b/tests/coverage/loops_branches.rs
index f3a343bcc..f3a343bcc 100644
--- a/tests/coverage-map/status-quo/loops_branches.rs
+++ b/tests/coverage/loops_branches.rs
diff --git a/tests/coverage/macro_name_span.cov-map b/tests/coverage/macro_name_span.cov-map
new file mode 100644
index 000000000..b84628fc7
--- /dev/null
+++ b/tests/coverage/macro_name_span.cov-map
@@ -0,0 +1,16 @@
+Function name: macro_name_span::affected_function
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 06, 1b, 00, 20]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 6, 27) to (start + 0, 32)
+
+Function name: macro_name_span::main
+Raw bytes (9): 0x[01, 02, 00, 01, 01, 0b, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 2
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 11, 1) to (start + 2, 2)
+
diff --git a/tests/run-coverage/macro_name_span.coverage b/tests/coverage/macro_name_span.coverage
index cadf70246..cadf70246 100644
--- a/tests/run-coverage/macro_name_span.coverage
+++ b/tests/coverage/macro_name_span.coverage
diff --git a/tests/run-coverage/macro_name_span.rs b/tests/coverage/macro_name_span.rs
index 5d15977c4..5d15977c4 100644
--- a/tests/run-coverage/macro_name_span.rs
+++ b/tests/coverage/macro_name_span.rs
diff --git a/tests/coverage-map/status-quo/match_or_pattern.cov-map b/tests/coverage/match_or_pattern.cov-map
index d63407a99..d63407a99 100644
--- a/tests/coverage-map/status-quo/match_or_pattern.cov-map
+++ b/tests/coverage/match_or_pattern.cov-map
diff --git a/tests/run-coverage/match_or_pattern.coverage b/tests/coverage/match_or_pattern.coverage
index 94c796721..94c796721 100644
--- a/tests/run-coverage/match_or_pattern.coverage
+++ b/tests/coverage/match_or_pattern.coverage
diff --git a/tests/coverage-map/status-quo/match_or_pattern.rs b/tests/coverage/match_or_pattern.rs
index ab7aee51d..ab7aee51d 100644
--- a/tests/coverage-map/status-quo/match_or_pattern.rs
+++ b/tests/coverage/match_or_pattern.rs
diff --git a/tests/coverage-map/status-quo/nested_loops.cov-map b/tests/coverage/nested_loops.cov-map
index 35d92594e..35d92594e 100644
--- a/tests/coverage-map/status-quo/nested_loops.cov-map
+++ b/tests/coverage/nested_loops.cov-map
diff --git a/tests/run-coverage/nested_loops.coverage b/tests/coverage/nested_loops.coverage
index 143d0d26a..143d0d26a 100644
--- a/tests/run-coverage/nested_loops.coverage
+++ b/tests/coverage/nested_loops.coverage
diff --git a/tests/coverage-map/status-quo/nested_loops.rs b/tests/coverage/nested_loops.rs
index 4c7c78427..4c7c78427 100644
--- a/tests/coverage-map/status-quo/nested_loops.rs
+++ b/tests/coverage/nested_loops.rs
diff --git a/tests/coverage-map/status-quo/no_cov_crate.cov-map b/tests/coverage/no_cov_crate.cov-map
index 7ab5995dc..05b6448bb 100644
--- a/tests/coverage-map/status-quo/no_cov_crate.cov-map
+++ b/tests/coverage/no_cov_crate.cov-map
@@ -15,12 +15,12 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 24, 1) to (start + 2, 2)
Function name: no_cov_crate::add_coverage_not_called (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 1d, 01, 02, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 1d, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 29, 1) to (start + 2, 2)
+- Code(Zero) at (prev + 29, 1) to (start + 2, 2)
Function name: no_cov_crate::main
Raw bytes (9): 0x[01, 01, 00, 01, 01, 4d, 01, 0b, 02]
diff --git a/tests/run-coverage/no_cov_crate.coverage b/tests/coverage/no_cov_crate.coverage
index f5a0322bf..f5a0322bf 100644
--- a/tests/run-coverage/no_cov_crate.coverage
+++ b/tests/coverage/no_cov_crate.coverage
diff --git a/tests/coverage-map/status-quo/no_cov_crate.rs b/tests/coverage/no_cov_crate.rs
index e12e4bc55..e12e4bc55 100644
--- a/tests/coverage-map/status-quo/no_cov_crate.rs
+++ b/tests/coverage/no_cov_crate.rs
diff --git a/tests/coverage-map/status-quo/overflow.cov-map b/tests/coverage/overflow.cov-map
index bfffd9b2a..39a5c05f8 100644
--- a/tests/coverage-map/status-quo/overflow.cov-map
+++ b/tests/coverage/overflow.cov-map
@@ -1,5 +1,5 @@
Function name: overflow::main
-Raw bytes (65): 0x[01, 01, 08, 01, 1b, 05, 1f, 09, 0d, 03, 11, 16, 05, 03, 11, 05, 1f, 09, 0d, 09, 01, 0f, 01, 01, 1b, 03, 02, 0b, 00, 18, 16, 01, 0c, 00, 1a, 05, 00, 1b, 03, 0a, 12, 03, 13, 00, 20, 09, 00, 21, 03, 0a, 0d, 03, 0a, 00, 0b, 1b, 01, 09, 00, 17, 11, 02, 05, 01, 02]
+Raw bytes (65): 0x[01, 01, 08, 01, 1b, 05, 1f, 09, 0d, 03, 11, 16, 05, 03, 11, 05, 1f, 09, 0d, 09, 01, 10, 01, 01, 1b, 03, 02, 0b, 00, 18, 16, 01, 0c, 00, 1a, 05, 00, 1b, 03, 0a, 12, 03, 13, 00, 20, 09, 00, 21, 03, 0a, 0d, 03, 0a, 00, 0b, 1b, 01, 09, 00, 17, 11, 02, 05, 01, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 8
@@ -12,7 +12,7 @@ Number of expressions: 8
- expression 6 operands: lhs = Counter(1), rhs = Expression(7, Add)
- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
Number of file 0 mappings: 9
-- Code(Counter(0)) at (prev + 15, 1) to (start + 1, 27)
+- Code(Counter(0)) at (prev + 16, 1) to (start + 1, 27)
- Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 24)
= (c0 + (c1 + (c2 + c3)))
- Code(Expression(5, Sub)) at (prev + 1, 12) to (start + 0, 26)
@@ -27,14 +27,14 @@ Number of file 0 mappings: 9
- Code(Counter(4)) at (prev + 2, 5) to (start + 1, 2)
Function name: overflow::might_overflow
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 04, 01, 01, 12, 05, 01, 13, 02, 06, 02, 02, 06, 00, 07, 07, 01, 09, 05, 02]
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 05, 01, 01, 12, 05, 01, 13, 02, 06, 02, 02, 06, 00, 07, 07, 01, 09, 05, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 4, 1) to (start + 1, 18)
+- Code(Counter(0)) at (prev + 5, 1) to (start + 1, 18)
- Code(Counter(1)) at (prev + 1, 19) to (start + 2, 6)
- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
= (c0 - c1)
diff --git a/tests/run-coverage/overflow.coverage b/tests/coverage/overflow.coverage
index cee076e88..4f8dffc0c 100644
--- a/tests/run-coverage/overflow.coverage
+++ b/tests/coverage/overflow.coverage
@@ -1,4 +1,5 @@
LL| |#![allow(unused_assignments)]
+ LL| |// compile-flags: -Coverflow-checks=yes
LL| |// failure-status: 101
LL| |
LL| 4|fn might_overflow(to_add: u32) -> u32 {
diff --git a/tests/run-coverage/overflow.rs b/tests/coverage/overflow.rs
index bbb65c1b3..1c40771b2 100644
--- a/tests/run-coverage/overflow.rs
+++ b/tests/coverage/overflow.rs
@@ -1,4 +1,5 @@
#![allow(unused_assignments)]
+// compile-flags: -Coverflow-checks=yes
// failure-status: 101
fn might_overflow(to_add: u32) -> u32 {
diff --git a/tests/coverage-map/status-quo/panic_unwind.cov-map b/tests/coverage/panic_unwind.cov-map
index f6089ce55..f6089ce55 100644
--- a/tests/coverage-map/status-quo/panic_unwind.cov-map
+++ b/tests/coverage/panic_unwind.cov-map
diff --git a/tests/run-coverage/panic_unwind.coverage b/tests/coverage/panic_unwind.coverage
index 2b0777ef2..2b0777ef2 100644
--- a/tests/run-coverage/panic_unwind.coverage
+++ b/tests/coverage/panic_unwind.coverage
diff --git a/tests/coverage-map/status-quo/panic_unwind.rs b/tests/coverage/panic_unwind.rs
index 638d2eb6a..638d2eb6a 100644
--- a/tests/coverage-map/status-quo/panic_unwind.rs
+++ b/tests/coverage/panic_unwind.rs
diff --git a/tests/coverage-map/status-quo/partial_eq.cov-map b/tests/coverage/partial_eq.cov-map
index dd61cd77a..3549116db 100644
--- a/tests/coverage-map/status-quo/partial_eq.cov-map
+++ b/tests/coverage/partial_eq.cov-map
@@ -1,27 +1,27 @@
Function name: <partial_eq::Version as core::clone::Clone>::clone (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 04, 0a, 00, 0f]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 04, 0a, 00, 0f]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 4, 10) to (start + 0, 15)
+- Code(Zero) at (prev + 4, 10) to (start + 0, 15)
Function name: <partial_eq::Version as core::cmp::Ord>::cmp (unused)
-Raw bytes (14): 0x[01, 01, 00, 02, 01, 04, 33, 00, 34, 00, 00, 35, 00, 36]
+Raw bytes (14): 0x[01, 01, 00, 02, 00, 04, 33, 00, 34, 00, 00, 35, 00, 36]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 2
-- Code(Counter(0)) at (prev + 4, 51) to (start + 0, 52)
+- Code(Zero) at (prev + 4, 51) to (start + 0, 52)
- Code(Zero) at (prev + 0, 53) to (start + 0, 54)
Function name: <partial_eq::Version as core::cmp::PartialEq>::eq (unused)
-Raw bytes (14): 0x[01, 01, 00, 02, 01, 04, 18, 00, 19, 00, 00, 20, 00, 21]
+Raw bytes (14): 0x[01, 01, 00, 02, 00, 04, 18, 00, 19, 00, 00, 20, 00, 21]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 2
-- Code(Counter(0)) at (prev + 4, 24) to (start + 0, 25)
+- Code(Zero) at (prev + 4, 24) to (start + 0, 25)
- Code(Zero) at (prev + 0, 32) to (start + 0, 33)
Function name: <partial_eq::Version as core::cmp::PartialOrd>::partial_cmp
diff --git a/tests/run-coverage/partial_eq.coverage b/tests/coverage/partial_eq.coverage
index c6d9ad6cf..c6d9ad6cf 100644
--- a/tests/run-coverage/partial_eq.coverage
+++ b/tests/coverage/partial_eq.coverage
diff --git a/tests/coverage-map/status-quo/partial_eq.rs b/tests/coverage/partial_eq.rs
index dd8b42c18..dd8b42c18 100644
--- a/tests/coverage-map/status-quo/partial_eq.rs
+++ b/tests/coverage/partial_eq.rs
diff --git a/tests/coverage/simple_loop.cov-map b/tests/coverage/simple_loop.cov-map
new file mode 100644
index 000000000..f1691ffc5
--- /dev/null
+++ b/tests/coverage/simple_loop.cov-map
@@ -0,0 +1,27 @@
+Function name: simple_loop::main
+Raw bytes (57): 0x[01, 01, 09, 01, 05, 23, 09, 05, 02, 1f, 09, 23, 09, 05, 02, 1f, 09, 23, 09, 05, 02, 07, 01, 03, 01, 09, 10, 05, 0a, 05, 05, 06, 02, 05, 06, 00, 07, 1f, 05, 0d, 02, 0e, 1a, 04, 0d, 00, 12, 09, 02, 0a, 03, 0a, 1a, 06, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 9
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(8, Add), rhs = Counter(2)
+- expression 2 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 3 operands: lhs = Expression(7, Add), rhs = Counter(2)
+- expression 4 operands: lhs = Expression(8, Add), rhs = Counter(2)
+- expression 5 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(2)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(2)
+- expression 8 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 7
+- Code(Counter(0)) at (prev + 3, 1) to (start + 9, 16)
+- Code(Counter(1)) at (prev + 10, 5) to (start + 5, 6)
+- Code(Expression(0, Sub)) at (prev + 5, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(7, Add)) at (prev + 5, 13) to (start + 2, 14)
+ = ((c1 + (c0 - c1)) + c2)
+- Code(Expression(6, Sub)) at (prev + 4, 13) to (start + 0, 18)
+ = (((c1 + (c0 - c1)) + c2) - c2)
+- Code(Counter(2)) at (prev + 2, 10) to (start + 3, 10)
+- Code(Expression(6, Sub)) at (prev + 6, 1) to (start + 0, 2)
+ = (((c1 + (c0 - c1)) + c2) - c2)
+
diff --git a/tests/run-coverage/simple_loop.coverage b/tests/coverage/simple_loop.coverage
index 691c6cd1e..691c6cd1e 100644
--- a/tests/run-coverage/simple_loop.coverage
+++ b/tests/coverage/simple_loop.coverage
diff --git a/tests/coverage-map/status-quo/simple_loop.rs b/tests/coverage/simple_loop.rs
index 6f7f23475..6f7f23475 100644
--- a/tests/coverage-map/status-quo/simple_loop.rs
+++ b/tests/coverage/simple_loop.rs
diff --git a/tests/coverage/simple_match.cov-map b/tests/coverage/simple_match.cov-map
new file mode 100644
index 000000000..4a32745d2
--- /dev/null
+++ b/tests/coverage/simple_match.cov-map
@@ -0,0 +1,33 @@
+Function name: simple_match::main
+Raw bytes (78): 0x[01, 01, 0c, 01, 05, 2b, 2f, 05, 02, 09, 0d, 27, 11, 2b, 2f, 05, 02, 09, 0d, 27, 11, 2b, 2f, 05, 02, 09, 0d, 0a, 01, 03, 01, 07, 0f, 05, 07, 10, 02, 06, 02, 02, 06, 00, 07, 27, 05, 09, 00, 0d, 22, 05, 0d, 00, 16, 09, 02, 0d, 00, 0e, 22, 02, 11, 02, 12, 09, 04, 0d, 07, 0e, 0d, 0a, 0d, 00, 0f, 11, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 12
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(10, Add), rhs = Expression(11, Add)
+- expression 2 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 3 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 4 operands: lhs = Expression(9, Add), rhs = Counter(4)
+- expression 5 operands: lhs = Expression(10, Add), rhs = Expression(11, Add)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 7 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(4)
+- expression 9 operands: lhs = Expression(10, Add), rhs = Expression(11, Add)
+- expression 10 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 11 operands: lhs = Counter(2), rhs = Counter(3)
+Number of file 0 mappings: 10
+- Code(Counter(0)) at (prev + 3, 1) to (start + 7, 15)
+- Code(Counter(1)) at (prev + 7, 16) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(9, Add)) at (prev + 5, 9) to (start + 0, 13)
+ = ((c1 + (c0 - c1)) + (c2 + c3))
+- Code(Expression(8, Sub)) at (prev + 5, 13) to (start + 0, 22)
+ = (((c1 + (c0 - c1)) + (c2 + c3)) - c4)
+- Code(Counter(2)) at (prev + 2, 13) to (start + 0, 14)
+- Code(Expression(8, Sub)) at (prev + 2, 17) to (start + 2, 18)
+ = (((c1 + (c0 - c1)) + (c2 + c3)) - c4)
+- Code(Counter(2)) at (prev + 4, 13) to (start + 7, 14)
+- Code(Counter(3)) at (prev + 10, 13) to (start + 0, 15)
+- Code(Counter(4)) at (prev + 3, 1) to (start + 0, 2)
+
diff --git a/tests/run-coverage/simple_match.coverage b/tests/coverage/simple_match.coverage
index 7f5dd3bb6..7f5dd3bb6 100644
--- a/tests/run-coverage/simple_match.coverage
+++ b/tests/coverage/simple_match.coverage
diff --git a/tests/coverage-map/status-quo/simple_match.rs b/tests/coverage/simple_match.rs
index be99e59a8..be99e59a8 100644
--- a/tests/coverage-map/status-quo/simple_match.rs
+++ b/tests/coverage/simple_match.rs
diff --git a/tests/coverage-map/status-quo/sort_groups.cov-map b/tests/coverage/sort_groups.cov-map
index 7156a66cf..3cbda6fbe 100644
--- a/tests/coverage-map/status-quo/sort_groups.cov-map
+++ b/tests/coverage/sort_groups.cov-map
@@ -28,6 +28,21 @@ Number of file 0 mappings: 4
- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
= (c1 + (c0 - c1))
+Function name: sort_groups::generic_fn::<char>
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 11, 01, 01, 0c, 05, 01, 0d, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 17, 1) to (start + 1, 12)
+- Code(Counter(1)) at (prev + 1, 13) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
+ = (c1 + (c0 - c1))
+
Function name: sort_groups::generic_fn::<i32>
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 11, 01, 01, 0c, 05, 01, 0d, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02]
Number of files: 1
@@ -44,15 +59,15 @@ Number of file 0 mappings: 4
= (c1 + (c0 - c1))
Function name: sort_groups::main
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 06, 01, 04, 0d, 00, 04, 0e, 02, 06, 02, 02, 06, 00, 07, 07, 01, 05, 02, 02]
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 06, 01, 04, 23, 05, 04, 24, 02, 06, 02, 02, 06, 00, 07, 07, 01, 05, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 6, 1) to (start + 4, 13)
-- Code(Zero) at (prev + 4, 14) to (start + 2, 6)
+- Code(Counter(0)) at (prev + 6, 1) to (start + 4, 35)
+- Code(Counter(1)) at (prev + 4, 36) to (start + 2, 6)
- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
= (c0 - c1)
- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 2, 2)
diff --git a/tests/run-coverage/sort_groups.coverage b/tests/coverage/sort_groups.coverage
index 8733bf48a..c70d7b3b2 100644
--- a/tests/run-coverage/sort_groups.coverage
+++ b/tests/coverage/sort_groups.coverage
@@ -7,7 +7,7 @@
LL| 1| let cond = std::env::args().len() > 1;
LL| 1| generic_fn::<()>(cond);
LL| 1| generic_fn::<&'static str>(!cond);
- LL| 1| if false {
+ LL| 1| if std::hint::black_box(false) {
LL| 0| generic_fn::<char>(cond);
LL| 1| }
LL| 1| generic_fn::<i32>(cond);
diff --git a/tests/run-coverage/sort_groups.rs b/tests/coverage/sort_groups.rs
index f89f9f3ec..5adbbc6a8 100644
--- a/tests/run-coverage/sort_groups.rs
+++ b/tests/coverage/sort_groups.rs
@@ -7,7 +7,7 @@ fn main() {
let cond = std::env::args().len() > 1;
generic_fn::<()>(cond);
generic_fn::<&'static str>(!cond);
- if false {
+ if std::hint::black_box(false) {
generic_fn::<char>(cond);
}
generic_fn::<i32>(cond);
diff --git a/tests/coverage-map/status-quo/test_harness.cov-map b/tests/coverage/test_harness.cov-map
index b0e955dd1..6940d2e28 100644
--- a/tests/coverage-map/status-quo/test_harness.cov-map
+++ b/tests/coverage/test_harness.cov-map
@@ -15,10 +15,10 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 9, 1) to (start + 0, 8)
Function name: test_harness::unused (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 07, 01, 00, 0f]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 07, 01, 00, 0f]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 7, 1) to (start + 0, 15)
+- Code(Zero) at (prev + 7, 1) to (start + 0, 15)
diff --git a/tests/run-coverage/test_harness.coverage b/tests/coverage/test_harness.coverage
index ff6009f6f..ff6009f6f 100644
--- a/tests/run-coverage/test_harness.coverage
+++ b/tests/coverage/test_harness.coverage
diff --git a/tests/coverage-map/status-quo/test_harness.rs b/tests/coverage/test_harness.rs
index 12a755734..12a755734 100644
--- a/tests/coverage-map/status-quo/test_harness.rs
+++ b/tests/coverage/test_harness.rs
diff --git a/tests/coverage-map/status-quo/tight_inf_loop.cov-map b/tests/coverage/tight_inf_loop.cov-map
index 76884212c..7fe3146b0 100644
--- a/tests/coverage-map/status-quo/tight_inf_loop.cov-map
+++ b/tests/coverage/tight_inf_loop.cov-map
@@ -1,12 +1,12 @@
Function name: tight_inf_loop::main
-Raw bytes (21): 0x[01, 01, 01, 01, 05, 03, 01, 01, 01, 01, 0d, 00, 02, 09, 00, 10, 02, 01, 06, 01, 02]
+Raw bytes (21): 0x[01, 01, 01, 01, 00, 03, 01, 01, 01, 01, 0d, 00, 02, 09, 00, 10, 02, 01, 06, 01, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 1
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 0 operands: lhs = Counter(0), rhs = Zero
Number of file 0 mappings: 3
- Code(Counter(0)) at (prev + 1, 1) to (start + 1, 13)
- Code(Zero) at (prev + 2, 9) to (start + 0, 16)
- Code(Expression(0, Sub)) at (prev + 1, 6) to (start + 1, 2)
- = (c0 - c1)
+ = (c0 - Zero)
diff --git a/tests/run-coverage/tight_inf_loop.coverage b/tests/coverage/tight_inf_loop.coverage
index c15c76b3a..c15c76b3a 100644
--- a/tests/run-coverage/tight_inf_loop.coverage
+++ b/tests/coverage/tight_inf_loop.coverage
diff --git a/tests/coverage-map/status-quo/tight_inf_loop.rs b/tests/coverage/tight_inf_loop.rs
index cef99027a..cef99027a 100644
--- a/tests/coverage-map/status-quo/tight_inf_loop.rs
+++ b/tests/coverage/tight_inf_loop.rs
diff --git a/tests/coverage-map/trivial.cov-map b/tests/coverage/trivial.cov-map
index 874e294a1..874e294a1 100644
--- a/tests/coverage-map/trivial.cov-map
+++ b/tests/coverage/trivial.cov-map
diff --git a/tests/coverage/trivial.coverage b/tests/coverage/trivial.coverage
new file mode 100644
index 000000000..4f417979e
--- /dev/null
+++ b/tests/coverage/trivial.coverage
@@ -0,0 +1,4 @@
+ LL| |// compile-flags: --edition=2021
+ LL| |
+ LL| 1|fn main() {}
+
diff --git a/tests/coverage-map/trivial.rs b/tests/coverage/trivial.rs
index d0a9b44fb..d0a9b44fb 100644
--- a/tests/coverage-map/trivial.rs
+++ b/tests/coverage/trivial.rs
diff --git a/tests/coverage-map/status-quo/try_error_result.cov-map b/tests/coverage/try_error_result.cov-map
index b52e78d11..8367103a2 100644
--- a/tests/coverage-map/status-quo/try_error_result.cov-map
+++ b/tests/coverage/try_error_result.cov-map
@@ -91,136 +91,130 @@ Number of file 0 mappings: 11
= ((c4 + (c5 + c6)) + c3)
Function name: try_error_result::test2
-Raw bytes (373): 0x[01, 01, 41, 01, 07, 05, 09, 03, 0d, 41, 11, 52, 15, 41, 11, 4a, 1d, 4e, 19, 52, 15, 41, 11, 4e, 00, 52, 15, 41, 11, 4e, 19, 52, 15, 41, 11, 46, 00, 4a, 1d, 4e, 19, 52, 15, 41, 11, 6a, 25, 49, 21, 49, 21, 66, 00, 6a, 25, 49, 21, 9a, 01, 2d, 9e, 01, 29, a2, 01, 41, 03, 0d, a2, 01, 41, 03, 0d, 9e, 01, 29, a2, 01, 41, 03, 0d, 96, 01, 00, 9a, 01, 2d, 9e, 01, 29, a2, 01, 41, 03, 0d, ba, 01, 35, 45, 31, 45, 31, b6, 01, 00, ba, 01, 35, 45, 31, d2, 01, 3d, 4d, 39, 4d, 39, ce, 01, 00, d2, 01, 3d, 4d, 39, db, 01, 0d, 11, df, 01, e3, 01, f3, 01, 15, e7, 01, eb, 01, ef, 01, 19, 1d, 21, 25, f7, 01, fb, 01, 29, 2d, ff, 01, 83, 02, 31, 35, 39, 3d, 28, 01, 3c, 01, 03, 17, 03, 08, 09, 00, 0e, a2, 01, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 52, 00, 31, 03, 35, 15, 04, 11, 00, 12, 4e, 02, 11, 04, 12, 46, 05, 11, 00, 14, 2b, 00, 17, 00, 41, 19, 00, 41, 00, 42, 4a, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 43, 01, 0d, 00, 20, 66, 01, 11, 00, 14, 49, 00, 17, 00, 41, 21, 00, 41, 00, 42, 6a, 00, 43, 00, 60, 25, 00, 60, 00, 61, 63, 01, 0d, 00, 20, 96, 01, 04, 11, 00, 14, 9e, 01, 00, 17, 00, 42, 29, 00, 42, 00, 43, 9a, 01, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 93, 01, 01, 0d, 00, 20, b6, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, ba, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, b3, 01, 01, 0d, 00, 20, ce, 01, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 39, 02, 11, 00, 12, d2, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, cb, 01, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, d7, 01, 01, 01, 00, 02]
+Raw bytes (358): 0x[01, 01, 3b, 01, 07, 05, 09, 03, 0d, 41, 11, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 4a, 15, 41, 11, 46, 19, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 5e, 25, 49, 21, 49, 21, 5e, 25, 49, 21, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, 92, 01, 41, 03, 0d, 8e, 01, 29, 92, 01, 41, 03, 0d, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, a6, 01, 35, 45, 31, 45, 31, a6, 01, 35, 45, 31, ba, 01, 3d, 4d, 39, 4d, 39, ba, 01, 3d, 4d, 39, c3, 01, 0d, 11, c7, 01, cb, 01, db, 01, 15, cf, 01, d3, 01, d7, 01, 19, 1d, 21, 25, df, 01, e3, 01, 29, 2d, e7, 01, eb, 01, 31, 35, 39, 3d, 28, 01, 3c, 01, 03, 17, 03, 08, 09, 00, 0e, 92, 01, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 4a, 00, 31, 03, 35, 15, 04, 11, 00, 12, 46, 02, 11, 04, 12, 3e, 05, 11, 00, 14, 46, 00, 17, 00, 41, 19, 00, 41, 00, 42, 42, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 3e, 01, 0d, 00, 20, 5a, 01, 11, 00, 14, 49, 00, 17, 00, 41, 21, 00, 41, 00, 42, 5e, 00, 43, 00, 60, 25, 00, 60, 00, 61, 5a, 01, 0d, 00, 20, 86, 01, 04, 11, 00, 14, 8e, 01, 00, 17, 00, 42, 29, 00, 42, 00, 43, 8a, 01, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 86, 01, 01, 0d, 00, 20, a2, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, a6, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, a2, 01, 01, 0d, 00, 20, b6, 01, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 39, 02, 11, 00, 12, ba, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, b6, 01, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, bf, 01, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
-Number of expressions: 65
+Number of expressions: 59
- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
- expression 3 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 4 operands: lhs = Expression(20, Sub), rhs = Counter(5)
+- expression 4 operands: lhs = Expression(18, Sub), rhs = Counter(5)
- expression 5 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 6 operands: lhs = Expression(18, Sub), rhs = Counter(7)
-- expression 7 operands: lhs = Expression(19, Sub), rhs = Counter(6)
-- expression 8 operands: lhs = Expression(20, Sub), rhs = Counter(5)
+- expression 6 operands: lhs = Expression(16, Sub), rhs = Counter(7)
+- expression 7 operands: lhs = Expression(17, Sub), rhs = Counter(6)
+- expression 8 operands: lhs = Expression(18, Sub), rhs = Counter(5)
- expression 9 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 10 operands: lhs = Expression(19, Sub), rhs = Zero
-- expression 11 operands: lhs = Expression(20, Sub), rhs = Counter(5)
-- expression 12 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 13 operands: lhs = Expression(19, Sub), rhs = Counter(6)
-- expression 14 operands: lhs = Expression(20, Sub), rhs = Counter(5)
-- expression 15 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 16 operands: lhs = Expression(17, Sub), rhs = Zero
-- expression 17 operands: lhs = Expression(18, Sub), rhs = Counter(7)
-- expression 18 operands: lhs = Expression(19, Sub), rhs = Counter(6)
-- expression 19 operands: lhs = Expression(20, Sub), rhs = Counter(5)
-- expression 20 operands: lhs = Counter(16), rhs = Counter(4)
-- expression 21 operands: lhs = Expression(26, Sub), rhs = Counter(9)
-- expression 22 operands: lhs = Counter(18), rhs = Counter(8)
+- expression 10 operands: lhs = Expression(18, Sub), rhs = Counter(5)
+- expression 11 operands: lhs = Counter(16), rhs = Counter(4)
+- expression 12 operands: lhs = Expression(17, Sub), rhs = Counter(6)
+- expression 13 operands: lhs = Expression(18, Sub), rhs = Counter(5)
+- expression 14 operands: lhs = Counter(16), rhs = Counter(4)
+- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(7)
+- expression 16 operands: lhs = Expression(17, Sub), rhs = Counter(6)
+- expression 17 operands: lhs = Expression(18, Sub), rhs = Counter(5)
+- expression 18 operands: lhs = Counter(16), rhs = Counter(4)
+- expression 19 operands: lhs = Expression(23, Sub), rhs = Counter(9)
+- expression 20 operands: lhs = Counter(18), rhs = Counter(8)
+- expression 21 operands: lhs = Counter(18), rhs = Counter(8)
+- expression 22 operands: lhs = Expression(23, Sub), rhs = Counter(9)
- expression 23 operands: lhs = Counter(18), rhs = Counter(8)
-- expression 24 operands: lhs = Expression(25, Sub), rhs = Zero
-- expression 25 operands: lhs = Expression(26, Sub), rhs = Counter(9)
-- expression 26 operands: lhs = Counter(18), rhs = Counter(8)
-- expression 27 operands: lhs = Expression(38, Sub), rhs = Counter(11)
-- expression 28 operands: lhs = Expression(39, Sub), rhs = Counter(10)
-- expression 29 operands: lhs = Expression(40, Sub), rhs = Counter(16)
-- expression 30 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 31 operands: lhs = Expression(40, Sub), rhs = Counter(16)
+- expression 24 operands: lhs = Expression(34, Sub), rhs = Counter(11)
+- expression 25 operands: lhs = Expression(35, Sub), rhs = Counter(10)
+- expression 26 operands: lhs = Expression(36, Sub), rhs = Counter(16)
+- expression 27 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 28 operands: lhs = Expression(36, Sub), rhs = Counter(16)
+- expression 29 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 30 operands: lhs = Expression(35, Sub), rhs = Counter(10)
+- expression 31 operands: lhs = Expression(36, Sub), rhs = Counter(16)
- expression 32 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 33 operands: lhs = Expression(39, Sub), rhs = Counter(10)
-- expression 34 operands: lhs = Expression(40, Sub), rhs = Counter(16)
-- expression 35 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 36 operands: lhs = Expression(37, Sub), rhs = Zero
-- expression 37 operands: lhs = Expression(38, Sub), rhs = Counter(11)
-- expression 38 operands: lhs = Expression(39, Sub), rhs = Counter(10)
-- expression 39 operands: lhs = Expression(40, Sub), rhs = Counter(16)
-- expression 40 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 41 operands: lhs = Expression(46, Sub), rhs = Counter(13)
-- expression 42 operands: lhs = Counter(17), rhs = Counter(12)
-- expression 43 operands: lhs = Counter(17), rhs = Counter(12)
-- expression 44 operands: lhs = Expression(45, Sub), rhs = Zero
-- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(13)
-- expression 46 operands: lhs = Counter(17), rhs = Counter(12)
-- expression 47 operands: lhs = Expression(52, Sub), rhs = Counter(15)
-- expression 48 operands: lhs = Counter(19), rhs = Counter(14)
-- expression 49 operands: lhs = Counter(19), rhs = Counter(14)
-- expression 50 operands: lhs = Expression(51, Sub), rhs = Zero
-- expression 51 operands: lhs = Expression(52, Sub), rhs = Counter(15)
-- expression 52 operands: lhs = Counter(19), rhs = Counter(14)
-- expression 53 operands: lhs = Expression(54, Add), rhs = Counter(3)
-- expression 54 operands: lhs = Counter(4), rhs = Expression(55, Add)
-- expression 55 operands: lhs = Expression(56, Add), rhs = Expression(60, Add)
-- expression 56 operands: lhs = Counter(5), rhs = Expression(57, Add)
-- expression 57 operands: lhs = Expression(58, Add), rhs = Expression(59, Add)
-- expression 58 operands: lhs = Counter(6), rhs = Counter(7)
-- expression 59 operands: lhs = Counter(8), rhs = Counter(9)
-- expression 60 operands: lhs = Expression(61, Add), rhs = Expression(62, Add)
-- expression 61 operands: lhs = Counter(10), rhs = Counter(11)
-- expression 62 operands: lhs = Expression(63, Add), rhs = Expression(64, Add)
-- expression 63 operands: lhs = Counter(12), rhs = Counter(13)
-- expression 64 operands: lhs = Counter(14), rhs = Counter(15)
+- expression 33 operands: lhs = Expression(34, Sub), rhs = Counter(11)
+- expression 34 operands: lhs = Expression(35, Sub), rhs = Counter(10)
+- expression 35 operands: lhs = Expression(36, Sub), rhs = Counter(16)
+- expression 36 operands: lhs = Expression(0, Add), rhs = Counter(3)
+- expression 37 operands: lhs = Expression(41, Sub), rhs = Counter(13)
+- expression 38 operands: lhs = Counter(17), rhs = Counter(12)
+- expression 39 operands: lhs = Counter(17), rhs = Counter(12)
+- expression 40 operands: lhs = Expression(41, Sub), rhs = Counter(13)
+- expression 41 operands: lhs = Counter(17), rhs = Counter(12)
+- expression 42 operands: lhs = Expression(46, Sub), rhs = Counter(15)
+- expression 43 operands: lhs = Counter(19), rhs = Counter(14)
+- expression 44 operands: lhs = Counter(19), rhs = Counter(14)
+- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(15)
+- expression 46 operands: lhs = Counter(19), rhs = Counter(14)
+- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(3)
+- expression 48 operands: lhs = Counter(4), rhs = Expression(49, Add)
+- expression 49 operands: lhs = Expression(50, Add), rhs = Expression(54, Add)
+- expression 50 operands: lhs = Counter(5), rhs = Expression(51, Add)
+- expression 51 operands: lhs = Expression(52, Add), rhs = Expression(53, Add)
+- expression 52 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 53 operands: lhs = Counter(8), rhs = Counter(9)
+- expression 54 operands: lhs = Expression(55, Add), rhs = Expression(56, Add)
+- expression 55 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 56 operands: lhs = Expression(57, Add), rhs = Expression(58, Add)
+- expression 57 operands: lhs = Counter(12), rhs = Counter(13)
+- expression 58 operands: lhs = Counter(14), rhs = Counter(15)
Number of file 0 mappings: 40
- Code(Counter(0)) at (prev + 60, 1) to (start + 3, 23)
- Code(Expression(0, Add)) at (prev + 8, 9) to (start + 0, 14)
= (c0 + (c1 + c2))
-- Code(Expression(40, Sub)) at (prev + 2, 9) to (start + 4, 26)
+- Code(Expression(36, Sub)) at (prev + 2, 9) to (start + 4, 26)
= ((c0 + (c1 + c2)) - c3)
- Code(Counter(16)) at (prev + 6, 13) to (start + 0, 47)
- Code(Counter(4)) at (prev + 0, 47) to (start + 0, 48)
-- Code(Expression(20, Sub)) at (prev + 0, 49) to (start + 3, 53)
+- Code(Expression(18, Sub)) at (prev + 0, 49) to (start + 3, 53)
= (c16 - c4)
- Code(Counter(5)) at (prev + 4, 17) to (start + 0, 18)
-- Code(Expression(19, Sub)) at (prev + 2, 17) to (start + 4, 18)
+- Code(Expression(17, Sub)) at (prev + 2, 17) to (start + 4, 18)
= ((c16 - c4) - c5)
-- Code(Expression(17, Sub)) at (prev + 5, 17) to (start + 0, 20)
+- Code(Expression(15, Sub)) at (prev + 5, 17) to (start + 0, 20)
= ((((c16 - c4) - c5) - c6) - c7)
-- Code(Expression(10, Add)) at (prev + 0, 23) to (start + 0, 65)
- = (((c16 - c4) - c5) + Zero)
+- Code(Expression(17, Sub)) at (prev + 0, 23) to (start + 0, 65)
+ = ((c16 - c4) - c5)
- Code(Counter(6)) at (prev + 0, 65) to (start + 0, 66)
-- Code(Expression(18, Sub)) at (prev + 0, 67) to (start + 0, 95)
+- Code(Expression(16, Sub)) at (prev + 0, 67) to (start + 0, 95)
= (((c16 - c4) - c5) - c6)
- Code(Counter(7)) at (prev + 0, 95) to (start + 0, 96)
-- Code(Expression(16, Add)) at (prev + 1, 13) to (start + 0, 32)
- = (((((c16 - c4) - c5) - c6) - c7) + Zero)
-- Code(Expression(25, Sub)) at (prev + 1, 17) to (start + 0, 20)
+- Code(Expression(15, Sub)) at (prev + 1, 13) to (start + 0, 32)
+ = ((((c16 - c4) - c5) - c6) - c7)
+- Code(Expression(22, Sub)) at (prev + 1, 17) to (start + 0, 20)
= ((c18 - c8) - c9)
- Code(Counter(18)) at (prev + 0, 23) to (start + 0, 65)
- Code(Counter(8)) at (prev + 0, 65) to (start + 0, 66)
-- Code(Expression(26, Sub)) at (prev + 0, 67) to (start + 0, 96)
+- Code(Expression(23, Sub)) at (prev + 0, 67) to (start + 0, 96)
= (c18 - c8)
- Code(Counter(9)) at (prev + 0, 96) to (start + 0, 97)
-- Code(Expression(24, Add)) at (prev + 1, 13) to (start + 0, 32)
- = (((c18 - c8) - c9) + Zero)
-- Code(Expression(37, Sub)) at (prev + 4, 17) to (start + 0, 20)
+- Code(Expression(22, Sub)) at (prev + 1, 13) to (start + 0, 32)
+ = ((c18 - c8) - c9)
+- Code(Expression(33, Sub)) at (prev + 4, 17) to (start + 0, 20)
= (((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11)
-- Code(Expression(39, Sub)) at (prev + 0, 23) to (start + 0, 66)
+- Code(Expression(35, Sub)) at (prev + 0, 23) to (start + 0, 66)
= (((c0 + (c1 + c2)) - c3) - c16)
- Code(Counter(10)) at (prev + 0, 66) to (start + 0, 67)
-- Code(Expression(38, Sub)) at (prev + 0, 68) to (start + 0, 97)
+- Code(Expression(34, Sub)) at (prev + 0, 68) to (start + 0, 97)
= ((((c0 + (c1 + c2)) - c3) - c16) - c10)
- Code(Counter(11)) at (prev + 0, 97) to (start + 0, 98)
-- Code(Expression(36, Add)) at (prev + 1, 13) to (start + 0, 32)
- = ((((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11) + Zero)
-- Code(Expression(45, Sub)) at (prev + 1, 17) to (start + 0, 20)
+- Code(Expression(33, Sub)) at (prev + 1, 13) to (start + 0, 32)
+ = (((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11)
+- Code(Expression(40, Sub)) at (prev + 1, 17) to (start + 0, 20)
= ((c17 - c12) - c13)
- Code(Counter(17)) at (prev + 0, 23) to (start + 1, 54)
- Code(Counter(12)) at (prev + 1, 54) to (start + 0, 55)
-- Code(Expression(46, Sub)) at (prev + 1, 18) to (start + 0, 47)
+- Code(Expression(41, Sub)) at (prev + 1, 18) to (start + 0, 47)
= (c17 - c12)
- Code(Counter(13)) at (prev + 0, 47) to (start + 0, 48)
-- Code(Expression(44, Add)) at (prev + 1, 13) to (start + 0, 32)
- = (((c17 - c12) - c13) + Zero)
-- Code(Expression(51, Sub)) at (prev + 1, 17) to (start + 0, 20)
+- Code(Expression(40, Sub)) at (prev + 1, 13) to (start + 0, 32)
+ = ((c17 - c12) - c13)
+- Code(Expression(45, Sub)) at (prev + 1, 17) to (start + 0, 20)
= ((c19 - c14) - c15)
- Code(Counter(19)) at (prev + 0, 23) to (start + 1, 54)
- Code(Counter(14)) at (prev + 2, 17) to (start + 0, 18)
-- Code(Expression(52, Sub)) at (prev + 1, 18) to (start + 0, 47)
+- Code(Expression(46, Sub)) at (prev + 1, 18) to (start + 0, 47)
= (c19 - c14)
- Code(Counter(15)) at (prev + 1, 17) to (start + 0, 18)
-- Code(Expression(50, Add)) at (prev + 2, 13) to (start + 0, 32)
- = (((c19 - c14) - c15) + Zero)
+- Code(Expression(45, Sub)) at (prev + 2, 13) to (start + 0, 32)
+ = ((c19 - c14) - c15)
- Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11)
-- Code(Expression(53, Add)) at (prev + 1, 1) to (start + 0, 2)
+- Code(Expression(47, Add)) at (prev + 1, 1) to (start + 0, 2)
= ((c4 + ((c5 + ((c6 + c7) + (c8 + c9))) + ((c10 + c11) + ((c12 + c13) + (c14 + c15))))) + c3)
diff --git a/tests/run-coverage/try_error_result.coverage b/tests/coverage/try_error_result.coverage
index 5d48cbd62..5d48cbd62 100644
--- a/tests/run-coverage/try_error_result.coverage
+++ b/tests/coverage/try_error_result.coverage
diff --git a/tests/coverage-map/status-quo/try_error_result.rs b/tests/coverage/try_error_result.rs
index 557cbf22b..557cbf22b 100644
--- a/tests/coverage-map/status-quo/try_error_result.rs
+++ b/tests/coverage/try_error_result.rs
diff --git a/tests/coverage/unreachable.cov-map b/tests/coverage/unreachable.cov-map
new file mode 100644
index 000000000..495419820
--- /dev/null
+++ b/tests/coverage/unreachable.cov-map
@@ -0,0 +1,24 @@
+Function name: unreachable::UNREACHABLE_CLOSURE::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 27, 00, 49]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 15, 39) to (start + 0, 73)
+
+Function name: unreachable::unreachable_function
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 17, 1) to (start + 2, 2)
+
+Function name: unreachable::unreachable_intrinsic
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 16, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 22, 1) to (start + 2, 2)
+
diff --git a/tests/coverage/unreachable.coverage b/tests/coverage/unreachable.coverage
new file mode 100644
index 000000000..fa0ac9ccf
--- /dev/null
+++ b/tests/coverage/unreachable.coverage
@@ -0,0 +1,38 @@
+ LL| |#![feature(core_intrinsics)]
+ LL| |#![feature(coverage_attribute)]
+ LL| |// compile-flags: --edition=2021
+ LL| |
+ LL| |// <https://github.com/rust-lang/rust/issues/116171>
+ LL| |// If we instrument a function for coverage, but all of its counter-increment
+ LL| |// statements are removed by MIR optimizations, LLVM will think it isn't
+ LL| |// instrumented and it will disappear from coverage maps and coverage reports.
+ LL| |// Most MIR opts won't cause this because they tend not to remove statements
+ LL| |// from bb0, but `UnreachablePropagation` can do so if it sees that bb0 ends
+ LL| |// with `TerminatorKind::Unreachable`.
+ LL| |
+ LL| |use std::hint::{black_box, unreachable_unchecked};
+ LL| |
+ LL| 0|static UNREACHABLE_CLOSURE: fn() = || unsafe { unreachable_unchecked() };
+ LL| |
+ LL| 0|fn unreachable_function() {
+ LL| 0| unsafe { unreachable_unchecked() }
+ LL| 0|}
+ LL| |
+ LL| |// Use an intrinsic to more reliably trigger unreachable-propagation.
+ LL| 0|fn unreachable_intrinsic() {
+ LL| 0| unsafe { std::intrinsics::unreachable() }
+ LL| 0|}
+ LL| |
+ LL| |#[coverage(off)]
+ LL| |fn main() {
+ LL| | if black_box(false) {
+ LL| | UNREACHABLE_CLOSURE();
+ LL| | }
+ LL| | if black_box(false) {
+ LL| | unreachable_function();
+ LL| | }
+ LL| | if black_box(false) {
+ LL| | unreachable_intrinsic();
+ LL| | }
+ LL| |}
+
diff --git a/tests/coverage/unreachable.rs b/tests/coverage/unreachable.rs
new file mode 100644
index 000000000..6385bfa16
--- /dev/null
+++ b/tests/coverage/unreachable.rs
@@ -0,0 +1,37 @@
+#![feature(core_intrinsics)]
+#![feature(coverage_attribute)]
+// compile-flags: --edition=2021
+
+// <https://github.com/rust-lang/rust/issues/116171>
+// If we instrument a function for coverage, but all of its counter-increment
+// statements are removed by MIR optimizations, LLVM will think it isn't
+// instrumented and it will disappear from coverage maps and coverage reports.
+// Most MIR opts won't cause this because they tend not to remove statements
+// from bb0, but `UnreachablePropagation` can do so if it sees that bb0 ends
+// with `TerminatorKind::Unreachable`.
+
+use std::hint::{black_box, unreachable_unchecked};
+
+static UNREACHABLE_CLOSURE: fn() = || unsafe { unreachable_unchecked() };
+
+fn unreachable_function() {
+ unsafe { unreachable_unchecked() }
+}
+
+// Use an intrinsic to more reliably trigger unreachable-propagation.
+fn unreachable_intrinsic() {
+ unsafe { std::intrinsics::unreachable() }
+}
+
+#[coverage(off)]
+fn main() {
+ if black_box(false) {
+ UNREACHABLE_CLOSURE();
+ }
+ if black_box(false) {
+ unreachable_function();
+ }
+ if black_box(false) {
+ unreachable_intrinsic();
+ }
+}
diff --git a/tests/coverage-map/status-quo/unused.cov-map b/tests/coverage/unused.cov-map
index c8b8f195f..9383d1e90 100644
--- a/tests/coverage-map/status-quo/unused.cov-map
+++ b/tests/coverage/unused.cov-map
@@ -47,45 +47,45 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 37, 1) to (start + 4, 2)
Function name: unused::unused_func (unused)
-Raw bytes (24): 0x[01, 01, 00, 04, 01, 13, 01, 01, 0e, 00, 01, 0f, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Raw bytes (24): 0x[01, 01, 00, 04, 00, 13, 01, 01, 0e, 00, 01, 0f, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 19, 1) to (start + 1, 14)
+- Code(Zero) at (prev + 19, 1) to (start + 1, 14)
- Code(Zero) at (prev + 1, 15) to (start + 2, 6)
- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
Function name: unused::unused_func2 (unused)
-Raw bytes (24): 0x[01, 01, 00, 04, 01, 19, 01, 01, 0e, 00, 01, 0f, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Raw bytes (24): 0x[01, 01, 00, 04, 00, 19, 01, 01, 0e, 00, 01, 0f, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 25, 1) to (start + 1, 14)
+- Code(Zero) at (prev + 25, 1) to (start + 1, 14)
- Code(Zero) at (prev + 1, 15) to (start + 2, 6)
- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
Function name: unused::unused_func3 (unused)
-Raw bytes (24): 0x[01, 01, 00, 04, 01, 1f, 01, 01, 0e, 00, 01, 0f, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
+Raw bytes (24): 0x[01, 01, 00, 04, 00, 1f, 01, 01, 0e, 00, 01, 0f, 02, 06, 00, 02, 06, 00, 07, 00, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 31, 1) to (start + 1, 14)
+- Code(Zero) at (prev + 31, 1) to (start + 1, 14)
- Code(Zero) at (prev + 1, 15) to (start + 2, 6)
- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
- Code(Zero) at (prev + 1, 1) to (start + 0, 2)
Function name: unused::unused_template_func::<_> (unused)
-Raw bytes (34): 0x[01, 01, 00, 06, 01, 0b, 01, 01, 12, 00, 02, 0b, 00, 11, 00, 01, 09, 00, 0f, 00, 00, 13, 00, 19, 00, 01, 09, 00, 0f, 00, 02, 01, 00, 02]
+Raw bytes (34): 0x[01, 01, 00, 06, 00, 0b, 01, 01, 12, 00, 02, 0b, 00, 11, 00, 01, 09, 00, 0f, 00, 00, 13, 00, 19, 00, 01, 09, 00, 0f, 00, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 6
-- Code(Counter(0)) at (prev + 11, 1) to (start + 1, 18)
+- Code(Zero) at (prev + 11, 1) to (start + 1, 18)
- Code(Zero) at (prev + 2, 11) to (start + 0, 17)
- Code(Zero) at (prev + 1, 9) to (start + 0, 15)
- Code(Zero) at (prev + 0, 19) to (start + 0, 25)
diff --git a/tests/run-coverage/unused.coverage b/tests/coverage/unused.coverage
index 056ffeb02..056ffeb02 100644
--- a/tests/run-coverage/unused.coverage
+++ b/tests/coverage/unused.coverage
diff --git a/tests/coverage-map/status-quo/unused.rs b/tests/coverage/unused.rs
index d985af135..d985af135 100644
--- a/tests/coverage-map/status-quo/unused.rs
+++ b/tests/coverage/unused.rs
diff --git a/tests/coverage/unused_mod.cov-map b/tests/coverage/unused_mod.cov-map
new file mode 100644
index 000000000..241cb2610
--- /dev/null
+++ b/tests/coverage/unused_mod.cov-map
@@ -0,0 +1,16 @@
+Function name: unused_mod::main
+Raw bytes (9): 0x[01, 02, 00, 01, 01, 04, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 2
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 4, 1) to (start + 2, 2)
+
+Function name: unused_mod::unused_module::never_called_function (unused)
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 02, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Zero) at (prev + 2, 1) to (start + 2, 2)
+
diff --git a/tests/run-coverage/unused_mod.coverage b/tests/coverage/unused_mod.coverage
index a8fa24ac6..a8fa24ac6 100644
--- a/tests/run-coverage/unused_mod.coverage
+++ b/tests/coverage/unused_mod.coverage
diff --git a/tests/run-coverage/unused_mod.rs b/tests/coverage/unused_mod.rs
index 6e62839c9..6e62839c9 100644
--- a/tests/run-coverage/unused_mod.rs
+++ b/tests/coverage/unused_mod.rs
diff --git a/tests/coverage/uses_crate.cov-map b/tests/coverage/uses_crate.cov-map
new file mode 100644
index 000000000..9c06eab70
--- /dev/null
+++ b/tests/coverage/uses_crate.cov-map
@@ -0,0 +1,40 @@
+Function name: used_crate::used_from_bin_crate_and_lib_crate_generic_function::<alloc::vec::Vec<i32>>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1b, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 27, 1) to (start + 2, 2)
+
+Function name: used_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 19, 1) to (start + 2, 2)
+
+Function name: used_crate::used_only_from_bin_crate_generic_function::<&str>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 19, 1) to (start + 2, 2)
+
+Function name: used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1f, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 31, 1) to (start + 2, 2)
+
+Function name: uses_crate::main
+Raw bytes (9): 0x[01, 02, 00, 01, 01, 0c, 01, 07, 02]
+Number of files: 1
+- file 0 => global file 2
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 12, 1) to (start + 7, 2)
+
diff --git a/tests/run-coverage/uses_crate.coverage b/tests/coverage/uses_crate.coverage
index 50d92102a..50d92102a 100644
--- a/tests/run-coverage/uses_crate.coverage
+++ b/tests/coverage/uses_crate.coverage
diff --git a/tests/run-coverage/uses_crate.rs b/tests/coverage/uses_crate.rs
index ab203ad78..ab203ad78 100644
--- a/tests/run-coverage/uses_crate.rs
+++ b/tests/coverage/uses_crate.rs
diff --git a/tests/coverage/uses_inline_crate.cov-map b/tests/coverage/uses_inline_crate.cov-map
new file mode 100644
index 000000000..6b621825c
--- /dev/null
+++ b/tests/coverage/uses_inline_crate.cov-map
@@ -0,0 +1,55 @@
+Function name: used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::<alloc::vec::Vec<i32>>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 2c, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 44, 1) to (start + 2, 2)
+
+Function name: used_inline_crate::used_inline_function
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 14, 01, 06, 0f, 05, 06, 10, 02, 06, 02, 02, 06, 00, 07, 07, 01, 05, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 20, 1) to (start + 6, 15)
+- Code(Counter(1)) at (prev + 6, 16) to (start + 2, 6)
+- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 1, 2)
+ = (c1 + (c0 - c1))
+
+Function name: used_inline_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 21, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 33, 1) to (start + 2, 2)
+
+Function name: used_inline_crate::used_only_from_bin_crate_generic_function::<&str>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 21, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 33, 1) to (start + 2, 2)
+
+Function name: used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 31, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 49, 1) to (start + 2, 2)
+
+Function name: uses_inline_crate::main
+Raw bytes (9): 0x[01, 02, 00, 01, 01, 0c, 01, 0a, 02]
+Number of files: 1
+- file 0 => global file 2
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 12, 1) to (start + 10, 2)
+
diff --git a/tests/run-coverage/uses_inline_crate.coverage b/tests/coverage/uses_inline_crate.coverage
index cc0e01ffd..cc0e01ffd 100644
--- a/tests/run-coverage/uses_inline_crate.coverage
+++ b/tests/coverage/uses_inline_crate.coverage
diff --git a/tests/run-coverage/uses_inline_crate.rs b/tests/coverage/uses_inline_crate.rs
index d7b4c3c05..d7b4c3c05 100644
--- a/tests/run-coverage/uses_inline_crate.rs
+++ b/tests/coverage/uses_inline_crate.rs
diff --git a/tests/coverage-map/status-quo/while.cov-map b/tests/coverage/while.cov-map
index cfd2be96a..af250f3fb 100644
--- a/tests/coverage-map/status-quo/while.cov-map
+++ b/tests/coverage/while.cov-map
@@ -1,15 +1,15 @@
Function name: while::main
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 03, 05, 04, 01, 01, 01, 01, 10, 03, 02, 0b, 00, 14, 00, 00, 15, 01, 06, 06, 02, 01, 00, 02]
+Raw bytes (28): 0x[01, 01, 02, 01, 00, 03, 00, 04, 01, 01, 01, 01, 10, 03, 02, 0b, 00, 14, 00, 00, 15, 01, 06, 06, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
-- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 1 operands: lhs = Expression(0, Add), rhs = Counter(1)
+- expression 0 operands: lhs = Counter(0), rhs = Zero
+- expression 1 operands: lhs = Expression(0, Add), rhs = Zero
Number of file 0 mappings: 4
- Code(Counter(0)) at (prev + 1, 1) to (start + 1, 16)
- Code(Expression(0, Add)) at (prev + 2, 11) to (start + 0, 20)
- = (c0 + c1)
+ = (c0 + Zero)
- Code(Zero) at (prev + 0, 21) to (start + 1, 6)
- Code(Expression(1, Sub)) at (prev + 2, 1) to (start + 0, 2)
- = ((c0 + c1) - c1)
+ = ((c0 + Zero) - Zero)
diff --git a/tests/run-coverage/while.coverage b/tests/coverage/while.coverage
index c9d497651..c9d497651 100644
--- a/tests/run-coverage/while.coverage
+++ b/tests/coverage/while.coverage
diff --git a/tests/coverage-map/status-quo/while.rs b/tests/coverage/while.rs
index 781b90b35..781b90b35 100644
--- a/tests/coverage-map/status-quo/while.rs
+++ b/tests/coverage/while.rs
diff --git a/tests/coverage-map/status-quo/while_early_ret.cov-map b/tests/coverage/while_early_ret.cov-map
index 369ebe891..369ebe891 100644
--- a/tests/coverage-map/status-quo/while_early_ret.cov-map
+++ b/tests/coverage/while_early_ret.cov-map
diff --git a/tests/run-coverage/while_early_ret.coverage b/tests/coverage/while_early_ret.coverage
index 49d39d366..49d39d366 100644
--- a/tests/run-coverage/while_early_ret.coverage
+++ b/tests/coverage/while_early_ret.coverage
diff --git a/tests/coverage-map/status-quo/while_early_ret.rs b/tests/coverage/while_early_ret.rs
index b2f0eee2c..b2f0eee2c 100644
--- a/tests/coverage-map/status-quo/while_early_ret.rs
+++ b/tests/coverage/while_early_ret.rs
diff --git a/tests/coverage/yield.cov-map b/tests/coverage/yield.cov-map
new file mode 100644
index 000000000..c9c9709fa
--- /dev/null
+++ b/tests/coverage/yield.cov-map
@@ -0,0 +1,62 @@
+Function name: yield::main
+Raw bytes (106): 0x[01, 01, 0b, 05, 09, 0d, 11, 22, 15, 0d, 11, 11, 15, 22, 15, 0d, 11, 22, 15, 0d, 11, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 06, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 22, 01, 22, 00, 27, 1e, 00, 2c, 00, 2e, 13, 01, 0e, 00, 34, 1e, 03, 09, 00, 16, 1e, 07, 0b, 00, 2e, 21, 01, 27, 00, 29, 27, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 2b, 01, 0e, 00, 34, 2d, 02, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 11
+- expression 0 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 2 operands: lhs = Expression(8, Sub), rhs = Counter(5)
+- expression 3 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 5 operands: lhs = Expression(8, Sub), rhs = Counter(5)
+- expression 6 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 7 operands: lhs = Expression(8, Sub), rhs = Counter(5)
+- expression 8 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 9 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 10 operands: lhs = Counter(9), rhs = Counter(10)
+Number of file 0 mappings: 16
+- Code(Counter(0)) at (prev + 7, 1) to (start + 1, 22)
+- Code(Counter(0)) at (prev + 6, 11) to (start + 0, 46)
+- Code(Counter(3)) at (prev + 1, 39) to (start + 0, 41)
+- Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 52)
+ = (c1 + c2)
+- Code(Counter(3)) at (prev + 2, 11) to (start + 0, 46)
+- Code(Expression(8, Sub)) at (prev + 1, 34) to (start + 0, 39)
+ = (c3 - c4)
+- Code(Expression(7, Sub)) at (prev + 0, 44) to (start + 0, 46)
+ = ((c3 - c4) - c5)
+- Code(Expression(4, Add)) at (prev + 1, 14) to (start + 0, 52)
+ = (c4 + c5)
+- Code(Expression(7, Sub)) at (prev + 3, 9) to (start + 0, 22)
+ = ((c3 - c4) - c5)
+- Code(Expression(7, Sub)) at (prev + 7, 11) to (start + 0, 46)
+ = ((c3 - c4) - c5)
+- Code(Counter(8)) at (prev + 1, 39) to (start + 0, 41)
+- Code(Expression(9, Add)) at (prev + 1, 14) to (start + 0, 52)
+ = (c6 + c7)
+- Code(Counter(8)) at (prev + 2, 11) to (start + 0, 46)
+- Code(Counter(11)) at (prev + 1, 39) to (start + 0, 41)
+- Code(Expression(10, Add)) at (prev + 1, 14) to (start + 0, 52)
+ = (c9 + c10)
+- Code(Counter(11)) at (prev + 2, 1) to (start + 0, 2)
+
+Function name: yield::main::{closure#0}
+Raw bytes (14): 0x[01, 01, 00, 02, 01, 08, 1c, 01, 10, 05, 02, 10, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 2
+- Code(Counter(0)) at (prev + 8, 28) to (start + 1, 16)
+- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)
+
+Function name: yield::main::{closure#1}
+Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 1c, 01, 10, 05, 02, 09, 00, 10, 09, 01, 09, 00, 10, 0d, 01, 10, 01, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 22, 28) to (start + 1, 16)
+- Code(Counter(1)) at (prev + 2, 9) to (start + 0, 16)
+- Code(Counter(2)) at (prev + 1, 9) to (start + 0, 16)
+- Code(Counter(3)) at (prev + 1, 16) to (start + 1, 6)
+
diff --git a/tests/run-coverage/yield.coverage b/tests/coverage/yield.coverage
index 90c2641a7..d7e455f21 100644
--- a/tests/run-coverage/yield.coverage
+++ b/tests/coverage/yield.coverage
@@ -1,37 +1,37 @@
- LL| |#![feature(generators, generator_trait)]
+ LL| |#![feature(coroutines, coroutine_trait)]
LL| |#![allow(unused_assignments)]
LL| |
- LL| |use std::ops::{Generator, GeneratorState};
+ LL| |use std::ops::{Coroutine, CoroutineState};
LL| |use std::pin::Pin;
LL| |
LL| 1|fn main() {
- LL| 1| let mut generator = || {
+ LL| 1| let mut coroutine = || {
LL| 1| yield 1;
LL| 1| return "foo";
LL| 1| };
LL| |
- LL| 1| match Pin::new(&mut generator).resume(()) {
- LL| 1| GeneratorState::Yielded(1) => {}
+ LL| 1| match Pin::new(&mut coroutine).resume(()) {
+ LL| 1| CoroutineState::Yielded(1) => {}
LL| 0| _ => panic!("unexpected value from resume"),
LL| | }
- LL| 1| match Pin::new(&mut generator).resume(()) {
- LL| 1| GeneratorState::Complete("foo") => {}
+ LL| 1| match Pin::new(&mut coroutine).resume(()) {
+ LL| 1| CoroutineState::Complete("foo") => {}
LL| 0| _ => panic!("unexpected value from resume"),
LL| | }
LL| |
- LL| 1| let mut generator = || {
+ LL| 1| let mut coroutine = || {
LL| 1| yield 1;
LL| 1| yield 2;
LL| 0| yield 3;
LL| 0| return "foo";
LL| 0| };
LL| |
- LL| 1| match Pin::new(&mut generator).resume(()) {
- LL| 1| GeneratorState::Yielded(1) => {}
+ LL| 1| match Pin::new(&mut coroutine).resume(()) {
+ LL| 1| CoroutineState::Yielded(1) => {}
LL| 0| _ => panic!("unexpected value from resume"),
LL| | }
- LL| 1| match Pin::new(&mut generator).resume(()) {
- LL| 1| GeneratorState::Yielded(2) => {}
+ LL| 1| match Pin::new(&mut coroutine).resume(()) {
+ LL| 1| CoroutineState::Yielded(2) => {}
LL| 0| _ => panic!("unexpected value from resume"),
LL| | }
LL| 1|}
diff --git a/tests/coverage/yield.rs b/tests/coverage/yield.rs
new file mode 100644
index 000000000..b7e2ba31b
--- /dev/null
+++ b/tests/coverage/yield.rs
@@ -0,0 +1,37 @@
+#![feature(coroutines, coroutine_trait)]
+#![allow(unused_assignments)]
+
+use std::ops::{Coroutine, CoroutineState};
+use std::pin::Pin;
+
+fn main() {
+ let mut coroutine = || {
+ yield 1;
+ return "foo";
+ };
+
+ match Pin::new(&mut coroutine).resume(()) {
+ CoroutineState::Yielded(1) => {}
+ _ => panic!("unexpected value from resume"),
+ }
+ match Pin::new(&mut coroutine).resume(()) {
+ CoroutineState::Complete("foo") => {}
+ _ => panic!("unexpected value from resume"),
+ }
+
+ let mut coroutine = || {
+ yield 1;
+ yield 2;
+ yield 3;
+ return "foo";
+ };
+
+ match Pin::new(&mut coroutine).resume(()) {
+ CoroutineState::Yielded(1) => {}
+ _ => panic!("unexpected value from resume"),
+ }
+ match Pin::new(&mut coroutine).resume(()) {
+ CoroutineState::Yielded(2) => {}
+ _ => panic!("unexpected value from resume"),
+ }
+}
diff --git a/tests/debuginfo/generator-locals.rs b/tests/debuginfo/coroutine-locals.rs
index fd46c1a8b..e5eb1022f 100644
--- a/tests/debuginfo/generator-locals.rs
+++ b/tests/debuginfo/coroutine-locals.rs
@@ -54,10 +54,10 @@
// lldbg-check:(int) $7 = 6
// lldbr-check:(int) c = 6
-#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
+#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)]
#![omit_gdb_pretty_printer_section]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/debuginfo/generator-objects.rs b/tests/debuginfo/coroutine-objects.rs
index 11c4ae2f6..3e658b213 100644
--- a/tests/debuginfo/generator-objects.rs
+++ b/tests/debuginfo/coroutine-objects.rs
@@ -2,7 +2,7 @@
// min-gdb-version: 8.2
// LLDB without native Rust support cannot read DW_TAG_variant_part,
-// so it prints nothing for generators. But those tests are kept to
+// so it prints nothing for coroutines. But those tests are kept to
// ensure that LLDB won't crash at least (like #57822).
// compile-flags:-g
@@ -11,62 +11,62 @@
// gdb-command:run
// gdb-command:print b
-// gdb-check:$1 = generator_objects::main::{generator_env#0}::Unresumed{_ref__a: 0x[...]}
+// gdb-check:$1 = coroutine_objects::main::{coroutine_env#0}::Unresumed{_ref__a: 0x[...]}
// gdb-command:continue
// gdb-command:print b
-// gdb-check:$2 = generator_objects::main::{generator_env#0}::Suspend0{c: 6, d: 7, _ref__a: 0x[...]}
+// gdb-check:$2 = coroutine_objects::main::{coroutine_env#0}::Suspend0{c: 6, d: 7, _ref__a: 0x[...]}
// gdb-command:continue
// gdb-command:print b
-// gdb-check:$3 = generator_objects::main::{generator_env#0}::Suspend1{c: 7, d: 8, _ref__a: 0x[...]}
+// gdb-check:$3 = coroutine_objects::main::{coroutine_env#0}::Suspend1{c: 7, d: 8, _ref__a: 0x[...]}
// gdb-command:continue
// gdb-command:print b
-// gdb-check:$4 = generator_objects::main::{generator_env#0}::Returned{_ref__a: 0x[...]}
+// gdb-check:$4 = coroutine_objects::main::{coroutine_env#0}::Returned{_ref__a: 0x[...]}
// === LLDB TESTS ==================================================================================
// lldb-command:run
// lldb-command:print b
-// lldbg-check:(generator_objects::main::{generator_env#0}) $0 =
+// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $0 =
// lldb-command:continue
// lldb-command:print b
-// lldbg-check:(generator_objects::main::{generator_env#0}) $1 =
+// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $1 =
// lldb-command:continue
// lldb-command:print b
-// lldbg-check:(generator_objects::main::{generator_env#0}) $2 =
+// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $2 =
// lldb-command:continue
// lldb-command:print b
-// lldbg-check:(generator_objects::main::{generator_env#0}) $3 =
+// lldbg-check:(coroutine_objects::main::{coroutine_env#0}) $3 =
// === CDB TESTS ===================================================================================
// cdb-command: g
// cdb-command: dx b
-// cdb-check: b : Unresumed [Type: enum2$<generator_objects::main::generator_env$0>]
+// cdb-check: b : Unresumed [Type: enum2$<coroutine_objects::main::coroutine_env$0>]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
// cdb-command: g
// cdb-command: dx b
-// cdb-check: b : Suspend0 [Type: enum2$<generator_objects::main::generator_env$0>]
+// cdb-check: b : Suspend0 [Type: enum2$<coroutine_objects::main::coroutine_env$0>]
// cdb-check: [+0x[...]] c : 6 [Type: int]
// cdb-check: [+0x[...]] d : 7 [Type: int]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
// cdb-command: g
// cdb-command: dx b
-// cdb-check: b : Suspend1 [Type: enum2$<generator_objects::main::generator_env$0>]
+// cdb-check: b : Suspend1 [Type: enum2$<coroutine_objects::main::coroutine_env$0>]
// cdb-check: [+0x[...]] c : 7 [Type: int]
// cdb-check: [+0x[...]] d : 8 [Type: int]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
// cdb-command: g
// cdb-command: dx b
-// cdb-check: b : Returned [Type: enum2$<generator_objects::main::generator_env$0>]
+// cdb-check: b : Returned [Type: enum2$<coroutine_objects::main::coroutine_env$0>]
// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
-#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
+#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)]
#![omit_gdb_pretty_printer_section]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/debuginfo/function-names.rs b/tests/debuginfo/function-names.rs
index d9aa03fee..d29b3ea76 100644
--- a/tests/debuginfo/function-names.rs
+++ b/tests/debuginfo/function-names.rs
@@ -31,8 +31,8 @@
// gdb-check:[...]static fn function_names::main::{closure#0}(*mut function_names::main::{closure_env#0});
// gdb-check:[...]static fn function_names::{impl#2}::impl_function::{closure#0}<i32, i32>(*mut function_names::{impl#2}::impl_function::{closure_env#0}<i32, i32>);
-// Generator
-// Generators don't seem to appear in GDB's symbol table.
+// Coroutine
+// Coroutines don't seem to appear in GDB's symbol table.
// Const generic parameter
// gdb-command:info functions -q function_names::const_generic_fn.*
@@ -69,9 +69,9 @@
// cdb-check:[...] a!function_names::main::closure$0 (void)
// cdb-check:[...] a!function_names::generic_func::closure$0<i32> (void)
-// Generator
-// cdb-command:x a!function_names::*::generator*
-// cdb-check:[...] a!function_names::main::generator$1 (void)
+// Coroutine
+// cdb-command:x a!function_names::*::coroutine*
+// cdb-check:[...] a!function_names::main::coroutine$1 (void)
// Const generic parameter
// cdb-command:x a!function_names::const_generic_fn*
@@ -83,10 +83,10 @@
#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
-#![feature(adt_const_params, generators, generator_trait)]
+#![feature(adt_const_params, coroutines, coroutine_trait)]
#![allow(incomplete_features)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
use Mod1::TestTrait2;
@@ -110,12 +110,12 @@ fn main() {
let closure = || TestStruct1;
closure();
- // Generator
- let mut generator = || {
+ // Coroutine
+ let mut coroutine = || {
yield;
return;
};
- Pin::new(&mut generator).resume(());
+ Pin::new(&mut coroutine).resume(());
// Const generic functions
const_generic_fn_bool::<false>();
diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs
index 62e7eb13c..a12a562a0 100644
--- a/tests/debuginfo/issue-57822.rs
+++ b/tests/debuginfo/issue-57822.rs
@@ -1,5 +1,5 @@
// This test makes sure that the LLDB pretty printer does not throw an exception
-// for nested closures and generators.
+// for nested closures and coroutines.
// Require a gdb that can read DW_TAG_variant_part.
// min-gdb-version: 8.2
@@ -14,7 +14,7 @@
// gdb-check:$1 = issue_57822::main::{closure_env#1} {f: issue_57822::main::{closure_env#0} {x: 1}}
// gdb-command:print b
-// gdb-check:$2 = issue_57822::main::{generator_env#3}::Unresumed{a: issue_57822::main::{generator_env#2}::Unresumed{y: 2}}
+// gdb-check:$2 = issue_57822::main::{coroutine_env#3}::Unresumed{a: issue_57822::main::{coroutine_env#2}::Unresumed{y: 2}}
// === LLDB TESTS ==================================================================================
@@ -24,12 +24,12 @@
// lldbg-check:(issue_57822::main::{closure_env#1}) $0 = { f = { x = 1 } }
// lldb-command:print b
-// lldbg-check:(issue_57822::main::{generator_env#3}) $1 =
+// lldbg-check:(issue_57822::main::{coroutine_env#3}) $1 =
-#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
+#![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait)]
#![omit_gdb_pretty_printer_section]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs
index aa3cf023a..fea810922 100644
--- a/tests/debuginfo/simple-struct.rs
+++ b/tests/debuginfo/simple-struct.rs
@@ -1,7 +1,7 @@
// min-lldb-version: 310
// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
-// compile-flags:-g
+// compile-flags: -g -Zmir-enable-passes=-CheckAlignment
// === GDB TESTS ===================================================================================
diff --git a/tests/incremental/hashes/for_loops.rs b/tests/incremental/hashes/for_loops.rs
index 193e792c8..98c762e40 100644
--- a/tests/incremental/hashes/for_loops.rs
+++ b/tests/incremental/hashes/for_loops.rs
@@ -28,9 +28,9 @@ pub fn change_loop_body() {
}
#[cfg(not(any(cfail1,cfail4)))]
-#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
-#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() {
let mut _x = 0;
@@ -180,7 +180,7 @@ pub fn add_loop_label_to_break() {
#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
-#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_break() {
let mut _x = 0;
diff --git a/tests/incremental/hashes/loop_expressions.rs b/tests/incremental/hashes/loop_expressions.rs
index 87b86479d..13e37bd59 100644
--- a/tests/incremental/hashes/loop_expressions.rs
+++ b/tests/incremental/hashes/loop_expressions.rs
@@ -28,9 +28,9 @@ pub fn change_loop_body() {
}
#[cfg(not(any(cfail1,cfail4)))]
-#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
-#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() {
let mut _x = 0;
diff --git a/tests/incremental/hashes/while_loops.rs b/tests/incremental/hashes/while_loops.rs
index c1cc0b62b..077d76fdd 100644
--- a/tests/incremental/hashes/while_loops.rs
+++ b/tests/incremental/hashes/while_loops.rs
@@ -28,9 +28,9 @@ pub fn change_loop_body() {
}
#[cfg(not(any(cfail1,cfail4)))]
-#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
-#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() {
let mut _x = 0;
@@ -53,9 +53,9 @@ pub fn change_loop_condition() {
}
#[cfg(not(any(cfail1,cfail4)))]
-#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
-#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_condition() {
let mut _x = 0;
@@ -211,7 +211,7 @@ pub fn change_continue_label() {
#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
-#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn change_continue_label() {
let mut _x = 0;
diff --git a/tests/mir-opt/README.md b/tests/mir-opt/README.md
index 0721d9f70..39a7b5aea 100644
--- a/tests/mir-opt/README.md
+++ b/tests/mir-opt/README.md
@@ -49,3 +49,21 @@ This exists mainly for completeness and is rarely useful.
```
// EMIT_MIR $file_name_of_some_mir_dump.before.mir
```
+
+# FileCheck directives
+
+The LLVM FileCheck tool is used to verify the contents of output MIR against `CHECK` directives
+present in the test file. This works on the runtime MIR, generated by `--emit=mir`, and not
+on the output of a individual passes.
+
+Use `// skip-filecheck` to prevent FileCheck from running.
+
+To check MIR for function `foo`, start with a `// CHECK-LABEL fn foo(` directive.
+
+`{{regex}}` syntax allows to match `regex`.
+
+`[[name:regex]]` syntax allows to bind `name` to a string matching `regex`, and refer to it
+as `[[name]]` in later directives, `regex` should be written not to match a leading space.
+Use `[[my_local:_.*]]` to name a local, and `[[my_bb:bb.*]]` to name a block.
+
+Documentation for FileCheck is available here: https://www.llvm.org/docs/CommandGuide/FileCheck.html
diff --git a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
index 61aa89e44..76938c14e 100644
--- a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
@@ -1,36 +1,36 @@
// MIR for `address_of_reborrow` after SimplifyCfg-initial
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:7:5: 7:18, inferred_ty: *const [i32; 10]
-| 1: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:9:5: 9:25, inferred_ty: *const dyn std::marker::Send
-| 2: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10]
-| 3: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:13:12: 13:20, inferred_ty: *const [i32; 10]
-| 4: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10]
-| 5: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:14:12: 14:28, inferred_ty: *const [i32; 10]
-| 6: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send
-| 7: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:15:12: 15:27, inferred_ty: *const dyn std::marker::Send
-| 8: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32]
-| 9: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:16:12: 16:24, inferred_ty: *const [i32]
-| 10: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:18:5: 18:18, inferred_ty: *const [i32; 10]
-| 11: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:20:5: 20:25, inferred_ty: *const dyn std::marker::Send
-| 12: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10]
-| 13: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:23:12: 23:20, inferred_ty: *const [i32; 10]
-| 14: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10]
-| 15: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:24:12: 24:28, inferred_ty: *const [i32; 10]
-| 16: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send
-| 17: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:25:12: 25:27, inferred_ty: *const dyn std::marker::Send
-| 18: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32]
-| 19: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:26:12: 26:24, inferred_ty: *const [i32]
-| 20: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:28:5: 28:16, inferred_ty: *mut [i32; 10]
-| 21: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:30:5: 30:23, inferred_ty: *mut dyn std::marker::Send
-| 22: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10]
-| 23: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:33:12: 33:18, inferred_ty: *mut [i32; 10]
-| 24: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10]
-| 25: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:34:12: 34:26, inferred_ty: *mut [i32; 10]
-| 26: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send
-| 27: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:35:12: 35:25, inferred_ty: *mut dyn std::marker::Send
-| 28: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32]
-| 29: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:36:12: 36:22, inferred_ty: *mut [i32]
+| 0: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:8:5: 8:18, inferred_ty: *const [i32; 10]
+| 1: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:10:5: 10:25, inferred_ty: *const dyn std::marker::Send
+| 2: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:14:12: 14:20, inferred_ty: *const [i32; 10]
+| 3: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:14:12: 14:20, inferred_ty: *const [i32; 10]
+| 4: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:15:12: 15:28, inferred_ty: *const [i32; 10]
+| 5: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:15:12: 15:28, inferred_ty: *const [i32; 10]
+| 6: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:16:12: 16:27, inferred_ty: *const dyn std::marker::Send
+| 7: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:16:12: 16:27, inferred_ty: *const dyn std::marker::Send
+| 8: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:17:12: 17:24, inferred_ty: *const [i32]
+| 9: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:17:12: 17:24, inferred_ty: *const [i32]
+| 10: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:19:5: 19:18, inferred_ty: *const [i32; 10]
+| 11: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:21:5: 21:25, inferred_ty: *const dyn std::marker::Send
+| 12: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:24:12: 24:20, inferred_ty: *const [i32; 10]
+| 13: user_ty: Canonical { value: Ty(*const ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:24:12: 24:20, inferred_ty: *const [i32; 10]
+| 14: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:25:12: 25:28, inferred_ty: *const [i32; 10]
+| 15: user_ty: Canonical { value: Ty(*const [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:25:12: 25:28, inferred_ty: *const [i32; 10]
+| 16: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:26:12: 26:27, inferred_ty: *const dyn std::marker::Send
+| 17: user_ty: Canonical { value: Ty(*const dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:26:12: 26:27, inferred_ty: *const dyn std::marker::Send
+| 18: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:27:12: 27:24, inferred_ty: *const [i32]
+| 19: user_ty: Canonical { value: Ty(*const [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:27:12: 27:24, inferred_ty: *const [i32]
+| 20: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:29:5: 29:16, inferred_ty: *mut [i32; 10]
+| 21: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:31:5: 31:23, inferred_ty: *mut dyn std::marker::Send
+| 22: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:34:12: 34:18, inferred_ty: *mut [i32; 10]
+| 23: user_ty: Canonical { value: Ty(*mut ^0), max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }, span: $DIR/address_of.rs:34:12: 34:18, inferred_ty: *mut [i32; 10]
+| 24: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:35:12: 35:26, inferred_ty: *mut [i32; 10]
+| 25: user_ty: Canonical { value: Ty(*mut [i32; 10]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:35:12: 35:26, inferred_ty: *mut [i32; 10]
+| 26: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:36:12: 36:25, inferred_ty: *mut dyn std::marker::Send
+| 27: user_ty: Canonical { value: Ty(*mut dyn std::marker::Send), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/address_of.rs:36:12: 36:25, inferred_ty: *mut dyn std::marker::Send
+| 28: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:37:12: 37:22, inferred_ty: *mut [i32]
+| 29: user_ty: Canonical { value: Ty(*mut [i32]), max_universe: U0, variables: [] }, span: $DIR/address_of.rs:37:12: 37:22, inferred_ty: *mut [i32]
|
fn address_of_reborrow() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/address_of.rs b/tests/mir-opt/address_of.rs
index c4bea5613..57a317a4a 100644
--- a/tests/mir-opt/address_of.rs
+++ b/tests/mir-opt/address_of.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
fn address_of_reborrow() {
diff --git a/tests/mir-opt/array_index_is_temporary.rs b/tests/mir-opt/array_index_is_temporary.rs
index 950429fb6..f5edc6890 100644
--- a/tests/mir-opt/array_index_is_temporary.rs
+++ b/tests/mir-opt/array_index_is_temporary.rs
@@ -1,3 +1,4 @@
+// unit-test: SimplifyCfg-elaborate-drops
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Retagging (from Stacked Borrows) relies on the array index being a fresh
// temporary, so that side-effects cannot change it.
@@ -11,6 +12,12 @@ unsafe fn foo(z: *mut usize) -> u32 {
// EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: [[y]] = const 1_usize;
+ // CHECK: [[tmp:_.*]] = [[y]];
+ // CHECK: [[x]][[[tmp]]] =
let mut x = [42, 43, 44];
let mut y = 1;
let z: *mut usize = &mut y;
diff --git a/tests/mir-opt/asm_unwind_panic_abort.rs b/tests/mir-opt/asm_unwind_panic_abort.rs
index ad8f9398e..a80dcb385 100644
--- a/tests/mir-opt/asm_unwind_panic_abort.rs
+++ b/tests/mir-opt/asm_unwind_panic_abort.rs
@@ -9,6 +9,9 @@
// EMIT_MIR asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: asm!(
+ // CHECK-SAME: unwind terminate(abi)
unsafe {
std::arch::asm!("", options(may_unwind));
}
diff --git a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
index 75070ffda..5df663388 100644
--- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
@@ -1,8 +1,8 @@
// MIR for `main` after SimplifyCfg-initial
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:20:17: 20:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
-| 1: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:20:17: 20:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
+| 0: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:38:17: 38:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
+| 1: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:38:17: 38:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
|
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/basic_assignment.rs b/tests/mir-opt/basic_assignment.rs
index 92434e44a..30a410988 100644
--- a/tests/mir-opt/basic_assignment.rs
+++ b/tests/mir-opt/basic_assignment.rs
@@ -1,3 +1,4 @@
+// unit-test: ElaborateDrops
// needs-unwind
// this tests move up progration, which is not yet implemented
@@ -10,6 +11,23 @@
// destruction.
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug nodrop_x => [[nodrop_x:_.*]];
+ // CHECK: debug nodrop_y => [[nodrop_y:_.*]];
+ // CHECK: debug drop_x => [[drop_x:_.*]];
+ // CHECK: debug drop_y => [[drop_y:_.*]];
+ // CHECK-NOT: drop([[nodrop_x]])
+ // CHECK-NOT: drop([[nodrop_y]])
+ // CHECK-NOT: drop([[drop_x]])
+ // CHECK: [[drop_tmp:_.*]] = move [[drop_x]];
+ // CHECK-NOT: drop([[drop_x]])
+ // CHECK-NOT: drop([[drop_tmp]])
+ // CHECK: [[drop_y]] = move [[drop_tmp]];
+ // CHECK-NOT: drop([[drop_x]])
+ // CHECK-NOT: drop([[drop_tmp]])
+ // CHECK: drop([[drop_y]])
+ // CHECK-NOT: drop([[drop_x]])
+ // CHECK-NOT: drop([[drop_tmp]])
let nodrop_x = false;
let nodrop_y;
diff --git a/tests/mir-opt/bool_compare.rs b/tests/mir-opt/bool_compare.rs
deleted file mode 100644
index 080f7f72d..000000000
--- a/tests/mir-opt/bool_compare.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// unit-test: InstSimplify
-
-// EMIT_MIR bool_compare.opt1.InstSimplify.diff
-fn opt1(x: bool) -> u32 {
- if x != true { 0 } else { 1 }
-}
-
-// EMIT_MIR bool_compare.opt2.InstSimplify.diff
-fn opt2(x: bool) -> u32 {
- if true != x { 0 } else { 1 }
-}
-
-// EMIT_MIR bool_compare.opt3.InstSimplify.diff
-fn opt3(x: bool) -> u32 {
- if x == false { 0 } else { 1 }
-}
-
-// EMIT_MIR bool_compare.opt4.InstSimplify.diff
-fn opt4(x: bool) -> u32 {
- if false == x { 0 } else { 1 }
-}
-
-fn main() {
- opt1(false);
- opt2(false);
- opt3(false);
- opt4(false);
-}
diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir
deleted file mode 100644
index 1c7ef7f83..000000000
--- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir
+++ /dev/null
@@ -1,71 +0,0 @@
-// MIR for `main` before ElaborateDrops
-
-fn main() -> () {
- let mut _0: ();
- let _1: std::boxed::Box<S>;
- let mut _2: usize;
- let mut _3: usize;
- let mut _4: *mut u8;
- let mut _5: std::boxed::Box<S>;
- let _6: ();
- let mut _7: std::boxed::Box<S>;
- scope 1 {
- debug x => _1;
- }
- scope 2 {
- }
-
- bb0: {
- StorageLive(_1);
- _2 = SizeOf(S);
- _3 = AlignOf(S);
- _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind: bb9];
- }
-
- bb1: {
- StorageLive(_5);
- _5 = ShallowInitBox(move _4, S);
- (*_5) = S::new() -> [return: bb2, unwind: bb8];
- }
-
- bb2: {
- _1 = move _5;
- drop(_5) -> [return: bb3, unwind: bb9];
- }
-
- bb3: {
- StorageDead(_5);
- StorageLive(_6);
- StorageLive(_7);
- _7 = move _1;
- _6 = std::mem::drop::<Box<S>>(move _7) -> [return: bb4, unwind: bb6];
- }
-
- bb4: {
- StorageDead(_7);
- StorageDead(_6);
- _0 = const ();
- drop(_1) -> [return: bb5, unwind: bb9];
- }
-
- bb5: {
- StorageDead(_1);
- return;
- }
-
- bb6 (cleanup): {
- drop(_7) -> [return: bb7, unwind terminate(cleanup)];
- }
-
- bb7 (cleanup): {
- drop(_1) -> [return: bb9, unwind terminate(cleanup)];
- }
-
- bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate(cleanup)];
- }
-
- bb9 (cleanup): {
- resume;
- }
-}
diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
deleted file mode 100644
index 4ad1c2de1..000000000
--- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
+++ /dev/null
@@ -1,71 +0,0 @@
-// MIR for `main` before ElaborateDrops
-
-fn main() -> () {
- let mut _0: ();
- let _1: std::boxed::Box<S>;
- let mut _2: usize;
- let mut _3: usize;
- let mut _4: *mut u8;
- let mut _5: std::boxed::Box<S>;
- let _6: ();
- let mut _7: std::boxed::Box<S>;
- scope 1 {
- debug x => _1;
- }
- scope 2 {
- }
-
- bb0: {
- StorageLive(_1);
- _2 = SizeOf(S);
- _3 = AlignOf(S);
- _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue];
- }
-
- bb1: {
- StorageLive(_5);
- _5 = ShallowInitBox(move _4, S);
- (*_5) = S::new() -> [return: bb2, unwind: bb8];
- }
-
- bb2: {
- _1 = move _5;
- drop(_5) -> [return: bb3, unwind continue];
- }
-
- bb3: {
- StorageDead(_5);
- StorageLive(_6);
- StorageLive(_7);
- _7 = move _1;
- _6 = std::mem::drop::<Box<S>>(move _7) -> [return: bb4, unwind: bb6];
- }
-
- bb4: {
- StorageDead(_7);
- StorageDead(_6);
- _0 = const ();
- drop(_1) -> [return: bb5, unwind continue];
- }
-
- bb5: {
- StorageDead(_1);
- return;
- }
-
- bb6 (cleanup): {
- drop(_7) -> [return: bb7, unwind terminate(cleanup)];
- }
-
- bb7 (cleanup): {
- drop(_1) -> [return: bb9, unwind terminate(cleanup)];
- }
-
- bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate(cleanup)];
- }
-
- bb9 (cleanup): {
- resume;
- }
-}
diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.diff b/tests/mir-opt/box_expr.main.ElaborateDrops.diff
new file mode 100644
index 000000000..88b12f19e
--- /dev/null
+++ b/tests/mir-opt/box_expr.main.ElaborateDrops.diff
@@ -0,0 +1,89 @@
+- // MIR for `main` before ElaborateDrops
++ // MIR for `main` after ElaborateDrops
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::boxed::Box<S>;
+ let mut _2: usize;
+ let mut _3: usize;
+ let mut _4: *mut u8;
+ let mut _5: std::boxed::Box<S>;
+ let _6: ();
+ let mut _7: std::boxed::Box<S>;
++ let mut _8: &mut std::boxed::Box<S>;
++ let mut _9: ();
+ scope 1 {
+ debug x => _1;
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _2 = SizeOf(S);
+ _3 = AlignOf(S);
+ _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageLive(_5);
+ _5 = ShallowInitBox(move _4, S);
+ (*_5) = S::new() -> [return: bb2, unwind: bb8];
+ }
+
+ bb2: {
+ _1 = move _5;
+- drop(_5) -> [return: bb3, unwind continue];
++ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = move _1;
+ _6 = std::mem::drop::<Box<S>>(move _7) -> [return: bb4, unwind: bb6];
+ }
+
+ bb4: {
+ StorageDead(_7);
+ StorageDead(_6);
+ _0 = const ();
+- drop(_1) -> [return: bb5, unwind continue];
++ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_1);
+ return;
+ }
+
+ bb6 (cleanup): {
+- drop(_7) -> [return: bb7, unwind terminate(cleanup)];
++ goto -> bb7;
+ }
+
+ bb7 (cleanup): {
+- drop(_1) -> [return: bb9, unwind terminate(cleanup)];
++ goto -> bb9;
+ }
+
+ bb8 (cleanup): {
+- drop(_5) -> [return: bb9, unwind terminate(cleanup)];
++ goto -> bb11;
+ }
+
+ bb9 (cleanup): {
+ resume;
++ }
++
++ bb10 (cleanup): {
++ _8 = &mut _5;
++ _9 = <Box<S> as Drop>::drop(move _8) -> [return: bb9, unwind terminate(cleanup)];
++ }
++
++ bb11 (cleanup): {
++ goto -> bb10;
+ }
+ }
+
diff --git a/tests/mir-opt/box_expr.rs b/tests/mir-opt/box_expr.rs
index 780420bda..0421e232a 100644
--- a/tests/mir-opt/box_expr.rs
+++ b/tests/mir-opt/box_expr.rs
@@ -1,9 +1,22 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// unit-test: ElaborateDrops
+// needs-unwind
#![feature(rustc_attrs, stmt_expr_attributes)]
-// EMIT_MIR box_expr.main.ElaborateDrops.before.mir
+// EMIT_MIR box_expr.main.ElaborateDrops.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: [[box:_.*]] = ShallowInitBox(
+ // CHECK: [[ptr:_.*]] = ((([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>).0: *const S);
+ // CHECK: (*[[ptr]]) = S::new() -> [return: [[ret:bb.*]], unwind: [[unwind:bb.*]]];
+ // CHECK: [[ret]]: {
+ // CHECK: [[box2:_.*]] = move [[box]];
+ // CHECK: [[box3:_.*]] = move [[box2]];
+ // CHECK: std::mem::drop::<Box<S>>(move [[box3]])
+ // CHECK: [[unwind]] (cleanup): {
+ // CHECK: [[boxref:_.*]] = &mut [[box]];
+ // CHECK: <Box<S> as Drop>::drop(move [[boxref]])
+
let x = #[rustc_box]
Box::new(S::new());
drop(x);
diff --git a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir
index 98b1befc3..8b22743d2 100644
--- a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
+++ b/tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir
@@ -1,5 +1,5 @@
-// MIR for `a::{closure#0}` 0 generator_resume
-/* generator_layout = GeneratorLayout {
+// MIR for `a::{closure#0}` 0 coroutine_resume
+/* coroutine_layout = CoroutineLayout {
field_tys: {},
variant_fields: {
Unresumed(0): [],
@@ -9,7 +9,7 @@
storage_conflicts: BitMatrix(0x0) {},
} */
-fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>, _2: &mut Context<'_>) -> Poll<()> {
+fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>, _2: &mut Context<'_>) -> Poll<()> {
debug _task_context => _4;
let mut _0: std::task::Poll<()>;
let mut _3: ();
@@ -17,7 +17,7 @@ fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>
let mut _5: u32;
bb0: {
- _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16})));
+ _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16})));
switchInt(move _5) -> [0: bb1, 1: bb4, otherwise: bb5];
}
@@ -29,7 +29,7 @@ fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>
bb2: {
_0 = Poll::<()>::Ready(move _3);
- discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))) = 1;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}))) = 1;
return;
}
diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir
index 15330b13c..396e4a378 100644
--- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
+++ b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir
@@ -1,38 +1,38 @@
-// MIR for `b::{closure#0}` 0 generator_resume
-/* generator_layout = GeneratorLayout {
+// MIR for `b::{closure#0}` 0 coroutine_resume
+/* coroutine_layout = CoroutineLayout {
field_tys: {
- _0: GeneratorSavedTy {
- ty: Generator(
+ _0: CoroutineSavedTy {
+ ty: Coroutine(
DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
[
std::future::ResumeTy,
(),
(),
- GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
+ CoroutineWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
(),
],
Static,
),
source_info: SourceInfo {
- span: $DIR/async_await.rs:15:9: 15:14 (#8),
+ span: $DIR/async_await.rs:16:9: 16:14 (#8),
scope: scope[0],
},
ignore_for_traits: false,
},
- _1: GeneratorSavedTy {
- ty: Generator(
+ _1: CoroutineSavedTy {
+ ty: Coroutine(
DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
[
std::future::ResumeTy,
(),
(),
- GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
+ CoroutineWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
(),
],
Static,
),
source_info: SourceInfo {
- span: $DIR/async_await.rs:16:9: 16:14 (#10),
+ span: $DIR/async_await.rs:17:9: 17:14 (#10),
scope: scope[0],
},
ignore_for_traits: false,
@@ -51,19 +51,19 @@
},
} */
-fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, _2: &mut Context<'_>) -> Poll<()> {
+fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>, _2: &mut Context<'_>) -> Poll<()> {
debug _task_context => _38;
let mut _0: std::task::Poll<()>;
let _3: ();
- let mut _4: {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _5: {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _6: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _4: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _5: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _6: {async fn body@$DIR/async_await.rs:12:14: 12:16};
let mut _7: ();
let _8: ();
let mut _9: std::task::Poll<()>;
- let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
- let mut _11: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _12: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>;
+ let mut _11: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _12: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
let mut _13: &mut std::task::Context<'_>;
let mut _14: &mut std::task::Context<'_>;
let mut _15: &mut std::task::Context<'_>;
@@ -71,14 +71,14 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
let mut _18: !;
let mut _19: &mut std::task::Context<'_>;
let mut _20: ();
- let mut _21: {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _22: {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _23: {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _21: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _22: {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _23: {async fn body@$DIR/async_await.rs:12:14: 12:16};
let _24: ();
let mut _25: std::task::Poll<()>;
- let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
- let mut _27: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _28: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
+ let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>;
+ let mut _27: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
+ let mut _28: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16};
let mut _29: &mut std::task::Context<'_>;
let mut _30: &mut std::task::Context<'_>;
let mut _31: &mut std::task::Context<'_>;
@@ -90,7 +90,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
let mut _38: &mut std::task::Context<'_>;
let mut _39: u32;
scope 1 {
- debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
+ debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
let _17: ();
scope 2 {
}
@@ -99,7 +99,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
}
}
scope 4 {
- debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
+ debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
let _33: ();
scope 5 {
}
@@ -109,7 +109,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
}
bb0: {
- _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})));
+ _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})));
switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30];
}
@@ -122,13 +122,14 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
}
bb2: {
- _4 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
+ _4 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageDead(_5);
+ PlaceMention(_4);
nop;
- (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _4;
+ (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _4;
goto -> bb4;
}
@@ -138,9 +139,9 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
StorageLive(_10);
StorageLive(_11);
StorageLive(_12);
- _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
+ _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
_11 = &mut (*_12);
- _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
+ _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
}
bb5: {
@@ -156,12 +157,13 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
bb6: {
_13 = &mut (*_14);
StorageDead(_15);
- _9 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
+ _9 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
}
bb7: {
StorageDead(_13);
StorageDead(_10);
+ PlaceMention(_9);
_16 = discriminant(_9);
switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9];
}
@@ -176,7 +178,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
StorageLive(_20);
_20 = ();
_0 = Poll::<()>::Pending;
- discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 3;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 3;
return;
}
@@ -193,7 +195,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb12, unwind unreachable];
+ drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb12, unwind unreachable];
}
bb11: {
@@ -218,13 +220,14 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
}
bb14: {
- _21 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
+ _21 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
}
bb15: {
StorageDead(_22);
+ PlaceMention(_21);
nop;
- (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _21;
+ (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _21;
goto -> bb16;
}
@@ -234,9 +237,9 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
StorageLive(_26);
StorageLive(_27);
StorageLive(_28);
- _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
+ _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16});
_27 = &mut (*_28);
- _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
+ _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
}
bb17: {
@@ -252,12 +255,13 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
bb18: {
_29 = &mut (*_30);
StorageDead(_31);
- _25 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
+ _25 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
}
bb19: {
StorageDead(_29);
StorageDead(_26);
+ PlaceMention(_25);
_32 = discriminant(_25);
switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9];
}
@@ -272,7 +276,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
StorageLive(_36);
_36 = ();
_0 = Poll::<()>::Pending;
- discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 4;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 4;
return;
}
@@ -285,7 +289,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
StorageDead(_28);
StorageDead(_25);
StorageDead(_24);
- drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb23, unwind unreachable];
+ drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb23, unwind unreachable];
}
bb22: {
@@ -308,7 +312,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>,
bb25: {
_0 = Poll::<()>::Ready(move _37);
- discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 1;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 1;
return;
}
diff --git a/tests/mir-opt/building/async_await.rs b/tests/mir-opt/building/async_await.rs
index 0b991e3b8..abdeafef6 100644
--- a/tests/mir-opt/building/async_await.rs
+++ b/tests/mir-opt/building/async_await.rs
@@ -1,4 +1,5 @@
-// This test makes sure that the generator MIR pass eliminates all calls to
+// skip-filecheck
+// This test makes sure that the coroutine MIR pass eliminates all calls to
// `get_context`, and that the MIR argument type for an async fn and all locals
// related to `yield` are `&mut Context`, and its return type is `Poll`.
@@ -7,10 +8,10 @@
#![crate_type = "lib"]
-// EMIT_MIR async_await.a-{closure#0}.generator_resume.0.mir
+// EMIT_MIR async_await.a-{closure#0}.coroutine_resume.0.mir
async fn a() {}
-// EMIT_MIR async_await.b-{closure#0}.generator_resume.0.mir
+// EMIT_MIR async_await.b-{closure#0}.coroutine_resume.0.mir
pub async fn b() {
a().await;
a().await
diff --git a/tests/mir-opt/building/custom/aggregate_exprs.rs b/tests/mir-opt/building/custom/aggregate_exprs.rs
index 554c9c03b..d58188624 100644
--- a/tests/mir-opt/building/custom/aggregate_exprs.rs
+++ b/tests/mir-opt/building/custom/aggregate_exprs.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/arbitrary_let.rs b/tests/mir-opt/building/custom/arbitrary_let.rs
index 776df3151..f8ee8504e 100644
--- a/tests/mir-opt/building/custom/arbitrary_let.rs
+++ b/tests/mir-opt/building/custom/arbitrary_let.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/arrays.rs b/tests/mir-opt/building/custom/arrays.rs
index 8e0a1fd7a..fe6abc546 100644
--- a/tests/mir-opt/building/custom/arrays.rs
+++ b/tests/mir-opt/building/custom/arrays.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics, inline_const)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/as_cast.rs b/tests/mir-opt/building/custom/as_cast.rs
index b4b5ac6aa..92aea64db 100644
--- a/tests/mir-opt/building/custom/as_cast.rs
+++ b/tests/mir-opt/building/custom/as_cast.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/composite_return.rs b/tests/mir-opt/building/custom/composite_return.rs
index 701d6b1ab..33c903fa0 100644
--- a/tests/mir-opt/building/custom/composite_return.rs
+++ b/tests/mir-opt/building/custom/composite_return.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/consts.rs b/tests/mir-opt/building/custom/consts.rs
index 16d10eb59..42abf5019 100644
--- a/tests/mir-opt/building/custom/consts.rs
+++ b/tests/mir-opt/building/custom/consts.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics, inline_const)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/consts.statics.built.after.mir b/tests/mir-opt/building/custom/consts.statics.built.after.mir
index ea394c5b7..a5cb6ff99 100644
--- a/tests/mir-opt/building/custom/consts.statics.built.after.mir
+++ b/tests/mir-opt/building/custom/consts.statics.built.after.mir
@@ -6,16 +6,16 @@ fn statics() -> () {
let mut _2: *mut i32;
bb0: {
- _1 = const {alloc1: &i32};
- _2 = const {alloc2: *mut i32};
+ _1 = const {ALLOC0: &i32};
+ _2 = const {ALLOC1: *mut i32};
return;
}
}
-alloc2 (static: T, size: 4, align: 4) {
+ALLOC1 (static: T, size: 4, align: 4) {
0a 0a 0a 0a │ ....
}
-alloc1 (static: S, size: 4, align: 4) {
+ALLOC0 (static: S, size: 4, align: 4) {
05 05 05 05 │ ....
}
diff --git a/tests/mir-opt/building/custom/debuginfo.rs b/tests/mir-opt/building/custom/debuginfo.rs
index bfdc3d3ea..3671a1ef0 100644
--- a/tests/mir-opt/building/custom/debuginfo.rs
+++ b/tests/mir-opt/building/custom/debuginfo.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/enums.rs b/tests/mir-opt/building/custom/enums.rs
index eca5b792e..6aab1503c 100644
--- a/tests/mir-opt/building/custom/enums.rs
+++ b/tests/mir-opt/building/custom/enums.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/operators.rs b/tests/mir-opt/building/custom/operators.rs
index db7a48317..91bdf2b91 100644
--- a/tests/mir-opt/building/custom/operators.rs
+++ b/tests/mir-opt/building/custom/operators.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: --crate-type=lib
#![feature(custom_mir, core_intrinsics, inline_const)]
use std::intrinsics::mir::*;
diff --git a/tests/mir-opt/building/custom/projections.rs b/tests/mir-opt/building/custom/projections.rs
index 3c155deae..ac23fe590 100644
--- a/tests/mir-opt/building/custom/projections.rs
+++ b/tests/mir-opt/building/custom/projections.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/references.rs b/tests/mir-opt/building/custom/references.rs
index f87f6664c..04afe6e64 100644
--- a/tests/mir-opt/building/custom/references.rs
+++ b/tests/mir-opt/building/custom/references.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/simple_assign.rs b/tests/mir-opt/building/custom/simple_assign.rs
index db041aab2..844227229 100644
--- a/tests/mir-opt/building/custom/simple_assign.rs
+++ b/tests/mir-opt/building/custom/simple_assign.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/custom/terminators.rs b/tests/mir-opt/building/custom/terminators.rs
index 123118f65..9e442e0f9 100644
--- a/tests/mir-opt/building/custom/terminators.rs
+++ b/tests/mir-opt/building/custom/terminators.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
diff --git a/tests/mir-opt/building/enum_cast.rs b/tests/mir-opt/building/enum_cast.rs
index 431b5c708..df8e397c8 100644
--- a/tests/mir-opt/building/enum_cast.rs
+++ b/tests/mir-opt/building/enum_cast.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR enum_cast.foo.built.after.mir
// EMIT_MIR enum_cast.bar.built.after.mir
// EMIT_MIR enum_cast.boo.built.after.mir
diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir
index 915c5ef11..57f8cca9a 100644
--- a/tests/mir-opt/building/issue_101867.main.built.after.mir
+++ b/tests/mir-opt/building/issue_101867.main.built.after.mir
@@ -1,8 +1,8 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option<u8>
-| 1: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option<u8>
+| 0: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option<u8>
+| 1: user_ty: Canonical { value: Ty(std::option::Option<u8>), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option<u8>
|
fn main() -> () {
let mut _0: ();
@@ -25,7 +25,7 @@ fn main() -> () {
FakeRead(ForLet(None), _1);
AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] });
StorageLive(_5);
- FakeRead(ForMatchedPlace(None), _1);
+ PlaceMention(_1);
_6 = discriminant(_1);
switchInt(move _6) -> [1: bb4, otherwise: bb3];
}
diff --git a/tests/mir-opt/building/issue_101867.rs b/tests/mir-opt/building/issue_101867.rs
index a32d8cb37..f8a531e89 100644
--- a/tests/mir-opt/building/issue_101867.rs
+++ b/tests/mir-opt/building/issue_101867.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR issue_101867.main.built.after.mir
fn main() {
let x: Option<u8> = Some(1);
diff --git a/tests/mir-opt/building/issue_110508.rs b/tests/mir-opt/building/issue_110508.rs
index bcbb1c298..e597cd5d0 100644
--- a/tests/mir-opt/building/issue_110508.rs
+++ b/tests/mir-opt/building/issue_110508.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR issue_110508.{impl#0}-BAR.built.after.mir
// EMIT_MIR issue_110508.{impl#0}-SELF_BAR.built.after.mir
diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir
index 5fc6d911a..c3d28fae5 100644
--- a/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir
+++ b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/issue_110508.rs:8:1: 8:9>::BAR` after built
+// MIR for `<impl at $DIR/issue_110508.rs:9:1: 9:9>::BAR` after built
-const <impl at $DIR/issue_110508.rs:8:1: 8:9>::BAR: Foo = {
+const <impl at $DIR/issue_110508.rs:9:1: 9:9>::BAR: Foo = {
let mut _0: Foo;
let mut _1: ();
diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir
index 1a8925599..177518c30 100644
--- a/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir
+++ b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/issue_110508.rs:8:1: 8:9>::SELF_BAR` after built
+// MIR for `<impl at $DIR/issue_110508.rs:9:1: 9:9>::SELF_BAR` after built
-const <impl at $DIR/issue_110508.rs:8:1: 8:9>::SELF_BAR: Foo = {
+const <impl at $DIR/issue_110508.rs:9:1: 9:9>::SELF_BAR: Foo = {
let mut _0: Foo;
let mut _1: ();
diff --git a/tests/mir-opt/building/issue_49232.main.built.after.mir b/tests/mir-opt/building/issue_49232.main.built.after.mir
index f809132bc..ac50b3889 100644
--- a/tests/mir-opt/building/issue_49232.main.built.after.mir
+++ b/tests/mir-opt/building/issue_49232.main.built.after.mir
@@ -24,7 +24,7 @@ fn main() -> () {
StorageLive(_2);
StorageLive(_3);
_3 = const true;
- FakeRead(ForMatchedPlace(None), _3);
+ PlaceMention(_3);
switchInt(_3) -> [0: bb3, otherwise: bb4];
}
diff --git a/tests/mir-opt/building/issue_49232.rs b/tests/mir-opt/building/issue_49232.rs
index 7e9f0de81..ac06e0277 100644
--- a/tests/mir-opt/building/issue_49232.rs
+++ b/tests/mir-opt/building/issue_49232.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// We must mark a variable whose initialization fails due to an
// abort statement as StorageDead.
diff --git a/tests/mir-opt/building/logical_or_in_conditional.rs b/tests/mir-opt/building/logical_or_in_conditional.rs
index ae159f7e1..00e666ed9 100644
--- a/tests/mir-opt/building/logical_or_in_conditional.rs
+++ b/tests/mir-opt/building/logical_or_in_conditional.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z validate-mir
#![feature(let_chains)]
struct Droppy(u8);
diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
index 096aaec4a..7407e7a8b 100644
--- a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
+++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
@@ -23,7 +23,7 @@ fn test_complex() -> () {
}
bb1: {
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
_3 = discriminant(_2);
switchInt(move _3) -> [0: bb2, otherwise: bb3];
}
@@ -151,7 +151,7 @@ fn test_complex() -> () {
}
bb25: {
- FakeRead(ForMatchedPlace(None), _12);
+ PlaceMention(_12);
_13 = discriminant(_12);
switchInt(move _13) -> [1: bb27, otherwise: bb26];
}
diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir
index 9f64a23f3..b99b0b995 100644
--- a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir
+++ b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir
@@ -26,7 +26,7 @@ fn full_tested_match() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = Option::<i32>::Some(const 42_i32);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
_3 = discriminant(_2);
switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4];
}
@@ -45,6 +45,7 @@ fn full_tested_match() -> () {
}
bb4: {
+ FakeRead(ForMatchedPlace(None), _2);
unreachable;
}
diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir
index 89f9bafb6..d1d86b55d 100644
--- a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir
+++ b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir
@@ -26,7 +26,7 @@ fn full_tested_match2() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = Option::<i32>::Some(const 42_i32);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
_3 = discriminant(_2);
switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4];
}
@@ -51,6 +51,7 @@ fn full_tested_match2() -> () {
}
bb4: {
+ FakeRead(ForMatchedPlace(None), _2);
unreachable;
}
diff --git a/tests/mir-opt/building/match_false_edges.main.built.after.mir b/tests/mir-opt/building/match_false_edges.main.built.after.mir
index 9a2d89c48..1d4fe67f3 100644
--- a/tests/mir-opt/building/match_false_edges.main.built.after.mir
+++ b/tests/mir-opt/building/match_false_edges.main.built.after.mir
@@ -37,7 +37,7 @@ fn main() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = Option::<i32>::Some(const 1_i32);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
_4 = discriminant(_2);
switchInt(move _4) -> [1: bb2, otherwise: bb1];
}
diff --git a/tests/mir-opt/building/match_false_edges.rs b/tests/mir-opt/building/match_false_edges.rs
index ddfcc1493..839eda40c 100644
--- a/tests/mir-opt/building/match_false_edges.rs
+++ b/tests/mir-opt/building/match_false_edges.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
fn guard() -> bool {
false
}
diff --git a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir
index fed5e68c3..e07c2b6fa 100644
--- a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir
+++ b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir
@@ -1,10 +1,10 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test
-| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test
-| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test
-| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test
+| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test
+| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test
+| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test
+| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test
|
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/building/receiver_ptr_mutability.rs b/tests/mir-opt/building/receiver_ptr_mutability.rs
index 668530968..4bb3b4cad 100644
--- a/tests/mir-opt/building/receiver_ptr_mutability.rs
+++ b/tests/mir-opt/building/receiver_ptr_mutability.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR receiver_ptr_mutability.main.built.after.mir
#![feature(arbitrary_self_types)]
diff --git a/tests/mir-opt/building/shifts.rs b/tests/mir-opt/building/shifts.rs
index 4b63a00a3..c94a142d3 100644
--- a/tests/mir-opt/building/shifts.rs
+++ b/tests/mir-opt/building/shifts.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -C debug-assertions=yes
// EMIT_MIR shifts.shift_signed.built.after.mir
diff --git a/tests/mir-opt/building/simple_match.match_bool.built.after.mir b/tests/mir-opt/building/simple_match.match_bool.built.after.mir
index c89ea2b6c..06de4c510 100644
--- a/tests/mir-opt/building/simple_match.match_bool.built.after.mir
+++ b/tests/mir-opt/building/simple_match.match_bool.built.after.mir
@@ -5,7 +5,7 @@ fn match_bool(_1: bool) -> usize {
let mut _0: usize;
bb0: {
- FakeRead(ForMatchedPlace(None), _1);
+ PlaceMention(_1);
switchInt(_1) -> [0: bb2, otherwise: bb1];
}
diff --git a/tests/mir-opt/building/simple_match.rs b/tests/mir-opt/building/simple_match.rs
index 0ef97dde6..4f0a3046a 100644
--- a/tests/mir-opt/building/simple_match.rs
+++ b/tests/mir-opt/building/simple_match.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that we don't generate unnecessarily large MIR for very simple matches
diff --git a/tests/mir-opt/building/storage_live_dead_in_statics.rs b/tests/mir-opt/building/storage_live_dead_in_statics.rs
index 79f709148..1f5692118 100644
--- a/tests/mir-opt/building/storage_live_dead_in_statics.rs
+++ b/tests/mir-opt/building/storage_live_dead_in_statics.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Check that when we compile the static `XXX` into MIR, we do not
// generate `StorageStart` or `StorageEnd` statements.
diff --git a/tests/mir-opt/building/uniform_array_move_out.rs b/tests/mir-opt/building/uniform_array_move_out.rs
index 4ba107c87..068289161 100644
--- a/tests/mir-opt/building/uniform_array_move_out.rs
+++ b/tests/mir-opt/building/uniform_array_move_out.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(stmt_expr_attributes, rustc_attrs)]
// EMIT_MIR uniform_array_move_out.move_out_from_end.built.after.mir
diff --git a/tests/mir-opt/building/while_storage.rs b/tests/mir-opt/building/while_storage.rs
new file mode 100644
index 000000000..b06c1639c
--- /dev/null
+++ b/tests/mir-opt/building/while_storage.rs
@@ -0,0 +1,60 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// Test that we correctly generate StorageDead statements for while loop
+// conditions on all branches
+// compile-flags: -Zmir-opt-level=0
+
+fn get_bool(c: bool) -> bool {
+ c
+}
+
+// EMIT_MIR while_storage.while_loop.PreCodegen.after.mir
+fn while_loop(c: bool) {
+ // CHECK-LABEL: fn while_loop(
+ // CHECK: bb0: {
+ // CHECK-NEXT: goto -> bb1;
+ // CHECK: bb1: {
+ // CHECK-NEXT: StorageLive(_3);
+ // CHECK-NEXT: StorageLive(_2);
+ // CHECK-NEXT: _2 = _1;
+ // CHECK-NEXT: _3 = get_bool(move _2) -> [return: bb2, unwind
+ // CHECK: bb2: {
+ // CHECK-NEXT: switchInt(move _3) -> [0: bb3, otherwise: bb4];
+ // CHECK: bb3: {
+ // CHECK-NEXT: StorageDead(_2);
+ // CHECK-NEXT: StorageLive(_9);
+ // CHECK-NEXT: _0 = const ();
+ // CHECK-NEXT: StorageDead(_9);
+ // CHECK-NEXT: goto -> bb8;
+ // CHECK: bb4: {
+ // CHECK-NEXT: StorageDead(_2);
+ // CHECK-NEXT: StorageLive(_5);
+ // CHECK-NEXT: StorageLive(_4);
+ // CHECK-NEXT: _4 = _1;
+ // CHECK-NEXT: _5 = get_bool(move _4) -> [return: bb5, unwind
+ // CHECK: bb5: {
+ // CHECK-NEXT: switchInt(move _5) -> [0: bb6, otherwise: bb7];
+ // CHECK: bb6: {
+ // CHECK-NEXT: StorageDead(_4);
+ // CHECK-NEXT: _6 = const ();
+ // CHECK-NEXT: StorageDead(_5);
+ // CHECK-NEXT: StorageDead(_3);
+ // CHECK-NEXT: goto -> bb1;
+ // CHECK: bb7: {
+ // CHECK-NEXT: StorageDead(_4);
+ // CHECK-NEXT: _0 = const ();
+ // CHECK-NEXT: StorageDead(_5);
+ // CHECK-NEXT: goto -> bb8;
+ // CHECK: bb8: {
+ // CHECK-NEXT: StorageDead(_3);
+ // CHECK-NEXT: return;
+
+ while get_bool(c) {
+ if get_bool(c) {
+ break;
+ }
+ }
+}
+
+fn main() {
+ while_loop(false);
+}
diff --git a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir
new file mode 100644
index 000000000..26c82edf2
--- /dev/null
+++ b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir
@@ -0,0 +1,70 @@
+// MIR for `while_loop` after PreCodegen
+
+fn while_loop(_1: bool) -> () {
+ debug c => _1;
+ let mut _0: ();
+ let mut _2: bool;
+ let mut _3: bool;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: ();
+ let mut _7: !;
+ let mut _8: !;
+ let _9: ();
+ let mut _10: !;
+
+ bb0: {
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_3);
+ StorageLive(_2);
+ _2 = _1;
+ _3 = get_bool(move _2) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ switchInt(move _3) -> [0: bb3, otherwise: bb4];
+ }
+
+ bb3: {
+ StorageDead(_2);
+ StorageLive(_9);
+ _0 = const ();
+ StorageDead(_9);
+ goto -> bb8;
+ }
+
+ bb4: {
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_4);
+ _4 = _1;
+ _5 = get_bool(move _4) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ switchInt(move _5) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb6: {
+ StorageDead(_4);
+ _6 = const ();
+ StorageDead(_5);
+ StorageDead(_3);
+ goto -> bb1;
+ }
+
+ bb7: {
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_5);
+ goto -> bb8;
+ }
+
+ bb8: {
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir
new file mode 100644
index 000000000..1bb720748
--- /dev/null
+++ b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir
@@ -0,0 +1,70 @@
+// MIR for `while_loop` after PreCodegen
+
+fn while_loop(_1: bool) -> () {
+ debug c => _1;
+ let mut _0: ();
+ let mut _2: bool;
+ let mut _3: bool;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: ();
+ let mut _7: !;
+ let mut _8: !;
+ let _9: ();
+ let mut _10: !;
+
+ bb0: {
+ goto -> bb1;
+ }
+
+ bb1: {
+ StorageLive(_3);
+ StorageLive(_2);
+ _2 = _1;
+ _3 = get_bool(move _2) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ switchInt(move _3) -> [0: bb3, otherwise: bb4];
+ }
+
+ bb3: {
+ StorageDead(_2);
+ StorageLive(_9);
+ _0 = const ();
+ StorageDead(_9);
+ goto -> bb8;
+ }
+
+ bb4: {
+ StorageDead(_2);
+ StorageLive(_5);
+ StorageLive(_4);
+ _4 = _1;
+ _5 = get_bool(move _4) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ switchInt(move _5) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb6: {
+ StorageDead(_4);
+ _6 = const ();
+ StorageDead(_5);
+ StorageDead(_3);
+ goto -> bb1;
+ }
+
+ bb7: {
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_5);
+ goto -> bb8;
+ }
+
+ bb8: {
+ StorageDead(_3);
+ return;
+ }
+}
diff --git a/tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
index 9b17b4b63..09a65e6e6 100644
--- a/tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
+++ b/tests/mir-opt/byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
@@ -23,6 +23,6 @@ fn main() -> () {
}
}
-alloc1 (size: 3, align: 1) {
+ALLOC0 (size: 3, align: 1) {
66 6f 6f │ foo
}
diff --git a/tests/mir-opt/byte_slice.rs b/tests/mir-opt/byte_slice.rs
index 48e9c48c1..813d9ccfd 100644
--- a/tests/mir-opt/byte_slice.rs
+++ b/tests/mir-opt/byte_slice.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=0
// EMIT_MIR byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
diff --git a/tests/mir-opt/casts.redundant.PreCodegen.after.mir b/tests/mir-opt/casts.redundant.PreCodegen.after.mir
deleted file mode 100644
index 2084f44f2..000000000
--- a/tests/mir-opt/casts.redundant.PreCodegen.after.mir
+++ /dev/null
@@ -1,14 +0,0 @@
-// MIR for `redundant` after PreCodegen
-
-fn redundant(_1: *const &u8) -> *const &u8 {
- debug x => _1;
- let mut _0: *const &u8;
- scope 1 (inlined generic_cast::<&u8, &u8>) {
- debug x => _1;
- }
-
- bb0: {
- _0 = _1;
- return;
- }
-}
diff --git a/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir b/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir
deleted file mode 100644
index f0c35fe97..000000000
--- a/tests/mir-opt/casts.roundtrip.PreCodegen.after.mir
+++ /dev/null
@@ -1,15 +0,0 @@
-// MIR for `roundtrip` after PreCodegen
-
-fn roundtrip(_1: *const u8) -> *const u8 {
- debug x => _1;
- let mut _0: *const u8;
- let mut _2: *mut u8;
-
- bb0: {
- StorageLive(_2);
- _2 = _1 as *mut u8 (PtrToPtr);
- _0 = move _2 as *const u8 (PointerCoercion(MutToConstPointer));
- StorageDead(_2);
- return;
- }
-}
diff --git a/tests/mir-opt/casts.rs b/tests/mir-opt/casts.rs
deleted file mode 100644
index 413b0e09d..000000000
--- a/tests/mir-opt/casts.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![crate_type = "lib"]
-
-// EMIT_MIR casts.redundant.InstSimplify.diff
-// EMIT_MIR casts.redundant.PreCodegen.after.mir
-pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 {
- generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8
-}
-
-#[inline]
-fn generic_cast<T, U>(x: *const T) -> *const U {
- x as *const U
-}
-
-// EMIT_MIR casts.roundtrip.PreCodegen.after.mir
-pub fn roundtrip(x: *const u8) -> *const u8 {
- x as *mut u8 as *const u8
-}
diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
index 8c8e69595..f20bfef8c 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&[(Option<i32>, &[&str])]};
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,43 +17,43 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 8, align: 4) {
- ╾─alloc19─╼ 03 00 00 00 │ ╾──╼....
+ALLOC9 (static: FOO, size: 8, align: 4) {
+ ╾ALLOC0╼ 03 00 00 00 │ ╾──╼....
}
-alloc19 (size: 48, align: 4) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc6──╼ 00 00 00 00 │ ....░░░░╾──╼....
- 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc10─╼ 02 00 00 00 │ ....░░░░╾──╼....
- 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc15─╼ 03 00 00 00 │ ....*...╾──╼....
+ALLOC0 (size: 48, align: 4) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC1╼ 00 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 00 00 __ __ __ __ ╾ALLOC2╼ 02 00 00 00 │ ....░░░░╾──╼....
+ 0x20 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3╼ 03 00 00 00 │ ....*...╾──╼....
}
-alloc6 (size: 0, align: 4) {}
+ALLOC1 (size: 0, align: 4) {}
-alloc10 (size: 16, align: 4) {
- ╾─alloc9──╼ 03 00 00 00 ╾─alloc11─╼ 03 00 00 00 │ ╾──╼....╾──╼....
+ALLOC2 (size: 16, align: 4) {
+ ╾ALLOC4╼ 03 00 00 00 ╾ALLOC5╼ 03 00 00 00 │ ╾──╼....╾──╼....
}
-alloc9 (size: 3, align: 1) {
+ALLOC4 (size: 3, align: 1) {
66 6f 6f │ foo
}
-alloc11 (size: 3, align: 1) {
+ALLOC5 (size: 3, align: 1) {
62 61 72 │ bar
}
-alloc15 (size: 24, align: 4) {
- 0x00 │ ╾─alloc14─╼ 03 00 00 00 ╾─alloc16─╼ 03 00 00 00 │ ╾──╼....╾──╼....
- 0x10 │ ╾─alloc17─╼ 04 00 00 00 │ ╾──╼....
+ALLOC3 (size: 24, align: 4) {
+ 0x00 │ ╾ALLOC6╼ 03 00 00 00 ╾ALLOC7╼ 03 00 00 00 │ ╾──╼....╾──╼....
+ 0x10 │ ╾ALLOC8╼ 04 00 00 00 │ ╾──╼....
}
-alloc14 (size: 3, align: 1) {
+ALLOC6 (size: 3, align: 1) {
6d 65 68 │ meh
}
-alloc16 (size: 3, align: 1) {
+ALLOC7 (size: 3, align: 1) {
6d 6f 70 │ mop
}
-alloc17 (size: 4, align: 1) {
+ALLOC8 (size: 4, align: 1) {
6d c3 b6 70 │ m..p
}
diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
index e22547032..263cae2f3 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&[(Option<i32>, &[&str])]};
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,47 +17,47 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 16, align: 8) {
- ╾───────alloc19───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC9 (static: FOO, size: 16, align: 8) {
+ ╾ALLOC0╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc19 (size: 72, align: 8) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc6────────╼ │ ....░░░░╾──────╼
+ALLOC0 (size: 72, align: 8) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC1╼ │ ....░░░░╾──────╼
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
- 0x20 │ ╾───────alloc10───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc15───────╼ │ ....*...╾──────╼
+ 0x20 │ ╾ALLOC2╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x30 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3╼ │ ....*...╾──────╼
0x40 │ 03 00 00 00 00 00 00 00 │ ........
}
-alloc6 (size: 0, align: 8) {}
+ALLOC1 (size: 0, align: 8) {}
-alloc10 (size: 32, align: 8) {
- 0x00 │ ╾───────alloc9────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x10 │ ╾───────alloc11───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC2 (size: 32, align: 8) {
+ 0x00 │ ╾ALLOC4╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x10 │ ╾ALLOC5╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc9 (size: 3, align: 1) {
+ALLOC4 (size: 3, align: 1) {
66 6f 6f │ foo
}
-alloc11 (size: 3, align: 1) {
+ALLOC5 (size: 3, align: 1) {
62 61 72 │ bar
}
-alloc15 (size: 48, align: 8) {
- 0x00 │ ╾───────alloc14───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x10 │ ╾───────alloc16───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x20 │ ╾───────alloc17───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC3 (size: 48, align: 8) {
+ 0x00 │ ╾ALLOC6╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x10 │ ╾ALLOC7╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x20 │ ╾ALLOC8╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc14 (size: 3, align: 1) {
+ALLOC6 (size: 3, align: 1) {
6d 65 68 │ meh
}
-alloc16 (size: 3, align: 1) {
+ALLOC7 (size: 3, align: 1) {
6d 6f 70 │ mop
}
-alloc17 (size: 4, align: 1) {
+ALLOC8 (size: 4, align: 1) {
6d c3 b6 70 │ m..p
}
diff --git a/tests/mir-opt/const_allocation.rs b/tests/mir-opt/const_allocation.rs
index 91a2455eb..577c61aeb 100644
--- a/tests/mir-opt/const_allocation.rs
+++ b/tests/mir-opt/const_allocation.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
index c5f6902b4..713abb264 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&[(Option<i32>, &[&u8])]};
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,42 +17,42 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 8, align: 4) {
- ╾─alloc23─╼ 03 00 00 00 │ ╾──╼....
+ALLOC9 (static: FOO, size: 8, align: 4) {
+ ╾ALLOC0╼ 03 00 00 00 │ ╾──╼....
}
-alloc23 (size: 48, align: 4) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc10─╼ 00 00 00 00 │ ....░░░░╾──╼....
- 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc15─╼ 02 00 00 00 │ ....░░░░╾──╼....
- 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc21─╼ 03 00 00 00 │ ....*...╾──╼....
+ALLOC0 (size: 48, align: 4) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC1╼ 00 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 00 00 __ __ __ __ ╾ALLOC2╼ 02 00 00 00 │ ....░░░░╾──╼....
+ 0x20 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3╼ 03 00 00 00 │ ....*...╾──╼....
}
-alloc10 (size: 0, align: 4) {}
+ALLOC1 (size: 0, align: 4) {}
-alloc15 (size: 8, align: 4) {
- ╾─alloc13─╼ ╾─alloc14─╼ │ ╾──╼╾──╼
+ALLOC2 (size: 8, align: 4) {
+ ╾ALLOC4╼ ╾ALLOC5╼ │ ╾──╼╾──╼
}
-alloc13 (size: 1, align: 1) {
+ALLOC4 (size: 1, align: 1) {
05 │ .
}
-alloc14 (size: 1, align: 1) {
+ALLOC5 (size: 1, align: 1) {
06 │ .
}
-alloc21 (size: 12, align: 4) {
- ╾─a18+0x3─╼ ╾─alloc19─╼ ╾─a20+0x2─╼ │ ╾──╼╾──╼╾──╼
+ALLOC3 (size: 12, align: 4) {
+ ╾ALLOC6+0x3╼ ╾ALLOC7╼ ╾ALLOC8+0x2╼ │ ╾──╼╾──╼╾──╼
}
-alloc18 (size: 4, align: 1) {
+ALLOC6 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
-alloc19 (size: 1, align: 1) {
+ALLOC7 (size: 1, align: 1) {
2a │ *
}
-alloc20 (size: 4, align: 1) {
+ALLOC8 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
index b95b8c787..e9d61ef12 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&[(Option<i32>, &[&u8])]};
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,45 +17,45 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 16, align: 8) {
- ╾───────alloc23───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC9 (static: FOO, size: 16, align: 8) {
+ ╾ALLOC0╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc23 (size: 72, align: 8) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc10───────╼ │ ....░░░░╾──────╼
+ALLOC0 (size: 72, align: 8) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC1╼ │ ....░░░░╾──────╼
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
- 0x20 │ ╾───────alloc15───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc21───────╼ │ ....*...╾──────╼
+ 0x20 │ ╾ALLOC2╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x30 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3╼ │ ....*...╾──────╼
0x40 │ 03 00 00 00 00 00 00 00 │ ........
}
-alloc10 (size: 0, align: 8) {}
+ALLOC1 (size: 0, align: 8) {}
-alloc15 (size: 16, align: 8) {
- ╾───────alloc13───────╼ ╾───────alloc14───────╼ │ ╾──────╼╾──────╼
+ALLOC2 (size: 16, align: 8) {
+ ╾ALLOC4╼ ╾ALLOC5╼ │ ╾──────╼╾──────╼
}
-alloc13 (size: 1, align: 1) {
+ALLOC4 (size: 1, align: 1) {
05 │ .
}
-alloc14 (size: 1, align: 1) {
+ALLOC5 (size: 1, align: 1) {
06 │ .
}
-alloc21 (size: 24, align: 8) {
- 0x00 │ ╾─────alloc18+0x3─────╼ ╾───────alloc19───────╼ │ ╾──────╼╾──────╼
- 0x10 │ ╾─────alloc20+0x2─────╼ │ ╾──────╼
+ALLOC3 (size: 24, align: 8) {
+ 0x00 │ ╾ALLOC6+0x3╼ ╾ALLOC7╼ │ ╾──────╼╾──────╼
+ 0x10 │ ╾ALLOC8+0x2╼ │ ╾──────╼
}
-alloc18 (size: 4, align: 1) {
+ALLOC6 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
-alloc19 (size: 1, align: 1) {
+ALLOC7 (size: 1, align: 1) {
2a │ *
}
-alloc20 (size: 4, align: 1) {
+ALLOC8 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
diff --git a/tests/mir-opt/const_allocation2.rs b/tests/mir-opt/const_allocation2.rs
index f2870aa47..0fcfaad84 100644
--- a/tests/mir-opt/const_allocation2.rs
+++ b/tests/mir-opt/const_allocation2.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
index e172c7540..c18c067c7 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&Packed};
+ _2 = const {ALLOC4: &&Packed};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,31 +17,31 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 4, align: 4) {
- ╾─alloc12─╼ │ ╾──╼
+ALLOC4 (static: FOO, size: 4, align: 4) {
+ ╾ALLOC0╼ │ ╾──╼
}
-alloc12 (size: 168, align: 1) {
+ALLOC0 (size: 168, align: 1) {
0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................
- 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾─alloc7──╼ │ ............╾──╼
+ 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾ALLOC1╼ │ ............╾──╼
0x20 │ 01 ef cd ab 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x30 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x40 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x50 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x60 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x70 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
- 0x80 │ 00 00 00 00 00 00 00 00 00 00 ╾─alloc9──╼ 00 00 │ ..........╾──╼..
- 0x90 │ ╾a10+0x63─╼ 00 00 00 00 00 00 00 00 00 00 00 00 │ ╾──╼............
+ 0x80 │ 00 00 00 00 00 00 00 00 00 00 ╾ALLOC2╼ 00 00 │ ..........╾──╼..
+ 0x90 │ ╾ALLOC3+0x63╼ 00 00 00 00 00 00 00 00 00 00 00 00 │ ╾──╼............
0xa0 │ 00 00 00 00 00 00 00 00 │ ........
}
-alloc7 (size: 4, align: 4) {
+ALLOC1 (size: 4, align: 4) {
2a 00 00 00 │ *...
}
-alloc9 (fn: main)
+ALLOC2 (fn: main)
-alloc10 (size: 100, align: 1) {
+ALLOC3 (size: 100, align: 1) {
0x00 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x20 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
index d5feea723..6af0e3cbd 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&Packed};
+ _2 = const {ALLOC2: &&Packed};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,13 +17,13 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 8, align: 8) {
- ╾───────alloc12───────╼ │ ╾──────╼
+ALLOC2 (static: FOO, size: 8, align: 8) {
+ ╾ALLOC0╼ │ ╾──────╼
}
-alloc12 (size: 180, align: 1) {
+ALLOC0 (size: 180, align: 1) {
0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................
- 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾──alloc7── │ ............╾───
+ 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾──ALLOC3── │ ............╾───
0x20 │ ──────────╼ 01 ef cd ab 00 00 00 00 00 00 00 00 │ ───╼............
0x30 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x40 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
@@ -31,18 +31,18 @@ alloc12 (size: 180, align: 1) {
0x60 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x70 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x80 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ╾──── │ ..............╾─
- 0x90 │ ─────alloc9─────╼ 00 00 ╾────alloc10+0x63─────╼ │ ─────╼..╾──────╼
+ 0x90 │ ─────ALLOC4─────╼ 00 00 ╾ALLOC1+0x63╼ │ ─────╼..╾──────╼
0xa0 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0xb0 │ 00 00 00 00 │ ....
}
-alloc7 (size: 4, align: 4) {
+ALLOC3 (size: 4, align: 4) {
2a 00 00 00 │ *...
}
-alloc9 (fn: main)
+ALLOC4 (fn: main)
-alloc10 (size: 100, align: 1) {
+ALLOC1 (size: 100, align: 1) {
0x00 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x20 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
diff --git a/tests/mir-opt/const_allocation3.rs b/tests/mir-opt/const_allocation3.rs
index da3fd089b..b8c9f5097 100644
--- a/tests/mir-opt/const_allocation3.rs
+++ b/tests/mir-opt/const_allocation3.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// ignore-endian-big
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
index ed47baa67..87c072795 100644
--- a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
+++ b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
@@ -8,8 +8,8 @@
let mut _6: u8;
let mut _7: u8;
let mut _8: u8;
- let mut _12: u32;
- let mut _13: u32;
+ let mut _14: u32;
+ let mut _15: u32;
scope 1 {
- debug x => _1;
+ debug x => const 1_u8;
@@ -29,29 +29,19 @@
scope 5 {
- debug s => _9;
+ debug s => const "hello, world!";
- let _14: bool;
- let _15: bool;
- let _16: u32;
+ let _10: (bool, bool, u32);
scope 6 {
-- debug ((f: (bool, bool, u32)).0: bool) => _14;
-- debug ((f: (bool, bool, u32)).1: bool) => _15;
-- debug ((f: (bool, bool, u32)).2: u32) => _16;
-+ debug ((f: (bool, bool, u32)).0: bool) => const true;
-+ debug ((f: (bool, bool, u32)).1: bool) => const false;
-+ debug ((f: (bool, bool, u32)).2: u32) => const 123_u32;
- let _10: std::option::Option<u16>;
+ debug f => _10;
+ let _11: std::option::Option<u16>;
scope 7 {
- debug o => _10;
- let _17: u32;
- let _18: u32;
+ debug o => _11;
+ let _12: Point;
scope 8 {
-- debug ((p: Point).0: u32) => _17;
-- debug ((p: Point).1: u32) => _18;
-+ debug ((p: Point).0: u32) => const 32_u32;
-+ debug ((p: Point).1: u32) => const 32_u32;
- let _11: u32;
+- debug p => _12;
++ debug p => const Point {{ x: 32_u32, y: 32_u32 }};
+ let _13: u32;
scope 9 {
-- debug a => _11;
+- debug a => _13;
+ debug a => const 64_u32;
}
}
@@ -64,36 +54,57 @@
}
bb0: {
+ StorageLive(_1);
_1 = const 1_u8;
+ StorageLive(_2);
_2 = const 2_u8;
+ StorageLive(_3);
_3 = const 3_u8;
StorageLive(_4);
StorageLive(_5);
+ StorageLive(_6);
+ _6 = const 1_u8;
+ StorageLive(_7);
+ _7 = const 2_u8;
_5 = const 3_u8;
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageLive(_8);
+ _8 = const 3_u8;
_4 = const 6_u8;
+ StorageDead(_8);
StorageDead(_5);
StorageLive(_9);
_9 = const "hello, world!";
- StorageLive(_14);
- StorageLive(_15);
- StorageLive(_16);
- _14 = const true;
- _15 = const false;
- _16 = const 123_u32;
StorageLive(_10);
- _10 = Option::<u16>::Some(const 99_u16);
- _17 = const 32_u32;
- _18 = const 32_u32;
+ _10 = (const true, const false, const 123_u32);
StorageLive(_11);
- _11 = const 64_u32;
+ _11 = Option::<u16>::Some(const 99_u16);
+ StorageLive(_12);
+ _12 = const Point {{ x: 32_u32, y: 32_u32 }};
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = const 32_u32;
+ StorageLive(_15);
+ _15 = const 32_u32;
+ _13 = const 64_u32;
+ StorageDead(_15);
+ StorageDead(_14);
+ _0 = const ();
+ StorageDead(_13);
+ StorageDead(_12);
StorageDead(_11);
StorageDead(_10);
- StorageDead(_14);
- StorageDead(_15);
- StorageDead(_16);
StorageDead(_9);
StorageDead(_4);
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_1);
return;
}
}
+ ALLOC0 (size: 8, align: 4) {
+ 20 00 00 00 20 00 00 00 │ ... ...
+ }
+
diff --git a/tests/mir-opt/const_debuginfo.rs b/tests/mir-opt/const_debuginfo.rs
index a188da385..0e5ac4b8b 100644
--- a/tests/mir-opt/const_debuginfo.rs
+++ b/tests/mir-opt/const_debuginfo.rs
@@ -1,11 +1,23 @@
-// compile-flags: -C overflow-checks=no -Zunsound-mir-opts
+// unit-test: ConstDebugInfo
+// compile-flags: -C overflow-checks=no -Zmir-enable-passes=+ConstProp
struct Point {
x: u32,
y: u32,
}
+// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug x => const 1_u8;
+ // CHECK: debug y => const 2_u8;
+ // CHECK: debug z => const 3_u8;
+ // CHECK: debug sum => const 6_u8;
+ // CHECK: debug s => const "hello, world!";
+ // CHECK: debug f => {{_.*}};
+ // CHECK: debug o => {{_.*}};
+ // CHECK: debug p => const Point
+ // CHECK: debug a => const 64_u32;
let x = 1u8;
let y = 2u8;
let z = 3u8;
@@ -20,5 +32,3 @@ fn main() {
let p = Point { x: 32, y: 32 };
let a = p.x + p.y;
}
-
-// EMIT_MIR const_debuginfo.main.ConstDebugInfo.diff
diff --git a/tests/mir-opt/const_goto.rs b/tests/mir-opt/const_goto.rs
index 6f84f186b..93cb71c3a 100644
--- a/tests/mir-opt/const_goto.rs
+++ b/tests/mir-opt/const_goto.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstGoto
pub enum Foo {
diff --git a/tests/mir-opt/const_goto_const_eval_fail.rs b/tests/mir-opt/const_goto_const_eval_fail.rs
index b2357663a..869f91600 100644
--- a/tests/mir-opt/const_goto_const_eval_fail.rs
+++ b/tests/mir-opt/const_goto_const_eval_fail.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(min_const_generics)]
#![crate_type = "lib"]
diff --git a/tests/mir-opt/const_goto_storage.rs b/tests/mir-opt/const_goto_storage.rs
index 459599c73..9d43da239 100644
--- a/tests/mir-opt/const_goto_storage.rs
+++ b/tests/mir-opt/const_goto_storage.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstGoto
// EMIT_MIR const_goto_storage.match_nested_if.ConstGoto.diff
diff --git a/tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir
index 5b8d3ca78..960b98224 100644
--- a/tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir
+++ b/tests/mir-opt/const_promotion_extern_static.BAR-promoted[0].SimplifyCfg-elaborate-drops.after.mir
@@ -7,7 +7,7 @@ promoted[0] in BAR: &[&i32; 1] = {
let mut _3: &i32;
bb0: {
- _3 = const {alloc1: &i32};
+ _3 = const {ALLOC0: &i32};
_2 = &(*_3);
_1 = [move _2];
_0 = &_1;
@@ -15,6 +15,6 @@ promoted[0] in BAR: &[&i32; 1] = {
}
}
-alloc1 (static: Y, size: 4, align: 4) {
+ALLOC0 (static: Y, size: 4, align: 4) {
2a 00 00 00 │ *...
}
diff --git a/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff b/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff
index 14d2d7fc8..4a93db3fc 100644
--- a/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff
+++ b/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff
@@ -16,7 +16,7 @@
- StorageLive(_3);
- StorageLive(_4);
- StorageLive(_5);
-- _5 = const {alloc1: &i32};
+- _5 = const {ALLOC0: &i32};
- _4 = &(*_5);
- _3 = [move _4];
- _2 = &_3;
@@ -40,7 +40,7 @@
}
- }
-
-- alloc1 (static: Y, size: 4, align: 4) {
+- ALLOC0 (static: Y, size: 4, align: 4) {
- 2a 00 00 00 │ *...
}
diff --git a/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir
index 85355389b..a9c054427 100644
--- a/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir
+++ b/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir
@@ -7,7 +7,7 @@ promoted[0] in FOO: &[&i32; 1] = {
let mut _3: *const i32;
bb0: {
- _3 = const {alloc3: *const i32};
+ _3 = const {ALLOC0: *const i32};
_2 = &(*_3);
_1 = [move _2];
_0 = &_1;
@@ -15,4 +15,4 @@ promoted[0] in FOO: &[&i32; 1] = {
}
}
-alloc3 (extern static: X)
+ALLOC0 (extern static: X)
diff --git a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
index ffdd195ec..21d21b0ee 100644
--- a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
+++ b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
@@ -18,7 +18,7 @@
- StorageLive(_3);
- StorageLive(_4);
- StorageLive(_5);
-- _5 = const {alloc3: *const i32};
+- _5 = const {ALLOC0: *const i32};
- _4 = &(*_5);
- _3 = [move _4];
- _2 = &_3;
@@ -42,5 +42,5 @@
}
}
-
-- alloc3 (extern static: X)
+- ALLOC0 (extern static: X)
diff --git a/tests/mir-opt/const_promotion_extern_static.rs b/tests/mir-opt/const_promotion_extern_static.rs
index e4261cfe5..edc3a5223 100644
--- a/tests/mir-opt/const_promotion_extern_static.rs
+++ b/tests/mir-opt/const_promotion_extern_static.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// ignore-endian-big
extern "C" {
static X: i32;
diff --git a/tests/mir-opt/const_prop/address_of_pair.rs b/tests/mir-opt/const_prop/address_of_pair.rs
index 43dc9bae6..169469a07 100644
--- a/tests/mir-opt/const_prop/address_of_pair.rs
+++ b/tests/mir-opt/const_prop/address_of_pair.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR address_of_pair.fn0.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs
index 62cd3dd68..2e043af08 100644
--- a/tests/mir-opt/const_prop/aggregate.rs
+++ b/tests/mir-opt/const_prop/aggregate.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -O
diff --git a/tests/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs
index f85d23b97..3bd232165 100644
--- a/tests/mir-opt/const_prop/array_index.rs
+++ b/tests/mir-opt/const_prop/array_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs
index 963084bf7..ab41f64a5 100644
--- a/tests/mir-opt/const_prop/bad_op_div_by_zero.rs
+++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
index 9d7d2aa10..e747b21cf 100644
--- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
+++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
index d6b1a93f3..38c97a4cf 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_prop/boolean_identities.rs b/tests/mir-opt/const_prop/boolean_identities.rs
index c7b609949..781cce8c7 100644
--- a/tests/mir-opt/const_prop/boolean_identities.rs
+++ b/tests/mir-opt/const_prop/boolean_identities.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -O -Zmir-opt-level=4
diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs
index 78599174b..c6807ece1 100644
--- a/tests/mir-opt/const_prop/boxes.rs
+++ b/tests/mir-opt/const_prop/boxes.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -O
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs
index 984086eda..3d543bada 100644
--- a/tests/mir-opt/const_prop/cast.rs
+++ b/tests/mir-opt/const_prop/cast.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR cast.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
index c2fd7f65f..5a958cc7a 100644
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
@@ -26,7 +26,7 @@
}
+ }
+
-+ alloc3 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 02 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
index 21a31f9ab..ab48186ae 100644
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
@@ -26,7 +26,7 @@
}
+ }
+
-+ alloc3 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 02 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/checked_add.rs b/tests/mir-opt/const_prop/checked_add.rs
index fd40876cb..6a53aced0 100644
--- a/tests/mir-opt/const_prop/checked_add.rs
+++ b/tests/mir-opt/const_prop/checked_add.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs
index c92831f92..5bd4731bf 100644
--- a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs
+++ b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
#[inline(never)]
diff --git a/tests/mir-opt/const_prop/control_flow_simplification.rs b/tests/mir-opt/const_prop/control_flow_simplification.rs
index 21d727b3e..5fc13e202 100644
--- a/tests/mir-opt/const_prop/control_flow_simplification.rs
+++ b/tests/mir-opt/const_prop/control_flow_simplification.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Zmir-opt-level=1
diff --git a/tests/mir-opt/const_prop/discriminant.rs b/tests/mir-opt/const_prop/discriminant.rs
index fdd67ca8a..11405f38b 100644
--- a/tests/mir-opt/const_prop/discriminant.rs
+++ b/tests/mir-opt/const_prop/discriminant.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -O
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
index c0efc8730..530cfc653 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
@@ -31,7 +31,7 @@
}
+ }
+
-+ alloc3 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 03 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
index 2aee6f164..08cf72e47 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
@@ -31,7 +31,7 @@
}
+ }
+
-+ alloc3 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 03 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/indirect.rs b/tests/mir-opt/const_prop/indirect.rs
index 72af6cd95..0e6e1d78d 100644
--- a/tests/mir-opt/const_prop/indirect.rs
+++ b/tests/mir-opt/const_prop/indirect.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff b/tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff
index 4eafb8d09..4eafb8d09 100644
--- a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff
+++ b/tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff
diff --git a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff b/tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff
index 445d9895d..445d9895d 100644
--- a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff
+++ b/tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/indirect_mutation.rs b/tests/mir-opt/const_prop/indirect_mutation.rs
new file mode 100644
index 000000000..ec9da6e8e
--- /dev/null
+++ b/tests/mir-opt/const_prop/indirect_mutation.rs
@@ -0,0 +1,41 @@
+// unit-test: ConstProp
+// Check that we do not propagate past an indirect mutation.
+#![feature(raw_ref_op)]
+
+// EMIT_MIR indirect_mutation.foo.ConstProp.diff
+fn foo() {
+ // CHECK-LABEL: fn foo(
+ // CHECK: debug u => _1;
+ // CHECK: debug y => _3;
+ // CHECK: _1 = (const 1_i32,);
+ // CHECK: _2 = &mut (_1.0: i32);
+ // CHECK: (*_2) = const 5_i32;
+ // CHECK: _4 = (_1.0: i32);
+ // CHECK: _3 = Eq(move _4, const 5_i32);
+
+ let mut u = (1,);
+ *&mut u.0 = 5;
+ let y = { u.0 } == 5;
+}
+
+// EMIT_MIR indirect_mutation.bar.ConstProp.diff
+fn bar() {
+ // CHECK-LABEL: fn bar(
+ // CHECK: debug v => _1;
+ // CHECK: debug y => _4;
+ // CHECK: _3 = &raw mut (_1.0: i32);
+ // CHECK: (*_3) = const 5_i32;
+ // CHECK: _5 = (_1.0: i32);
+ // CHECK: _4 = Eq(move _5, const 5_i32);
+
+ let mut v = (1,);
+ unsafe {
+ *&raw mut v.0 = 5;
+ }
+ let y = { v.0 } == 5;
+}
+
+fn main() {
+ foo();
+ bar();
+}
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
index 7ba51ccdb..b30deb2a4 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
@@ -20,6 +20,7 @@
_2 = const u8::MAX;
StorageLive(_3);
_3 = const 1_u8;
+ StorageLive(_4);
- _4 = CheckedAdd(_2, _3);
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
+ _4 = const (0_u8, true);
@@ -29,6 +30,7 @@
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
+ StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
@@ -37,7 +39,7 @@
}
+ }
+
-+ alloc3 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 00 01 │ ..
}
diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
index 545b7f22f..47c51196c 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
@@ -20,6 +20,7 @@
_2 = const u8::MAX;
StorageLive(_3);
_3 = const 1_u8;
+ StorageLive(_4);
- _4 = CheckedAdd(_2, _3);
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
+ _4 = const (0_u8, true);
@@ -29,6 +30,7 @@
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
+ StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
@@ -37,7 +39,7 @@
}
+ }
+
-+ alloc3 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 00 01 │ ..
}
diff --git a/tests/mir-opt/const_prop/inherit_overflow.rs b/tests/mir-opt/const_prop/inherit_overflow.rs
index 6ebd36412..41989462d 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.rs
+++ b/tests/mir-opt/const_prop/inherit_overflow.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+Inline
diff --git a/tests/mir-opt/const_prop/invalid_constant.rs b/tests/mir-opt/const_prop/invalid_constant.rs
index bdbc5a199..ff6b31a1e 100644
--- a/tests/mir-opt/const_prop/invalid_constant.rs
+++ b/tests/mir-opt/const_prop/invalid_constant.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+RemoveZsts
// Verify that we can pretty print invalid constants.
diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
index 18341ba7d..6484b4b67 100644
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
@@ -20,11 +20,11 @@
}
+ }
+
-+ alloc8 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 00 00 │ ..
+ }
+
-+ alloc7 (size: 2, align: 1) {
++ ALLOC1 (size: 2, align: 1) {
+ 00 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
index 50763c10f..b02f04078 100644
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
@@ -20,11 +20,11 @@
}
+ }
+
-+ alloc8 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 00 00 │ ..
+ }
+
-+ alloc7 (size: 2, align: 1) {
++ ALLOC1 (size: 2, align: 1) {
+ 00 00 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_66971.rs b/tests/mir-opt/const_prop/issue_66971.rs
index a0242ec63..386c95b5b 100644
--- a/tests/mir-opt/const_prop/issue_66971.rs
+++ b/tests/mir-opt/const_prop/issue_66971.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Z mir-opt-level=3
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
index 015180db8..c1ef453e9 100644
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
@@ -25,15 +25,15 @@
}
+ }
+
-+ alloc12 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 01 02 │ ..
+ }
+
-+ alloc11 (size: 2, align: 1) {
++ ALLOC1 (size: 2, align: 1) {
+ 01 02 │ ..
+ }
+
-+ alloc8 (size: 2, align: 1) {
++ ALLOC2 (size: 2, align: 1) {
+ 01 02 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
index 8e41705c1..53cdcc181 100644
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
@@ -25,15 +25,15 @@
}
+ }
+
-+ alloc12 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 01 02 │ ..
+ }
+
-+ alloc11 (size: 2, align: 1) {
++ ALLOC1 (size: 2, align: 1) {
+ 01 02 │ ..
+ }
+
-+ alloc8 (size: 2, align: 1) {
++ ALLOC2 (size: 2, align: 1) {
+ 01 02 │ ..
}
diff --git a/tests/mir-opt/const_prop/issue_67019.rs b/tests/mir-opt/const_prop/issue_67019.rs
index 66b577f5b..2f61298bb 100644
--- a/tests/mir-opt/const_prop/issue_67019.rs
+++ b/tests/mir-opt/const_prop/issue_67019.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Z mir-opt-level=3
diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs
index d226bd546..d98d166ff 100644
--- a/tests/mir-opt/const_prop/large_array_index.rs
+++ b/tests/mir-opt/const_prop/large_array_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_prop/mult_by_zero.rs b/tests/mir-opt/const_prop/mult_by_zero.rs
index 7bd30975a..47e15205e 100644
--- a/tests/mir-opt/const_prop/mult_by_zero.rs
+++ b/tests/mir-opt/const_prop/mult_by_zero.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR mult_by_zero.test.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs
index 95987ef7f..175d63d46 100644
--- a/tests/mir-opt/const_prop/mutable_variable.rs
+++ b/tests/mir-opt/const_prop/mutable_variable.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR mutable_variable.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
index 56a127ae3..c3ace9687 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
@@ -27,11 +27,11 @@
}
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 2a 00 00 00 63 00 00 00 │ *...c...
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC1 (size: 8, align: 4) {
+ 2a 00 00 00 2b 00 00 00 │ *...+...
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
index a145c0354..f926771ae 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs
index 3099e659f..a81aa7b49 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
index 30ea5714a..54a5d9223 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff
index ac26f8ef4..1f74bdcfd 100644
--- a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff
@@ -23,7 +23,7 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = const {alloc1: *mut u32};
+ _4 = const {ALLOC0: *mut u32};
_3 = (*_4);
_1 = move _3;
StorageDead(_3);
@@ -39,7 +39,7 @@
}
}
- alloc1 (static: STATIC, size: 4, align: 4) {
+ ALLOC0 (static: STATIC, size: 4, align: 4) {
42 42 42 42 │ BBBB
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
index e51c62235..a7aeeccd8 100644
--- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
static mut STATIC: u32 = 0x42424242;
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
index a1b433716..85bd2b6e7 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
@@ -48,7 +48,7 @@
}
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
index 2dc514194..06e96e57a 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
@@ -48,7 +48,7 @@
}
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
index 4e7c0597a..6bdb136a9 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff
index c73d217ae..711db3d21 100644
--- a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff
@@ -8,6 +8,9 @@
let mut _4: usize;
let mut _6: usize;
let mut _8: usize;
+ let mut _10: usize;
+ let mut _12: usize;
+ let mut _14: usize;
scope 1 {
debug x => _1;
let _3: usize;
@@ -19,6 +22,18 @@
let _7: usize;
scope 4 {
debug z1 => _7;
+ let _9: usize;
+ scope 5 {
+ debug eA0 => _9;
+ let _11: usize;
+ scope 6 {
+ debug eA1 => _11;
+ let _13: usize;
+ scope 7 {
+ debug eC => _13;
+ }
+ }
+ }
}
}
}
@@ -27,7 +42,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
-- _2 = OffsetOf(Alpha, [0]);
+- _2 = OffsetOf(Alpha, [(0, 0)]);
- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
+ _2 = const 4_usize;
+ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind unreachable];
@@ -37,7 +52,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
-- _4 = OffsetOf(Alpha, [1]);
+- _4 = OffsetOf(Alpha, [(0, 1)]);
- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
+ _4 = const 0_usize;
+ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind unreachable];
@@ -47,7 +62,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Alpha, [2, 0]);
+- _6 = OffsetOf(Alpha, [(0, 2), (0, 0)]);
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
+ _6 = const 2_usize;
+ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind unreachable];
@@ -57,7 +72,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Alpha, [2, 1]);
+- _8 = OffsetOf(Alpha, [(0, 2), (0, 1)]);
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
+ _8 = const 3_usize;
+ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind unreachable];
@@ -65,7 +80,40 @@
bb4: {
StorageDead(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+- _10 = OffsetOf(Epsilon, [(0, 0)]);
+- _9 = must_use::<usize>(move _10) -> [return: bb5, unwind unreachable];
++ _10 = const 1_usize;
++ _9 = must_use::<usize>(const 1_usize) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = OffsetOf(Epsilon, [(0, 1)]);
+- _11 = must_use::<usize>(move _12) -> [return: bb6, unwind unreachable];
++ _12 = const 2_usize;
++ _11 = must_use::<usize>(const 2_usize) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+- _14 = OffsetOf(Epsilon, [(2, 0)]);
+- _13 = must_use::<usize>(move _14) -> [return: bb7, unwind unreachable];
++ _14 = const 4_usize;
++ _13 = must_use::<usize>(const 4_usize) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_14);
_0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageDead(_9);
StorageDead(_7);
StorageDead(_5);
StorageDead(_3);
diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff
index 913ffca4a..494581454 100644
--- a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff
@@ -8,6 +8,9 @@
let mut _4: usize;
let mut _6: usize;
let mut _8: usize;
+ let mut _10: usize;
+ let mut _12: usize;
+ let mut _14: usize;
scope 1 {
debug x => _1;
let _3: usize;
@@ -19,6 +22,18 @@
let _7: usize;
scope 4 {
debug z1 => _7;
+ let _9: usize;
+ scope 5 {
+ debug eA0 => _9;
+ let _11: usize;
+ scope 6 {
+ debug eA1 => _11;
+ let _13: usize;
+ scope 7 {
+ debug eC => _13;
+ }
+ }
+ }
}
}
}
@@ -27,7 +42,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
-- _2 = OffsetOf(Alpha, [0]);
+- _2 = OffsetOf(Alpha, [(0, 0)]);
- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
+ _2 = const 4_usize;
+ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind continue];
@@ -37,7 +52,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
-- _4 = OffsetOf(Alpha, [1]);
+- _4 = OffsetOf(Alpha, [(0, 1)]);
- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
+ _4 = const 0_usize;
+ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind continue];
@@ -47,7 +62,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Alpha, [2, 0]);
+- _6 = OffsetOf(Alpha, [(0, 2), (0, 0)]);
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
+ _6 = const 2_usize;
+ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind continue];
@@ -57,7 +72,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Alpha, [2, 1]);
+- _8 = OffsetOf(Alpha, [(0, 2), (0, 1)]);
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
+ _8 = const 3_usize;
+ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind continue];
@@ -65,7 +80,40 @@
bb4: {
StorageDead(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+- _10 = OffsetOf(Epsilon, [(0, 0)]);
+- _9 = must_use::<usize>(move _10) -> [return: bb5, unwind continue];
++ _10 = const 1_usize;
++ _9 = must_use::<usize>(const 1_usize) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = OffsetOf(Epsilon, [(0, 1)]);
+- _11 = must_use::<usize>(move _12) -> [return: bb6, unwind continue];
++ _12 = const 2_usize;
++ _11 = must_use::<usize>(const 2_usize) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+- _14 = OffsetOf(Epsilon, [(2, 0)]);
+- _13 = must_use::<usize>(move _14) -> [return: bb7, unwind continue];
++ _14 = const 4_usize;
++ _13 = must_use::<usize>(const 4_usize) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_14);
_0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageDead(_9);
StorageDead(_7);
StorageDead(_5);
StorageDead(_3);
diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff
index 7519331f6..768970a72 100644
--- a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff
@@ -8,6 +8,9 @@
let mut _4: usize;
let mut _6: usize;
let mut _8: usize;
+ let mut _10: usize;
+ let mut _12: usize;
+ let mut _14: usize;
scope 1 {
debug gx => _1;
let _3: usize;
@@ -19,6 +22,18 @@
let _7: usize;
scope 4 {
debug dy => _7;
+ let _9: usize;
+ scope 5 {
+ debug zA0 => _9;
+ let _11: usize;
+ scope 6 {
+ debug zA1 => _11;
+ let _13: usize;
+ scope 7 {
+ debug zB => _13;
+ }
+ }
+ }
}
}
}
@@ -27,7 +42,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = OffsetOf(Gamma<T>, [0]);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
}
@@ -35,7 +50,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = OffsetOf(Gamma<T>, [1]);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
}
@@ -43,7 +58,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
- _6 = OffsetOf(Delta<T>, [1]);
+ _6 = OffsetOf(Delta<T>, [(0, 1)]);
_5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
}
@@ -51,13 +66,40 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
- _8 = OffsetOf(Delta<T>, [2]);
+ _8 = OffsetOf(Delta<T>, [(0, 2)]);
_7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = OffsetOf(Zeta<T>, [(0, 0)]);
+ _9 = must_use::<usize>(move _10) -> [return: bb5, unwind unreachable];
+ }
+
+ bb5: {
+ StorageDead(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = OffsetOf(Zeta<T>, [(0, 1)]);
+ _11 = must_use::<usize>(move _12) -> [return: bb6, unwind unreachable];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = OffsetOf(Zeta<T>, [(1, 0)]);
+ _13 = must_use::<usize>(move _14) -> [return: bb7, unwind unreachable];
+ }
+
+ bb7: {
+ StorageDead(_14);
_0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageDead(_9);
StorageDead(_7);
StorageDead(_5);
StorageDead(_3);
diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff
index fd5206e46..04ccd2b36 100644
--- a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff
@@ -8,6 +8,9 @@
let mut _4: usize;
let mut _6: usize;
let mut _8: usize;
+ let mut _10: usize;
+ let mut _12: usize;
+ let mut _14: usize;
scope 1 {
debug gx => _1;
let _3: usize;
@@ -19,6 +22,18 @@
let _7: usize;
scope 4 {
debug dy => _7;
+ let _9: usize;
+ scope 5 {
+ debug zA0 => _9;
+ let _11: usize;
+ scope 6 {
+ debug zA1 => _11;
+ let _13: usize;
+ scope 7 {
+ debug zB => _13;
+ }
+ }
+ }
}
}
}
@@ -27,7 +42,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = OffsetOf(Gamma<T>, [0]);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
}
@@ -35,7 +50,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = OffsetOf(Gamma<T>, [1]);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
}
@@ -43,7 +58,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
- _6 = OffsetOf(Delta<T>, [1]);
+ _6 = OffsetOf(Delta<T>, [(0, 1)]);
_5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
}
@@ -51,13 +66,40 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
- _8 = OffsetOf(Delta<T>, [2]);
+ _8 = OffsetOf(Delta<T>, [(0, 2)]);
_7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
}
bb4: {
StorageDead(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = OffsetOf(Zeta<T>, [(0, 0)]);
+ _9 = must_use::<usize>(move _10) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ StorageDead(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = OffsetOf(Zeta<T>, [(0, 1)]);
+ _11 = must_use::<usize>(move _12) -> [return: bb6, unwind continue];
+ }
+
+ bb6: {
+ StorageDead(_12);
+ StorageLive(_13);
+ StorageLive(_14);
+ _14 = OffsetOf(Zeta<T>, [(1, 0)]);
+ _13 = must_use::<usize>(move _14) -> [return: bb7, unwind continue];
+ }
+
+ bb7: {
+ StorageDead(_14);
_0 = const ();
+ StorageDead(_13);
+ StorageDead(_11);
+ StorageDead(_9);
StorageDead(_7);
StorageDead(_5);
StorageDead(_3);
diff --git a/tests/mir-opt/const_prop/offset_of.rs b/tests/mir-opt/const_prop/offset_of.rs
index 164db5957..2571c3856 100644
--- a/tests/mir-opt/const_prop/offset_of.rs
+++ b/tests/mir-opt/const_prop/offset_of.rs
@@ -1,7 +1,8 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-#![feature(offset_of)]
+#![feature(offset_of, offset_of_enum)]
use std::marker::PhantomData;
use std::mem::offset_of;
@@ -27,12 +28,26 @@ struct Delta<T> {
y: u16,
}
+enum Epsilon {
+ A(u8, u16),
+ B,
+ C { c: u32 }
+}
+
+enum Zeta<T> {
+ A(T, bool),
+ B(char),
+}
+
// EMIT_MIR offset_of.concrete.ConstProp.diff
fn concrete() {
let x = offset_of!(Alpha, x);
let y = offset_of!(Alpha, y);
let z0 = offset_of!(Alpha, z.0);
let z1 = offset_of!(Alpha, z.1);
+ let eA0 = offset_of!(Epsilon, A.0);
+ let eA1 = offset_of!(Epsilon, A.1);
+ let eC = offset_of!(Epsilon, C.c);
}
// EMIT_MIR offset_of.generic.ConstProp.diff
@@ -41,6 +56,9 @@ fn generic<T>() {
let gy = offset_of!(Gamma<T>, y);
let dx = offset_of!(Delta<T>, x);
let dy = offset_of!(Delta<T>, y);
+ let zA0 = offset_of!(Zeta<T>, A.0);
+ let zA1 = offset_of!(Zeta<T>, A.1);
+ let zB = offset_of!(Zeta<T>, B.0);
}
fn main() {
diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs
new file mode 100644
index 000000000..4cf6d7c13
--- /dev/null
+++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs
@@ -0,0 +1,26 @@
+// unit-test: ConstProp
+// compile-flags: -O
+
+// Regression test for https://github.com/rust-lang/rust/issues/118328
+
+#![allow(unused_assignments)]
+
+struct SizeOfConst<T>(std::marker::PhantomData<T>);
+impl<T> SizeOfConst<T> {
+ const SIZE: usize = std::mem::size_of::<T>();
+}
+
+// EMIT_MIR overwrite_with_const_with_params.size_of.ConstProp.diff
+fn size_of<T>() -> usize {
+ // CHECK-LABEL: fn size_of(
+ // CHECK: _1 = const 0_usize;
+ // CHECK-NEXT: _1 = const _;
+ // CHECK-NEXT: _0 = _1;
+ let mut a = 0;
+ a = SizeOfConst::<T>::SIZE;
+ a
+}
+
+fn main() {
+ assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>());
+}
diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff
new file mode 100644
index 000000000..ad8318832
--- /dev/null
+++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff
@@ -0,0 +1,20 @@
+- // MIR for `size_of` before ConstProp
++ // MIR for `size_of` after ConstProp
+
+ fn size_of() -> usize {
+ let mut _0: usize;
+ let mut _1: usize;
+ scope 1 {
+ debug a => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 0_usize;
+ _1 = const _;
+ _0 = _1;
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
index 29c455f35..e193c82d2 100644
--- a/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
@@ -16,12 +16,12 @@
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
- _3 = const {alloc1: &u8};
+ _3 = const {ALLOC0: &u8};
- _2 = (*_3);
+ _2 = const 2_u8;
StorageLive(_4);
StorageLive(_5);
- _5 = const {alloc1: &u8};
+ _5 = const {ALLOC0: &u8};
- _4 = (*_5);
- _1 = Add(move _2, move _4);
+ _4 = const 2_u8;
@@ -36,7 +36,7 @@
}
}
- alloc1 (static: FOO, size: 1, align: 1) {
+ ALLOC0 (static: FOO, size: 1, align: 1) {
02 │ .
}
diff --git a/tests/mir-opt/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs
index fb8f9fe99..a8d8cfacc 100644
--- a/tests/mir-opt/const_prop/read_immutable_static.rs
+++ b/tests/mir-opt/const_prop/read_immutable_static.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
static FOO: u8 = 2;
diff --git a/tests/mir-opt/const_prop/ref_deref.rs b/tests/mir-opt/const_prop/ref_deref.rs
index 76e56916a..f2fa024f7 100644
--- a/tests/mir-opt/const_prop/ref_deref.rs
+++ b/tests/mir-opt/const_prop/ref_deref.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR ref_deref.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/ref_deref_project.rs b/tests/mir-opt/const_prop/ref_deref_project.rs
index 04fc7f8da..1b9e0acb2 100644
--- a/tests/mir-opt/const_prop/ref_deref_project.rs
+++ b/tests/mir-opt/const_prop/ref_deref_project.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR ref_deref_project.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs
index 5f6382066..da7de80c5 100644
--- a/tests/mir-opt/const_prop/reify_fn_ptr.rs
+++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR reify_fn_ptr.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs
index fb8b825ee..92194d6bb 100644
--- a/tests/mir-opt/const_prop/repeat.rs
+++ b/tests/mir-opt/const_prop/repeat.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
index 6c9de4764..974a42e50 100644
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
@@ -19,7 +19,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
index 0f079278c..55dbc7002 100644
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
@@ -19,7 +19,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
index c2488f394..f87c26bb0 100644
--- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
@@ -15,6 +15,6 @@ fn add() -> u32 {
}
}
-alloc5 (size: 8, align: 4) {
+ALLOC0 (size: 8, align: 4) {
04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
index fa0b9c77e..33f975913 100644
--- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
@@ -15,6 +15,6 @@ fn add() -> u32 {
}
}
-alloc5 (size: 8, align: 4) {
+ALLOC0 (size: 8, align: 4) {
04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/return_place.rs b/tests/mir-opt/const_prop/return_place.rs
index 0576b02a8..1263de793 100644
--- a/tests/mir-opt/const_prop/return_place.rs
+++ b/tests/mir-opt/const_prop/return_place.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.rs b/tests/mir-opt/const_prop/scalar_literal_propagation.rs
index dfe41e614..9dcddf7c7 100644
--- a/tests/mir-opt/const_prop/scalar_literal_propagation.rs
+++ b/tests/mir-opt/const_prop/scalar_literal_propagation.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR scalar_literal_propagation.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs
index e91724536..3b551b6b1 100644
--- a/tests/mir-opt/const_prop/slice_len.rs
+++ b/tests/mir-opt/const_prop/slice_len.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+InstSimplify
diff --git a/tests/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs
index bf708c829..7ec56e11e 100644
--- a/tests/mir-opt/const_prop/switch_int.rs
+++ b/tests/mir-opt/const_prop/switch_int.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs
index 762c42171..99988d059 100644
--- a/tests/mir-opt/const_prop/transmute.rs
+++ b/tests/mir-opt/const_prop/transmute.rs
@@ -7,55 +7,77 @@ use std::mem::transmute;
// EMIT_MIR transmute.less_as_i8.ConstProp.diff
pub fn less_as_i8() -> i8 {
+ // CHECK-LABEL: fn less_as_i8(
+ // CHECK: _0 = const -1_i8;
unsafe { transmute(std::cmp::Ordering::Less) }
}
// EMIT_MIR transmute.from_char.ConstProp.diff
pub fn from_char() -> i32 {
+ // CHECK-LABEL: fn from_char(
+ // CHECK: _0 = const 82_i32;
unsafe { transmute('R') }
}
// EMIT_MIR transmute.valid_char.ConstProp.diff
pub fn valid_char() -> char {
+ // CHECK-LABEL: fn valid_char(
+ // CHECK: _0 = const 'R';
unsafe { transmute(0x52_u32) }
}
// EMIT_MIR transmute.invalid_char.ConstProp.diff
pub unsafe fn invalid_char() -> char {
+ // CHECK-LABEL: fn invalid_char(
+ // CHECK: _0 = const {transmute(0x7fffffff): char};
unsafe { transmute(i32::MAX) }
}
// EMIT_MIR transmute.invalid_bool.ConstProp.diff
pub unsafe fn invalid_bool() -> bool {
+ // CHECK-LABEL: fn invalid_bool(
+ // CHECK: _0 = const {transmute(0xff): bool};
unsafe { transmute(-1_i8) }
}
// EMIT_MIR transmute.undef_union_as_integer.ConstProp.diff
pub unsafe fn undef_union_as_integer() -> u32 {
+ // CHECK-LABEL: fn undef_union_as_integer(
+ // CHECK: _1 = Union32 {
+ // CHECK: _0 = move _1 as u32 (Transmute);
union Union32 { value: u32, unit: () }
unsafe { transmute(Union32 { unit: () }) }
}
// EMIT_MIR transmute.unreachable_direct.ConstProp.diff
pub unsafe fn unreachable_direct() -> ! {
+ // CHECK-LABEL: fn unreachable_direct(
+ // CHECK: [[unit:_.*]] = ();
+ // CHECK: move [[unit]] as Never (Transmute);
let x: Never = unsafe { transmute(()) };
match x {}
}
// EMIT_MIR transmute.unreachable_ref.ConstProp.diff
pub unsafe fn unreachable_ref() -> ! {
+ // CHECK-LABEL: fn unreachable_ref(
+ // CHECK: = const {0x1 as &Never};
let x: &Never = unsafe { transmute(1_usize) };
match *x {}
}
// EMIT_MIR transmute.unreachable_mut.ConstProp.diff
pub unsafe fn unreachable_mut() -> ! {
+ // CHECK-LABEL: fn unreachable_mut(
+ // CHECK: = const {0x1 as &mut Never};
let x: &mut Never = unsafe { transmute(1_usize) };
match *x {}
}
// EMIT_MIR transmute.unreachable_box.ConstProp.diff
pub unsafe fn unreachable_box() -> ! {
+ // CHECK-LABEL: fn unreachable_box(
+ // CHECK: = const Box::<Never>(
let x: Box<Never> = unsafe { transmute(1_usize) };
match *x {}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
index 100982382..16519749b 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
@@ -4,6 +4,7 @@
fn unreachable_box() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -13,7 +14,9 @@
bb0: {
StorageLive(_1);
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
+- _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
++ _2 = const {0x1 as *const Never};
unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff
index 100982382..16519749b 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff
@@ -4,6 +4,7 @@
fn unreachable_box() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -13,7 +14,9 @@
bb0: {
StorageLive(_1);
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
+- _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
++ _2 = const {0x1 as *const Never};
unreachable;
}
}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
index 988ef7dd2..f19650d5a 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
@@ -31,15 +31,15 @@
}
+ }
+
-+ alloc9 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
+ }
+
-+ alloc8 (size: 8, align: 4) {
++ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
+ }
+
-+ alloc6 (size: 8, align: 4) {
++ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
index 298446197..67307c423 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
@@ -31,15 +31,15 @@
}
+ }
+
-+ alloc9 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
+ }
+
-+ alloc8 (size: 8, align: 4) {
++ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
+ }
+
-+ alloc6 (size: 8, align: 4) {
++ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.rs b/tests/mir-opt/const_prop/tuple_literal_propagation.rs
index 5890a343f..e0bc6e1be 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.rs
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR tuple_literal_propagation.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/while_let_loops.rs b/tests/mir-opt/const_prop/while_let_loops.rs
index 595a94b88..39081c355 100644
--- a/tests/mir-opt/const_prop/while_let_loops.rs
+++ b/tests/mir-opt/const_prop/while_let_loops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff
diff --git a/tests/mir-opt/const_prop_miscompile.rs b/tests/mir-opt/const_prop_miscompile.rs
deleted file mode 100644
index dbbe5ee08..000000000
--- a/tests/mir-opt/const_prop_miscompile.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// unit-test: ConstProp
-#![feature(raw_ref_op)]
-
-// EMIT_MIR const_prop_miscompile.foo.ConstProp.diff
-fn foo() {
- let mut u = (1,);
- *&mut u.0 = 5;
- let y = { u.0 } == 5;
-}
-
-// EMIT_MIR const_prop_miscompile.bar.ConstProp.diff
-fn bar() {
- let mut v = (1,);
- unsafe {
- *&raw mut v.0 = 5;
- }
- let y = { v.0 } == 5;
-}
-
-fn main() {
- foo();
- bar();
-}
diff --git a/tests/mir-opt/copy-prop/borrowed_local.rs b/tests/mir-opt/copy-prop/borrowed_local.rs
index bf94dc57d..c6b8ad357 100644
--- a/tests/mir-opt/copy-prop/borrowed_local.rs
+++ b/tests/mir-opt/copy-prop/borrowed_local.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/branch.rs b/tests/mir-opt/copy-prop/branch.rs
index c8af1aa7b..278508957 100644
--- a/tests/mir-opt/copy-prop/branch.rs
+++ b/tests/mir-opt/copy-prop/branch.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that we bail out when there are multiple assignments to the same local.
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff b/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff
new file mode 100644
index 000000000..4d56a8b25
--- /dev/null
+++ b/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff
@@ -0,0 +1,21 @@
+- // MIR for `multiple_edges` before CopyProp
++ // MIR for `multiple_edges` after CopyProp
+
+ fn multiple_edges(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+
+ bb0: {
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = dummy(const 13_u8) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ _0 = _2;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff b/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff
new file mode 100644
index 000000000..b5d56909b
--- /dev/null
+++ b/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff
@@ -0,0 +1,24 @@
+- // MIR for `nrvo` before CopyProp
++ // MIR for `nrvo` after CopyProp
+
+ fn nrvo() -> u8 {
+ let mut _0: u8;
+ let _1: u8;
+ scope 1 {
+- debug y => _1;
++ debug y => _0;
+ }
+
+ bb0: {
+- StorageLive(_1);
+- _1 = dummy(const 5_u8) -> [return: bb1, unwind continue];
++ _0 = dummy(const 5_u8) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+- _0 = _1;
+- StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/calls.rs b/tests/mir-opt/copy-prop/calls.rs
new file mode 100644
index 000000000..2970f5f0b
--- /dev/null
+++ b/tests/mir-opt/copy-prop/calls.rs
@@ -0,0 +1,44 @@
+// skip-filecheck
+// Check that CopyProp does propagate return values of call terminators.
+// unit-test: CopyProp
+// needs-unwind
+
+#![feature(custom_mir, core_intrinsics)]
+use std::intrinsics::mir::*;
+
+#[inline(never)]
+fn dummy(x: u8) -> u8 {
+ x
+}
+
+// EMIT_MIR calls.nrvo.CopyProp.diff
+fn nrvo() -> u8 {
+ let y = dummy(5); // this should get NRVO
+ y
+}
+
+// EMIT_MIR calls.multiple_edges.CopyProp.diff
+#[custom_mir(dialect = "runtime", phase = "initial")]
+fn multiple_edges(t: bool) -> u8 {
+ mir! {
+ let x: u8;
+ {
+ match t { true => bbt, _ => ret }
+ }
+ bbt = {
+ Call(x = dummy(13), ret)
+ }
+ ret = {
+ // `x` is not assigned on the `bb0 -> ret` edge,
+ // so should not be marked as SSA for merging with `_0`.
+ RET = x;
+ Return()
+ }
+ }
+}
+
+fn main() {
+ // Make sure the function actually gets instantiated.
+ nrvo();
+ multiple_edges(false);
+}
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.rs b/tests/mir-opt/copy-prop/copy_propagation_arg.rs
index 671860da5..83bbefe09 100644
--- a/tests/mir-opt/copy-prop/copy_propagation_arg.rs
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that CopyProp does not propagate an assignment to a function argument
// (doing so can break usages of the original argument value)
diff --git a/tests/mir-opt/copy-prop/custom_move_arg.rs b/tests/mir-opt/copy-prop/custom_move_arg.rs
index d1c5ffdff..2077874ee 100644
--- a/tests/mir-opt/copy-prop/custom_move_arg.rs
+++ b/tests/mir-opt/copy-prop/custom_move_arg.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/cycle.rs b/tests/mir-opt/copy-prop/cycle.rs
index 56ec75397..58e049fde 100644
--- a/tests/mir-opt/copy-prop/cycle.rs
+++ b/tests/mir-opt/copy-prop/cycle.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that cyclic assignments don't hang CopyProp, and result in reasonable code.
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.rs b/tests/mir-opt/copy-prop/dead_stores_79191.rs
index 4260d35b1..81306ab61 100644
--- a/tests/mir-opt/copy-prop/dead_stores_79191.rs
+++ b/tests/mir-opt/copy-prop/dead_stores_79191.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/dead_stores_better.rs b/tests/mir-opt/copy-prop/dead_stores_better.rs
index c5962db6a..7addf6af2 100644
--- a/tests/mir-opt/copy-prop/dead_stores_better.rs
+++ b/tests/mir-opt/copy-prop/dead_stores_better.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates
// that that pass enables this one to do more optimizations.
diff --git a/tests/mir-opt/copy-prop/issue_107511.rs b/tests/mir-opt/copy-prop/issue_107511.rs
index ce6fcc17b..53fd93662 100644
--- a/tests/mir-opt/copy-prop/issue_107511.rs
+++ b/tests/mir-opt/copy-prop/issue_107511.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/move_arg.rs b/tests/mir-opt/copy-prop/move_arg.rs
index a3a04e57b..fc2932a65 100644
--- a/tests/mir-opt/copy-prop/move_arg.rs
+++ b/tests/mir-opt/copy-prop/move_arg.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Test that we do not move multiple times from the same local.
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/move_projection.rs b/tests/mir-opt/copy-prop/move_projection.rs
index f94addb56..8629d535b 100644
--- a/tests/mir-opt/copy-prop/move_projection.rs
+++ b/tests/mir-opt/copy-prop/move_projection.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/mutate_through_pointer.rs b/tests/mir-opt/copy-prop/mutate_through_pointer.rs
index 753787089..e36a10846 100644
--- a/tests/mir-opt/copy-prop/mutate_through_pointer.rs
+++ b/tests/mir-opt/copy-prop/mutate_through_pointer.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: CopyProp
//
// This attempts to mutate `a` via a pointer derived from `addr_of!(a)`. That is UB
diff --git a/tests/mir-opt/copy-prop/non_dominate.rs b/tests/mir-opt/copy-prop/non_dominate.rs
index c0ea838e1..c26ac444e 100644
--- a/tests/mir-opt/copy-prop/non_dominate.rs
+++ b/tests/mir-opt/copy-prop/non_dominate.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: CopyProp
#![feature(custom_mir, core_intrinsics)]
diff --git a/tests/mir-opt/copy-prop/partial_init.rs b/tests/mir-opt/copy-prop/partial_init.rs
index f5ab9974f..44cc203de 100644
--- a/tests/mir-opt/copy-prop/partial_init.rs
+++ b/tests/mir-opt/copy-prop/partial_init.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: CopyProp
// Verify that we do not ICE on partial initializations.
diff --git a/tests/mir-opt/copy-prop/reborrow.rs b/tests/mir-opt/copy-prop/reborrow.rs
index c37ba5e5c..57c4fb8ad 100644
--- a/tests/mir-opt/copy-prop/reborrow.rs
+++ b/tests/mir-opt/copy-prop/reborrow.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that CopyProp considers reborrows as not mutating the pointer.
// unit-test: CopyProp
diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir b/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-abort.mir
index d8bea1420..25bffbe24 100644
--- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir
+++ b/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-abort.mir
@@ -1,10 +1,10 @@
-// MIR for `main::{closure#0}` 0 generator_drop
-/* generator_layout = GeneratorLayout {
+// MIR for `main::{closure#0}` 0 coroutine_drop
+/* coroutine_layout = CoroutineLayout {
field_tys: {
- _0: GeneratorSavedTy {
+ _0: CoroutineSavedTy {
ty: std::string::String,
source_info: SourceInfo {
- span: $DIR/generator_drop_cleanup.rs:11:13: 11:15 (#0),
+ span: $DIR/coroutine_drop_cleanup.rs:12:13: 12:15 (#0),
scope: scope[0],
},
ignore_for_traits: false,
@@ -21,7 +21,7 @@
},
} */
-fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17}) -> () {
+fn main::{closure#0}(_1: *mut {coroutine@$DIR/coroutine_drop_cleanup.rs:11:15: 11:17}) -> () {
let mut _0: ();
let mut _2: ();
let _3: std::string::String;
diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir b/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-unwind.mir
index d8b27eda8..2eac754b1 100644
--- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir
+++ b/tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-unwind.mir
@@ -1,10 +1,10 @@
-// MIR for `main::{closure#0}` 0 generator_drop
-/* generator_layout = GeneratorLayout {
+// MIR for `main::{closure#0}` 0 coroutine_drop
+/* coroutine_layout = CoroutineLayout {
field_tys: {
- _0: GeneratorSavedTy {
+ _0: CoroutineSavedTy {
ty: std::string::String,
source_info: SourceInfo {
- span: $DIR/generator_drop_cleanup.rs:11:13: 11:15 (#0),
+ span: $DIR/coroutine_drop_cleanup.rs:12:13: 12:15 (#0),
scope: scope[0],
},
ignore_for_traits: false,
@@ -21,7 +21,7 @@
},
} */
-fn main::{closure#0}(_1: *mut {generator@$DIR/generator_drop_cleanup.rs:10:15: 10:17}) -> () {
+fn main::{closure#0}(_1: *mut {coroutine@$DIR/coroutine_drop_cleanup.rs:11:15: 11:17}) -> () {
let mut _0: ();
let mut _2: ();
let _3: std::string::String;
diff --git a/tests/mir-opt/coroutine_drop_cleanup.rs b/tests/mir-opt/coroutine_drop_cleanup.rs
new file mode 100644
index 000000000..69984c737
--- /dev/null
+++ b/tests/mir-opt/coroutine_drop_cleanup.rs
@@ -0,0 +1,15 @@
+// skip-filecheck
+#![feature(coroutines, coroutine_trait)]
+
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+// Regression test for #58892, coroutine drop shims should not have blocks
+// spuriously marked as cleanup
+
+// EMIT_MIR coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.mir
+fn main() {
+ let gen = || {
+ let _s = String::new();
+ yield;
+ };
+}
diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir b/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
index 4587282de..8369a3e60 100644
--- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
+++ b/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` before StateTransform
-fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18}, _2: ()) -> ()
+fn main::{closure#0}(_1: {coroutine@$DIR/coroutine_storage_dead_unwind.rs:23:16: 23:18}, _2: ()) -> ()
yields ()
{
let mut _0: ();
@@ -78,6 +78,6 @@ yields ()
}
bb8: {
- generator_drop;
+ coroutine_drop;
}
}
diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir b/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
index 38026f65b..1773db1ab 100644
--- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
+++ b/tests/mir-opt/coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
@@ -1,6 +1,6 @@
// MIR for `main::{closure#0}` before StateTransform
-fn main::{closure#0}(_1: {generator@$DIR/generator_storage_dead_unwind.rs:22:16: 22:18}, _2: ()) -> ()
+fn main::{closure#0}(_1: {coroutine@$DIR/coroutine_storage_dead_unwind.rs:23:16: 23:18}, _2: ()) -> ()
yields ()
{
let mut _0: ();
@@ -78,7 +78,7 @@ yields ()
}
bb8: {
- generator_drop;
+ coroutine_drop;
}
bb9 (cleanup): {
diff --git a/tests/mir-opt/generator_storage_dead_unwind.rs b/tests/mir-opt/coroutine_storage_dead_unwind.rs
index 664f7ef67..253be1ff6 100644
--- a/tests/mir-opt/generator_storage_dead_unwind.rs
+++ b/tests/mir-opt/coroutine_storage_dead_unwind.rs
@@ -1,11 +1,12 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// Test that we generate StorageDead on unwind paths for generators.
+// Test that we generate StorageDead on unwind paths for coroutines.
//
// Basic block and local names can safely change, but the StorageDead statements
// should not go away.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
struct Foo(i32);
@@ -17,7 +18,7 @@ struct Bar(i32);
fn take<T>(_x: T) {}
-// EMIT_MIR generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
+// EMIT_MIR coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
fn main() {
let _gen = || {
let a = Foo(5);
diff --git a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir b/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
index ac7549f93..17b99c87c 100644
--- a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir
+++ b/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
@@ -1,10 +1,10 @@
-// MIR for `main::{closure#0}` 0 generator_resume
-/* generator_layout = GeneratorLayout {
+// MIR for `main::{closure#0}` 0 coroutine_resume
+/* coroutine_layout = CoroutineLayout {
field_tys: {
- _0: GeneratorSavedTy {
+ _0: CoroutineSavedTy {
ty: HasDrop,
source_info: SourceInfo {
- span: $DIR/generator_tiny.rs:20:13: 20:15 (#0),
+ span: $DIR/coroutine_tiny.rs:21:13: 21:15 (#0),
scope: scope[0],
},
ignore_for_traits: false,
@@ -21,9 +21,9 @@
},
} */
-fn main::{closure#0}(_1: Pin<&mut {generator@$DIR/generator_tiny.rs:19:16: 19:24}>, _2: u8) -> GeneratorState<(), ()> {
+fn main::{closure#0}(_1: Pin<&mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24}>, _2: u8) -> CoroutineState<(), ()> {
debug _x => _10;
- let mut _0: std::ops::GeneratorState<(), ()>;
+ let mut _0: std::ops::CoroutineState<(), ()>;
let _3: HasDrop;
let mut _4: !;
let mut _5: ();
@@ -34,18 +34,18 @@ fn main::{closure#0}(_1: Pin<&mut {generator@$DIR/generator_tiny.rs:19:16: 19:24
let _10: u8;
let mut _11: u32;
scope 1 {
- debug _d => (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop);
+ debug _d => (((*(_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24})) as variant#3).0: HasDrop);
}
bb0: {
- _11 = discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})));
+ _11 = discriminant((*(_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24})));
switchInt(move _11) -> [0: bb1, 3: bb5, otherwise: bb6];
}
bb1: {
_10 = move _2;
nop;
- (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop) = HasDrop;
+ (((*(_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24})) as variant#3).0: HasDrop) = HasDrop;
StorageLive(_4);
goto -> bb2;
}
@@ -54,8 +54,8 @@ fn main::{closure#0}(_1: Pin<&mut {generator@$DIR/generator_tiny.rs:19:16: 19:24
StorageLive(_6);
StorageLive(_7);
_7 = ();
- _0 = GeneratorState::<(), ()>::Yielded(move _7);
- discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24}))) = 3;
+ _0 = CoroutineState::<(), ()>::Yielded(move _7);
+ discriminant((*(_1.0: &mut {coroutine@$DIR/coroutine_tiny.rs:20:16: 20:24}))) = 3;
return;
}
diff --git a/tests/mir-opt/generator_tiny.rs b/tests/mir-opt/coroutine_tiny.rs
index 7dad63a61..0fd785b28 100644
--- a/tests/mir-opt/generator_tiny.rs
+++ b/tests/mir-opt/coroutine_tiny.rs
@@ -1,10 +1,11 @@
-//! Tests that generators that cannot return or unwind don't have unnecessary
+// skip-filecheck
+//! Tests that coroutines that cannot return or unwind don't have unnecessary
//! panic branches.
// compile-flags: -C panic=abort
// no-prefer-dynamic
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
struct HasDrop;
@@ -14,7 +15,7 @@ impl Drop for HasDrop {
fn callee() {}
-// EMIT_MIR generator_tiny.main-{closure#0}.generator_resume.0.mir
+// EMIT_MIR coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
fn main() {
let _gen = |_x: u8| {
let _d = HasDrop;
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.rs b/tests/mir-opt/dataflow-const-prop/array_index.rs
index ddb3646ca..3d420f930 100644
--- a/tests/mir-opt/dataflow-const-prop/array_index.rs
+++ b/tests/mir-opt/dataflow-const-prop/array_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
index 9e911e85b..2605c7019 100644
--- a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
+++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR boolean_identities.test.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/cast.rs b/tests/mir-opt/dataflow-const-prop/cast.rs
index 484403f7f..c87872609 100644
--- a/tests/mir-opt/dataflow-const-prop/cast.rs
+++ b/tests/mir-opt/dataflow-const-prop/cast.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR cast.main.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff
index 2f1a70f32..4569ffe48 100644
--- a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff
@@ -43,7 +43,7 @@
- _6 = CheckedAdd(_4, _5);
- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind unreachable];
+ _5 = const 2_i32;
-+ _6 = CheckedAdd(const 1_i32, const 2_i32);
++ _6 = const (3_i32, false);
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> [success: bb1, unwind unreachable];
}
@@ -60,7 +60,7 @@
- _10 = CheckedAdd(_9, const 1_i32);
- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind unreachable];
+ _9 = const i32::MAX;
-+ _10 = CheckedAdd(const i32::MAX, const 1_i32);
++ _10 = const (i32::MIN, true);
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind unreachable];
}
@@ -76,5 +76,13 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 80 01 __ __ __ │ .....░░░
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 03 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff
index 0d8a9aca3..aa7e404eb 100644
--- a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff
@@ -43,7 +43,7 @@
- _6 = CheckedAdd(_4, _5);
- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind continue];
+ _5 = const 2_i32;
-+ _6 = CheckedAdd(const 1_i32, const 2_i32);
++ _6 = const (3_i32, false);
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> [success: bb1, unwind continue];
}
@@ -60,7 +60,7 @@
- _10 = CheckedAdd(_9, const 1_i32);
- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind continue];
+ _9 = const i32::MAX;
-+ _10 = CheckedAdd(const i32::MAX, const 1_i32);
++ _10 = const (i32::MIN, true);
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind continue];
}
@@ -76,5 +76,13 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 80 01 __ __ __ │ .....░░░
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 03 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/dataflow-const-prop/checked.rs b/tests/mir-opt/dataflow-const-prop/checked.rs
index 1c301460f..f7fac8890 100644
--- a/tests/mir-opt/dataflow-const-prop/checked.rs
+++ b/tests/mir-opt/dataflow-const-prop/checked.rs
@@ -1,6 +1,7 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// skip-filecheck
// unit-test: DataflowConstProp
// compile-flags: -Coverflow-checks=on
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR checked.main.DataflowConstProp.diff
#[allow(arithmetic_overflow)]
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff
index b9b46f16a..9bfd46231 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-abort.diff
@@ -87,13 +87,13 @@
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
-+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
-+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_3);
- _1 = A { foo: move _2 };
-+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
@@ -105,15 +105,15 @@
}
+ }
+
-+ alloc11 (size: 8, align: 4) {
++ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
-+ alloc10 (size: 8, align: 4) {
++ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
}
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff
index 93b18f23e..dba50b142 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff
@@ -87,13 +87,13 @@
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
-+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
-+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_3);
- _1 = A { foo: move _2 };
-+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
@@ -109,15 +109,15 @@
}
+ }
+
-+ alloc11 (size: 8, align: 4) {
++ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
-+ alloc10 (size: 8, align: 4) {
++ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
}
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff
index 3d3af6285..33fe4628d 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff
@@ -87,13 +87,13 @@
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
-+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
-+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_3);
- _1 = A { foo: move _2 };
-+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
@@ -105,15 +105,15 @@
}
+ }
+
-+ alloc11 (size: 16, align: 8) {
++ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
-+ alloc10 (size: 16, align: 8) {
++ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
-+ alloc7 (size: 16, align: 8) {
++ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff
index 1933f9baf..b2d561911 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff
@@ -87,13 +87,13 @@
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
-+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
++ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
-+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
++ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_3);
- _1 = A { foo: move _2 };
-+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
++ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
@@ -109,15 +109,15 @@
}
+ }
+
-+ alloc11 (size: 16, align: 8) {
++ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
-+ alloc10 (size: 16, align: 8) {
++ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
-+ alloc7 (size: 16, align: 8) {
++ ALLOC0 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
index 7862c23da..1751b0de2 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff
@@ -81,11 +81,11 @@
StorageDead(_6);
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
- _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_3);
- _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
@@ -97,15 +97,15 @@
}
}
- alloc11 (size: 8, align: 4) {
+ ALLOC2 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
- alloc10 (size: 8, align: 4) {
+ ALLOC1 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
- alloc7 (size: 8, align: 4) {
+ ALLOC0 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
index bd4150ebb..858a9d33d 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff
@@ -81,11 +81,11 @@
StorageDead(_6);
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
- _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_3);
- _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
@@ -101,15 +101,15 @@
}
}
- alloc11 (size: 8, align: 4) {
+ ALLOC2 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
- alloc10 (size: 8, align: 4) {
+ ALLOC1 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
- alloc7 (size: 8, align: 4) {
+ ALLOC0 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
index 312fc7b7a..517070420 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff
@@ -81,11 +81,11 @@
StorageDead(_6);
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
- _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_3);
- _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind unreachable];
@@ -97,15 +97,15 @@
}
}
- alloc11 (size: 16, align: 8) {
+ ALLOC2 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
- alloc10 (size: 16, align: 8) {
+ ALLOC1 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
- alloc7 (size: 16, align: 8) {
+ ALLOC0 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
index 3227d8b84..9141a6c67 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff
@@ -81,11 +81,11 @@
StorageDead(_6);
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
StorageDead(_4);
- _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
StorageDead(_3);
- _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ _1 = A { foo: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
StorageDead(_2);
_0 = const ();
drop(_1) -> [return: bb1, unwind: bb2];
@@ -101,15 +101,15 @@
}
}
- alloc11 (size: 16, align: 8) {
+ ALLOC2 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
- alloc10 (size: 16, align: 8) {
+ ALLOC1 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
- alloc7 (size: 16, align: 8) {
+ ALLOC0 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
index dfeccd3eb..1bb052736 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// compile-flags: -Zmir-enable-passes=+ConstProp,+Inline
// ignore-debug assertions change the output MIR
diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs
index 5a10e9e88..e35c0e6e8 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.rs
+++ b/tests/mir-opt/dataflow-const-prop/enum.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
index 3946e7c7d..798b0c041 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
@@ -23,7 +23,8 @@
bb0: {
StorageLive(_1);
- _1 = E::V1(const 0_i32);
+- _1 = E::V1(const 0_i32);
++ _1 = const E::V1(0_i32);
StorageLive(_2);
- _3 = discriminant(_1);
- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
@@ -59,5 +60,9 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
}
diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
index 3946e7c7d..798b0c041 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
@@ -23,7 +23,8 @@
bb0: {
StorageLive(_1);
- _1 = E::V1(const 0_i32);
+- _1 = E::V1(const 0_i32);
++ _1 = const E::V1(0_i32);
StorageLive(_2);
- _3 = discriminant(_1);
- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
@@ -59,5 +60,9 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
}
diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
index ae8b44c95..d502b1982 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
@@ -43,8 +43,9 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &E};
- _1 = (*_2);
+ _2 = const {ALLOC1: &E};
+- _1 = (*_2);
++ _1 = const E::V1(0_i32);
StorageDead(_2);
StorageLive(_3);
- _4 = discriminant(_1);
@@ -78,7 +79,7 @@
bb4: {
StorageLive(_7);
StorageLive(_8);
- _8 = const {alloc2: &&E};
+ _8 = const {ALLOC2: &&E};
_7 = (*_8);
StorageDead(_8);
StorageLive(_9);
@@ -110,17 +111,21 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
}
- alloc2 (static: RC, size: 4, align: 4) {
- ╾─alloc14─╼ │ ╾──╼
+ ALLOC2 (static: RC, size: 4, align: 4) {
+ ╾ALLOC0╼ │ ╾──╼
}
- alloc14 (size: 8, align: 4) {
+ ALLOC0 (size: 8, align: 4) {
01 00 00 00 04 00 00 00 │ ........
}
- alloc1 (static: statics::C, size: 8, align: 4) {
+ ALLOC1 (static: statics::C, size: 8, align: 4) {
00 00 00 00 00 00 00 00 │ ........
}
diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
index 63799b3ba..5d69572b5 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
@@ -43,8 +43,9 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &E};
- _1 = (*_2);
+ _2 = const {ALLOC1: &E};
+- _1 = (*_2);
++ _1 = const E::V1(0_i32);
StorageDead(_2);
StorageLive(_3);
- _4 = discriminant(_1);
@@ -78,7 +79,7 @@
bb4: {
StorageLive(_7);
StorageLive(_8);
- _8 = const {alloc2: &&E};
+ _8 = const {ALLOC2: &&E};
_7 = (*_8);
StorageDead(_8);
StorageLive(_9);
@@ -110,17 +111,21 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
}
- alloc2 (static: RC, size: 8, align: 8) {
- ╾───────alloc14───────╼ │ ╾──────╼
+ ALLOC2 (static: RC, size: 8, align: 8) {
+ ╾ALLOC0╼ │ ╾──────╼
}
- alloc14 (size: 8, align: 4) {
+ ALLOC0 (size: 8, align: 4) {
01 00 00 00 04 00 00 00 │ ........
}
- alloc1 (static: statics::C, size: 8, align: 4) {
+ ALLOC1 (static: statics::C, size: 8, align: 4) {
00 00 00 00 00 00 00 00 │ ........
}
diff --git a/tests/mir-opt/dataflow-const-prop/if.rs b/tests/mir-opt/dataflow-const-prop/if.rs
index 34fc35790..72aabbccf 100644
--- a/tests/mir-opt/dataflow-const-prop/if.rs
+++ b/tests/mir-opt/dataflow-const-prop/if.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR if.main.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff
index 9a68d3b51..2d4591ea2 100644
--- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff
@@ -20,20 +20,26 @@
_2 = const u8::MAX;
StorageLive(_3);
_3 = const 1_u8;
+ StorageLive(_4);
- _4 = CheckedAdd(_2, _3);
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
-+ _4 = CheckedAdd(const u8::MAX, const 1_u8);
++ _4 = const (0_u8, true);
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable];
}
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
+ StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
_0 = const ();
return;
}
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 00 01 │ ..
}
diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff
index c1d281ab7..e99ac782a 100644
--- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff
@@ -20,20 +20,26 @@
_2 = const u8::MAX;
StorageLive(_3);
_3 = const 1_u8;
+ StorageLive(_4);
- _4 = CheckedAdd(_2, _3);
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
-+ _4 = CheckedAdd(const u8::MAX, const 1_u8);
++ _4 = const (0_u8, true);
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue];
}
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
+ StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
_0 = const ();
return;
}
++ }
++
++ ALLOC0 (size: 2, align: 1) {
++ 00 01 │ ..
}
diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs
index 964c58966..664cbcb2c 100644
--- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs
+++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
// compile-flags: -Zmir-enable-passes=+Inline
diff --git a/tests/mir-opt/dataflow-const-prop/issue_81605.rs b/tests/mir-opt/dataflow-const-prop/issue_81605.rs
index d75e2a28b..7c5eceb8a 100644
--- a/tests/mir-opt/dataflow-const-prop/issue_81605.rs
+++ b/tests/mir-opt/dataflow-const-prop/issue_81605.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR issue_81605.f.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.rs b/tests/mir-opt/dataflow-const-prop/large_array_index.rs
index af13c7d10..d611a54ba 100644
--- a/tests/mir-opt/dataflow-const-prop/large_array_index.rs
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
index dbea14804..16a45c8e9 100644
--- a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
+++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff
index c61414b65..f8f891750 100644
--- a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff
@@ -27,7 +27,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
-- _2 = OffsetOf(Alpha, [0]);
+- _2 = OffsetOf(Alpha, [(0, 0)]);
- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
+ _2 = const 4_usize;
+ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind unreachable];
@@ -37,7 +37,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
-- _4 = OffsetOf(Alpha, [1]);
+- _4 = OffsetOf(Alpha, [(0, 1)]);
- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
+ _4 = const 0_usize;
+ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind unreachable];
@@ -47,7 +47,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Alpha, [2, 0]);
+- _6 = OffsetOf(Alpha, [(0, 2), (0, 0)]);
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
+ _6 = const 2_usize;
+ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind unreachable];
@@ -57,7 +57,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Alpha, [2, 1]);
+- _8 = OffsetOf(Alpha, [(0, 2), (0, 1)]);
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
+ _8 = const 3_usize;
+ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind unreachable];
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff
index 0c3939a34..d4f8cb667 100644
--- a/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff
@@ -27,7 +27,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
-- _2 = OffsetOf(Alpha, [0]);
+- _2 = OffsetOf(Alpha, [(0, 0)]);
- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
+ _2 = const 4_usize;
+ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind continue];
@@ -37,7 +37,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
-- _4 = OffsetOf(Alpha, [1]);
+- _4 = OffsetOf(Alpha, [(0, 1)]);
- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
+ _4 = const 0_usize;
+ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind continue];
@@ -47,7 +47,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Alpha, [2, 0]);
+- _6 = OffsetOf(Alpha, [(0, 2), (0, 0)]);
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
+ _6 = const 2_usize;
+ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind continue];
@@ -57,7 +57,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Alpha, [2, 1]);
+- _8 = OffsetOf(Alpha, [(0, 2), (0, 1)]);
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
+ _8 = const 3_usize;
+ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind continue];
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff
index d54d46870..7f166e4fa 100644
--- a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff
@@ -27,7 +27,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = OffsetOf(Gamma<T>, [0]);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
}
@@ -35,7 +35,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = OffsetOf(Gamma<T>, [1]);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
}
@@ -43,7 +43,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Delta<T>, [1]);
+- _6 = OffsetOf(Delta<T>, [(0, 1)]);
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
+ _6 = const 0_usize;
+ _5 = must_use::<usize>(const 0_usize) -> [return: bb3, unwind unreachable];
@@ -53,7 +53,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Delta<T>, [2]);
+- _8 = OffsetOf(Delta<T>, [(0, 2)]);
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
+ _8 = const 2_usize;
+ _7 = must_use::<usize>(const 2_usize) -> [return: bb4, unwind unreachable];
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff
index 6032a2274..38ad6f798 100644
--- a/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff
@@ -27,7 +27,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = OffsetOf(Gamma<T>, [0]);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
}
@@ -35,7 +35,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = OffsetOf(Gamma<T>, [1]);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
}
@@ -43,7 +43,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Delta<T>, [1]);
+- _6 = OffsetOf(Delta<T>, [(0, 1)]);
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
+ _6 = const 0_usize;
+ _5 = must_use::<usize>(const 0_usize) -> [return: bb3, unwind continue];
@@ -53,7 +53,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Delta<T>, [2]);
+- _8 = OffsetOf(Delta<T>, [(0, 2)]);
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
+ _8 = const 2_usize;
+ _7 = must_use::<usize>(const 2_usize) -> [return: bb4, unwind continue];
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.rs b/tests/mir-opt/dataflow-const-prop/offset_of.rs
index ccc90790e..e71b3f59e 100644
--- a/tests/mir-opt/dataflow-const-prop/offset_of.rs
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs
index 4ac0a5b32..2851c0590 100644
--- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs
+++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.rs b/tests/mir-opt/dataflow-const-prop/repeat.rs
index 9fa353e44..b82448194 100644
--- a/tests/mir-opt/dataflow-const-prop/repeat.rs
+++ b/tests/mir-opt/dataflow-const-prop/repeat.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff
index 4b1a8d932..98bd40ab2 100644
--- a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff
@@ -17,7 +17,8 @@
bb0: {
StorageLive(_1);
- _1 = I32(const 0_i32);
+- _1 = I32(const 0_i32);
++ _1 = const I32(0_i32);
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
@@ -31,12 +32,20 @@
StorageDead(_5);
StorageDead(_4);
- _2 = I32(move _3);
-+ _2 = I32(const 0_i32);
++ _2 = const I32(0_i32);
StorageDead(_3);
_0 = const ();
StorageDead(_2);
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 4, align: 4) {
++ 00 00 00 00 │ ....
++ }
++
++ ALLOC1 (size: 4, align: 4) {
++ 00 00 00 00 │ ....
}
diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs
index 4ce0ca4df..8cbed6fbb 100644
--- a/tests/mir-opt/dataflow-const-prop/repr_transparent.rs
+++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// The struct has scalar ABI, but is not a scalar type.
diff --git a/tests/mir-opt/dataflow-const-prop/self_assign.rs b/tests/mir-opt/dataflow-const-prop/self_assign.rs
index 8de2195f9..c5866c4a9 100644
--- a/tests/mir-opt/dataflow-const-prop/self_assign.rs
+++ b/tests/mir-opt/dataflow-const-prop/self_assign.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR self_assign.main.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs b/tests/mir-opt/dataflow-const-prop/self_assign_add.rs
index e32827624..cfe1458e4 100644
--- a/tests/mir-opt/dataflow-const-prop/self_assign_add.rs
+++ b/tests/mir-opt/dataflow-const-prop/self_assign_add.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR self_assign_add.main.DataflowConstProp.diff
diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs
index 87842f347..68aff5286 100644
--- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs
+++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// This attempts to modify `x.1` via a pointer derived from `addr_of_mut!(x.0)`.
// According to Miri, that is UB. However, T-opsem has not finalized that
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs
index 41367e484..86266ef5d 100644
--- a/tests/mir-opt/dataflow-const-prop/slice_len.rs
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
// compile-flags: -Zmir-enable-passes=+InstSimplify
diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
index 2de6ba307..8499d0a89 100644
--- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
@@ -7,13 +7,24 @@
let mut _3: i32;
let mut _5: i32;
let mut _6: i32;
- let mut _11: BigStruct;
- let mut _16: &&BigStruct;
- let mut _17: &BigStruct;
- let mut _18: &BigStruct;
- let mut _19: &BigStruct;
- let mut _20: &BigStruct;
- let mut _21: &BigStruct;
+ let mut _10: SmallStruct;
+ let mut _14: &&SmallStruct;
+ let mut _16: f32;
+ let mut _17: std::option::Option<S>;
+ let mut _18: &[f32];
+ let mut _22: BigStruct;
+ let mut _26: &&BigStruct;
+ let mut _28: f32;
+ let mut _29: std::option::Option<S>;
+ let mut _30: &[f32];
+ let mut _31: &SmallStruct;
+ let mut _32: &SmallStruct;
+ let mut _33: &SmallStruct;
+ let mut _34: &SmallStruct;
+ let mut _35: &BigStruct;
+ let mut _36: &BigStruct;
+ let mut _37: &BigStruct;
+ let mut _38: &BigStruct;
scope 1 {
debug s => _1;
let _2: i32;
@@ -22,24 +33,44 @@
let _4: i32;
scope 3 {
debug b => _4;
- let _7: S;
- let _8: u8;
- let _9: f32;
- let _10: S;
+ let _7: f32;
+ let _8: std::option::Option<S>;
+ let _9: &[f32];
scope 4 {
debug a => _7;
debug b => _8;
debug c => _9;
- debug d => _10;
- let _12: S;
- let _13: u8;
- let _14: f32;
- let _15: S;
+ let _11: f32;
+ let _12: std::option::Option<S>;
+ let _13: &[f32];
scope 5 {
- debug a => _12;
- debug b => _13;
- debug c => _14;
- debug d => _15;
+ debug a => _11;
+ debug b => _12;
+ debug c => _13;
+ let _15: SmallStruct;
+ scope 6 {
+ debug ss => _15;
+ let _19: f32;
+ let _20: std::option::Option<S>;
+ let _21: &[f32];
+ scope 7 {
+ debug a => _19;
+ debug b => _20;
+ debug c => _21;
+ let _23: f32;
+ let _24: std::option::Option<S>;
+ let _25: &[f32];
+ scope 8 {
+ debug a => _23;
+ debug b => _24;
+ debug c => _25;
+ let _27: BigStruct;
+ scope 9 {
+ debug bs => _27;
+ }
+ }
+ }
+ }
}
}
}
@@ -48,7 +79,8 @@
bb0: {
StorageLive(_1);
- _1 = S(const 1_i32);
+- _1 = S(const 1_i32);
++ _1 = const S(1_i32);
StorageLive(_2);
StorageLive(_3);
- _3 = (_1.0: i32);
@@ -68,47 +100,95 @@
+ _4 = const 6_i32;
StorageDead(_6);
StorageDead(_5);
- StorageLive(_11);
- _11 = const _;
+ StorageLive(_10);
+ _10 = const _;
StorageLive(_7);
-- _7 = (_11.0: S);
-+ _7 = const S(1_i32);
+- _7 = (_10.0: f32);
++ _7 = const 4f32;
StorageLive(_8);
-- _8 = (_11.1: u8);
-+ _8 = const 5_u8;
+- _8 = (_10.1: std::option::Option<S>);
++ _8 = const Option::<S>::Some(S(1_i32));
StorageLive(_9);
-- _9 = (_11.2: f32);
-+ _9 = const 7f32;
- StorageLive(_10);
-- _10 = (_11.3: S);
-+ _10 = const S(13_i32);
- StorageDead(_11);
- StorageLive(_16);
- _16 = const {alloc1: &&BigStruct};
- _17 = deref_copy (*_16);
+ _9 = (_10.2: &[f32]);
+ StorageDead(_10);
+ StorageLive(_14);
+ _14 = const {ALLOC4: &&SmallStruct};
+ _31 = deref_copy (*_14);
+ StorageLive(_11);
+ _32 = deref_copy (*_14);
+- _11 = ((*_32).0: f32);
++ _11 = const 9f32;
StorageLive(_12);
- _18 = deref_copy (*_16);
-- _12 = ((*_18).0: S);
-+ _12 = const S(1_i32);
+ _33 = deref_copy (*_14);
+ _12 = ((*_33).1: std::option::Option<S>);
StorageLive(_13);
- _19 = deref_copy (*_16);
-- _13 = ((*_19).1: u8);
-+ _13 = const 5_u8;
- StorageLive(_14);
- _20 = deref_copy (*_16);
-- _14 = ((*_20).2: f32);
-+ _14 = const 7f32;
+ _34 = deref_copy (*_14);
+ _13 = ((*_34).2: &[f32]);
+ StorageDead(_14);
StorageLive(_15);
- _21 = deref_copy (*_16);
-- _15 = ((*_21).3: S);
-+ _15 = const S(13_i32);
+ StorageLive(_16);
+- _16 = _11;
++ _16 = const 9f32;
+ StorageLive(_17);
+ _17 = _12;
+ StorageLive(_18);
+ _18 = _13;
+- _15 = SmallStruct(move _16, move _17, move _18);
++ _15 = SmallStruct(const 9f32, move _17, move _18);
+ StorageDead(_18);
+ StorageDead(_17);
StorageDead(_16);
+ StorageLive(_22);
+ _22 = const _;
+ StorageLive(_19);
+- _19 = (_22.0: f32);
++ _19 = const 25f32;
+ StorageLive(_20);
+ _20 = (_22.1: std::option::Option<S>);
+ StorageLive(_21);
+ _21 = (_22.2: &[f32]);
+ StorageDead(_22);
+ StorageLive(_26);
+ _26 = const {ALLOC5: &&BigStruct};
+ _35 = deref_copy (*_26);
+ StorageLive(_23);
+ _36 = deref_copy (*_26);
+- _23 = ((*_36).0: f32);
++ _23 = const 82f32;
+ StorageLive(_24);
+ _37 = deref_copy (*_26);
+- _24 = ((*_37).1: std::option::Option<S>);
++ _24 = const Option::<S>::Some(S(35_i32));
+ StorageLive(_25);
+ _38 = deref_copy (*_26);
+ _25 = ((*_38).2: &[f32]);
+ StorageDead(_26);
+ StorageLive(_27);
+ StorageLive(_28);
+- _28 = _23;
++ _28 = const 82f32;
+ StorageLive(_29);
+- _29 = _24;
++ _29 = const Option::<S>::Some(S(35_i32));
+ StorageLive(_30);
+ _30 = _25;
+- _27 = BigStruct(move _28, move _29, move _30);
++ _27 = BigStruct(const 82f32, const Option::<S>::Some(S(35_i32)), move _30);
+ StorageDead(_30);
+ StorageDead(_29);
+ StorageDead(_28);
_0 = const ();
+ StorageDead(_27);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
StorageDead(_15);
- StorageDead(_14);
StorageDead(_13);
StorageDead(_12);
- StorageDead(_10);
+ StorageDead(_11);
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
@@ -117,13 +197,51 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC6 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC7 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC8 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC9 (size: 8, align: 4) {
++ 01 00 00 00 01 00 00 00 │ ........
++ }
++
++ ALLOC10 (size: 4, align: 4) {
++ 01 00 00 00 │ ....
+ }
+
+ ALLOC5 (static: BIG_STAT, size: 4, align: 4) {
+ ╾ALLOC0╼ │ ╾──╼
+ }
+
+ ALLOC0 (size: 20, align: 4) {
+ 0x00 │ 01 00 00 00 23 00 00 00 ╾ALLOC1╼ 02 00 00 00 │ ....#...╾──╼....
+ 0x10 │ 00 00 a4 42 │ ...B
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 00 00 34 42 00 00 90 42 │ ..4B...B
+ }
+
+ ALLOC4 (static: SMALL_STAT, size: 4, align: 4) {
+ ╾ALLOC2╼ │ ╾──╼
}
- alloc1 (static: STAT, size: 4, align: 4) {
- ╾─alloc15─╼ │ ╾──╼
+ ALLOC2 (size: 20, align: 4) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC3╼ 01 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 10 41 │ ...A
}
- alloc15 (size: 16, align: 4) {
- 01 00 00 00 00 00 e0 40 0d 00 00 00 05 __ __ __ │ .......@.....░░░
+ ALLOC3 (size: 4, align: 4) {
+ 00 00 50 41 │ ..PA
}
diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
index 71a28f216..01ec3f623 100644
--- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
@@ -7,13 +7,24 @@
let mut _3: i32;
let mut _5: i32;
let mut _6: i32;
- let mut _11: BigStruct;
- let mut _16: &&BigStruct;
- let mut _17: &BigStruct;
- let mut _18: &BigStruct;
- let mut _19: &BigStruct;
- let mut _20: &BigStruct;
- let mut _21: &BigStruct;
+ let mut _10: SmallStruct;
+ let mut _14: &&SmallStruct;
+ let mut _16: f32;
+ let mut _17: std::option::Option<S>;
+ let mut _18: &[f32];
+ let mut _22: BigStruct;
+ let mut _26: &&BigStruct;
+ let mut _28: f32;
+ let mut _29: std::option::Option<S>;
+ let mut _30: &[f32];
+ let mut _31: &SmallStruct;
+ let mut _32: &SmallStruct;
+ let mut _33: &SmallStruct;
+ let mut _34: &SmallStruct;
+ let mut _35: &BigStruct;
+ let mut _36: &BigStruct;
+ let mut _37: &BigStruct;
+ let mut _38: &BigStruct;
scope 1 {
debug s => _1;
let _2: i32;
@@ -22,24 +33,44 @@
let _4: i32;
scope 3 {
debug b => _4;
- let _7: S;
- let _8: u8;
- let _9: f32;
- let _10: S;
+ let _7: f32;
+ let _8: std::option::Option<S>;
+ let _9: &[f32];
scope 4 {
debug a => _7;
debug b => _8;
debug c => _9;
- debug d => _10;
- let _12: S;
- let _13: u8;
- let _14: f32;
- let _15: S;
+ let _11: f32;
+ let _12: std::option::Option<S>;
+ let _13: &[f32];
scope 5 {
- debug a => _12;
- debug b => _13;
- debug c => _14;
- debug d => _15;
+ debug a => _11;
+ debug b => _12;
+ debug c => _13;
+ let _15: SmallStruct;
+ scope 6 {
+ debug ss => _15;
+ let _19: f32;
+ let _20: std::option::Option<S>;
+ let _21: &[f32];
+ scope 7 {
+ debug a => _19;
+ debug b => _20;
+ debug c => _21;
+ let _23: f32;
+ let _24: std::option::Option<S>;
+ let _25: &[f32];
+ scope 8 {
+ debug a => _23;
+ debug b => _24;
+ debug c => _25;
+ let _27: BigStruct;
+ scope 9 {
+ debug bs => _27;
+ }
+ }
+ }
+ }
}
}
}
@@ -48,7 +79,8 @@
bb0: {
StorageLive(_1);
- _1 = S(const 1_i32);
+- _1 = S(const 1_i32);
++ _1 = const S(1_i32);
StorageLive(_2);
StorageLive(_3);
- _3 = (_1.0: i32);
@@ -68,47 +100,95 @@
+ _4 = const 6_i32;
StorageDead(_6);
StorageDead(_5);
- StorageLive(_11);
- _11 = const _;
+ StorageLive(_10);
+ _10 = const _;
StorageLive(_7);
-- _7 = (_11.0: S);
-+ _7 = const S(1_i32);
+- _7 = (_10.0: f32);
++ _7 = const 4f32;
StorageLive(_8);
-- _8 = (_11.1: u8);
-+ _8 = const 5_u8;
+- _8 = (_10.1: std::option::Option<S>);
++ _8 = const Option::<S>::Some(S(1_i32));
StorageLive(_9);
-- _9 = (_11.2: f32);
-+ _9 = const 7f32;
- StorageLive(_10);
-- _10 = (_11.3: S);
-+ _10 = const S(13_i32);
- StorageDead(_11);
- StorageLive(_16);
- _16 = const {alloc1: &&BigStruct};
- _17 = deref_copy (*_16);
+ _9 = (_10.2: &[f32]);
+ StorageDead(_10);
+ StorageLive(_14);
+ _14 = const {ALLOC4: &&SmallStruct};
+ _31 = deref_copy (*_14);
+ StorageLive(_11);
+ _32 = deref_copy (*_14);
+- _11 = ((*_32).0: f32);
++ _11 = const 9f32;
StorageLive(_12);
- _18 = deref_copy (*_16);
-- _12 = ((*_18).0: S);
-+ _12 = const S(1_i32);
+ _33 = deref_copy (*_14);
+ _12 = ((*_33).1: std::option::Option<S>);
StorageLive(_13);
- _19 = deref_copy (*_16);
-- _13 = ((*_19).1: u8);
-+ _13 = const 5_u8;
- StorageLive(_14);
- _20 = deref_copy (*_16);
-- _14 = ((*_20).2: f32);
-+ _14 = const 7f32;
+ _34 = deref_copy (*_14);
+ _13 = ((*_34).2: &[f32]);
+ StorageDead(_14);
StorageLive(_15);
- _21 = deref_copy (*_16);
-- _15 = ((*_21).3: S);
-+ _15 = const S(13_i32);
+ StorageLive(_16);
+- _16 = _11;
++ _16 = const 9f32;
+ StorageLive(_17);
+ _17 = _12;
+ StorageLive(_18);
+ _18 = _13;
+- _15 = SmallStruct(move _16, move _17, move _18);
++ _15 = SmallStruct(const 9f32, move _17, move _18);
+ StorageDead(_18);
+ StorageDead(_17);
StorageDead(_16);
+ StorageLive(_22);
+ _22 = const _;
+ StorageLive(_19);
+- _19 = (_22.0: f32);
++ _19 = const 25f32;
+ StorageLive(_20);
+ _20 = (_22.1: std::option::Option<S>);
+ StorageLive(_21);
+ _21 = (_22.2: &[f32]);
+ StorageDead(_22);
+ StorageLive(_26);
+ _26 = const {ALLOC5: &&BigStruct};
+ _35 = deref_copy (*_26);
+ StorageLive(_23);
+ _36 = deref_copy (*_26);
+- _23 = ((*_36).0: f32);
++ _23 = const 82f32;
+ StorageLive(_24);
+ _37 = deref_copy (*_26);
+- _24 = ((*_37).1: std::option::Option<S>);
++ _24 = const Option::<S>::Some(S(35_i32));
+ StorageLive(_25);
+ _38 = deref_copy (*_26);
+ _25 = ((*_38).2: &[f32]);
+ StorageDead(_26);
+ StorageLive(_27);
+ StorageLive(_28);
+- _28 = _23;
++ _28 = const 82f32;
+ StorageLive(_29);
+- _29 = _24;
++ _29 = const Option::<S>::Some(S(35_i32));
+ StorageLive(_30);
+ _30 = _25;
+- _27 = BigStruct(move _28, move _29, move _30);
++ _27 = BigStruct(const 82f32, const Option::<S>::Some(S(35_i32)), move _30);
+ StorageDead(_30);
+ StorageDead(_29);
+ StorageDead(_28);
_0 = const ();
+ StorageDead(_27);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_19);
StorageDead(_15);
- StorageDead(_14);
StorageDead(_13);
StorageDead(_12);
- StorageDead(_10);
+ StorageDead(_11);
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
@@ -117,13 +197,51 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC6 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC7 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC8 (size: 8, align: 4) {
++ 01 00 00 00 23 00 00 00 │ ....#...
++ }
++
++ ALLOC9 (size: 8, align: 4) {
++ 01 00 00 00 01 00 00 00 │ ........
++ }
++
++ ALLOC10 (size: 4, align: 4) {
++ 01 00 00 00 │ ....
+ }
+
+ ALLOC5 (static: BIG_STAT, size: 8, align: 8) {
+ ╾ALLOC0╼ │ ╾──────╼
+ }
+
+ ALLOC0 (size: 32, align: 8) {
+ 0x00 │ 01 00 00 00 23 00 00 00 ╾ALLOC1╼ │ ....#...╾──────╼
+ 0x10 │ 02 00 00 00 00 00 00 00 00 00 a4 42 __ __ __ __ │ ...........B░░░░
+ }
+
+ ALLOC1 (size: 8, align: 4) {
+ 00 00 34 42 00 00 90 42 │ ..4B...B
+ }
+
+ ALLOC4 (static: SMALL_STAT, size: 8, align: 8) {
+ ╾ALLOC2╼ │ ╾──────╼
}
- alloc1 (static: STAT, size: 8, align: 8) {
- ╾───────alloc15───────╼ │ ╾──────╼
+ ALLOC2 (size: 32, align: 8) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC3╼ │ ....░░░░╾──────╼
+ 0x10 │ 01 00 00 00 00 00 00 00 00 00 10 41 __ __ __ __ │ ...........A░░░░
}
- alloc15 (size: 16, align: 4) {
- 01 00 00 00 00 00 e0 40 0d 00 00 00 05 __ __ __ │ .......@.....░░░
+ ALLOC3 (size: 4, align: 4) {
+ 00 00 50 41 │ ..PA
}
diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/dataflow-const-prop/struct.rs
index e92a1676d..043981a29 100644
--- a/tests/mir-opt/dataflow-const-prop/struct.rs
+++ b/tests/mir-opt/dataflow-const-prop/struct.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
@@ -5,7 +6,10 @@
struct S(i32);
#[derive(Copy, Clone)]
-struct BigStruct(S, u8, f32, S);
+struct SmallStruct(f32, Option<S>, &'static [f32]);
+
+#[derive(Copy, Clone)]
+struct BigStruct(f32, Option<S>, &'static [f32]);
// EMIT_MIR struct.main.DataflowConstProp.diff
fn main() {
@@ -14,9 +18,21 @@ fn main() {
s.0 = 3;
let b = a + s.0;
- const VAL: BigStruct = BigStruct(S(1), 5, 7., S(13));
- let BigStruct(a, b, c, d) = VAL;
+ const SMALL_VAL: SmallStruct = SmallStruct(4., Some(S(1)), &[]);
+ let SmallStruct(a, b, c) = SMALL_VAL;
+
+ static SMALL_STAT: &SmallStruct = &SmallStruct(9., None, &[13.]);
+ let SmallStruct(a, b, c) = *SMALL_STAT;
+
+ let ss = SmallStruct(a, b, c);
+
+ const BIG_VAL: BigStruct = BigStruct(25., None, &[]);
+ let BigStruct(a, b, c) = BIG_VAL;
+
+ static BIG_STAT: &BigStruct = &BigStruct(82., Some(S(35)), &[45., 72.]);
+ let BigStruct(a, b, c) = *BIG_STAT;
- static STAT: &BigStruct = &BigStruct(S(1), 5, 7., S(13));
- let BigStruct(a, b, c, d) = *STAT;
+ // We arbitrarily limit the size of synthetized values to 4 pointers.
+ // `BigStruct` can be read, but we will keep a MIR aggregate for this.
+ let bs = BigStruct(a, b, c);
}
diff --git a/tests/mir-opt/dataflow-const-prop/terminator.rs b/tests/mir-opt/dataflow-const-prop/terminator.rs
index 114dbeca5..92a42f22c 100644
--- a/tests/mir-opt/dataflow-const-prop/terminator.rs
+++ b/tests/mir-opt/dataflow-const-prop/terminator.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.rs b/tests/mir-opt/dataflow-const-prop/transmute.rs
index c25e33ab0..bb85e4586 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.rs
+++ b/tests/mir-opt/dataflow-const-prop/transmute.rs
@@ -7,55 +7,77 @@ use std::mem::transmute;
// EMIT_MIR transmute.less_as_i8.DataflowConstProp.diff
pub fn less_as_i8() -> i8 {
+ // CHECK-LABEL: fn less_as_i8(
+ // FIXME-CHECK: _0 = const -1_i8;
unsafe { transmute(std::cmp::Ordering::Less) }
}
// EMIT_MIR transmute.from_char.DataflowConstProp.diff
pub fn from_char() -> i32 {
+ // CHECK-LABEL: fn from_char(
+ // CHECK: _0 = const 82_i32;
unsafe { transmute('R') }
}
// EMIT_MIR transmute.valid_char.DataflowConstProp.diff
pub fn valid_char() -> char {
+ // CHECK-LABEL: fn valid_char(
+ // CHECK: _0 = const 'R';
unsafe { transmute(0x52_u32) }
}
// EMIT_MIR transmute.invalid_char.DataflowConstProp.diff
pub unsafe fn invalid_char() -> char {
+ // CHECK-LABEL: fn invalid_char(
+ // CHECK: _0 = const {transmute(0x7fffffff): char};
unsafe { transmute(i32::MAX) }
}
// EMIT_MIR transmute.invalid_bool.DataflowConstProp.diff
pub unsafe fn invalid_bool() -> bool {
+ // CHECK-LABEL: fn invalid_bool(
+ // CHECK: _0 = const {transmute(0xff): bool};
unsafe { transmute(-1_i8) }
}
// EMIT_MIR transmute.undef_union_as_integer.DataflowConstProp.diff
pub unsafe fn undef_union_as_integer() -> u32 {
+ // CHECK-LABEL: fn undef_union_as_integer(
+ // CHECK: _1 = Union32 {
+ // CHECK: _0 = move _1 as u32 (Transmute);
union Union32 { value: u32, unit: () }
unsafe { transmute(Union32 { unit: () }) }
}
// EMIT_MIR transmute.unreachable_direct.DataflowConstProp.diff
pub unsafe fn unreachable_direct() -> ! {
+ // CHECK-LABEL: fn unreachable_direct(
+ // CHECK: = const ();
+ // CHECK: = const ZeroSized: Never;
let x: Never = unsafe { transmute(()) };
match x {}
}
// EMIT_MIR transmute.unreachable_ref.DataflowConstProp.diff
pub unsafe fn unreachable_ref() -> ! {
+ // CHECK-LABEL: fn unreachable_ref(
+ // CHECK: = const {0x1 as &Never};
let x: &Never = unsafe { transmute(1_usize) };
match *x {}
}
// EMIT_MIR transmute.unreachable_mut.DataflowConstProp.diff
pub unsafe fn unreachable_mut() -> ! {
+ // CHECK-LABEL: fn unreachable_mut(
+ // CHECK: = const {0x1 as &mut Never};
let x: &mut Never = unsafe { transmute(1_usize) };
match *x {}
}
// EMIT_MIR transmute.unreachable_box.DataflowConstProp.diff
pub unsafe fn unreachable_box() -> ! {
+ // CHECK-LABEL: fn unreachable_box(
+ // CHECK: = const Box::<Never>(
let x: Box<Never> = unsafe { transmute(1_usize) };
match *x {}
}
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff
index fc0634b1f..fb28aa8f6 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff
@@ -11,8 +11,10 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
- _1 = Union32 { value: move _2 };
+- _2 = ();
+- _1 = Union32 { value: move _2 };
++ _2 = const ();
++ _1 = Union32 { value: const () };
StorageDead(_2);
_0 = move _1 as u32 (Transmute);
StorageDead(_1);
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff
index fc0634b1f..fb28aa8f6 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff
@@ -11,8 +11,10 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
- _1 = Union32 { value: move _2 };
+- _2 = ();
+- _1 = Union32 { value: move _2 };
++ _2 = const ();
++ _1 = Union32 { value: const () };
StorageDead(_2);
_0 = move _1 as u32 (Transmute);
StorageDead(_1);
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff
index d0c298ba2..5d17c47ae 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff
@@ -4,6 +4,7 @@
fn unreachable_box() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -14,6 +15,7 @@
StorageLive(_1);
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
+ _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
unreachable;
}
}
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff
index d0c298ba2..5d17c47ae 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff
@@ -4,6 +4,7 @@
fn unreachable_box() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -14,6 +15,7 @@
StorageLive(_1);
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute);
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global);
+ _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
unreachable;
}
}
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff
index acbb5cd1b..c8d4d6edb 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff
@@ -14,8 +14,10 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
- _1 = move _2 as Never (Transmute);
+- _2 = ();
+- _1 = move _2 as Never (Transmute);
++ _2 = const ();
++ _1 = const ZeroSized: Never;
unreachable;
}
}
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff
index acbb5cd1b..c8d4d6edb 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff
@@ -14,8 +14,10 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
- _1 = move _2 as Never (Transmute);
+- _2 = ();
+- _1 = move _2 as Never (Transmute);
++ _2 = const ();
++ _1 = const ZeroSized: Never;
unreachable;
}
}
diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff
index 5e385d21e..f5723cac7 100644
--- a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.diff
+++ b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff
@@ -11,6 +11,9 @@
let mut _8: i32;
let mut _9: i32;
let mut _10: i32;
+ let mut _12: i32;
+ let mut _13: (i32, i32);
+ let mut _14: i32;
scope 1 {
debug a => _1;
let _2: i32;
@@ -19,13 +22,18 @@
let _6: i32;
scope 3 {
debug c => _6;
+ let _11: (i32, (i32, i32), i32);
+ scope 4 {
+ debug d => _11;
+ }
}
}
}
bb0: {
StorageLive(_1);
- _1 = (const 1_i32, const 2_i32);
+- _1 = (const 1_i32, const 2_i32);
++ _1 = const (1_i32, 2_i32);
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
@@ -41,7 +49,8 @@
- _2 = Add(move _3, const 3_i32);
+ _2 = const 6_i32;
StorageDead(_3);
- _1 = (const 2_i32, const 3_i32);
+- _1 = (const 2_i32, const 3_i32);
++ _1 = const (2_i32, 3_i32);
StorageLive(_6);
StorageLive(_7);
StorageLive(_8);
@@ -61,11 +70,43 @@
+ _6 = const 11_i32;
StorageDead(_10);
StorageDead(_7);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = _2;
++ _12 = const 6_i32;
+ StorageLive(_13);
+- _13 = _1;
++ _13 = const (2_i32, 3_i32);
+ StorageLive(_14);
+- _14 = _6;
+- _11 = (move _12, move _13, move _14);
++ _14 = const 11_i32;
++ _11 = (const 6_i32, const (2_i32, 3_i32), const 11_i32);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
_0 = const ();
+ StorageDead(_11);
StorageDead(_6);
StorageDead(_2);
StorageDead(_1);
return;
}
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC2 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
}
diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff
new file mode 100644
index 000000000..f5723cac7
--- /dev/null
+++ b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff
@@ -0,0 +1,112 @@
+- // MIR for `main` before DataflowConstProp
++ // MIR for `main` after DataflowConstProp
+
+ fn main() -> () {
+ let mut _0: ();
+ let mut _1: (i32, i32);
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _9: i32;
+ let mut _10: i32;
+ let mut _12: i32;
+ let mut _13: (i32, i32);
+ let mut _14: i32;
+ scope 1 {
+ debug a => _1;
+ let _2: i32;
+ scope 2 {
+ debug b => _2;
+ let _6: i32;
+ scope 3 {
+ debug c => _6;
+ let _11: (i32, (i32, i32), i32);
+ scope 4 {
+ debug d => _11;
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+- _1 = (const 1_i32, const 2_i32);
++ _1 = const (1_i32, 2_i32);
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+- _4 = (_1.0: i32);
++ _4 = const 1_i32;
+ StorageLive(_5);
+- _5 = (_1.1: i32);
+- _3 = Add(move _4, move _5);
++ _5 = const 2_i32;
++ _3 = const 3_i32;
+ StorageDead(_5);
+ StorageDead(_4);
+- _2 = Add(move _3, const 3_i32);
++ _2 = const 6_i32;
+ StorageDead(_3);
+- _1 = (const 2_i32, const 3_i32);
++ _1 = const (2_i32, 3_i32);
+ StorageLive(_6);
+ StorageLive(_7);
+ StorageLive(_8);
+- _8 = (_1.0: i32);
++ _8 = const 2_i32;
+ StorageLive(_9);
+- _9 = (_1.1: i32);
+- _7 = Add(move _8, move _9);
++ _9 = const 3_i32;
++ _7 = const 5_i32;
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageLive(_10);
+- _10 = _2;
+- _6 = Add(move _7, move _10);
++ _10 = const 6_i32;
++ _6 = const 11_i32;
+ StorageDead(_10);
+ StorageDead(_7);
+ StorageLive(_11);
+ StorageLive(_12);
+- _12 = _2;
++ _12 = const 6_i32;
+ StorageLive(_13);
+- _13 = _1;
++ _13 = const (2_i32, 3_i32);
+ StorageLive(_14);
+- _14 = _6;
+- _11 = (move _12, move _13, move _14);
++ _14 = const 11_i32;
++ _11 = (const 6_i32, const (2_i32, 3_i32), const 11_i32);
+ StorageDead(_14);
+ StorageDead(_13);
+ StorageDead(_12);
+ _0 = const ();
+ StorageDead(_11);
+ StorageDead(_6);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
++ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC1 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC2 (size: 8, align: 4) {
++ 02 00 00 00 03 00 00 00 │ ........
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 01 00 00 00 02 00 00 00 │ ........
+ }
+
diff --git a/tests/mir-opt/dataflow-const-prop/tuple.rs b/tests/mir-opt/dataflow-const-prop/tuple.rs
index 92c70eab0..bb706eafe 100644
--- a/tests/mir-opt/dataflow-const-prop/tuple.rs
+++ b/tests/mir-opt/dataflow-const-prop/tuple.rs
@@ -1,4 +1,6 @@
+// skip-filecheck
// unit-test: DataflowConstProp
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR tuple.main.DataflowConstProp.diff
fn main() {
@@ -6,4 +8,6 @@ fn main() {
let b = a.0 + a.1 + 3;
a = (2, 3);
let c = a.0 + a.1 + b;
+
+ let d = (b, a, c);
}
diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
index f09cdee14..dcd15fb2b 100644
--- a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DeadStoreElimination
// compile-flags: -Zmir-enable-passes=+CopyProp
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
new file mode 100644
index 000000000..cf73358dc
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
@@ -0,0 +1,29 @@
+- // MIR for `cycle` before DeadStoreElimination
++ // MIR for `cycle` after DeadStoreElimination
+
+ fn cycle(_1: i32, _2: i32, _3: i32) -> () {
+ let mut _0: ();
+ let mut _4: bool;
+- let mut _5: i32;
+
+ bb0: {
+ _4 = cond() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ switchInt(_4) -> [1: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+- _5 = _3;
+- _3 = _2;
+- _2 = _1;
+- _1 = _5;
+ _4 = cond() -> [return: bb1, unwind continue];
+ }
+
+ bb3: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff
deleted file mode 100644
index 6221d4780..000000000
--- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff
+++ /dev/null
@@ -1,73 +0,0 @@
-- // MIR for `cycle` before DeadStoreElimination
-+ // MIR for `cycle` after DeadStoreElimination
-
- fn cycle(_1: i32, _2: i32, _3: i32) -> () {
- debug x => _1;
- debug y => _2;
- debug z => _3;
- let mut _0: ();
-- let mut _4: ();
-- let mut _5: bool;
-- let _6: i32;
-- let mut _7: i32;
-- let mut _8: i32;
-- let mut _9: i32;
-- let mut _10: !;
-- let _11: ();
-- let mut _12: !;
-+ let mut _4: bool;
-+ let _5: i32;
- scope 1 {
-- debug temp => _6;
-+ debug temp => _5;
- }
-
- bb0: {
- goto -> bb1;
- }
-
- bb1: {
-- StorageLive(_5);
-- _5 = cond() -> [return: bb2, unwind unreachable];
-+ StorageLive(_4);
-+ _4 = cond() -> [return: bb2, unwind unreachable];
- }
-
- bb2: {
-- switchInt(move _5) -> [0: bb4, otherwise: bb3];
-+ switchInt(move _4) -> [0: bb4, otherwise: bb3];
- }
-
- bb3: {
-- StorageLive(_6);
-- _6 = _3;
-- StorageLive(_7);
-- _7 = _2;
-- _3 = move _7;
-- StorageDead(_7);
-- StorageLive(_8);
-- _8 = _1;
-- _2 = move _8;
-- StorageDead(_8);
-- StorageLive(_9);
-- _9 = _6;
-- _1 = move _9;
-- StorageDead(_9);
-- _4 = const ();
-- StorageDead(_6);
-+ StorageLive(_5);
- StorageDead(_5);
-+ StorageDead(_4);
- goto -> bb1;
- }
-
- bb4: {
-- StorageLive(_11);
- _0 = const ();
-- StorageDead(_11);
-- StorageDead(_5);
-+ StorageDead(_4);
- return;
- }
- }
-
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff
deleted file mode 100644
index 4b922e05e..000000000
--- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff
+++ /dev/null
@@ -1,73 +0,0 @@
-- // MIR for `cycle` before DeadStoreElimination
-+ // MIR for `cycle` after DeadStoreElimination
-
- fn cycle(_1: i32, _2: i32, _3: i32) -> () {
- debug x => _1;
- debug y => _2;
- debug z => _3;
- let mut _0: ();
-- let mut _4: ();
-- let mut _5: bool;
-- let _6: i32;
-- let mut _7: i32;
-- let mut _8: i32;
-- let mut _9: i32;
-- let mut _10: !;
-- let _11: ();
-- let mut _12: !;
-+ let mut _4: bool;
-+ let _5: i32;
- scope 1 {
-- debug temp => _6;
-+ debug temp => _5;
- }
-
- bb0: {
- goto -> bb1;
- }
-
- bb1: {
-- StorageLive(_5);
-- _5 = cond() -> [return: bb2, unwind continue];
-+ StorageLive(_4);
-+ _4 = cond() -> [return: bb2, unwind continue];
- }
-
- bb2: {
-- switchInt(move _5) -> [0: bb4, otherwise: bb3];
-+ switchInt(move _4) -> [0: bb4, otherwise: bb3];
- }
-
- bb3: {
-- StorageLive(_6);
-- _6 = _3;
-- StorageLive(_7);
-- _7 = _2;
-- _3 = move _7;
-- StorageDead(_7);
-- StorageLive(_8);
-- _8 = _1;
-- _2 = move _8;
-- StorageDead(_8);
-- StorageLive(_9);
-- _9 = _6;
-- _1 = move _9;
-- StorageDead(_9);
-- _4 = const ();
-- StorageDead(_6);
-+ StorageLive(_5);
- StorageDead(_5);
-+ StorageDead(_4);
- goto -> bb1;
- }
-
- bb4: {
-- StorageLive(_11);
- _0 = const ();
-- StorageDead(_11);
-- StorageDead(_5);
-+ StorageDead(_4);
- return;
- }
- }
-
diff --git a/tests/mir-opt/dead-store-elimination/cycle.rs b/tests/mir-opt/dead-store-elimination/cycle.rs
index cd34fe96e..8896f5ff3 100644
--- a/tests/mir-opt/dead-store-elimination/cycle.rs
+++ b/tests/mir-opt/dead-store-elimination/cycle.rs
@@ -1,21 +1,41 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// skip-filecheck
+// This example is interesting because the non-transitive version of `MaybeLiveLocals` would
+// report that *all* of these stores are live.
+//
+// needs-unwind
// unit-test: DeadStoreElimination
+#![feature(core_intrinsics, custom_mir)]
+use std::intrinsics::mir::*;
+
#[inline(never)]
fn cond() -> bool {
false
}
// EMIT_MIR cycle.cycle.DeadStoreElimination.diff
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn cycle(mut x: i32, mut y: i32, mut z: i32) {
- // This example is interesting because the non-transitive version of `MaybeLiveLocals` would
- // report that *all* of these stores are live.
- while cond() {
- let temp = z;
- z = y;
- y = x;
- x = temp;
- }
+ // We use custom MIR to avoid generating debuginfo, that would force to preserve writes.
+ mir!(
+ let condition: bool;
+ {
+ Call(condition = cond(), bb1)
+ }
+ bb1 = {
+ match condition { true => bb2, _ => ret }
+ }
+ bb2 = {
+ let temp = z;
+ z = y;
+ y = x;
+ x = temp;
+ Call(condition = cond(), bb1)
+ }
+ ret = {
+ Return()
+ }
+ )
}
fn main() {
diff --git a/tests/mir-opt/dead-store-elimination/place_mention.rs b/tests/mir-opt/dead-store-elimination/place_mention.rs
index 59dc74454..4813cf7ee 100644
--- a/tests/mir-opt/dead-store-elimination/place_mention.rs
+++ b/tests/mir-opt/dead-store-elimination/place_mention.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DeadStoreElimination
// compile-flags: -Zmir-keep-place-mention
diff --git a/tests/mir-opt/dead-store-elimination/provenance_soundness.rs b/tests/mir-opt/dead-store-elimination/provenance_soundness.rs
index 11314e990..24ffbe980 100644
--- a/tests/mir-opt/dead-store-elimination/provenance_soundness.rs
+++ b/tests/mir-opt/dead-store-elimination/provenance_soundness.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DeadStoreElimination
// compile-flags: -Zmir-emit-retag
diff --git a/tests/mir-opt/deduplicate_blocks.rs b/tests/mir-opt/deduplicate_blocks.rs
index 0c38c7f21..d3b89102f 100644
--- a/tests/mir-opt/deduplicate_blocks.rs
+++ b/tests/mir-opt/deduplicate_blocks.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DeduplicateBlocks
diff --git a/tests/mir-opt/deref-patterns/string.rs b/tests/mir-opt/deref-patterns/string.rs
index 3a99c44aa..0c8385b5c 100644
--- a/tests/mir-opt/deref-patterns/string.rs
+++ b/tests/mir-opt/deref-patterns/string.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=0 -C panic=abort
#![feature(string_deref_patterns)]
diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff
index 1f3b3ad64..0fad716a2 100644
--- a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff
+++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff
@@ -35,6 +35,7 @@
bb1: {
StorageDead(_2);
+ PlaceMention(_1);
StorageLive(_4);
_4 = move _1;
goto -> bb2;
@@ -52,6 +53,7 @@
bb3: {
StorageDead(_8);
+ PlaceMention(_7);
_10 = discriminant(_7);
switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5];
}
diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff
index da4cc188c..ae5656f02 100644
--- a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff
+++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff
@@ -35,6 +35,7 @@
bb1: {
StorageDead(_2);
+ PlaceMention(_1);
StorageLive(_4);
_4 = move _1;
goto -> bb2;
@@ -52,6 +53,7 @@
bb3: {
StorageDead(_8);
+ PlaceMention(_7);
_10 = discriminant(_7);
switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5];
}
diff --git a/tests/mir-opt/derefer_complex_case.rs b/tests/mir-opt/derefer_complex_case.rs
index cc619879e..6097d8739 100644
--- a/tests/mir-opt/derefer_complex_case.rs
+++ b/tests/mir-opt/derefer_complex_case.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_complex_case.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/derefer_inline_test.rs b/tests/mir-opt/derefer_inline_test.rs
index 7ac330e51..713c051f4 100644
--- a/tests/mir-opt/derefer_inline_test.rs
+++ b/tests/mir-opt/derefer_inline_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_inline_test.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff
index 895dcf579..f4c034517 100644
--- a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff
+++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff
@@ -12,6 +12,9 @@
+ let mut _10: &&&bool;
+ let mut _11: &&bool;
+ let mut _12: &bool;
++ let mut _13: &&&bool;
++ let mut _14: &&bool;
++ let mut _15: &bool;
scope 1 {
debug b => _1;
let _2: bool;
@@ -48,11 +51,16 @@
_6 = &_7;
_5 = &_6;
_4 = &_5;
+- PlaceMention((*(*(*(*_4)))));
- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4];
+ _10 = deref_copy (*_4);
+ _11 = deref_copy (*_10);
+ _12 = deref_copy (*_11);
-+ switchInt((*_12)) -> [0: bb3, otherwise: bb4];
++ PlaceMention((*_12));
++ _13 = deref_copy (*_4);
++ _14 = deref_copy (*_13);
++ _15 = deref_copy (*_14);
++ switchInt((*_15)) -> [0: bb3, otherwise: bb4];
}
bb3: {
diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff
index 19b26c901..e3c0c6b7d 100644
--- a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff
+++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff
@@ -12,6 +12,9 @@
+ let mut _10: &&&bool;
+ let mut _11: &&bool;
+ let mut _12: &bool;
++ let mut _13: &&&bool;
++ let mut _14: &&bool;
++ let mut _15: &bool;
scope 1 {
debug b => _1;
let _2: bool;
@@ -48,11 +51,16 @@
_6 = &_7;
_5 = &_6;
_4 = &_5;
+- PlaceMention((*(*(*(*_4)))));
- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4];
+ _10 = deref_copy (*_4);
+ _11 = deref_copy (*_10);
+ _12 = deref_copy (*_11);
-+ switchInt((*_12)) -> [0: bb3, otherwise: bb4];
++ PlaceMention((*_12));
++ _13 = deref_copy (*_4);
++ _14 = deref_copy (*_13);
++ _15 = deref_copy (*_14);
++ switchInt((*_15)) -> [0: bb3, otherwise: bb4];
}
bb3: {
diff --git a/tests/mir-opt/derefer_terminator_test.rs b/tests/mir-opt/derefer_terminator_test.rs
index 164aa733a..3780ff5df 100644
--- a/tests/mir-opt/derefer_terminator_test.rs
+++ b/tests/mir-opt/derefer_terminator_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_terminator_test.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/derefer_test.rs b/tests/mir-opt/derefer_test.rs
index fad0fe8eb..171925bb1 100644
--- a/tests/mir-opt/derefer_test.rs
+++ b/tests/mir-opt/derefer_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_test.main.Derefer.diff
fn main() {
diff --git a/tests/mir-opt/derefer_test_multiple.rs b/tests/mir-opt/derefer_test_multiple.rs
index 0b3888b07..ac778a9c9 100644
--- a/tests/mir-opt/derefer_test_multiple.rs
+++ b/tests/mir-opt/derefer_test_multiple.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_test_multiple.main.Derefer.diff
fn main () {
diff --git a/tests/mir-opt/dest-prop/branch.rs b/tests/mir-opt/dest-prop/branch.rs
index 5007aafb6..d8c74a0aa 100644
--- a/tests/mir-opt/dest-prop/branch.rs
+++ b/tests/mir-opt/dest-prop/branch.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that assignment in both branches of an `if` are eliminated.
// unit-test: DestinationPropagation
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.rs b/tests/mir-opt/dest-prop/copy_propagation_arg.rs
index 1f8d58892..435cf07ab 100644
--- a/tests/mir-opt/dest-prop/copy_propagation_arg.rs
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that DestinationPropagation does not propagate an assignment to a function argument
// (doing so can break usages of the original argument value)
diff --git a/tests/mir-opt/dest-prop/cycle.rs b/tests/mir-opt/dest-prop/cycle.rs
index 9bc0cb05a..77cff062c 100644
--- a/tests/mir-opt/dest-prop/cycle.rs
+++ b/tests/mir-opt/dest-prop/cycle.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code.
// unit-test: DestinationPropagation
diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.rs b/tests/mir-opt/dest-prop/dead_stores_79191.rs
index 2f95ba0e3..a6fd542d3 100644
--- a/tests/mir-opt/dest-prop/dead_stores_79191.rs
+++ b/tests/mir-opt/dest-prop/dead_stores_79191.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DestinationPropagation
diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir
index a3ec09010..eb160fc19 100644
--- a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir
+++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir
@@ -7,15 +7,16 @@ fn f(_1: usize) -> usize {
let mut _3: usize;
let mut _4: usize;
scope 1 {
- debug b => _1;
+ debug b => _3;
}
bb0: {
nop;
+ _3 = _1;
+ _1 = const 5_usize;
nop;
nop;
- nop;
- nop;
+ _1 = move _3;
nop;
nop;
nop;
diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir
index 185feb4b4..9147de2ec 100644
--- a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir
+++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir
@@ -7,15 +7,16 @@ fn f(_1: usize) -> usize {
let mut _3: usize;
let mut _4: usize;
scope 1 {
- debug b => _1;
+ debug b => _3;
}
bb0: {
nop;
+ _3 = _1;
+ _1 = const 5_usize;
nop;
nop;
- nop;
- nop;
+ _1 = move _3;
nop;
nop;
nop;
diff --git a/tests/mir-opt/dest-prop/dead_stores_better.rs b/tests/mir-opt/dest-prop/dead_stores_better.rs
index e67653c57..c9895f35c 100644
--- a/tests/mir-opt/dest-prop/dead_stores_better.rs
+++ b/tests/mir-opt/dest-prop/dead_stores_better.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// This is a copy of the `dead_stores_79191` test, except that we turn on DSE. This demonstrates
// that that pass enables this one to do more optimizations.
diff --git a/tests/mir-opt/dest-prop/simple.rs b/tests/mir-opt/dest-prop/simple.rs
index 0bcb2924f..03d209626 100644
--- a/tests/mir-opt/dest-prop/simple.rs
+++ b/tests/mir-opt/dest-prop/simple.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too.
// unit-test: DestinationPropagation
diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff
index 459a9c442..142e08f4d 100644
--- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff
+++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff
@@ -4,27 +4,20 @@
fn main() -> () {
let mut _0: ();
let _1: main::Un;
- let mut _2: u32;
- let mut _3: u32;
scope 1 {
debug un => _1;
scope 2 {
}
- scope 3 (inlined std::mem::drop::<u32>) {
- debug _x => _3;
+ scope 4 (inlined std::mem::drop::<u32>) {
+ debug _x => const 1_u32;
}
}
+ scope 3 (inlined val) {
+ }
bb0: {
StorageLive(_1);
- StorageLive(_2);
- _2 = val() -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
- StorageDead(_2);
- StorageLive(_3);
- StorageDead(_3);
+ _1 = Un { us: const 1_u32 };
StorageDead(_1);
return;
}
diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff
index d2eef9058..142e08f4d 100644
--- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff
+++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff
@@ -4,27 +4,20 @@
fn main() -> () {
let mut _0: ();
let _1: main::Un;
- let mut _2: u32;
- let mut _3: u32;
scope 1 {
debug un => _1;
scope 2 {
}
- scope 3 (inlined std::mem::drop::<u32>) {
- debug _x => _3;
+ scope 4 (inlined std::mem::drop::<u32>) {
+ debug _x => const 1_u32;
}
}
+ scope 3 (inlined val) {
+ }
bb0: {
StorageLive(_1);
- StorageLive(_2);
- _2 = val() -> [return: bb1, unwind continue];
- }
-
- bb1: {
- StorageDead(_2);
- StorageLive(_3);
- StorageDead(_3);
+ _1 = Un { us: const 1_u32 };
StorageDead(_1);
return;
}
diff --git a/tests/mir-opt/dest-prop/union.rs b/tests/mir-opt/dest-prop/union.rs
index 4bc6f28c6..6d3e6d7fa 100644
--- a/tests/mir-opt/dest-prop/union.rs
+++ b/tests/mir-opt/dest-prop/union.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that we can propagate into places that are projections into unions
// compile-flags: -Zunsound-mir-opts
diff --git a/tests/mir-opt/dest-prop/unreachable.rs b/tests/mir-opt/dest-prop/unreachable.rs
index e950dbbf5..a47d2a0c8 100644
--- a/tests/mir-opt/dest-prop/unreachable.rs
+++ b/tests/mir-opt/dest-prop/unreachable.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that unreachable code is removed after the destination propagation.
// Regression test for issue #105428.
diff --git a/tests/mir-opt/dont_inline_type_id.rs b/tests/mir-opt/dont_inline_type_id.rs
index d8a566360..788c2f55d 100644
--- a/tests/mir-opt/dont_inline_type_id.rs
+++ b/tests/mir-opt/dont_inline_type_id.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Inline
// compile-flags: --crate-type=lib -C panic=abort
diff --git a/tests/mir-opt/dont_yeet_assert.rs b/tests/mir-opt/dont_yeet_assert.rs
deleted file mode 100644
index 38cc5a293..000000000
--- a/tests/mir-opt/dont_yeet_assert.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// compile-flags: --crate-type=lib
-// unit-test: InstSimplify
-
-#![feature(core_intrinsics)]
-
-// Want to make sure this assertion isn't compiled away in generic code.
-
-// EMIT_MIR dont_yeet_assert.generic.InstSimplify.diff
-pub fn generic<T>() {
- core::intrinsics::assert_mem_uninitialized_valid::<&T>();
-}
diff --git a/tests/mir-opt/early_otherwise_branch.rs b/tests/mir-opt/early_otherwise_branch.rs
index 7be9fbd03..b48516c5a 100644
--- a/tests/mir-opt/early_otherwise_branch.rs
+++ b/tests/mir-opt/early_otherwise_branch.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
fn opt1(x: Option<u32>, y: Option<u32>) -> u32 {
diff --git a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs
index 76055e133..2a0fba9be 100644
--- a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs
+++ b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
diff --git a/tests/mir-opt/early_otherwise_branch_68867.rs b/tests/mir-opt/early_otherwise_branch_68867.rs
index a6a56f3a9..f27527b96 100644
--- a/tests/mir-opt/early_otherwise_branch_68867.rs
+++ b/tests/mir-opt/early_otherwise_branch_68867.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// FIXME: This test was broken by the derefer change.
diff --git a/tests/mir-opt/early_otherwise_branch_noopt.rs b/tests/mir-opt/early_otherwise_branch_noopt.rs
index ef766bbd4..351640c27 100644
--- a/tests/mir-opt/early_otherwise_branch_noopt.rs
+++ b/tests/mir-opt/early_otherwise_branch_noopt.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// must not optimize as it does not follow the pattern of
diff --git a/tests/mir-opt/early_otherwise_branch_soundness.rs b/tests/mir-opt/early_otherwise_branch_soundness.rs
index cd4589232..02c25a1bd 100644
--- a/tests/mir-opt/early_otherwise_branch_soundness.rs
+++ b/tests/mir-opt/early_otherwise_branch_soundness.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EarlyOtherwiseBranch
// Tests various cases that the `early_otherwise_branch` opt should *not* optimize
diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
index ec5f5c1f1..775a60f1c 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
@@ -66,7 +66,7 @@
}
+ }
+
-+ alloc15 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 02 00 00 00 05 20 00 00 │ ..... ..
}
diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
index 9bf8637ec..c4b575799 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
@@ -66,7 +66,7 @@
}
+ }
+
-+ alloc15 (size: 16, align: 8) {
++ ALLOC0 (size: 16, align: 8) {
+ 02 00 00 00 00 00 00 00 05 20 00 00 00 00 00 00 │ ......... ......
}
diff --git a/tests/mir-opt/enum_opt.rs b/tests/mir-opt/enum_opt.rs
index 2768d7080..7738c4310 100644
--- a/tests/mir-opt/enum_opt.rs
+++ b/tests/mir-opt/enum_opt.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: EnumSizeOpt
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// compile-flags: -Zunsound-mir-opts
diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
index 7dc6d21a9..f7d0d1fb5 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
@@ -66,7 +66,7 @@
}
+ }
+
-+ alloc14 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 05 20 00 00 01 00 00 00 │ . ......
}
diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
index 0b000876a..15f1bd0df 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
@@ -66,7 +66,7 @@
}
+ }
+
-+ alloc14 (size: 16, align: 8) {
++ ALLOC0 (size: 16, align: 8) {
+ 05 20 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ . ..............
}
diff --git a/tests/mir-opt/equal_true.opt.InstSimplify.diff b/tests/mir-opt/equal_true.opt.InstSimplify.diff
deleted file mode 100644
index 88a51000c..000000000
--- a/tests/mir-opt/equal_true.opt.InstSimplify.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-- // MIR for `opt` before InstSimplify
-+ // MIR for `opt` after InstSimplify
-
- fn opt(_1: bool) -> i32 {
- debug x => _1;
- let mut _0: i32;
- let mut _2: bool;
- let mut _3: bool;
-
- bb0: {
- StorageLive(_2);
- StorageLive(_3);
- _3 = _1;
-- _2 = Eq(move _3, const true);
-+ _2 = move _3;
- switchInt(move _2) -> [0: bb2, otherwise: bb1];
- }
-
- bb1: {
- StorageDead(_3);
- _0 = const 0_i32;
- goto -> bb3;
- }
-
- bb2: {
- StorageDead(_3);
- _0 = const 1_i32;
- goto -> bb3;
- }
-
- bb3: {
- StorageDead(_2);
- return;
- }
- }
-
diff --git a/tests/mir-opt/equal_true.rs b/tests/mir-opt/equal_true.rs
deleted file mode 100644
index fbb5d8d37..000000000
--- a/tests/mir-opt/equal_true.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// unit-test InstSimplify
-
-// EMIT_MIR equal_true.opt.InstSimplify.diff
-
-fn opt(x: bool) -> i32 {
- if x == true { 0 } else { 1 }
-}
-
-fn main() {
- opt(true);
-}
diff --git a/tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir b/tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir
index fba616d04..b04e09e88 100644
--- a/tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir
@@ -18,7 +18,7 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
}
bb0: {
- FakeRead(ForMatchedPlace(None), _1);
+ PlaceMention(_1);
switchInt((_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1];
}
diff --git a/tests/mir-opt/exponential_or.rs b/tests/mir-opt/exponential_or.rs
index 0b8be8385..89963b9bd 100644
--- a/tests/mir-opt/exponential_or.rs
+++ b/tests/mir-opt/exponential_or.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that simple or-patterns don't get expanded to exponentially large CFGs
// EMIT_MIR exponential_or.match_tuple.SimplifyCfg-initial.after.mir
diff --git a/tests/mir-opt/fn_ptr_shim.rs b/tests/mir-opt/fn_ptr_shim.rs
index 64fbdc9de..c82260bae 100644
--- a/tests/mir-opt/fn_ptr_shim.rs
+++ b/tests/mir-opt/fn_ptr_shim.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Zmir-opt-level=0
// Tests that the `<fn() as Fn>` shim does not create a `Call` terminator with a `Self` callee
diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff
index a538756ba..298a60848 100644
--- a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff
@@ -7,104 +7,104 @@
debug upper => _3;
let mut _0: std::result::Result<(), std::fmt::Error>;
let _4: bool;
- let mut _5: &std::fmt::Formatter<'_>;
- let mut _7: std::option::Option<usize>;
- let mut _8: &std::fmt::Formatter<'_>;
- let mut _9: isize;
- let mut _11: &mut std::fmt::Formatter<'_>;
- let mut _12: &T;
- let mut _13: core::num::flt2dec::Sign;
- let mut _14: u32;
- let mut _15: u32;
- let mut _16: usize;
- let mut _17: bool;
- let mut _18: &mut std::fmt::Formatter<'_>;
- let mut _19: &T;
- let mut _20: core::num::flt2dec::Sign;
- let mut _21: bool;
+ let mut _6: std::option::Option<usize>;
+ let mut _7: isize;
+ let mut _9: &mut std::fmt::Formatter<'_>;
+ let mut _10: &T;
+ let mut _11: core::num::flt2dec::Sign;
+ let mut _12: u32;
+ let mut _13: u32;
+ let mut _14: usize;
+ let mut _15: bool;
+ let mut _16: &mut std::fmt::Formatter<'_>;
+ let mut _17: &T;
+ let mut _18: core::num::flt2dec::Sign;
+ let mut _19: bool;
scope 1 {
debug force_sign => _4;
- let _6: core::num::flt2dec::Sign;
+ let _5: core::num::flt2dec::Sign;
scope 2 {
- debug sign => _6;
+ debug sign => _5;
scope 3 {
- debug precision => _10;
- let _10: usize;
+ debug precision => _8;
+ let _8: usize;
+ scope 5 (inlined Formatter::<'_>::precision) {
+ debug self => _1;
+ }
}
}
}
+ scope 4 (inlined Formatter::<'_>::sign_plus) {
+ debug self => _1;
+ let mut _20: u32;
+ let mut _21: u32;
+ }
bb0: {
StorageLive(_4);
+ StorageLive(_20);
+ StorageLive(_21);
+ _21 = ((*_1).0: u32);
+ _20 = BitAnd(move _21, const 1_u32);
+ StorageDead(_21);
+ _4 = Ne(move _20, const 0_u32);
+ StorageDead(_20);
StorageLive(_5);
- _5 = &(*_1);
- _4 = Formatter::<'_>::sign_plus(move _5) -> [return: bb1, unwind unreachable];
+ switchInt(_4) -> [0: bb2, otherwise: bb1];
}
bb1: {
- StorageDead(_5);
- StorageLive(_6);
- switchInt(_4) -> [0: bb3, otherwise: bb2];
+- _5 = MinusPlus;
++ _5 = const MinusPlus;
+ goto -> bb3;
}
bb2: {
-- _6 = MinusPlus;
-+ _6 = const MinusPlus;
- goto -> bb4;
+- _5 = Minus;
++ _5 = const Minus;
+ goto -> bb3;
}
bb3: {
-- _6 = Minus;
-+ _6 = const Minus;
- goto -> bb4;
+ StorageLive(_6);
+ _6 = ((*_1).4: std::option::Option<usize>);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [1: bb4, otherwise: bb6];
}
bb4: {
- StorageLive(_7);
- StorageLive(_8);
- _8 = &(*_1);
- _7 = Formatter::<'_>::precision(move _8) -> [return: bb5, unwind unreachable];
+ _8 = ((_6 as Some).0: usize);
+ StorageLive(_11);
+ _11 = _5;
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _8 as u32 (IntToInt);
+ _12 = Add(move _13, const 1_u32);
+ StorageDead(_13);
+ _0 = float_to_exponential_common_exact::<T>(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind unreachable];
}
bb5: {
- StorageDead(_8);
- _9 = discriminant(_7);
- switchInt(move _9) -> [1: bb6, otherwise: bb8];
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
}
bb6: {
- _10 = ((_7 as Some).0: usize);
- StorageLive(_13);
- _13 = _6;
- StorageLive(_14);
- StorageLive(_15);
- _15 = _10 as u32 (IntToInt);
- _14 = Add(move _15, const 1_u32);
- StorageDead(_15);
- _0 = float_to_exponential_common_exact::<T>(_1, _2, move _13, move _14, _3) -> [return: bb7, unwind unreachable];
+ StorageLive(_18);
+ _18 = _5;
+ _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _18, _3) -> [return: bb7, unwind unreachable];
}
bb7: {
- StorageDead(_14);
- StorageDead(_13);
- goto -> bb10;
+ StorageDead(_18);
+ goto -> bb8;
}
bb8: {
- StorageLive(_20);
- _20 = _6;
- _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _20, _3) -> [return: bb9, unwind unreachable];
- }
-
- bb9: {
- StorageDead(_20);
- goto -> bb10;
- }
-
- bb10: {
- StorageDead(_6);
+ StorageDead(_5);
StorageDead(_4);
- StorageDead(_7);
+ StorageDead(_6);
return;
}
}
diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff
index 8a3dcfab4..037f4f7cf 100644
--- a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff
@@ -7,104 +7,104 @@
debug upper => _3;
let mut _0: std::result::Result<(), std::fmt::Error>;
let _4: bool;
- let mut _5: &std::fmt::Formatter<'_>;
- let mut _7: std::option::Option<usize>;
- let mut _8: &std::fmt::Formatter<'_>;
- let mut _9: isize;
- let mut _11: &mut std::fmt::Formatter<'_>;
- let mut _12: &T;
- let mut _13: core::num::flt2dec::Sign;
- let mut _14: u32;
- let mut _15: u32;
- let mut _16: usize;
- let mut _17: bool;
- let mut _18: &mut std::fmt::Formatter<'_>;
- let mut _19: &T;
- let mut _20: core::num::flt2dec::Sign;
- let mut _21: bool;
+ let mut _6: std::option::Option<usize>;
+ let mut _7: isize;
+ let mut _9: &mut std::fmt::Formatter<'_>;
+ let mut _10: &T;
+ let mut _11: core::num::flt2dec::Sign;
+ let mut _12: u32;
+ let mut _13: u32;
+ let mut _14: usize;
+ let mut _15: bool;
+ let mut _16: &mut std::fmt::Formatter<'_>;
+ let mut _17: &T;
+ let mut _18: core::num::flt2dec::Sign;
+ let mut _19: bool;
scope 1 {
debug force_sign => _4;
- let _6: core::num::flt2dec::Sign;
+ let _5: core::num::flt2dec::Sign;
scope 2 {
- debug sign => _6;
+ debug sign => _5;
scope 3 {
- debug precision => _10;
- let _10: usize;
+ debug precision => _8;
+ let _8: usize;
+ scope 5 (inlined Formatter::<'_>::precision) {
+ debug self => _1;
+ }
}
}
}
+ scope 4 (inlined Formatter::<'_>::sign_plus) {
+ debug self => _1;
+ let mut _20: u32;
+ let mut _21: u32;
+ }
bb0: {
StorageLive(_4);
+ StorageLive(_20);
+ StorageLive(_21);
+ _21 = ((*_1).0: u32);
+ _20 = BitAnd(move _21, const 1_u32);
+ StorageDead(_21);
+ _4 = Ne(move _20, const 0_u32);
+ StorageDead(_20);
StorageLive(_5);
- _5 = &(*_1);
- _4 = Formatter::<'_>::sign_plus(move _5) -> [return: bb1, unwind continue];
+ switchInt(_4) -> [0: bb2, otherwise: bb1];
}
bb1: {
- StorageDead(_5);
- StorageLive(_6);
- switchInt(_4) -> [0: bb3, otherwise: bb2];
+- _5 = MinusPlus;
++ _5 = const MinusPlus;
+ goto -> bb3;
}
bb2: {
-- _6 = MinusPlus;
-+ _6 = const MinusPlus;
- goto -> bb4;
+- _5 = Minus;
++ _5 = const Minus;
+ goto -> bb3;
}
bb3: {
-- _6 = Minus;
-+ _6 = const Minus;
- goto -> bb4;
+ StorageLive(_6);
+ _6 = ((*_1).4: std::option::Option<usize>);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [1: bb4, otherwise: bb6];
}
bb4: {
- StorageLive(_7);
- StorageLive(_8);
- _8 = &(*_1);
- _7 = Formatter::<'_>::precision(move _8) -> [return: bb5, unwind continue];
+ _8 = ((_6 as Some).0: usize);
+ StorageLive(_11);
+ _11 = _5;
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _8 as u32 (IntToInt);
+ _12 = Add(move _13, const 1_u32);
+ StorageDead(_13);
+ _0 = float_to_exponential_common_exact::<T>(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_8);
- _9 = discriminant(_7);
- switchInt(move _9) -> [1: bb6, otherwise: bb8];
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
}
bb6: {
- _10 = ((_7 as Some).0: usize);
- StorageLive(_13);
- _13 = _6;
- StorageLive(_14);
- StorageLive(_15);
- _15 = _10 as u32 (IntToInt);
- _14 = Add(move _15, const 1_u32);
- StorageDead(_15);
- _0 = float_to_exponential_common_exact::<T>(_1, _2, move _13, move _14, _3) -> [return: bb7, unwind continue];
+ StorageLive(_18);
+ _18 = _5;
+ _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _18, _3) -> [return: bb7, unwind continue];
}
bb7: {
- StorageDead(_14);
- StorageDead(_13);
- goto -> bb10;
+ StorageDead(_18);
+ goto -> bb8;
}
bb8: {
- StorageLive(_20);
- _20 = _6;
- _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _20, _3) -> [return: bb9, unwind continue];
- }
-
- bb9: {
- StorageDead(_20);
- goto -> bb10;
- }
-
- bb10: {
- StorageDead(_6);
+ StorageDead(_5);
StorageDead(_4);
- StorageDead(_7);
+ StorageDead(_6);
return;
}
}
diff --git a/tests/mir-opt/funky_arms.rs b/tests/mir-opt/funky_arms.rs
index 79fd9457c..14aad0399 100644
--- a/tests/mir-opt/funky_arms.rs
+++ b/tests/mir-opt/funky_arms.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: --crate-type lib -Cdebug-assertions=no
diff --git a/tests/mir-opt/generator_drop_cleanup.rs b/tests/mir-opt/generator_drop_cleanup.rs
deleted file mode 100644
index 7e0d7bb59..000000000
--- a/tests/mir-opt/generator_drop_cleanup.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![feature(generators, generator_trait)]
-
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-
-// Regression test for #58892, generator drop shims should not have blocks
-// spuriously marked as cleanup
-
-// EMIT_MIR generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir
-fn main() {
- let gen = || {
- let _s = String::new();
- yield;
- };
-}
diff --git a/tests/mir-opt/graphviz.rs b/tests/mir-opt/graphviz.rs
index 6906b86c2..61b5a2fb3 100644
--- a/tests/mir-opt/graphviz.rs
+++ b/tests/mir-opt/graphviz.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test graphviz output
// compile-flags: -Z dump-mir-graphviz
diff --git a/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
index 3f5173c18..d524ad242 100644
--- a/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
@@ -67,11 +67,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = Add(move _4, const 0_u64);
-- StorageDead(_4);
+ _3 = Add(_1, const 0_u64);
+ StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb1, unwind unreachable];
}
@@ -80,11 +80,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
-- StorageLive(_7);
-- _7 = _1;
+ StorageLive(_7);
+ _7 = _1;
- _6 = Sub(move _7, const 0_u64);
-- StorageDead(_7);
+ _6 = Sub(_1, const 0_u64);
+ StorageDead(_7);
_5 = opaque::<u64>(move _6) -> [return: bb2, unwind unreachable];
}
@@ -93,11 +93,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
+ StorageLive(_10);
+ _10 = _1;
- _9 = Mul(move _10, const 0_u64);
-- StorageDead(_10);
+ _9 = Mul(_1, const 0_u64);
+ StorageDead(_10);
_8 = opaque::<u64>(move _9) -> [return: bb3, unwind unreachable];
}
@@ -106,11 +106,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
-- StorageLive(_13);
-- _13 = _1;
+ StorageLive(_13);
+ _13 = _1;
- _12 = Mul(move _13, const 1_u64);
-- StorageDead(_13);
+ _12 = Mul(_1, const 1_u64);
+ StorageDead(_13);
_11 = opaque::<u64>(move _12) -> [return: bb4, unwind unreachable];
}
@@ -119,17 +119,18 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
- _17 = Eq(const 0_u64, const 0_u64);
+ StorageLive(_16);
+ _16 = _1;
+- _17 = Eq(const 0_u64, const 0_u64);
- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind unreachable];
-+ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind unreachable];
++ _17 = const true;
++ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind unreachable];
}
bb5: {
- _15 = Div(move _16, const 0_u64);
-- StorageDead(_16);
+ _15 = Div(_1, const 0_u64);
+ StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb6, unwind unreachable];
}
@@ -138,17 +139,18 @@
StorageDead(_14);
StorageLive(_18);
StorageLive(_19);
-- StorageLive(_20);
-- _20 = _1;
- _21 = Eq(const 1_u64, const 0_u64);
+ StorageLive(_20);
+ _20 = _1;
+- _21 = Eq(const 1_u64, const 0_u64);
- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind unreachable];
-+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind unreachable];
++ _21 = const false;
++ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind unreachable];
}
bb7: {
- _19 = Div(move _20, const 1_u64);
-- StorageDead(_20);
+ _19 = Div(_1, const 1_u64);
+ StorageDead(_20);
_18 = opaque::<u64>(move _19) -> [return: bb8, unwind unreachable];
}
@@ -157,8 +159,8 @@
StorageDead(_18);
StorageLive(_22);
StorageLive(_23);
-- StorageLive(_24);
-- _24 = _1;
+ StorageLive(_24);
+ _24 = _1;
- _25 = Eq(_24, const 0_u64);
- assert(!move _25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind unreachable];
+ _25 = Eq(_1, const 0_u64);
@@ -167,8 +169,8 @@
bb9: {
- _23 = Div(const 0_u64, move _24);
-- StorageDead(_24);
+ _23 = Div(const 0_u64, _1);
+ StorageDead(_24);
_22 = opaque::<u64>(move _23) -> [return: bb10, unwind unreachable];
}
@@ -177,17 +179,18 @@
StorageDead(_22);
StorageLive(_26);
StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
+ StorageLive(_28);
+ _28 = _1;
- _29 = Eq(_28, const 0_u64);
- assert(!move _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind unreachable];
++ _29 = _25;
+ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind unreachable];
}
bb11: {
- _27 = Div(const 1_u64, move _28);
-- StorageDead(_28);
+ _27 = Div(const 1_u64, _1);
+ StorageDead(_28);
_26 = opaque::<u64>(move _27) -> [return: bb12, unwind unreachable];
}
@@ -196,17 +199,18 @@
StorageDead(_26);
StorageLive(_30);
StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
+ StorageLive(_32);
+ _32 = _1;
- _33 = Eq(const 0_u64, const 0_u64);
- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind unreachable];
-+ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind unreachable];
++ _33 = const true;
++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind unreachable];
}
bb13: {
- _31 = Rem(move _32, const 0_u64);
-- StorageDead(_32);
+ _31 = Rem(_1, const 0_u64);
+ StorageDead(_32);
_30 = opaque::<u64>(move _31) -> [return: bb14, unwind unreachable];
}
@@ -215,17 +219,18 @@
StorageDead(_30);
StorageLive(_34);
StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
+ StorageLive(_36);
+ _36 = _1;
- _37 = Eq(const 1_u64, const 0_u64);
- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind unreachable];
-+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind unreachable];
++ _37 = const false;
++ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind unreachable];
}
bb15: {
- _35 = Rem(move _36, const 1_u64);
-- StorageDead(_36);
+ _35 = Rem(_1, const 1_u64);
+ StorageDead(_36);
_34 = opaque::<u64>(move _35) -> [return: bb16, unwind unreachable];
}
@@ -234,17 +239,18 @@
StorageDead(_34);
StorageLive(_38);
StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
+ StorageLive(_40);
+ _40 = _1;
- _41 = Eq(_40, const 0_u64);
- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind unreachable];
++ _41 = _25;
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind unreachable];
}
bb17: {
- _39 = Rem(const 0_u64, move _40);
-- StorageDead(_40);
+ _39 = Rem(const 0_u64, _1);
+ StorageDead(_40);
_38 = opaque::<u64>(move _39) -> [return: bb18, unwind unreachable];
}
@@ -253,17 +259,18 @@
StorageDead(_38);
StorageLive(_42);
StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
+ StorageLive(_44);
+ _44 = _1;
- _45 = Eq(_44, const 0_u64);
- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind unreachable];
++ _45 = _25;
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind unreachable];
}
bb19: {
- _43 = Rem(const 1_u64, move _44);
-- StorageDead(_44);
+ _43 = Rem(const 1_u64, _1);
+ StorageDead(_44);
_42 = opaque::<u64>(move _43) -> [return: bb20, unwind unreachable];
}
@@ -272,11 +279,11 @@
StorageDead(_42);
StorageLive(_46);
StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
+ StorageLive(_48);
+ _48 = _1;
- _47 = BitAnd(move _48, const 0_u64);
-- StorageDead(_48);
+ _47 = BitAnd(_1, const 0_u64);
+ StorageDead(_48);
_46 = opaque::<u64>(move _47) -> [return: bb21, unwind unreachable];
}
@@ -285,11 +292,11 @@
StorageDead(_46);
StorageLive(_49);
StorageLive(_50);
-- StorageLive(_51);
-- _51 = _1;
+ StorageLive(_51);
+ _51 = _1;
- _50 = BitOr(move _51, const 0_u64);
-- StorageDead(_51);
+ _50 = BitOr(_1, const 0_u64);
+ StorageDead(_51);
_49 = opaque::<u64>(move _50) -> [return: bb22, unwind unreachable];
}
@@ -298,11 +305,11 @@
StorageDead(_49);
StorageLive(_52);
StorageLive(_53);
-- StorageLive(_54);
-- _54 = _1;
+ StorageLive(_54);
+ _54 = _1;
- _53 = BitXor(move _54, const 0_u64);
-- StorageDead(_54);
+ _53 = BitXor(_1, const 0_u64);
+ StorageDead(_54);
_52 = opaque::<u64>(move _53) -> [return: bb23, unwind unreachable];
}
@@ -311,11 +318,11 @@
StorageDead(_52);
StorageLive(_55);
StorageLive(_56);
-- StorageLive(_57);
-- _57 = _1;
+ StorageLive(_57);
+ _57 = _1;
- _56 = Shr(move _57, const 0_i32);
-- StorageDead(_57);
+ _56 = Shr(_1, const 0_i32);
+ StorageDead(_57);
_55 = opaque::<u64>(move _56) -> [return: bb24, unwind unreachable];
}
@@ -324,11 +331,11 @@
StorageDead(_55);
StorageLive(_58);
StorageLive(_59);
-- StorageLive(_60);
-- _60 = _1;
+ StorageLive(_60);
+ _60 = _1;
- _59 = Shl(move _60, const 0_i32);
-- StorageDead(_60);
+ _59 = Shl(_1, const 0_i32);
+ StorageDead(_60);
_58 = opaque::<u64>(move _59) -> [return: bb25, unwind unreachable];
}
diff --git a/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
index 38da21d91..9d6935393 100644
--- a/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
@@ -67,11 +67,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = Add(move _4, const 0_u64);
-- StorageDead(_4);
+ _3 = Add(_1, const 0_u64);
+ StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb1, unwind continue];
}
@@ -80,11 +80,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
-- StorageLive(_7);
-- _7 = _1;
+ StorageLive(_7);
+ _7 = _1;
- _6 = Sub(move _7, const 0_u64);
-- StorageDead(_7);
+ _6 = Sub(_1, const 0_u64);
+ StorageDead(_7);
_5 = opaque::<u64>(move _6) -> [return: bb2, unwind continue];
}
@@ -93,11 +93,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
+ StorageLive(_10);
+ _10 = _1;
- _9 = Mul(move _10, const 0_u64);
-- StorageDead(_10);
+ _9 = Mul(_1, const 0_u64);
+ StorageDead(_10);
_8 = opaque::<u64>(move _9) -> [return: bb3, unwind continue];
}
@@ -106,11 +106,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
-- StorageLive(_13);
-- _13 = _1;
+ StorageLive(_13);
+ _13 = _1;
- _12 = Mul(move _13, const 1_u64);
-- StorageDead(_13);
+ _12 = Mul(_1, const 1_u64);
+ StorageDead(_13);
_11 = opaque::<u64>(move _12) -> [return: bb4, unwind continue];
}
@@ -119,17 +119,18 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
- _17 = Eq(const 0_u64, const 0_u64);
+ StorageLive(_16);
+ _16 = _1;
+- _17 = Eq(const 0_u64, const 0_u64);
- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind continue];
-+ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind continue];
++ _17 = const true;
++ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind continue];
}
bb5: {
- _15 = Div(move _16, const 0_u64);
-- StorageDead(_16);
+ _15 = Div(_1, const 0_u64);
+ StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb6, unwind continue];
}
@@ -138,17 +139,18 @@
StorageDead(_14);
StorageLive(_18);
StorageLive(_19);
-- StorageLive(_20);
-- _20 = _1;
- _21 = Eq(const 1_u64, const 0_u64);
+ StorageLive(_20);
+ _20 = _1;
+- _21 = Eq(const 1_u64, const 0_u64);
- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind continue];
-+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind continue];
++ _21 = const false;
++ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind continue];
}
bb7: {
- _19 = Div(move _20, const 1_u64);
-- StorageDead(_20);
+ _19 = Div(_1, const 1_u64);
+ StorageDead(_20);
_18 = opaque::<u64>(move _19) -> [return: bb8, unwind continue];
}
@@ -157,8 +159,8 @@
StorageDead(_18);
StorageLive(_22);
StorageLive(_23);
-- StorageLive(_24);
-- _24 = _1;
+ StorageLive(_24);
+ _24 = _1;
- _25 = Eq(_24, const 0_u64);
- assert(!move _25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind continue];
+ _25 = Eq(_1, const 0_u64);
@@ -167,8 +169,8 @@
bb9: {
- _23 = Div(const 0_u64, move _24);
-- StorageDead(_24);
+ _23 = Div(const 0_u64, _1);
+ StorageDead(_24);
_22 = opaque::<u64>(move _23) -> [return: bb10, unwind continue];
}
@@ -177,17 +179,18 @@
StorageDead(_22);
StorageLive(_26);
StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
+ StorageLive(_28);
+ _28 = _1;
- _29 = Eq(_28, const 0_u64);
- assert(!move _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind continue];
++ _29 = _25;
+ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind continue];
}
bb11: {
- _27 = Div(const 1_u64, move _28);
-- StorageDead(_28);
+ _27 = Div(const 1_u64, _1);
+ StorageDead(_28);
_26 = opaque::<u64>(move _27) -> [return: bb12, unwind continue];
}
@@ -196,17 +199,18 @@
StorageDead(_26);
StorageLive(_30);
StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
+ StorageLive(_32);
+ _32 = _1;
- _33 = Eq(const 0_u64, const 0_u64);
- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind continue];
-+ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind continue];
++ _33 = const true;
++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind continue];
}
bb13: {
- _31 = Rem(move _32, const 0_u64);
-- StorageDead(_32);
+ _31 = Rem(_1, const 0_u64);
+ StorageDead(_32);
_30 = opaque::<u64>(move _31) -> [return: bb14, unwind continue];
}
@@ -215,17 +219,18 @@
StorageDead(_30);
StorageLive(_34);
StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
+ StorageLive(_36);
+ _36 = _1;
- _37 = Eq(const 1_u64, const 0_u64);
- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind continue];
-+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind continue];
++ _37 = const false;
++ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind continue];
}
bb15: {
- _35 = Rem(move _36, const 1_u64);
-- StorageDead(_36);
+ _35 = Rem(_1, const 1_u64);
+ StorageDead(_36);
_34 = opaque::<u64>(move _35) -> [return: bb16, unwind continue];
}
@@ -234,17 +239,18 @@
StorageDead(_34);
StorageLive(_38);
StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
+ StorageLive(_40);
+ _40 = _1;
- _41 = Eq(_40, const 0_u64);
- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind continue];
++ _41 = _25;
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind continue];
}
bb17: {
- _39 = Rem(const 0_u64, move _40);
-- StorageDead(_40);
+ _39 = Rem(const 0_u64, _1);
+ StorageDead(_40);
_38 = opaque::<u64>(move _39) -> [return: bb18, unwind continue];
}
@@ -253,17 +259,18 @@
StorageDead(_38);
StorageLive(_42);
StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
+ StorageLive(_44);
+ _44 = _1;
- _45 = Eq(_44, const 0_u64);
- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind continue];
++ _45 = _25;
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind continue];
}
bb19: {
- _43 = Rem(const 1_u64, move _44);
-- StorageDead(_44);
+ _43 = Rem(const 1_u64, _1);
+ StorageDead(_44);
_42 = opaque::<u64>(move _43) -> [return: bb20, unwind continue];
}
@@ -272,11 +279,11 @@
StorageDead(_42);
StorageLive(_46);
StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
+ StorageLive(_48);
+ _48 = _1;
- _47 = BitAnd(move _48, const 0_u64);
-- StorageDead(_48);
+ _47 = BitAnd(_1, const 0_u64);
+ StorageDead(_48);
_46 = opaque::<u64>(move _47) -> [return: bb21, unwind continue];
}
@@ -285,11 +292,11 @@
StorageDead(_46);
StorageLive(_49);
StorageLive(_50);
-- StorageLive(_51);
-- _51 = _1;
+ StorageLive(_51);
+ _51 = _1;
- _50 = BitOr(move _51, const 0_u64);
-- StorageDead(_51);
+ _50 = BitOr(_1, const 0_u64);
+ StorageDead(_51);
_49 = opaque::<u64>(move _50) -> [return: bb22, unwind continue];
}
@@ -298,11 +305,11 @@
StorageDead(_49);
StorageLive(_52);
StorageLive(_53);
-- StorageLive(_54);
-- _54 = _1;
+ StorageLive(_54);
+ _54 = _1;
- _53 = BitXor(move _54, const 0_u64);
-- StorageDead(_54);
+ _53 = BitXor(_1, const 0_u64);
+ StorageDead(_54);
_52 = opaque::<u64>(move _53) -> [return: bb23, unwind continue];
}
@@ -311,11 +318,11 @@
StorageDead(_52);
StorageLive(_55);
StorageLive(_56);
-- StorageLive(_57);
-- _57 = _1;
+ StorageLive(_57);
+ _57 = _1;
- _56 = Shr(move _57, const 0_i32);
-- StorageDead(_57);
+ _56 = Shr(_1, const 0_i32);
+ StorageDead(_57);
_55 = opaque::<u64>(move _56) -> [return: bb24, unwind continue];
}
@@ -324,11 +331,11 @@
StorageDead(_55);
StorageLive(_58);
StorageLive(_59);
-- StorageLive(_60);
-- _60 = _1;
+ StorageLive(_60);
+ _60 = _1;
- _59 = Shl(move _60, const 0_i32);
-- StorageDead(_60);
+ _59 = Shl(_1, const 0_i32);
+ StorageDead(_60);
_58 = opaque::<u64>(move _59) -> [return: bb25, unwind continue];
}
diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
index 0c342799e..6633df3ae 100644
--- a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
@@ -20,63 +20,12 @@
let mut _15: u64;
let mut _16: u64;
let mut _17: (u64, bool);
- let _18: ();
- let mut _19: u64;
- let mut _20: u64;
- let mut _21: bool;
- let _22: ();
- let mut _23: u64;
- let mut _24: u64;
- let mut _25: bool;
- let _26: ();
- let mut _27: u64;
- let mut _28: u64;
- let mut _29: bool;
- let _30: ();
- let mut _31: u64;
- let mut _32: u64;
- let mut _33: bool;
- let _34: ();
- let mut _35: u64;
- let mut _36: u64;
- let mut _37: bool;
- let _38: ();
- let mut _39: u64;
- let mut _40: u64;
- let mut _41: bool;
- let _42: ();
- let mut _43: u64;
- let mut _44: u64;
- let mut _45: bool;
- let _46: ();
- let mut _47: u64;
- let mut _48: u64;
- let mut _49: bool;
- let _50: ();
- let mut _51: u64;
- let mut _52: u64;
- let _53: ();
- let mut _54: u64;
- let mut _55: u64;
- let _56: ();
- let mut _57: u64;
- let mut _58: u64;
- let _59: ();
- let mut _60: u64;
- let mut _61: u64;
- let mut _62: u32;
- let mut _63: bool;
- let _64: ();
- let mut _65: u64;
- let mut _66: u64;
- let mut _67: u32;
- let mut _68: bool;
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _5 = CheckedAdd(_4, const 0_u64);
- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind unreachable];
+ _5 = CheckedAdd(_1, const 0_u64);
@@ -85,7 +34,7 @@
bb1: {
_3 = move (_5.0: u64);
-- StorageDead(_4);
+ StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb2, unwind unreachable];
}
@@ -94,8 +43,8 @@
StorageDead(_2);
StorageLive(_6);
StorageLive(_7);
-- StorageLive(_8);
-- _8 = _1;
+ StorageLive(_8);
+ _8 = _1;
- _9 = CheckedSub(_8, const 0_u64);
- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind unreachable];
+ _9 = CheckedSub(_1, const 0_u64);
@@ -104,7 +53,7 @@
bb3: {
_7 = move (_9.0: u64);
-- StorageDead(_8);
+ StorageDead(_8);
_6 = opaque::<u64>(move _7) -> [return: bb4, unwind unreachable];
}
@@ -113,8 +62,8 @@
StorageDead(_6);
StorageLive(_10);
StorageLive(_11);
-- StorageLive(_12);
-- _12 = _1;
+ StorageLive(_12);
+ _12 = _1;
- _13 = CheckedMul(_12, const 0_u64);
- assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind unreachable];
+ _13 = CheckedMul(_1, const 0_u64);
@@ -123,7 +72,7 @@
bb5: {
_11 = move (_13.0: u64);
-- StorageDead(_12);
+ StorageDead(_12);
_10 = opaque::<u64>(move _11) -> [return: bb6, unwind unreachable];
}
@@ -132,8 +81,8 @@
StorageDead(_10);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
+ StorageLive(_16);
+ _16 = _1;
- _17 = CheckedMul(_16, const 1_u64);
- assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind unreachable];
+ _17 = CheckedMul(_1, const 1_u64);
@@ -142,246 +91,13 @@
bb7: {
_15 = move (_17.0: u64);
-- StorageDead(_16);
+ StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb8, unwind unreachable];
}
bb8: {
StorageDead(_15);
StorageDead(_14);
- StorageLive(_18);
- StorageLive(_19);
-- StorageLive(_20);
-- _20 = _1;
- _21 = Eq(const 0_u64, const 0_u64);
-- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind unreachable];
-+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind unreachable];
- }
-
- bb9: {
-- _19 = Div(move _20, const 0_u64);
-- StorageDead(_20);
-+ _19 = Div(_1, const 0_u64);
- _18 = opaque::<u64>(move _19) -> [return: bb10, unwind unreachable];
- }
-
- bb10: {
- StorageDead(_19);
- StorageDead(_18);
- StorageLive(_22);
- StorageLive(_23);
-- StorageLive(_24);
-- _24 = _1;
- _25 = Eq(const 1_u64, const 0_u64);
-- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind unreachable];
-+ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind unreachable];
- }
-
- bb11: {
-- _23 = Div(move _24, const 1_u64);
-- StorageDead(_24);
-+ _23 = Div(_1, const 1_u64);
- _22 = opaque::<u64>(move _23) -> [return: bb12, unwind unreachable];
- }
-
- bb12: {
- StorageDead(_23);
- StorageDead(_22);
- StorageLive(_26);
- StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
-- _29 = Eq(_28, const 0_u64);
-- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
-+ _29 = Eq(_1, const 0_u64);
-+ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
- }
-
- bb13: {
-- _27 = Div(const 0_u64, move _28);
-- StorageDead(_28);
-+ _27 = Div(const 0_u64, _1);
- _26 = opaque::<u64>(move _27) -> [return: bb14, unwind unreachable];
- }
-
- bb14: {
- StorageDead(_27);
- StorageDead(_26);
- StorageLive(_30);
- StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
-- _33 = Eq(_32, const 0_u64);
-- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
-+ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
- }
-
- bb15: {
-- _31 = Div(const 1_u64, move _32);
-- StorageDead(_32);
-+ _31 = Div(const 1_u64, _1);
- _30 = opaque::<u64>(move _31) -> [return: bb16, unwind unreachable];
- }
-
- bb16: {
- StorageDead(_31);
- StorageDead(_30);
- StorageLive(_34);
- StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
-- _37 = Eq(const 0_u64, const 0_u64);
-- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind unreachable];
-+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind unreachable];
- }
-
- bb17: {
-- _35 = Rem(move _36, const 0_u64);
-- StorageDead(_36);
-+ _35 = Rem(_1, const 0_u64);
- _34 = opaque::<u64>(move _35) -> [return: bb18, unwind unreachable];
- }
-
- bb18: {
- StorageDead(_35);
- StorageDead(_34);
- StorageLive(_38);
- StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
-- _41 = Eq(const 1_u64, const 0_u64);
-- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind unreachable];
-+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind unreachable];
- }
-
- bb19: {
-- _39 = Rem(move _40, const 1_u64);
-- StorageDead(_40);
-+ _39 = Rem(_1, const 1_u64);
- _38 = opaque::<u64>(move _39) -> [return: bb20, unwind unreachable];
- }
-
- bb20: {
- StorageDead(_39);
- StorageDead(_38);
- StorageLive(_42);
- StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
-- _45 = Eq(_44, const 0_u64);
-- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
-+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
- }
-
- bb21: {
-- _43 = Rem(const 0_u64, move _44);
-- StorageDead(_44);
-+ _43 = Rem(const 0_u64, _1);
- _42 = opaque::<u64>(move _43) -> [return: bb22, unwind unreachable];
- }
-
- bb22: {
- StorageDead(_43);
- StorageDead(_42);
- StorageLive(_46);
- StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
-- _49 = Eq(_48, const 0_u64);
-- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
-+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
- }
-
- bb23: {
-- _47 = Rem(const 1_u64, move _48);
-- StorageDead(_48);
-+ _47 = Rem(const 1_u64, _1);
- _46 = opaque::<u64>(move _47) -> [return: bb24, unwind unreachable];
- }
-
- bb24: {
- StorageDead(_47);
- StorageDead(_46);
- StorageLive(_50);
- StorageLive(_51);
-- StorageLive(_52);
-- _52 = _1;
-- _51 = BitAnd(move _52, const 0_u64);
-- StorageDead(_52);
-+ _51 = BitAnd(_1, const 0_u64);
- _50 = opaque::<u64>(move _51) -> [return: bb25, unwind unreachable];
- }
-
- bb25: {
- StorageDead(_51);
- StorageDead(_50);
- StorageLive(_53);
- StorageLive(_54);
-- StorageLive(_55);
-- _55 = _1;
-- _54 = BitOr(move _55, const 0_u64);
-- StorageDead(_55);
-+ _54 = BitOr(_1, const 0_u64);
- _53 = opaque::<u64>(move _54) -> [return: bb26, unwind unreachable];
- }
-
- bb26: {
- StorageDead(_54);
- StorageDead(_53);
- StorageLive(_56);
- StorageLive(_57);
-- StorageLive(_58);
-- _58 = _1;
-- _57 = BitXor(move _58, const 0_u64);
-- StorageDead(_58);
-+ _57 = BitXor(_1, const 0_u64);
- _56 = opaque::<u64>(move _57) -> [return: bb27, unwind unreachable];
- }
-
- bb27: {
- StorageDead(_57);
- StorageDead(_56);
- StorageLive(_59);
- StorageLive(_60);
-- StorageLive(_61);
-- _61 = _1;
- _62 = const 0_i32 as u32 (IntToInt);
-- _63 = Lt(move _62, const 64_u32);
-- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
-+ _63 = Lt(_62, const 64_u32);
-+ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
- }
-
- bb28: {
-- _60 = Shr(move _61, const 0_i32);
-- StorageDead(_61);
-+ _60 = Shr(_1, const 0_i32);
- _59 = opaque::<u64>(move _60) -> [return: bb29, unwind unreachable];
- }
-
- bb29: {
- StorageDead(_60);
- StorageDead(_59);
- StorageLive(_64);
- StorageLive(_65);
-- StorageLive(_66);
-- _66 = _1;
-- _67 = const 0_i32 as u32 (IntToInt);
-- _68 = Lt(move _67, const 64_u32);
-- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
-+ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
- }
-
- bb30: {
-- _65 = Shl(move _66, const 0_i32);
-- StorageDead(_66);
-+ _65 = Shl(_1, const 0_i32);
- _64 = opaque::<u64>(move _65) -> [return: bb31, unwind unreachable];
- }
-
- bb31: {
- StorageDead(_65);
- StorageDead(_64);
_0 = const ();
return;
}
diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
index 7813c29b9..d100a77fe 100644
--- a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
@@ -20,63 +20,12 @@
let mut _15: u64;
let mut _16: u64;
let mut _17: (u64, bool);
- let _18: ();
- let mut _19: u64;
- let mut _20: u64;
- let mut _21: bool;
- let _22: ();
- let mut _23: u64;
- let mut _24: u64;
- let mut _25: bool;
- let _26: ();
- let mut _27: u64;
- let mut _28: u64;
- let mut _29: bool;
- let _30: ();
- let mut _31: u64;
- let mut _32: u64;
- let mut _33: bool;
- let _34: ();
- let mut _35: u64;
- let mut _36: u64;
- let mut _37: bool;
- let _38: ();
- let mut _39: u64;
- let mut _40: u64;
- let mut _41: bool;
- let _42: ();
- let mut _43: u64;
- let mut _44: u64;
- let mut _45: bool;
- let _46: ();
- let mut _47: u64;
- let mut _48: u64;
- let mut _49: bool;
- let _50: ();
- let mut _51: u64;
- let mut _52: u64;
- let _53: ();
- let mut _54: u64;
- let mut _55: u64;
- let _56: ();
- let mut _57: u64;
- let mut _58: u64;
- let _59: ();
- let mut _60: u64;
- let mut _61: u64;
- let mut _62: u32;
- let mut _63: bool;
- let _64: ();
- let mut _65: u64;
- let mut _66: u64;
- let mut _67: u32;
- let mut _68: bool;
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _5 = CheckedAdd(_4, const 0_u64);
- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind continue];
+ _5 = CheckedAdd(_1, const 0_u64);
@@ -85,7 +34,7 @@
bb1: {
_3 = move (_5.0: u64);
-- StorageDead(_4);
+ StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb2, unwind continue];
}
@@ -94,8 +43,8 @@
StorageDead(_2);
StorageLive(_6);
StorageLive(_7);
-- StorageLive(_8);
-- _8 = _1;
+ StorageLive(_8);
+ _8 = _1;
- _9 = CheckedSub(_8, const 0_u64);
- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind continue];
+ _9 = CheckedSub(_1, const 0_u64);
@@ -104,7 +53,7 @@
bb3: {
_7 = move (_9.0: u64);
-- StorageDead(_8);
+ StorageDead(_8);
_6 = opaque::<u64>(move _7) -> [return: bb4, unwind continue];
}
@@ -113,8 +62,8 @@
StorageDead(_6);
StorageLive(_10);
StorageLive(_11);
-- StorageLive(_12);
-- _12 = _1;
+ StorageLive(_12);
+ _12 = _1;
- _13 = CheckedMul(_12, const 0_u64);
- assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind continue];
+ _13 = CheckedMul(_1, const 0_u64);
@@ -123,7 +72,7 @@
bb5: {
_11 = move (_13.0: u64);
-- StorageDead(_12);
+ StorageDead(_12);
_10 = opaque::<u64>(move _11) -> [return: bb6, unwind continue];
}
@@ -132,8 +81,8 @@
StorageDead(_10);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
+ StorageLive(_16);
+ _16 = _1;
- _17 = CheckedMul(_16, const 1_u64);
- assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind continue];
+ _17 = CheckedMul(_1, const 1_u64);
@@ -142,246 +91,13 @@
bb7: {
_15 = move (_17.0: u64);
-- StorageDead(_16);
+ StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb8, unwind continue];
}
bb8: {
StorageDead(_15);
StorageDead(_14);
- StorageLive(_18);
- StorageLive(_19);
-- StorageLive(_20);
-- _20 = _1;
- _21 = Eq(const 0_u64, const 0_u64);
-- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind continue];
-+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind continue];
- }
-
- bb9: {
-- _19 = Div(move _20, const 0_u64);
-- StorageDead(_20);
-+ _19 = Div(_1, const 0_u64);
- _18 = opaque::<u64>(move _19) -> [return: bb10, unwind continue];
- }
-
- bb10: {
- StorageDead(_19);
- StorageDead(_18);
- StorageLive(_22);
- StorageLive(_23);
-- StorageLive(_24);
-- _24 = _1;
- _25 = Eq(const 1_u64, const 0_u64);
-- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind continue];
-+ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind continue];
- }
-
- bb11: {
-- _23 = Div(move _24, const 1_u64);
-- StorageDead(_24);
-+ _23 = Div(_1, const 1_u64);
- _22 = opaque::<u64>(move _23) -> [return: bb12, unwind continue];
- }
-
- bb12: {
- StorageDead(_23);
- StorageDead(_22);
- StorageLive(_26);
- StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
-- _29 = Eq(_28, const 0_u64);
-- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
-+ _29 = Eq(_1, const 0_u64);
-+ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
- }
-
- bb13: {
-- _27 = Div(const 0_u64, move _28);
-- StorageDead(_28);
-+ _27 = Div(const 0_u64, _1);
- _26 = opaque::<u64>(move _27) -> [return: bb14, unwind continue];
- }
-
- bb14: {
- StorageDead(_27);
- StorageDead(_26);
- StorageLive(_30);
- StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
-- _33 = Eq(_32, const 0_u64);
-- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
-+ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
- }
-
- bb15: {
-- _31 = Div(const 1_u64, move _32);
-- StorageDead(_32);
-+ _31 = Div(const 1_u64, _1);
- _30 = opaque::<u64>(move _31) -> [return: bb16, unwind continue];
- }
-
- bb16: {
- StorageDead(_31);
- StorageDead(_30);
- StorageLive(_34);
- StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
-- _37 = Eq(const 0_u64, const 0_u64);
-- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind continue];
-+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind continue];
- }
-
- bb17: {
-- _35 = Rem(move _36, const 0_u64);
-- StorageDead(_36);
-+ _35 = Rem(_1, const 0_u64);
- _34 = opaque::<u64>(move _35) -> [return: bb18, unwind continue];
- }
-
- bb18: {
- StorageDead(_35);
- StorageDead(_34);
- StorageLive(_38);
- StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
-- _41 = Eq(const 1_u64, const 0_u64);
-- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind continue];
-+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind continue];
- }
-
- bb19: {
-- _39 = Rem(move _40, const 1_u64);
-- StorageDead(_40);
-+ _39 = Rem(_1, const 1_u64);
- _38 = opaque::<u64>(move _39) -> [return: bb20, unwind continue];
- }
-
- bb20: {
- StorageDead(_39);
- StorageDead(_38);
- StorageLive(_42);
- StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
-- _45 = Eq(_44, const 0_u64);
-- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
-+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
- }
-
- bb21: {
-- _43 = Rem(const 0_u64, move _44);
-- StorageDead(_44);
-+ _43 = Rem(const 0_u64, _1);
- _42 = opaque::<u64>(move _43) -> [return: bb22, unwind continue];
- }
-
- bb22: {
- StorageDead(_43);
- StorageDead(_42);
- StorageLive(_46);
- StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
-- _49 = Eq(_48, const 0_u64);
-- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
-+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
- }
-
- bb23: {
-- _47 = Rem(const 1_u64, move _48);
-- StorageDead(_48);
-+ _47 = Rem(const 1_u64, _1);
- _46 = opaque::<u64>(move _47) -> [return: bb24, unwind continue];
- }
-
- bb24: {
- StorageDead(_47);
- StorageDead(_46);
- StorageLive(_50);
- StorageLive(_51);
-- StorageLive(_52);
-- _52 = _1;
-- _51 = BitAnd(move _52, const 0_u64);
-- StorageDead(_52);
-+ _51 = BitAnd(_1, const 0_u64);
- _50 = opaque::<u64>(move _51) -> [return: bb25, unwind continue];
- }
-
- bb25: {
- StorageDead(_51);
- StorageDead(_50);
- StorageLive(_53);
- StorageLive(_54);
-- StorageLive(_55);
-- _55 = _1;
-- _54 = BitOr(move _55, const 0_u64);
-- StorageDead(_55);
-+ _54 = BitOr(_1, const 0_u64);
- _53 = opaque::<u64>(move _54) -> [return: bb26, unwind continue];
- }
-
- bb26: {
- StorageDead(_54);
- StorageDead(_53);
- StorageLive(_56);
- StorageLive(_57);
-- StorageLive(_58);
-- _58 = _1;
-- _57 = BitXor(move _58, const 0_u64);
-- StorageDead(_58);
-+ _57 = BitXor(_1, const 0_u64);
- _56 = opaque::<u64>(move _57) -> [return: bb27, unwind continue];
- }
-
- bb27: {
- StorageDead(_57);
- StorageDead(_56);
- StorageLive(_59);
- StorageLive(_60);
-- StorageLive(_61);
-- _61 = _1;
- _62 = const 0_i32 as u32 (IntToInt);
-- _63 = Lt(move _62, const 64_u32);
-- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
-+ _63 = Lt(_62, const 64_u32);
-+ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
- }
-
- bb28: {
-- _60 = Shr(move _61, const 0_i32);
-- StorageDead(_61);
-+ _60 = Shr(_1, const 0_i32);
- _59 = opaque::<u64>(move _60) -> [return: bb29, unwind continue];
- }
-
- bb29: {
- StorageDead(_60);
- StorageDead(_59);
- StorageLive(_64);
- StorageLive(_65);
-- StorageLive(_66);
-- _66 = _1;
-- _67 = const 0_i32 as u32 (IntToInt);
-- _68 = Lt(move _67, const 64_u32);
-- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
-+ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
- }
-
- bb30: {
-- _65 = Shl(move _66, const 0_i32);
-- StorageDead(_66);
-+ _65 = Shl(_1, const 0_i32);
- _64 = opaque::<u64>(move _65) -> [return: bb31, unwind continue];
- }
-
- bb31: {
- StorageDead(_65);
- StorageDead(_64);
_0 = const ();
return;
}
diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
index 7d5ac8353..b332100ea 100644
--- a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
@@ -37,11 +37,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = Add(move _4, const 0f64);
-- StorageDead(_4);
+ _3 = Add(_1, const 0f64);
+ StorageDead(_4);
_2 = opaque::<f64>(move _3) -> [return: bb1, unwind unreachable];
}
@@ -50,11 +50,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
-- StorageLive(_7);
-- _7 = _1;
+ StorageLive(_7);
+ _7 = _1;
- _6 = Sub(move _7, const 0f64);
-- StorageDead(_7);
+ _6 = Sub(_1, const 0f64);
+ StorageDead(_7);
_5 = opaque::<f64>(move _6) -> [return: bb2, unwind unreachable];
}
@@ -63,11 +63,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
+ StorageLive(_10);
+ _10 = _1;
- _9 = Mul(move _10, const 0f64);
-- StorageDead(_10);
+ _9 = Mul(_1, const 0f64);
+ StorageDead(_10);
_8 = opaque::<f64>(move _9) -> [return: bb3, unwind unreachable];
}
@@ -76,11 +76,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
-- StorageLive(_13);
-- _13 = _1;
+ StorageLive(_13);
+ _13 = _1;
- _12 = Div(move _13, const 0f64);
-- StorageDead(_13);
+ _12 = Div(_1, const 0f64);
+ StorageDead(_13);
_11 = opaque::<f64>(move _12) -> [return: bb4, unwind unreachable];
}
@@ -89,11 +89,11 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
+ StorageLive(_16);
+ _16 = _1;
- _15 = Div(const 0f64, move _16);
-- StorageDead(_16);
+ _15 = Div(const 0f64, _1);
+ StorageDead(_16);
_14 = opaque::<f64>(move _15) -> [return: bb5, unwind unreachable];
}
@@ -102,11 +102,11 @@
StorageDead(_14);
StorageLive(_17);
StorageLive(_18);
-- StorageLive(_19);
-- _19 = _1;
+ StorageLive(_19);
+ _19 = _1;
- _18 = Rem(move _19, const 0f64);
-- StorageDead(_19);
+ _18 = Rem(_1, const 0f64);
+ StorageDead(_19);
_17 = opaque::<f64>(move _18) -> [return: bb6, unwind unreachable];
}
@@ -115,11 +115,11 @@
StorageDead(_17);
StorageLive(_20);
StorageLive(_21);
-- StorageLive(_22);
-- _22 = _1;
+ StorageLive(_22);
+ _22 = _1;
- _21 = Rem(const 0f64, move _22);
-- StorageDead(_22);
+ _21 = Rem(const 0f64, _1);
+ StorageDead(_22);
_20 = opaque::<f64>(move _21) -> [return: bb7, unwind unreachable];
}
@@ -128,14 +128,14 @@
StorageDead(_20);
StorageLive(_23);
StorageLive(_24);
-- StorageLive(_25);
-- _25 = _1;
-- StorageLive(_26);
-- _26 = _1;
+ StorageLive(_25);
+ _25 = _1;
+ StorageLive(_26);
+ _26 = _1;
- _24 = Eq(move _25, move _26);
-- StorageDead(_26);
-- StorageDead(_25);
+ _24 = Eq(_1, _1);
+ StorageDead(_26);
+ StorageDead(_25);
_23 = opaque::<bool>(move _24) -> [return: bb8, unwind unreachable];
}
@@ -144,14 +144,14 @@
StorageDead(_23);
StorageLive(_27);
StorageLive(_28);
-- StorageLive(_29);
-- _29 = _1;
-- StorageLive(_30);
-- _30 = _1;
+ StorageLive(_29);
+ _29 = _1;
+ StorageLive(_30);
+ _30 = _1;
- _28 = Ne(move _29, move _30);
-- StorageDead(_30);
-- StorageDead(_29);
+ _28 = Ne(_1, _1);
+ StorageDead(_30);
+ StorageDead(_29);
_27 = opaque::<bool>(move _28) -> [return: bb9, unwind unreachable];
}
diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
index 36c26dc66..28664cb0a 100644
--- a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
@@ -37,11 +37,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = Add(move _4, const 0f64);
-- StorageDead(_4);
+ _3 = Add(_1, const 0f64);
+ StorageDead(_4);
_2 = opaque::<f64>(move _3) -> [return: bb1, unwind continue];
}
@@ -50,11 +50,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
-- StorageLive(_7);
-- _7 = _1;
+ StorageLive(_7);
+ _7 = _1;
- _6 = Sub(move _7, const 0f64);
-- StorageDead(_7);
+ _6 = Sub(_1, const 0f64);
+ StorageDead(_7);
_5 = opaque::<f64>(move _6) -> [return: bb2, unwind continue];
}
@@ -63,11 +63,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
+ StorageLive(_10);
+ _10 = _1;
- _9 = Mul(move _10, const 0f64);
-- StorageDead(_10);
+ _9 = Mul(_1, const 0f64);
+ StorageDead(_10);
_8 = opaque::<f64>(move _9) -> [return: bb3, unwind continue];
}
@@ -76,11 +76,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
-- StorageLive(_13);
-- _13 = _1;
+ StorageLive(_13);
+ _13 = _1;
- _12 = Div(move _13, const 0f64);
-- StorageDead(_13);
+ _12 = Div(_1, const 0f64);
+ StorageDead(_13);
_11 = opaque::<f64>(move _12) -> [return: bb4, unwind continue];
}
@@ -89,11 +89,11 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
+ StorageLive(_16);
+ _16 = _1;
- _15 = Div(const 0f64, move _16);
-- StorageDead(_16);
+ _15 = Div(const 0f64, _1);
+ StorageDead(_16);
_14 = opaque::<f64>(move _15) -> [return: bb5, unwind continue];
}
@@ -102,11 +102,11 @@
StorageDead(_14);
StorageLive(_17);
StorageLive(_18);
-- StorageLive(_19);
-- _19 = _1;
+ StorageLive(_19);
+ _19 = _1;
- _18 = Rem(move _19, const 0f64);
-- StorageDead(_19);
+ _18 = Rem(_1, const 0f64);
+ StorageDead(_19);
_17 = opaque::<f64>(move _18) -> [return: bb6, unwind continue];
}
@@ -115,11 +115,11 @@
StorageDead(_17);
StorageLive(_20);
StorageLive(_21);
-- StorageLive(_22);
-- _22 = _1;
+ StorageLive(_22);
+ _22 = _1;
- _21 = Rem(const 0f64, move _22);
-- StorageDead(_22);
+ _21 = Rem(const 0f64, _1);
+ StorageDead(_22);
_20 = opaque::<f64>(move _21) -> [return: bb7, unwind continue];
}
@@ -128,14 +128,14 @@
StorageDead(_20);
StorageLive(_23);
StorageLive(_24);
-- StorageLive(_25);
-- _25 = _1;
-- StorageLive(_26);
-- _26 = _1;
+ StorageLive(_25);
+ _25 = _1;
+ StorageLive(_26);
+ _26 = _1;
- _24 = Eq(move _25, move _26);
-- StorageDead(_26);
-- StorageDead(_25);
+ _24 = Eq(_1, _1);
+ StorageDead(_26);
+ StorageDead(_25);
_23 = opaque::<bool>(move _24) -> [return: bb8, unwind continue];
}
@@ -144,14 +144,14 @@
StorageDead(_23);
StorageLive(_27);
StorageLive(_28);
-- StorageLive(_29);
-- _29 = _1;
-- StorageLive(_30);
-- _30 = _1;
+ StorageLive(_29);
+ _29 = _1;
+ StorageLive(_30);
+ _30 = _1;
- _28 = Ne(move _29, move _30);
-- StorageDead(_30);
-- StorageDead(_29);
+ _28 = Ne(_1, _1);
+ StorageDead(_30);
+ StorageDead(_29);
_27 = opaque::<bool>(move _28) -> [return: bb9, unwind continue];
}
diff --git a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
index 513fe60b6..d43198c99 100644
--- a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
@@ -105,19 +105,24 @@
bb0: {
- StorageLive(_1);
++ nop;
_1 = const 1_i64;
- StorageLive(_2);
++ nop;
_2 = const 1_u64;
- StorageLive(_3);
++ nop;
_3 = const 1f64;
StorageLive(_4);
StorageLive(_5);
-- StorageLive(_6);
+ StorageLive(_6);
- _6 = _1;
- _5 = move _6 as u8 (IntToInt);
-- StorageDead(_6);
-+ _5 = const 1_i64 as u8 (IntToInt);
- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind unreachable];
++ _6 = const 1_i64;
++ _5 = const 1_u8;
+ StorageDead(_6);
+- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind unreachable];
++ _4 = opaque::<u8>(const 1_u8) -> [return: bb1, unwind unreachable];
}
bb1: {
@@ -125,12 +130,14 @@
StorageDead(_4);
StorageLive(_7);
StorageLive(_8);
-- StorageLive(_9);
+ StorageLive(_9);
- _9 = _1;
- _8 = move _9 as u16 (IntToInt);
-- StorageDead(_9);
-+ _8 = const 1_i64 as u16 (IntToInt);
- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind unreachable];
++ _9 = const 1_i64;
++ _8 = const 1_u16;
+ StorageDead(_9);
+- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind unreachable];
++ _7 = opaque::<u16>(const 1_u16) -> [return: bb2, unwind unreachable];
}
bb2: {
@@ -138,12 +145,14 @@
StorageDead(_7);
StorageLive(_10);
StorageLive(_11);
-- StorageLive(_12);
+ StorageLive(_12);
- _12 = _1;
- _11 = move _12 as u32 (IntToInt);
-- StorageDead(_12);
-+ _11 = const 1_i64 as u32 (IntToInt);
- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind unreachable];
++ _12 = const 1_i64;
++ _11 = const 1_u32;
+ StorageDead(_12);
+- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind unreachable];
++ _10 = opaque::<u32>(const 1_u32) -> [return: bb3, unwind unreachable];
}
bb3: {
@@ -151,12 +160,14 @@
StorageDead(_10);
StorageLive(_13);
StorageLive(_14);
-- StorageLive(_15);
+ StorageLive(_15);
- _15 = _1;
- _14 = move _15 as u64 (IntToInt);
-- StorageDead(_15);
-+ _14 = const 1_i64 as u64 (IntToInt);
- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind unreachable];
++ _15 = const 1_i64;
++ _14 = const 1_u64;
+ StorageDead(_15);
+- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind unreachable];
++ _13 = opaque::<u64>(const 1_u64) -> [return: bb4, unwind unreachable];
}
bb4: {
@@ -164,12 +175,14 @@
StorageDead(_13);
StorageLive(_16);
StorageLive(_17);
-- StorageLive(_18);
+ StorageLive(_18);
- _18 = _1;
- _17 = move _18 as i8 (IntToInt);
-- StorageDead(_18);
-+ _17 = const 1_i64 as i8 (IntToInt);
- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind unreachable];
++ _18 = const 1_i64;
++ _17 = const 1_i8;
+ StorageDead(_18);
+- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind unreachable];
++ _16 = opaque::<i8>(const 1_i8) -> [return: bb5, unwind unreachable];
}
bb5: {
@@ -177,12 +190,14 @@
StorageDead(_16);
StorageLive(_19);
StorageLive(_20);
-- StorageLive(_21);
+ StorageLive(_21);
- _21 = _1;
- _20 = move _21 as i16 (IntToInt);
-- StorageDead(_21);
-+ _20 = const 1_i64 as i16 (IntToInt);
- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind unreachable];
++ _21 = const 1_i64;
++ _20 = const 1_i16;
+ StorageDead(_21);
+- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind unreachable];
++ _19 = opaque::<i16>(const 1_i16) -> [return: bb6, unwind unreachable];
}
bb6: {
@@ -190,35 +205,40 @@
StorageDead(_19);
StorageLive(_22);
StorageLive(_23);
-- StorageLive(_24);
+ StorageLive(_24);
- _24 = _1;
- _23 = move _24 as i32 (IntToInt);
-- StorageDead(_24);
-+ _23 = const 1_i64 as i32 (IntToInt);
- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind unreachable];
++ _24 = const 1_i64;
++ _23 = const 1_i32;
+ StorageDead(_24);
+- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind unreachable];
++ _22 = opaque::<i32>(const 1_i32) -> [return: bb7, unwind unreachable];
}
bb7: {
StorageDead(_23);
StorageDead(_22);
StorageLive(_25);
-- StorageLive(_26);
+ StorageLive(_26);
- _26 = _1;
- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind unreachable];
++ _26 = const 1_i64;
+ _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind unreachable];
}
bb8: {
-- StorageDead(_26);
+ StorageDead(_26);
StorageDead(_25);
StorageLive(_27);
StorageLive(_28);
-- StorageLive(_29);
+ StorageLive(_29);
- _29 = _1;
- _28 = move _29 as f32 (IntToFloat);
-- StorageDead(_29);
-+ _28 = const 1_i64 as f32 (IntToFloat);
- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind unreachable];
++ _29 = const 1_i64;
++ _28 = const 1f32;
+ StorageDead(_29);
+- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind unreachable];
++ _27 = opaque::<f32>(const 1f32) -> [return: bb9, unwind unreachable];
}
bb9: {
@@ -226,12 +246,14 @@
StorageDead(_27);
StorageLive(_30);
StorageLive(_31);
-- StorageLive(_32);
+ StorageLive(_32);
- _32 = _1;
- _31 = move _32 as f64 (IntToFloat);
-- StorageDead(_32);
-+ _31 = const 1_i64 as f64 (IntToFloat);
- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind unreachable];
++ _32 = const 1_i64;
++ _31 = const 1f64;
+ StorageDead(_32);
+- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind unreachable];
++ _30 = opaque::<f64>(const 1f64) -> [return: bb10, unwind unreachable];
}
bb10: {
@@ -239,12 +261,14 @@
StorageDead(_30);
StorageLive(_33);
StorageLive(_34);
-- StorageLive(_35);
+ StorageLive(_35);
- _35 = _2;
- _34 = move _35 as u8 (IntToInt);
-- StorageDead(_35);
-+ _34 = const 1_u64 as u8 (IntToInt);
- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind unreachable];
++ _35 = const 1_u64;
++ _34 = const 1_u8;
+ StorageDead(_35);
+- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind unreachable];
++ _33 = opaque::<u8>(const 1_u8) -> [return: bb11, unwind unreachable];
}
bb11: {
@@ -252,12 +276,14 @@
StorageDead(_33);
StorageLive(_36);
StorageLive(_37);
-- StorageLive(_38);
+ StorageLive(_38);
- _38 = _2;
- _37 = move _38 as u16 (IntToInt);
-- StorageDead(_38);
-+ _37 = const 1_u64 as u16 (IntToInt);
- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind unreachable];
++ _38 = const 1_u64;
++ _37 = const 1_u16;
+ StorageDead(_38);
+- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind unreachable];
++ _36 = opaque::<u16>(const 1_u16) -> [return: bb12, unwind unreachable];
}
bb12: {
@@ -265,35 +291,40 @@
StorageDead(_36);
StorageLive(_39);
StorageLive(_40);
-- StorageLive(_41);
+ StorageLive(_41);
- _41 = _2;
- _40 = move _41 as u32 (IntToInt);
-- StorageDead(_41);
-+ _40 = const 1_u64 as u32 (IntToInt);
- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind unreachable];
++ _41 = const 1_u64;
++ _40 = const 1_u32;
+ StorageDead(_41);
+- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind unreachable];
++ _39 = opaque::<u32>(const 1_u32) -> [return: bb13, unwind unreachable];
}
bb13: {
StorageDead(_40);
StorageDead(_39);
StorageLive(_42);
-- StorageLive(_43);
+ StorageLive(_43);
- _43 = _2;
- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind unreachable];
++ _43 = const 1_u64;
+ _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind unreachable];
}
bb14: {
-- StorageDead(_43);
+ StorageDead(_43);
StorageDead(_42);
StorageLive(_44);
StorageLive(_45);
-- StorageLive(_46);
+ StorageLive(_46);
- _46 = _2;
- _45 = move _46 as i8 (IntToInt);
-- StorageDead(_46);
-+ _45 = const 1_u64 as i8 (IntToInt);
- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind unreachable];
++ _46 = const 1_u64;
++ _45 = const 1_i8;
+ StorageDead(_46);
+- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind unreachable];
++ _44 = opaque::<i8>(const 1_i8) -> [return: bb15, unwind unreachable];
}
bb15: {
@@ -301,12 +332,14 @@
StorageDead(_44);
StorageLive(_47);
StorageLive(_48);
-- StorageLive(_49);
+ StorageLive(_49);
- _49 = _2;
- _48 = move _49 as i16 (IntToInt);
-- StorageDead(_49);
-+ _48 = const 1_u64 as i16 (IntToInt);
- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind unreachable];
++ _49 = const 1_u64;
++ _48 = const 1_i16;
+ StorageDead(_49);
+- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind unreachable];
++ _47 = opaque::<i16>(const 1_i16) -> [return: bb16, unwind unreachable];
}
bb16: {
@@ -314,12 +347,14 @@
StorageDead(_47);
StorageLive(_50);
StorageLive(_51);
-- StorageLive(_52);
+ StorageLive(_52);
- _52 = _2;
- _51 = move _52 as i32 (IntToInt);
-- StorageDead(_52);
-+ _51 = const 1_u64 as i32 (IntToInt);
- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind unreachable];
++ _52 = const 1_u64;
++ _51 = const 1_i32;
+ StorageDead(_52);
+- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind unreachable];
++ _50 = opaque::<i32>(const 1_i32) -> [return: bb17, unwind unreachable];
}
bb17: {
@@ -327,12 +362,14 @@
StorageDead(_50);
StorageLive(_53);
StorageLive(_54);
-- StorageLive(_55);
+ StorageLive(_55);
- _55 = _2;
- _54 = move _55 as i64 (IntToInt);
-- StorageDead(_55);
-+ _54 = const 1_u64 as i64 (IntToInt);
- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind unreachable];
++ _55 = const 1_u64;
++ _54 = const 1_i64;
+ StorageDead(_55);
+- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind unreachable];
++ _53 = opaque::<i64>(const 1_i64) -> [return: bb18, unwind unreachable];
}
bb18: {
@@ -340,12 +377,14 @@
StorageDead(_53);
StorageLive(_56);
StorageLive(_57);
-- StorageLive(_58);
+ StorageLive(_58);
- _58 = _2;
- _57 = move _58 as f32 (IntToFloat);
-- StorageDead(_58);
-+ _57 = const 1_u64 as f32 (IntToFloat);
- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind unreachable];
++ _58 = const 1_u64;
++ _57 = const 1f32;
+ StorageDead(_58);
+- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind unreachable];
++ _56 = opaque::<f32>(const 1f32) -> [return: bb19, unwind unreachable];
}
bb19: {
@@ -353,12 +392,14 @@
StorageDead(_56);
StorageLive(_59);
StorageLive(_60);
-- StorageLive(_61);
+ StorageLive(_61);
- _61 = _2;
- _60 = move _61 as f64 (IntToFloat);
-- StorageDead(_61);
-+ _60 = const 1_u64 as f64 (IntToFloat);
- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind unreachable];
++ _61 = const 1_u64;
++ _60 = const 1f64;
+ StorageDead(_61);
+- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind unreachable];
++ _59 = opaque::<f64>(const 1f64) -> [return: bb20, unwind unreachable];
}
bb20: {
@@ -366,12 +407,14 @@
StorageDead(_59);
StorageLive(_62);
StorageLive(_63);
-- StorageLive(_64);
+ StorageLive(_64);
- _64 = _3;
- _63 = move _64 as u8 (FloatToInt);
-- StorageDead(_64);
-+ _63 = const 1f64 as u8 (FloatToInt);
- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind unreachable];
++ _64 = const 1f64;
++ _63 = const 1_u8;
+ StorageDead(_64);
+- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind unreachable];
++ _62 = opaque::<u8>(const 1_u8) -> [return: bb21, unwind unreachable];
}
bb21: {
@@ -379,12 +422,14 @@
StorageDead(_62);
StorageLive(_65);
StorageLive(_66);
-- StorageLive(_67);
+ StorageLive(_67);
- _67 = _3;
- _66 = move _67 as u16 (FloatToInt);
-- StorageDead(_67);
-+ _66 = const 1f64 as u16 (FloatToInt);
- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind unreachable];
++ _67 = const 1f64;
++ _66 = const 1_u16;
+ StorageDead(_67);
+- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind unreachable];
++ _65 = opaque::<u16>(const 1_u16) -> [return: bb22, unwind unreachable];
}
bb22: {
@@ -392,12 +437,14 @@
StorageDead(_65);
StorageLive(_68);
StorageLive(_69);
-- StorageLive(_70);
+ StorageLive(_70);
- _70 = _3;
- _69 = move _70 as u32 (FloatToInt);
-- StorageDead(_70);
-+ _69 = const 1f64 as u32 (FloatToInt);
- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind unreachable];
++ _70 = const 1f64;
++ _69 = const 1_u32;
+ StorageDead(_70);
+- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind unreachable];
++ _68 = opaque::<u32>(const 1_u32) -> [return: bb23, unwind unreachable];
}
bb23: {
@@ -405,12 +452,14 @@
StorageDead(_68);
StorageLive(_71);
StorageLive(_72);
-- StorageLive(_73);
+ StorageLive(_73);
- _73 = _3;
- _72 = move _73 as u64 (FloatToInt);
-- StorageDead(_73);
-+ _72 = const 1f64 as u64 (FloatToInt);
- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind unreachable];
++ _73 = const 1f64;
++ _72 = const 1_u64;
+ StorageDead(_73);
+- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind unreachable];
++ _71 = opaque::<u64>(const 1_u64) -> [return: bb24, unwind unreachable];
}
bb24: {
@@ -418,12 +467,14 @@
StorageDead(_71);
StorageLive(_74);
StorageLive(_75);
-- StorageLive(_76);
+ StorageLive(_76);
- _76 = _3;
- _75 = move _76 as i8 (FloatToInt);
-- StorageDead(_76);
-+ _75 = const 1f64 as i8 (FloatToInt);
- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind unreachable];
++ _76 = const 1f64;
++ _75 = const 1_i8;
+ StorageDead(_76);
+- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind unreachable];
++ _74 = opaque::<i8>(const 1_i8) -> [return: bb25, unwind unreachable];
}
bb25: {
@@ -431,12 +482,14 @@
StorageDead(_74);
StorageLive(_77);
StorageLive(_78);
-- StorageLive(_79);
+ StorageLive(_79);
- _79 = _3;
- _78 = move _79 as i16 (FloatToInt);
-- StorageDead(_79);
-+ _78 = const 1f64 as i16 (FloatToInt);
- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind unreachable];
++ _79 = const 1f64;
++ _78 = const 1_i16;
+ StorageDead(_79);
+- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind unreachable];
++ _77 = opaque::<i16>(const 1_i16) -> [return: bb26, unwind unreachable];
}
bb26: {
@@ -444,12 +497,14 @@
StorageDead(_77);
StorageLive(_80);
StorageLive(_81);
-- StorageLive(_82);
+ StorageLive(_82);
- _82 = _3;
- _81 = move _82 as i32 (FloatToInt);
-- StorageDead(_82);
-+ _81 = const 1f64 as i32 (FloatToInt);
- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind unreachable];
++ _82 = const 1f64;
++ _81 = const 1_i32;
+ StorageDead(_82);
+- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind unreachable];
++ _80 = opaque::<i32>(const 1_i32) -> [return: bb27, unwind unreachable];
}
bb27: {
@@ -457,12 +512,14 @@
StorageDead(_80);
StorageLive(_83);
StorageLive(_84);
-- StorageLive(_85);
+ StorageLive(_85);
- _85 = _3;
- _84 = move _85 as i64 (FloatToInt);
-- StorageDead(_85);
-+ _84 = const 1f64 as i64 (FloatToInt);
- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind unreachable];
++ _85 = const 1f64;
++ _84 = const 1_i64;
+ StorageDead(_85);
+- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind unreachable];
++ _83 = opaque::<i64>(const 1_i64) -> [return: bb28, unwind unreachable];
}
bb28: {
@@ -470,31 +527,37 @@
StorageDead(_83);
StorageLive(_86);
StorageLive(_87);
-- StorageLive(_88);
+ StorageLive(_88);
- _88 = _3;
- _87 = move _88 as f32 (FloatToFloat);
-- StorageDead(_88);
-+ _87 = const 1f64 as f32 (FloatToFloat);
- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind unreachable];
++ _88 = const 1f64;
++ _87 = const 1f32;
+ StorageDead(_88);
+- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind unreachable];
++ _86 = opaque::<f32>(const 1f32) -> [return: bb29, unwind unreachable];
}
bb29: {
StorageDead(_87);
StorageDead(_86);
StorageLive(_89);
-- StorageLive(_90);
+ StorageLive(_90);
- _90 = _3;
- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind unreachable];
++ _90 = const 1f64;
+ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind unreachable];
}
bb30: {
-- StorageDead(_90);
+ StorageDead(_90);
StorageDead(_89);
_0 = const ();
- StorageDead(_3);
- StorageDead(_2);
- StorageDead(_1);
++ nop;
++ nop;
++ nop;
return;
}
}
diff --git a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
index 33192ed8d..08b97e13a 100644
--- a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
@@ -105,19 +105,24 @@
bb0: {
- StorageLive(_1);
++ nop;
_1 = const 1_i64;
- StorageLive(_2);
++ nop;
_2 = const 1_u64;
- StorageLive(_3);
++ nop;
_3 = const 1f64;
StorageLive(_4);
StorageLive(_5);
-- StorageLive(_6);
+ StorageLive(_6);
- _6 = _1;
- _5 = move _6 as u8 (IntToInt);
-- StorageDead(_6);
-+ _5 = const 1_i64 as u8 (IntToInt);
- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind continue];
++ _6 = const 1_i64;
++ _5 = const 1_u8;
+ StorageDead(_6);
+- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind continue];
++ _4 = opaque::<u8>(const 1_u8) -> [return: bb1, unwind continue];
}
bb1: {
@@ -125,12 +130,14 @@
StorageDead(_4);
StorageLive(_7);
StorageLive(_8);
-- StorageLive(_9);
+ StorageLive(_9);
- _9 = _1;
- _8 = move _9 as u16 (IntToInt);
-- StorageDead(_9);
-+ _8 = const 1_i64 as u16 (IntToInt);
- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind continue];
++ _9 = const 1_i64;
++ _8 = const 1_u16;
+ StorageDead(_9);
+- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind continue];
++ _7 = opaque::<u16>(const 1_u16) -> [return: bb2, unwind continue];
}
bb2: {
@@ -138,12 +145,14 @@
StorageDead(_7);
StorageLive(_10);
StorageLive(_11);
-- StorageLive(_12);
+ StorageLive(_12);
- _12 = _1;
- _11 = move _12 as u32 (IntToInt);
-- StorageDead(_12);
-+ _11 = const 1_i64 as u32 (IntToInt);
- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind continue];
++ _12 = const 1_i64;
++ _11 = const 1_u32;
+ StorageDead(_12);
+- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind continue];
++ _10 = opaque::<u32>(const 1_u32) -> [return: bb3, unwind continue];
}
bb3: {
@@ -151,12 +160,14 @@
StorageDead(_10);
StorageLive(_13);
StorageLive(_14);
-- StorageLive(_15);
+ StorageLive(_15);
- _15 = _1;
- _14 = move _15 as u64 (IntToInt);
-- StorageDead(_15);
-+ _14 = const 1_i64 as u64 (IntToInt);
- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind continue];
++ _15 = const 1_i64;
++ _14 = const 1_u64;
+ StorageDead(_15);
+- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind continue];
++ _13 = opaque::<u64>(const 1_u64) -> [return: bb4, unwind continue];
}
bb4: {
@@ -164,12 +175,14 @@
StorageDead(_13);
StorageLive(_16);
StorageLive(_17);
-- StorageLive(_18);
+ StorageLive(_18);
- _18 = _1;
- _17 = move _18 as i8 (IntToInt);
-- StorageDead(_18);
-+ _17 = const 1_i64 as i8 (IntToInt);
- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind continue];
++ _18 = const 1_i64;
++ _17 = const 1_i8;
+ StorageDead(_18);
+- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind continue];
++ _16 = opaque::<i8>(const 1_i8) -> [return: bb5, unwind continue];
}
bb5: {
@@ -177,12 +190,14 @@
StorageDead(_16);
StorageLive(_19);
StorageLive(_20);
-- StorageLive(_21);
+ StorageLive(_21);
- _21 = _1;
- _20 = move _21 as i16 (IntToInt);
-- StorageDead(_21);
-+ _20 = const 1_i64 as i16 (IntToInt);
- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind continue];
++ _21 = const 1_i64;
++ _20 = const 1_i16;
+ StorageDead(_21);
+- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind continue];
++ _19 = opaque::<i16>(const 1_i16) -> [return: bb6, unwind continue];
}
bb6: {
@@ -190,35 +205,40 @@
StorageDead(_19);
StorageLive(_22);
StorageLive(_23);
-- StorageLive(_24);
+ StorageLive(_24);
- _24 = _1;
- _23 = move _24 as i32 (IntToInt);
-- StorageDead(_24);
-+ _23 = const 1_i64 as i32 (IntToInt);
- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind continue];
++ _24 = const 1_i64;
++ _23 = const 1_i32;
+ StorageDead(_24);
+- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind continue];
++ _22 = opaque::<i32>(const 1_i32) -> [return: bb7, unwind continue];
}
bb7: {
StorageDead(_23);
StorageDead(_22);
StorageLive(_25);
-- StorageLive(_26);
+ StorageLive(_26);
- _26 = _1;
- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind continue];
++ _26 = const 1_i64;
+ _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind continue];
}
bb8: {
-- StorageDead(_26);
+ StorageDead(_26);
StorageDead(_25);
StorageLive(_27);
StorageLive(_28);
-- StorageLive(_29);
+ StorageLive(_29);
- _29 = _1;
- _28 = move _29 as f32 (IntToFloat);
-- StorageDead(_29);
-+ _28 = const 1_i64 as f32 (IntToFloat);
- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind continue];
++ _29 = const 1_i64;
++ _28 = const 1f32;
+ StorageDead(_29);
+- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind continue];
++ _27 = opaque::<f32>(const 1f32) -> [return: bb9, unwind continue];
}
bb9: {
@@ -226,12 +246,14 @@
StorageDead(_27);
StorageLive(_30);
StorageLive(_31);
-- StorageLive(_32);
+ StorageLive(_32);
- _32 = _1;
- _31 = move _32 as f64 (IntToFloat);
-- StorageDead(_32);
-+ _31 = const 1_i64 as f64 (IntToFloat);
- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind continue];
++ _32 = const 1_i64;
++ _31 = const 1f64;
+ StorageDead(_32);
+- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind continue];
++ _30 = opaque::<f64>(const 1f64) -> [return: bb10, unwind continue];
}
bb10: {
@@ -239,12 +261,14 @@
StorageDead(_30);
StorageLive(_33);
StorageLive(_34);
-- StorageLive(_35);
+ StorageLive(_35);
- _35 = _2;
- _34 = move _35 as u8 (IntToInt);
-- StorageDead(_35);
-+ _34 = const 1_u64 as u8 (IntToInt);
- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind continue];
++ _35 = const 1_u64;
++ _34 = const 1_u8;
+ StorageDead(_35);
+- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind continue];
++ _33 = opaque::<u8>(const 1_u8) -> [return: bb11, unwind continue];
}
bb11: {
@@ -252,12 +276,14 @@
StorageDead(_33);
StorageLive(_36);
StorageLive(_37);
-- StorageLive(_38);
+ StorageLive(_38);
- _38 = _2;
- _37 = move _38 as u16 (IntToInt);
-- StorageDead(_38);
-+ _37 = const 1_u64 as u16 (IntToInt);
- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind continue];
++ _38 = const 1_u64;
++ _37 = const 1_u16;
+ StorageDead(_38);
+- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind continue];
++ _36 = opaque::<u16>(const 1_u16) -> [return: bb12, unwind continue];
}
bb12: {
@@ -265,35 +291,40 @@
StorageDead(_36);
StorageLive(_39);
StorageLive(_40);
-- StorageLive(_41);
+ StorageLive(_41);
- _41 = _2;
- _40 = move _41 as u32 (IntToInt);
-- StorageDead(_41);
-+ _40 = const 1_u64 as u32 (IntToInt);
- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind continue];
++ _41 = const 1_u64;
++ _40 = const 1_u32;
+ StorageDead(_41);
+- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind continue];
++ _39 = opaque::<u32>(const 1_u32) -> [return: bb13, unwind continue];
}
bb13: {
StorageDead(_40);
StorageDead(_39);
StorageLive(_42);
-- StorageLive(_43);
+ StorageLive(_43);
- _43 = _2;
- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind continue];
++ _43 = const 1_u64;
+ _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind continue];
}
bb14: {
-- StorageDead(_43);
+ StorageDead(_43);
StorageDead(_42);
StorageLive(_44);
StorageLive(_45);
-- StorageLive(_46);
+ StorageLive(_46);
- _46 = _2;
- _45 = move _46 as i8 (IntToInt);
-- StorageDead(_46);
-+ _45 = const 1_u64 as i8 (IntToInt);
- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind continue];
++ _46 = const 1_u64;
++ _45 = const 1_i8;
+ StorageDead(_46);
+- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind continue];
++ _44 = opaque::<i8>(const 1_i8) -> [return: bb15, unwind continue];
}
bb15: {
@@ -301,12 +332,14 @@
StorageDead(_44);
StorageLive(_47);
StorageLive(_48);
-- StorageLive(_49);
+ StorageLive(_49);
- _49 = _2;
- _48 = move _49 as i16 (IntToInt);
-- StorageDead(_49);
-+ _48 = const 1_u64 as i16 (IntToInt);
- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind continue];
++ _49 = const 1_u64;
++ _48 = const 1_i16;
+ StorageDead(_49);
+- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind continue];
++ _47 = opaque::<i16>(const 1_i16) -> [return: bb16, unwind continue];
}
bb16: {
@@ -314,12 +347,14 @@
StorageDead(_47);
StorageLive(_50);
StorageLive(_51);
-- StorageLive(_52);
+ StorageLive(_52);
- _52 = _2;
- _51 = move _52 as i32 (IntToInt);
-- StorageDead(_52);
-+ _51 = const 1_u64 as i32 (IntToInt);
- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind continue];
++ _52 = const 1_u64;
++ _51 = const 1_i32;
+ StorageDead(_52);
+- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind continue];
++ _50 = opaque::<i32>(const 1_i32) -> [return: bb17, unwind continue];
}
bb17: {
@@ -327,12 +362,14 @@
StorageDead(_50);
StorageLive(_53);
StorageLive(_54);
-- StorageLive(_55);
+ StorageLive(_55);
- _55 = _2;
- _54 = move _55 as i64 (IntToInt);
-- StorageDead(_55);
-+ _54 = const 1_u64 as i64 (IntToInt);
- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind continue];
++ _55 = const 1_u64;
++ _54 = const 1_i64;
+ StorageDead(_55);
+- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind continue];
++ _53 = opaque::<i64>(const 1_i64) -> [return: bb18, unwind continue];
}
bb18: {
@@ -340,12 +377,14 @@
StorageDead(_53);
StorageLive(_56);
StorageLive(_57);
-- StorageLive(_58);
+ StorageLive(_58);
- _58 = _2;
- _57 = move _58 as f32 (IntToFloat);
-- StorageDead(_58);
-+ _57 = const 1_u64 as f32 (IntToFloat);
- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind continue];
++ _58 = const 1_u64;
++ _57 = const 1f32;
+ StorageDead(_58);
+- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind continue];
++ _56 = opaque::<f32>(const 1f32) -> [return: bb19, unwind continue];
}
bb19: {
@@ -353,12 +392,14 @@
StorageDead(_56);
StorageLive(_59);
StorageLive(_60);
-- StorageLive(_61);
+ StorageLive(_61);
- _61 = _2;
- _60 = move _61 as f64 (IntToFloat);
-- StorageDead(_61);
-+ _60 = const 1_u64 as f64 (IntToFloat);
- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind continue];
++ _61 = const 1_u64;
++ _60 = const 1f64;
+ StorageDead(_61);
+- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind continue];
++ _59 = opaque::<f64>(const 1f64) -> [return: bb20, unwind continue];
}
bb20: {
@@ -366,12 +407,14 @@
StorageDead(_59);
StorageLive(_62);
StorageLive(_63);
-- StorageLive(_64);
+ StorageLive(_64);
- _64 = _3;
- _63 = move _64 as u8 (FloatToInt);
-- StorageDead(_64);
-+ _63 = const 1f64 as u8 (FloatToInt);
- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind continue];
++ _64 = const 1f64;
++ _63 = const 1_u8;
+ StorageDead(_64);
+- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind continue];
++ _62 = opaque::<u8>(const 1_u8) -> [return: bb21, unwind continue];
}
bb21: {
@@ -379,12 +422,14 @@
StorageDead(_62);
StorageLive(_65);
StorageLive(_66);
-- StorageLive(_67);
+ StorageLive(_67);
- _67 = _3;
- _66 = move _67 as u16 (FloatToInt);
-- StorageDead(_67);
-+ _66 = const 1f64 as u16 (FloatToInt);
- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind continue];
++ _67 = const 1f64;
++ _66 = const 1_u16;
+ StorageDead(_67);
+- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind continue];
++ _65 = opaque::<u16>(const 1_u16) -> [return: bb22, unwind continue];
}
bb22: {
@@ -392,12 +437,14 @@
StorageDead(_65);
StorageLive(_68);
StorageLive(_69);
-- StorageLive(_70);
+ StorageLive(_70);
- _70 = _3;
- _69 = move _70 as u32 (FloatToInt);
-- StorageDead(_70);
-+ _69 = const 1f64 as u32 (FloatToInt);
- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind continue];
++ _70 = const 1f64;
++ _69 = const 1_u32;
+ StorageDead(_70);
+- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind continue];
++ _68 = opaque::<u32>(const 1_u32) -> [return: bb23, unwind continue];
}
bb23: {
@@ -405,12 +452,14 @@
StorageDead(_68);
StorageLive(_71);
StorageLive(_72);
-- StorageLive(_73);
+ StorageLive(_73);
- _73 = _3;
- _72 = move _73 as u64 (FloatToInt);
-- StorageDead(_73);
-+ _72 = const 1f64 as u64 (FloatToInt);
- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind continue];
++ _73 = const 1f64;
++ _72 = const 1_u64;
+ StorageDead(_73);
+- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind continue];
++ _71 = opaque::<u64>(const 1_u64) -> [return: bb24, unwind continue];
}
bb24: {
@@ -418,12 +467,14 @@
StorageDead(_71);
StorageLive(_74);
StorageLive(_75);
-- StorageLive(_76);
+ StorageLive(_76);
- _76 = _3;
- _75 = move _76 as i8 (FloatToInt);
-- StorageDead(_76);
-+ _75 = const 1f64 as i8 (FloatToInt);
- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind continue];
++ _76 = const 1f64;
++ _75 = const 1_i8;
+ StorageDead(_76);
+- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind continue];
++ _74 = opaque::<i8>(const 1_i8) -> [return: bb25, unwind continue];
}
bb25: {
@@ -431,12 +482,14 @@
StorageDead(_74);
StorageLive(_77);
StorageLive(_78);
-- StorageLive(_79);
+ StorageLive(_79);
- _79 = _3;
- _78 = move _79 as i16 (FloatToInt);
-- StorageDead(_79);
-+ _78 = const 1f64 as i16 (FloatToInt);
- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind continue];
++ _79 = const 1f64;
++ _78 = const 1_i16;
+ StorageDead(_79);
+- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind continue];
++ _77 = opaque::<i16>(const 1_i16) -> [return: bb26, unwind continue];
}
bb26: {
@@ -444,12 +497,14 @@
StorageDead(_77);
StorageLive(_80);
StorageLive(_81);
-- StorageLive(_82);
+ StorageLive(_82);
- _82 = _3;
- _81 = move _82 as i32 (FloatToInt);
-- StorageDead(_82);
-+ _81 = const 1f64 as i32 (FloatToInt);
- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind continue];
++ _82 = const 1f64;
++ _81 = const 1_i32;
+ StorageDead(_82);
+- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind continue];
++ _80 = opaque::<i32>(const 1_i32) -> [return: bb27, unwind continue];
}
bb27: {
@@ -457,12 +512,14 @@
StorageDead(_80);
StorageLive(_83);
StorageLive(_84);
-- StorageLive(_85);
+ StorageLive(_85);
- _85 = _3;
- _84 = move _85 as i64 (FloatToInt);
-- StorageDead(_85);
-+ _84 = const 1f64 as i64 (FloatToInt);
- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind continue];
++ _85 = const 1f64;
++ _84 = const 1_i64;
+ StorageDead(_85);
+- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind continue];
++ _83 = opaque::<i64>(const 1_i64) -> [return: bb28, unwind continue];
}
bb28: {
@@ -470,31 +527,37 @@
StorageDead(_83);
StorageLive(_86);
StorageLive(_87);
-- StorageLive(_88);
+ StorageLive(_88);
- _88 = _3;
- _87 = move _88 as f32 (FloatToFloat);
-- StorageDead(_88);
-+ _87 = const 1f64 as f32 (FloatToFloat);
- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind continue];
++ _88 = const 1f64;
++ _87 = const 1f32;
+ StorageDead(_88);
+- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind continue];
++ _86 = opaque::<f32>(const 1f32) -> [return: bb29, unwind continue];
}
bb29: {
StorageDead(_87);
StorageDead(_86);
StorageLive(_89);
-- StorageLive(_90);
+ StorageLive(_90);
- _90 = _3;
- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind continue];
++ _90 = const 1f64;
+ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind continue];
}
bb30: {
-- StorageDead(_90);
+ StorageDead(_90);
StorageDead(_89);
_0 = const ();
- StorageDead(_3);
- StorageDead(_2);
- StorageDead(_1);
++ nop;
++ nop;
++ nop;
return;
}
}
diff --git a/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff b/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff
new file mode 100644
index 000000000..ee3b9da21
--- /dev/null
+++ b/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff
@@ -0,0 +1,94 @@
+- // MIR for `comparison` before GVN
++ // MIR for `comparison` after GVN
+
+ fn comparison(_1: u64, _2: u64) -> () {
+ debug x => _1;
+ debug y => _2;
+ let mut _0: ();
+ let _3: ();
+ let mut _4: bool;
+ let mut _5: u64;
+ let mut _6: u64;
+ let _7: ();
+ let mut _8: bool;
+ let mut _9: u64;
+ let mut _10: u64;
+ let _11: ();
+ let mut _12: bool;
+ let mut _13: u64;
+ let mut _14: u64;
+ let _15: ();
+ let mut _16: bool;
+ let mut _17: u64;
+ let mut _18: u64;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ StorageLive(_6);
+ _6 = _1;
+- _4 = Eq(move _5, move _6);
++ _4 = Eq(_1, _1);
+ StorageDead(_6);
+ StorageDead(_5);
+ _3 = opaque::<bool>(move _4) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = _1;
+ StorageLive(_10);
+ _10 = _1;
+- _8 = Ne(move _9, move _10);
++ _8 = Ne(_1, _1);
+ StorageDead(_10);
+ StorageDead(_9);
+ _7 = opaque::<bool>(move _8) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _1;
+ StorageLive(_14);
+ _14 = _2;
+- _12 = Eq(move _13, move _14);
++ _12 = Eq(_1, _2);
+ StorageDead(_14);
+ StorageDead(_13);
+ _11 = opaque::<bool>(move _12) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_15);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = _1;
+ StorageLive(_18);
+ _18 = _2;
+- _16 = Ne(move _17, move _18);
++ _16 = Ne(_1, _2);
+ StorageDead(_18);
+ StorageDead(_17);
+ _15 = opaque::<bool>(move _16) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_16);
+ StorageDead(_15);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff b/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff
new file mode 100644
index 000000000..a1408fe34
--- /dev/null
+++ b/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff
@@ -0,0 +1,94 @@
+- // MIR for `comparison` before GVN
++ // MIR for `comparison` after GVN
+
+ fn comparison(_1: u64, _2: u64) -> () {
+ debug x => _1;
+ debug y => _2;
+ let mut _0: ();
+ let _3: ();
+ let mut _4: bool;
+ let mut _5: u64;
+ let mut _6: u64;
+ let _7: ();
+ let mut _8: bool;
+ let mut _9: u64;
+ let mut _10: u64;
+ let _11: ();
+ let mut _12: bool;
+ let mut _13: u64;
+ let mut _14: u64;
+ let _15: ();
+ let mut _16: bool;
+ let mut _17: u64;
+ let mut _18: u64;
+
+ bb0: {
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ StorageLive(_6);
+ _6 = _1;
+- _4 = Eq(move _5, move _6);
++ _4 = Eq(_1, _1);
+ StorageDead(_6);
+ StorageDead(_5);
+ _3 = opaque::<bool>(move _4) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_4);
+ StorageDead(_3);
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_9);
+ _9 = _1;
+ StorageLive(_10);
+ _10 = _1;
+- _8 = Ne(move _9, move _10);
++ _8 = Ne(_1, _1);
+ StorageDead(_10);
+ StorageDead(_9);
+ _7 = opaque::<bool>(move _8) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
+ _13 = _1;
+ StorageLive(_14);
+ _14 = _2;
+- _12 = Eq(move _13, move _14);
++ _12 = Eq(_1, _2);
+ StorageDead(_14);
+ StorageDead(_13);
+ _11 = opaque::<bool>(move _12) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageLive(_15);
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = _1;
+ StorageLive(_18);
+ _18 = _2;
+- _16 = Ne(move _17, move _18);
++ _16 = Ne(_1, _2);
+ StorageDead(_18);
+ StorageDead(_17);
+ _15 = opaque::<bool>(move _16) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_16);
+ StorageDead(_15);
+ _0 = const ();
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
index ee320cf67..a587b1e6b 100644
--- a/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
@@ -72,7 +72,8 @@
bb2: {
StorageDead(_7);
StorageDead(_6);
- StorageLive(_8);
+- StorageLive(_8);
++ nop;
_8 = &raw const (*_1);
StorageLive(_9);
StorageLive(_10);
@@ -92,7 +93,8 @@
bb4: {
StorageDead(_12);
StorageDead(_11);
- StorageLive(_13);
+- StorageLive(_13);
++ nop;
_13 = &raw mut (*_1);
StorageLive(_14);
StorageLive(_15);
@@ -112,10 +114,12 @@
bb6: {
StorageDead(_17);
StorageDead(_16);
- StorageLive(_18);
+- StorageLive(_18);
++ nop;
_18 = &(*_1);
StorageLive(_19);
- StorageLive(_20);
++ nop;
_20 = (*_18);
- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind unreachable];
+ _19 = opaque::<u32>(_20) -> [return: bb7, unwind unreachable];
@@ -123,16 +127,18 @@
bb7: {
- StorageDead(_20);
++ nop;
StorageDead(_19);
StorageLive(_21);
-- StorageLive(_22);
+ StorageLive(_22);
- _22 = (*_18);
- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind unreachable];
++ _22 = _20;
+ _21 = opaque::<u32>(_20) -> [return: bb8, unwind unreachable];
}
bb8: {
-- StorageDead(_22);
+ StorageDead(_22);
StorageDead(_21);
StorageLive(_23);
StorageLive(_24);
@@ -163,6 +169,7 @@
StorageDead(_27);
StorageLive(_29);
- StorageLive(_30);
++ nop;
_30 = ((*_3).0: u32);
- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind unreachable];
+ _29 = opaque::<u32>(_30) -> [return: bb12, unwind unreachable];
@@ -170,21 +177,26 @@
bb12: {
- StorageDead(_30);
++ nop;
StorageDead(_29);
StorageLive(_31);
-- StorageLive(_32);
+ StorageLive(_32);
- _32 = ((*_3).0: u32);
- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind unreachable];
++ _32 = _30;
+ _31 = opaque::<u32>(_30) -> [return: bb13, unwind unreachable];
}
bb13: {
-- StorageDead(_32);
+ StorageDead(_32);
StorageDead(_31);
_0 = const ();
- StorageDead(_18);
- StorageDead(_13);
- StorageDead(_8);
+- StorageDead(_18);
+- StorageDead(_13);
+- StorageDead(_8);
++ nop;
++ nop;
++ nop;
return;
}
}
diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
index f627b4d59..6fdda5e99 100644
--- a/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
@@ -72,7 +72,8 @@
bb2: {
StorageDead(_7);
StorageDead(_6);
- StorageLive(_8);
+- StorageLive(_8);
++ nop;
_8 = &raw const (*_1);
StorageLive(_9);
StorageLive(_10);
@@ -92,7 +93,8 @@
bb4: {
StorageDead(_12);
StorageDead(_11);
- StorageLive(_13);
+- StorageLive(_13);
++ nop;
_13 = &raw mut (*_1);
StorageLive(_14);
StorageLive(_15);
@@ -112,10 +114,12 @@
bb6: {
StorageDead(_17);
StorageDead(_16);
- StorageLive(_18);
+- StorageLive(_18);
++ nop;
_18 = &(*_1);
StorageLive(_19);
- StorageLive(_20);
++ nop;
_20 = (*_18);
- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind continue];
+ _19 = opaque::<u32>(_20) -> [return: bb7, unwind continue];
@@ -123,16 +127,18 @@
bb7: {
- StorageDead(_20);
++ nop;
StorageDead(_19);
StorageLive(_21);
-- StorageLive(_22);
+ StorageLive(_22);
- _22 = (*_18);
- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind continue];
++ _22 = _20;
+ _21 = opaque::<u32>(_20) -> [return: bb8, unwind continue];
}
bb8: {
-- StorageDead(_22);
+ StorageDead(_22);
StorageDead(_21);
StorageLive(_23);
StorageLive(_24);
@@ -163,6 +169,7 @@
StorageDead(_27);
StorageLive(_29);
- StorageLive(_30);
++ nop;
_30 = ((*_3).0: u32);
- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind continue];
+ _29 = opaque::<u32>(_30) -> [return: bb12, unwind continue];
@@ -170,21 +177,26 @@
bb12: {
- StorageDead(_30);
++ nop;
StorageDead(_29);
StorageLive(_31);
-- StorageLive(_32);
+ StorageLive(_32);
- _32 = ((*_3).0: u32);
- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind continue];
++ _32 = _30;
+ _31 = opaque::<u32>(_30) -> [return: bb13, unwind continue];
}
bb13: {
-- StorageDead(_32);
+ StorageDead(_32);
StorageDead(_31);
_0 = const ();
- StorageDead(_18);
- StorageDead(_13);
- StorageDead(_8);
+- StorageDead(_18);
+- StorageDead(_13);
+- StorageDead(_8);
++ nop;
++ nop;
++ nop;
return;
}
}
diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff
new file mode 100644
index 000000000..7ae1fae68
--- /dev/null
+++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff
@@ -0,0 +1,38 @@
+- // MIR for `duplicate_slice` before GVN
++ // MIR for `duplicate_slice` after GVN
+
+ fn duplicate_slice() -> (bool, bool) {
+ let mut _0: (bool, bool);
+ let mut _1: u128;
+ let mut _2: u128;
+ let mut _3: u128;
+ let mut _4: u128;
+ let mut _5: &str;
+ let mut _6: &str;
+ let mut _7: (&str,);
+ let mut _8: &str;
+ let mut _9: bool;
+ let mut _10: bool;
+
+ bb0: {
+ _7 = (const "a",);
+ _1 = (_7.0: &str) as u128 (Transmute);
+ _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _3 = _5 as u128 (Transmute);
+ _8 = const "a";
+ _2 = _8 as u128 (Transmute);
+ _6 = identity::<&str>(_8) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ _4 = _6 as u128 (Transmute);
+ _9 = Eq(_1, _2);
+ _10 = Eq(_3, _4);
+ _0 = (_9, _10);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff
new file mode 100644
index 000000000..8c96edaa2
--- /dev/null
+++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff
@@ -0,0 +1,38 @@
+- // MIR for `duplicate_slice` before GVN
++ // MIR for `duplicate_slice` after GVN
+
+ fn duplicate_slice() -> (bool, bool) {
+ let mut _0: (bool, bool);
+ let mut _1: u128;
+ let mut _2: u128;
+ let mut _3: u128;
+ let mut _4: u128;
+ let mut _5: &str;
+ let mut _6: &str;
+ let mut _7: (&str,);
+ let mut _8: &str;
+ let mut _9: bool;
+ let mut _10: bool;
+
+ bb0: {
+ _7 = (const "a",);
+ _1 = (_7.0: &str) as u128 (Transmute);
+ _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _3 = _5 as u128 (Transmute);
+ _8 = const "a";
+ _2 = _8 as u128 (Transmute);
+ _6 = identity::<&str>(_8) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ _4 = _6 as u128 (Transmute);
+ _9 = Eq(_1, _2);
+ _10 = Eq(_3, _4);
+ _0 = (_9, _10);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff
new file mode 100644
index 000000000..d8248d22d
--- /dev/null
+++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff
@@ -0,0 +1,118 @@
+- // MIR for `fn_pointers` before GVN
++ // MIR for `fn_pointers` after GVN
+
+ fn fn_pointers() -> () {
+ let mut _0: ();
+ let _1: fn(u8) -> u8;
+ let _2: ();
+ let mut _3: fn(u8) -> u8;
+ let _5: ();
+ let mut _6: fn(u8) -> u8;
+ let mut _9: {closure@$DIR/gvn.rs:591:19: 591:21};
+ let _10: ();
+ let mut _11: fn();
+ let mut _13: {closure@$DIR/gvn.rs:591:19: 591:21};
+ let _14: ();
+ let mut _15: fn();
+ scope 1 {
+ debug f => _1;
+ let _4: fn(u8) -> u8;
+ scope 2 {
+ debug g => _4;
+ let _7: {closure@$DIR/gvn.rs:591:19: 591:21};
+ scope 3 {
+ debug closure => _7;
+ let _8: fn();
+ scope 4 {
+ debug cf => _8;
+ let _12: fn();
+ scope 5 {
+ debug cg => _12;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
++ nop;
+ _1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = opaque::<fn(u8) -> u8>(move _3) -> [return: bb1, unwind unreachable];
++ _2 = opaque::<fn(u8) -> u8>(_1) -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+- StorageLive(_4);
++ nop;
+ _4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _4;
+- _5 = opaque::<fn(u8) -> u8>(move _6) -> [return: bb2, unwind unreachable];
++ _5 = opaque::<fn(u8) -> u8>(_4) -> [return: bb2, unwind unreachable];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+- StorageLive(_7);
+- _7 = {closure@$DIR/gvn.rs:591:19: 591:21};
+- StorageLive(_8);
++ nop;
++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ nop;
+ StorageLive(_9);
+- _9 = _7;
+- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = _8;
+- _10 = opaque::<fn()>(move _11) -> [return: bb3, unwind unreachable];
++ _10 = opaque::<fn()>(_8) -> [return: bb3, unwind unreachable];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+- StorageLive(_12);
++ nop;
+ StorageLive(_13);
+- _13 = _7;
+- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = _12;
+- _14 = opaque::<fn()>(move _15) -> [return: bb4, unwind unreachable];
++ _14 = opaque::<fn()>(_12) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageDead(_15);
+ StorageDead(_14);
+ _0 = const ();
+- StorageDead(_12);
+- StorageDead(_8);
+- StorageDead(_7);
+- StorageDead(_4);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff
new file mode 100644
index 000000000..e38a3d852
--- /dev/null
+++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff
@@ -0,0 +1,118 @@
+- // MIR for `fn_pointers` before GVN
++ // MIR for `fn_pointers` after GVN
+
+ fn fn_pointers() -> () {
+ let mut _0: ();
+ let _1: fn(u8) -> u8;
+ let _2: ();
+ let mut _3: fn(u8) -> u8;
+ let _5: ();
+ let mut _6: fn(u8) -> u8;
+ let mut _9: {closure@$DIR/gvn.rs:591:19: 591:21};
+ let _10: ();
+ let mut _11: fn();
+ let mut _13: {closure@$DIR/gvn.rs:591:19: 591:21};
+ let _14: ();
+ let mut _15: fn();
+ scope 1 {
+ debug f => _1;
+ let _4: fn(u8) -> u8;
+ scope 2 {
+ debug g => _4;
+ let _7: {closure@$DIR/gvn.rs:591:19: 591:21};
+ scope 3 {
+ debug closure => _7;
+ let _8: fn();
+ scope 4 {
+ debug cf => _8;
+ let _12: fn();
+ scope 5 {
+ debug cg => _12;
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
++ nop;
+ _1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = opaque::<fn(u8) -> u8>(move _3) -> [return: bb1, unwind continue];
++ _2 = opaque::<fn(u8) -> u8>(_1) -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ StorageDead(_2);
+- StorageLive(_4);
++ nop;
+ _4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = _4;
+- _5 = opaque::<fn(u8) -> u8>(move _6) -> [return: bb2, unwind continue];
++ _5 = opaque::<fn(u8) -> u8>(_4) -> [return: bb2, unwind continue];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ StorageDead(_5);
+- StorageLive(_7);
+- _7 = {closure@$DIR/gvn.rs:591:19: 591:21};
+- StorageLive(_8);
++ nop;
++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ nop;
+ StorageLive(_9);
+- _9 = _7;
+- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_9);
+ StorageLive(_10);
+ StorageLive(_11);
+ _11 = _8;
+- _10 = opaque::<fn()>(move _11) -> [return: bb3, unwind continue];
++ _10 = opaque::<fn()>(_8) -> [return: bb3, unwind continue];
+ }
+
+ bb3: {
+ StorageDead(_11);
+ StorageDead(_10);
+- StorageLive(_12);
++ nop;
+ StorageLive(_13);
+- _13 = _7;
+- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ StorageDead(_13);
+ StorageLive(_14);
+ StorageLive(_15);
+ _15 = _12;
+- _14 = opaque::<fn()>(move _15) -> [return: bb4, unwind continue];
++ _14 = opaque::<fn()>(_12) -> [return: bb4, unwind continue];
+ }
+
+ bb4: {
+ StorageDead(_15);
+ StorageDead(_14);
+ _0 = const ();
+- StorageDead(_12);
+- StorageDead(_8);
+- StorageDead(_7);
+- StorageDead(_4);
+- StorageDead(_1);
++ nop;
++ nop;
++ nop;
++ nop;
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff b/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff
new file mode 100644
index 000000000..f853942bb
--- /dev/null
+++ b/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff
@@ -0,0 +1,19 @@
+- // MIR for `indirect_static` before GVN
++ // MIR for `indirect_static` after GVN
+
+ fn indirect_static() -> () {
+ let mut _0: ();
+ let mut _1: &std::option::Option<u8>;
+ let mut _2: u8;
+
+ bb0: {
+ _1 = const {ALLOC0: &Option<u8>};
+ _2 = (((*_1) as variant#1).0: u8);
+ return;
+ }
+ }
+
+ ALLOC0 (static: A, size: 2, align: 1) {
+ 00 __ │ .░
+ }
+
diff --git a/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff b/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff
new file mode 100644
index 000000000..f853942bb
--- /dev/null
+++ b/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff
@@ -0,0 +1,19 @@
+- // MIR for `indirect_static` before GVN
++ // MIR for `indirect_static` after GVN
+
+ fn indirect_static() -> () {
+ let mut _0: ();
+ let mut _1: &std::option::Option<u8>;
+ let mut _2: u8;
+
+ bb0: {
+ _1 = const {ALLOC0: &Option<u8>};
+ _2 = (((*_1) as variant#1).0: u8);
+ return;
+ }
+ }
+
+ ALLOC0 (static: A, size: 2, align: 1) {
+ 00 __ │ .░
+ }
+
diff --git a/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
index 0a6690028..29ca1ba59 100644
--- a/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
@@ -39,9 +39,9 @@
let mut _34: u8;
bb0: {
-- StorageLive(_4);
-- StorageLive(_5);
-- _5 = _1;
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
- switchInt(move _5) -> [0: bb4, otherwise: bb1];
+ switchInt(_1) -> [0: bb4, otherwise: bb1];
}
@@ -49,121 +49,130 @@
bb1: {
StorageLive(_6);
- StorageLive(_7);
-- StorageLive(_8);
-- _8 = _2;
-- StorageLive(_9);
-- _9 = _3;
++ nop;
+ StorageLive(_8);
+ _8 = _2;
+ StorageLive(_9);
+ _9 = _3;
- _7 = Add(move _8, move _9);
-- StorageDead(_9);
-- StorageDead(_8);
-- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind unreachable];
+ _7 = Add(_2, _3);
+ StorageDead(_9);
+ StorageDead(_8);
+- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind unreachable];
+ _6 = opaque::<u8>(_7) -> [return: bb2, unwind unreachable];
}
bb2: {
- StorageDead(_7);
++ nop;
StorageDead(_6);
StorageLive(_10);
-- StorageLive(_11);
-- StorageLive(_12);
-- _12 = _2;
-- StorageLive(_13);
-- _13 = _3;
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+ StorageLive(_13);
+ _13 = _3;
- _11 = Add(move _12, move _13);
-- StorageDead(_13);
-- StorageDead(_12);
++ _11 = _7;
+ StorageDead(_13);
+ StorageDead(_12);
- _10 = opaque::<u8>(move _11) -> [return: bb3, unwind unreachable];
+ _10 = opaque::<u8>(_7) -> [return: bb3, unwind unreachable];
}
bb3: {
-- StorageDead(_11);
+ StorageDead(_11);
StorageDead(_10);
-- _4 = const ();
+ _4 = const ();
goto -> bb7;
}
bb4: {
StorageLive(_14);
- StorageLive(_15);
-- StorageLive(_16);
-- _16 = _2;
-- StorageLive(_17);
-- _17 = _3;
++ nop;
+ StorageLive(_16);
+ _16 = _2;
+ StorageLive(_17);
+ _17 = _3;
- _15 = Add(move _16, move _17);
-- StorageDead(_17);
-- StorageDead(_16);
-- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind unreachable];
+ _15 = Add(_2, _3);
+ StorageDead(_17);
+ StorageDead(_16);
+- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind unreachable];
+ _14 = opaque::<u8>(_15) -> [return: bb5, unwind unreachable];
}
bb5: {
- StorageDead(_15);
++ nop;
StorageDead(_14);
StorageLive(_18);
-- StorageLive(_19);
-- StorageLive(_20);
-- _20 = _2;
-- StorageLive(_21);
-- _21 = _3;
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = _2;
+ StorageLive(_21);
+ _21 = _3;
- _19 = Add(move _20, move _21);
-- StorageDead(_21);
-- StorageDead(_20);
++ _19 = _15;
+ StorageDead(_21);
+ StorageDead(_20);
- _18 = opaque::<u8>(move _19) -> [return: bb6, unwind unreachable];
+ _18 = opaque::<u8>(_15) -> [return: bb6, unwind unreachable];
}
bb6: {
-- StorageDead(_19);
+ StorageDead(_19);
StorageDead(_18);
-- _4 = const ();
+ _4 = const ();
goto -> bb7;
}
bb7: {
-- StorageDead(_5);
-- StorageDead(_4);
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_22);
- StorageLive(_23);
-- StorageLive(_24);
-- _24 = _2;
-- StorageLive(_25);
-- _25 = _3;
++ nop;
+ StorageLive(_24);
+ _24 = _2;
+ StorageLive(_25);
+ _25 = _3;
- _23 = Add(move _24, move _25);
-- StorageDead(_25);
-- StorageDead(_24);
-- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind unreachable];
+ _23 = Add(_2, _3);
+ StorageDead(_25);
+ StorageDead(_24);
+- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind unreachable];
+ _22 = opaque::<u8>(_23) -> [return: bb8, unwind unreachable];
}
bb8: {
- StorageDead(_23);
++ nop;
StorageDead(_22);
-- StorageLive(_26);
-- _26 = _1;
+ StorageLive(_26);
+ _26 = _1;
- switchInt(move _26) -> [0: bb11, otherwise: bb9];
+ switchInt(_1) -> [0: bb11, otherwise: bb9];
}
bb9: {
StorageLive(_27);
-- StorageLive(_28);
-- StorageLive(_29);
-- _29 = _2;
-- StorageLive(_30);
-- _30 = _3;
+ StorageLive(_28);
+ StorageLive(_29);
+ _29 = _2;
+ StorageLive(_30);
+ _30 = _3;
- _28 = Add(move _29, move _30);
-- StorageDead(_30);
-- StorageDead(_29);
++ _28 = _23;
+ StorageDead(_30);
+ StorageDead(_29);
- _27 = opaque::<u8>(move _28) -> [return: bb10, unwind unreachable];
+ _27 = opaque::<u8>(_23) -> [return: bb10, unwind unreachable];
}
bb10: {
-- StorageDead(_28);
+ StorageDead(_28);
StorageDead(_27);
_0 = const ();
goto -> bb13;
@@ -171,27 +180,28 @@
bb11: {
StorageLive(_31);
-- StorageLive(_32);
-- StorageLive(_33);
-- _33 = _2;
-- StorageLive(_34);
-- _34 = _3;
+ StorageLive(_32);
+ StorageLive(_33);
+ _33 = _2;
+ StorageLive(_34);
+ _34 = _3;
- _32 = Add(move _33, move _34);
-- StorageDead(_34);
-- StorageDead(_33);
++ _32 = _23;
+ StorageDead(_34);
+ StorageDead(_33);
- _31 = opaque::<u8>(move _32) -> [return: bb12, unwind unreachable];
+ _31 = opaque::<u8>(_23) -> [return: bb12, unwind unreachable];
}
bb12: {
-- StorageDead(_32);
+ StorageDead(_32);
StorageDead(_31);
_0 = const ();
goto -> bb13;
}
bb13: {
-- StorageDead(_26);
+ StorageDead(_26);
return;
}
}
diff --git a/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
index 0199f2720..5394dc8be 100644
--- a/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
@@ -39,9 +39,9 @@
let mut _34: u8;
bb0: {
-- StorageLive(_4);
-- StorageLive(_5);
-- _5 = _1;
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
- switchInt(move _5) -> [0: bb4, otherwise: bb1];
+ switchInt(_1) -> [0: bb4, otherwise: bb1];
}
@@ -49,121 +49,130 @@
bb1: {
StorageLive(_6);
- StorageLive(_7);
-- StorageLive(_8);
-- _8 = _2;
-- StorageLive(_9);
-- _9 = _3;
++ nop;
+ StorageLive(_8);
+ _8 = _2;
+ StorageLive(_9);
+ _9 = _3;
- _7 = Add(move _8, move _9);
-- StorageDead(_9);
-- StorageDead(_8);
-- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind continue];
+ _7 = Add(_2, _3);
+ StorageDead(_9);
+ StorageDead(_8);
+- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind continue];
+ _6 = opaque::<u8>(_7) -> [return: bb2, unwind continue];
}
bb2: {
- StorageDead(_7);
++ nop;
StorageDead(_6);
StorageLive(_10);
-- StorageLive(_11);
-- StorageLive(_12);
-- _12 = _2;
-- StorageLive(_13);
-- _13 = _3;
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+ StorageLive(_13);
+ _13 = _3;
- _11 = Add(move _12, move _13);
-- StorageDead(_13);
-- StorageDead(_12);
++ _11 = _7;
+ StorageDead(_13);
+ StorageDead(_12);
- _10 = opaque::<u8>(move _11) -> [return: bb3, unwind continue];
+ _10 = opaque::<u8>(_7) -> [return: bb3, unwind continue];
}
bb3: {
-- StorageDead(_11);
+ StorageDead(_11);
StorageDead(_10);
-- _4 = const ();
+ _4 = const ();
goto -> bb7;
}
bb4: {
StorageLive(_14);
- StorageLive(_15);
-- StorageLive(_16);
-- _16 = _2;
-- StorageLive(_17);
-- _17 = _3;
++ nop;
+ StorageLive(_16);
+ _16 = _2;
+ StorageLive(_17);
+ _17 = _3;
- _15 = Add(move _16, move _17);
-- StorageDead(_17);
-- StorageDead(_16);
-- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind continue];
+ _15 = Add(_2, _3);
+ StorageDead(_17);
+ StorageDead(_16);
+- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind continue];
+ _14 = opaque::<u8>(_15) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_15);
++ nop;
StorageDead(_14);
StorageLive(_18);
-- StorageLive(_19);
-- StorageLive(_20);
-- _20 = _2;
-- StorageLive(_21);
-- _21 = _3;
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = _2;
+ StorageLive(_21);
+ _21 = _3;
- _19 = Add(move _20, move _21);
-- StorageDead(_21);
-- StorageDead(_20);
++ _19 = _15;
+ StorageDead(_21);
+ StorageDead(_20);
- _18 = opaque::<u8>(move _19) -> [return: bb6, unwind continue];
+ _18 = opaque::<u8>(_15) -> [return: bb6, unwind continue];
}
bb6: {
-- StorageDead(_19);
+ StorageDead(_19);
StorageDead(_18);
-- _4 = const ();
+ _4 = const ();
goto -> bb7;
}
bb7: {
-- StorageDead(_5);
-- StorageDead(_4);
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_22);
- StorageLive(_23);
-- StorageLive(_24);
-- _24 = _2;
-- StorageLive(_25);
-- _25 = _3;
++ nop;
+ StorageLive(_24);
+ _24 = _2;
+ StorageLive(_25);
+ _25 = _3;
- _23 = Add(move _24, move _25);
-- StorageDead(_25);
-- StorageDead(_24);
-- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind continue];
+ _23 = Add(_2, _3);
+ StorageDead(_25);
+ StorageDead(_24);
+- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind continue];
+ _22 = opaque::<u8>(_23) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_23);
++ nop;
StorageDead(_22);
-- StorageLive(_26);
-- _26 = _1;
+ StorageLive(_26);
+ _26 = _1;
- switchInt(move _26) -> [0: bb11, otherwise: bb9];
+ switchInt(_1) -> [0: bb11, otherwise: bb9];
}
bb9: {
StorageLive(_27);
-- StorageLive(_28);
-- StorageLive(_29);
-- _29 = _2;
-- StorageLive(_30);
-- _30 = _3;
+ StorageLive(_28);
+ StorageLive(_29);
+ _29 = _2;
+ StorageLive(_30);
+ _30 = _3;
- _28 = Add(move _29, move _30);
-- StorageDead(_30);
-- StorageDead(_29);
++ _28 = _23;
+ StorageDead(_30);
+ StorageDead(_29);
- _27 = opaque::<u8>(move _28) -> [return: bb10, unwind continue];
+ _27 = opaque::<u8>(_23) -> [return: bb10, unwind continue];
}
bb10: {
-- StorageDead(_28);
+ StorageDead(_28);
StorageDead(_27);
_0 = const ();
goto -> bb13;
@@ -171,27 +180,28 @@
bb11: {
StorageLive(_31);
-- StorageLive(_32);
-- StorageLive(_33);
-- _33 = _2;
-- StorageLive(_34);
-- _34 = _3;
+ StorageLive(_32);
+ StorageLive(_33);
+ _33 = _2;
+ StorageLive(_34);
+ _34 = _3;
- _32 = Add(move _33, move _34);
-- StorageDead(_34);
-- StorageDead(_33);
++ _32 = _23;
+ StorageDead(_34);
+ StorageDead(_33);
- _31 = opaque::<u8>(move _32) -> [return: bb12, unwind continue];
+ _31 = opaque::<u8>(_23) -> [return: bb12, unwind continue];
}
bb12: {
-- StorageDead(_32);
+ StorageDead(_32);
StorageDead(_31);
_0 = const ();
goto -> bb13;
}
bb13: {
-- StorageDead(_26);
+ StorageDead(_26);
return;
}
}
diff --git a/tests/mir-opt/gvn.references.GVN.panic-abort.diff b/tests/mir-opt/gvn.references.GVN.panic-abort.diff
index b7ad4ab1f..7799c6114 100644
--- a/tests/mir-opt/gvn.references.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.references.GVN.panic-abort.diff
@@ -20,6 +20,24 @@
let mut _15: *mut impl Sized;
let _16: ();
let mut _17: *mut impl Sized;
+ let _18: &mut impl Sized;
+ let mut _20: S<&mut impl Sized>;
+ let mut _21: &mut impl Sized;
+ let _22: ();
+ let mut _23: &impl Sized;
+ let _24: ();
+ let mut _25: &mut impl Sized;
+ let _26: ();
+ let mut _27: *const impl Sized;
+ let _28: ();
+ let mut _29: *mut impl Sized;
+ scope 1 {
+ debug r => _18;
+ let _19: &mut impl Sized;
+ scope 2 {
+ debug s => _19;
+ }
+ }
bb0: {
StorageLive(_2);
@@ -94,11 +112,68 @@
bb8: {
StorageDead(_17);
StorageDead(_16);
- _0 = const ();
- drop(_1) -> [return: bb9, unwind unreachable];
+- StorageLive(_18);
++ nop;
+ _18 = &mut _1;
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+- _21 = move _18;
+- _20 = S::<&mut impl Sized>(move _21);
++ _21 = _18;
++ _20 = S::<&mut impl Sized>(_18);
+ StorageDead(_21);
+- _19 = move (_20.0: &mut impl Sized);
++ _19 = _18;
+ StorageDead(_20);
+ StorageLive(_22);
+ StorageLive(_23);
+- _23 = &(*_19);
++ _23 = &(*_18);
+ _22 = opaque::<&impl Sized>(move _23) -> [return: bb9, unwind unreachable];
}
bb9: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_24);
+ StorageLive(_25);
+- _25 = &mut (*_19);
++ _25 = &mut (*_18);
+ _24 = opaque::<&mut impl Sized>(move _25) -> [return: bb10, unwind unreachable];
+ }
+
+ bb10: {
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageLive(_26);
+ StorageLive(_27);
+- _27 = &raw const (*_19);
++ _27 = &raw const (*_18);
+ _26 = opaque::<*const impl Sized>(move _27) -> [return: bb11, unwind unreachable];
+ }
+
+ bb11: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_28);
+ StorageLive(_29);
+- _29 = &raw mut (*_19);
++ _29 = &raw mut (*_18);
+ _28 = opaque::<*mut impl Sized>(move _29) -> [return: bb12, unwind unreachable];
+ }
+
+ bb12: {
+ StorageDead(_29);
+ StorageDead(_28);
+ _0 = const ();
+ StorageDead(_19);
+- StorageDead(_18);
++ nop;
+ drop(_1) -> [return: bb13, unwind unreachable];
+ }
+
+ bb13: {
return;
}
}
diff --git a/tests/mir-opt/gvn.references.GVN.panic-unwind.diff b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
index 08ed4c629..880e7913f 100644
--- a/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
@@ -20,12 +20,30 @@
let mut _15: *mut impl Sized;
let _16: ();
let mut _17: *mut impl Sized;
+ let _18: &mut impl Sized;
+ let mut _20: S<&mut impl Sized>;
+ let mut _21: &mut impl Sized;
+ let _22: ();
+ let mut _23: &impl Sized;
+ let _24: ();
+ let mut _25: &mut impl Sized;
+ let _26: ();
+ let mut _27: *const impl Sized;
+ let _28: ();
+ let mut _29: *mut impl Sized;
+ scope 1 {
+ debug r => _18;
+ let _19: &mut impl Sized;
+ scope 2 {
+ debug s => _19;
+ }
+ }
bb0: {
StorageLive(_2);
StorageLive(_3);
_3 = &_1;
- _2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind: bb10];
+ _2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind: bb14];
}
bb1: {
@@ -34,7 +52,7 @@
StorageLive(_4);
StorageLive(_5);
_5 = &_1;
- _4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind: bb10];
+ _4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind: bb14];
}
bb2: {
@@ -43,7 +61,7 @@
StorageLive(_6);
StorageLive(_7);
_7 = &mut _1;
- _6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind: bb10];
+ _6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind: bb14];
}
bb3: {
@@ -52,7 +70,7 @@
StorageLive(_8);
StorageLive(_9);
_9 = &mut _1;
- _8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind: bb10];
+ _8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind: bb14];
}
bb4: {
@@ -61,7 +79,7 @@
StorageLive(_10);
StorageLive(_11);
_11 = &raw const _1;
- _10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind: bb10];
+ _10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind: bb14];
}
bb5: {
@@ -70,7 +88,7 @@
StorageLive(_12);
StorageLive(_13);
_13 = &raw const _1;
- _12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind: bb10];
+ _12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind: bb14];
}
bb6: {
@@ -79,7 +97,7 @@
StorageLive(_14);
StorageLive(_15);
_15 = &raw mut _1;
- _14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind: bb10];
+ _14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind: bb14];
}
bb7: {
@@ -88,25 +106,82 @@
StorageLive(_16);
StorageLive(_17);
_17 = &raw mut _1;
- _16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind: bb10];
+ _16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind: bb14];
}
bb8: {
StorageDead(_17);
StorageDead(_16);
- _0 = const ();
- drop(_1) -> [return: bb9, unwind: bb11];
+- StorageLive(_18);
++ nop;
+ _18 = &mut _1;
+ StorageLive(_19);
+ StorageLive(_20);
+ StorageLive(_21);
+- _21 = move _18;
+- _20 = S::<&mut impl Sized>(move _21);
++ _21 = _18;
++ _20 = S::<&mut impl Sized>(_18);
+ StorageDead(_21);
+- _19 = move (_20.0: &mut impl Sized);
++ _19 = _18;
+ StorageDead(_20);
+ StorageLive(_22);
+ StorageLive(_23);
+- _23 = &(*_19);
++ _23 = &(*_18);
+ _22 = opaque::<&impl Sized>(move _23) -> [return: bb9, unwind: bb14];
}
bb9: {
+ StorageDead(_23);
+ StorageDead(_22);
+ StorageLive(_24);
+ StorageLive(_25);
+- _25 = &mut (*_19);
++ _25 = &mut (*_18);
+ _24 = opaque::<&mut impl Sized>(move _25) -> [return: bb10, unwind: bb14];
+ }
+
+ bb10: {
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageLive(_26);
+ StorageLive(_27);
+- _27 = &raw const (*_19);
++ _27 = &raw const (*_18);
+ _26 = opaque::<*const impl Sized>(move _27) -> [return: bb11, unwind: bb14];
+ }
+
+ bb11: {
+ StorageDead(_27);
+ StorageDead(_26);
+ StorageLive(_28);
+ StorageLive(_29);
+- _29 = &raw mut (*_19);
++ _29 = &raw mut (*_18);
+ _28 = opaque::<*mut impl Sized>(move _29) -> [return: bb12, unwind: bb14];
+ }
+
+ bb12: {
+ StorageDead(_29);
+ StorageDead(_28);
+ _0 = const ();
+ StorageDead(_19);
+- StorageDead(_18);
++ nop;
+ drop(_1) -> [return: bb13, unwind: bb15];
+ }
+
+ bb13: {
return;
}
- bb10 (cleanup): {
- drop(_1) -> [return: bb11, unwind terminate(cleanup)];
+ bb14 (cleanup): {
+ drop(_1) -> [return: bb15, unwind terminate(cleanup)];
}
- bb11 (cleanup): {
+ bb15 (cleanup): {
resume;
}
}
diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff
new file mode 100644
index 000000000..37915f857
--- /dev/null
+++ b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff
@@ -0,0 +1,79 @@
+- // MIR for `repeat` before GVN
++ // MIR for `repeat` after GVN
+
+ fn repeat() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _6: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _9: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ let mut _12: i32;
+ scope 1 {
+ debug val => _1;
+ let _2: [i32; 10];
+ scope 2 {
+ debug array => _2;
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
++ nop;
+ _1 = const 5_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
++ _3 = const 5_i32;
+ StorageLive(_4);
+- _4 = _1;
++ _4 = const 5_i32;
+ StorageLive(_5);
+- _5 = _1;
++ _5 = const 5_i32;
+ StorageLive(_6);
+- _6 = _1;
++ _6 = const 5_i32;
+ StorageLive(_7);
+- _7 = _1;
++ _7 = const 5_i32;
+ StorageLive(_8);
+- _8 = _1;
++ _8 = const 5_i32;
+ StorageLive(_9);
+- _9 = _1;
++ _9 = const 5_i32;
+ StorageLive(_10);
+- _10 = _1;
++ _10 = const 5_i32;
+ StorageLive(_11);
+- _11 = _1;
++ _11 = const 5_i32;
+ StorageLive(_12);
+- _12 = _1;
+- _2 = [move _3, move _4, move _5, move _6, move _7, move _8, move _9, move _10, move _11, move _12];
++ _12 = const 5_i32;
++ _2 = [const 5_i32; 10];
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+- StorageDead(_1);
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff
new file mode 100644
index 000000000..37915f857
--- /dev/null
+++ b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff
@@ -0,0 +1,79 @@
+- // MIR for `repeat` before GVN
++ // MIR for `repeat` after GVN
+
+ fn repeat() -> () {
+ let mut _0: ();
+ let _1: i32;
+ let mut _3: i32;
+ let mut _4: i32;
+ let mut _5: i32;
+ let mut _6: i32;
+ let mut _7: i32;
+ let mut _8: i32;
+ let mut _9: i32;
+ let mut _10: i32;
+ let mut _11: i32;
+ let mut _12: i32;
+ scope 1 {
+ debug val => _1;
+ let _2: [i32; 10];
+ scope 2 {
+ debug array => _2;
+ }
+ }
+
+ bb0: {
+- StorageLive(_1);
++ nop;
+ _1 = const 5_i32;
+ StorageLive(_2);
+ StorageLive(_3);
+- _3 = _1;
++ _3 = const 5_i32;
+ StorageLive(_4);
+- _4 = _1;
++ _4 = const 5_i32;
+ StorageLive(_5);
+- _5 = _1;
++ _5 = const 5_i32;
+ StorageLive(_6);
+- _6 = _1;
++ _6 = const 5_i32;
+ StorageLive(_7);
+- _7 = _1;
++ _7 = const 5_i32;
+ StorageLive(_8);
+- _8 = _1;
++ _8 = const 5_i32;
+ StorageLive(_9);
+- _9 = _1;
++ _9 = const 5_i32;
+ StorageLive(_10);
+- _10 = _1;
++ _10 = const 5_i32;
+ StorageLive(_11);
+- _11 = _1;
++ _11 = const 5_i32;
+ StorageLive(_12);
+- _12 = _1;
+- _2 = [move _3, move _4, move _5, move _6, move _7, move _8, move _9, move _10, move _11, move _12];
++ _12 = const 5_i32;
++ _2 = [const 5_i32; 10];
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
+ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_3);
+ _0 = const ();
+ StorageDead(_2);
+- StorageDead(_1);
++ nop;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
index 4c29523d6..d937902e8 100644
--- a/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
@@ -23,11 +23,11 @@
bb0: {
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = [move _4; N];
-- StorageDead(_4);
+ _3 = [_1; N];
+ StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
@@ -40,8 +40,10 @@
}
bb1: {
- _6 = _3[_7];
- _5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable];
+- _6 = _3[_7];
+- _5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable];
++ _6 = _1;
++ _5 = opaque::<T>(_1) -> [return: bb2, unwind unreachable];
}
bb2: {
@@ -55,13 +57,16 @@
- _13 = Len(_3);
- _14 = Lt(_12, _13);
- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind unreachable];
++ _13 = _8;
+ _14 = Lt(_2, _8);
+ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind unreachable];
}
bb3: {
- _11 = _3[_12];
- _10 = opaque::<T>(move _11) -> [return: bb4, unwind unreachable];
+- _11 = _3[_12];
+- _10 = opaque::<T>(move _11) -> [return: bb4, unwind unreachable];
++ _11 = _1;
++ _10 = opaque::<T>(_1) -> [return: bb4, unwind unreachable];
}
bb4: {
diff --git a/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
index e44f54cf3..dd4d24b12 100644
--- a/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
@@ -23,11 +23,11 @@
bb0: {
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = [move _4; N];
-- StorageDead(_4);
+ _3 = [_1; N];
+ StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
@@ -40,8 +40,10 @@
}
bb1: {
- _6 = _3[_7];
- _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue];
+- _6 = _3[_7];
+- _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue];
++ _6 = _1;
++ _5 = opaque::<T>(_1) -> [return: bb2, unwind continue];
}
bb2: {
@@ -55,13 +57,16 @@
- _13 = Len(_3);
- _14 = Lt(_12, _13);
- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind continue];
++ _13 = _8;
+ _14 = Lt(_2, _8);
+ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind continue];
}
bb3: {
- _11 = _3[_12];
- _10 = opaque::<T>(move _11) -> [return: bb4, unwind continue];
+- _11 = _3[_12];
+- _10 = opaque::<T>(move _11) -> [return: bb4, unwind continue];
++ _11 = _1;
++ _10 = opaque::<T>(_1) -> [return: bb4, unwind continue];
}
bb4: {
diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs
index a85e2ae36..10a66ced0 100644
--- a/tests/mir-opt/gvn.rs
+++ b/tests/mir-opt/gvn.rs
@@ -1,55 +1,133 @@
// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// only-64bit
#![feature(raw_ref_op)]
#![feature(rustc_attrs)]
+#![feature(custom_mir)]
+#![feature(core_intrinsics)]
#![allow(unconditional_panic)]
+use std::intrinsics::mir::*;
+use std::mem::transmute;
+
struct S<T>(T);
fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
+ // CHECK-LABEL: fn subexpression_elimination(
+
+ // CHECK: [[add:_.*]] = Add(_1, _2);
+ // CHECK: opaque::<u64>([[add]])
opaque(x + y);
+ // CHECK: [[mul:_.*]] = Mul(_1, _2);
+ // CHECK: opaque::<u64>([[mul]])
opaque(x * y);
+ // CHECK: [[sub:_.*]] = Sub(_1, _2);
+ // CHECK: opaque::<u64>([[sub]])
opaque(x - y);
+ // CHECK: [[div:_.*]] = Div(_1, _2);
+ // CHECK: opaque::<u64>([[div]])
opaque(x / y);
+ // CHECK: [[rem:_.*]] = Rem(_1, _2);
+ // CHECK: opaque::<u64>([[rem]])
opaque(x % y);
+ // CHECK: [[and:_.*]] = BitAnd(_1, _2);
+ // CHECK: opaque::<u64>([[and]])
opaque(x & y);
+ // CHECK: [[or:_.*]] = BitOr(_1, _2);
+ // CHECK: opaque::<u64>([[or]])
opaque(x | y);
+ // CHECK: [[xor:_.*]] = BitXor(_1, _2);
+ // CHECK: opaque::<u64>([[xor]])
opaque(x ^ y);
+ // CHECK: [[shl:_.*]] = Shl(_1, _2);
+ // CHECK: opaque::<u64>([[shl]])
opaque(x << y);
+ // CHECK: [[shr:_.*]] = Shr(_1, _2);
+ // CHECK: opaque::<u64>([[shr]])
opaque(x >> y);
+ // CHECK: [[int:_.*]] = _1 as u32 (IntToInt);
+ // CHECK: opaque::<u32>([[int]])
opaque(x as u32);
+ // CHECK: [[float:_.*]] = _1 as f32 (IntToFloat);
+ // CHECK: opaque::<f32>([[float]])
opaque(x as f32);
+ // CHECK: [[wrap:_.*]] = S::<u64>(_1);
+ // CHECK: opaque::<S<u64>>([[wrap]])
opaque(S(x));
+ // CHECK: opaque::<u64>(_1)
opaque(S(x).0);
// Those are duplicates to substitute somehow.
- opaque((x + y) + z);
- opaque((x * y) + z);
- opaque((x - y) + z);
- opaque((x / y) + z);
- opaque((x % y) + z);
- opaque((x & y) + z);
- opaque((x | y) + z);
- opaque((x ^ y) + z);
- opaque((x << y) + z);
- opaque((x >> y) + z);
+ // CHECK: opaque::<u64>([[add]])
+ opaque(x + y);
+ // CHECK: opaque::<u64>([[mul]])
+ opaque(x * y);
+ // CHECK: opaque::<u64>([[sub]])
+ opaque(x - y);
+ // CHECK: opaque::<u64>([[div]])
+ opaque(x / y);
+ // CHECK: opaque::<u64>([[rem]])
+ opaque(x % y);
+ // CHECK: opaque::<u64>([[and]])
+ opaque(x & y);
+ // CHECK: opaque::<u64>([[or]])
+ opaque(x | y);
+ // CHECK: opaque::<u64>([[xor]])
+ opaque(x ^ y);
+ // CHECK: opaque::<u64>([[shl]])
+ opaque(x << y);
+ // CHECK: opaque::<u64>([[shr]])
+ opaque(x >> y);
+ // CHECK: opaque::<u32>([[int]])
+ opaque(x as u32);
+ // CHECK: opaque::<f32>([[float]])
+ opaque(x as f32);
+ // CHECK: opaque::<S<u64>>([[wrap]])
opaque(S(x));
+ // CHECK: opaque::<u64>(_1)
opaque(S(x).0);
+ // We can substitute through a complex expression.
+ // CHECK: [[compound:_.*]] = Sub([[mul]], _2);
+ // CHECK: opaque::<u64>([[compound]])
+ // CHECK: opaque::<u64>([[compound]])
+ opaque((x * y) - y);
+ opaque((x * y) - y);
+
// We can substitute through an immutable reference too.
+ // CHECK: [[ref:_.*]] = &_3;
+ // CHECK: [[deref:_.*]] = (*[[ref]]);
+ // CHECK: [[addref:_.*]] = Add([[deref]], _1);
+ // CHECK: opaque::<u64>([[addref]])
+ // CHECK: opaque::<u64>([[addref]])
let a = &z;
opaque(*a + x);
opaque(*a + x);
// But not through a mutable reference or a pointer.
+ // CHECK: [[mut:_.*]] = &mut _3;
+ // CHECK: [[addmut:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addmut]])
+ // CHECK: [[addmut2:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addmut2]])
let b = &mut z;
opaque(*b + x);
opaque(*b + x);
unsafe {
+ // CHECK: [[raw:_.*]] = &raw const _3;
+ // CHECK: [[addraw:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addraw]])
+ // CHECK: [[addraw2:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addraw2]])
let c = &raw const z;
opaque(*c + x);
opaque(*c + x);
+ // CHECK: [[ptr:_.*]] = &raw mut _3;
+ // CHECK: [[addptr:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addptr]])
+ // CHECK: [[addptr2:_.*]] = Add(
+ // CHECK: opaque::<u64>(move [[addptr2]])
let d = &raw mut z;
opaque(*d + x);
opaque(*d + x);
@@ -57,13 +135,21 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
// We can substitute again, but not with the earlier computations.
// Important: `e` is not `a`!
+ // CHECK: [[ref2:_.*]] = &_3;
+ // CHECK: [[deref2:_.*]] = (*[[ref2]]);
+ // CHECK: [[addref2:_.*]] = Add([[deref2]], _1);
+ // CHECK: opaque::<u64>([[addref2]])
+ // CHECK: opaque::<u64>([[addref2]])
let e = &z;
opaque(*e + x);
opaque(*e + x);
-
}
fn wrap_unwrap<T: Copy>(x: T) -> T {
+ // CHECK-LABEL: fn wrap_unwrap(
+ // CHECK: [[some:_.*]] = Option::<T>::Some(_1);
+ // CHECK: switchInt(const 1_isize)
+ // CHECK: _0 = _1;
match Some(x) {
Some(y) => y,
None => panic!(),
@@ -71,163 +157,464 @@ fn wrap_unwrap<T: Copy>(x: T) -> T {
}
fn repeated_index<T: Copy, const N: usize>(x: T, idx: usize) {
+ // CHECK-LABEL: fn repeated_index(
+ // CHECK: [[a:_.*]] = [_1; N];
let a = [x; N];
+ // CHECK: opaque::<T>(_1)
opaque(a[0]);
+ // CHECK: opaque::<T>(_1)
opaque(a[idx]);
}
+/// Verify symbolic integer arithmetic simplifications.
fn arithmetic(x: u64) {
+ // CHECK-LABEL: fn arithmetic(
+ // CHECK: [[add:_.*]] = Add(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[add]])
opaque(x + 0);
+ // CHECK: [[sub:_.*]] = Sub(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[sub]])
opaque(x - 0);
+ // CHECK: [[mul0:_.*]] = Mul(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[mul0]])
opaque(x * 0);
+ // CHECK: [[mul1:_.*]] = Mul(_1, const 1_u64);
+ // CHECK: opaque::<u64>(move [[mul1]])
opaque(x * 1);
+ // CHECK: [[div0:_.*]] = Div(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[div0]])
opaque(x / 0);
+ // CHECK: [[div1:_.*]] = Div(_1, const 1_u64);
+ // CHECK: opaque::<u64>(move [[div1]])
opaque(x / 1);
+ // CHECK: [[zdiv:_.*]] = Div(const 0_u64, _1);
+ // CHECK: opaque::<u64>(move [[zdiv]])
opaque(0 / x);
+ // CHECK: [[odiv:_.*]] = Div(const 1_u64, _1);
+ // CHECK: opaque::<u64>(move [[odiv]])
opaque(1 / x);
+ // CHECK: [[rem0:_.*]] = Rem(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[rem0]])
opaque(x % 0);
+ // CHECK: [[rem1:_.*]] = Rem(_1, const 1_u64);
+ // CHECK: opaque::<u64>(move [[rem1]])
opaque(x % 1);
+ // CHECK: [[zrem:_.*]] = Rem(const 0_u64, _1);
+ // CHECK: opaque::<u64>(move [[zrem]])
opaque(0 % x);
+ // CHECK: [[orem:_.*]] = Rem(const 1_u64, _1);
+ // CHECK: opaque::<u64>(move [[orem]])
opaque(1 % x);
+ // CHECK: [[and:_.*]] = BitAnd(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[and]])
opaque(x & 0);
+ // CHECK: [[or:_.*]] = BitOr(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[or]])
opaque(x | 0);
+ // CHECK: [[xor:_.*]] = BitXor(_1, const 0_u64);
+ // CHECK: opaque::<u64>(move [[xor]])
opaque(x ^ 0);
+ // CHECK: [[shr:_.*]] = Shr(_1, const 0_i32);
+ // CHECK: opaque::<u64>(move [[shr]])
opaque(x >> 0);
+ // CHECK: [[shl:_.*]] = Shl(_1, const 0_i32);
+ // CHECK: opaque::<u64>(move [[shl]])
opaque(x << 0);
}
+fn comparison(x: u64, y: u64) {
+ // CHECK-LABEL: fn comparison(
+ // CHECK: [[eqxx:_.*]] = Eq(_1, _1);
+ // CHECK: opaque::<bool>(move [[eqxx]])
+ opaque(x == x);
+ // CHECK: [[nexx:_.*]] = Ne(_1, _1);
+ // CHECK: opaque::<bool>(move [[nexx]])
+ opaque(x != x);
+ // CHECK: [[eqxy:_.*]] = Eq(_1, _2);
+ // CHECK: opaque::<bool>(move [[eqxy]])
+ opaque(x == y);
+ // CHECK: [[nexy:_.*]] = Ne(_1, _2);
+ // CHECK: opaque::<bool>(move [[nexy]])
+ opaque(x != y);
+}
+
+/// Verify symbolic integer arithmetic simplifications on checked ops.
#[rustc_inherit_overflow_checks]
fn arithmetic_checked(x: u64) {
+ // CHECK-LABEL: fn arithmetic_checked(
+ // CHECK: [[cadd:_.*]] = CheckedAdd(_1, const 0_u64);
+ // CHECK: [[add:_.*]] = move ([[cadd]].0: u64);
+ // CHECK: opaque::<u64>(move [[add]])
opaque(x + 0);
+ // CHECK: [[csub:_.*]] = CheckedSub(_1, const 0_u64);
+ // CHECK: [[sub:_.*]] = move ([[csub]].0: u64);
+ // CHECK: opaque::<u64>(move [[sub]])
opaque(x - 0);
+ // CHECK: [[cmul0:_.*]] = CheckedMul(_1, const 0_u64);
+ // CHECK: [[mul0:_.*]] = move ([[cmul0]].0: u64);
+ // CHECK: opaque::<u64>(move [[mul0]])
opaque(x * 0);
+ // CHECK: [[cmul1:_.*]] = CheckedMul(_1, const 1_u64);
+ // CHECK: [[mul1:_.*]] = move ([[cmul1]].0: u64);
+ // CHECK: opaque::<u64>(move [[mul1]])
opaque(x * 1);
- opaque(x / 0);
- opaque(x / 1);
- opaque(0 / x);
- opaque(1 / x);
- opaque(x % 0);
- opaque(x % 1);
- opaque(0 % x);
- opaque(1 % x);
- opaque(x & 0);
- opaque(x | 0);
- opaque(x ^ 0);
- opaque(x >> 0);
- opaque(x << 0);
}
+/// Verify that we do not apply arithmetic simplifications on floats.
fn arithmetic_float(x: f64) {
+ // CHECK-LABEL: fn arithmetic_float(
+ // CHECK: [[add:_.*]] = Add(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[add]])
opaque(x + 0.);
+ // CHECK: [[sub:_.*]] = Sub(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[sub]])
opaque(x - 0.);
+ // CHECK: [[mul:_.*]] = Mul(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[mul]])
opaque(x * 0.);
+ // CHECK: [[div0:_.*]] = Div(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[div0]])
opaque(x / 0.);
+ // CHECK: [[zdiv:_.*]] = Div(const 0f64, _1);
+ // CHECK: opaque::<f64>(move [[zdiv]])
opaque(0. / x);
+ // CHECK: [[rem0:_.*]] = Rem(_1, const 0f64);
+ // CHECK: opaque::<f64>(move [[rem0]])
opaque(x % 0.);
+ // CHECK: [[zrem:_.*]] = Rem(const 0f64, _1);
+ // CHECK: opaque::<f64>(move [[zrem]])
opaque(0. % x);
// Those are not simplifiable to `true`/`false`, thanks to NaNs.
+ // CHECK: [[eq:_.*]] = Eq(_1, _1);
+ // CHECK: opaque::<bool>(move [[eq]])
opaque(x == x);
+ // CHECK: [[ne:_.*]] = Ne(_1, _1);
+ // CHECK: opaque::<bool>(move [[ne]])
opaque(x != x);
}
fn cast() {
+ // CHECK-LABEL: fn cast(
let i = 1_i64;
let u = 1_u64;
let f = 1_f64;
+ // CHECK: opaque::<u8>(const 1_u8)
opaque(i as u8);
+ // CHECK: opaque::<u16>(const 1_u16)
opaque(i as u16);
+ // CHECK: opaque::<u32>(const 1_u32)
opaque(i as u32);
+ // CHECK: opaque::<u64>(const 1_u64)
opaque(i as u64);
+ // CHECK: opaque::<i8>(const 1_i8)
opaque(i as i8);
+ // CHECK: opaque::<i16>(const 1_i16)
opaque(i as i16);
+ // CHECK: opaque::<i32>(const 1_i32)
opaque(i as i32);
+ // CHECK: opaque::<i64>(const 1_i64)
opaque(i as i64);
+ // CHECK: opaque::<f32>(const 1f32)
opaque(i as f32);
+ // CHECK: opaque::<f64>(const 1f64)
opaque(i as f64);
+ // CHECK: opaque::<u8>(const 1_u8)
opaque(u as u8);
+ // CHECK: opaque::<u16>(const 1_u16)
opaque(u as u16);
+ // CHECK: opaque::<u32>(const 1_u32)
opaque(u as u32);
+ // CHECK: opaque::<u64>(const 1_u64)
opaque(u as u64);
+ // CHECK: opaque::<i8>(const 1_i8)
opaque(u as i8);
+ // CHECK: opaque::<i16>(const 1_i16)
opaque(u as i16);
+ // CHECK: opaque::<i32>(const 1_i32)
opaque(u as i32);
+ // CHECK: opaque::<i64>(const 1_i64)
opaque(u as i64);
+ // CHECK: opaque::<f32>(const 1f32)
opaque(u as f32);
+ // CHECK: opaque::<f64>(const 1f64)
opaque(u as f64);
+ // CHECK: opaque::<u8>(const 1_u8)
opaque(f as u8);
+ // CHECK: opaque::<u16>(const 1_u16)
opaque(f as u16);
+ // CHECK: opaque::<u32>(const 1_u32)
opaque(f as u32);
+ // CHECK: opaque::<u64>(const 1_u64)
opaque(f as u64);
+ // CHECK: opaque::<i8>(const 1_i8)
opaque(f as i8);
+ // CHECK: opaque::<i16>(const 1_i16)
opaque(f as i16);
+ // CHECK: opaque::<i32>(const 1_i32)
opaque(f as i32);
+ // CHECK: opaque::<i64>(const 1_i64)
opaque(f as i64);
+ // CHECK: opaque::<f32>(const 1f32)
opaque(f as f32);
+ // CHECK: opaque::<f64>(const 1f64)
opaque(f as f64);
}
fn multiple_branches(t: bool, x: u8, y: u8) {
+ // CHECK-LABEL: fn multiple_branches(
+ // CHECK: switchInt(_1) -> [0: [[bbf:bb.*]], otherwise: [[bbt:bb.*]]];
if t {
- opaque(x + y); // a
- opaque(x + y); // should reuse a
+ // CHECK: [[bbt]]: {
+ // CHECK: [[a:_.*]] = Add(_2, _3);
+ // CHECK: opaque::<u8>([[a]])
+ // CHECK: opaque::<u8>([[a]])
+ // CHECK: goto -> [[bbc:bb.*]];
+ opaque(x + y);
+ opaque(x + y);
} else {
- opaque(x + y); // b
- opaque(x + y); // shoud reuse b
+ // CHECK: [[bbf]]: {
+ // CHECK: [[b:_.*]] = Add(_2, _3);
+ // CHECK: opaque::<u8>([[b]])
+ // CHECK: opaque::<u8>([[b]])
+ // CHECK: goto -> [[bbc:bb.*]];
+ opaque(x + y);
+ opaque(x + y);
}
- opaque(x + y); // c
+ // Neither `a` nor `b` dominate `c`, so we cannot reuse any of them.
+ // CHECK: [[bbc]]: {
+ // CHECK: [[c:_.*]] = Add(_2, _3);
+ // CHECK: opaque::<u8>([[c]])
+ opaque(x + y);
+
+ // `c` dominates both calls, so we can reuse it.
if t {
- opaque(x + y); // should reuse c
+ // CHECK: opaque::<u8>([[c]])
+ opaque(x + y);
} else {
- opaque(x + y); // should reuse c
+ // CHECK: opaque::<u8>([[c]])
+ opaque(x + y);
}
}
+/// Verify that we do not reuse a `&raw? mut?` rvalue.
fn references(mut x: impl Sized) {
+ // CHECK-LABEL: fn references(
+ // CHECK: [[ref1:_.*]] = &_1;
+ // CHECK: opaque::<&impl Sized>(move [[ref1]])
opaque(&x);
- opaque(&x); // should not reuse a
+ // CHECK: [[ref2:_.*]] = &_1;
+ // CHECK: opaque::<&impl Sized>(move [[ref2]])
+ opaque(&x);
+ // CHECK: [[ref3:_.*]] = &mut _1;
+ // CHECK: opaque::<&mut impl Sized>(move [[ref3]])
+ opaque(&mut x);
+ // CHECK: [[ref4:_.*]] = &mut _1;
+ // CHECK: opaque::<&mut impl Sized>(move [[ref4]])
opaque(&mut x);
- opaque(&mut x); // should not reuse a
+ // CHECK: [[ref5:_.*]] = &raw const _1;
+ // CHECK: opaque::<*const impl Sized>(move [[ref5]])
opaque(&raw const x);
- opaque(&raw const x); // should not reuse a
+ // CHECK: [[ref6:_.*]] = &raw const _1;
+ // CHECK: opaque::<*const impl Sized>(move [[ref6]])
+ opaque(&raw const x);
+ // CHECK: [[ref7:_.*]] = &raw mut _1;
+ // CHECK: opaque::<*mut impl Sized>(move [[ref7]])
+ opaque(&raw mut x);
+ // CHECK: [[ref8:_.*]] = &raw mut _1;
+ // CHECK: opaque::<*mut impl Sized>(move [[ref8]])
opaque(&raw mut x);
- opaque(&raw mut x); // should not reuse a
+
+ let r = &mut x;
+ let s = S(r).0; // Obfuscate `r`. Following lines should still reborrow `r`.
+ // CHECK: [[ref9:_.*]] = &mut _1;
+ // CHECK: [[ref10:_.*]] = &(*[[ref9]]);
+ // CHECK: opaque::<&impl Sized>(move [[ref10]])
+ opaque(&*s);
+ // CHECK: [[ref11:_.*]] = &mut (*[[ref9]]);
+ // CHECK: opaque::<&mut impl Sized>(move [[ref11]])
+ opaque(&mut *s);
+ // CHECK: [[ref12:_.*]] = &raw const (*[[ref9]]);
+ // CHECK: opaque::<*const impl Sized>(move [[ref12]])
+ opaque(&raw const *s);
+ // CHECK: [[ref12:_.*]] = &raw mut (*[[ref9]]);
+ // CHECK: opaque::<*mut impl Sized>(move [[ref12]])
+ opaque(&raw mut *s);
}
fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) {
+ // CHECK-LABEL: fn dereferences(
+
+ // Do not reuse dereferences of `&mut`.
+ // CHECK: [[st1:_.*]] = (*_1);
+ // CHECK: opaque::<u32>(move [[st1]])
+ // CHECK: [[st2:_.*]] = (*_1);
+ // CHECK: opaque::<u32>(move [[st2]])
opaque(*t);
- opaque(*t); // this cannot reuse a, as x is &mut.
+ opaque(*t);
+
+ // Do not reuse dereferences of `*const`.
+ // CHECK: [[raw:_.*]] = &raw const (*_1);
+ // CHECK: [[st3:_.*]] = (*[[raw]]);
+ // CHECK: opaque::<u32>(move [[st3]])
+ // CHECK: [[st4:_.*]] = (*[[raw]]);
+ // CHECK: opaque::<u32>(move [[st4]])
let z = &raw const *t;
unsafe { opaque(*z) };
- unsafe { opaque(*z) }; // this cannot reuse a, as x is *const.
+ unsafe { opaque(*z) };
+
+ // Do not reuse dereferences of `*mut`.
+ // CHECK: [[ptr:_.*]] = &raw mut (*_1);
+ // CHECK: [[st5:_.*]] = (*[[ptr]]);
+ // CHECK: opaque::<u32>(move [[st5]])
+ // CHECK: [[st6:_.*]] = (*[[ptr]]);
+ // CHECK: opaque::<u32>(move [[st6]])
let z = &raw mut *t;
unsafe { opaque(*z) };
- unsafe { opaque(*z) }; // this cannot reuse a, as x is *mut.
+ unsafe { opaque(*z) };
+
+ // We can reuse dereferences of `&Freeze`.
+ // CHECK: [[ref:_.*]] = &(*_1);
+ // CHECK: [[st7:_.*]] = (*[[ref]]);
+ // CHECK: opaque::<u32>([[st7]])
+ // CHECK: opaque::<u32>([[st7]])
let z = &*t;
opaque(*z);
- opaque(*z); // this can reuse, as `z` is immutable ref, Freeze and Copy.
- opaque(&*z); // but not for a reborrow.
+ opaque(*z);
+ // But not in reborrows.
+ // CHECK: [[reborrow:_.*]] = &(*[[ref]]);
+ // CHECK: opaque::<&u32>(move [[reborrow]])
+ opaque(&*z);
+
+ // `*u` is not Freeze, so we cannot reuse.
+ // CHECK: [[st8:_.*]] = (*_2);
+ // CHECK: opaque::<impl Copy>(move [[st8]])
+ // CHECK: [[st9:_.*]] = (*_2);
+ // CHECK: opaque::<impl Copy>(move [[st9]])
opaque(*u);
- opaque(*u); // this cannot reuse, as `z` is not Freeze.
+ opaque(*u);
+
+ // `*s` is not Copy, by `(*s).0` is, so we can reuse.
+ // CHECK: [[st10:_.*]] = ((*_3).0: u32);
+ // CHECK: opaque::<u32>([[st10]])
+ // CHECK: opaque::<u32>([[st10]])
+ opaque(s.0);
opaque(s.0);
- opaque(s.0); // *s is not Copy, by (*s).0 is, so we can reuse.
}
fn slices() {
+ // CHECK-LABEL: fn slices(
+ // CHECK: {{_.*}} = const "
+ // CHECK-NOT: {{_.*}} = const "
let s = "my favourite slice"; // This is a `Const::Slice` in MIR.
opaque(s);
let t = s; // This should be the same pointer, so cannot be a `Const::Slice`.
opaque(t);
assert_eq!(s.as_ptr(), t.as_ptr());
- let u = unsafe { std::mem::transmute::<&str, &[u8]>(s) };
+ let u = unsafe { transmute::<&str, &[u8]>(s) };
opaque(u);
assert_eq!(s.as_ptr(), u.as_ptr());
}
+#[custom_mir(dialect = "analysis")]
+fn duplicate_slice() -> (bool, bool) {
+ // CHECK-LABEL: fn duplicate_slice(
+ mir!(
+ let au: u128;
+ let bu: u128;
+ let cu: u128;
+ let du: u128;
+ let c: &str;
+ let d: &str;
+ {
+ // CHECK: [[a:_.*]] = (const "a",);
+ // CHECK: [[au:_.*]] = ([[a]].0: &str) as u128 (Transmute);
+ let a = ("a",);
+ Call(au = transmute::<_, u128>(a.0), bb1)
+ }
+ bb1 = {
+ // CHECK: [[c:_.*]] = identity::<&str>(([[a]].0: &str))
+ Call(c = identity(a.0), bb2)
+ }
+ bb2 = {
+ // CHECK: [[cu:_.*]] = [[c]] as u128 (Transmute);
+ Call(cu = transmute::<_, u128>(c), bb3)
+ }
+ bb3 = {
+ // This slice is different from `a.0`. Hence `bu` is not `au`.
+ // CHECK: [[b:_.*]] = const "a";
+ // CHECK: [[bu:_.*]] = [[b]] as u128 (Transmute);
+ let b = "a";
+ Call(bu = transmute::<_, u128>(b), bb4)
+ }
+ bb4 = {
+ // This returns a copy of `b`, which is not `a`.
+ // CHECK: [[d:_.*]] = identity::<&str>([[b]])
+ Call(d = identity(b), bb5)
+ }
+ bb5 = {
+ // CHECK: [[du:_.*]] = [[d]] as u128 (Transmute);
+ Call(du = transmute::<_, u128>(d), bb6)
+ }
+ bb6 = {
+ // `direct` must not fold to `true`, as `indirect` will not.
+ // CHECK: = Eq([[au]], [[bu]]);
+ // CHECK: = Eq([[cu]], [[du]]);
+ let direct = au == bu;
+ let indirect = cu == du;
+ RET = (direct, indirect);
+ Return()
+ }
+ )
+}
+
+fn repeat() {
+ // CHECK-LABEL: fn repeat(
+ // CHECK: = [const 5_i32; 10];
+ let val = 5;
+ let array = [val, val, val, val, val, val, val, val, val, val];
+}
+
+/// Verify that we do not merge fn pointers created by casts.
+fn fn_pointers() {
+ // CHECK-LABEL: fn fn_pointers(
+ // CHECK: [[f:_.*]] = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer
+ // CHECK: opaque::<fn(u8) -> u8>([[f]])
+ let f = identity as fn(u8) -> u8;
+ opaque(f);
+ // CHECK: [[g:_.*]] = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer
+ // CHECK: opaque::<fn(u8) -> u8>([[g]])
+ let g = identity as fn(u8) -> u8;
+ opaque(g);
+
+ // CHECK: [[cf:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer
+ // CHECK: opaque::<fn()>([[cf]])
+ let closure = || {};
+ let cf = closure as fn();
+ opaque(cf);
+ // CHECK: [[cg:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer
+ // CHECK: opaque::<fn()>([[cg]])
+ let cg = closure as fn();
+ opaque(cg);
+}
+
+/// Verify that we do not create a `ConstValue::Indirect` backed by a static's AllocId.
+#[custom_mir(dialect = "analysis")]
+fn indirect_static() {
+ static A: Option<u8> = None;
+
+ mir!({
+ let ptr = Static(A);
+ let out = Field::<u8>(Variant(*ptr, 1), 0);
+ Return()
+ })
+}
+
fn main() {
subexpression_elimination(2, 4, 5);
wrap_unwrap(5);
repeated_index::<u32, 7>(5, 3);
arithmetic(5);
+ comparison(5, 6);
arithmetic_checked(5);
arithmetic_float(5.);
cast();
@@ -235,15 +622,26 @@ fn main() {
references(5);
dereferences(&mut 5, &6, &S(7));
slices();
+ let (direct, indirect) = duplicate_slice();
+ assert_eq!(direct, indirect);
+ repeat();
+ fn_pointers();
+ indirect_static();
}
#[inline(never)]
fn opaque(_: impl Sized) {}
+#[inline(never)]
+fn identity<T>(x: T) -> T {
+ x
+}
+
// EMIT_MIR gvn.subexpression_elimination.GVN.diff
// EMIT_MIR gvn.wrap_unwrap.GVN.diff
// EMIT_MIR gvn.repeated_index.GVN.diff
// EMIT_MIR gvn.arithmetic.GVN.diff
+// EMIT_MIR gvn.comparison.GVN.diff
// EMIT_MIR gvn.arithmetic_checked.GVN.diff
// EMIT_MIR gvn.arithmetic_float.GVN.diff
// EMIT_MIR gvn.cast.GVN.diff
@@ -251,3 +649,7 @@ fn opaque(_: impl Sized) {}
// EMIT_MIR gvn.references.GVN.diff
// EMIT_MIR gvn.dereferences.GVN.diff
// EMIT_MIR gvn.slices.GVN.diff
+// EMIT_MIR gvn.duplicate_slice.GVN.diff
+// EMIT_MIR gvn.repeat.GVN.diff
+// EMIT_MIR gvn.fn_pointers.GVN.diff
+// EMIT_MIR gvn.indirect_static.GVN.diff
diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
index de3d28d05..ec4499803 100644
--- a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
@@ -85,32 +85,35 @@
bb0: {
- StorageLive(_1);
++ nop;
_1 = const "my favourite slice";
StorageLive(_2);
-- StorageLive(_3);
-- _3 = _1;
+ StorageLive(_3);
+ _3 = _1;
- _2 = opaque::<&str>(move _3) -> [return: bb1, unwind unreachable];
+ _2 = opaque::<&str>(_1) -> [return: bb1, unwind unreachable];
}
bb1: {
-- StorageDead(_3);
+ StorageDead(_3);
StorageDead(_2);
StorageLive(_4);
_4 = _1;
StorageLive(_5);
-- StorageLive(_6);
+ StorageLive(_6);
- _6 = _4;
- _5 = opaque::<&str>(move _6) -> [return: bb2, unwind unreachable];
++ _6 = _1;
+ _5 = opaque::<&str>(_1) -> [return: bb2, unwind unreachable];
}
bb2: {
-- StorageDead(_6);
+ StorageDead(_6);
StorageDead(_5);
-- StorageLive(_7);
+ StorageLive(_7);
StorageLive(_8);
- StorageLive(_9);
+- StorageLive(_9);
++ nop;
StorageLive(_10);
StorageLive(_11);
_11 = &(*_1);
@@ -120,28 +123,37 @@
bb3: {
StorageDead(_11);
_9 = &_10;
- StorageLive(_12);
+- StorageLive(_12);
++ nop;
StorageLive(_13);
StorageLive(_14);
- _14 = &(*_4);
+- _14 = &(*_4);
++ _14 = &(*_1);
_13 = core::str::<impl str>::as_ptr(move _14) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_14);
_12 = &_13;
- _8 = (move _9, move _12);
- StorageDead(_12);
- StorageDead(_9);
+- _8 = (move _9, move _12);
+- StorageDead(_12);
+- StorageDead(_9);
++ _8 = (_9, _12);
++ nop;
++ nop;
StorageLive(_15);
- _15 = (_8.0: &*const u8);
+- _15 = (_8.0: &*const u8);
++ _15 = _9;
StorageLive(_16);
- _16 = (_8.1: &*const u8);
+- _16 = (_8.1: &*const u8);
++ _16 = _12;
StorageLive(_17);
StorageLive(_18);
- _18 = (*_15);
+- _18 = (*_15);
++ _18 = (*_9);
StorageLive(_19);
- _19 = (*_16);
+- _19 = (*_16);
++ _19 = (*_12);
_17 = Eq(move _18, move _19);
switchInt(move _17) -> [0: bb6, otherwise: bb5];
}
@@ -149,22 +161,23 @@
bb5: {
StorageDead(_19);
StorageDead(_18);
-- _7 = const ();
+ _7 = const ();
StorageDead(_17);
StorageDead(_16);
StorageDead(_15);
StorageDead(_13);
StorageDead(_10);
StorageDead(_8);
-- StorageDead(_7);
+ StorageDead(_7);
- StorageLive(_29);
++ nop;
StorageLive(_30);
_30 = &(*_1);
_29 = move _30 as &[u8] (Transmute);
StorageDead(_30);
StorageLive(_31);
-- StorageLive(_32);
-- _32 = _29;
+ StorageLive(_32);
+ _32 = _29;
- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind unreachable];
+ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind unreachable];
}
@@ -173,30 +186,38 @@
StorageDead(_19);
StorageDead(_18);
- StorageLive(_21);
- _21 = core::panicking::AssertKind::Eq;
+- _21 = core::panicking::AssertKind::Eq;
++ nop;
++ _21 = const core::panicking::AssertKind::Eq;
StorageLive(_22);
-- StorageLive(_23);
+ StorageLive(_23);
- _23 = move _21;
++ _23 = const core::panicking::AssertKind::Eq;
StorageLive(_24);
- StorageLive(_25);
- _25 = &(*_15);
+- StorageLive(_25);
+- _25 = &(*_15);
++ nop;
++ _25 = &(*_9);
_24 = &(*_25);
StorageLive(_26);
- StorageLive(_27);
- _27 = &(*_16);
+- StorageLive(_27);
+- _27 = &(*_16);
++ nop;
++ _27 = &(*_12);
_26 = &(*_27);
StorageLive(_28);
_28 = Option::<Arguments<'_>>::None;
-- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind unreachable;
-+ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind unreachable;
+- _22 = assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind unreachable;
++ _22 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _26, move _28) -> unwind unreachable;
}
bb7: {
-- StorageDead(_32);
+ StorageDead(_32);
StorageDead(_31);
-- StorageLive(_33);
+ StorageLive(_33);
StorageLive(_34);
- StorageLive(_35);
+- StorageLive(_35);
++ nop;
StorageLive(_36);
StorageLive(_37);
_37 = &(*_1);
@@ -206,7 +227,8 @@
bb8: {
StorageDead(_37);
_35 = &_36;
- StorageLive(_38);
+- StorageLive(_38);
++ nop;
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
@@ -216,18 +238,25 @@
bb9: {
StorageDead(_40);
_38 = &_39;
- _34 = (move _35, move _38);
- StorageDead(_38);
- StorageDead(_35);
+- _34 = (move _35, move _38);
+- StorageDead(_38);
+- StorageDead(_35);
++ _34 = (_35, _38);
++ nop;
++ nop;
StorageLive(_41);
- _41 = (_34.0: &*const u8);
+- _41 = (_34.0: &*const u8);
++ _41 = _35;
StorageLive(_42);
- _42 = (_34.1: &*const u8);
+- _42 = (_34.1: &*const u8);
++ _42 = _38;
StorageLive(_43);
StorageLive(_44);
- _44 = (*_41);
+- _44 = (*_41);
++ _44 = (*_35);
StorageLive(_45);
- _45 = (*_42);
+- _45 = (*_42);
++ _45 = (*_38);
_43 = Eq(move _44, move _45);
switchInt(move _43) -> [0: bb11, otherwise: bb10];
}
@@ -235,18 +264,20 @@
bb10: {
StorageDead(_45);
StorageDead(_44);
-- _33 = const ();
+ _33 = const ();
StorageDead(_43);
StorageDead(_42);
StorageDead(_41);
StorageDead(_39);
StorageDead(_36);
StorageDead(_34);
-- StorageDead(_33);
+ StorageDead(_33);
_0 = const ();
- StorageDead(_29);
++ nop;
StorageDead(_4);
- StorageDead(_1);
++ nop;
return;
}
@@ -254,22 +285,29 @@
StorageDead(_45);
StorageDead(_44);
- StorageLive(_47);
- _47 = core::panicking::AssertKind::Eq;
+- _47 = core::panicking::AssertKind::Eq;
++ nop;
++ _47 = const core::panicking::AssertKind::Eq;
StorageLive(_48);
-- StorageLive(_49);
+ StorageLive(_49);
- _49 = move _47;
++ _49 = const core::panicking::AssertKind::Eq;
StorageLive(_50);
- StorageLive(_51);
- _51 = &(*_41);
+- StorageLive(_51);
+- _51 = &(*_41);
++ nop;
++ _51 = &(*_35);
_50 = &(*_51);
StorageLive(_52);
- StorageLive(_53);
- _53 = &(*_42);
+- StorageLive(_53);
+- _53 = &(*_42);
++ nop;
++ _53 = &(*_38);
_52 = &(*_53);
StorageLive(_54);
_54 = Option::<Arguments<'_>>::None;
-- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind unreachable;
-+ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind unreachable;
+- _48 = assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind unreachable;
++ _48 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _50, move _52, move _54) -> unwind unreachable;
}
}
diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
index f22bb2543..56a78ca86 100644
--- a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
@@ -85,32 +85,35 @@
bb0: {
- StorageLive(_1);
++ nop;
_1 = const "my favourite slice";
StorageLive(_2);
-- StorageLive(_3);
-- _3 = _1;
+ StorageLive(_3);
+ _3 = _1;
- _2 = opaque::<&str>(move _3) -> [return: bb1, unwind continue];
+ _2 = opaque::<&str>(_1) -> [return: bb1, unwind continue];
}
bb1: {
-- StorageDead(_3);
+ StorageDead(_3);
StorageDead(_2);
StorageLive(_4);
_4 = _1;
StorageLive(_5);
-- StorageLive(_6);
+ StorageLive(_6);
- _6 = _4;
- _5 = opaque::<&str>(move _6) -> [return: bb2, unwind continue];
++ _6 = _1;
+ _5 = opaque::<&str>(_1) -> [return: bb2, unwind continue];
}
bb2: {
-- StorageDead(_6);
+ StorageDead(_6);
StorageDead(_5);
-- StorageLive(_7);
+ StorageLive(_7);
StorageLive(_8);
- StorageLive(_9);
+- StorageLive(_9);
++ nop;
StorageLive(_10);
StorageLive(_11);
_11 = &(*_1);
@@ -120,28 +123,37 @@
bb3: {
StorageDead(_11);
_9 = &_10;
- StorageLive(_12);
+- StorageLive(_12);
++ nop;
StorageLive(_13);
StorageLive(_14);
- _14 = &(*_4);
+- _14 = &(*_4);
++ _14 = &(*_1);
_13 = core::str::<impl str>::as_ptr(move _14) -> [return: bb4, unwind continue];
}
bb4: {
StorageDead(_14);
_12 = &_13;
- _8 = (move _9, move _12);
- StorageDead(_12);
- StorageDead(_9);
+- _8 = (move _9, move _12);
+- StorageDead(_12);
+- StorageDead(_9);
++ _8 = (_9, _12);
++ nop;
++ nop;
StorageLive(_15);
- _15 = (_8.0: &*const u8);
+- _15 = (_8.0: &*const u8);
++ _15 = _9;
StorageLive(_16);
- _16 = (_8.1: &*const u8);
+- _16 = (_8.1: &*const u8);
++ _16 = _12;
StorageLive(_17);
StorageLive(_18);
- _18 = (*_15);
+- _18 = (*_15);
++ _18 = (*_9);
StorageLive(_19);
- _19 = (*_16);
+- _19 = (*_16);
++ _19 = (*_12);
_17 = Eq(move _18, move _19);
switchInt(move _17) -> [0: bb6, otherwise: bb5];
}
@@ -149,22 +161,23 @@
bb5: {
StorageDead(_19);
StorageDead(_18);
-- _7 = const ();
+ _7 = const ();
StorageDead(_17);
StorageDead(_16);
StorageDead(_15);
StorageDead(_13);
StorageDead(_10);
StorageDead(_8);
-- StorageDead(_7);
+ StorageDead(_7);
- StorageLive(_29);
++ nop;
StorageLive(_30);
_30 = &(*_1);
_29 = move _30 as &[u8] (Transmute);
StorageDead(_30);
StorageLive(_31);
-- StorageLive(_32);
-- _32 = _29;
+ StorageLive(_32);
+ _32 = _29;
- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind continue];
+ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind continue];
}
@@ -173,30 +186,38 @@
StorageDead(_19);
StorageDead(_18);
- StorageLive(_21);
- _21 = core::panicking::AssertKind::Eq;
+- _21 = core::panicking::AssertKind::Eq;
++ nop;
++ _21 = const core::panicking::AssertKind::Eq;
StorageLive(_22);
-- StorageLive(_23);
+ StorageLive(_23);
- _23 = move _21;
++ _23 = const core::panicking::AssertKind::Eq;
StorageLive(_24);
- StorageLive(_25);
- _25 = &(*_15);
+- StorageLive(_25);
+- _25 = &(*_15);
++ nop;
++ _25 = &(*_9);
_24 = &(*_25);
StorageLive(_26);
- StorageLive(_27);
- _27 = &(*_16);
+- StorageLive(_27);
+- _27 = &(*_16);
++ nop;
++ _27 = &(*_12);
_26 = &(*_27);
StorageLive(_28);
_28 = Option::<Arguments<'_>>::None;
-- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind continue;
-+ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind continue;
+- _22 = assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind continue;
++ _22 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _26, move _28) -> unwind continue;
}
bb7: {
-- StorageDead(_32);
+ StorageDead(_32);
StorageDead(_31);
-- StorageLive(_33);
+ StorageLive(_33);
StorageLive(_34);
- StorageLive(_35);
+- StorageLive(_35);
++ nop;
StorageLive(_36);
StorageLive(_37);
_37 = &(*_1);
@@ -206,7 +227,8 @@
bb8: {
StorageDead(_37);
_35 = &_36;
- StorageLive(_38);
+- StorageLive(_38);
++ nop;
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
@@ -216,18 +238,25 @@
bb9: {
StorageDead(_40);
_38 = &_39;
- _34 = (move _35, move _38);
- StorageDead(_38);
- StorageDead(_35);
+- _34 = (move _35, move _38);
+- StorageDead(_38);
+- StorageDead(_35);
++ _34 = (_35, _38);
++ nop;
++ nop;
StorageLive(_41);
- _41 = (_34.0: &*const u8);
+- _41 = (_34.0: &*const u8);
++ _41 = _35;
StorageLive(_42);
- _42 = (_34.1: &*const u8);
+- _42 = (_34.1: &*const u8);
++ _42 = _38;
StorageLive(_43);
StorageLive(_44);
- _44 = (*_41);
+- _44 = (*_41);
++ _44 = (*_35);
StorageLive(_45);
- _45 = (*_42);
+- _45 = (*_42);
++ _45 = (*_38);
_43 = Eq(move _44, move _45);
switchInt(move _43) -> [0: bb11, otherwise: bb10];
}
@@ -235,18 +264,20 @@
bb10: {
StorageDead(_45);
StorageDead(_44);
-- _33 = const ();
+ _33 = const ();
StorageDead(_43);
StorageDead(_42);
StorageDead(_41);
StorageDead(_39);
StorageDead(_36);
StorageDead(_34);
-- StorageDead(_33);
+ StorageDead(_33);
_0 = const ();
- StorageDead(_29);
++ nop;
StorageDead(_4);
- StorageDead(_1);
++ nop;
return;
}
@@ -254,22 +285,29 @@
StorageDead(_45);
StorageDead(_44);
- StorageLive(_47);
- _47 = core::panicking::AssertKind::Eq;
+- _47 = core::panicking::AssertKind::Eq;
++ nop;
++ _47 = const core::panicking::AssertKind::Eq;
StorageLive(_48);
-- StorageLive(_49);
+ StorageLive(_49);
- _49 = move _47;
++ _49 = const core::panicking::AssertKind::Eq;
StorageLive(_50);
- StorageLive(_51);
- _51 = &(*_41);
+- StorageLive(_51);
+- _51 = &(*_41);
++ nop;
++ _51 = &(*_35);
_50 = &(*_51);
StorageLive(_52);
- StorageLive(_53);
- _53 = &(*_42);
+- StorageLive(_53);
+- _53 = &(*_42);
++ nop;
++ _53 = &(*_38);
_52 = &(*_53);
StorageLive(_54);
_54 = Option::<Arguments<'_>>::None;
-- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind continue;
-+ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind continue;
+- _48 = assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind continue;
++ _48 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _50, move _52, move _54) -> unwind continue;
}
}
diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
index bf866e2f4..0a747d3ae 100644
--- a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
@@ -65,11 +65,11 @@
let mut _60: u64;
let mut _61: u64;
let mut _62: u64;
- let mut _63: u64;
+ let _63: ();
let mut _64: u64;
- let _65: ();
+ let mut _65: u64;
let mut _66: u64;
- let mut _67: u64;
+ let _67: ();
let mut _68: u64;
let mut _69: u64;
let mut _70: u64;
@@ -77,25 +77,25 @@
let mut _72: u64;
let mut _73: u64;
let mut _74: u64;
- let mut _75: u64;
- let mut _76: u64;
- let _77: ();
+ let mut _75: bool;
+ let _76: ();
+ let mut _77: u64;
let mut _78: u64;
let mut _79: u64;
- let mut _80: u64;
- let mut _81: u64;
- let mut _82: bool;
+ let mut _80: bool;
+ let _81: ();
+ let mut _82: u64;
let mut _83: u64;
- let _84: ();
- let mut _85: u64;
+ let mut _84: u64;
+ let _85: ();
let mut _86: u64;
let mut _87: u64;
let mut _88: u64;
- let mut _89: bool;
+ let _89: ();
let mut _90: u64;
- let _91: ();
+ let mut _91: u64;
let mut _92: u64;
- let mut _93: u64;
+ let _93: ();
let mut _94: u64;
let mut _95: u64;
let mut _96: u64;
@@ -103,93 +103,91 @@
let mut _98: u64;
let mut _99: u64;
let mut _100: u64;
- let mut _101: u64;
- let mut _102: u64;
- let _103: ();
- let mut _104: u64;
- let mut _105: u64;
+ let _101: ();
+ let mut _102: u32;
+ let mut _103: u64;
+ let _104: ();
+ let mut _105: f32;
let mut _106: u64;
- let mut _107: u64;
- let mut _108: u64;
- let _109: ();
- let mut _110: u64;
+ let _107: ();
+ let mut _108: S<u64>;
+ let mut _109: u64;
+ let _110: ();
let mut _111: u64;
- let mut _112: u64;
+ let mut _112: S<u64>;
let mut _113: u64;
- let mut _114: u64;
- let _115: ();
+ let _114: ();
+ let mut _115: u64;
let mut _116: u64;
let mut _117: u64;
let mut _118: u64;
let mut _119: u64;
- let mut _120: u64;
- let _121: ();
- let mut _122: S<u64>;
+ let _120: ();
+ let mut _121: u64;
+ let mut _122: u64;
let mut _123: u64;
- let _124: ();
+ let mut _124: u64;
let mut _125: u64;
- let mut _126: S<u64>;
- let mut _127: u64;
- let _128: &u64;
- let _129: ();
+ let _126: &u64;
+ let _127: ();
+ let mut _128: u64;
+ let mut _129: u64;
let mut _130: u64;
- let mut _131: u64;
+ let _131: ();
let mut _132: u64;
- let _133: ();
+ let mut _133: u64;
let mut _134: u64;
- let mut _135: u64;
- let mut _136: u64;
- let _138: ();
+ let _136: ();
+ let mut _137: u64;
+ let mut _138: u64;
let mut _139: u64;
- let mut _140: u64;
+ let _140: ();
let mut _141: u64;
- let _142: ();
+ let mut _142: u64;
let mut _143: u64;
- let mut _144: u64;
- let mut _145: u64;
+ let _144: ();
let _146: ();
- let _148: ();
+ let mut _147: u64;
+ let mut _148: u64;
let mut _149: u64;
- let mut _150: u64;
+ let _150: ();
let mut _151: u64;
- let _152: ();
+ let mut _152: u64;
let mut _153: u64;
- let mut _154: u64;
- let mut _155: u64;
- let _157: ();
+ let _155: ();
+ let mut _156: u64;
+ let mut _157: u64;
let mut _158: u64;
- let mut _159: u64;
+ let _159: ();
let mut _160: u64;
- let _161: ();
+ let mut _161: u64;
let mut _162: u64;
- let mut _163: u64;
- let mut _164: u64;
- let _166: ();
+ let _164: ();
+ let mut _165: u64;
+ let mut _166: u64;
let mut _167: u64;
- let mut _168: u64;
+ let _168: ();
let mut _169: u64;
- let _170: ();
+ let mut _170: u64;
let mut _171: u64;
- let mut _172: u64;
- let mut _173: u64;
scope 1 {
- debug a => _128;
- let _137: &mut u64;
+ debug a => _126;
+ let _135: &mut u64;
scope 2 {
- debug b => _137;
- let _165: &u64;
+ debug b => _135;
+ let _163: &u64;
scope 3 {
- let _147: *const u64;
+ let _145: *const u64;
scope 4 {
- debug c => _147;
- let _156: *mut u64;
+ debug c => _145;
+ let _154: *mut u64;
scope 5 {
- debug d => _156;
+ debug d => _154;
}
}
}
scope 6 {
- debug e => _165;
+ debug e => _163;
}
}
}
@@ -197,61 +195,68 @@
bb0: {
StorageLive(_4);
- StorageLive(_5);
-- StorageLive(_6);
-- _6 = _1;
-- StorageLive(_7);
-- _7 = _2;
++ nop;
+ StorageLive(_6);
+ _6 = _1;
+ StorageLive(_7);
+ _7 = _2;
- _5 = Add(move _6, move _7);
-- StorageDead(_7);
-- StorageDead(_6);
-- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind unreachable];
+ _5 = Add(_1, _2);
+ StorageDead(_7);
+ StorageDead(_6);
+- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind unreachable];
+ _4 = opaque::<u64>(_5) -> [return: bb1, unwind unreachable];
}
bb1: {
- StorageDead(_5);
++ nop;
StorageDead(_4);
StorageLive(_8);
- StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
-- StorageLive(_11);
-- _11 = _2;
++ nop;
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
- _9 = Mul(move _10, move _11);
-- StorageDead(_11);
-- StorageDead(_10);
-- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind unreachable];
+ _9 = Mul(_1, _2);
+ StorageDead(_11);
+ StorageDead(_10);
+- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind unreachable];
+ _8 = opaque::<u64>(_9) -> [return: bb2, unwind unreachable];
}
bb2: {
- StorageDead(_9);
++ nop;
StorageDead(_8);
StorageLive(_12);
- StorageLive(_13);
-- StorageLive(_14);
-- _14 = _1;
-- StorageLive(_15);
-- _15 = _2;
++ nop;
+ StorageLive(_14);
+ _14 = _1;
+ StorageLive(_15);
+ _15 = _2;
- _13 = Sub(move _14, move _15);
-- StorageDead(_15);
-- StorageDead(_14);
-- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind unreachable];
+ _13 = Sub(_1, _2);
+ StorageDead(_15);
+ StorageDead(_14);
+- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind unreachable];
+ _12 = opaque::<u64>(_13) -> [return: bb3, unwind unreachable];
}
bb3: {
- StorageDead(_13);
++ nop;
StorageDead(_12);
StorageLive(_16);
- StorageLive(_17);
-- StorageLive(_18);
-- _18 = _1;
-- StorageLive(_19);
-- _19 = _2;
++ nop;
+ StorageLive(_18);
+ _18 = _1;
+ StorageLive(_19);
+ _19 = _2;
- _20 = Eq(_19, const 0_u64);
- assert(!move _20, "attempt to divide `{}` by zero", _18) -> [success: bb4, unwind unreachable];
+ _20 = Eq(_2, const 0_u64);
@@ -260,623 +265,701 @@
bb4: {
- _17 = Div(move _18, move _19);
-- StorageDead(_19);
-- StorageDead(_18);
-- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind unreachable];
+ _17 = Div(_1, _2);
+ StorageDead(_19);
+ StorageDead(_18);
+- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind unreachable];
+ _16 = opaque::<u64>(_17) -> [return: bb5, unwind unreachable];
}
bb5: {
- StorageDead(_17);
++ nop;
StorageDead(_16);
StorageLive(_21);
- StorageLive(_22);
-- StorageLive(_23);
-- _23 = _1;
-- StorageLive(_24);
-- _24 = _2;
++ nop;
+ StorageLive(_23);
+ _23 = _1;
+ StorageLive(_24);
+ _24 = _2;
- _25 = Eq(_24, const 0_u64);
- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", _23) -> [success: bb6, unwind unreachable];
++ _25 = _20;
+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb6, unwind unreachable];
}
bb6: {
- _22 = Rem(move _23, move _24);
-- StorageDead(_24);
-- StorageDead(_23);
-- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind unreachable];
+ _22 = Rem(_1, _2);
+ StorageDead(_24);
+ StorageDead(_23);
+- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind unreachable];
+ _21 = opaque::<u64>(_22) -> [return: bb7, unwind unreachable];
}
bb7: {
- StorageDead(_22);
++ nop;
StorageDead(_21);
StorageLive(_26);
- StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
-- StorageLive(_29);
-- _29 = _2;
++ nop;
+ StorageLive(_28);
+ _28 = _1;
+ StorageLive(_29);
+ _29 = _2;
- _27 = BitAnd(move _28, move _29);
-- StorageDead(_29);
-- StorageDead(_28);
-- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind unreachable];
+ _27 = BitAnd(_1, _2);
+ StorageDead(_29);
+ StorageDead(_28);
+- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind unreachable];
+ _26 = opaque::<u64>(_27) -> [return: bb8, unwind unreachable];
}
bb8: {
- StorageDead(_27);
++ nop;
StorageDead(_26);
StorageLive(_30);
- StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
-- StorageLive(_33);
-- _33 = _2;
++ nop;
+ StorageLive(_32);
+ _32 = _1;
+ StorageLive(_33);
+ _33 = _2;
- _31 = BitOr(move _32, move _33);
-- StorageDead(_33);
-- StorageDead(_32);
-- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind unreachable];
+ _31 = BitOr(_1, _2);
+ StorageDead(_33);
+ StorageDead(_32);
+- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind unreachable];
+ _30 = opaque::<u64>(_31) -> [return: bb9, unwind unreachable];
}
bb9: {
- StorageDead(_31);
++ nop;
StorageDead(_30);
StorageLive(_34);
- StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
-- StorageLive(_37);
-- _37 = _2;
++ nop;
+ StorageLive(_36);
+ _36 = _1;
+ StorageLive(_37);
+ _37 = _2;
- _35 = BitXor(move _36, move _37);
-- StorageDead(_37);
-- StorageDead(_36);
-- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind unreachable];
+ _35 = BitXor(_1, _2);
+ StorageDead(_37);
+ StorageDead(_36);
+- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind unreachable];
+ _34 = opaque::<u64>(_35) -> [return: bb10, unwind unreachable];
}
bb10: {
- StorageDead(_35);
++ nop;
StorageDead(_34);
StorageLive(_38);
- StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
-- StorageLive(_41);
-- _41 = _2;
++ nop;
+ StorageLive(_40);
+ _40 = _1;
+ StorageLive(_41);
+ _41 = _2;
- _39 = Shl(move _40, move _41);
-- StorageDead(_41);
-- StorageDead(_40);
-- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind unreachable];
+ _39 = Shl(_1, _2);
+ StorageDead(_41);
+ StorageDead(_40);
+- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind unreachable];
+ _38 = opaque::<u64>(_39) -> [return: bb11, unwind unreachable];
}
bb11: {
- StorageDead(_39);
++ nop;
StorageDead(_38);
StorageLive(_42);
- StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
-- StorageLive(_45);
-- _45 = _2;
++ nop;
+ StorageLive(_44);
+ _44 = _1;
+ StorageLive(_45);
+ _45 = _2;
- _43 = Shr(move _44, move _45);
-- StorageDead(_45);
-- StorageDead(_44);
-- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind unreachable];
+ _43 = Shr(_1, _2);
+ StorageDead(_45);
+ StorageDead(_44);
+- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind unreachable];
+ _42 = opaque::<u64>(_43) -> [return: bb12, unwind unreachable];
}
bb12: {
- StorageDead(_43);
++ nop;
StorageDead(_42);
StorageLive(_46);
- StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
+- StorageLive(_47);
++ nop;
+ StorageLive(_48);
+ _48 = _1;
- _47 = move _48 as u32 (IntToInt);
-- StorageDead(_48);
+ _47 = _1 as u32 (IntToInt);
- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind unreachable];
+ StorageDead(_48);
+- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind unreachable];
++ _46 = opaque::<u32>(_47) -> [return: bb13, unwind unreachable];
}
bb13: {
- StorageDead(_47);
+- StorageDead(_47);
++ nop;
StorageDead(_46);
StorageLive(_49);
- StorageLive(_50);
-- StorageLive(_51);
-- _51 = _1;
+- StorageLive(_50);
++ nop;
+ StorageLive(_51);
+ _51 = _1;
- _50 = move _51 as f32 (IntToFloat);
-- StorageDead(_51);
+ _50 = _1 as f32 (IntToFloat);
- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind unreachable];
+ StorageDead(_51);
+- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind unreachable];
++ _49 = opaque::<f32>(_50) -> [return: bb14, unwind unreachable];
}
bb14: {
- StorageDead(_50);
+- StorageDead(_50);
++ nop;
StorageDead(_49);
StorageLive(_52);
- StorageLive(_53);
-- StorageLive(_54);
-- _54 = _1;
++ nop;
+ StorageLive(_54);
+ _54 = _1;
- _53 = S::<u64>(move _54);
-- StorageDead(_54);
-- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind unreachable];
+ _53 = S::<u64>(_1);
+ StorageDead(_54);
+- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind unreachable];
+ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind unreachable];
}
bb15: {
- StorageDead(_53);
++ nop;
StorageDead(_52);
StorageLive(_55);
-- StorageLive(_56);
-- StorageLive(_57);
-- StorageLive(_58);
-- _58 = _1;
+ StorageLive(_56);
+ StorageLive(_57);
+ StorageLive(_58);
+ _58 = _1;
- _57 = S::<u64>(move _58);
-- StorageDead(_58);
++ _57 = _53;
+ StorageDead(_58);
- _56 = (_57.0: u64);
- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind unreachable];
-+ _56 = (_53.0: u64);
-+ _55 = opaque::<u64>(_56) -> [return: bb16, unwind unreachable];
++ _56 = _1;
++ _55 = opaque::<u64>(_1) -> [return: bb16, unwind unreachable];
}
bb16: {
-- StorageDead(_56);
-- StorageDead(_57);
+ StorageDead(_56);
+ StorageDead(_57);
StorageDead(_55);
StorageLive(_59);
StorageLive(_60);
-- StorageLive(_61);
-- StorageLive(_62);
-- _62 = _1;
-- StorageLive(_63);
-- _63 = _2;
-- _61 = Add(move _62, move _63);
-- StorageDead(_63);
-- StorageDead(_62);
- StorageLive(_64);
- _64 = _3;
-- _60 = Add(move _61, move _64);
-+ _60 = Add(_5, move _64);
- StorageDead(_64);
-- StorageDead(_61);
- _59 = opaque::<u64>(move _60) -> [return: bb17, unwind unreachable];
+ StorageLive(_61);
+ _61 = _1;
+ StorageLive(_62);
+ _62 = _2;
+- _60 = Add(move _61, move _62);
++ _60 = _5;
+ StorageDead(_62);
+ StorageDead(_61);
+- _59 = opaque::<u64>(move _60) -> [return: bb17, unwind unreachable];
++ _59 = opaque::<u64>(_5) -> [return: bb17, unwind unreachable];
}
bb17: {
StorageDead(_60);
StorageDead(_59);
+ StorageLive(_63);
+ StorageLive(_64);
StorageLive(_65);
+ _65 = _1;
StorageLive(_66);
-- StorageLive(_67);
-- StorageLive(_68);
-- _68 = _1;
-- StorageLive(_69);
-- _69 = _2;
-- _67 = Mul(move _68, move _69);
-- StorageDead(_69);
-- StorageDead(_68);
+ _66 = _2;
+- _64 = Mul(move _65, move _66);
++ _64 = _9;
+ StorageDead(_66);
+ StorageDead(_65);
+- _63 = opaque::<u64>(move _64) -> [return: bb18, unwind unreachable];
++ _63 = opaque::<u64>(_9) -> [return: bb18, unwind unreachable];
+ }
+
+ bb18: {
+ StorageDead(_64);
+ StorageDead(_63);
+ StorageLive(_67);
+ StorageLive(_68);
+ StorageLive(_69);
+ _69 = _1;
StorageLive(_70);
- _70 = _3;
-- _66 = Add(move _67, move _70);
-+ _66 = Add(_9, move _70);
+ _70 = _2;
+- _68 = Sub(move _69, move _70);
++ _68 = _13;
StorageDead(_70);
-- StorageDead(_67);
- _65 = opaque::<u64>(move _66) -> [return: bb18, unwind unreachable];
+ StorageDead(_69);
+- _67 = opaque::<u64>(move _68) -> [return: bb19, unwind unreachable];
++ _67 = opaque::<u64>(_13) -> [return: bb19, unwind unreachable];
}
- bb18: {
- StorageDead(_66);
- StorageDead(_65);
+ bb19: {
+ StorageDead(_68);
+ StorageDead(_67);
StorageLive(_71);
StorageLive(_72);
-- StorageLive(_73);
-- StorageLive(_74);
-- _74 = _1;
-- StorageLive(_75);
-- _75 = _2;
-- _73 = Sub(move _74, move _75);
-- StorageDead(_75);
-- StorageDead(_74);
- StorageLive(_76);
- _76 = _3;
-- _72 = Add(move _73, move _76);
-+ _72 = Add(_13, move _76);
- StorageDead(_76);
-- StorageDead(_73);
- _71 = opaque::<u64>(move _72) -> [return: bb19, unwind unreachable];
+ StorageLive(_73);
+ _73 = _1;
+ StorageLive(_74);
+ _74 = _2;
+- _75 = Eq(_74, const 0_u64);
+- assert(!move _75, "attempt to divide `{}` by zero", _73) -> [success: bb20, unwind unreachable];
++ _75 = _20;
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind unreachable];
}
- bb19: {
+ bb20: {
+- _72 = Div(move _73, move _74);
++ _72 = _17;
+ StorageDead(_74);
+ StorageDead(_73);
+- _71 = opaque::<u64>(move _72) -> [return: bb21, unwind unreachable];
++ _71 = opaque::<u64>(_17) -> [return: bb21, unwind unreachable];
+ }
+
+ bb21: {
StorageDead(_72);
StorageDead(_71);
+ StorageLive(_76);
StorageLive(_77);
StorageLive(_78);
-- StorageLive(_79);
-- StorageLive(_80);
-- _80 = _1;
-- StorageLive(_81);
-- _81 = _2;
-- _82 = Eq(_81, const 0_u64);
-- assert(!move _82, "attempt to divide `{}` by zero", _80) -> [success: bb20, unwind unreachable];
-+ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind unreachable];
+ _78 = _1;
+ StorageLive(_79);
+ _79 = _2;
+- _80 = Eq(_79, const 0_u64);
+- assert(!move _80, "attempt to calculate the remainder of `{}` with a divisor of zero", _78) -> [success: bb22, unwind unreachable];
++ _80 = _20;
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind unreachable];
}
- bb20: {
-- _79 = Div(move _80, move _81);
-- StorageDead(_81);
-- StorageDead(_80);
- StorageLive(_83);
- _83 = _3;
-- _78 = Add(move _79, move _83);
-+ _78 = Add(_17, move _83);
- StorageDead(_83);
-- StorageDead(_79);
- _77 = opaque::<u64>(move _78) -> [return: bb21, unwind unreachable];
+ bb22: {
+- _77 = Rem(move _78, move _79);
++ _77 = _22;
+ StorageDead(_79);
+ StorageDead(_78);
+- _76 = opaque::<u64>(move _77) -> [return: bb23, unwind unreachable];
++ _76 = opaque::<u64>(_22) -> [return: bb23, unwind unreachable];
}
- bb21: {
- StorageDead(_78);
+ bb23: {
StorageDead(_77);
+ StorageDead(_76);
+ StorageLive(_81);
+ StorageLive(_82);
+ StorageLive(_83);
+ _83 = _1;
StorageLive(_84);
- StorageLive(_85);
-- StorageLive(_86);
-- StorageLive(_87);
-- _87 = _1;
-- StorageLive(_88);
-- _88 = _2;
-- _89 = Eq(_88, const 0_u64);
-- assert(!move _89, "attempt to calculate the remainder of `{}` with a divisor of zero", _87) -> [success: bb22, unwind unreachable];
-+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind unreachable];
+ _84 = _2;
+- _82 = BitAnd(move _83, move _84);
++ _82 = _27;
+ StorageDead(_84);
+ StorageDead(_83);
+- _81 = opaque::<u64>(move _82) -> [return: bb24, unwind unreachable];
++ _81 = opaque::<u64>(_27) -> [return: bb24, unwind unreachable];
}
- bb22: {
-- _86 = Rem(move _87, move _88);
-- StorageDead(_88);
-- StorageDead(_87);
- StorageLive(_90);
- _90 = _3;
-- _85 = Add(move _86, move _90);
-+ _85 = Add(_22, move _90);
- StorageDead(_90);
-- StorageDead(_86);
- _84 = opaque::<u64>(move _85) -> [return: bb23, unwind unreachable];
+ bb24: {
+ StorageDead(_82);
+ StorageDead(_81);
+ StorageLive(_85);
+ StorageLive(_86);
+ StorageLive(_87);
+ _87 = _1;
+ StorageLive(_88);
+ _88 = _2;
+- _86 = BitOr(move _87, move _88);
++ _86 = _31;
+ StorageDead(_88);
+ StorageDead(_87);
+- _85 = opaque::<u64>(move _86) -> [return: bb25, unwind unreachable];
++ _85 = opaque::<u64>(_31) -> [return: bb25, unwind unreachable];
}
- bb23: {
+ bb25: {
+ StorageDead(_86);
StorageDead(_85);
- StorageDead(_84);
+ StorageLive(_89);
+ StorageLive(_90);
StorageLive(_91);
+ _91 = _1;
StorageLive(_92);
-- StorageLive(_93);
-- StorageLive(_94);
-- _94 = _1;
-- StorageLive(_95);
-- _95 = _2;
-- _93 = BitAnd(move _94, move _95);
-- StorageDead(_95);
-- StorageDead(_94);
+ _92 = _2;
+- _90 = BitXor(move _91, move _92);
++ _90 = _35;
+ StorageDead(_92);
+ StorageDead(_91);
+- _89 = opaque::<u64>(move _90) -> [return: bb26, unwind unreachable];
++ _89 = opaque::<u64>(_35) -> [return: bb26, unwind unreachable];
+ }
+
+ bb26: {
+ StorageDead(_90);
+ StorageDead(_89);
+ StorageLive(_93);
+ StorageLive(_94);
+ StorageLive(_95);
+ _95 = _1;
StorageLive(_96);
- _96 = _3;
-- _92 = Add(move _93, move _96);
-+ _92 = Add(_27, move _96);
+ _96 = _2;
+- _94 = Shl(move _95, move _96);
++ _94 = _39;
StorageDead(_96);
-- StorageDead(_93);
- _91 = opaque::<u64>(move _92) -> [return: bb24, unwind unreachable];
+ StorageDead(_95);
+- _93 = opaque::<u64>(move _94) -> [return: bb27, unwind unreachable];
++ _93 = opaque::<u64>(_39) -> [return: bb27, unwind unreachable];
}
- bb24: {
- StorageDead(_92);
- StorageDead(_91);
+ bb27: {
+ StorageDead(_94);
+ StorageDead(_93);
StorageLive(_97);
StorageLive(_98);
-- StorageLive(_99);
-- StorageLive(_100);
-- _100 = _1;
-- StorageLive(_101);
-- _101 = _2;
-- _99 = BitOr(move _100, move _101);
-- StorageDead(_101);
-- StorageDead(_100);
- StorageLive(_102);
- _102 = _3;
-- _98 = Add(move _99, move _102);
-+ _98 = Add(_31, move _102);
- StorageDead(_102);
-- StorageDead(_99);
- _97 = opaque::<u64>(move _98) -> [return: bb25, unwind unreachable];
+ StorageLive(_99);
+ _99 = _1;
+ StorageLive(_100);
+ _100 = _2;
+- _98 = Shr(move _99, move _100);
++ _98 = _43;
+ StorageDead(_100);
+ StorageDead(_99);
+- _97 = opaque::<u64>(move _98) -> [return: bb28, unwind unreachable];
++ _97 = opaque::<u64>(_43) -> [return: bb28, unwind unreachable];
}
- bb25: {
+ bb28: {
StorageDead(_98);
StorageDead(_97);
+ StorageLive(_101);
+ StorageLive(_102);
StorageLive(_103);
+ _103 = _1;
+- _102 = move _103 as u32 (IntToInt);
++ _102 = _47;
+ StorageDead(_103);
+- _101 = opaque::<u32>(move _102) -> [return: bb29, unwind unreachable];
++ _101 = opaque::<u32>(_47) -> [return: bb29, unwind unreachable];
+ }
+
+ bb29: {
+ StorageDead(_102);
+ StorageDead(_101);
StorageLive(_104);
-- StorageLive(_105);
-- StorageLive(_106);
-- _106 = _1;
-- StorageLive(_107);
-- _107 = _2;
-- _105 = BitXor(move _106, move _107);
-- StorageDead(_107);
-- StorageDead(_106);
- StorageLive(_108);
- _108 = _3;
-- _104 = Add(move _105, move _108);
-+ _104 = Add(_35, move _108);
- StorageDead(_108);
-- StorageDead(_105);
- _103 = opaque::<u64>(move _104) -> [return: bb26, unwind unreachable];
+ StorageLive(_105);
+ StorageLive(_106);
+ _106 = _1;
+- _105 = move _106 as f32 (IntToFloat);
++ _105 = _50;
+ StorageDead(_106);
+- _104 = opaque::<f32>(move _105) -> [return: bb30, unwind unreachable];
++ _104 = opaque::<f32>(_50) -> [return: bb30, unwind unreachable];
}
- bb26: {
+ bb30: {
+ StorageDead(_105);
StorageDead(_104);
- StorageDead(_103);
+ StorageLive(_107);
+ StorageLive(_108);
StorageLive(_109);
+ _109 = _1;
+- _108 = S::<u64>(move _109);
++ _108 = _53;
+ StorageDead(_109);
+- _107 = opaque::<S<u64>>(move _108) -> [return: bb31, unwind unreachable];
++ _107 = opaque::<S<u64>>(_53) -> [return: bb31, unwind unreachable];
+ }
+
+ bb31: {
+ StorageDead(_108);
+ StorageDead(_107);
StorageLive(_110);
-- StorageLive(_111);
-- StorageLive(_112);
-- _112 = _1;
-- StorageLive(_113);
-- _113 = _2;
-- _111 = Shl(move _112, move _113);
-- StorageDead(_113);
-- StorageDead(_112);
- StorageLive(_114);
- _114 = _3;
-- _110 = Add(move _111, move _114);
-+ _110 = Add(_39, move _114);
- StorageDead(_114);
-- StorageDead(_111);
- _109 = opaque::<u64>(move _110) -> [return: bb27, unwind unreachable];
+ StorageLive(_111);
+ StorageLive(_112);
+ StorageLive(_113);
+ _113 = _1;
+- _112 = S::<u64>(move _113);
++ _112 = _53;
+ StorageDead(_113);
+- _111 = (_112.0: u64);
+- _110 = opaque::<u64>(move _111) -> [return: bb32, unwind unreachable];
++ _111 = _1;
++ _110 = opaque::<u64>(_1) -> [return: bb32, unwind unreachable];
}
- bb27: {
+ bb32: {
+ StorageDead(_111);
+ StorageDead(_112);
StorageDead(_110);
- StorageDead(_109);
- StorageLive(_115);
+ StorageLive(_114);
+- StorageLive(_115);
++ nop;
StorageLive(_116);
-- StorageLive(_117);
-- StorageLive(_118);
-- _118 = _1;
-- StorageLive(_119);
-- _119 = _2;
-- _117 = Shr(move _118, move _119);
-- StorageDead(_119);
-- StorageDead(_118);
- StorageLive(_120);
- _120 = _3;
-- _116 = Add(move _117, move _120);
-+ _116 = Add(_43, move _120);
- StorageDead(_120);
-- StorageDead(_117);
- _115 = opaque::<u64>(move _116) -> [return: bb28, unwind unreachable];
+ StorageLive(_117);
+ _117 = _1;
+ StorageLive(_118);
+ _118 = _2;
+- _116 = Mul(move _117, move _118);
++ _116 = _9;
+ StorageDead(_118);
+ StorageDead(_117);
+ StorageLive(_119);
+ _119 = _2;
+- _115 = Sub(move _116, move _119);
++ _115 = Sub(_9, _2);
+ StorageDead(_119);
+ StorageDead(_116);
+- _114 = opaque::<u64>(move _115) -> [return: bb33, unwind unreachable];
++ _114 = opaque::<u64>(_115) -> [return: bb33, unwind unreachable];
}
- bb28: {
- StorageDead(_116);
- StorageDead(_115);
+ bb33: {
+- StorageDead(_115);
++ nop;
+ StorageDead(_114);
+ StorageLive(_120);
StorageLive(_121);
-- StorageLive(_122);
-- StorageLive(_123);
-- _123 = _1;
-- _122 = S::<u64>(move _123);
-- StorageDead(_123);
-- _121 = opaque::<S<u64>>(move _122) -> [return: bb29, unwind unreachable];
-+ _121 = opaque::<S<u64>>(_53) -> [return: bb29, unwind unreachable];
+ StorageLive(_122);
+ StorageLive(_123);
+ _123 = _1;
+ StorageLive(_124);
+ _124 = _2;
+- _122 = Mul(move _123, move _124);
++ _122 = _9;
+ StorageDead(_124);
+ StorageDead(_123);
+ StorageLive(_125);
+ _125 = _2;
+- _121 = Sub(move _122, move _125);
++ _121 = _115;
+ StorageDead(_125);
+ StorageDead(_122);
+- _120 = opaque::<u64>(move _121) -> [return: bb34, unwind unreachable];
++ _120 = opaque::<u64>(_115) -> [return: bb34, unwind unreachable];
}
- bb29: {
-- StorageDead(_122);
+ bb34: {
StorageDead(_121);
- StorageLive(_124);
-- StorageLive(_125);
+ StorageDead(_120);
- StorageLive(_126);
-- StorageLive(_127);
-- _127 = _1;
-- _126 = S::<u64>(move _127);
-- StorageDead(_127);
-- _125 = (_126.0: u64);
-- _124 = opaque::<u64>(move _125) -> [return: bb30, unwind unreachable];
-+ _124 = opaque::<u64>(_56) -> [return: bb30, unwind unreachable];
- }
-
- bb30: {
-- StorageDead(_125);
-- StorageDead(_126);
- StorageDead(_124);
- StorageLive(_128);
- _128 = &_3;
- StorageLive(_129);
-- StorageLive(_130);
-- StorageLive(_131);
- _131 = (*_128);
-- StorageLive(_132);
-- _132 = _1;
-- _130 = Add(move _131, move _132);
-- StorageDead(_132);
-- StorageDead(_131);
-- _129 = opaque::<u64>(move _130) -> [return: bb31, unwind unreachable];
-+ _130 = Add(_131, _1);
-+ _129 = opaque::<u64>(_130) -> [return: bb31, unwind unreachable];
++ nop;
+ _126 = &_3;
+ StorageLive(_127);
+- StorageLive(_128);
+- StorageLive(_129);
++ nop;
++ nop;
+ _129 = (*_126);
+ StorageLive(_130);
+ _130 = _1;
+- _128 = Add(move _129, move _130);
++ _128 = Add(_129, _1);
+ StorageDead(_130);
+- StorageDead(_129);
+- _127 = opaque::<u64>(move _128) -> [return: bb35, unwind unreachable];
++ nop;
++ _127 = opaque::<u64>(_128) -> [return: bb35, unwind unreachable];
}
- bb31: {
-- StorageDead(_130);
- StorageDead(_129);
+ bb35: {
+- StorageDead(_128);
++ nop;
+ StorageDead(_127);
+ StorageLive(_131);
+ StorageLive(_132);
StorageLive(_133);
-- StorageLive(_134);
-- StorageLive(_135);
-- _135 = (*_128);
-- StorageLive(_136);
-- _136 = _1;
-- _134 = Add(move _135, move _136);
-- StorageDead(_136);
-- StorageDead(_135);
-- _133 = opaque::<u64>(move _134) -> [return: bb32, unwind unreachable];
-+ _133 = opaque::<u64>(_130) -> [return: bb32, unwind unreachable];
+- _133 = (*_126);
++ _133 = _129;
+ StorageLive(_134);
+ _134 = _1;
+- _132 = Add(move _133, move _134);
++ _132 = _128;
+ StorageDead(_134);
+ StorageDead(_133);
+- _131 = opaque::<u64>(move _132) -> [return: bb36, unwind unreachable];
++ _131 = opaque::<u64>(_128) -> [return: bb36, unwind unreachable];
}
- bb32: {
-- StorageDead(_134);
- StorageDead(_133);
+ bb36: {
+ StorageDead(_132);
+ StorageDead(_131);
+- StorageLive(_135);
++ nop;
+ _135 = &mut _3;
+ StorageLive(_136);
StorageLive(_137);
- _137 = &mut _3;
StorageLive(_138);
+ _138 = (*_135);
StorageLive(_139);
- StorageLive(_140);
- _140 = (*_137);
-- StorageLive(_141);
-- _141 = _1;
-- _139 = Add(move _140, move _141);
-- StorageDead(_141);
-+ _139 = Add(move _140, _1);
- StorageDead(_140);
- _138 = opaque::<u64>(move _139) -> [return: bb33, unwind unreachable];
- }
-
- bb33: {
+ _139 = _1;
+- _137 = Add(move _138, move _139);
++ _137 = Add(move _138, _1);
StorageDead(_139);
StorageDead(_138);
- StorageLive(_142);
- StorageLive(_143);
- StorageLive(_144);
- _144 = (*_137);
-- StorageLive(_145);
-- _145 = _1;
-- _143 = Add(move _144, move _145);
-- StorageDead(_145);
-+ _143 = Add(move _144, _1);
- StorageDead(_144);
- _142 = opaque::<u64>(move _143) -> [return: bb34, unwind unreachable];
+ _136 = opaque::<u64>(move _137) -> [return: bb37, unwind unreachable];
}
- bb34: {
+ bb37: {
+ StorageDead(_137);
+ StorageDead(_136);
+ StorageLive(_140);
+ StorageLive(_141);
+ StorageLive(_142);
+ _142 = (*_135);
+ StorageLive(_143);
+ _143 = _1;
+- _141 = Add(move _142, move _143);
++ _141 = Add(move _142, _1);
StorageDead(_143);
StorageDead(_142);
-- StorageLive(_146);
+ _140 = opaque::<u64>(move _141) -> [return: bb38, unwind unreachable];
+ }
+
+ bb38: {
+ StorageDead(_141);
+ StorageDead(_140);
+ StorageLive(_144);
+- StorageLive(_145);
++ nop;
+ _145 = &raw const _3;
+ StorageLive(_146);
StorageLive(_147);
- _147 = &raw const _3;
StorageLive(_148);
+ _148 = (*_145);
StorageLive(_149);
- StorageLive(_150);
- _150 = (*_147);
-- StorageLive(_151);
-- _151 = _1;
-- _149 = Add(move _150, move _151);
-- StorageDead(_151);
-+ _149 = Add(move _150, _1);
- StorageDead(_150);
- _148 = opaque::<u64>(move _149) -> [return: bb35, unwind unreachable];
- }
-
- bb35: {
+ _149 = _1;
+- _147 = Add(move _148, move _149);
++ _147 = Add(move _148, _1);
StorageDead(_149);
StorageDead(_148);
- StorageLive(_152);
- StorageLive(_153);
- StorageLive(_154);
- _154 = (*_147);
-- StorageLive(_155);
-- _155 = _1;
-- _153 = Add(move _154, move _155);
-- StorageDead(_155);
-+ _153 = Add(move _154, _1);
- StorageDead(_154);
- _152 = opaque::<u64>(move _153) -> [return: bb36, unwind unreachable];
+ _146 = opaque::<u64>(move _147) -> [return: bb39, unwind unreachable];
}
- bb36: {
+ bb39: {
+ StorageDead(_147);
+ StorageDead(_146);
+ StorageLive(_150);
+ StorageLive(_151);
+ StorageLive(_152);
+ _152 = (*_145);
+ StorageLive(_153);
+ _153 = _1;
+- _151 = Add(move _152, move _153);
++ _151 = Add(move _152, _1);
StorageDead(_153);
StorageDead(_152);
+ _150 = opaque::<u64>(move _151) -> [return: bb40, unwind unreachable];
+ }
+
+ bb40: {
+ StorageDead(_151);
+ StorageDead(_150);
+- StorageLive(_154);
++ nop;
+ _154 = &raw mut _3;
+ StorageLive(_155);
StorageLive(_156);
- _156 = &raw mut _3;
StorageLive(_157);
+ _157 = (*_154);
StorageLive(_158);
- StorageLive(_159);
- _159 = (*_156);
-- StorageLive(_160);
-- _160 = _1;
-- _158 = Add(move _159, move _160);
-- StorageDead(_160);
-+ _158 = Add(move _159, _1);
- StorageDead(_159);
- _157 = opaque::<u64>(move _158) -> [return: bb37, unwind unreachable];
- }
-
- bb37: {
+ _158 = _1;
+- _156 = Add(move _157, move _158);
++ _156 = Add(move _157, _1);
StorageDead(_158);
StorageDead(_157);
- StorageLive(_161);
- StorageLive(_162);
- StorageLive(_163);
- _163 = (*_156);
-- StorageLive(_164);
-- _164 = _1;
-- _162 = Add(move _163, move _164);
-- StorageDead(_164);
-+ _162 = Add(move _163, _1);
- StorageDead(_163);
- _161 = opaque::<u64>(move _162) -> [return: bb38, unwind unreachable];
+ _155 = opaque::<u64>(move _156) -> [return: bb41, unwind unreachable];
}
- bb38: {
+ bb41: {
+ StorageDead(_156);
+ StorageDead(_155);
+ StorageLive(_159);
+ StorageLive(_160);
+ StorageLive(_161);
+ _161 = (*_154);
+ StorageLive(_162);
+ _162 = _1;
+- _160 = Add(move _161, move _162);
++ _160 = Add(move _161, _1);
StorageDead(_162);
StorageDead(_161);
-- _146 = const ();
- StorageDead(_156);
- StorageDead(_147);
-- StorageDead(_146);
- StorageLive(_165);
- _165 = &_3;
- StorageLive(_166);
-- StorageLive(_167);
-- StorageLive(_168);
- _168 = (*_165);
-- StorageLive(_169);
-- _169 = _1;
-- _167 = Add(move _168, move _169);
-- StorageDead(_169);
-- StorageDead(_168);
-- _166 = opaque::<u64>(move _167) -> [return: bb39, unwind unreachable];
-+ _167 = Add(_168, _1);
-+ _166 = opaque::<u64>(_167) -> [return: bb39, unwind unreachable];
+ _159 = opaque::<u64>(move _160) -> [return: bb42, unwind unreachable];
}
- bb39: {
-- StorageDead(_167);
- StorageDead(_166);
+ bb42: {
+ StorageDead(_160);
+ StorageDead(_159);
+ _144 = const ();
+- StorageDead(_154);
+- StorageDead(_145);
++ nop;
++ nop;
+ StorageDead(_144);
+- StorageLive(_163);
++ nop;
+ _163 = &_3;
+ StorageLive(_164);
+- StorageLive(_165);
+- StorageLive(_166);
++ nop;
++ nop;
+ _166 = (*_163);
+ StorageLive(_167);
+ _167 = _1;
+- _165 = Add(move _166, move _167);
++ _165 = Add(_166, _1);
+ StorageDead(_167);
+- StorageDead(_166);
+- _164 = opaque::<u64>(move _165) -> [return: bb43, unwind unreachable];
++ nop;
++ _164 = opaque::<u64>(_165) -> [return: bb43, unwind unreachable];
+ }
+
+ bb43: {
+- StorageDead(_165);
++ nop;
+ StorageDead(_164);
+ StorageLive(_168);
+ StorageLive(_169);
StorageLive(_170);
-- StorageLive(_171);
-- StorageLive(_172);
-- _172 = (*_165);
-- StorageLive(_173);
-- _173 = _1;
-- _171 = Add(move _172, move _173);
-- StorageDead(_173);
-- StorageDead(_172);
-- _170 = opaque::<u64>(move _171) -> [return: bb40, unwind unreachable];
-+ _170 = opaque::<u64>(_167) -> [return: bb40, unwind unreachable];
+- _170 = (*_163);
++ _170 = _166;
+ StorageLive(_171);
+ _171 = _1;
+- _169 = Add(move _170, move _171);
++ _169 = _165;
+ StorageDead(_171);
+ StorageDead(_170);
+- _168 = opaque::<u64>(move _169) -> [return: bb44, unwind unreachable];
++ _168 = opaque::<u64>(_165) -> [return: bb44, unwind unreachable];
}
- bb40: {
-- StorageDead(_171);
- StorageDead(_170);
+ bb44: {
+ StorageDead(_169);
+ StorageDead(_168);
_0 = const ();
- StorageDead(_165);
- StorageDead(_137);
- StorageDead(_128);
+- StorageDead(_163);
+- StorageDead(_135);
+- StorageDead(_126);
++ nop;
++ nop;
++ nop;
return;
}
}
diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
index 68b052907..119a4d9bb 100644
--- a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
@@ -65,11 +65,11 @@
let mut _60: u64;
let mut _61: u64;
let mut _62: u64;
- let mut _63: u64;
+ let _63: ();
let mut _64: u64;
- let _65: ();
+ let mut _65: u64;
let mut _66: u64;
- let mut _67: u64;
+ let _67: ();
let mut _68: u64;
let mut _69: u64;
let mut _70: u64;
@@ -77,25 +77,25 @@
let mut _72: u64;
let mut _73: u64;
let mut _74: u64;
- let mut _75: u64;
- let mut _76: u64;
- let _77: ();
+ let mut _75: bool;
+ let _76: ();
+ let mut _77: u64;
let mut _78: u64;
let mut _79: u64;
- let mut _80: u64;
- let mut _81: u64;
- let mut _82: bool;
+ let mut _80: bool;
+ let _81: ();
+ let mut _82: u64;
let mut _83: u64;
- let _84: ();
- let mut _85: u64;
+ let mut _84: u64;
+ let _85: ();
let mut _86: u64;
let mut _87: u64;
let mut _88: u64;
- let mut _89: bool;
+ let _89: ();
let mut _90: u64;
- let _91: ();
+ let mut _91: u64;
let mut _92: u64;
- let mut _93: u64;
+ let _93: ();
let mut _94: u64;
let mut _95: u64;
let mut _96: u64;
@@ -103,93 +103,91 @@
let mut _98: u64;
let mut _99: u64;
let mut _100: u64;
- let mut _101: u64;
- let mut _102: u64;
- let _103: ();
- let mut _104: u64;
- let mut _105: u64;
+ let _101: ();
+ let mut _102: u32;
+ let mut _103: u64;
+ let _104: ();
+ let mut _105: f32;
let mut _106: u64;
- let mut _107: u64;
- let mut _108: u64;
- let _109: ();
- let mut _110: u64;
+ let _107: ();
+ let mut _108: S<u64>;
+ let mut _109: u64;
+ let _110: ();
let mut _111: u64;
- let mut _112: u64;
+ let mut _112: S<u64>;
let mut _113: u64;
- let mut _114: u64;
- let _115: ();
+ let _114: ();
+ let mut _115: u64;
let mut _116: u64;
let mut _117: u64;
let mut _118: u64;
let mut _119: u64;
- let mut _120: u64;
- let _121: ();
- let mut _122: S<u64>;
+ let _120: ();
+ let mut _121: u64;
+ let mut _122: u64;
let mut _123: u64;
- let _124: ();
+ let mut _124: u64;
let mut _125: u64;
- let mut _126: S<u64>;
- let mut _127: u64;
- let _128: &u64;
- let _129: ();
+ let _126: &u64;
+ let _127: ();
+ let mut _128: u64;
+ let mut _129: u64;
let mut _130: u64;
- let mut _131: u64;
+ let _131: ();
let mut _132: u64;
- let _133: ();
+ let mut _133: u64;
let mut _134: u64;
- let mut _135: u64;
- let mut _136: u64;
- let _138: ();
+ let _136: ();
+ let mut _137: u64;
+ let mut _138: u64;
let mut _139: u64;
- let mut _140: u64;
+ let _140: ();
let mut _141: u64;
- let _142: ();
+ let mut _142: u64;
let mut _143: u64;
- let mut _144: u64;
- let mut _145: u64;
+ let _144: ();
let _146: ();
- let _148: ();
+ let mut _147: u64;
+ let mut _148: u64;
let mut _149: u64;
- let mut _150: u64;
+ let _150: ();
let mut _151: u64;
- let _152: ();
+ let mut _152: u64;
let mut _153: u64;
- let mut _154: u64;
- let mut _155: u64;
- let _157: ();
+ let _155: ();
+ let mut _156: u64;
+ let mut _157: u64;
let mut _158: u64;
- let mut _159: u64;
+ let _159: ();
let mut _160: u64;
- let _161: ();
+ let mut _161: u64;
let mut _162: u64;
- let mut _163: u64;
- let mut _164: u64;
- let _166: ();
+ let _164: ();
+ let mut _165: u64;
+ let mut _166: u64;
let mut _167: u64;
- let mut _168: u64;
+ let _168: ();
let mut _169: u64;
- let _170: ();
+ let mut _170: u64;
let mut _171: u64;
- let mut _172: u64;
- let mut _173: u64;
scope 1 {
- debug a => _128;
- let _137: &mut u64;
+ debug a => _126;
+ let _135: &mut u64;
scope 2 {
- debug b => _137;
- let _165: &u64;
+ debug b => _135;
+ let _163: &u64;
scope 3 {
- let _147: *const u64;
+ let _145: *const u64;
scope 4 {
- debug c => _147;
- let _156: *mut u64;
+ debug c => _145;
+ let _154: *mut u64;
scope 5 {
- debug d => _156;
+ debug d => _154;
}
}
}
scope 6 {
- debug e => _165;
+ debug e => _163;
}
}
}
@@ -197,61 +195,68 @@
bb0: {
StorageLive(_4);
- StorageLive(_5);
-- StorageLive(_6);
-- _6 = _1;
-- StorageLive(_7);
-- _7 = _2;
++ nop;
+ StorageLive(_6);
+ _6 = _1;
+ StorageLive(_7);
+ _7 = _2;
- _5 = Add(move _6, move _7);
-- StorageDead(_7);
-- StorageDead(_6);
-- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind continue];
+ _5 = Add(_1, _2);
+ StorageDead(_7);
+ StorageDead(_6);
+- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind continue];
+ _4 = opaque::<u64>(_5) -> [return: bb1, unwind continue];
}
bb1: {
- StorageDead(_5);
++ nop;
StorageDead(_4);
StorageLive(_8);
- StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
-- StorageLive(_11);
-- _11 = _2;
++ nop;
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
- _9 = Mul(move _10, move _11);
-- StorageDead(_11);
-- StorageDead(_10);
-- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind continue];
+ _9 = Mul(_1, _2);
+ StorageDead(_11);
+ StorageDead(_10);
+- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind continue];
+ _8 = opaque::<u64>(_9) -> [return: bb2, unwind continue];
}
bb2: {
- StorageDead(_9);
++ nop;
StorageDead(_8);
StorageLive(_12);
- StorageLive(_13);
-- StorageLive(_14);
-- _14 = _1;
-- StorageLive(_15);
-- _15 = _2;
++ nop;
+ StorageLive(_14);
+ _14 = _1;
+ StorageLive(_15);
+ _15 = _2;
- _13 = Sub(move _14, move _15);
-- StorageDead(_15);
-- StorageDead(_14);
-- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind continue];
+ _13 = Sub(_1, _2);
+ StorageDead(_15);
+ StorageDead(_14);
+- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind continue];
+ _12 = opaque::<u64>(_13) -> [return: bb3, unwind continue];
}
bb3: {
- StorageDead(_13);
++ nop;
StorageDead(_12);
StorageLive(_16);
- StorageLive(_17);
-- StorageLive(_18);
-- _18 = _1;
-- StorageLive(_19);
-- _19 = _2;
++ nop;
+ StorageLive(_18);
+ _18 = _1;
+ StorageLive(_19);
+ _19 = _2;
- _20 = Eq(_19, const 0_u64);
- assert(!move _20, "attempt to divide `{}` by zero", _18) -> [success: bb4, unwind continue];
+ _20 = Eq(_2, const 0_u64);
@@ -260,623 +265,701 @@
bb4: {
- _17 = Div(move _18, move _19);
-- StorageDead(_19);
-- StorageDead(_18);
-- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind continue];
+ _17 = Div(_1, _2);
+ StorageDead(_19);
+ StorageDead(_18);
+- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind continue];
+ _16 = opaque::<u64>(_17) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_17);
++ nop;
StorageDead(_16);
StorageLive(_21);
- StorageLive(_22);
-- StorageLive(_23);
-- _23 = _1;
-- StorageLive(_24);
-- _24 = _2;
++ nop;
+ StorageLive(_23);
+ _23 = _1;
+ StorageLive(_24);
+ _24 = _2;
- _25 = Eq(_24, const 0_u64);
- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", _23) -> [success: bb6, unwind continue];
++ _25 = _20;
+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb6, unwind continue];
}
bb6: {
- _22 = Rem(move _23, move _24);
-- StorageDead(_24);
-- StorageDead(_23);
-- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind continue];
+ _22 = Rem(_1, _2);
+ StorageDead(_24);
+ StorageDead(_23);
+- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind continue];
+ _21 = opaque::<u64>(_22) -> [return: bb7, unwind continue];
}
bb7: {
- StorageDead(_22);
++ nop;
StorageDead(_21);
StorageLive(_26);
- StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
-- StorageLive(_29);
-- _29 = _2;
++ nop;
+ StorageLive(_28);
+ _28 = _1;
+ StorageLive(_29);
+ _29 = _2;
- _27 = BitAnd(move _28, move _29);
-- StorageDead(_29);
-- StorageDead(_28);
-- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind continue];
+ _27 = BitAnd(_1, _2);
+ StorageDead(_29);
+ StorageDead(_28);
+- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind continue];
+ _26 = opaque::<u64>(_27) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_27);
++ nop;
StorageDead(_26);
StorageLive(_30);
- StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
-- StorageLive(_33);
-- _33 = _2;
++ nop;
+ StorageLive(_32);
+ _32 = _1;
+ StorageLive(_33);
+ _33 = _2;
- _31 = BitOr(move _32, move _33);
-- StorageDead(_33);
-- StorageDead(_32);
-- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind continue];
+ _31 = BitOr(_1, _2);
+ StorageDead(_33);
+ StorageDead(_32);
+- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind continue];
+ _30 = opaque::<u64>(_31) -> [return: bb9, unwind continue];
}
bb9: {
- StorageDead(_31);
++ nop;
StorageDead(_30);
StorageLive(_34);
- StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
-- StorageLive(_37);
-- _37 = _2;
++ nop;
+ StorageLive(_36);
+ _36 = _1;
+ StorageLive(_37);
+ _37 = _2;
- _35 = BitXor(move _36, move _37);
-- StorageDead(_37);
-- StorageDead(_36);
-- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind continue];
+ _35 = BitXor(_1, _2);
+ StorageDead(_37);
+ StorageDead(_36);
+- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind continue];
+ _34 = opaque::<u64>(_35) -> [return: bb10, unwind continue];
}
bb10: {
- StorageDead(_35);
++ nop;
StorageDead(_34);
StorageLive(_38);
- StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
-- StorageLive(_41);
-- _41 = _2;
++ nop;
+ StorageLive(_40);
+ _40 = _1;
+ StorageLive(_41);
+ _41 = _2;
- _39 = Shl(move _40, move _41);
-- StorageDead(_41);
-- StorageDead(_40);
-- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind continue];
+ _39 = Shl(_1, _2);
+ StorageDead(_41);
+ StorageDead(_40);
+- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind continue];
+ _38 = opaque::<u64>(_39) -> [return: bb11, unwind continue];
}
bb11: {
- StorageDead(_39);
++ nop;
StorageDead(_38);
StorageLive(_42);
- StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
-- StorageLive(_45);
-- _45 = _2;
++ nop;
+ StorageLive(_44);
+ _44 = _1;
+ StorageLive(_45);
+ _45 = _2;
- _43 = Shr(move _44, move _45);
-- StorageDead(_45);
-- StorageDead(_44);
-- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind continue];
+ _43 = Shr(_1, _2);
+ StorageDead(_45);
+ StorageDead(_44);
+- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind continue];
+ _42 = opaque::<u64>(_43) -> [return: bb12, unwind continue];
}
bb12: {
- StorageDead(_43);
++ nop;
StorageDead(_42);
StorageLive(_46);
- StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
+- StorageLive(_47);
++ nop;
+ StorageLive(_48);
+ _48 = _1;
- _47 = move _48 as u32 (IntToInt);
-- StorageDead(_48);
+ _47 = _1 as u32 (IntToInt);
- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind continue];
+ StorageDead(_48);
+- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind continue];
++ _46 = opaque::<u32>(_47) -> [return: bb13, unwind continue];
}
bb13: {
- StorageDead(_47);
+- StorageDead(_47);
++ nop;
StorageDead(_46);
StorageLive(_49);
- StorageLive(_50);
-- StorageLive(_51);
-- _51 = _1;
+- StorageLive(_50);
++ nop;
+ StorageLive(_51);
+ _51 = _1;
- _50 = move _51 as f32 (IntToFloat);
-- StorageDead(_51);
+ _50 = _1 as f32 (IntToFloat);
- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind continue];
+ StorageDead(_51);
+- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind continue];
++ _49 = opaque::<f32>(_50) -> [return: bb14, unwind continue];
}
bb14: {
- StorageDead(_50);
+- StorageDead(_50);
++ nop;
StorageDead(_49);
StorageLive(_52);
- StorageLive(_53);
-- StorageLive(_54);
-- _54 = _1;
++ nop;
+ StorageLive(_54);
+ _54 = _1;
- _53 = S::<u64>(move _54);
-- StorageDead(_54);
-- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind continue];
+ _53 = S::<u64>(_1);
+ StorageDead(_54);
+- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind continue];
+ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind continue];
}
bb15: {
- StorageDead(_53);
++ nop;
StorageDead(_52);
StorageLive(_55);
-- StorageLive(_56);
-- StorageLive(_57);
-- StorageLive(_58);
-- _58 = _1;
+ StorageLive(_56);
+ StorageLive(_57);
+ StorageLive(_58);
+ _58 = _1;
- _57 = S::<u64>(move _58);
-- StorageDead(_58);
++ _57 = _53;
+ StorageDead(_58);
- _56 = (_57.0: u64);
- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind continue];
-+ _56 = (_53.0: u64);
-+ _55 = opaque::<u64>(_56) -> [return: bb16, unwind continue];
++ _56 = _1;
++ _55 = opaque::<u64>(_1) -> [return: bb16, unwind continue];
}
bb16: {
-- StorageDead(_56);
-- StorageDead(_57);
+ StorageDead(_56);
+ StorageDead(_57);
StorageDead(_55);
StorageLive(_59);
StorageLive(_60);
-- StorageLive(_61);
-- StorageLive(_62);
-- _62 = _1;
-- StorageLive(_63);
-- _63 = _2;
-- _61 = Add(move _62, move _63);
-- StorageDead(_63);
-- StorageDead(_62);
- StorageLive(_64);
- _64 = _3;
-- _60 = Add(move _61, move _64);
-+ _60 = Add(_5, move _64);
- StorageDead(_64);
-- StorageDead(_61);
- _59 = opaque::<u64>(move _60) -> [return: bb17, unwind continue];
+ StorageLive(_61);
+ _61 = _1;
+ StorageLive(_62);
+ _62 = _2;
+- _60 = Add(move _61, move _62);
++ _60 = _5;
+ StorageDead(_62);
+ StorageDead(_61);
+- _59 = opaque::<u64>(move _60) -> [return: bb17, unwind continue];
++ _59 = opaque::<u64>(_5) -> [return: bb17, unwind continue];
}
bb17: {
StorageDead(_60);
StorageDead(_59);
+ StorageLive(_63);
+ StorageLive(_64);
StorageLive(_65);
+ _65 = _1;
StorageLive(_66);
-- StorageLive(_67);
-- StorageLive(_68);
-- _68 = _1;
-- StorageLive(_69);
-- _69 = _2;
-- _67 = Mul(move _68, move _69);
-- StorageDead(_69);
-- StorageDead(_68);
+ _66 = _2;
+- _64 = Mul(move _65, move _66);
++ _64 = _9;
+ StorageDead(_66);
+ StorageDead(_65);
+- _63 = opaque::<u64>(move _64) -> [return: bb18, unwind continue];
++ _63 = opaque::<u64>(_9) -> [return: bb18, unwind continue];
+ }
+
+ bb18: {
+ StorageDead(_64);
+ StorageDead(_63);
+ StorageLive(_67);
+ StorageLive(_68);
+ StorageLive(_69);
+ _69 = _1;
StorageLive(_70);
- _70 = _3;
-- _66 = Add(move _67, move _70);
-+ _66 = Add(_9, move _70);
+ _70 = _2;
+- _68 = Sub(move _69, move _70);
++ _68 = _13;
StorageDead(_70);
-- StorageDead(_67);
- _65 = opaque::<u64>(move _66) -> [return: bb18, unwind continue];
+ StorageDead(_69);
+- _67 = opaque::<u64>(move _68) -> [return: bb19, unwind continue];
++ _67 = opaque::<u64>(_13) -> [return: bb19, unwind continue];
}
- bb18: {
- StorageDead(_66);
- StorageDead(_65);
+ bb19: {
+ StorageDead(_68);
+ StorageDead(_67);
StorageLive(_71);
StorageLive(_72);
-- StorageLive(_73);
-- StorageLive(_74);
-- _74 = _1;
-- StorageLive(_75);
-- _75 = _2;
-- _73 = Sub(move _74, move _75);
-- StorageDead(_75);
-- StorageDead(_74);
- StorageLive(_76);
- _76 = _3;
-- _72 = Add(move _73, move _76);
-+ _72 = Add(_13, move _76);
- StorageDead(_76);
-- StorageDead(_73);
- _71 = opaque::<u64>(move _72) -> [return: bb19, unwind continue];
+ StorageLive(_73);
+ _73 = _1;
+ StorageLive(_74);
+ _74 = _2;
+- _75 = Eq(_74, const 0_u64);
+- assert(!move _75, "attempt to divide `{}` by zero", _73) -> [success: bb20, unwind continue];
++ _75 = _20;
++ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind continue];
}
- bb19: {
+ bb20: {
+- _72 = Div(move _73, move _74);
++ _72 = _17;
+ StorageDead(_74);
+ StorageDead(_73);
+- _71 = opaque::<u64>(move _72) -> [return: bb21, unwind continue];
++ _71 = opaque::<u64>(_17) -> [return: bb21, unwind continue];
+ }
+
+ bb21: {
StorageDead(_72);
StorageDead(_71);
+ StorageLive(_76);
StorageLive(_77);
StorageLive(_78);
-- StorageLive(_79);
-- StorageLive(_80);
-- _80 = _1;
-- StorageLive(_81);
-- _81 = _2;
-- _82 = Eq(_81, const 0_u64);
-- assert(!move _82, "attempt to divide `{}` by zero", _80) -> [success: bb20, unwind continue];
-+ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind continue];
+ _78 = _1;
+ StorageLive(_79);
+ _79 = _2;
+- _80 = Eq(_79, const 0_u64);
+- assert(!move _80, "attempt to calculate the remainder of `{}` with a divisor of zero", _78) -> [success: bb22, unwind continue];
++ _80 = _20;
++ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind continue];
}
- bb20: {
-- _79 = Div(move _80, move _81);
-- StorageDead(_81);
-- StorageDead(_80);
- StorageLive(_83);
- _83 = _3;
-- _78 = Add(move _79, move _83);
-+ _78 = Add(_17, move _83);
- StorageDead(_83);
-- StorageDead(_79);
- _77 = opaque::<u64>(move _78) -> [return: bb21, unwind continue];
+ bb22: {
+- _77 = Rem(move _78, move _79);
++ _77 = _22;
+ StorageDead(_79);
+ StorageDead(_78);
+- _76 = opaque::<u64>(move _77) -> [return: bb23, unwind continue];
++ _76 = opaque::<u64>(_22) -> [return: bb23, unwind continue];
}
- bb21: {
- StorageDead(_78);
+ bb23: {
StorageDead(_77);
+ StorageDead(_76);
+ StorageLive(_81);
+ StorageLive(_82);
+ StorageLive(_83);
+ _83 = _1;
StorageLive(_84);
- StorageLive(_85);
-- StorageLive(_86);
-- StorageLive(_87);
-- _87 = _1;
-- StorageLive(_88);
-- _88 = _2;
-- _89 = Eq(_88, const 0_u64);
-- assert(!move _89, "attempt to calculate the remainder of `{}` with a divisor of zero", _87) -> [success: bb22, unwind continue];
-+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind continue];
+ _84 = _2;
+- _82 = BitAnd(move _83, move _84);
++ _82 = _27;
+ StorageDead(_84);
+ StorageDead(_83);
+- _81 = opaque::<u64>(move _82) -> [return: bb24, unwind continue];
++ _81 = opaque::<u64>(_27) -> [return: bb24, unwind continue];
}
- bb22: {
-- _86 = Rem(move _87, move _88);
-- StorageDead(_88);
-- StorageDead(_87);
- StorageLive(_90);
- _90 = _3;
-- _85 = Add(move _86, move _90);
-+ _85 = Add(_22, move _90);
- StorageDead(_90);
-- StorageDead(_86);
- _84 = opaque::<u64>(move _85) -> [return: bb23, unwind continue];
+ bb24: {
+ StorageDead(_82);
+ StorageDead(_81);
+ StorageLive(_85);
+ StorageLive(_86);
+ StorageLive(_87);
+ _87 = _1;
+ StorageLive(_88);
+ _88 = _2;
+- _86 = BitOr(move _87, move _88);
++ _86 = _31;
+ StorageDead(_88);
+ StorageDead(_87);
+- _85 = opaque::<u64>(move _86) -> [return: bb25, unwind continue];
++ _85 = opaque::<u64>(_31) -> [return: bb25, unwind continue];
}
- bb23: {
+ bb25: {
+ StorageDead(_86);
StorageDead(_85);
- StorageDead(_84);
+ StorageLive(_89);
+ StorageLive(_90);
StorageLive(_91);
+ _91 = _1;
StorageLive(_92);
-- StorageLive(_93);
-- StorageLive(_94);
-- _94 = _1;
-- StorageLive(_95);
-- _95 = _2;
-- _93 = BitAnd(move _94, move _95);
-- StorageDead(_95);
-- StorageDead(_94);
+ _92 = _2;
+- _90 = BitXor(move _91, move _92);
++ _90 = _35;
+ StorageDead(_92);
+ StorageDead(_91);
+- _89 = opaque::<u64>(move _90) -> [return: bb26, unwind continue];
++ _89 = opaque::<u64>(_35) -> [return: bb26, unwind continue];
+ }
+
+ bb26: {
+ StorageDead(_90);
+ StorageDead(_89);
+ StorageLive(_93);
+ StorageLive(_94);
+ StorageLive(_95);
+ _95 = _1;
StorageLive(_96);
- _96 = _3;
-- _92 = Add(move _93, move _96);
-+ _92 = Add(_27, move _96);
+ _96 = _2;
+- _94 = Shl(move _95, move _96);
++ _94 = _39;
StorageDead(_96);
-- StorageDead(_93);
- _91 = opaque::<u64>(move _92) -> [return: bb24, unwind continue];
+ StorageDead(_95);
+- _93 = opaque::<u64>(move _94) -> [return: bb27, unwind continue];
++ _93 = opaque::<u64>(_39) -> [return: bb27, unwind continue];
}
- bb24: {
- StorageDead(_92);
- StorageDead(_91);
+ bb27: {
+ StorageDead(_94);
+ StorageDead(_93);
StorageLive(_97);
StorageLive(_98);
-- StorageLive(_99);
-- StorageLive(_100);
-- _100 = _1;
-- StorageLive(_101);
-- _101 = _2;
-- _99 = BitOr(move _100, move _101);
-- StorageDead(_101);
-- StorageDead(_100);
- StorageLive(_102);
- _102 = _3;
-- _98 = Add(move _99, move _102);
-+ _98 = Add(_31, move _102);
- StorageDead(_102);
-- StorageDead(_99);
- _97 = opaque::<u64>(move _98) -> [return: bb25, unwind continue];
+ StorageLive(_99);
+ _99 = _1;
+ StorageLive(_100);
+ _100 = _2;
+- _98 = Shr(move _99, move _100);
++ _98 = _43;
+ StorageDead(_100);
+ StorageDead(_99);
+- _97 = opaque::<u64>(move _98) -> [return: bb28, unwind continue];
++ _97 = opaque::<u64>(_43) -> [return: bb28, unwind continue];
}
- bb25: {
+ bb28: {
StorageDead(_98);
StorageDead(_97);
+ StorageLive(_101);
+ StorageLive(_102);
StorageLive(_103);
+ _103 = _1;
+- _102 = move _103 as u32 (IntToInt);
++ _102 = _47;
+ StorageDead(_103);
+- _101 = opaque::<u32>(move _102) -> [return: bb29, unwind continue];
++ _101 = opaque::<u32>(_47) -> [return: bb29, unwind continue];
+ }
+
+ bb29: {
+ StorageDead(_102);
+ StorageDead(_101);
StorageLive(_104);
-- StorageLive(_105);
-- StorageLive(_106);
-- _106 = _1;
-- StorageLive(_107);
-- _107 = _2;
-- _105 = BitXor(move _106, move _107);
-- StorageDead(_107);
-- StorageDead(_106);
- StorageLive(_108);
- _108 = _3;
-- _104 = Add(move _105, move _108);
-+ _104 = Add(_35, move _108);
- StorageDead(_108);
-- StorageDead(_105);
- _103 = opaque::<u64>(move _104) -> [return: bb26, unwind continue];
+ StorageLive(_105);
+ StorageLive(_106);
+ _106 = _1;
+- _105 = move _106 as f32 (IntToFloat);
++ _105 = _50;
+ StorageDead(_106);
+- _104 = opaque::<f32>(move _105) -> [return: bb30, unwind continue];
++ _104 = opaque::<f32>(_50) -> [return: bb30, unwind continue];
}
- bb26: {
+ bb30: {
+ StorageDead(_105);
StorageDead(_104);
- StorageDead(_103);
+ StorageLive(_107);
+ StorageLive(_108);
StorageLive(_109);
+ _109 = _1;
+- _108 = S::<u64>(move _109);
++ _108 = _53;
+ StorageDead(_109);
+- _107 = opaque::<S<u64>>(move _108) -> [return: bb31, unwind continue];
++ _107 = opaque::<S<u64>>(_53) -> [return: bb31, unwind continue];
+ }
+
+ bb31: {
+ StorageDead(_108);
+ StorageDead(_107);
StorageLive(_110);
-- StorageLive(_111);
-- StorageLive(_112);
-- _112 = _1;
-- StorageLive(_113);
-- _113 = _2;
-- _111 = Shl(move _112, move _113);
-- StorageDead(_113);
-- StorageDead(_112);
- StorageLive(_114);
- _114 = _3;
-- _110 = Add(move _111, move _114);
-+ _110 = Add(_39, move _114);
- StorageDead(_114);
-- StorageDead(_111);
- _109 = opaque::<u64>(move _110) -> [return: bb27, unwind continue];
+ StorageLive(_111);
+ StorageLive(_112);
+ StorageLive(_113);
+ _113 = _1;
+- _112 = S::<u64>(move _113);
++ _112 = _53;
+ StorageDead(_113);
+- _111 = (_112.0: u64);
+- _110 = opaque::<u64>(move _111) -> [return: bb32, unwind continue];
++ _111 = _1;
++ _110 = opaque::<u64>(_1) -> [return: bb32, unwind continue];
}
- bb27: {
+ bb32: {
+ StorageDead(_111);
+ StorageDead(_112);
StorageDead(_110);
- StorageDead(_109);
- StorageLive(_115);
+ StorageLive(_114);
+- StorageLive(_115);
++ nop;
StorageLive(_116);
-- StorageLive(_117);
-- StorageLive(_118);
-- _118 = _1;
-- StorageLive(_119);
-- _119 = _2;
-- _117 = Shr(move _118, move _119);
-- StorageDead(_119);
-- StorageDead(_118);
- StorageLive(_120);
- _120 = _3;
-- _116 = Add(move _117, move _120);
-+ _116 = Add(_43, move _120);
- StorageDead(_120);
-- StorageDead(_117);
- _115 = opaque::<u64>(move _116) -> [return: bb28, unwind continue];
+ StorageLive(_117);
+ _117 = _1;
+ StorageLive(_118);
+ _118 = _2;
+- _116 = Mul(move _117, move _118);
++ _116 = _9;
+ StorageDead(_118);
+ StorageDead(_117);
+ StorageLive(_119);
+ _119 = _2;
+- _115 = Sub(move _116, move _119);
++ _115 = Sub(_9, _2);
+ StorageDead(_119);
+ StorageDead(_116);
+- _114 = opaque::<u64>(move _115) -> [return: bb33, unwind continue];
++ _114 = opaque::<u64>(_115) -> [return: bb33, unwind continue];
}
- bb28: {
- StorageDead(_116);
- StorageDead(_115);
+ bb33: {
+- StorageDead(_115);
++ nop;
+ StorageDead(_114);
+ StorageLive(_120);
StorageLive(_121);
-- StorageLive(_122);
-- StorageLive(_123);
-- _123 = _1;
-- _122 = S::<u64>(move _123);
-- StorageDead(_123);
-- _121 = opaque::<S<u64>>(move _122) -> [return: bb29, unwind continue];
-+ _121 = opaque::<S<u64>>(_53) -> [return: bb29, unwind continue];
+ StorageLive(_122);
+ StorageLive(_123);
+ _123 = _1;
+ StorageLive(_124);
+ _124 = _2;
+- _122 = Mul(move _123, move _124);
++ _122 = _9;
+ StorageDead(_124);
+ StorageDead(_123);
+ StorageLive(_125);
+ _125 = _2;
+- _121 = Sub(move _122, move _125);
++ _121 = _115;
+ StorageDead(_125);
+ StorageDead(_122);
+- _120 = opaque::<u64>(move _121) -> [return: bb34, unwind continue];
++ _120 = opaque::<u64>(_115) -> [return: bb34, unwind continue];
}
- bb29: {
-- StorageDead(_122);
+ bb34: {
StorageDead(_121);
- StorageLive(_124);
-- StorageLive(_125);
+ StorageDead(_120);
- StorageLive(_126);
-- StorageLive(_127);
-- _127 = _1;
-- _126 = S::<u64>(move _127);
-- StorageDead(_127);
-- _125 = (_126.0: u64);
-- _124 = opaque::<u64>(move _125) -> [return: bb30, unwind continue];
-+ _124 = opaque::<u64>(_56) -> [return: bb30, unwind continue];
- }
-
- bb30: {
-- StorageDead(_125);
-- StorageDead(_126);
- StorageDead(_124);
- StorageLive(_128);
- _128 = &_3;
- StorageLive(_129);
-- StorageLive(_130);
-- StorageLive(_131);
- _131 = (*_128);
-- StorageLive(_132);
-- _132 = _1;
-- _130 = Add(move _131, move _132);
-- StorageDead(_132);
-- StorageDead(_131);
-- _129 = opaque::<u64>(move _130) -> [return: bb31, unwind continue];
-+ _130 = Add(_131, _1);
-+ _129 = opaque::<u64>(_130) -> [return: bb31, unwind continue];
++ nop;
+ _126 = &_3;
+ StorageLive(_127);
+- StorageLive(_128);
+- StorageLive(_129);
++ nop;
++ nop;
+ _129 = (*_126);
+ StorageLive(_130);
+ _130 = _1;
+- _128 = Add(move _129, move _130);
++ _128 = Add(_129, _1);
+ StorageDead(_130);
+- StorageDead(_129);
+- _127 = opaque::<u64>(move _128) -> [return: bb35, unwind continue];
++ nop;
++ _127 = opaque::<u64>(_128) -> [return: bb35, unwind continue];
}
- bb31: {
-- StorageDead(_130);
- StorageDead(_129);
+ bb35: {
+- StorageDead(_128);
++ nop;
+ StorageDead(_127);
+ StorageLive(_131);
+ StorageLive(_132);
StorageLive(_133);
-- StorageLive(_134);
-- StorageLive(_135);
-- _135 = (*_128);
-- StorageLive(_136);
-- _136 = _1;
-- _134 = Add(move _135, move _136);
-- StorageDead(_136);
-- StorageDead(_135);
-- _133 = opaque::<u64>(move _134) -> [return: bb32, unwind continue];
-+ _133 = opaque::<u64>(_130) -> [return: bb32, unwind continue];
+- _133 = (*_126);
++ _133 = _129;
+ StorageLive(_134);
+ _134 = _1;
+- _132 = Add(move _133, move _134);
++ _132 = _128;
+ StorageDead(_134);
+ StorageDead(_133);
+- _131 = opaque::<u64>(move _132) -> [return: bb36, unwind continue];
++ _131 = opaque::<u64>(_128) -> [return: bb36, unwind continue];
}
- bb32: {
-- StorageDead(_134);
- StorageDead(_133);
+ bb36: {
+ StorageDead(_132);
+ StorageDead(_131);
+- StorageLive(_135);
++ nop;
+ _135 = &mut _3;
+ StorageLive(_136);
StorageLive(_137);
- _137 = &mut _3;
StorageLive(_138);
+ _138 = (*_135);
StorageLive(_139);
- StorageLive(_140);
- _140 = (*_137);
-- StorageLive(_141);
-- _141 = _1;
-- _139 = Add(move _140, move _141);
-- StorageDead(_141);
-+ _139 = Add(move _140, _1);
- StorageDead(_140);
- _138 = opaque::<u64>(move _139) -> [return: bb33, unwind continue];
- }
-
- bb33: {
+ _139 = _1;
+- _137 = Add(move _138, move _139);
++ _137 = Add(move _138, _1);
StorageDead(_139);
StorageDead(_138);
- StorageLive(_142);
- StorageLive(_143);
- StorageLive(_144);
- _144 = (*_137);
-- StorageLive(_145);
-- _145 = _1;
-- _143 = Add(move _144, move _145);
-- StorageDead(_145);
-+ _143 = Add(move _144, _1);
- StorageDead(_144);
- _142 = opaque::<u64>(move _143) -> [return: bb34, unwind continue];
+ _136 = opaque::<u64>(move _137) -> [return: bb37, unwind continue];
}
- bb34: {
+ bb37: {
+ StorageDead(_137);
+ StorageDead(_136);
+ StorageLive(_140);
+ StorageLive(_141);
+ StorageLive(_142);
+ _142 = (*_135);
+ StorageLive(_143);
+ _143 = _1;
+- _141 = Add(move _142, move _143);
++ _141 = Add(move _142, _1);
StorageDead(_143);
StorageDead(_142);
-- StorageLive(_146);
+ _140 = opaque::<u64>(move _141) -> [return: bb38, unwind continue];
+ }
+
+ bb38: {
+ StorageDead(_141);
+ StorageDead(_140);
+ StorageLive(_144);
+- StorageLive(_145);
++ nop;
+ _145 = &raw const _3;
+ StorageLive(_146);
StorageLive(_147);
- _147 = &raw const _3;
StorageLive(_148);
+ _148 = (*_145);
StorageLive(_149);
- StorageLive(_150);
- _150 = (*_147);
-- StorageLive(_151);
-- _151 = _1;
-- _149 = Add(move _150, move _151);
-- StorageDead(_151);
-+ _149 = Add(move _150, _1);
- StorageDead(_150);
- _148 = opaque::<u64>(move _149) -> [return: bb35, unwind continue];
- }
-
- bb35: {
+ _149 = _1;
+- _147 = Add(move _148, move _149);
++ _147 = Add(move _148, _1);
StorageDead(_149);
StorageDead(_148);
- StorageLive(_152);
- StorageLive(_153);
- StorageLive(_154);
- _154 = (*_147);
-- StorageLive(_155);
-- _155 = _1;
-- _153 = Add(move _154, move _155);
-- StorageDead(_155);
-+ _153 = Add(move _154, _1);
- StorageDead(_154);
- _152 = opaque::<u64>(move _153) -> [return: bb36, unwind continue];
+ _146 = opaque::<u64>(move _147) -> [return: bb39, unwind continue];
}
- bb36: {
+ bb39: {
+ StorageDead(_147);
+ StorageDead(_146);
+ StorageLive(_150);
+ StorageLive(_151);
+ StorageLive(_152);
+ _152 = (*_145);
+ StorageLive(_153);
+ _153 = _1;
+- _151 = Add(move _152, move _153);
++ _151 = Add(move _152, _1);
StorageDead(_153);
StorageDead(_152);
+ _150 = opaque::<u64>(move _151) -> [return: bb40, unwind continue];
+ }
+
+ bb40: {
+ StorageDead(_151);
+ StorageDead(_150);
+- StorageLive(_154);
++ nop;
+ _154 = &raw mut _3;
+ StorageLive(_155);
StorageLive(_156);
- _156 = &raw mut _3;
StorageLive(_157);
+ _157 = (*_154);
StorageLive(_158);
- StorageLive(_159);
- _159 = (*_156);
-- StorageLive(_160);
-- _160 = _1;
-- _158 = Add(move _159, move _160);
-- StorageDead(_160);
-+ _158 = Add(move _159, _1);
- StorageDead(_159);
- _157 = opaque::<u64>(move _158) -> [return: bb37, unwind continue];
- }
-
- bb37: {
+ _158 = _1;
+- _156 = Add(move _157, move _158);
++ _156 = Add(move _157, _1);
StorageDead(_158);
StorageDead(_157);
- StorageLive(_161);
- StorageLive(_162);
- StorageLive(_163);
- _163 = (*_156);
-- StorageLive(_164);
-- _164 = _1;
-- _162 = Add(move _163, move _164);
-- StorageDead(_164);
-+ _162 = Add(move _163, _1);
- StorageDead(_163);
- _161 = opaque::<u64>(move _162) -> [return: bb38, unwind continue];
+ _155 = opaque::<u64>(move _156) -> [return: bb41, unwind continue];
}
- bb38: {
+ bb41: {
+ StorageDead(_156);
+ StorageDead(_155);
+ StorageLive(_159);
+ StorageLive(_160);
+ StorageLive(_161);
+ _161 = (*_154);
+ StorageLive(_162);
+ _162 = _1;
+- _160 = Add(move _161, move _162);
++ _160 = Add(move _161, _1);
StorageDead(_162);
StorageDead(_161);
-- _146 = const ();
- StorageDead(_156);
- StorageDead(_147);
-- StorageDead(_146);
- StorageLive(_165);
- _165 = &_3;
- StorageLive(_166);
-- StorageLive(_167);
-- StorageLive(_168);
- _168 = (*_165);
-- StorageLive(_169);
-- _169 = _1;
-- _167 = Add(move _168, move _169);
-- StorageDead(_169);
-- StorageDead(_168);
-- _166 = opaque::<u64>(move _167) -> [return: bb39, unwind continue];
-+ _167 = Add(_168, _1);
-+ _166 = opaque::<u64>(_167) -> [return: bb39, unwind continue];
+ _159 = opaque::<u64>(move _160) -> [return: bb42, unwind continue];
}
- bb39: {
-- StorageDead(_167);
- StorageDead(_166);
+ bb42: {
+ StorageDead(_160);
+ StorageDead(_159);
+ _144 = const ();
+- StorageDead(_154);
+- StorageDead(_145);
++ nop;
++ nop;
+ StorageDead(_144);
+- StorageLive(_163);
++ nop;
+ _163 = &_3;
+ StorageLive(_164);
+- StorageLive(_165);
+- StorageLive(_166);
++ nop;
++ nop;
+ _166 = (*_163);
+ StorageLive(_167);
+ _167 = _1;
+- _165 = Add(move _166, move _167);
++ _165 = Add(_166, _1);
+ StorageDead(_167);
+- StorageDead(_166);
+- _164 = opaque::<u64>(move _165) -> [return: bb43, unwind continue];
++ nop;
++ _164 = opaque::<u64>(_165) -> [return: bb43, unwind continue];
+ }
+
+ bb43: {
+- StorageDead(_165);
++ nop;
+ StorageDead(_164);
+ StorageLive(_168);
+ StorageLive(_169);
StorageLive(_170);
-- StorageLive(_171);
-- StorageLive(_172);
-- _172 = (*_165);
-- StorageLive(_173);
-- _173 = _1;
-- _171 = Add(move _172, move _173);
-- StorageDead(_173);
-- StorageDead(_172);
-- _170 = opaque::<u64>(move _171) -> [return: bb40, unwind continue];
-+ _170 = opaque::<u64>(_167) -> [return: bb40, unwind continue];
+- _170 = (*_163);
++ _170 = _166;
+ StorageLive(_171);
+ _171 = _1;
+- _169 = Add(move _170, move _171);
++ _169 = _165;
+ StorageDead(_171);
+ StorageDead(_170);
+- _168 = opaque::<u64>(move _169) -> [return: bb44, unwind continue];
++ _168 = opaque::<u64>(_165) -> [return: bb44, unwind continue];
}
- bb40: {
-- StorageDead(_171);
- StorageDead(_170);
+ bb44: {
+ StorageDead(_169);
+ StorageDead(_168);
_0 = const ();
- StorageDead(_165);
- StorageDead(_137);
- StorageDead(_128);
+- StorageDead(_163);
+- StorageDead(_135);
+- StorageDead(_126);
++ nop;
++ nop;
++ nop;
return;
}
}
diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
index f33845502..62710ba8f 100644
--- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
@@ -15,13 +15,15 @@
bb0: {
StorageLive(_2);
-- StorageLive(_3);
-- _3 = _1;
+ StorageLive(_3);
+ _3 = _1;
- _2 = Option::<T>::Some(move _3);
-- StorageDead(_3);
+ _2 = Option::<T>::Some(_1);
- _4 = discriminant(_2);
- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ StorageDead(_3);
+- _4 = discriminant(_2);
+- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
++ _4 = const 1_isize;
++ switchInt(const 1_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
}
bb1: {
@@ -34,10 +36,12 @@
}
bb3: {
-- StorageLive(_5);
- _5 = ((_2 as Some).0: T);
- _0 = _5;
-- StorageDead(_5);
+ StorageLive(_5);
+- _5 = ((_2 as Some).0: T);
+- _0 = _5;
++ _5 = _1;
++ _0 = _1;
+ StorageDead(_5);
StorageDead(_2);
return;
}
diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
index edc05f99f..ad46a065b 100644
--- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
@@ -15,13 +15,15 @@
bb0: {
StorageLive(_2);
-- StorageLive(_3);
-- _3 = _1;
+ StorageLive(_3);
+ _3 = _1;
- _2 = Option::<T>::Some(move _3);
-- StorageDead(_3);
+ _2 = Option::<T>::Some(_1);
- _4 = discriminant(_2);
- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ StorageDead(_3);
+- _4 = discriminant(_2);
+- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
++ _4 = const 1_isize;
++ switchInt(const 1_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
}
bb1: {
@@ -34,10 +36,12 @@
}
bb3: {
-- StorageLive(_5);
- _5 = ((_2 as Some).0: T);
- _0 = _5;
-- StorageDead(_5);
+ StorageLive(_5);
+- _5 = ((_2 as Some).0: T);
+- _0 = _5;
++ _5 = _1;
++ _0 = _1;
+ StorageDead(_5);
StorageDead(_2);
return;
}
diff --git a/tests/mir-opt/if_condition_int.rs b/tests/mir-opt/if_condition_int.rs
index 398311e6b..a3dd74d9a 100644
--- a/tests/mir-opt/if_condition_int.rs
+++ b/tests/mir-opt/if_condition_int.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: SimplifyComparisonIntegral
// EMIT_MIR if_condition_int.opt_u32.SimplifyComparisonIntegral.diff
// EMIT_MIR if_condition_int.opt_negative.SimplifyComparisonIntegral.diff
diff --git a/tests/mir-opt/inline/asm_unwind.rs b/tests/mir-opt/inline/asm_unwind.rs
index 573ae1ba6..0ae20e522 100644
--- a/tests/mir-opt/inline/asm_unwind.rs
+++ b/tests/mir-opt/inline/asm_unwind.rs
@@ -2,6 +2,7 @@
//
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// needs-asm-support
+// needs-unwind
// compile-flags: -Zinline-mir-hint-threshold=1000
#![feature(asm_unwind)]
@@ -19,5 +20,9 @@ fn foo() {
// EMIT_MIR asm_unwind.main.Inline.diff
pub fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: (inlined foo)
+ // CHECK: asm!("", options(MAY_UNWIND)) -> [return: {{bb.*}}, unwind: [[unwind:bb.*]]];
+ // CHECK: [[unwind]] (cleanup)
foo();
}
diff --git a/tests/mir-opt/inline/caller_with_trivial_bound.rs b/tests/mir-opt/inline/caller_with_trivial_bound.rs
index a8f101d48..40f7f4bba 100644
--- a/tests/mir-opt/inline/caller_with_trivial_bound.rs
+++ b/tests/mir-opt/inline/caller_with_trivial_bound.rs
@@ -15,8 +15,13 @@ impl<T> Factory<T> for IntFactory {
// EMIT_MIR caller_with_trivial_bound.foo.Inline.diff
pub fn foo<T>()
where
+ // Because of this trivial bound, the inliner fails to normalize
+ // `<IntFactory as Factory<T>>::Item`.
+ // Verify that we do not inline anything, which would cause validation ICEs.
IntFactory: Factory<T>,
{
+ // CHECK-LABEL: fn foo(
+ // CHECK-NOT: (inlined bar::<T>)
let mut x: <IntFactory as Factory<T>>::Item = bar::<T>();
}
diff --git a/tests/mir-opt/inline/cycle.rs b/tests/mir-opt/inline/cycle.rs
index 1b74d8184..350724235 100644
--- a/tests/mir-opt/inline/cycle.rs
+++ b/tests/mir-opt/inline/cycle.rs
@@ -4,16 +4,26 @@
// EMIT_MIR cycle.f.Inline.diff
#[inline(always)]
fn f(g: impl Fn()) {
+ // CHECK-LABEL: fn f(
+ // CHECK-NOT: inlined
g();
}
// EMIT_MIR cycle.g.Inline.diff
#[inline(always)]
fn g() {
+ // CHECK-LABEL: fn g(
+ // CHECK-NOT: inlined
+ // CHECK: (inlined f::<fn() {main}>)
+ // CHECK-NOT: inlined
f(main);
}
// EMIT_MIR cycle.main.Inline.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK-NOT: inlined
+ // CHECK: (inlined f::<fn() {g}>)
+ // CHECK-NOT: inlined
f(g);
}
diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs
index 971223c72..ce5e1855a 100644
--- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs
+++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs
@@ -7,5 +7,7 @@ use std::marker::Tuple;
// EMIT_MIR dont_ice_on_generic_rust_call.call.Inline.diff
pub fn call<I: Tuple>(mut mock: Box<dyn FnMut<I, Output = ()>>, input: I) {
+ // CHECK-LABEL: fn call(
+ // CHECK-NOT: inlined
mock.call_mut(input)
}
diff --git a/tests/mir-opt/inline/dyn_trait.rs b/tests/mir-opt/inline/dyn_trait.rs
index 0faeec0bb..ecf220a85 100644
--- a/tests/mir-opt/inline/dyn_trait.rs
+++ b/tests/mir-opt/inline/dyn_trait.rs
@@ -19,18 +19,26 @@ pub trait Query {
// EMIT_MIR dyn_trait.mk_cycle.Inline.diff
#[inline(always)]
pub fn mk_cycle<V: Debug>(c: &dyn Cache<V = V>) {
+ // CHECK-LABEL: fn mk_cycle(
+ // CHECK-NOT: inlined
c.store_nocache()
}
// EMIT_MIR dyn_trait.try_execute_query.Inline.diff
#[inline(always)]
pub fn try_execute_query<C: Cache>(c: &C) {
+ // CHECK-LABEL: fn try_execute_query(
+ // CHECK: (inlined mk_cycle::<<C as Cache>::V>)
mk_cycle(c)
}
// EMIT_MIR dyn_trait.get_query.Inline.diff
#[inline(always)]
pub fn get_query<Q: Query, T>(t: &T) {
+ // CHECK-LABEL: fn get_query(
+ // CHECK-NOT: inlined
let c = Q::cache(t);
+ // CHECK: (inlined try_execute_query::<<Q as Query>::C>)
+ // CHECK: (inlined mk_cycle::<<Q as Query>::V>)
try_execute_query(c)
}
diff --git a/tests/mir-opt/inline/exponential_runtime.rs b/tests/mir-opt/inline/exponential_runtime.rs
index cfa9ff210..1199ce4e5 100644
--- a/tests/mir-opt/inline/exponential_runtime.rs
+++ b/tests/mir-opt/inline/exponential_runtime.rs
@@ -84,5 +84,14 @@ impl A for () {
// EMIT_MIR exponential_runtime.main.Inline.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK-NOT: inlined
+ // CHECK: (inlined <() as G>::call)
+ // CHECK: (inlined <() as F>::call)
+ // CHECK: (inlined <() as E>::call)
+ // CHECK: (inlined <() as D>::call)
+ // CHECK: (inlined <() as C>::call)
+ // CHECK: (inlined <() as B>::call)
+ // CHECK-NOT: inlined
<() as G>::call();
}
diff --git a/tests/mir-opt/inline/inline_any_operand.rs b/tests/mir-opt/inline/inline_any_operand.rs
index fb0de020f..659b7c3a0 100644
--- a/tests/mir-opt/inline/inline_any_operand.rs
+++ b/tests/mir-opt/inline/inline_any_operand.rs
@@ -8,6 +8,8 @@ fn main() {
// EMIT_MIR inline_any_operand.bar.Inline.after.mir
fn bar() -> bool {
+ // CHECK-LABEL: fn bar(
+ // CHECK: (inlined foo)
let f = foo;
f(1, -1)
}
diff --git a/tests/mir-opt/inline/inline_async.rs b/tests/mir-opt/inline/inline_async.rs
index 5c838159b..1de87e1e4 100644
--- a/tests/mir-opt/inline/inline_async.rs
+++ b/tests/mir-opt/inline/inline_async.rs
@@ -1,4 +1,5 @@
-// Checks that inliner doesn't introduce cycles when optimizing generators.
+// skip-filecheck
+// Checks that inliner doesn't introduce cycles when optimizing coroutines.
// The outcome of optimization is not verfied, just the absence of the cycle.
// Regression test for #76181.
//
diff --git a/tests/mir-opt/inline/inline_box_fn.rs b/tests/mir-opt/inline/inline_box_fn.rs
index 348f0e77f..d2da23939 100644
--- a/tests/mir-opt/inline/inline_box_fn.rs
+++ b/tests/mir-opt/inline/inline_box_fn.rs
@@ -4,5 +4,7 @@
// EMIT_MIR inline_box_fn.call.Inline.diff
fn call(x: Box<dyn Fn(i32)>) {
+ // CHECK-LABEL: fn call(
+ // CHECK-NOT: inlined
x(1);
}
diff --git a/tests/mir-opt/inline/inline_closure.rs b/tests/mir-opt/inline/inline_closure.rs
index 715fd0138..65f55d49a 100644
--- a/tests/mir-opt/inline/inline_closure.rs
+++ b/tests/mir-opt/inline/inline_closure.rs
@@ -9,5 +9,8 @@ fn main() {
// EMIT_MIR inline_closure.foo.Inline.after.mir
fn foo<T: Copy>(_t: T, q: i32) -> i32 {
let x = |_t, _q| _t;
+
+ // CHECK-LABEL: fn foo(
+ // CHECK: (inlined foo::<T>::{closure#0})
x(q, q)
}
diff --git a/tests/mir-opt/inline/inline_closure_borrows_arg.rs b/tests/mir-opt/inline/inline_closure_borrows_arg.rs
index d76bc33f5..1570ab057 100644
--- a/tests/mir-opt/inline/inline_closure_borrows_arg.rs
+++ b/tests/mir-opt/inline/inline_closure_borrows_arg.rs
@@ -13,5 +13,8 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
let variable = &*r;
*variable
};
+
+ // CHECK-LABEL: fn foo(
+ // CHECK: (inlined foo::<T>::{closure#0})
x(q, q)
}
diff --git a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
index 721fac27d..10b81e59b 100644
--- a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
+++ b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir
@@ -41,6 +41,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
_7 = (move _8,);
StorageLive(_9);
_9 = move (_7.0: i32);
+ StorageLive(_10);
+ StorageLive(_12);
StorageLive(_11);
_10 = ((*_6).0: &i32);
_11 = (*_10);
@@ -50,6 +52,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
_0 = (move _11, move _13);
StorageDead(_13);
StorageDead(_11);
+ StorageDead(_12);
+ StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
diff --git a/tests/mir-opt/inline/inline_closure_captures.rs b/tests/mir-opt/inline/inline_closure_captures.rs
index 52b6817e4..2b08b1068 100644
--- a/tests/mir-opt/inline/inline_closure_captures.rs
+++ b/tests/mir-opt/inline/inline_closure_captures.rs
@@ -9,5 +9,8 @@ fn main() {
// EMIT_MIR inline_closure_captures.foo.Inline.after.mir
fn foo<T: Copy>(t: T, q: i32) -> (i32, T) {
let x = |_q| (q, t);
+
+ // CHECK-LABEL: fn foo(
+ // CHECK: (inlined foo::<T>::{closure#0})
x(q)
}
diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff
deleted file mode 100644
index eac51000c..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `inlined_no_sanitize` before Inline
-+ // MIR for `inlined_no_sanitize` after Inline
-
- fn inlined_no_sanitize() -> () {
- let mut _0: ();
- let _1: ();
-+ scope 1 (inlined no_sanitize) {
-+ }
-
- bb0: {
- StorageLive(_1);
-- _1 = no_sanitize() -> [return: bb1, unwind unreachable];
-- }
--
-- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff
deleted file mode 100644
index eba5ad9cf..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `inlined_no_sanitize` before Inline
-+ // MIR for `inlined_no_sanitize` after Inline
-
- fn inlined_no_sanitize() -> () {
- let mut _0: ();
- let _1: ();
-+ scope 1 (inlined no_sanitize) {
-+ }
-
- bb0: {
- StorageLive(_1);
-- _1 = no_sanitize() -> [return: bb1, unwind continue];
-- }
--
-- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff
deleted file mode 100644
index c2a81b980..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `inlined_target_feature` before Inline
-+ // MIR for `inlined_target_feature` after Inline
-
- fn inlined_target_feature() -> () {
- let mut _0: ();
- let _1: ();
-+ scope 1 (inlined target_feature) {
-+ }
-
- bb0: {
- StorageLive(_1);
-- _1 = target_feature() -> [return: bb1, unwind unreachable];
-- }
--
-- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff
deleted file mode 100644
index 24457819b..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `inlined_target_feature` before Inline
-+ // MIR for `inlined_target_feature` after Inline
-
- fn inlined_target_feature() -> () {
- let mut _0: ();
- let _1: ();
-+ scope 1 (inlined target_feature) {
-+ }
-
- bb0: {
- StorageLive(_1);
-- _1 = target_feature() -> [return: bb1, unwind continue];
-- }
--
-- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff
deleted file mode 100644
index 791c5a0f2..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-- // MIR for `not_inlined_c_variadic` before Inline
-+ // MIR for `not_inlined_c_variadic` after Inline
-
- fn not_inlined_c_variadic() -> () {
- let mut _0: ();
- let _1: u32;
- scope 1 {
- debug s => _1;
- }
-
- bb0: {
- StorageLive(_1);
- _1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
- _0 = const ();
- StorageDead(_1);
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff
deleted file mode 100644
index 364acab6d..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-- // MIR for `not_inlined_c_variadic` before Inline
-+ // MIR for `not_inlined_c_variadic` after Inline
-
- fn not_inlined_c_variadic() -> () {
- let mut _0: ();
- let _1: u32;
- scope 1 {
- debug s => _1;
- }
-
- bb0: {
- StorageLive(_1);
- _1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> [return: bb1, unwind continue];
- }
-
- bb1: {
- _0 = const ();
- StorageDead(_1);
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff
deleted file mode 100644
index b9d0946b7..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff
+++ /dev/null
@@ -1,19 +0,0 @@
-- // MIR for `not_inlined_no_sanitize` before Inline
-+ // MIR for `not_inlined_no_sanitize` after Inline
-
- fn not_inlined_no_sanitize() -> () {
- let mut _0: ();
- let _1: ();
-
- bb0: {
- StorageLive(_1);
- _1 = no_sanitize() -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff
deleted file mode 100644
index 965b7ddca..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,19 +0,0 @@
-- // MIR for `not_inlined_no_sanitize` before Inline
-+ // MIR for `not_inlined_no_sanitize` after Inline
-
- fn not_inlined_no_sanitize() -> () {
- let mut _0: ();
- let _1: ();
-
- bb0: {
- StorageLive(_1);
- _1 = no_sanitize() -> [return: bb1, unwind continue];
- }
-
- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff
deleted file mode 100644
index 7c689a734..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff
+++ /dev/null
@@ -1,19 +0,0 @@
-- // MIR for `not_inlined_target_feature` before Inline
-+ // MIR for `not_inlined_target_feature` after Inline
-
- fn not_inlined_target_feature() -> () {
- let mut _0: ();
- let _1: ();
-
- bb0: {
- StorageLive(_1);
- _1 = target_feature() -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff
deleted file mode 100644
index bcdbd6e33..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,19 +0,0 @@
-- // MIR for `not_inlined_target_feature` before Inline
-+ // MIR for `not_inlined_target_feature` after Inline
-
- fn not_inlined_target_feature() -> () {
- let mut _0: ();
- let _1: ();
-
- bb0: {
- StorageLive(_1);
- _1 = target_feature() -> [return: bb1, unwind continue];
- }
-
- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.rs b/tests/mir-opt/inline/inline_compatibility.rs
index 1527fea1c..3ad880715 100644
--- a/tests/mir-opt/inline/inline_compatibility.rs
+++ b/tests/mir-opt/inline/inline_compatibility.rs
@@ -1,50 +1,71 @@
// Checks that only functions with compatible attributes are inlined.
-//
// only-x86_64
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// compile-flags: -Cpanic=abort
#![crate_type = "lib"]
#![feature(no_sanitize)]
#![feature(target_feature_11)]
#![feature(c_variadic)]
-// EMIT_MIR inline_compatibility.inlined_target_feature.Inline.diff
+#[inline]
+#[target_feature(enable = "sse2")]
+unsafe fn sse2() {}
+
+#[inline]
+fn nop() {}
+
+// CHECK-LABEL: fn f0()
+// CHECK: bb0: {
+// CHECK-NEXT: return;
#[target_feature(enable = "sse2")]
-pub unsafe fn inlined_target_feature() {
- target_feature();
+pub unsafe fn f0() {
+ sse2();
}
-// EMIT_MIR inline_compatibility.not_inlined_target_feature.Inline.diff
-pub unsafe fn not_inlined_target_feature() {
- target_feature();
+// CHECK-LABEL: fn f1()
+// CHECK: bb0: {
+// CHECK-NEXT: sse2()
+pub unsafe fn f1() {
+ sse2();
}
-// EMIT_MIR inline_compatibility.inlined_no_sanitize.Inline.diff
+// CHECK-LABEL: fn f2()
+// CHECK: bb0: {
+// CHECK-NEXT: nop()
+#[target_feature(enable = "avx")]
+pub unsafe fn f2() {
+ nop();
+}
+
+#[inline]
+#[no_sanitize(address)]
+pub unsafe fn no_sanitize() {}
+
+// CHECK-LABEL: fn inlined_no_sanitize()
+// CHECK: bb0: {
+// CHECK-NEXT: return;
#[no_sanitize(address)]
pub unsafe fn inlined_no_sanitize() {
no_sanitize();
}
-// EMIT_MIR inline_compatibility.not_inlined_no_sanitize.Inline.diff
+// CHECK-LABEL: fn not_inlined_no_sanitize()
+// CHECK: bb0: {
+// CHECK-NEXT: no_sanitize()
pub unsafe fn not_inlined_no_sanitize() {
no_sanitize();
}
-#[inline]
-#[target_feature(enable = "sse2")]
-pub unsafe fn target_feature() {}
-
-#[inline]
-#[no_sanitize(address)]
-pub unsafe fn no_sanitize() {}
-
-// EMIT_MIR inline_compatibility.not_inlined_c_variadic.Inline.diff
+// CHECK-LABEL: fn not_inlined_c_variadic()
+// CHECK: bb0: {
+// CHECK-NEXT: StorageLive(_1)
+// CHECK-NEXT: _1 = sum
pub unsafe fn not_inlined_c_variadic() {
- let s = sum(4u32, 4u32, 30u32, 200u32, 1000u32);
+ let _ = sum(4u32, 4u32, 30u32, 200u32, 1000u32);
}
-#[no_mangle]
#[inline(always)]
+#[no_mangle]
unsafe extern "C" fn sum(n: u32, mut vs: ...) -> u32 {
let mut s = 0;
let mut i = 0;
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff
index 6779003b6..40eeda539 100644
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff
@@ -3,27 +3,27 @@
fn main() -> () {
let mut _0: ();
- let _1: std::ops::GeneratorState<i32, bool>;
- let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>;
- let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
- let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let _1: std::ops::CoroutineState<i32, bool>;
+ let mut _2: std::pin::Pin<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>;
+ let mut _3: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
+ let mut _4: {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
+ let mut _5: bool;
scope 1 {
debug _r => _1;
}
+ scope 2 (inlined g) {
+ }
-+ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) {
++ scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new) {
+ debug pointer => _3;
+ scope 4 {
-+ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) {
++ scope 5 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) {
+ debug pointer => _3;
+ }
+ }
+ }
+ scope 6 (inlined g::{closure#0}) {
+ debug a => _5;
-+ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
++ let mut _6: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
+ let mut _7: u32;
+ let mut _8: i32;
+ }
@@ -34,20 +34,24 @@
StorageLive(_3);
StorageLive(_4);
- _4 = g() -> [return: bb1, unwind unreachable];
-+ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
++ _4 = {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8 (#0)};
+ _3 = &mut _4;
-+ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
++ _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}> { pointer: move _3 };
+ StorageDead(_3);
+ StorageLive(_5);
+ _5 = const false;
-+ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
++ StorageLive(_6);
++ StorageLive(_7);
++ _6 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8});
+ _7 = discriminant((*_6));
+ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
}
bb1: {
- _3 = &mut _4;
-- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable];
+- _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new(move _3) -> [return: bb2, unwind unreachable];
++ StorageDead(_7);
++ StorageDead(_6);
+ StorageDead(_5);
+ StorageDead(_2);
+ drop(_4) -> [return: bb2, unwind unreachable];
@@ -55,7 +59,7 @@
bb2: {
- StorageDead(_3);
-- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
+- _1 = <{coroutine@$DIR/inline_coroutine.rs:19:5: 19:8} as Coroutine<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_1);
@@ -84,19 +88,19 @@
+ }
+
+ bb6: {
-+ _1 = GeneratorState::<i32, bool>::Yielded(move _8);
++ _1 = CoroutineState::<i32, bool>::Yielded(move _8);
+ discriminant((*_6)) = 3;
+ goto -> bb1;
+ }
+
+ bb7: {
-+ assert(const false, "generator resumed after completion") -> [success: bb7, unwind unreachable];
++ assert(const false, "coroutine resumed after completion") -> [success: bb7, unwind unreachable];
+ }
+
+ bb8: {
+ StorageLive(_8);
+ StorageDead(_8);
-+ _1 = GeneratorState::<i32, bool>::Complete(_5);
++ _1 = CoroutineState::<i32, bool>::Complete(_5);
+ discriminant((*_6)) = 1;
+ goto -> bb1;
+ }
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff
index 31744be99..fdb42bf3d 100644
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff
@@ -3,27 +3,27 @@
fn main() -> () {
let mut _0: ();
- let _1: std::ops::GeneratorState<i32, bool>;
- let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>;
- let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
- let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8};
+ let _1: std::ops::CoroutineState<i32, bool>;
+ let mut _2: std::pin::Pin<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>;
+ let mut _3: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
+ let mut _4: {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
+ let mut _5: bool;
scope 1 {
debug _r => _1;
}
+ scope 2 (inlined g) {
+ }
-+ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) {
++ scope 3 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new) {
+ debug pointer => _3;
+ scope 4 {
-+ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) {
++ scope 5 (inlined Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new_unchecked) {
+ debug pointer => _3;
+ }
+ }
+ }
+ scope 6 (inlined g::{closure#0}) {
+ debug a => _5;
-+ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
++ let mut _6: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8};
+ let mut _7: u32;
+ let mut _8: i32;
+ }
@@ -37,24 +37,28 @@
- }
-
- bb1: {
-+ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
++ _4 = {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8 (#0)};
_3 = &mut _4;
-- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind: bb5];
+- _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}>::new(move _3) -> [return: bb2, unwind: bb5];
- }
-
- bb2: {
-+ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
++ _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}> { pointer: move _3 };
StorageDead(_3);
-- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
+- _1 = <{coroutine@$DIR/inline_coroutine.rs:19:5: 19:8} as Coroutine<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
+ StorageLive(_5);
+ _5 = const false;
-+ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
++ StorageLive(_6);
++ StorageLive(_7);
++ _6 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8});
+ _7 = discriminant((*_6));
+ switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11];
}
- bb3: {
+ bb1: {
++ StorageDead(_7);
++ StorageDead(_6);
+ StorageDead(_5);
StorageDead(_2);
- drop(_4) -> [return: bb4, unwind: bb6];
@@ -96,19 +100,19 @@
+ }
+
+ bb8: {
-+ _1 = GeneratorState::<i32, bool>::Yielded(move _8);
++ _1 = CoroutineState::<i32, bool>::Yielded(move _8);
+ discriminant((*_6)) = 3;
+ goto -> bb1;
+ }
+
+ bb9: {
-+ assert(const false, "generator resumed after completion") -> [success: bb9, unwind: bb3];
++ assert(const false, "coroutine resumed after completion") -> [success: bb9, unwind: bb3];
+ }
+
+ bb10: {
+ StorageLive(_8);
+ StorageDead(_8);
-+ _1 = GeneratorState::<i32, bool>::Complete(_5);
++ _1 = CoroutineState::<i32, bool>::Complete(_5);
+ discriminant((*_6)) = 1;
+ goto -> bb1;
+ }
diff --git a/tests/mir-opt/inline/inline_coroutine.rs b/tests/mir-opt/inline/inline_coroutine.rs
new file mode 100644
index 000000000..a82586bf2
--- /dev/null
+++ b/tests/mir-opt/inline/inline_coroutine.rs
@@ -0,0 +1,20 @@
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// compile-flags: -Zinline-mir-hint-threshold=1000
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+use std::pin::Pin;
+
+// EMIT_MIR inline_coroutine.main.Inline.diff
+fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: (inlined g)
+ // CHECK: (inlined g::{closure#0})
+ let _r = Pin::new(&mut g()).resume(false);
+}
+
+#[inline]
+pub fn g() -> impl Coroutine<bool> {
+ #[inline]
+ |a| { yield if a { 7 } else { 13 } }
+}
diff --git a/tests/mir-opt/inline/inline_cycle.rs b/tests/mir-opt/inline/inline_cycle.rs
index 42a6914c9..e3dd08255 100644
--- a/tests/mir-opt/inline/inline_cycle.rs
+++ b/tests/mir-opt/inline/inline_cycle.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that inliner handles various forms of recursion and doesn't fall into
// an infinite inlining cycle. The particular outcome of inlining is not
diff --git a/tests/mir-opt/inline/inline_cycle_generic.rs b/tests/mir-opt/inline/inline_cycle_generic.rs
index ef261b04c..667bf7f92 100644
--- a/tests/mir-opt/inline/inline_cycle_generic.rs
+++ b/tests/mir-opt/inline/inline_cycle_generic.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Check that inliner handles various forms of recursion and doesn't fall into
// an infinite inlining cycle. The particular outcome of inlining is not
diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
index 7d5553b2f..da45ebcb4 100644
--- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
@@ -8,11 +8,11 @@
+ scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) {
+ debug f => _2;
+ let mut _3: &fn() -> ! {sleep};
-+ let mut _4: !;
++ let _4: !;
+ let mut _5: &fn() -> ! {sleep};
-+ let mut _6: !;
+ scope 2 {
+ debug a => _4;
++ let _6: !;
+ scope 3 {
+ debug b => _6;
+ }
diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
index 9f8c5806c..d65c65e5f 100644
--- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
@@ -10,10 +10,10 @@
+ let mut _3: &fn() -> ! {sleep};
+ let _4: !;
+ let mut _5: &fn() -> ! {sleep};
-+ let mut _6: !;
+ let mut _7: !;
+ scope 2 {
+ debug a => _4;
++ let _6: !;
+ scope 3 {
+ debug b => _6;
+ }
diff --git a/tests/mir-opt/inline/inline_diverging.rs b/tests/mir-opt/inline/inline_diverging.rs
index e01c4c1dd..25a5b9c5c 100644
--- a/tests/mir-opt/inline/inline_diverging.rs
+++ b/tests/mir-opt/inline/inline_diverging.rs
@@ -6,6 +6,8 @@
// EMIT_MIR inline_diverging.f.Inline.diff
pub fn f() {
+ // CHECK-LABEL: fn f(
+ // CHECK: (inlined sleep)
sleep();
}
@@ -14,12 +16,17 @@ pub fn g(i: i32) -> u32 {
if i > 0 {
i as u32
} else {
+ // CHECK-LABEL: fn g(
+ // CHECK: (inlined panic)
panic();
}
}
// EMIT_MIR inline_diverging.h.Inline.diff
pub fn h() {
+ // CHECK-LABEL: fn h(
+ // CHECK: (inlined call_twice::<!, fn() -> ! {sleep}>)
+ // CHECK-NOT: inlined
call_twice(sleep);
}
diff --git a/tests/mir-opt/inline/inline_generator.rs b/tests/mir-opt/inline/inline_generator.rs
deleted file mode 100644
index 2d71458c1..000000000
--- a/tests/mir-opt/inline/inline_generator.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// compile-flags: -Zinline-mir-hint-threshold=1000
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-use std::pin::Pin;
-
-// EMIT_MIR inline_generator.main.Inline.diff
-fn main() {
- let _r = Pin::new(&mut g()).resume(false);
-}
-
-#[inline]
-pub fn g() -> impl Generator<bool> {
- #[inline]
- |a| { yield if a { 7 } else { 13 } }
-}
diff --git a/tests/mir-opt/inline/inline_instruction_set.rs b/tests/mir-opt/inline/inline_instruction_set.rs
index 5dfb04943..7cb596455 100644
--- a/tests/mir-opt/inline/inline_instruction_set.rs
+++ b/tests/mir-opt/inline/inline_instruction_set.rs
@@ -46,16 +46,26 @@ fn inline_always_and_using_inline_asm() {
// EMIT_MIR inline_instruction_set.t32.Inline.diff
#[instruction_set(arm::t32)]
pub fn t32() {
+ // CHECK-LABEL: fn t32(
+ // CHECK-NOT: (inlined instruction_set_a32)
instruction_set_a32();
+ // CHECK: (inlined instruction_set_t32)
instruction_set_t32();
+ // CHECK: (inlined instruction_set_default)
instruction_set_default();
+ // CHECK-NOT: (inlined inline_always_and_using_inline_asm)
inline_always_and_using_inline_asm();
}
// EMIT_MIR inline_instruction_set.default.Inline.diff
pub fn default() {
+ // CHECK-LABEL: fn default(
+ // CHECK-NOT: (inlined instruction_set_a32)
instruction_set_a32();
+ // CHECK-NOT: (inlined instruction_set_t32)
instruction_set_t32();
+ // CHECK: (inlined instruction_set_default)
instruction_set_default();
+ // CHECK: (inlined inline_always_and_using_inline_asm)
inline_always_and_using_inline_asm();
}
diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff
index dc0ab255a..b90e0505c 100644
--- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff
@@ -122,9 +122,14 @@
+ _3 = const _;
+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
+ StorageDead(_3);
++ StorageLive(_4);
++ StorageLive(_5);
++ StorageLive(_6);
++ StorageLive(_7);
+ _4 = SizeOf(std::vec::Vec<u32>);
+ _5 = AlignOf(std::vec::Vec<u32>);
+ StorageLive(_8);
++ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
@@ -178,10 +183,15 @@
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
++ StorageDead(_10);
+ StorageDead(_8);
+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
+ (*_7) = move _2;
++ StorageDead(_7);
++ StorageDead(_6);
++ StorageDead(_5);
++ StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind unreachable];
diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
index 675292f06..f9c637caa 100644
--- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
@@ -122,9 +122,14 @@
+ _3 = const _;
+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
+ StorageDead(_3);
++ StorageLive(_4);
++ StorageLive(_5);
++ StorageLive(_6);
++ StorageLive(_7);
+ _4 = SizeOf(std::vec::Vec<u32>);
+ _5 = AlignOf(std::vec::Vec<u32>);
+ StorageLive(_8);
++ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
@@ -195,10 +200,15 @@
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
++ StorageDead(_10);
+ StorageDead(_8);
+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
+ (*_7) = move _2;
++ StorageDead(_7);
++ StorageDead(_6);
++ StorageDead(_5);
++ StorageDead(_4);
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
diff --git a/tests/mir-opt/inline/inline_into_box_place.rs b/tests/mir-opt/inline/inline_into_box_place.rs
index 56f174e51..65f8e2916 100644
--- a/tests/mir-opt/inline/inline_into_box_place.rs
+++ b/tests/mir-opt/inline/inline_into_box_place.rs
@@ -5,5 +5,7 @@
// EMIT_MIR inline_into_box_place.main.Inline.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: (inlined Box::<Vec<u32>>::new)
let _x: Box<Vec<u32>> = Box::new(Vec::new());
}
diff --git a/tests/mir-opt/inline/inline_options.rs b/tests/mir-opt/inline/inline_options.rs
index b247ecd0b..b940c64f0 100644
--- a/tests/mir-opt/inline/inline_options.rs
+++ b/tests/mir-opt/inline/inline_options.rs
@@ -7,7 +7,10 @@
// EMIT_MIR inline_options.main.Inline.after.mir
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK-NOT: (inlined not_inlined)
not_inlined();
+ // CHECK: (inlined inlined::<u32>)
inlined::<u32>();
}
diff --git a/tests/mir-opt/inline/inline_retag.rs b/tests/mir-opt/inline/inline_retag.rs
index c6950f269..9fb6f7092 100644
--- a/tests/mir-opt/inline/inline_retag.rs
+++ b/tests/mir-opt/inline/inline_retag.rs
@@ -8,6 +8,17 @@ fn main() {
// EMIT_MIR inline_retag.bar.Inline.after.mir
fn bar() -> bool {
+ // CHECK-LABEL: fn bar(
+ // CHECK: (inlined foo)
+ // CHECK: debug x => [[x:_.*]];
+ // CHECK: debug y => [[y:_.*]];
+ // CHECK: bb0: {
+ // CHECK: Retag
+ // CHECK: Retag
+ // CHECK: Retag([[x]]);
+ // CHECK: Retag([[y]]);
+ // CHECK: return;
+ // CHECK-NEXT: }
let f = foo;
f(&1, &-1)
}
diff --git a/tests/mir-opt/inline/inline_shims.rs b/tests/mir-opt/inline/inline_shims.rs
index eafbb962e..a223c2d26 100644
--- a/tests/mir-opt/inline/inline_shims.rs
+++ b/tests/mir-opt/inline/inline_shims.rs
@@ -3,11 +3,15 @@
// EMIT_MIR inline_shims.clone.Inline.diff
pub fn clone<A, B>(f: fn(A, B)) -> fn(A, B) {
+ // CHECK-LABEL: fn clone(
+ // CHECK: (inlined <fn(A, B) as Clone>::clone - shim(fn(A, B)))
f.clone()
}
// EMIT_MIR inline_shims.drop.Inline.diff
pub fn drop<A, B>(a: *mut Vec<A>, b: *mut Option<B>) {
+ // CHECK-LABEL: fn drop(
+ // CHECK: (inlined std::ptr::drop_in_place::<Option<B>> - shim(Some(Option<B>)))
unsafe { std::ptr::drop_in_place(a) }
unsafe { std::ptr::drop_in_place(b) }
}
diff --git a/tests/mir-opt/inline/inline_specialization.rs b/tests/mir-opt/inline/inline_specialization.rs
index 0311531dc..6453abc00 100644
--- a/tests/mir-opt/inline/inline_specialization.rs
+++ b/tests/mir-opt/inline/inline_specialization.rs
@@ -3,6 +3,8 @@
// EMIT_MIR inline_specialization.main.Inline.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: (inlined <Vec<()> as Foo>::bar)
let x = <Vec::<()> as Foo>::bar();
}
diff --git a/tests/mir-opt/inline/inline_trait_method.rs b/tests/mir-opt/inline/inline_trait_method.rs
index a9d2168c2..b39355637 100644
--- a/tests/mir-opt/inline/inline_trait_method.rs
+++ b/tests/mir-opt/inline/inline_trait_method.rs
@@ -1,3 +1,4 @@
+// Verify that we do not inline the default impl in a trait object.
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Z span_free_formats
@@ -7,6 +8,8 @@ fn main() {
// EMIT_MIR inline_trait_method.test.Inline.after.mir
fn test(x: &dyn X) -> u32 {
+ // CHECK-LABEL: fn test(
+ // CHECK-NOT: inlined
x.y()
}
diff --git a/tests/mir-opt/inline/inline_trait_method_2.rs b/tests/mir-opt/inline/inline_trait_method_2.rs
index 62ec7ebde..b0b6a7b9b 100644
--- a/tests/mir-opt/inline/inline_trait_method_2.rs
+++ b/tests/mir-opt/inline/inline_trait_method_2.rs
@@ -3,6 +3,9 @@
// EMIT_MIR inline_trait_method_2.test2.Inline.after.mir
fn test2(x: &dyn X) -> bool {
+ // CHECK-LABEL: fn test2(
+ // CHECK: (inlined test)
+ // CHECK-NOT: (inlined <dyn X as X>::y)
test(x)
}
diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
index 3d0c10725..688ab9c56 100644
--- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
@@ -18,6 +18,7 @@
bb0: {
- _0 = inner() -> [return: bb1, unwind unreachable];
+ StorageLive(_1);
++ StorageLive(_2);
+ _1 = const _;
+ _0 = index() -> [return: bb1, unwind unreachable];
}
@@ -40,6 +41,7 @@
+
+ bb4: {
+ StorageDead(_3);
++ StorageDead(_2);
+ StorageDead(_1);
return;
}
diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
index 16a19f4a3..e4d2b1a7f 100644
--- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
@@ -18,6 +18,7 @@
bb0: {
- _0 = inner() -> [return: bb1, unwind continue];
+ StorageLive(_1);
++ StorageLive(_2);
+ _1 = const _;
+ _0 = index() -> [return: bb1, unwind continue];
}
@@ -40,6 +41,7 @@
+
+ bb4: {
+ StorageDead(_3);
++ StorageDead(_2);
+ StorageDead(_1);
return;
}
diff --git a/tests/mir-opt/inline/issue_106141.rs b/tests/mir-opt/inline/issue_106141.rs
index eed1d8917..592b4d9b7 100644
--- a/tests/mir-opt/inline/issue_106141.rs
+++ b/tests/mir-opt/inline/issue_106141.rs
@@ -1,14 +1,21 @@
+// Verify that we do not ICE inlining a function which uses _0 as an index.
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
pub fn outer() -> usize {
+ // CHECK-LABEL: fn outer(
+ // CHECK: = {{.*}}[_0];
inner()
}
+#[inline(never)]
fn index() -> usize {
loop {}
}
#[inline]
fn inner() -> usize {
+ // CHECK-LABEL: fn inner(
+ // CHECK: = {{.*}}[_0];
let buffer = &[true];
let index = index();
if buffer[index] {
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
index 6837da27a..62d7e839f 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
@@ -17,9 +17,13 @@ fn b(_1: &mut Box<T>) -> &mut T {
StorageLive(_3);
StorageLive(_4);
_4 = &mut (*_1);
+ StorageLive(_5);
+ StorageLive(_6);
_5 = deref_copy (*_4);
_6 = (((_5.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
_3 = &mut (*_6);
+ StorageDead(_6);
+ StorageDead(_5);
_2 = &mut (*_3);
StorageDead(_4);
_0 = &mut (*_2);
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
index d09bfc33f..bc0aa06a7 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
@@ -15,9 +15,13 @@ fn d(_1: &Box<T>) -> &T {
StorageLive(_2);
StorageLive(_3);
_3 = &(*_1);
+ StorageLive(_4);
+ StorageLive(_5);
_4 = deref_copy (*_3);
_5 = (((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T);
_2 = &(*_5);
+ StorageDead(_5);
+ StorageDead(_4);
_0 = &(*_2);
StorageDead(_3);
StorageDead(_2);
diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs
index 94f926d39..4517c88d7 100644
--- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs
+++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.rs
@@ -1,20 +1,28 @@
// EMIT_MIR issue_58867_inline_as_ref_as_mut.a.Inline.after.mir
pub fn a<T>(x: &mut [T]) -> &mut [T] {
+ // CHECK-LABEL: fn a(
+ // CHECK: (inlined <[T] as AsMut<[T]>>::as_mut)
x.as_mut()
}
// EMIT_MIR issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
pub fn b<T>(x: &mut Box<T>) -> &mut T {
+ // CHECK-LABEL: fn b(
+ // CHECK: (inlined <Box<T> as AsMut<T>>::as_mut)
x.as_mut()
}
// EMIT_MIR issue_58867_inline_as_ref_as_mut.c.Inline.after.mir
pub fn c<T>(x: &[T]) -> &[T] {
+ // CHECK-LABEL: fn c(
+ // CHECK: (inlined <[T] as AsRef<[T]>>::as_ref)
x.as_ref()
}
// EMIT_MIR issue_58867_inline_as_ref_as_mut.d.Inline.after.mir
pub fn d<T>(x: &Box<T>) -> &T {
+ // CHECK-LABEL: fn d(
+ // CHECK: (inlined <Box<T> as AsRef<T>>::as_ref)
x.as_ref()
}
diff --git a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir
index 4d170c41f..ba4f91b28 100644
--- a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir
+++ b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir
@@ -2,8 +2,8 @@
fn main() -> () {
let mut _0: ();
- let _1: {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
- let mut _2: &{closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
+ let _1: {closure@$DIR/issue_76997_inline_scopes_parenting.rs:15:13: 15:16};
+ let mut _2: &{closure@$DIR/issue_76997_inline_scopes_parenting.rs:15:13: 15:16};
let mut _3: ((),);
let mut _4: ();
let mut _5: ();
@@ -19,7 +19,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- _1 = {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
+ _1 = {closure@$DIR/issue_76997_inline_scopes_parenting.rs:15:13: 15:16};
StorageLive(_2);
_2 = &_1;
StorageLive(_3);
diff --git a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs
index 76d806acc..2fb363c19 100644
--- a/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs
+++ b/tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs
@@ -2,6 +2,16 @@
// EMIT_MIR issue_76997_inline_scopes_parenting.main.Inline.after.mir
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: scope 1 {
+ // CHECK-NEXT: debug f
+ // CHECK-NEXT: scope 2 (inlined main::{closure#0}) {
+ // CHECK-NEXT: debug x
+ // CHECK-NEXT: scope 3 {
+ // CHECK-NEXT: debug y
+ // CHECK-NEXT: }
+ // CHECK-NEXT: }
+ // CHECK-NEXT: }
let f = |x| { let y = x; y };
f(())
}
diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff
index bee01a5f9..b9f268df3 100644
--- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff
@@ -8,31 +8,37 @@
let mut _3: &fn() {foo};
let _4: fn() {foo};
let mut _5: ();
++ scope 1 (inlined hide_foo) {
++ }
bb0: {
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = hide_foo() -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
+- _4 = hide_foo() -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
_3 = &_4;
StorageLive(_5);
_5 = ();
- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable];
+- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind unreachable];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb1, unwind unreachable];
}
- bb2: {
+- bb2: {
++ bb1: {
StorageDead(_5);
StorageDead(_3);
StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind unreachable];
+- drop(_1) -> [return: bb3, unwind unreachable];
++ drop(_1) -> [return: bb2, unwind unreachable];
}
- bb3: {
+- bb3: {
++ bb2: {
return;
}
}
diff --git a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
index 5a946712e..8495164df 100644
--- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
@@ -8,39 +8,48 @@
let mut _3: &fn() {foo};
let _4: fn() {foo};
let mut _5: ();
++ scope 1 (inlined hide_foo) {
++ }
bb0: {
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = hide_foo() -> [return: bb1, unwind: bb4];
- }
-
- bb1: {
+- _4 = hide_foo() -> [return: bb1, unwind: bb4];
+- }
+-
+- bb1: {
_3 = &_4;
StorageLive(_5);
_5 = ();
- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4];
+- _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb2, unwind: bb4];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb1, unwind: bb3];
}
- bb2: {
+- bb2: {
++ bb1: {
StorageDead(_5);
StorageDead(_3);
StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind: bb5];
+- drop(_1) -> [return: bb3, unwind: bb5];
++ drop(_1) -> [return: bb2, unwind: bb4];
}
- bb3: {
+- bb3: {
++ bb2: {
return;
}
- bb4 (cleanup): {
- drop(_1) -> [return: bb5, unwind terminate(cleanup)];
+- bb4 (cleanup): {
+- drop(_1) -> [return: bb5, unwind terminate(cleanup)];
++ bb3 (cleanup): {
++ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
- bb5 (cleanup): {
+- bb5 (cleanup): {
++ bb4 (cleanup): {
resume;
}
}
diff --git a/tests/mir-opt/inline/issue_78442.rs b/tests/mir-opt/inline/issue_78442.rs
index d956e6241..f9a523428 100644
--- a/tests/mir-opt/inline/issue_78442.rs
+++ b/tests/mir-opt/inline/issue_78442.rs
@@ -8,6 +8,11 @@ pub fn bar<P>(
// Error won't happen if "bar" is not generic
_baz: P,
) {
+ // CHECK-LABEL: fn bar(
+ // CHECK: let mut {{.*}}: &fn() {foo};
+ // CHECK: let {{.*}}: fn() {foo};
+ // CHECK: (inlined hide_foo)
+ // CHECK-NOT: inlined
hide_foo()();
}
diff --git a/tests/mir-opt/inline/polymorphic_recursion.rs b/tests/mir-opt/inline/polymorphic_recursion.rs
index 7388722b7..f71e382e8 100644
--- a/tests/mir-opt/inline/polymorphic_recursion.rs
+++ b/tests/mir-opt/inline/polymorphic_recursion.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Make sure that the MIR inliner does not loop indefinitely on polymorphic recursion.
// compile-flags: --crate-type lib
diff --git a/tests/mir-opt/inline/unchecked_shifts.rs b/tests/mir-opt/inline/unchecked_shifts.rs
index 22f84e44a..0de80641c 100644
--- a/tests/mir-opt/inline/unchecked_shifts.rs
+++ b/tests/mir-opt/inline/unchecked_shifts.rs
@@ -1,6 +1,6 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![crate_type = "lib"]
-#![feature(unchecked_math)]
+#![feature(unchecked_shifts)]
// ignore-debug: the debug assertions prevent the inlining we are testing for
// compile-flags: -Zmir-opt-level=2 -Zinline-mir
@@ -8,23 +8,31 @@
// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
pub unsafe fn unchecked_shl_unsigned_smaller(a: u16, b: u32) -> u16 {
+ // CHECK-LABEL: fn unchecked_shl_unsigned_smaller(
+ // CHECK: (inlined core::num::<impl u16>::unchecked_shl)
a.unchecked_shl(b)
}
// EMIT_MIR unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
// EMIT_MIR unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
pub unsafe fn unchecked_shr_signed_smaller(a: i16, b: u32) -> i16 {
+ // CHECK-LABEL: fn unchecked_shr_signed_smaller(
+ // CHECK: (inlined core::num::<impl i16>::unchecked_shr)
a.unchecked_shr(b)
}
// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.diff
// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.mir
pub unsafe fn unchecked_shl_unsigned_bigger(a: u64, b: u32) -> u64 {
+ // CHECK-LABEL: fn unchecked_shl_unsigned_bigger(
+ // CHECK: (inlined core::num::<impl u64>::unchecked_shl)
a.unchecked_shl(b)
}
// EMIT_MIR unchecked_shifts.unchecked_shr_signed_bigger.Inline.diff
// EMIT_MIR unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.mir
pub unsafe fn unchecked_shr_signed_bigger(a: i64, b: u32) -> i64 {
+ // CHECK-LABEL: fn unchecked_shr_signed_bigger(
+ // CHECK: (inlined core::num::<impl i64>::unchecked_shr)
a.unchecked_shr(b)
}
diff --git a/tests/mir-opt/inline/unit_test.rs b/tests/mir-opt/inline/unit_test.rs
new file mode 100644
index 000000000..0d877bb10
--- /dev/null
+++ b/tests/mir-opt/inline/unit_test.rs
@@ -0,0 +1,19 @@
+// Check that `-Zmir-enable-passes=+Inline` does not ICE because of stolen MIR.
+// unit-test: Inline
+// skip-filecheck
+#![crate_type = "lib"]
+
+// Randomize `def_path_hash` by defining them under a module with different names
+macro_rules! emit {
+ ($($m:ident)*) => {$(
+ pub mod $m {
+ pub fn main() {
+ let func = || 123u8;
+ func();
+ }
+ }
+ )*};
+}
+
+// Increase the chance of triggering the bug
+emit!(m00 m01 m02 m03 m04 m05 m06 m07 m08 m09 m10 m11 m12 m13 m14 m15 m16 m17 m18 m19);
diff --git a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
index ab81f7071..37083973f 100644
--- a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
+++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
@@ -6,24 +6,18 @@
let mut _0: ();
let _2: ();
let mut _3: std::boxed::Box<[i32]>;
- let mut _4: &mut std::boxed::Box<[i32]>;
- let mut _5: ();
- let mut _6: &mut std::boxed::Box<[i32]>;
- let mut _7: ();
- let mut _8: &mut std::boxed::Box<[i32]>;
- let mut _9: ();
- let mut _10: *const [i32];
+ let mut _4: *const [i32];
bb0: {
StorageLive(_2);
StorageLive(_3);
_3 = move _1;
- _10 = (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]);
- _2 = callee(move (*_10)) -> [return: bb3, unwind: bb4];
+ _4 = (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]);
+ _2 = callee(move (*_4)) -> [return: bb1, unwind: bb3];
}
- bb1 (cleanup): {
- resume;
+ bb1: {
+ drop(_3) -> [return: bb2, unwind: bb4];
}
bb2: {
@@ -33,14 +27,12 @@
return;
}
- bb3: {
- _4 = &mut _3;
- _5 = <Box<[i32]> as Drop>::drop(move _4) -> [return: bb2, unwind: bb1];
+ bb3 (cleanup): {
+ drop(_3) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
- _8 = &mut _3;
- _9 = <Box<[i32]> as Drop>::drop(move _8) -> [return: bb1, unwind terminate(cleanup)];
+ resume;
}
}
diff --git a/tests/mir-opt/inline/unsized_argument.rs b/tests/mir-opt/inline/unsized_argument.rs
index b2c51407f..e8c2bc10b 100644
--- a/tests/mir-opt/inline/unsized_argument.rs
+++ b/tests/mir-opt/inline/unsized_argument.rs
@@ -6,6 +6,8 @@ fn callee(y: [i32]) {}
// EMIT_MIR unsized_argument.caller.Inline.diff
fn caller(x: Box<[i32]>) {
+ // CHECK-LABEL: fn caller(
+ // CHECK-NOT: (inlined callee)
callee(*x);
}
diff --git a/tests/mir-opt/inline/unwrap_unchecked.rs b/tests/mir-opt/inline/unwrap_unchecked.rs
index f28aef7a8..be133706e 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.rs
+++ b/tests/mir-opt/inline/unwrap_unchecked.rs
@@ -7,5 +7,7 @@
// EMIT_MIR unwrap_unchecked.unwrap_unchecked.Inline.diff
// EMIT_MIR unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir
pub unsafe fn unwrap_unchecked<T>(slf: Option<T>) -> T {
+ // CHECK-LABEL: fn unwrap_unchecked(
+ // CHECK: (inlined #[track_caller] Option::<T>::unwrap_unchecked)
slf.unwrap_unchecked()
}
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff
index e3c573473..2a36ad923 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff
@@ -9,6 +9,7 @@
+ debug self => _2;
+ let mut _3: &std::option::Option<T>;
+ let mut _4: isize;
++ let mut _5: bool;
+ scope 2 {
+ debug val => _0;
+ }
@@ -29,17 +30,18 @@
StorageLive(_2);
_2 = move _1;
- _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind unreachable];
+- }
+-
+- bb1: {
+ StorageLive(_3);
++ StorageLive(_4);
++ StorageLive(_5);
+ _4 = discriminant(_2);
-+ switchInt(move _4) -> [1: bb2, otherwise: bb1];
- }
-
- bb1: {
-+ unreachable;
-+ }
-+
-+ bb2: {
++ _5 = Eq(_4, const 1_isize);
++ assume(move _5);
+ _0 = move ((_2 as Some).0: T);
++ StorageDead(_5);
++ StorageDead(_4);
+ StorageDead(_3);
StorageDead(_2);
return;
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff
index fc638cb3a..14c8c671d 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff
@@ -9,6 +9,7 @@
+ debug self => _2;
+ let mut _3: &std::option::Option<T>;
+ let mut _4: isize;
++ let mut _5: bool;
+ scope 2 {
+ debug val => _0;
+ }
@@ -29,24 +30,25 @@
StorageLive(_2);
_2 = move _1;
- _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2];
+- }
+-
+- bb1: {
+ StorageLive(_3);
++ StorageLive(_4);
++ StorageLive(_5);
+ _4 = discriminant(_2);
-+ switchInt(move _4) -> [1: bb2, otherwise: bb1];
- }
-
- bb1: {
-- StorageDead(_2);
-- return;
-+ unreachable;
- }
-
-- bb2 (cleanup): {
-- resume;
-+ bb2: {
++ _5 = Eq(_4, const 1_isize);
++ assume(move _5);
+ _0 = move ((_2 as Some).0: T);
++ StorageDead(_5);
++ StorageDead(_4);
+ StorageDead(_3);
-+ StorageDead(_2);
-+ return;
+ StorageDead(_2);
+ return;
+- }
+-
+- bb2 (cleanup): {
+- resume;
}
}
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir
index fcc4d43ce..aeb93bd33 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir
@@ -6,7 +6,8 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
debug self => _1;
let mut _2: isize;
- let mut _3: &std::option::Option<T>;
+ let mut _3: bool;
+ let mut _4: &std::option::Option<T>;
scope 2 {
debug val => _0;
}
@@ -19,23 +20,21 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
}
}
scope 4 (inlined Option::<T>::is_some) {
- debug self => _3;
+ debug self => _4;
}
}
bb0: {
+ StorageLive(_4);
+ StorageLive(_2);
StorageLive(_3);
_2 = discriminant(_1);
- switchInt(move _2) -> [1: bb1, otherwise: bb2];
- }
-
- bb1: {
+ _3 = Eq(_2, const 1_isize);
+ assume(move _3);
_0 = move ((_1 as Some).0: T);
StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_4);
return;
}
-
- bb2: {
- unreachable;
- }
}
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir
index fcc4d43ce..aeb93bd33 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir
@@ -6,7 +6,8 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
debug self => _1;
let mut _2: isize;
- let mut _3: &std::option::Option<T>;
+ let mut _3: bool;
+ let mut _4: &std::option::Option<T>;
scope 2 {
debug val => _0;
}
@@ -19,23 +20,21 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
}
}
scope 4 (inlined Option::<T>::is_some) {
- debug self => _3;
+ debug self => _4;
}
}
bb0: {
+ StorageLive(_4);
+ StorageLive(_2);
StorageLive(_3);
_2 = discriminant(_1);
- switchInt(move _2) -> [1: bb1, otherwise: bb2];
- }
-
- bb1: {
+ _3 = Eq(_2, const 1_isize);
+ assume(move _3);
_0 = move ((_1 as Some).0: T);
StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_4);
return;
}
-
- bb2: {
- unreachable;
- }
}
diff --git a/tests/mir-opt/inline_generically_if_sized.rs b/tests/mir-opt/inline_generically_if_sized.rs
index 1acfff7a5..1a7512a4b 100644
--- a/tests/mir-opt/inline_generically_if_sized.rs
+++ b/tests/mir-opt/inline_generically_if_sized.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Inline
// compile-flags: --crate-type=lib -C panic=abort
diff --git a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff
index afcfde09c..1ef6b69ef 100644
--- a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff
+++ b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff
@@ -4,8 +4,10 @@
fn bar() -> bool {
let mut _0: bool;
++ coverage Counter(0) => /the/src/instrument_coverage.rs:21:1 - 23:2;
++
bb0: {
-+ Coverage::Counter(0) for /the/src/instrument_coverage.rs:20:1 - 22:2;
++ Coverage::CounterIncrement(0);
_0 = const true;
return;
}
diff --git a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff
index e17c6ddc5..14b4833a5 100644
--- a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff
+++ b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff
@@ -7,13 +7,21 @@
let mut _2: bool;
let mut _3: !;
++ coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Add, rhs: Counter(1) };
++ coverage ExpressionId(1) => Expression { lhs: Expression(0), op: Subtract, rhs: Counter(1) };
++ coverage Counter(0) => /the/src/instrument_coverage.rs:12:1 - 12:11;
++ coverage Expression(0) => /the/src/instrument_coverage.rs:13:5 - 14:17;
++ coverage Expression(1) => /the/src/instrument_coverage.rs:15:13 - 15:18;
++ coverage Expression(1) => /the/src/instrument_coverage.rs:18:1 - 18:2;
++ coverage Counter(1) => /the/src/instrument_coverage.rs:16:10 - 16:11;
++
bb0: {
-+ Coverage::Counter(0) for /the/src/instrument_coverage.rs:11:1 - 11:11;
++ Coverage::CounterIncrement(0);
goto -> bb1;
}
bb1: {
-+ Coverage::Expression(0) = Counter(0) + Counter(1) for /the/src/instrument_coverage.rs:12:5 - 13:17;
++ Coverage::ExpressionUsed(0);
falseUnwind -> [real: bb2, unwind: bb6];
}
@@ -27,15 +35,14 @@
}
bb4: {
-+ Coverage::Expression(2) = Expression(1) + Zero for /the/src/instrument_coverage.rs:17:1 - 17:2;
-+ Coverage::Expression(1) = Expression(0) - Counter(1) for /the/src/instrument_coverage.rs:14:13 - 14:18;
++ Coverage::ExpressionUsed(1);
_0 = const ();
StorageDead(_2);
return;
}
bb5: {
-+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:15:10 - 15:11;
++ Coverage::CounterIncrement(1);
_1 = const ();
StorageDead(_2);
goto -> bb1;
diff --git a/tests/mir-opt/instrument_coverage.rs b/tests/mir-opt/instrument_coverage.rs
index 7f6a0a0eb..f131fc0a3 100644
--- a/tests/mir-opt/instrument_coverage.rs
+++ b/tests/mir-opt/instrument_coverage.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that `-C instrument-coverage` injects Coverage statements. The Coverage Counter statements
// are later converted into LLVM instrprof.increment intrinsics, during codegen.
diff --git a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff
index 034d5e440..5c09963d4 100644
--- a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff
@@ -1,7 +1,7 @@
-- // MIR for `opt3` before InstSimplify
-+ // MIR for `opt3` after InstSimplify
+- // MIR for `eq_false` before InstSimplify
++ // MIR for `eq_false` after InstSimplify
- fn opt3(_1: bool) -> u32 {
+ fn eq_false(_1: bool) -> u32 {
debug x => _1;
let mut _0: u32;
let mut _2: bool;
diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff
new file mode 100644
index 000000000..a80133b0e
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `eq_true` before InstSimplify
++ // MIR for `eq_true` after InstSimplify
+
+ fn eq_true(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(move _3, const true);
++ _2 = move _3;
+ switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ _0 = const 0_u32;
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageDead(_3);
+ _0 = const 1_u32;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff
index d3096da6c..8235d5263 100644
--- a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff
@@ -1,7 +1,7 @@
-- // MIR for `opt4` before InstSimplify
-+ // MIR for `opt4` after InstSimplify
+- // MIR for `false_eq` before InstSimplify
++ // MIR for `false_eq` after InstSimplify
- fn opt4(_1: bool) -> u32 {
+ fn false_eq(_1: bool) -> u32 {
debug x => _1;
let mut _0: u32;
let mut _2: bool;
diff --git a/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff
new file mode 100644
index 000000000..77d076c6c
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `false_ne` before InstSimplify
++ // MIR for `false_ne` after InstSimplify
+
+ fn false_ne(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Ne(const false, move _3);
++ _2 = move _3;
+ switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ _0 = const 0_u32;
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageDead(_3);
+ _0 = const 1_u32;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff
index 1342966aa..2362b1129 100644
--- a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff
@@ -1,7 +1,7 @@
-- // MIR for `opt` before InstSimplify
-+ // MIR for `opt` after InstSimplify
+- // MIR for `ne_false` before InstSimplify
++ // MIR for `ne_false` after InstSimplify
- fn opt(_1: bool) -> u32 {
+ fn ne_false(_1: bool) -> u32 {
debug x => _1;
let mut _0: u32;
let mut _2: bool;
diff --git a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff
index 657c11516..6ccbd2fb7 100644
--- a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff
@@ -1,7 +1,7 @@
-- // MIR for `opt1` before InstSimplify
-+ // MIR for `opt1` after InstSimplify
+- // MIR for `ne_true` before InstSimplify
++ // MIR for `ne_true` after InstSimplify
- fn opt1(_1: bool) -> u32 {
+ fn ne_true(_1: bool) -> u32 {
debug x => _1;
let mut _0: u32;
let mut _2: bool;
diff --git a/tests/mir-opt/instsimplify/bool_compare.rs b/tests/mir-opt/instsimplify/bool_compare.rs
new file mode 100644
index 000000000..77f427b0d
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.rs
@@ -0,0 +1,68 @@
+// unit-test: InstSimplify
+
+// EMIT_MIR bool_compare.eq_true.InstSimplify.diff
+fn eq_true(x: bool) -> u32 {
+ // CHECK-LABEL: fn eq_true(
+ // CHECK-NOT: Eq(
+ if x == true { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.true_eq.InstSimplify.diff
+fn true_eq(x: bool) -> u32 {
+ // CHECK-LABEL: fn true_eq(
+ // CHECK-NOT: Eq(
+ if true == x { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.ne_true.InstSimplify.diff
+fn ne_true(x: bool) -> u32 {
+ // CHECK-LABEL: fn ne_true(
+ // CHECK: Not(
+ if x != true { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.true_ne.InstSimplify.diff
+fn true_ne(x: bool) -> u32 {
+ // CHECK-LABEL: fn true_ne(
+ // CHECK: Not(
+ if true != x { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.eq_false.InstSimplify.diff
+fn eq_false(x: bool) -> u32 {
+ // CHECK-LABEL: fn eq_false(
+ // CHECK: Not(
+ if x == false { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.false_eq.InstSimplify.diff
+fn false_eq(x: bool) -> u32 {
+ // CHECK-LABEL: fn false_eq(
+ // CHECK: Not(
+ if false == x { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.ne_false.InstSimplify.diff
+fn ne_false(x: bool) -> u32 {
+ // CHECK-LABEL: fn ne_false(
+ // CHECK-NOT: Ne(
+ if x != false { 0 } else { 1 }
+}
+
+// EMIT_MIR bool_compare.false_ne.InstSimplify.diff
+fn false_ne(x: bool) -> u32 {
+ // CHECK-LABEL: fn false_ne(
+ // CHECK-NOT: Ne(
+ if false != x { 0 } else { 1 }
+}
+
+fn main() {
+ eq_true(false);
+ true_eq(false);
+ ne_true(false);
+ true_ne(false);
+ eq_false(false);
+ false_eq(false);
+ ne_false(false);
+ false_ne(false);
+}
diff --git a/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff
new file mode 100644
index 000000000..18675329a
--- /dev/null
+++ b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff
@@ -0,0 +1,36 @@
+- // MIR for `true_eq` before InstSimplify
++ // MIR for `true_eq` after InstSimplify
+
+ fn true_eq(_1: bool) -> u32 {
+ debug x => _1;
+ let mut _0: u32;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+- _2 = Eq(const true, move _3);
++ _2 = move _3;
+ switchInt(move _2) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageDead(_3);
+ _0 = const 0_u32;
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageDead(_3);
+ _0 = const 1_u32;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff
index bc8be62bd..dc91cf8a5 100644
--- a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff
@@ -1,7 +1,7 @@
-- // MIR for `opt2` before InstSimplify
-+ // MIR for `opt2` after InstSimplify
+- // MIR for `true_ne` before InstSimplify
++ // MIR for `true_ne` after InstSimplify
- fn opt2(_1: bool) -> u32 {
+ fn true_ne(_1: bool) -> u32 {
debug x => _1;
let mut _0: u32;
let mut _2: bool;
diff --git a/tests/mir-opt/casts.redundant.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff
index f5ea78aec..9e1bce1ee 100644
--- a/tests/mir-opt/casts.redundant.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff
@@ -6,18 +6,27 @@
let mut _0: *const &u8;
let mut _2: *const &u8;
let mut _3: *const &u8;
+ let mut _4: *const &u8;
scope 1 (inlined generic_cast::<&u8, &u8>) {
- debug x => _1;
+ debug x => _4;
+ let mut _5: *const &u8;
}
bb0: {
StorageLive(_2);
StorageLive(_3);
- _3 = _1;
-- _2 = _3 as *const &u8 (PtrToPtr);
-+ _2 = _3;
- StorageDead(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_5);
+ _5 = _4;
+- _3 = move _5 as *const &u8 (PtrToPtr);
++ _3 = move _5;
+ StorageDead(_5);
+ StorageDead(_4);
+- _2 = move _3 as *const &u8 (PtrToPtr);
++ _2 = move _3;
_0 = _2;
+ StorageDead(_3);
StorageDead(_2);
return;
}
diff --git a/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff
new file mode 100644
index 000000000..a6d68cd4e
--- /dev/null
+++ b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff
@@ -0,0 +1,26 @@
+- // MIR for `roundtrip` before InstSimplify
++ // MIR for `roundtrip` after InstSimplify
+
+ fn roundtrip(_1: *const u8) -> *const u8 {
+ debug x => _1;
+ let mut _0: *const u8;
+ let mut _2: *const u8;
+ let mut _3: *mut u8;
+ let mut _4: *const u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ _2 = move _3 as *const u8 (PointerCoercion(MutToConstPointer));
+ StorageDead(_4);
+ StorageDead(_3);
+- _0 = move _2 as *const u8 (PtrToPtr);
++ _0 = move _2;
+ StorageDead(_2);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/instsimplify/casts.rs b/tests/mir-opt/instsimplify/casts.rs
new file mode 100644
index 000000000..86f9b34ea
--- /dev/null
+++ b/tests/mir-opt/instsimplify/casts.rs
@@ -0,0 +1,25 @@
+// unit-test: InstSimplify
+// compile-flags: -Zinline-mir
+#![crate_type = "lib"]
+
+#[inline(always)]
+fn generic_cast<T, U>(x: *const T) -> *const U {
+ x as *const U
+}
+
+// EMIT_MIR casts.redundant.InstSimplify.diff
+pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 {
+ // CHECK-LABEL: fn redundant(
+ // CHECK: inlined generic_cast
+ // CHECK-NOT: as
+ generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8
+}
+
+// EMIT_MIR casts.roundtrip.InstSimplify.diff
+pub fn roundtrip(x: *const u8) -> *const u8 {
+ // CHECK-LABEL: fn roundtrip(
+ // CHECK: _4 = _1;
+ // CHECK: _3 = move _4 as *mut u8 (PtrToPtr);
+ // CHECK: _2 = move _3 as *const u8 (PointerCoercion(MutToConstPointer));
+ x as *mut u8 as *const u8
+}
diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff
index 3e7d0ce51..3e7d0ce51 100644
--- a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff
+++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff
diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff
index 4833c1089..4833c1089 100644
--- a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff
+++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff
diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/instsimplify/combine_array_len.rs
index e971ab478..3b6795bc9 100644
--- a/tests/mir-opt/combine_array_len.rs
+++ b/tests/mir-opt/instsimplify/combine_array_len.rs
@@ -1,8 +1,10 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: InstSimplify
-// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
+// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
fn norm2(x: [f32; 2]) -> f32 {
+ // CHECK-LABEL: fn norm2(
+ // CHECK-NOT: Len(
let a = x[0];
let b = x[1];
a*a + b*b
diff --git a/tests/mir-opt/combine_clone_of_primitives.rs b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs
index c19f9ee10..2adbe778d 100644
--- a/tests/mir-opt/combine_clone_of_primitives.rs
+++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs
@@ -2,7 +2,6 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
-
#[derive(Clone)]
struct MyThing<T> {
v: T,
@@ -10,6 +9,11 @@ struct MyThing<T> {
a: [f32; 3],
}
+// CHECK-LABEL: ::clone(
+// CHECK: <T as Clone>::clone(
+// CHECK-NOT: <u64 as Clone>::clone(
+// CHECK-NOT: <[f32; 3] as Clone>::clone(
+
fn main() {
let x = MyThing::<i16> { v: 2, i: 3, a: [0.0; 3] };
let y = x.clone();
diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff
index 124c2dc7e..48586f8b3 100644
--- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff
+++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff
@@ -1,7 +1,7 @@
-- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` before InstSimplify
-+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` after InstSimplify
+- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify
++ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify
- fn <impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
+ fn <impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
debug self => _1;
let mut _0: MyThing<T>;
let mut _2: T;
diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
index f2b87221f..a57266e9c 100644
--- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
+++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff
@@ -1,7 +1,7 @@
-- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` before InstSimplify
-+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` after InstSimplify
+- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify
++ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify
- fn <impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
+ fn <impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
debug self => _1;
let mut _0: MyThing<T>;
let mut _2: T;
diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff
index cb623e83f..cb623e83f 100644
--- a/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff
diff --git a/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff
index 58ae59190..58ae59190 100644
--- a/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff
diff --git a/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff
index 8eff802dd..8eff802dd 100644
--- a/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff
diff --git a/tests/mir-opt/combine_transmutes.rs b/tests/mir-opt/instsimplify/combine_transmutes.rs
index 403f9356c..b8e15da90 100644
--- a/tests/mir-opt/combine_transmutes.rs
+++ b/tests/mir-opt/instsimplify/combine_transmutes.rs
@@ -10,6 +10,10 @@ use std::mem::{MaybeUninit, ManuallyDrop, transmute};
// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff
pub unsafe fn identity_transmutes() {
+ // CHECK-LABEL: fn identity_transmutes(
+ // CHECK-NOT: as i32 (Transmute);
+ // CHECK-NOT: as Vec<i32> (Transmute);
+
// These are nops and should be removed
let _a = transmute::<i32, i32>(1);
let _a = transmute::<Vec<i32>, Vec<i32>>(Vec::new());
@@ -18,6 +22,16 @@ pub unsafe fn identity_transmutes() {
#[custom_mir(dialect = "runtime", phase = "initial")]
// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff
pub unsafe fn integer_transmutes() {
+ // CHECK-LABEL: fn integer_transmutes(
+ // CHECK-NOT: _i32 as u32 (Transmute);
+ // CHECK: _i32 as u32 (IntToInt);
+ // CHECK: _i32 as i64 (Transmute);
+ // CHECK-NOT: _u64 as i64 (Transmute);
+ // CHECK: _u64 as i64 (IntToInt);
+ // CHECK: _u64 as u32 (Transmute);
+ // CHECK-NOT: _isize as usize (Transmute);
+ // CHECK: _isize as usize (IntToInt);
+
mir! {
{
let A = CastTransmute::<i32, u32>(1); // Can be a cast
@@ -32,6 +46,14 @@ pub unsafe fn integer_transmutes() {
// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff
pub unsafe fn adt_transmutes() {
+ // CHECK-LABEL: fn adt_transmutes(
+ // CHECK: as u8 (Transmute);
+ // CHECK: ({{_.*}}.0: i16);
+ // CHECK: as u16 (Transmute);
+ // CHECK: as u32 (Transmute);
+ // CHECK: as i32 (Transmute);
+ // CHECK: ({{_.*}}.1: std::mem::ManuallyDrop<std::string::String>);
+
let _a: u8 = transmute(Some(std::num::NonZeroU8::MAX));
let _a: i16 = transmute(std::num::Wrapping(0_i16));
let _a: u16 = transmute(std::num::Wrapping(0_i16));
diff --git a/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff
index e2b45c882..e2b45c882 100644
--- a/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff
diff --git a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs
index 3e280a40f..e40bc7eda 100644
--- a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs
+++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs
@@ -1,13 +1,15 @@
+// unit-test: InstSimplify
+
#![feature(custom_mir, core_intrinsics)]
#![crate_type = "lib"]
use std::intrinsics::mir::*;
-// unit-test: InstSimplify
-
-// EMIT_MIR instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff
+// EMIT_MIR duplicate_switch_targets.assert_zero.InstSimplify.diff
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
pub unsafe fn assert_zero(x: u8) -> u8 {
+ // CHECK-LABEL: fn assert_zero(
+ // CHECK: switchInt({{.*}}) -> [0: {{bb.*}}, otherwise: {{bb.*}}]
mir!(
{
match x {
diff --git a/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff
index efa52798e..2ecacb5e3 100644
--- a/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic.InstSimplify.diff
@@ -8,25 +8,25 @@
let _3: ();
bb0: {
- nop;
+ StorageLive(_1);
_1 = assert_inhabited::<T>() -> [return: bb1, unwind unreachable];
}
bb1: {
- nop;
- nop;
+ StorageDead(_1);
+ StorageLive(_2);
_2 = assert_zero_valid::<T>() -> [return: bb2, unwind unreachable];
}
bb2: {
- nop;
- nop;
+ StorageDead(_2);
+ StorageLive(_3);
_3 = assert_mem_uninitialized_valid::<T>() -> [return: bb3, unwind unreachable];
}
bb3: {
- nop;
- nop;
+ StorageDead(_3);
+ _0 = const ();
return;
}
}
diff --git a/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff
index 98d9d24af..d29af0945 100644
--- a/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.generic_ref.InstSimplify.diff
@@ -1,7 +1,7 @@
-- // MIR for `generic` before InstSimplify
-+ // MIR for `generic` after InstSimplify
+- // MIR for `generic_ref` before InstSimplify
++ // MIR for `generic_ref` after InstSimplify
- fn generic() -> () {
+ fn generic_ref() -> () {
let mut _0: ();
let _1: ();
diff --git a/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff
index 46e053378..1be386acf 100644
--- a/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff
@@ -8,28 +8,28 @@
let _3: ();
bb0: {
- nop;
+ StorageLive(_1);
- _1 = assert_inhabited::<Never>() -> [return: bb1, unwind unreachable];
+ _1 = assert_inhabited::<Never>() -> unwind unreachable;
}
bb1: {
- nop;
- nop;
+ StorageDead(_1);
+ StorageLive(_2);
- _2 = assert_zero_valid::<&u8>() -> [return: bb2, unwind unreachable];
+ _2 = assert_zero_valid::<&u8>() -> unwind unreachable;
}
bb2: {
- nop;
- nop;
+ StorageDead(_2);
+ StorageLive(_3);
- _3 = assert_mem_uninitialized_valid::<&u8>() -> [return: bb3, unwind unreachable];
+ _3 = assert_mem_uninitialized_valid::<&u8>() -> unwind unreachable;
}
bb3: {
- nop;
- nop;
+ StorageDead(_3);
+ _0 = const ();
return;
}
}
diff --git a/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff
index 70c3e8830..f2e697838 100644
--- a/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff
@@ -8,28 +8,28 @@
let _3: ();
bb0: {
- nop;
+ StorageLive(_1);
- _1 = assert_inhabited::<()>() -> [return: bb1, unwind unreachable];
+ goto -> bb1;
}
bb1: {
- nop;
- nop;
+ StorageDead(_1);
+ StorageLive(_2);
- _2 = assert_zero_valid::<u8>() -> [return: bb2, unwind unreachable];
+ goto -> bb2;
}
bb2: {
- nop;
- nop;
+ StorageDead(_2);
+ StorageLive(_3);
- _3 = assert_mem_uninitialized_valid::<u8>() -> [return: bb3, unwind unreachable];
+ goto -> bb3;
}
bb3: {
- nop;
- nop;
+ StorageDead(_3);
+ _0 = const ();
return;
}
}
diff --git a/tests/mir-opt/intrinsic_asserts.rs b/tests/mir-opt/instsimplify/intrinsic_asserts.rs
index 302d4bda1..43998b2db 100644
--- a/tests/mir-opt/intrinsic_asserts.rs
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.rs
@@ -1,9 +1,15 @@
+// unit-test: InstSimplify
+
#![crate_type = "lib"]
#![feature(core_intrinsics)]
// All these assertions pass, so all the intrinsic calls should be deleted.
// EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff
pub fn removable() {
+ // CHECK-LABEL: fn removable(
+ // CHECK-NOT: assert_inhabited
+ // CHECK-NOT: assert_zero_valid
+ // CHECK-NOT: assert_mem_uninitialized_valid
core::intrinsics::assert_inhabited::<()>();
core::intrinsics::assert_zero_valid::<u8>();
core::intrinsics::assert_mem_uninitialized_valid::<u8>();
@@ -14,6 +20,10 @@ enum Never {}
// These assertions all diverge, so their target blocks should become None.
// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff
pub fn panics() {
+ // CHECK-LABEL: fn panics(
+ // CHECK: assert_inhabited::<Never>() -> unwind
+ // CHECK: assert_zero_valid::<&u8>() -> unwind
+ // CHECK: assert_mem_uninitialized_valid::<&u8>() -> unwind
core::intrinsics::assert_inhabited::<Never>();
core::intrinsics::assert_zero_valid::<&u8>();
core::intrinsics::assert_mem_uninitialized_valid::<&u8>();
@@ -22,7 +32,19 @@ pub fn panics() {
// Whether or not these asserts pass isn't known, so they shouldn't be modified.
// EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff
pub fn generic<T>() {
+ // CHECK-LABEL: fn generic(
+ // CHECK: assert_inhabited::<T>() -> [return:
+ // CHECK: assert_zero_valid::<T>() -> [return:
+ // CHECK: assert_mem_uninitialized_valid::<T>() -> [return:
core::intrinsics::assert_inhabited::<T>();
core::intrinsics::assert_zero_valid::<T>();
core::intrinsics::assert_mem_uninitialized_valid::<T>();
}
+
+// Whether or not these asserts pass isn't known, so they shouldn't be modified.
+// EMIT_MIR intrinsic_asserts.generic_ref.InstSimplify.diff
+pub fn generic_ref<T>() {
+ // CHECK-LABEL: fn generic_ref(
+ // CHECK: assert_mem_uninitialized_valid::<&T>() -> [return:
+ core::intrinsics::assert_mem_uninitialized_valid::<&T>();
+}
diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
index ce490e894..3748d1483 100644
--- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
@@ -33,6 +33,7 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
+ _4 = const 0_u32;
StorageLive(_15);
StorageLive(_14);
_14 = Shr(_1, const 0_i32);
diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
index 254557b99..9dab4233c 100644
--- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
@@ -33,6 +33,7 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
+ _4 = const 0_u32;
StorageLive(_15);
StorageLive(_14);
_14 = Shr(_1, const 0_i32);
diff --git a/tests/mir-opt/issue_101973.rs b/tests/mir-opt/issue_101973.rs
index 01b342f4d..3de325bc1 100644
--- a/tests/mir-opt/issue_101973.rs
+++ b/tests/mir-opt/issue_101973.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -O -C debug-assertions=on
// This needs inlining followed by ConstProp to reproduce, so we cannot use "unit-test".
diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.rs b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs
index 54112627e..cd068f122 100644
--- a/tests/mir-opt/issue_104451_unwindable_intrinsics.rs
+++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Check that `UnwindAction::Unreachable` is not generated for unwindable intrinsics.
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(core_intrinsics)]
diff --git a/tests/mir-opt/issue_38669.rs b/tests/mir-opt/issue_38669.rs
index db3f89472..9da4c89bb 100644
--- a/tests/mir-opt/issue_38669.rs
+++ b/tests/mir-opt/issue_38669.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// check that we don't StorageDead booleans before they are used
// EMIT_MIR issue_38669.main.SimplifyCfg-initial.after.mir
diff --git a/tests/mir-opt/issue_41110.rs b/tests/mir-opt/issue_41110.rs
index d8665b23d..38602d5ea 100644
--- a/tests/mir-opt/issue_41110.rs
+++ b/tests/mir-opt/issue_41110.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// check that we don't emit multiple drop flags when they are not needed.
diff --git a/tests/mir-opt/issue_41697.rs b/tests/mir-opt/issue_41697.rs
index cbd8633a3..92d382c39 100644
--- a/tests/mir-opt/issue_41697.rs
+++ b/tests/mir-opt/issue_41697.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Regression test for #41697. Using dump-mir was triggering
// artificial cycles: during type-checking, we had to get the MIR for
// the constant expressions in `[u8; 2]`, which in turn would trigger
diff --git a/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir b/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir
index 0b48e58da..7dafeabaa 100644
--- a/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir
+++ b/tests/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/issue_41697.rs:18:1: 18:23>::{constant#0}` after SimplifyCfg-promote-consts
+// MIR for `<impl at $DIR/issue_41697.rs:19:1: 19:23>::{constant#0}` after SimplifyCfg-promote-consts
-<impl at $DIR/issue_41697.rs:18:1: 18:23>::{constant#0}: usize = {
+<impl at $DIR/issue_41697.rs:19:1: 19:23>::{constant#0}: usize = {
let mut _0: usize;
let mut _1: (usize, bool);
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
index b57fe348c..55d2629a5 100644
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
@@ -10,9 +10,8 @@
let mut _5: isize;
+ let mut _7: bool;
+ let mut _8: bool;
-+ let mut _9: bool;
++ let mut _9: isize;
+ let mut _10: isize;
-+ let mut _11: isize;
scope 1 {
debug e => _1;
scope 2 {
@@ -24,7 +23,6 @@
bb0: {
+ _7 = const false;
+ _8 = const false;
-+ _9 = const false;
StorageLive(_1);
StorageLive(_2);
_2 = cond() -> [return: bb1, unwind: bb11];
@@ -47,7 +45,6 @@
bb3: {
+ _7 = const true;
+ _8 = const true;
-+ _9 = const true;
_1 = move _3;
- drop(_3) -> [return: bb5, unwind: bb11];
+ goto -> bb5;
@@ -56,7 +53,6 @@
bb4 (cleanup): {
+ _7 = const true;
+ _8 = const true;
-+ _9 = const true;
_1 = move _3;
- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
+ goto -> bb11;
@@ -64,13 +60,13 @@
bb5: {
StorageDead(_3);
+ PlaceMention(_1);
_5 = discriminant(_1);
switchInt(move _5) -> [0: bb6, otherwise: bb7];
}
bb6: {
StorageLive(_6);
-+ _9 = const false;
_6 = move ((_1 as F).0: K);
_0 = const ();
StorageDead(_6);
@@ -90,13 +86,12 @@
bb9: {
StorageDead(_2);
- drop(_1) -> [return: bb10, unwind: bb12];
-+ goto -> bb18;
++ goto -> bb19;
}
bb10: {
+ _7 = const false;
+ _8 = const false;
-+ _9 = const false;
StorageDead(_1);
return;
}
@@ -116,33 +111,37 @@
+ }
+
+ bb14 (cleanup): {
-+ goto -> bb12;
++ drop(((_1 as F).0: K)) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
-+ bb15: {
-+ drop(_1) -> [return: bb13, unwind: bb12];
++ bb15 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb14];
+ }
+
-+ bb16 (cleanup): {
-+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
++ bb16: {
++ drop(_1) -> [return: bb13, unwind: bb12];
+ }
+
-+ bb17: {
-+ _10 = discriminant(_1);
-+ switchInt(move _10) -> [0: bb13, otherwise: bb15];
++ bb17 (cleanup): {
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb18: {
-+ switchInt(_7) -> [0: bb13, otherwise: bb17];
++ _9 = discriminant(_1);
++ switchInt(move _9) -> [0: bb13, otherwise: bb16];
+ }
+
-+ bb19 (cleanup): {
-+ _11 = discriminant(_1);
-+ switchInt(move _11) -> [0: bb14, otherwise: bb16];
++ bb19: {
++ switchInt(_7) -> [0: bb13, otherwise: bb18];
+ }
+
+ bb20 (cleanup): {
-+ switchInt(_7) -> [0: bb12, otherwise: bb19];
++ _10 = discriminant(_1);
++ switchInt(move _10) -> [0: bb15, otherwise: bb17];
++ }
++
++ bb21 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb20];
}
}
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
index 2156850e3..c731b5646 100644
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
@@ -10,9 +10,8 @@
let mut _5: isize;
+ let mut _7: bool;
+ let mut _8: bool;
-+ let mut _9: bool;
++ let mut _9: isize;
+ let mut _10: isize;
-+ let mut _11: isize;
scope 1 {
debug e => _1;
scope 2 {
@@ -24,7 +23,6 @@
bb0: {
+ _7 = const false;
+ _8 = const false;
-+ _9 = const false;
StorageLive(_1);
StorageLive(_2);
_2 = cond() -> [return: bb1, unwind: bb11];
@@ -47,7 +45,6 @@
bb3: {
+ _7 = const true;
+ _8 = const true;
-+ _9 = const true;
_1 = move _3;
- drop(_3) -> [return: bb5, unwind: bb11];
+ goto -> bb5;
@@ -56,7 +53,6 @@
bb4 (cleanup): {
+ _7 = const true;
+ _8 = const true;
-+ _9 = const true;
_1 = move _3;
- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
+ goto -> bb11;
@@ -64,13 +60,13 @@
bb5: {
StorageDead(_3);
+ PlaceMention(_1);
_5 = discriminant(_1);
switchInt(move _5) -> [0: bb6, otherwise: bb7];
}
bb6: {
StorageLive(_6);
-+ _9 = const false;
_6 = move ((_1 as F).0: K);
_0 = const ();
StorageDead(_6);
@@ -90,13 +86,12 @@
bb9: {
StorageDead(_2);
- drop(_1) -> [return: bb10, unwind continue];
-+ goto -> bb18;
++ goto -> bb19;
}
bb10: {
+ _7 = const false;
+ _8 = const false;
-+ _9 = const false;
StorageDead(_1);
return;
}
@@ -116,33 +111,37 @@
+ }
+
+ bb14 (cleanup): {
-+ goto -> bb12;
++ drop(((_1 as F).0: K)) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
-+ bb15: {
-+ drop(_1) -> [return: bb13, unwind: bb12];
++ bb15 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb14];
+ }
+
-+ bb16 (cleanup): {
-+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
++ bb16: {
++ drop(_1) -> [return: bb13, unwind: bb12];
+ }
+
-+ bb17: {
-+ _10 = discriminant(_1);
-+ switchInt(move _10) -> [0: bb13, otherwise: bb15];
++ bb17 (cleanup): {
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb18: {
-+ switchInt(_7) -> [0: bb13, otherwise: bb17];
++ _9 = discriminant(_1);
++ switchInt(move _9) -> [0: bb13, otherwise: bb16];
+ }
+
-+ bb19 (cleanup): {
-+ _11 = discriminant(_1);
-+ switchInt(move _11) -> [0: bb14, otherwise: bb16];
++ bb19: {
++ switchInt(_7) -> [0: bb13, otherwise: bb18];
+ }
+
+ bb20 (cleanup): {
-+ switchInt(_7) -> [0: bb12, otherwise: bb19];
++ _10 = discriminant(_1);
++ switchInt(move _10) -> [0: bb15, otherwise: bb17];
++ }
++
++ bb21 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb20];
}
}
diff --git a/tests/mir-opt/issue_41888.rs b/tests/mir-opt/issue_41888.rs
index 9b16caf92..70b202186 100644
--- a/tests/mir-opt/issue_41888.rs
+++ b/tests/mir-opt/issue_41888.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// check that we clear the "ADT master drop flag" even when there are
// no fields to be dropped.
diff --git a/tests/mir-opt/issue_62289.rs b/tests/mir-opt/issue_62289.rs
index fece6bb7c..40e8352cf 100644
--- a/tests/mir-opt/issue_62289.rs
+++ b/tests/mir-opt/issue_62289.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// check that we don't forget to drop the Box if we early return before
// initializing it
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
index 734629678..fadfdfc87 100644
--- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
@@ -45,6 +45,7 @@ fn test() -> Option<Box<u32>> {
bb2: {
StorageDead(_7);
+ PlaceMention(_6);
_8 = discriminant(_6);
switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4];
}
diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
index 8264e2cab..8f94165a1 100644
--- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
@@ -45,6 +45,7 @@ fn test() -> Option<Box<u32>> {
bb2: {
StorageDead(_7);
+ PlaceMention(_6);
_8 = discriminant(_6);
switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4];
}
diff --git a/tests/mir-opt/issue_72181.rs b/tests/mir-opt/issue_72181.rs
index 6a32d4bbe..226709bab 100644
--- a/tests/mir-opt/issue_72181.rs
+++ b/tests/mir-opt/issue_72181.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=1
// Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags.
diff --git a/tests/mir-opt/issue_72181_1.f.built.after.mir b/tests/mir-opt/issue_72181_1.f.built.after.mir
index 16f34e4a4..89da9a801 100644
--- a/tests/mir-opt/issue_72181_1.f.built.after.mir
+++ b/tests/mir-opt/issue_72181_1.f.built.after.mir
@@ -5,6 +5,7 @@ fn f(_1: Void) -> ! {
let mut _0: !;
bb0: {
+ PlaceMention(_1);
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
diff --git a/tests/mir-opt/issue_72181_1.main.built.after.mir b/tests/mir-opt/issue_72181_1.main.built.after.mir
index f5ab5b526..d35aada95 100644
--- a/tests/mir-opt/issue_72181_1.main.built.after.mir
+++ b/tests/mir-opt/issue_72181_1.main.built.after.mir
@@ -1,8 +1,8 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void
-| 1: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:16:12: 16:16, inferred_ty: Void
+| 0: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:17:12: 17:16, inferred_ty: Void
+| 1: user_ty: Canonical { value: Ty(Void), max_universe: U0, variables: [] }, span: $DIR/issue_72181_1.rs:17:12: 17:16, inferred_ty: Void
|
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/issue_72181_1.rs b/tests/mir-opt/issue_72181_1.rs
index 8ae2599ec..f9ee33ef9 100644
--- a/tests/mir-opt/issue_72181_1.rs
+++ b/tests/mir-opt/issue_72181_1.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=1
// Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags.
diff --git a/tests/mir-opt/issue_76432.rs b/tests/mir-opt/issue_76432.rs
index 2a8e1283b..f0f12c535 100644
--- a/tests/mir-opt/issue_76432.rs
+++ b/tests/mir-opt/issue_76432.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Zmir-enable-passes=-NormalizeArrayLen
// Check that we do not insert StorageDead at each target if StorageDead was never seen
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
index 9d8f272ab..b2539f391 100644
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
@@ -7,22 +7,18 @@
let _2: &[T];
let mut _3: &[T; 3];
let _4: [T; 3];
- let mut _5: T;
- let mut _6: T;
- let mut _7: T;
- let mut _8: usize;
- let mut _9: usize;
- let mut _10: bool;
- let mut _14: !;
+ let mut _5: usize;
+ let mut _6: bool;
+ let mut _10: !;
scope 1 {
debug v => _2;
- let _11: &T;
- let _12: &T;
- let _13: &T;
+ let _7: &T;
+ let _8: &T;
+ let _9: &T;
scope 2 {
- debug v1 => _11;
- debug v2 => _12;
- debug v3 => _13;
+ debug v1 => _7;
+ debug v2 => _8;
+ debug v3 => _9;
}
}
@@ -33,26 +29,25 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
- _8 = const 3_usize;
- _9 = const 3_usize;
- _10 = const true;
+ _5 = const 3_usize;
+ _6 = const true;
goto -> bb2;
}
bb1: {
- _14 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable;
+ _10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable;
}
bb2: {
- StorageLive(_11);
- _11 = &(*_2)[0 of 3];
- StorageLive(_12);
- _12 = &(*_2)[1 of 3];
- StorageLive(_13);
- _13 = &(*_2)[2 of 3];
- StorageDead(_13);
- StorageDead(_12);
- StorageDead(_11);
+ StorageLive(_7);
+ _7 = &(*_2)[0 of 3];
+ StorageLive(_8);
+ _8 = &(*_2)[1 of 3];
+ StorageLive(_9);
+ _9 = &(*_2)[2 of 3];
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
return;
}
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
index 738b0b1b3..ff7f12c09 100644
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
@@ -7,22 +7,18 @@
let _2: &[T];
let mut _3: &[T; 3];
let _4: [T; 3];
- let mut _5: T;
- let mut _6: T;
- let mut _7: T;
- let mut _8: usize;
- let mut _9: usize;
- let mut _10: bool;
- let mut _14: !;
+ let mut _5: usize;
+ let mut _6: bool;
+ let mut _10: !;
scope 1 {
debug v => _2;
- let _11: &T;
- let _12: &T;
- let _13: &T;
+ let _7: &T;
+ let _8: &T;
+ let _9: &T;
scope 2 {
- debug v1 => _11;
- debug v2 => _12;
- debug v3 => _13;
+ debug v1 => _7;
+ debug v2 => _8;
+ debug v3 => _9;
}
}
@@ -33,26 +29,25 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
- _8 = const 3_usize;
- _9 = const 3_usize;
- _10 = const true;
+ _5 = const 3_usize;
+ _6 = const true;
goto -> bb2;
}
bb1: {
- _14 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue;
+ _10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue;
}
bb2: {
- StorageLive(_11);
- _11 = &(*_2)[0 of 3];
- StorageLive(_12);
- _12 = &(*_2)[1 of 3];
- StorageLive(_13);
- _13 = &(*_2)[2 of 3];
- StorageDead(_13);
- StorageDead(_12);
- StorageDead(_11);
+ StorageLive(_7);
+ _7 = &(*_2)[0 of 3];
+ StorageLive(_8);
+ _8 = &(*_2)[1 of 3];
+ StorageLive(_9);
+ _9 = &(*_2)[2 of 3];
+ StorageDead(_9);
+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
return;
}
diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs
index 95142a3e4..b08c3615e 100644
--- a/tests/mir-opt/issue_78192.rs
+++ b/tests/mir-opt/issue_78192.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Zmir-opt-level=1 -Zinline-mir
pub fn f<T>(a: &T) -> *const T {
let b: &*const T = &(a as *const T);
diff --git a/tests/mir-opt/issue_91633.rs b/tests/mir-opt/issue_91633.rs
index 9127cacc9..047a0cd9b 100644
--- a/tests/mir-opt/issue_91633.rs
+++ b/tests/mir-opt/issue_91633.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=0
// EMIT_MIR issue_91633.hey.built.after.mir
fn hey<T> (it: &[T])
diff --git a/tests/mir-opt/issue_99325.main.built.after.32bit.mir b/tests/mir-opt/issue_99325.main.built.after.32bit.mir
index 132b71335..ffb1aedd2 100644
--- a/tests/mir-opt/issue_99325.main.built.after.32bit.mir
+++ b/tests/mir-opt/issue_99325.main.built.after.32bit.mir
@@ -1,8 +1,8 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
-| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:14:16: 14:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
fn main() -> () {
let mut _0: ();
@@ -81,7 +81,7 @@ fn main() -> () {
_2 = (move _3, move _5);
StorageDead(_5);
StorageDead(_3);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
StorageLive(_8);
_8 = (_2.0: &&[u8]);
StorageLive(_9);
@@ -180,7 +180,7 @@ fn main() -> () {
_23 = (move _24, move _26);
StorageDead(_26);
StorageDead(_24);
- FakeRead(ForMatchedPlace(None), _23);
+ PlaceMention(_23);
StorageLive(_28);
_28 = (_23.0: &&[u8]);
StorageLive(_29);
@@ -271,6 +271,6 @@ fn main() -> () {
}
}
-alloc4 (size: 4, align: 1) {
+ALLOC0 (size: 4, align: 1) {
41 41 41 41 │ AAAA
}
diff --git a/tests/mir-opt/issue_99325.main.built.after.64bit.mir b/tests/mir-opt/issue_99325.main.built.after.64bit.mir
index 132b71335..ffb1aedd2 100644
--- a/tests/mir-opt/issue_99325.main.built.after.64bit.mir
+++ b/tests/mir-opt/issue_99325.main.built.after.64bit.mir
@@ -1,8 +1,8 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
-| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:14:16: 14:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
fn main() -> () {
let mut _0: ();
@@ -81,7 +81,7 @@ fn main() -> () {
_2 = (move _3, move _5);
StorageDead(_5);
StorageDead(_3);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
StorageLive(_8);
_8 = (_2.0: &&[u8]);
StorageLive(_9);
@@ -180,7 +180,7 @@ fn main() -> () {
_23 = (move _24, move _26);
StorageDead(_26);
StorageDead(_24);
- FakeRead(ForMatchedPlace(None), _23);
+ PlaceMention(_23);
StorageLive(_28);
_28 = (_23.0: &&[u8]);
StorageLive(_29);
@@ -271,6 +271,6 @@ fn main() -> () {
}
}
-alloc4 (size: 4, align: 1) {
+ALLOC0 (size: 4, align: 1) {
41 41 41 41 │ AAAA
}
diff --git a/tests/mir-opt/issue_99325.rs b/tests/mir-opt/issue_99325.rs
index 3603228a5..2638b69e2 100644
--- a/tests/mir-opt/issue_99325.rs
+++ b/tests/mir-opt/issue_99325.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_BIT_WIDTH
#![feature(adt_const_params)]
diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir
index f8c859418..5d25c6557 100644
--- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir
@@ -3,56 +3,61 @@
fn num_to_digit(_1: char) -> u32 {
debug num => _1;
let mut _0: u32;
- let mut _4: std::option::Option<u32>;
+ let mut _5: std::option::Option<u32>;
scope 1 (inlined char::methods::<impl char>::is_digit) {
debug self => _1;
debug radix => const 8_u32;
let _2: std::option::Option<u32>;
- let mut _7: &std::option::Option<u32>;
+ let mut _3: &std::option::Option<u32>;
scope 2 (inlined Option::<u32>::is_some) {
- debug self => _7;
- let mut _3: isize;
+ debug self => _3;
+ let mut _4: isize;
}
}
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
- debug self => _4;
- let mut _5: isize;
- let mut _6: !;
+ debug self => _5;
+ let mut _6: isize;
+ let mut _7: !;
scope 4 {
debug val => _0;
}
}
bb0: {
- StorageLive(_7);
+ StorageLive(_3);
StorageLive(_2);
_2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind unreachable];
}
bb1: {
- _3 = discriminant(_2);
- StorageDead(_7);
+ _3 = &_2;
+ StorageLive(_4);
+ _4 = discriminant(_2);
+ StorageDead(_3);
StorageDead(_2);
- switchInt(move _3) -> [1: bb2, otherwise: bb7];
+ switchInt(move _4) -> [1: bb2, otherwise: bb7];
}
bb2: {
- StorageLive(_4);
- _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable];
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable];
}
bb3: {
- _5 = discriminant(_4);
- switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6];
+ StorageLive(_6);
+ _6 = discriminant(_5);
+ switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6];
}
bb4: {
- _6 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
+ _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
}
bb5: {
- _0 = move ((_4 as Some).0: u32);
- StorageDead(_4);
+ _0 = move ((_5 as Some).0: u32);
+ StorageDead(_6);
+ StorageDead(_5);
goto -> bb8;
}
@@ -61,6 +66,7 @@ fn num_to_digit(_1: char) -> u32 {
}
bb7: {
+ StorageDead(_4);
_0 = const 0_u32;
goto -> bb8;
}
diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir
index df7392edc..4677c0108 100644
--- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir
@@ -3,56 +3,61 @@
fn num_to_digit(_1: char) -> u32 {
debug num => _1;
let mut _0: u32;
- let mut _4: std::option::Option<u32>;
+ let mut _5: std::option::Option<u32>;
scope 1 (inlined char::methods::<impl char>::is_digit) {
debug self => _1;
debug radix => const 8_u32;
let _2: std::option::Option<u32>;
- let mut _7: &std::option::Option<u32>;
+ let mut _3: &std::option::Option<u32>;
scope 2 (inlined Option::<u32>::is_some) {
- debug self => _7;
- let mut _3: isize;
+ debug self => _3;
+ let mut _4: isize;
}
}
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
- debug self => _4;
- let mut _5: isize;
- let mut _6: !;
+ debug self => _5;
+ let mut _6: isize;
+ let mut _7: !;
scope 4 {
debug val => _0;
}
}
bb0: {
- StorageLive(_7);
+ StorageLive(_3);
StorageLive(_2);
_2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind continue];
}
bb1: {
- _3 = discriminant(_2);
- StorageDead(_7);
+ _3 = &_2;
+ StorageLive(_4);
+ _4 = discriminant(_2);
+ StorageDead(_3);
StorageDead(_2);
- switchInt(move _3) -> [1: bb2, otherwise: bb7];
+ switchInt(move _4) -> [1: bb2, otherwise: bb7];
}
bb2: {
- StorageLive(_4);
- _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue];
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue];
}
bb3: {
- _5 = discriminant(_4);
- switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6];
+ StorageLive(_6);
+ _6 = discriminant(_5);
+ switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6];
}
bb4: {
- _6 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
+ _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
}
bb5: {
- _0 = move ((_4 as Some).0: u32);
- StorageDead(_4);
+ _0 = move ((_5 as Some).0: u32);
+ StorageDead(_6);
+ StorageDead(_5);
goto -> bb8;
}
@@ -61,6 +66,7 @@ fn num_to_digit(_1: char) -> u32 {
}
bb7: {
+ StorageDead(_4);
_0 = const 0_u32;
goto -> bb8;
}
diff --git a/tests/mir-opt/issues/issue_59352.rs b/tests/mir-opt/issues/issue_59352.rs
index 7cadf8f22..1cbeaec28 100644
--- a/tests/mir-opt/issues/issue_59352.rs
+++ b/tests/mir-opt/issues/issue_59352.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// This test is a mirror of codegen/issue-59352.rs.
// The LLVM inliner doesn't inline `char::method::is_digit()` and so it doesn't recognize this case
diff --git a/tests/mir-opt/issues/issue_75439.rs b/tests/mir-opt/issues/issue_75439.rs
index 4c749a150..0ab496e47 100644
--- a/tests/mir-opt/issues/issue_75439.rs
+++ b/tests/mir-opt/issues/issue_75439.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff
// ignore-endian-big
diff --git a/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..462cc2077
--- /dev/null
+++ b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff
@@ -0,0 +1,57 @@
+- // MIR for `custom_discr` before JumpThreading
++ // MIR for `custom_discr` after JumpThreading
+
+ fn custom_discr(_1: bool) -> u8 {
+ debug x => _1;
+ let mut _0: u8;
+ let mut _2: CustomDiscr;
+ let mut _3: bool;
+ let mut _4: u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _2 = CustomDiscr::A;
+- goto -> bb3;
++ goto -> bb7;
+ }
+
+ bb2: {
+ _2 = CustomDiscr::B;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ _4 = discriminant(_2);
+- switchInt(move _4) -> [35: bb5, otherwise: bb4];
++ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const 13_u8;
+ goto -> bb6;
+ }
+
+ bb5: {
+ _0 = const 5_u8;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_2);
+ return;
++ }
++
++ bb7: {
++ StorageDead(_3);
++ _4 = discriminant(_2);
++ goto -> bb5;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..462cc2077
--- /dev/null
+++ b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff
@@ -0,0 +1,57 @@
+- // MIR for `custom_discr` before JumpThreading
++ // MIR for `custom_discr` after JumpThreading
+
+ fn custom_discr(_1: bool) -> u8 {
+ debug x => _1;
+ let mut _0: u8;
+ let mut _2: CustomDiscr;
+ let mut _3: bool;
+ let mut _4: u8;
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = _1;
+ switchInt(move _3) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ _2 = CustomDiscr::A;
+- goto -> bb3;
++ goto -> bb7;
+ }
+
+ bb2: {
+ _2 = CustomDiscr::B;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ _4 = discriminant(_2);
+- switchInt(move _4) -> [35: bb5, otherwise: bb4];
++ goto -> bb4;
+ }
+
+ bb4: {
+ _0 = const 13_u8;
+ goto -> bb6;
+ }
+
+ bb5: {
+ _0 = const 5_u8;
+ goto -> bb6;
+ }
+
+ bb6: {
+ StorageDead(_2);
+ return;
++ }
++
++ bb7: {
++ StorageDead(_3);
++ _4 = discriminant(_2);
++ goto -> bb5;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..ad5846c97
--- /dev/null
+++ b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff
@@ -0,0 +1,68 @@
+- // MIR for `dfa` before JumpThreading
++ // MIR for `dfa` after JumpThreading
+
+ fn dfa() -> () {
+ let mut _0: ();
+ let mut _1: DFA;
+ let mut _2: !;
+ let mut _3: ();
+ let mut _4: isize;
+ let mut _5: DFA;
+ let mut _6: DFA;
+ let mut _7: DFA;
+ let mut _8: !;
+ scope 1 {
+ debug state => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = DFA::A;
+ StorageLive(_2);
+ goto -> bb1;
+ }
+
+ bb1: {
+ _4 = discriminant(_1);
+ switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ StorageLive(_5);
+ _5 = DFA::B;
+ _1 = move _5;
+ _3 = const ();
+ StorageDead(_5);
+ goto -> bb1;
+ }
+
+ bb5: {
+ StorageLive(_6);
+ _6 = DFA::C;
+ _1 = move _6;
+ _3 = const ();
+ StorageDead(_6);
+ goto -> bb1;
+ }
+
+ bb6: {
+ StorageLive(_7);
+ _7 = DFA::D;
+ _1 = move _7;
+ _3 = const ();
+ StorageDead(_7);
+ goto -> bb1;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..ad5846c97
--- /dev/null
+++ b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff
@@ -0,0 +1,68 @@
+- // MIR for `dfa` before JumpThreading
++ // MIR for `dfa` after JumpThreading
+
+ fn dfa() -> () {
+ let mut _0: ();
+ let mut _1: DFA;
+ let mut _2: !;
+ let mut _3: ();
+ let mut _4: isize;
+ let mut _5: DFA;
+ let mut _6: DFA;
+ let mut _7: DFA;
+ let mut _8: !;
+ scope 1 {
+ debug state => _1;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = DFA::A;
+ StorageLive(_2);
+ goto -> bb1;
+ }
+
+ bb1: {
+ _4 = discriminant(_1);
+ switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ _0 = const ();
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ StorageLive(_5);
+ _5 = DFA::B;
+ _1 = move _5;
+ _3 = const ();
+ StorageDead(_5);
+ goto -> bb1;
+ }
+
+ bb5: {
+ StorageLive(_6);
+ _6 = DFA::C;
+ _1 = move _6;
+ _3 = const ();
+ StorageDead(_6);
+ goto -> bb1;
+ }
+
+ bb6: {
+ StorageLive(_7);
+ _7 = DFA::D;
+ _1 = move _7;
+ _3 = const ();
+ StorageDead(_7);
+ goto -> bb1;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..f290da84e
--- /dev/null
+++ b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff
@@ -0,0 +1,59 @@
+- // MIR for `disappearing_bb` before JumpThreading
++ // MIR for `disappearing_bb` after JumpThreading
+
+ fn disappearing_bb(_1: u8) -> u8 {
+ let mut _0: u8;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ _2 = const true;
+ _3 = const true;
+ switchInt(_1) -> [0: bb3, 1: bb3, 2: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _3 = const false;
+- goto -> bb4;
++ goto -> bb9;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ _2 = const false;
+ goto -> bb4;
+ }
+
+ bb4: {
+ switchInt(_3) -> [0: bb5, otherwise: bb7];
+ }
+
+ bb5: {
+ switchInt(_2) -> [0: bb6, otherwise: bb8];
+ }
+
+ bb6: {
+ return;
+ }
+
+ bb7: {
+- goto -> bb5;
++ goto -> bb10;
+ }
+
+ bb8: {
++ goto -> bb6;
++ }
++
++ bb9: {
++ goto -> bb5;
++ }
++
++ bb10: {
+ goto -> bb6;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..f290da84e
--- /dev/null
+++ b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff
@@ -0,0 +1,59 @@
+- // MIR for `disappearing_bb` before JumpThreading
++ // MIR for `disappearing_bb` after JumpThreading
+
+ fn disappearing_bb(_1: u8) -> u8 {
+ let mut _0: u8;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ _2 = const true;
+ _3 = const true;
+ switchInt(_1) -> [0: bb3, 1: bb3, 2: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _3 = const false;
+- goto -> bb4;
++ goto -> bb9;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ _2 = const false;
+ goto -> bb4;
+ }
+
+ bb4: {
+ switchInt(_3) -> [0: bb5, otherwise: bb7];
+ }
+
+ bb5: {
+ switchInt(_2) -> [0: bb6, otherwise: bb8];
+ }
+
+ bb6: {
+ return;
+ }
+
+ bb7: {
+- goto -> bb5;
++ goto -> bb10;
+ }
+
+ bb8: {
++ goto -> bb6;
++ }
++
++ bb9: {
++ goto -> bb5;
++ }
++
++ bb10: {
+ goto -> bb6;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..adcedfb36
--- /dev/null
+++ b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `duplicate_chain` before JumpThreading
++ // MIR for `duplicate_chain` after JumpThreading
+
+ fn duplicate_chain(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+ let mut _3: i32;
+ let mut _4: i32;
+
+ bb0: {
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = const 5_u8;
+ goto -> bb3;
+ }
+
+ bb2: {
+ _2 = const 5_u8;
+ goto -> bb3;
+ }
+
+ bb3: {
+ _3 = const 13_i32;
+ goto -> bb4;
+ }
+
+ bb4: {
+ _4 = const 15_i32;
+- switchInt(_2) -> [5: bb5, otherwise: bb6];
++ goto -> bb5;
+ }
+
+ bb5: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb6: {
+ _0 = const 9_u8;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..adcedfb36
--- /dev/null
+++ b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `duplicate_chain` before JumpThreading
++ // MIR for `duplicate_chain` after JumpThreading
+
+ fn duplicate_chain(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+ let mut _3: i32;
+ let mut _4: i32;
+
+ bb0: {
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = const 5_u8;
+ goto -> bb3;
+ }
+
+ bb2: {
+ _2 = const 5_u8;
+ goto -> bb3;
+ }
+
+ bb3: {
+ _3 = const 13_i32;
+ goto -> bb4;
+ }
+
+ bb4: {
+ _4 = const 15_i32;
+- switchInt(_2) -> [5: bb5, otherwise: bb6];
++ goto -> bb5;
+ }
+
+ bb5: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb6: {
+ _0 = const 9_u8;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..f17c9ba3f
--- /dev/null
+++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff
@@ -0,0 +1,139 @@
+- // MIR for `identity` before JumpThreading
++ // MIR for `identity` after JumpThreading
+
+ fn identity(_1: Result<i32, i32>) -> Result<i32, i32> {
+ debug x => _1;
+ let mut _0: std::result::Result<i32, i32>;
+ let mut _2: i32;
+ let mut _3: std::ops::ControlFlow<std::result::Result<std::convert::Infallible, i32>, i32>;
+ let mut _4: std::result::Result<i32, i32>;
+ let mut _5: isize;
+ let _6: std::result::Result<std::convert::Infallible, i32>;
+ let mut _7: !;
+ let mut _8: std::result::Result<std::convert::Infallible, i32>;
+ let _9: i32;
+ scope 1 {
+ debug residual => _6;
+ scope 2 {
+ scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) {
+ debug residual => _8;
+ let _14: i32;
+ let mut _15: i32;
+ scope 9 {
+ debug e => _14;
+ scope 10 (inlined <i32 as From<i32>>::from) {
+ debug t => _14;
+ }
+ }
+ }
+ }
+ }
+ scope 3 {
+ debug val => _9;
+ scope 4 {
+ }
+ }
+ scope 5 (inlined <Result<i32, i32> as Try>::branch) {
+ debug self => _4;
+ let mut _10: isize;
+ let _11: i32;
+ let _12: i32;
+ let mut _13: std::result::Result<std::convert::Infallible, i32>;
+ scope 6 {
+ debug v => _11;
+ }
+ scope 7 {
+ debug e => _12;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _10 = discriminant(_4);
+ switchInt(move _10) -> [0: bb8, 1: bb6, otherwise: bb7];
+ }
+
+ bb1: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_4);
+ _5 = discriminant(_3);
+- switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3];
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_9);
+ _9 = ((_3 as Continue).0: i32);
+ _2 = _9;
+ StorageDead(_9);
+ _0 = Result::<i32, i32>::Ok(move _2);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb5;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ StorageLive(_6);
+ _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>);
+ StorageLive(_8);
+ _8 = _6;
+ StorageLive(_14);
+ _14 = move ((_8 as Err).0: i32);
+ StorageLive(_15);
+ _15 = move _14;
+ _0 = Result::<i32, i32>::Err(move _15);
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_8);
+ StorageDead(_6);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb5;
+ }
+
+ bb5: {
+ return;
+ }
+
+ bb6: {
+ _12 = move ((_4 as Err).0: i32);
+ StorageLive(_13);
+ _13 = Result::<Infallible, i32>::Err(move _12);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _13);
+ StorageDead(_13);
+- goto -> bb1;
++ goto -> bb9;
+ }
+
+ bb7: {
+ unreachable;
+ }
+
+ bb8: {
+ _11 = move ((_4 as Ok).0: i32);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _11);
+ goto -> bb1;
++ }
++
++ bb9: {
++ StorageDead(_12);
++ StorageDead(_11);
++ StorageDead(_10);
++ StorageDead(_4);
++ _5 = discriminant(_3);
++ goto -> bb4;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..f17c9ba3f
--- /dev/null
+++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff
@@ -0,0 +1,139 @@
+- // MIR for `identity` before JumpThreading
++ // MIR for `identity` after JumpThreading
+
+ fn identity(_1: Result<i32, i32>) -> Result<i32, i32> {
+ debug x => _1;
+ let mut _0: std::result::Result<i32, i32>;
+ let mut _2: i32;
+ let mut _3: std::ops::ControlFlow<std::result::Result<std::convert::Infallible, i32>, i32>;
+ let mut _4: std::result::Result<i32, i32>;
+ let mut _5: isize;
+ let _6: std::result::Result<std::convert::Infallible, i32>;
+ let mut _7: !;
+ let mut _8: std::result::Result<std::convert::Infallible, i32>;
+ let _9: i32;
+ scope 1 {
+ debug residual => _6;
+ scope 2 {
+ scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) {
+ debug residual => _8;
+ let _14: i32;
+ let mut _15: i32;
+ scope 9 {
+ debug e => _14;
+ scope 10 (inlined <i32 as From<i32>>::from) {
+ debug t => _14;
+ }
+ }
+ }
+ }
+ }
+ scope 3 {
+ debug val => _9;
+ scope 4 {
+ }
+ }
+ scope 5 (inlined <Result<i32, i32> as Try>::branch) {
+ debug self => _4;
+ let mut _10: isize;
+ let _11: i32;
+ let _12: i32;
+ let mut _13: std::result::Result<std::convert::Infallible, i32>;
+ scope 6 {
+ debug v => _11;
+ }
+ scope 7 {
+ debug e => _12;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ _4 = _1;
+ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ _10 = discriminant(_4);
+ switchInt(move _10) -> [0: bb8, 1: bb6, otherwise: bb7];
+ }
+
+ bb1: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_4);
+ _5 = discriminant(_3);
+- switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3];
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_9);
+ _9 = ((_3 as Continue).0: i32);
+ _2 = _9;
+ StorageDead(_9);
+ _0 = Result::<i32, i32>::Ok(move _2);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb5;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ StorageLive(_6);
+ _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>);
+ StorageLive(_8);
+ _8 = _6;
+ StorageLive(_14);
+ _14 = move ((_8 as Err).0: i32);
+ StorageLive(_15);
+ _15 = move _14;
+ _0 = Result::<i32, i32>::Err(move _15);
+ StorageDead(_15);
+ StorageDead(_14);
+ StorageDead(_8);
+ StorageDead(_6);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb5;
+ }
+
+ bb5: {
+ return;
+ }
+
+ bb6: {
+ _12 = move ((_4 as Err).0: i32);
+ StorageLive(_13);
+ _13 = Result::<Infallible, i32>::Err(move _12);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _13);
+ StorageDead(_13);
+- goto -> bb1;
++ goto -> bb9;
+ }
+
+ bb7: {
+ unreachable;
+ }
+
+ bb8: {
+ _11 = move ((_4 as Ok).0: i32);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _11);
+ goto -> bb1;
++ }
++
++ bb9: {
++ StorageDead(_12);
++ StorageDead(_11);
++ StorageDead(_10);
++ StorageDead(_4);
++ _5 = discriminant(_3);
++ goto -> bb4;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..2ca03e439
--- /dev/null
+++ b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff
@@ -0,0 +1,54 @@
+- // MIR for `multiple_match` before JumpThreading
++ // MIR for `multiple_match` after JumpThreading
+
+ fn multiple_match(_1: u8) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ switchInt(_1) -> [3: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = _1;
+- switchInt(_2) -> [3: bb3, otherwise: bb4];
++ goto -> bb3;
+ }
+
+ bb2: {
+ _3 = _1;
+- switchInt(_3) -> [3: bb5, otherwise: bb6];
++ goto -> bb6;
+ }
+
+ bb3: {
+ _0 = const 5_u8;
+ return;
+ }
+
+ bb4: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb5: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb6: {
+ switchInt(_3) -> [1: bb7, otherwise: bb8];
+ }
+
+ bb7: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb8: {
+ _0 = const 11_u8;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..2ca03e439
--- /dev/null
+++ b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff
@@ -0,0 +1,54 @@
+- // MIR for `multiple_match` before JumpThreading
++ // MIR for `multiple_match` after JumpThreading
+
+ fn multiple_match(_1: u8) -> u8 {
+ let mut _0: u8;
+ let mut _2: u8;
+ let mut _3: u8;
+
+ bb0: {
+ switchInt(_1) -> [3: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = _1;
+- switchInt(_2) -> [3: bb3, otherwise: bb4];
++ goto -> bb3;
+ }
+
+ bb2: {
+ _3 = _1;
+- switchInt(_3) -> [3: bb5, otherwise: bb6];
++ goto -> bb6;
+ }
+
+ bb3: {
+ _0 = const 5_u8;
+ return;
+ }
+
+ bb4: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb5: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb6: {
+ switchInt(_3) -> [1: bb7, otherwise: bb8];
+ }
+
+ bb7: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb8: {
+ _0 = const 11_u8;
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..80a422636
--- /dev/null
+++ b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff
@@ -0,0 +1,56 @@
+- // MIR for `mutable_ref` before JumpThreading
++ // MIR for `mutable_ref` after JumpThreading
+
+ fn mutable_ref() -> bool {
+ let mut _0: bool;
+ let mut _1: i32;
+ let _3: ();
+ let mut _4: bool;
+ let mut _5: i32;
+ scope 1 {
+ debug x => _1;
+ let _2: *mut i32;
+ scope 2 {
+ debug a => _2;
+ scope 3 {
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 5_i32;
+ StorageLive(_2);
+ _2 = &raw mut _1;
+ _1 = const 7_i32;
+ StorageLive(_3);
+ (*_2) = const 8_i32;
+ _3 = const ();
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = Eq(move _5, const 7_i32);
+ switchInt(move _4) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ _0 = const true;
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageDead(_5);
+ _0 = const false;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..80a422636
--- /dev/null
+++ b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff
@@ -0,0 +1,56 @@
+- // MIR for `mutable_ref` before JumpThreading
++ // MIR for `mutable_ref` after JumpThreading
+
+ fn mutable_ref() -> bool {
+ let mut _0: bool;
+ let mut _1: i32;
+ let _3: ();
+ let mut _4: bool;
+ let mut _5: i32;
+ scope 1 {
+ debug x => _1;
+ let _2: *mut i32;
+ scope 2 {
+ debug a => _2;
+ scope 3 {
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = const 5_i32;
+ StorageLive(_2);
+ _2 = &raw mut _1;
+ _1 = const 7_i32;
+ StorageLive(_3);
+ (*_2) = const 8_i32;
+ _3 = const ();
+ StorageDead(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
+ _4 = Eq(move _5, const 7_i32);
+ switchInt(move _4) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ StorageDead(_5);
+ _0 = const true;
+ goto -> bb3;
+ }
+
+ bb2: {
+ StorageDead(_5);
+ _0 = const false;
+ goto -> bb3;
+ }
+
+ bb3: {
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..8821b47c3
--- /dev/null
+++ b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff
@@ -0,0 +1,26 @@
+- // MIR for `mutate_discriminant` before JumpThreading
++ // MIR for `mutate_discriminant` after JumpThreading
+
+ fn mutate_discriminant() -> u8 {
+ let mut _0: u8;
+ let mut _1: std::option::Option<NonZeroUsize>;
+ let mut _2: isize;
+
+ bb0: {
+ discriminant(_1) = 1;
+ (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize;
+ _2 = discriminant(_1);
+ switchInt(_2) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _0 = const 1_u8;
+ return;
+ }
+
+ bb2: {
+ _0 = const 2_u8;
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..8821b47c3
--- /dev/null
+++ b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff
@@ -0,0 +1,26 @@
+- // MIR for `mutate_discriminant` before JumpThreading
++ // MIR for `mutate_discriminant` after JumpThreading
+
+ fn mutate_discriminant() -> u8 {
+ let mut _0: u8;
+ let mut _1: std::option::Option<NonZeroUsize>;
+ let mut _2: isize;
+
+ bb0: {
+ discriminant(_1) = 1;
+ (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize;
+ _2 = discriminant(_1);
+ switchInt(_2) -> [0: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _0 = const 1_u8;
+ return;
+ }
+
+ bb2: {
+ _0 = const 2_u8;
+ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..2d943a4be
--- /dev/null
+++ b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff
@@ -0,0 +1,57 @@
+- // MIR for `renumbered_bb` before JumpThreading
++ // MIR for `renumbered_bb` after JumpThreading
+
+ fn renumbered_bb(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ _3 = const false;
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = const false;
+- goto -> bb3;
++ goto -> bb8;
+ }
+
+ bb2: {
+ _2 = _1;
+ _3 = _1;
+ goto -> bb3;
+ }
+
+ bb3: {
+ switchInt(_2) -> [0: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+ switchInt(_3) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb5: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb6: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb7: {
+ _0 = const 11_u8;
+ return;
++ }
++
++ bb8: {
++ goto -> bb9;
++ }
++
++ bb9: {
++ goto -> bb6;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..2d943a4be
--- /dev/null
+++ b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff
@@ -0,0 +1,57 @@
+- // MIR for `renumbered_bb` before JumpThreading
++ // MIR for `renumbered_bb` after JumpThreading
+
+ fn renumbered_bb(_1: bool) -> u8 {
+ let mut _0: u8;
+ let mut _2: bool;
+ let mut _3: bool;
+
+ bb0: {
+ _3 = const false;
+ switchInt(_1) -> [1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ _2 = const false;
+- goto -> bb3;
++ goto -> bb8;
+ }
+
+ bb2: {
+ _2 = _1;
+ _3 = _1;
+ goto -> bb3;
+ }
+
+ bb3: {
+ switchInt(_2) -> [0: bb4, otherwise: bb5];
+ }
+
+ bb4: {
+ switchInt(_3) -> [0: bb6, otherwise: bb7];
+ }
+
+ bb5: {
+ _0 = const 7_u8;
+ return;
+ }
+
+ bb6: {
+ _0 = const 9_u8;
+ return;
+ }
+
+ bb7: {
+ _0 = const 11_u8;
+ return;
++ }
++
++ bb8: {
++ goto -> bb9;
++ }
++
++ bb9: {
++ goto -> bb6;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs
new file mode 100644
index 000000000..852dcd0db
--- /dev/null
+++ b/tests/mir-opt/jump_threading.rs
@@ -0,0 +1,480 @@
+// unit-test: JumpThreading
+// compile-flags: -Zmir-enable-passes=+Inline
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+#![feature(control_flow_enum)]
+#![feature(try_trait_v2)]
+#![feature(custom_mir, core_intrinsics, rustc_attrs)]
+
+use std::intrinsics::mir::*;
+use std::ops::ControlFlow;
+
+fn too_complex(x: Result<i32, usize>) -> Option<i32> {
+ // CHECK-LABEL: fn too_complex(
+ // CHECK: bb0: {
+ // CHECK: switchInt(move {{_.*}}) -> [0: bb3, 1: bb1, otherwise: bb2];
+ // CHECK: bb1: {
+ // CHECK: [[controlflow:_.*]] = ControlFlow::<usize, i32>::Break(
+ // CHECK: goto -> bb8;
+ // CHECK: bb2: {
+ // CHECK: unreachable;
+ // CHECK: bb3: {
+ // CHECK: [[controlflow]] = ControlFlow::<usize, i32>::Continue(
+ // CHECK: goto -> bb4;
+ // CHECK: bb4: {
+ // CHECK: goto -> bb6;
+ // CHECK: bb5: {
+ // CHECK: {{_.*}} = (([[controlflow]] as Break).0: usize);
+ // CHECK: _0 = Option::<i32>::None;
+ // CHECK: goto -> bb7;
+ // CHECK: bb6: {
+ // CHECK: {{_.*}} = (([[controlflow]] as Continue).0: i32);
+ // CHECK: _0 = Option::<i32>::Some(
+ // CHECK: goto -> bb7;
+ // CHECK: bb7: {
+ // CHECK: return;
+ // CHECK: bb8: {
+ // CHECK: goto -> bb5;
+ match {
+ match x {
+ Ok(v) => ControlFlow::Continue(v),
+ Err(r) => ControlFlow::Break(r),
+ }
+ } {
+ ControlFlow::Continue(v) => Some(v),
+ ControlFlow::Break(r) => None,
+ }
+}
+
+fn identity(x: Result<i32, i32>) -> Result<i32, i32> {
+ // CHECK-LABEL: fn identity(
+ // CHECK: bb0: {
+ // CHECK: [[x:_.*]] = _1;
+ // CHECK: switchInt(move {{_.*}}) -> [0: bb8, 1: bb6, otherwise: bb7];
+ // CHECK: bb1: {
+ // CHECK: goto -> bb2;
+ // CHECK: bb2: {
+ // CHECK: {{_.*}} = (([[controlflow:_.*]] as Continue).0: i32);
+ // CHECK: _0 = Result::<i32, i32>::Ok(
+ // CHECK: goto -> bb5;
+ // CHECK: bb3: {
+ // CHECK: unreachable;
+ // CHECK: bb4: {
+ // CHECK: {{_.*}} = (([[controlflow]] as Break).0: std::result::Result<std::convert::Infallible, i32>);
+ // CHECK: _0 = Result::<i32, i32>::Err(
+ // CHECK: goto -> bb5;
+ // CHECK: bb5: {
+ // CHECK: return;
+ // CHECK: bb6: {
+ // CHECK: {{_.*}} = move (([[x]] as Err).0: i32);
+ // CHECK: [[controlflow]] = ControlFlow::<Result<Infallible, i32>, i32>::Break(
+ // CHECK: goto -> bb9;
+ // CHECK: bb7: {
+ // CHECK: unreachable;
+ // CHECK: bb8: {
+ // CHECK: {{_.*}} = move (([[x]] as Ok).0: i32);
+ // CHECK: [[controlflow]] = ControlFlow::<Result<Infallible, i32>, i32>::Continue(
+ // CHECK: goto -> bb1;
+ // CHECK: bb9: {
+ // CHECK: goto -> bb4;
+ Ok(x?)
+}
+
+enum DFA {
+ A,
+ B,
+ C,
+ D,
+}
+
+/// Check that we do not thread through a loop header,
+/// to avoid creating an irreducible CFG.
+fn dfa() {
+ // CHECK-LABEL: fn dfa(
+ // CHECK: bb0: {
+ // CHECK: {{_.*}} = DFA::A;
+ // CHECK: goto -> bb1;
+ // CHECK: bb1: {
+ // CHECK: switchInt({{.*}}) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3];
+ // CHECK: bb2: {
+ // CHECK: return;
+ // CHECK: bb3: {
+ // CHECK: unreachable;
+ // CHECK: bb4: {
+ // CHECK: {{_.*}} = DFA::B;
+ // CHECK: goto -> bb1;
+ // CHECK: bb5: {
+ // CHECK: {{_.*}} = DFA::C;
+ // CHECK: goto -> bb1;
+ // CHECK: bb6: {
+ // CHECK: {{_.*}} = DFA::D;
+ // CHECK: goto -> bb1;
+ let mut state = DFA::A;
+ loop {
+ match state {
+ DFA::A => state = DFA::B,
+ DFA::B => state = DFA::C,
+ DFA::C => state = DFA::D,
+ DFA::D => return,
+ }
+ }
+}
+
+#[repr(u8)]
+enum CustomDiscr {
+ A = 35,
+ B = 73,
+ C = 99,
+}
+
+/// Verify that we correctly match the discriminant value, and not its index.
+fn custom_discr(x: bool) -> u8 {
+ // CHECK-LABEL: fn custom_discr(
+ // CHECK: bb0: {
+ // CHECK: switchInt({{.*}}) -> [0: bb2, otherwise: bb1];
+ // CHECK: bb1: {
+ // CHECK: {{_.*}} = CustomDiscr::A;
+ // CHECK: goto -> bb7;
+ // CHECK: bb2: {
+ // CHECK: {{_.*}} = CustomDiscr::B;
+ // CHECK: goto -> bb3;
+ // CHECK: bb3: {
+ // CHECK: goto -> bb4;
+ // CHECK: bb4: {
+ // CHECK: _0 = const 13_u8;
+ // CHECK: goto -> bb6;
+ // CHECK: bb5: {
+ // CHECK: _0 = const 5_u8;
+ // CHECK: goto -> bb6;
+ // CHECK: bb6: {
+ // CHECK: return;
+ // CHECK: bb7: {
+ // CHECK: goto -> bb5;
+ match if x { CustomDiscr::A } else { CustomDiscr::B } {
+ CustomDiscr::A => 5,
+ _ => 13,
+ }
+}
+
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn multiple_match(x: u8) -> u8 {
+ // CHECK-LABEL: fn multiple_match(
+ mir!(
+ {
+ // CHECK: bb0: {
+ // CHECK: switchInt([[x:_.*]]) -> [3: bb1, otherwise: bb2];
+ match x { 3 => bb1, _ => bb2 }
+ }
+ bb1 = {
+ // We know `x == 3`, so we can take `bb3`.
+ // CHECK: bb1: {
+ // CHECK: {{_.*}} = [[x]];
+ // CHECK: goto -> bb3;
+ let y = x;
+ match y { 3 => bb3, _ => bb4 }
+ }
+ bb2 = {
+ // We know `x != 3`, so we can take `bb6`.
+ // CHECK: bb2: {
+ // CHECK: [[z:_.*]] = [[x]];
+ // CHECK: goto -> bb6;
+ let z = x;
+ match z { 3 => bb5, _ => bb6 }
+ }
+ bb3 = {
+ // CHECK: bb3: {
+ // CHECK: _0 = const 5_u8;
+ // CHECK: return;
+ RET = 5;
+ Return()
+ }
+ bb4 = {
+ // CHECK: bb4: {
+ // CHECK: _0 = const 7_u8;
+ // CHECK: return;
+ RET = 7;
+ Return()
+ }
+ bb5 = {
+ // CHECK: bb5: {
+ // CHECK: _0 = const 9_u8;
+ // CHECK: return;
+ RET = 9;
+ Return()
+ }
+ bb6 = {
+ // We know `z != 3`, so we CANNOT take `bb7`.
+ // CHECK: bb6: {
+ // CHECK: switchInt([[z]]) -> [1: bb7, otherwise: bb8];
+ match z { 1 => bb7, _ => bb8 }
+ }
+ bb7 = {
+ // CHECK: bb7: {
+ // CHECK: _0 = const 9_u8;
+ // CHECK: return;
+ RET = 9;
+ Return()
+ }
+ bb8 = {
+ // CHECK: bb8: {
+ // CHECK: _0 = const 11_u8;
+ // CHECK: return;
+ RET = 11;
+ Return()
+ }
+ )
+}
+
+/// Both 1-3-4 and 2-3-4 are threadable. As 1 and 2 are the only predecessors of 3,
+/// verify that we only thread the 3-4 part.
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn duplicate_chain(x: bool) -> u8 {
+ // CHECK-LABEL: fn duplicate_chain(
+ mir!(
+ let a: u8;
+ {
+ // CHECK: bb0: {
+ // CHECK: switchInt({{.*}}) -> [1: bb1, otherwise: bb2];
+ match x { true => bb1, _ => bb2 }
+ }
+ bb1 = {
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_u8;
+ // CHECK: goto -> bb3;
+ a = 5;
+ Goto(bb3)
+ }
+ bb2 = {
+ // CHECK: bb2: {
+ // CHECK: [[a]] = const 5_u8;
+ // CHECK: goto -> bb3;
+ a = 5;
+ Goto(bb3)
+ }
+ bb3 = {
+ // CHECK: bb3: {
+ // CHECK: {{_.*}} = const 13_i32;
+ // CHECK: goto -> bb4;
+ let b = 13;
+ Goto(bb4)
+ }
+ bb4 = {
+ // CHECK: bb4: {
+ // CHECK: {{_.*}} = const 15_i32;
+ // CHECK-NOT: switchInt(
+ // CHECK: goto -> bb5;
+ let c = 15;
+ match a { 5 => bb5, _ => bb6 }
+ }
+ bb5 = {
+ // CHECK: bb5: {
+ // CHECK: _0 = const 7_u8;
+ // CHECK: return;
+ RET = 7;
+ Return()
+ }
+ bb6 = {
+ // CHECK: bb6: {
+ // CHECK: _0 = const 9_u8;
+ // CHECK: return;
+ RET = 9;
+ Return()
+ }
+ )
+}
+
+#[rustc_layout_scalar_valid_range_start(1)]
+#[rustc_nonnull_optimization_guaranteed]
+struct NonZeroUsize(usize);
+
+/// Verify that we correctly discard threads that may mutate a discriminant by aliasing.
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn mutate_discriminant() -> u8 {
+ // CHECK-LABEL: fn mutate_discriminant(
+ // CHECK-NOT: goto -> {{bb.*}};
+ // CHECK: switchInt(
+ // CHECK-NOT: goto -> {{bb.*}};
+ mir!(
+ let x: Option<NonZeroUsize>;
+ {
+ SetDiscriminant(x, 1);
+ // This assignment overwrites the niche in which the discriminant is stored.
+ place!(Field(Field(Variant(x, 1), 0), 0)) = 0_usize;
+ // So we cannot know the value of this discriminant.
+ let a = Discriminant(x);
+ match a {
+ 0 => bb1,
+ _ => bad,
+ }
+ }
+ bb1 = {
+ RET = 1;
+ Return()
+ }
+ bad = {
+ RET = 2;
+ Unreachable()
+ }
+ )
+}
+
+/// Verify that we do not try to reason when there are mutable pointers involved.
+fn mutable_ref() -> bool {
+ // CHECK-LABEL: fn mutable_ref(
+ // CHECK-NOT: goto -> {{bb.*}};
+ // CHECK: switchInt(
+ // CHECK: goto -> [[bbret:bb.*]];
+ // CHECK: goto -> [[bbret]];
+ // CHECK: [[bbret]]: {
+ // CHECK-NOT: {{bb.*}}: {
+ // CHECK: return;
+ let mut x = 5;
+ let a = std::ptr::addr_of_mut!(x);
+ x = 7;
+ unsafe { *a = 8 };
+ if x == 7 {
+ true
+ } else {
+ false
+ }
+}
+
+/// This function has 2 TOs: 1-3-4 and 0-1-3-4-6.
+/// We verify that the second TO does not modify 3 once the first has been applied.
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn renumbered_bb(x: bool) -> u8 {
+ // CHECK-LABEL: fn renumbered_bb(
+ mir!(
+ let a: bool;
+ let b: bool;
+ {
+ // CHECK: bb0: {
+ // CHECK: switchInt({{.*}}) -> [1: bb1, otherwise: bb2];
+ b = false;
+ match x { true => bb1, _ => bb2 }
+ }
+ bb1 = {
+ // CHECK: bb1: {
+ // CHECK: goto -> bb8;
+ a = false;
+ Goto(bb3)
+ }
+ bb2 = {
+ // CHECK: bb2: {
+ // CHECK: goto -> bb3;
+ a = x;
+ b = x;
+ Goto(bb3)
+ }
+ bb3 = {
+ // CHECK: bb3: {
+ // CHECK: switchInt({{.*}}) -> [0: bb4, otherwise: bb5];
+ match a { false => bb4, _ => bb5 }
+ }
+ bb4 = {
+ // CHECK: bb4: {
+ // CHECK: switchInt({{.*}}) -> [0: bb6, otherwise: bb7];
+ match b { false => bb6, _ => bb7 }
+ }
+ bb5 = {
+ // CHECK: bb5: {
+ // CHECK: _0 = const 7_u8;
+ RET = 7;
+ Return()
+ }
+ bb6 = {
+ // CHECK: bb6: {
+ // CHECK: _0 = const 9_u8;
+ RET = 9;
+ Return()
+ }
+ bb7 = {
+ // CHECK: bb7: {
+ // CHECK: _0 = const 11_u8;
+ RET = 11;
+ Return()
+ }
+ // Duplicate of bb3.
+ // CHECK: bb8: {
+ // CHECK-NEXT: goto -> bb9;
+ // Duplicate of bb4.
+ // CHECK: bb9: {
+ // CHECK-NEXT: goto -> bb6;
+ )
+}
+
+/// This function has 3 TOs: 1-4-5, 0-1-4-7-5-8 and 3-4-7-5-6
+/// After applying the first TO, we create bb9 to replace 4, and rename 1-4 edge by 1-9. The
+/// second TO may try to thread non-existing edge 9-4.
+/// This test verifies that we preserve semantics by bailing out of this second TO.
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn disappearing_bb(x: u8) -> u8 {
+ // CHECK-LABEL: fn disappearing_bb(
+ mir!(
+ let a: bool;
+ let b: bool;
+ {
+ a = true;
+ b = true;
+ match x { 0 => bb3, 1 => bb3, 2 => bb1, _ => bb2 }
+ }
+ bb1 = {
+ // CHECK: bb1: {
+ // CHECK: goto -> bb9;
+ b = false;
+ Goto(bb4)
+ }
+ bb2 = {
+ Unreachable()
+ }
+ bb3 = {
+ // CHECK: bb3: {
+ // CHECK: goto -> bb10;
+ a = false;
+ Goto(bb4)
+ }
+ bb4 = {
+ match b { false => bb5, _ => bb7 }
+ }
+ bb5 = {
+ match a { false => bb6, _ => bb8 }
+ }
+ bb6 = {
+ Return()
+ }
+ bb7 = {
+ Goto(bb5)
+ }
+ bb8 = {
+ Goto(bb6)
+ }
+ // CHECK: bb9: {
+ // CHECK: goto -> bb5;
+ // CHECK: bb10: {
+ // CHECK: goto -> bb6;
+ )
+}
+
+fn main() {
+ too_complex(Ok(0));
+ identity(Ok(0));
+ custom_discr(false);
+ dfa();
+ multiple_match(5);
+ duplicate_chain(false);
+ mutate_discriminant();
+ mutable_ref();
+ renumbered_bb(true);
+ disappearing_bb(7);
+}
+
+// EMIT_MIR jump_threading.too_complex.JumpThreading.diff
+// EMIT_MIR jump_threading.identity.JumpThreading.diff
+// EMIT_MIR jump_threading.custom_discr.JumpThreading.diff
+// EMIT_MIR jump_threading.dfa.JumpThreading.diff
+// EMIT_MIR jump_threading.multiple_match.JumpThreading.diff
+// EMIT_MIR jump_threading.duplicate_chain.JumpThreading.diff
+// EMIT_MIR jump_threading.mutate_discriminant.JumpThreading.diff
+// EMIT_MIR jump_threading.mutable_ref.JumpThreading.diff
+// EMIT_MIR jump_threading.renumbered_bb.JumpThreading.diff
+// EMIT_MIR jump_threading.disappearing_bb.JumpThreading.diff
diff --git a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff
new file mode 100644
index 000000000..f5eade4a9
--- /dev/null
+++ b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff
@@ -0,0 +1,98 @@
+- // MIR for `too_complex` before JumpThreading
++ // MIR for `too_complex` after JumpThreading
+
+ fn too_complex(_1: Result<i32, usize>) -> Option<i32> {
+ debug x => _1;
+ let mut _0: std::option::Option<i32>;
+ let mut _2: std::ops::ControlFlow<usize, i32>;
+ let mut _3: isize;
+ let _4: i32;
+ let mut _5: i32;
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: isize;
+ let _9: i32;
+ let mut _10: i32;
+ let _11: usize;
+ scope 1 {
+ debug v => _4;
+ }
+ scope 2 {
+ debug r => _6;
+ }
+ scope 3 {
+ debug v => _9;
+ }
+ scope 4 {
+ debug r => _11;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _3 = discriminant(_1);
+ switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = ((_1 as Err).0: usize);
+ StorageLive(_7);
+ _7 = _6;
+ _2 = ControlFlow::<usize, i32>::Break(move _7);
+ StorageDead(_7);
+ StorageDead(_6);
+- goto -> bb4;
++ goto -> bb8;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+ _4 = ((_1 as Ok).0: i32);
+ StorageLive(_5);
+ _5 = _4;
+ _2 = ControlFlow::<usize, i32>::Continue(move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _8 = discriminant(_2);
+- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2];
++ goto -> bb6;
+ }
+
+ bb5: {
+ StorageLive(_11);
+ _11 = ((_2 as Break).0: usize);
+ _0 = Option::<i32>::None;
+ StorageDead(_11);
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageLive(_9);
+ _9 = ((_2 as Continue).0: i32);
+ StorageLive(_10);
+ _10 = _9;
+ _0 = Option::<i32>::Some(move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb7;
+ }
+
+ bb7: {
+ StorageDead(_2);
+ return;
++ }
++
++ bb8: {
++ _8 = discriminant(_2);
++ goto -> bb5;
+ }
+ }
+
diff --git a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff
new file mode 100644
index 000000000..f5eade4a9
--- /dev/null
+++ b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff
@@ -0,0 +1,98 @@
+- // MIR for `too_complex` before JumpThreading
++ // MIR for `too_complex` after JumpThreading
+
+ fn too_complex(_1: Result<i32, usize>) -> Option<i32> {
+ debug x => _1;
+ let mut _0: std::option::Option<i32>;
+ let mut _2: std::ops::ControlFlow<usize, i32>;
+ let mut _3: isize;
+ let _4: i32;
+ let mut _5: i32;
+ let _6: usize;
+ let mut _7: usize;
+ let mut _8: isize;
+ let _9: i32;
+ let mut _10: i32;
+ let _11: usize;
+ scope 1 {
+ debug v => _4;
+ }
+ scope 2 {
+ debug r => _6;
+ }
+ scope 3 {
+ debug v => _9;
+ }
+ scope 4 {
+ debug r => _11;
+ }
+
+ bb0: {
+ StorageLive(_2);
+ _3 = discriminant(_1);
+ switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2];
+ }
+
+ bb1: {
+ StorageLive(_6);
+ _6 = ((_1 as Err).0: usize);
+ StorageLive(_7);
+ _7 = _6;
+ _2 = ControlFlow::<usize, i32>::Break(move _7);
+ StorageDead(_7);
+ StorageDead(_6);
+- goto -> bb4;
++ goto -> bb8;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ StorageLive(_4);
+ _4 = ((_1 as Ok).0: i32);
+ StorageLive(_5);
+ _5 = _4;
+ _2 = ControlFlow::<usize, i32>::Continue(move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb4: {
+ _8 = discriminant(_2);
+- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2];
++ goto -> bb6;
+ }
+
+ bb5: {
+ StorageLive(_11);
+ _11 = ((_2 as Break).0: usize);
+ _0 = Option::<i32>::None;
+ StorageDead(_11);
+ goto -> bb7;
+ }
+
+ bb6: {
+ StorageLive(_9);
+ _9 = ((_2 as Continue).0: i32);
+ StorageLive(_10);
+ _10 = _9;
+ _0 = Option::<i32>::Some(move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb7;
+ }
+
+ bb7: {
+ StorageDead(_2);
+ return;
++ }
++
++ bb8: {
++ _8 = discriminant(_2);
++ goto -> bb5;
+ }
+ }
+
diff --git a/tests/mir-opt/loop_test.rs b/tests/mir-opt/loop_test.rs
index 7ded5b575..81a0d9df0 100644
--- a/tests/mir-opt/loop_test.rs
+++ b/tests/mir-opt/loop_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z identify_regions
// Tests to make sure we correctly generate falseUnwind edges in loops
diff --git a/tests/mir-opt/lower_array_len.rs b/tests/mir-opt/lower_array_len.rs
index 7d69e1759..effd83b6a 100644
--- a/tests/mir-opt/lower_array_len.rs
+++ b/tests/mir-opt/lower_array_len.rs
@@ -4,6 +4,9 @@
// EMIT_MIR lower_array_len.array_bound.NormalizeArrayLen.diff
pub fn array_bound<const N: usize>(index: usize, slice: &[u8; N]) -> u8 {
+ // CHECK-LABEL: fn array_bound(
+ // CHECK: [[len:_.*]] = const N;
+ // CHECK: Lt(move {{_.*}}, move [[len]]);
if index < slice.len() {
slice[index]
} else {
@@ -13,6 +16,9 @@ pub fn array_bound<const N: usize>(index: usize, slice: &[u8; N]) -> u8 {
// EMIT_MIR lower_array_len.array_bound_mut.NormalizeArrayLen.diff
pub fn array_bound_mut<const N: usize>(index: usize, slice: &mut [u8; N]) -> u8 {
+ // CHECK-LABEL: fn array_bound_mut(
+ // CHECK: [[len:_.*]] = const N;
+ // CHECK: Lt(move {{_.*}}, move [[len]]);
if index < slice.len() {
slice[index]
} else {
@@ -24,16 +30,22 @@ pub fn array_bound_mut<const N: usize>(index: usize, slice: &mut [u8; N]) -> u8
// EMIT_MIR lower_array_len.array_len.NormalizeArrayLen.diff
pub fn array_len<const N: usize>(arr: &[u8; N]) -> usize {
+ // CHECK-LABEL: fn array_len(
+ // CHECK: _0 = const N;
arr.len()
}
// EMIT_MIR lower_array_len.array_len_by_value.NormalizeArrayLen.diff
pub fn array_len_by_value<const N: usize>(arr: [u8; N]) -> usize {
+ // CHECK-LABEL: fn array_len_by_value(
+ // CHECK: _0 = const N;
arr.len()
}
// EMIT_MIR lower_array_len.array_len_reborrow.NormalizeArrayLen.diff
pub fn array_len_reborrow<const N: usize>(mut arr: [u8; N]) -> usize {
+ // CHECK-LABEL: fn array_len_reborrow(
+ // CHECK: _0 = const N;
let arr: &mut [_] = &mut arr;
let arr = &*arr;
arr.len()
@@ -41,6 +53,8 @@ pub fn array_len_reborrow<const N: usize>(mut arr: [u8; N]) -> usize {
// EMIT_MIR lower_array_len.array_len_raw.NormalizeArrayLen.diff
pub fn array_len_raw<const N: usize>(arr: [u8; N]) -> usize {
+ // CHECK-LABEL: fn array_len_raw(
+ // CHECK: _0 = const N;
let arr: &[_] = &arr;
let arr = std::ptr::addr_of!(*arr);
unsafe { &*arr }.len()
diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs
index 0758e9b77..913605cc2 100644
--- a/tests/mir-opt/lower_intrinsics.rs
+++ b/tests/mir-opt/lower_intrinsics.rs
@@ -6,6 +6,10 @@
// EMIT_MIR lower_intrinsics.wrapping.LowerIntrinsics.diff
pub fn wrapping(a: i32, b: i32) {
+ // CHECK-LABEL: fn wrapping(
+ // CHECK: {{_.*}} = Add(
+ // CHECK: {{_.*}} = Sub(
+ // CHECK: {{_.*}} = Mul(
let _x = core::intrinsics::wrapping_add(a, b);
let _y = core::intrinsics::wrapping_sub(a, b);
let _z = core::intrinsics::wrapping_mul(a, b);
@@ -13,6 +17,14 @@ pub fn wrapping(a: i32, b: i32) {
// EMIT_MIR lower_intrinsics.unchecked.LowerIntrinsics.diff
pub unsafe fn unchecked(a: i32, b: i32) {
+ // CHECK-LABEL: fn unchecked(
+ // CHECK: {{_.*}} = AddUnchecked(
+ // CHECK: {{_.*}} = SubUnchecked(
+ // CHECK: {{_.*}} = MulUnchecked(
+ // CHECK: {{_.*}} = Div(
+ // CHECK: {{_.*}} = Rem(
+ // CHECK: {{_.*}} = ShlUnchecked(
+ // CHECK: {{_.*}} = ShrUnchecked(
let _a = core::intrinsics::unchecked_add(a, b);
let _b = core::intrinsics::unchecked_sub(a, b);
let _c = core::intrinsics::unchecked_mul(a, b);
@@ -24,26 +36,39 @@ pub unsafe fn unchecked(a: i32, b: i32) {
// EMIT_MIR lower_intrinsics.size_of.LowerIntrinsics.diff
pub fn size_of<T>() -> usize {
+ // CHECK-LABEL: fn size_of(
+ // CHECK: {{_.*}} = SizeOf(T);
core::intrinsics::size_of::<T>()
}
// EMIT_MIR lower_intrinsics.align_of.LowerIntrinsics.diff
pub fn align_of<T>() -> usize {
+ // CHECK-LABEL: fn align_of(
+ // CHECK: {{_.*}} = AlignOf(T);
core::intrinsics::min_align_of::<T>()
}
// EMIT_MIR lower_intrinsics.forget.LowerIntrinsics.diff
pub fn forget<T>(t: T) {
+ // CHECK-LABEL: fn forget(
+ // CHECK-NOT: Drop(
+ // CHECK: return;
+ // CHECK-NOT: Drop(
core::intrinsics::forget(t)
}
// EMIT_MIR lower_intrinsics.unreachable.LowerIntrinsics.diff
pub fn unreachable() -> ! {
+ // CHECK-LABEL: fn unreachable(
+ // CHECK: unreachable;
unsafe { core::intrinsics::unreachable() };
}
// EMIT_MIR lower_intrinsics.non_const.LowerIntrinsics.diff
pub fn non_const<T>() -> usize {
+ // CHECK-LABEL: fn non_const(
+ // CHECK: SizeOf(T);
+
// Check that lowering works with non-const operand as a func.
let size_of_t = core::intrinsics::size_of::<T>;
size_of_t()
@@ -51,33 +76,55 @@ pub fn non_const<T>() -> usize {
// EMIT_MIR lower_intrinsics.transmute_inhabited.LowerIntrinsics.diff
pub fn transmute_inhabited(c: std::cmp::Ordering) -> i8 {
+ // CHECK-LABEL: fn transmute_inhabited(
+ // CHECK: {{_.*}} = {{.*}} as i8 (Transmute);
+
unsafe { std::mem::transmute(c) }
}
// EMIT_MIR lower_intrinsics.transmute_uninhabited.LowerIntrinsics.diff
pub unsafe fn transmute_uninhabited(u: ()) -> Never {
+ // CHECK-LABEL: fn transmute_uninhabited(
+ // CHECK: {{_.*}} = {{.*}} as Never (Transmute);
+ // CHECK: unreachable;
+
unsafe { std::mem::transmute::<(), Never>(u) }
}
// EMIT_MIR lower_intrinsics.transmute_ref_dst.LowerIntrinsics.diff
pub unsafe fn transmute_ref_dst<T: ?Sized>(u: &T) -> *const T {
+ // CHECK-LABEL: fn transmute_ref_dst(
+ // CHECK: {{_.*}} = {{.*}} as *const T (Transmute);
+
unsafe { std::mem::transmute(u) }
}
// EMIT_MIR lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
pub unsafe fn transmute_to_ref_uninhabited() -> ! {
+ // CHECK-LABEL: fn transmute_to_ref_uninhabited(
+ // CHECK: {{_.*}} = {{.*}} as &Never (Transmute);
+ // CHECK: unreachable;
+
let x: &Never = std::mem::transmute(1usize);
match *x {}
}
// EMIT_MIR lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
pub unsafe fn transmute_to_mut_uninhabited() -> ! {
+ // CHECK-LABEL: fn transmute_to_mut_uninhabited(
+ // CHECK: {{_.*}} = {{.*}} as &mut Never (Transmute);
+ // CHECK: unreachable;
+
let x: &mut Never = std::mem::transmute(1usize);
match *x {}
}
// EMIT_MIR lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
pub unsafe fn transmute_to_box_uninhabited() -> ! {
+ // CHECK-LABEL: fn transmute_to_box_uninhabited(
+ // CHECK: {{_.*}} = {{.*}} as std::boxed::Box<Never> (Transmute);
+ // CHECK: unreachable;
+
let x: Box<Never> = std::mem::transmute(1usize);
match *x {}
}
@@ -90,6 +137,12 @@ pub enum E {
// EMIT_MIR lower_intrinsics.discriminant.LowerIntrinsics.diff
pub fn discriminant<T>(t: T) {
+ // CHECK-LABEL: fn discriminant(
+ // CHECK: {{_.*}} = discriminant(
+ // CHECK: {{_.*}} = discriminant(
+ // CHECK: {{_.*}} = discriminant(
+ // CHECK: {{_.*}} = discriminant(
+
core::intrinsics::discriminant_value(&t);
core::intrinsics::discriminant_value(&0);
core::intrinsics::discriminant_value(&());
@@ -104,6 +157,9 @@ extern "rust-intrinsic" {
// EMIT_MIR lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff
pub fn f_copy_nonoverlapping() {
+ // CHECK-LABEL: fn f_copy_nonoverlapping(
+ // CHECK: copy_nonoverlapping({{.*}});
+
let src = ();
let mut dst = ();
unsafe {
@@ -113,6 +169,9 @@ pub fn f_copy_nonoverlapping() {
// EMIT_MIR lower_intrinsics.assume.LowerIntrinsics.diff
pub fn assume() {
+ // CHECK-LABEL: fn assume(
+ // CHECK: assume({{.*}});
+
unsafe {
std::intrinsics::assume(true);
}
@@ -120,6 +179,11 @@ pub fn assume() {
// EMIT_MIR lower_intrinsics.with_overflow.LowerIntrinsics.diff
pub fn with_overflow(a: i32, b: i32) {
+ // CHECK-LABEL: fn with_overflow(
+ // CHECK: CheckedAdd(
+ // CHECK: CheckedSub(
+ // CHECK: CheckedMul(
+
let _x = core::intrinsics::add_with_overflow(a, b);
let _y = core::intrinsics::sub_with_overflow(a, b);
let _z = core::intrinsics::mul_with_overflow(a, b);
@@ -127,16 +191,32 @@ pub fn with_overflow(a: i32, b: i32) {
// EMIT_MIR lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.diff
pub fn read_via_copy_primitive(r: &i32) -> i32 {
+ // CHECK-LABEL: fn read_via_copy_primitive(
+ // CHECK: [[tmp:_.*]] = &raw const (*_1);
+ // CHECK: _0 = (*[[tmp]]);
+ // CHECK: return;
+
unsafe { core::intrinsics::read_via_copy(r) }
}
// EMIT_MIR lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.diff
pub fn read_via_copy_uninhabited(r: &Never) -> Never {
+ // CHECK-LABEL: fn read_via_copy_uninhabited(
+ // CHECK: [[tmp:_.*]] = &raw const (*_1);
+ // CHECK: _0 = (*[[tmp]]);
+ // CHECK: unreachable;
+
unsafe { core::intrinsics::read_via_copy(r) }
}
// EMIT_MIR lower_intrinsics.write_via_move_string.LowerIntrinsics.diff
pub fn write_via_move_string(r: &mut String, v: String) {
+ // CHECK-LABEL: fn write_via_move_string(
+ // CHECK: [[ptr:_.*]] = &raw mut (*_1);
+ // CHECK: [[tmp:_.*]] = move _2;
+ // CHECK: (*[[ptr]]) = move [[tmp]];
+ // CHECK: return;
+
unsafe { core::intrinsics::write_via_move(r, v) }
}
@@ -144,6 +224,10 @@ pub enum Never {}
// EMIT_MIR lower_intrinsics.option_payload.LowerIntrinsics.diff
pub fn option_payload(o: &Option<usize>, p: &Option<String>) {
+ // CHECK-LABEL: fn option_payload(
+ // CHECK: {{_.*}} = &raw const (((*{{_.*}}) as Some).0: usize);
+ // CHECK: {{_.*}} = &raw const (((*{{_.*}}) as Some).0: std::string::String);
+
unsafe {
let _x = core::intrinsics::option_payload_ptr(o);
let _y = core::intrinsics::option_payload_ptr(p);
@@ -152,5 +236,8 @@ pub fn option_payload(o: &Option<usize>, p: &Option<String>) {
// EMIT_MIR lower_intrinsics.ptr_offset.LowerIntrinsics.diff
pub unsafe fn ptr_offset(p: *const i32, d: isize) -> *const i32 {
+ // CHECK-LABEL: fn ptr_offset(
+ // CHECK: _0 = Offset(
+
core::intrinsics::offset(p, d)
}
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff
index 49cc8b1af..c4a3358ff 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -4,6 +4,7 @@
fn transmute_to_box_uninhabited() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -16,6 +17,8 @@
}
bb1: {
+ _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
+ PlaceMention((*_2));
unreachable;
}
}
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff
index 49cc8b1af..c4a3358ff 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff
@@ -4,6 +4,7 @@
fn transmute_to_box_uninhabited() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -16,6 +17,8 @@
}
bb1: {
+ _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never);
+ PlaceMention((*_2));
unreachable;
}
}
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff
index 94c7ebe15..c2c4ec000 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -16,6 +16,7 @@
}
bb1: {
+ PlaceMention((*_1));
unreachable;
}
}
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff
index 94c7ebe15..c2c4ec000 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff
@@ -16,6 +16,7 @@
}
bb1: {
+ PlaceMention((*_1));
unreachable;
}
}
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff
index 6576616e0..1b516a1f5 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff
@@ -16,6 +16,7 @@
}
bb1: {
+ PlaceMention((*_1));
unreachable;
}
}
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff
index 6576616e0..1b516a1f5 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff
@@ -16,6 +16,7 @@
}
bb1: {
+ PlaceMention((*_1));
unreachable;
}
}
diff --git a/tests/mir-opt/lower_slice_len.rs b/tests/mir-opt/lower_slice_len.rs
index b0c512aec..7b967a165 100644
--- a/tests/mir-opt/lower_slice_len.rs
+++ b/tests/mir-opt/lower_slice_len.rs
@@ -1,8 +1,10 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: LowerSliceLenCalls
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR lower_slice_len.bound.LowerSliceLenCalls.diff
pub fn bound(index: usize, slice: &[u8]) -> u8 {
+ // CHECK-LABEL: fn bound(
+ // CHECK-NOT: ::len(
if index < slice.len() {
slice[index]
} else {
diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
index 137688ff6..b4bd45ba5 100644
--- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
+++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -31,7 +31,7 @@
}
bb0: {
-- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2];
+ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1];
}
diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
index 137688ff6..b4bd45ba5 100644
--- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
+++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -31,7 +31,7 @@
}
bb0: {
-- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2];
+ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1];
}
diff --git a/tests/mir-opt/match_arm_scopes.rs b/tests/mir-opt/match_arm_scopes.rs
index e0249de86..43746e993 100644
--- a/tests/mir-opt/match_arm_scopes.rs
+++ b/tests/mir-opt/match_arm_scopes.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Test that StorageDead and Drops are generated properly for bindings in
// matches:
diff --git a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
index 8764236bf..ebb2f70a4 100644
--- a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
@@ -26,7 +26,7 @@ fn main() -> () {
_2 = const true;
FakeRead(ForLet(None), _2);
StorageLive(_3);
- FakeRead(ForMatchedPlace(None), _1);
+ PlaceMention(_1);
_6 = Le(const 0_i32, _1);
switchInt(move _6) -> [0: bb4, otherwise: bb1];
}
diff --git a/tests/mir-opt/match_test.rs b/tests/mir-opt/match_test.rs
index 3a2107790..e465289e4 100644
--- a/tests/mir-opt/match_test.rs
+++ b/tests/mir-opt/match_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Make sure redundant testing paths in `match` expressions are sorted out.
#![feature(exclusive_range_pattern)]
diff --git a/tests/mir-opt/matches_reduce_branches.rs b/tests/mir-opt/matches_reduce_branches.rs
index a81d5f7b4..13db79734 100644
--- a/tests/mir-opt/matches_reduce_branches.rs
+++ b/tests/mir-opt/matches_reduce_branches.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: MatchBranchSimplification
diff --git a/tests/mir-opt/matches_u8.rs b/tests/mir-opt/matches_u8.rs
index 422c3a95e..47c4ffee0 100644
--- a/tests/mir-opt/matches_u8.rs
+++ b/tests/mir-opt/matches_u8.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: MatchBranchSimplification
diff --git a/tests/mir-opt/multiple_return_terminators.rs b/tests/mir-opt/multiple_return_terminators.rs
index a2b902d14..f33243ecf 100644
--- a/tests/mir-opt/multiple_return_terminators.rs
+++ b/tests/mir-opt/multiple_return_terminators.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=4
// EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff
diff --git a/tests/mir-opt/nll/named_lifetimes_basic.rs b/tests/mir-opt/nll/named_lifetimes_basic.rs
index 843716033..5a9312de2 100644
--- a/tests/mir-opt/nll/named_lifetimes_basic.rs
+++ b/tests/mir-opt/nll/named_lifetimes_basic.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Basic test for named lifetime translation. Check that we
// instantiate the types that appear in function arguments with
// suitable variables and that we setup the outlives relationship
diff --git a/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir b/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir
index 1d6b83073..49f0a4329 100644
--- a/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir
+++ b/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir
@@ -24,14 +24,14 @@
| '?2 live at {bb0[0..=1]}
| '?3 live at {bb0[0..=1]}
| '?4 live at {bb0[0..=1]}
-| '?1: '?5 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0)
-| '?1: '?7 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0)
-| '?2: '?6 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0)
-| '?3: '?8 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0)
-| '?5: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0)
-| '?6: '?2 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0)
-| '?7: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0)
-| '?8: '?3 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0)
+| '?1: '?5 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:26: 13:27) ($DIR/named_lifetimes_basic.rs:13:26: 13:27 (#0)
+| '?1: '?7 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:54: 13:55) ($DIR/named_lifetimes_basic.rs:13:54: 13:55 (#0)
+| '?2: '?6 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:42: 13:43) ($DIR/named_lifetimes_basic.rs:13:42: 13:43 (#0)
+| '?3: '?8 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:66: 13:67) ($DIR/named_lifetimes_basic.rs:13:66: 13:67 (#0)
+| '?5: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:26: 13:27) ($DIR/named_lifetimes_basic.rs:13:26: 13:27 (#0)
+| '?6: '?2 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:42: 13:43) ($DIR/named_lifetimes_basic.rs:13:42: 13:43 (#0)
+| '?7: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:54: 13:55) ($DIR/named_lifetimes_basic.rs:13:54: 13:55 (#0)
+| '?8: '?3 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:13:66: 13:67) ($DIR/named_lifetimes_basic.rs:13:66: 13:67 (#0)
|
fn use_x(_1: &'?5 mut i32, _2: &'?6 u32, _3: &'?7 u32, _4: &'?8 u32) -> bool {
debug w => _1;
diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir
index c581d0f84..ad456600b 100644
--- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir
+++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir
@@ -17,8 +17,8 @@
| '?2 live at {bb1[0]}
| '?3 live at {bb1[1..=3]}
| '?4 live at {bb1[4..=7], bb2[0..=2]}
-| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0)
-| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0)
+| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:19:13: 19:18 (#0)
+| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:20:13: 20:14 (#0)
|
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir
index 48243e34d..a15d47cd6 100644
--- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir
+++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir
@@ -17,8 +17,8 @@
| '?2 live at {bb1[0]}
| '?3 live at {bb1[1..=3]}
| '?4 live at {bb1[4..=7], bb2[0..=2]}
-| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0)
-| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0)
+| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:19:13: 19:18 (#0)
+| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:20:13: 20:14 (#0)
|
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/nll/region_subtyping_basic.rs b/tests/mir-opt/nll/region_subtyping_basic.rs
index 64332f302..83f756acd 100644
--- a/tests/mir-opt/nll/region_subtyping_basic.rs
+++ b/tests/mir-opt/nll/region_subtyping_basic.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Basic test for liveness constraints: the region (`R1`) that appears
// in the type of `p` includes the points after `&v[0]` up to (but not
// including) the call to `use_x`. The `else` branch is not included.
diff --git a/tests/mir-opt/no_drop_for_inactive_variant.rs b/tests/mir-opt/no_drop_for_inactive_variant.rs
index adbd1f353..dd20e4a54 100644
--- a/tests/mir-opt/no_drop_for_inactive_variant.rs
+++ b/tests/mir-opt/no_drop_for_inactive_variant.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Ensure that there are no drop terminators in `unwrap<T>` (except the one along the cleanup
diff --git a/tests/mir-opt/no_spurious_drop_after_call.rs b/tests/mir-opt/no_spurious_drop_after_call.rs
index 71f050502..cd7b8fb79 100644
--- a/tests/mir-opt/no_spurious_drop_after_call.rs
+++ b/tests/mir-opt/no_spurious_drop_after_call.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Test that after the call to `std::mem::drop` we do not generate a
diff --git a/tests/mir-opt/not_equal_false.rs b/tests/mir-opt/not_equal_false.rs
deleted file mode 100644
index e05607329..000000000
--- a/tests/mir-opt/not_equal_false.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// unit-test: InstSimplify
-// EMIT_MIR not_equal_false.opt.InstSimplify.diff
-
-fn opt(x: bool) -> u32 {
- if x != false { 0 } else { 1 }
-}
-
-fn main() {
- opt(false);
-}
diff --git a/tests/mir-opt/nrvo_miscompile_111005.rs b/tests/mir-opt/nrvo_miscompile_111005.rs
index a9f391b79..aff037ae4 100644
--- a/tests/mir-opt/nrvo_miscompile_111005.rs
+++ b/tests/mir-opt/nrvo_miscompile_111005.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// This is a miscompilation, #111005 to track
// unit-test: RenameReturnPlace
diff --git a/tests/mir-opt/nrvo_simple.rs b/tests/mir-opt/nrvo_simple.rs
index 9e822ed51..5b403c560 100644
--- a/tests/mir-opt/nrvo_simple.rs
+++ b/tests/mir-opt/nrvo_simple.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: RenameReturnPlace
diff --git a/tests/mir-opt/packed_struct_drop_aligned.rs b/tests/mir-opt/packed_struct_drop_aligned.rs
index f88a68353..079c4e68f 100644
--- a/tests/mir-opt/packed_struct_drop_aligned.rs
+++ b/tests/mir-opt/packed_struct_drop_aligned.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs
index 430300419..d1d400af2 100644
--- a/tests/mir-opt/pre-codegen/chained_comparison.rs
+++ b/tests/mir-opt/pre-codegen/chained_comparison.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs
index 23d78e987..d386219f4 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.rs
+++ b/tests/mir-opt/pre-codegen/checked_ops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
// needs-unwind
// only-x86_64
diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
index 75f81c5aa..cf7feef00 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
@@ -8,59 +8,62 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
debug start => _1;
debug n => _2;
let _3: std::option::Option<u32>;
- let mut _6: bool;
- let mut _7: u32;
- let mut _8: &std::option::Option<u32>;
+ let mut _4: &std::option::Option<u32>;
+ let mut _7: bool;
+ let mut _8: u32;
scope 2 {
}
scope 3 (inlined Option::<u32>::is_none) {
- debug self => _8;
- let mut _5: bool;
+ debug self => _4;
+ let mut _6: bool;
scope 4 (inlined Option::<u32>::is_some) {
- debug self => _8;
- let mut _4: isize;
+ debug self => _4;
+ let mut _5: isize;
}
}
scope 5 (inlined core::num::<impl u32>::wrapping_add) {
debug self => _1;
- debug rhs => _7;
+ debug rhs => _8;
}
}
bb0: {
- StorageLive(_6);
- StorageLive(_8);
+ StorageLive(_7);
+ StorageLive(_4);
StorageLive(_3);
_3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue];
}
bb1: {
+ _4 = &_3;
+ StorageLive(_6);
StorageLive(_5);
- _4 = discriminant(_3);
- _5 = Eq(_4, const 1_isize);
- _6 = Not(move _5);
+ _5 = discriminant(_3);
+ _6 = Eq(_5, const 1_isize);
StorageDead(_5);
- switchInt(move _6) -> [0: bb2, otherwise: bb3];
+ _7 = Not(move _6);
+ StorageDead(_6);
+ switchInt(move _7) -> [0: bb2, otherwise: bb3];
}
bb2: {
StorageDead(_3);
- StorageDead(_8);
+ StorageDead(_4);
goto -> bb4;
}
bb3: {
StorageDead(_3);
- StorageDead(_8);
+ StorageDead(_4);
assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue];
}
bb4: {
- StorageDead(_6);
- StorageLive(_7);
- _7 = _2 as u32 (IntToInt);
- _0 = Add(_1, _7);
StorageDead(_7);
+ StorageLive(_8);
+ _8 = _2 as u32 (IntToInt);
+ _0 = Add(_1, _8);
+ StorageDead(_8);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
index d8af6b14d..b1a00d293 100644
--- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
+++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0
// ignore-debug: standard library debug assertions add a panic that breaks this optimization
diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
index 65d71199a..0114309db 100644
--- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
@@ -4,6 +4,7 @@ fn ub_if_b(_1: Thing) -> Thing {
debug t => _1;
let mut _0: Thing;
let mut _2: isize;
+ let mut _3: bool;
scope 1 (inlined unreachable_unchecked) {
scope 2 {
scope 3 (inlined unreachable_unchecked::runtime) {
@@ -13,15 +14,9 @@ fn ub_if_b(_1: Thing) -> Thing {
bb0: {
_2 = discriminant(_1);
- switchInt(move _2) -> [0: bb1, otherwise: bb2];
- }
-
- bb1: {
+ _3 = Eq(_2, const 0_isize);
+ assume(move _3);
_0 = move _1;
return;
}
-
- bb2: {
- unreachable;
- }
}
diff --git a/tests/mir-opt/pre-codegen/intrinsics.rs b/tests/mir-opt/pre-codegen/intrinsics.rs
index e32e04384..565bd89e5 100644
--- a/tests/mir-opt/pre-codegen/intrinsics.rs
+++ b/tests/mir-opt/pre-codegen/intrinsics.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
new file mode 100644
index 000000000..50189d192
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined #[track_caller] Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap) {
+ debug self => _6;
+ let mut _12: isize;
+ let _13: std::alloc::AllocError;
+ let mut _14: !;
+ let _15: &str;
+ let mut _16: &dyn std::fmt::Debug;
+ let mut _17: &std::alloc::AllocError;
+ scope 7 {
+ debug t => _5;
+ }
+ scope 8 {
+ debug e => const std::alloc::AllocError;
+ }
+ }
+ scope 9 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _18: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb4, unwind unreachable];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageLive(_12);
+ StorageLive(_15);
+ _12 = discriminant(_6);
+ switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ _15 = const "called `Result::unwrap()` on an `Err` value";
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &_13;
+ _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize));
+ StorageDead(_17);
+ _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable;
+ }
+
+ bb6: {
+ _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>);
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_6);
+ StorageLive(_18);
+ _18 = (_5.0: *const [u8]);
+ _4 = move _18 as *mut [u8] (PtrToPtr);
+ StorageDead(_18);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 __ __ __ __ │ ....░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff
new file mode 100644
index 000000000..6966762a1
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff
@@ -0,0 +1,92 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _12: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageLive(_12);
+ _12 = (_5.0: *const [u8]);
+ _4 = move _12 as *mut [u8] (PtrToPtr);
+ StorageDead(_12);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+
+ bb2: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb5, unwind continue];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ _5 = Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue];
+ }
+ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 __ __ __ __ │ ....░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff
new file mode 100644
index 000000000..08a185bad
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined #[track_caller] Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap) {
+ debug self => _6;
+ let mut _12: isize;
+ let _13: std::alloc::AllocError;
+ let mut _14: !;
+ let _15: &str;
+ let mut _16: &dyn std::fmt::Debug;
+ let mut _17: &std::alloc::AllocError;
+ scope 7 {
+ debug t => _5;
+ }
+ scope 8 {
+ debug e => const std::alloc::AllocError;
+ }
+ }
+ scope 9 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _18: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): ptr::alignment::AlignmentEnum64) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb4, unwind unreachable];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageLive(_12);
+ StorageLive(_15);
+ _12 = discriminant(_6);
+ switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ _15 = const "called `Result::unwrap()` on an `Err` value";
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &_13;
+ _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize));
+ StorageDead(_17);
+ _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable;
+ }
+
+ bb6: {
+ _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>);
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_6);
+ StorageLive(_18);
+ _18 = (_5.0: *const [u8]);
+ _4 = move _18 as *mut [u8] (PtrToPtr);
+ StorageDead(_18);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
++
++ ALLOC0 (size: 16, align: 8) {
++ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff
new file mode 100644
index 000000000..6501cb85e
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff
@@ -0,0 +1,92 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _12: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageLive(_12);
+ _12 = (_5.0: *const [u8]);
+ _4 = move _12 as *mut [u8] (PtrToPtr);
+ StorageDead(_12);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+
+ bb2: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): ptr::alignment::AlignmentEnum64) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb5, unwind continue];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ _5 = Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue];
+ }
+ }
++
++ ALLOC0 (size: 16, align: 8) {
++ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs
new file mode 100644
index 000000000..c92424f29
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs
@@ -0,0 +1,15 @@
+// Verify that we do not ICE when printing an invalid constant.
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+#![feature(allocator_api)]
+
+use std::alloc::{Allocator, Global, Layout};
+
+// EMIT_MIR issue_117368_print_invalid_constant.main.GVN.diff
+fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug layout => const Layout
+ let layout: Layout = None.unwrap();
+ let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
+}
diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
index 4db829a5e..8dbb68899 100644
--- a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
@@ -6,19 +6,18 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
let mut _0: ();
let mut _3: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
let mut _4: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
- let mut _5: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
+ let mut _5: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
let mut _8: std::option::Option<U>;
let mut _9: isize;
let _11: ();
- let mut _12: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
scope 1 {
- debug iter => _5;
+ debug iter => _4;
let _10: U;
scope 2 {
debug x => _10;
}
scope 4 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as Iterator>::next) {
- debug self => _12;
+ debug self => _5;
let mut _6: &mut impl Iterator<Item = T>;
let mut _7: &mut impl Fn(T) -> Option<U>;
}
@@ -28,25 +27,22 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
}
bb0: {
- StorageLive(_4);
- StorageLive(_3);
_3 = <impl Iterator<Item = T> as Iterator>::filter_map::<U, impl Fn(T) -> Option<U>>(move _1, move _2) -> [return: bb1, unwind continue];
}
bb1: {
+ StorageLive(_4);
_4 = move _3;
- StorageDead(_3);
- StorageLive(_5);
- _5 = move _4;
goto -> bb2;
}
bb2: {
StorageLive(_8);
+ _5 = &mut _4;
StorageLive(_6);
- _6 = &mut (_5.0: impl Iterator<Item = T>);
+ _6 = &mut (_4.0: impl Iterator<Item = T>);
StorageLive(_7);
- _7 = &mut (_5.1: impl Fn(T) -> Option<U>);
+ _7 = &mut (_4.1: impl Fn(T) -> Option<U>);
_8 = <impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>(move _6, move _7) -> [return: bb3, unwind: bb9];
}
@@ -59,11 +55,10 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
bb4: {
StorageDead(_8);
- drop(_5) -> [return: bb5, unwind continue];
+ drop(_4) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_5);
StorageDead(_4);
return;
}
@@ -83,7 +78,7 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate(cleanup)];
+ drop(_4) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
index 0d79f2de1..49f685cfa 100644
--- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
@@ -6,35 +6,35 @@ fn int_range(_1: usize, _2: usize) -> () {
let mut _0: ();
let mut _3: std::ops::Range<usize>;
let mut _4: std::ops::Range<usize>;
- let mut _8: std::option::Option<usize>;
- let mut _11: isize;
- let _13: ();
- let mut _14: &mut std::ops::Range<usize>;
+ let mut _5: &mut std::ops::Range<usize>;
+ let mut _11: std::option::Option<usize>;
+ let mut _14: isize;
+ let _16: ();
scope 1 {
debug iter => _4;
- let _12: usize;
+ let _15: usize;
scope 2 {
- debug i => _12;
+ debug i => _15;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
- debug self => _14;
+ debug self => _5;
scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _14;
- let mut _7: bool;
- let _9: usize;
- let mut _10: usize;
- let mut _15: &usize;
- let mut _16: &usize;
+ debug self => _5;
+ let mut _6: &usize;
+ let mut _7: &usize;
+ let mut _10: bool;
+ let _12: usize;
+ let mut _13: usize;
scope 6 {
- debug old => _9;
+ debug old => _12;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
- debug self => _15;
- debug other => _16;
- let mut _5: usize;
- let mut _6: usize;
+ debug self => _6;
+ debug other => _7;
+ let mut _8: usize;
+ let mut _9: usize;
}
}
}
@@ -51,63 +51,66 @@ fn int_range(_1: usize, _2: usize) -> () {
}
bb1: {
+ StorageLive(_11);
+ _5 = &mut _4;
+ StorageLive(_12);
+ StorageLive(_10);
+ StorageLive(_6);
+ _6 = &(_4.0: usize);
+ StorageLive(_7);
+ _7 = &(_4.1: usize);
StorageLive(_8);
+ _8 = (_4.0: usize);
StorageLive(_9);
- StorageLive(_7);
- StorageLive(_15);
- StorageLive(_16);
- StorageLive(_5);
- _5 = (_4.0: usize);
- StorageLive(_6);
- _6 = (_4.1: usize);
- _7 = Lt(move _5, move _6);
- StorageDead(_6);
- StorageDead(_5);
- switchInt(move _7) -> [0: bb2, otherwise: bb3];
+ _9 = (_4.1: usize);
+ _10 = Lt(move _8, move _9);
+ StorageDead(_9);
+ StorageDead(_8);
+ switchInt(move _10) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_16);
- StorageDead(_15);
- _8 = Option::<usize>::None;
+ StorageDead(_7);
+ StorageDead(_6);
+ _11 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_16);
- StorageDead(_15);
- _9 = (_4.0: usize);
- StorageLive(_10);
- _10 = <usize as Step>::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue];
+ StorageDead(_7);
+ StorageDead(_6);
+ _12 = (_4.0: usize);
+ StorageLive(_13);
+ _13 = <usize as Step>::forward_unchecked(_12, const 1_usize) -> [return: bb4, unwind continue];
}
bb4: {
- (_4.0: usize) = move _10;
- StorageDead(_10);
- _8 = Option::<usize>::Some(_9);
+ (_4.0: usize) = move _13;
+ StorageDead(_13);
+ _11 = Option::<usize>::Some(_12);
goto -> bb5;
}
bb5: {
- StorageDead(_7);
- StorageDead(_9);
- _11 = discriminant(_8);
- switchInt(move _11) -> [0: bb6, 1: bb7, otherwise: bb9];
+ StorageDead(_10);
+ StorageDead(_12);
+ _14 = discriminant(_11);
+ switchInt(move _14) -> [0: bb6, 1: bb7, otherwise: bb9];
}
bb6: {
- StorageDead(_8);
+ StorageDead(_11);
StorageDead(_4);
return;
}
bb7: {
- _12 = ((_8 as Some).0: usize);
- _13 = opaque::<usize>(move _12) -> [return: bb8, unwind continue];
+ _15 = ((_11 as Some).0: usize);
+ _16 = opaque::<usize>(move _15) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_8);
+ StorageDead(_11);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
index c30df7425..30bdc1310 100644
--- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
@@ -6,16 +6,15 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
let mut _0: ();
let mut _3: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
let mut _4: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
- let mut _5: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
- let mut _6: &mut std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
- let mut _7: std::option::Option<U>;
- let mut _8: isize;
- let _10: ();
+ let mut _5: &mut std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
+ let mut _6: std::option::Option<U>;
+ let mut _7: isize;
+ let _9: ();
scope 1 {
- debug iter => _5;
- let _9: U;
+ debug iter => _4;
+ let _8: U;
scope 2 {
- debug x => _9;
+ debug x => _8;
}
}
scope 3 (inlined <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as IntoIterator>::into_iter) {
@@ -23,50 +22,45 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
}
bb0: {
- StorageLive(_4);
- StorageLive(_3);
_3 = <impl Iterator<Item = T> as Iterator>::map::<U, impl Fn(T) -> U>(move _1, move _2) -> [return: bb1, unwind continue];
}
bb1: {
+ StorageLive(_4);
_4 = move _3;
- StorageDead(_3);
- StorageLive(_5);
- _5 = move _4;
goto -> bb2;
}
bb2: {
- StorageLive(_7);
StorageLive(_6);
- _6 = &mut _5;
- _7 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(move _6) -> [return: bb3, unwind: bb9];
+ StorageLive(_5);
+ _5 = &mut _4;
+ _6 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(move _5) -> [return: bb3, unwind: bb9];
}
bb3: {
- StorageDead(_6);
- _8 = discriminant(_7);
- switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb8];
+ StorageDead(_5);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb8];
}
bb4: {
- StorageDead(_7);
- drop(_5) -> [return: bb5, unwind continue];
+ StorageDead(_6);
+ drop(_4) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_5);
StorageDead(_4);
return;
}
bb6: {
- _9 = move ((_7 as Some).0: U);
- _10 = opaque::<U>(move _9) -> [return: bb7, unwind: bb9];
+ _8 = move ((_6 as Some).0: U);
+ _9 = opaque::<U>(move _8) -> [return: bb7, unwind: bb9];
}
bb7: {
- StorageDead(_7);
+ StorageDead(_6);
goto -> bb2;
}
@@ -75,7 +69,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate(cleanup)];
+ drop(_4) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs
index f3ba40922..7f9c26f4f 100644
--- a/tests/mir-opt/pre-codegen/loops.rs
+++ b/tests/mir-opt/pre-codegen/loops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -g
// needs-unwind
diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs
index a139848ba..18c4653d4 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.rs
+++ b/tests/mir-opt/pre-codegen/mem_replace.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// ignore-debug the standard library debug assertions leak into this test
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
index 681e9666e..bddd961c9 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
index db16b8d82..297ebd79f 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
index 681e9666e..bddd961c9 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
index db16b8d82..297ebd79f 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
index 704f8f887..bb089ea44 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
index 9664ccfb0..91c3731f4 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
@@ -7,37 +7,37 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
let mut _0: ();
let mut _4: std::ops::Range<u32>;
let mut _5: std::ops::Range<u32>;
- let mut _9: std::option::Option<u32>;
- let mut _12: isize;
- let mut _14: &impl Fn(u32);
- let mut _15: (u32,);
- let _16: ();
- let mut _17: &mut std::ops::Range<u32>;
+ let mut _6: &mut std::ops::Range<u32>;
+ let mut _12: std::option::Option<u32>;
+ let mut _15: isize;
+ let mut _17: &impl Fn(u32);
+ let mut _18: (u32,);
+ let _19: ();
scope 1 {
debug iter => _5;
- let _13: u32;
+ let _16: u32;
scope 2 {
- debug x => _13;
+ debug x => _16;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
- debug self => _17;
+ debug self => _6;
scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _17;
- let mut _8: bool;
- let _10: u32;
- let mut _11: u32;
- let mut _18: &u32;
- let mut _19: &u32;
+ debug self => _6;
+ let mut _7: &u32;
+ let mut _8: &u32;
+ let mut _11: bool;
+ let _13: u32;
+ let mut _14: u32;
scope 6 {
- debug old => _10;
+ debug old => _13;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _18;
- debug other => _19;
- let mut _6: u32;
- let mut _7: u32;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: u32;
+ let mut _10: u32;
}
}
}
@@ -54,52 +54,55 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: u32);
+ StorageLive(_8);
+ _8 = &(_5.1: u32);
StorageLive(_9);
+ _9 = (_5.0: u32);
StorageLive(_10);
- StorageLive(_8);
- StorageLive(_18);
- StorageLive(_19);
- StorageLive(_6);
- _6 = (_5.0: u32);
- StorageLive(_7);
- _7 = (_5.1: u32);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: u32);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_19);
- StorageDead(_18);
- _9 = Option::<u32>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_19);
- StorageDead(_18);
- _10 = (_5.0: u32);
- StorageLive(_11);
- _11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: u32);
+ StorageLive(_14);
+ _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable];
}
bb4: {
- (_5.0: u32) = move _11;
- StorageDead(_11);
- _9 = Option::<u32>::Some(_10);
+ (_5.0: u32) = move _14;
+ StorageDead(_14);
+ _12 = Option::<u32>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_3) -> [return: bb7, unwind unreachable];
}
@@ -109,18 +112,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: u32);
- StorageLive(_14);
- _14 = &_3;
- StorageLive(_15);
- _15 = (_13,);
- _16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind unreachable];
+ _16 = ((_12 as Some).0: u32);
+ StorageLive(_17);
+ _17 = &_3;
+ StorageLive(_18);
+ _18 = (_16,);
+ _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind unreachable];
}
bb9: {
- StorageDead(_15);
- StorageDead(_14);
- StorageDead(_9);
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index dc8b46b6c..f76de02c9 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -7,37 +7,37 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
let mut _0: ();
let mut _4: std::ops::Range<u32>;
let mut _5: std::ops::Range<u32>;
- let mut _9: std::option::Option<u32>;
- let mut _12: isize;
- let mut _14: &impl Fn(u32);
- let mut _15: (u32,);
- let _16: ();
- let mut _17: &mut std::ops::Range<u32>;
+ let mut _6: &mut std::ops::Range<u32>;
+ let mut _12: std::option::Option<u32>;
+ let mut _15: isize;
+ let mut _17: &impl Fn(u32);
+ let mut _18: (u32,);
+ let _19: ();
scope 1 {
debug iter => _5;
- let _13: u32;
+ let _16: u32;
scope 2 {
- debug x => _13;
+ debug x => _16;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
- debug self => _17;
+ debug self => _6;
scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _17;
- let mut _8: bool;
- let _10: u32;
- let mut _11: u32;
- let mut _18: &u32;
- let mut _19: &u32;
+ debug self => _6;
+ let mut _7: &u32;
+ let mut _8: &u32;
+ let mut _11: bool;
+ let _13: u32;
+ let mut _14: u32;
scope 6 {
- debug old => _10;
+ debug old => _13;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _18;
- debug other => _19;
- let mut _6: u32;
- let mut _7: u32;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: u32;
+ let mut _10: u32;
}
}
}
@@ -54,52 +54,55 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: u32);
+ StorageLive(_8);
+ _8 = &(_5.1: u32);
StorageLive(_9);
+ _9 = (_5.0: u32);
StorageLive(_10);
- StorageLive(_8);
- StorageLive(_18);
- StorageLive(_19);
- StorageLive(_6);
- _6 = (_5.0: u32);
- StorageLive(_7);
- _7 = (_5.1: u32);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: u32);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_19);
- StorageDead(_18);
- _9 = Option::<u32>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_19);
- StorageDead(_18);
- _10 = (_5.0: u32);
- StorageLive(_11);
- _11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11];
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: u32);
+ StorageLive(_14);
+ _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb11];
}
bb4: {
- (_5.0: u32) = move _11;
- StorageDead(_11);
- _9 = Option::<u32>::Some(_10);
+ (_5.0: u32) = move _14;
+ StorageDead(_14);
+ _12 = Option::<u32>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_3) -> [return: bb7, unwind continue];
}
@@ -109,18 +112,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: u32);
- StorageLive(_14);
- _14 = &_3;
- StorageLive(_15);
- _15 = (_13,);
- _16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind: bb11];
+ _16 = ((_12 as Some).0: u32);
+ StorageLive(_17);
+ _17 = &_3;
+ StorageLive(_18);
+ _18 = (_16,);
+ _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind: bb11];
}
bb9: {
- StorageDead(_15);
- StorageDead(_14);
- StorageDead(_9);
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
index fff713b5a..a7824f36d 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
@@ -7,65 +7,67 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
debug self => _1;
scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => _1;
- let mut _4: bool;
- let _5: u32;
- let mut _6: u32;
- let mut _7: &u32;
- let mut _8: &u32;
+ let mut _2: &u32;
+ let mut _3: &u32;
+ let mut _6: bool;
+ let _7: u32;
+ let mut _8: u32;
scope 3 {
- debug old => _5;
+ debug old => _7;
scope 4 {
}
}
scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _7;
- debug other => _8;
- let mut _2: u32;
- let mut _3: u32;
+ debug self => _2;
+ debug other => _3;
+ let mut _4: u32;
+ let mut _5: u32;
}
}
}
bb0: {
- StorageLive(_5);
- StorageLive(_4);
StorageLive(_7);
- StorageLive(_8);
+ StorageLive(_6);
StorageLive(_2);
- _2 = ((*_1).0: u32);
+ _2 = &((*_1).0: u32);
StorageLive(_3);
- _3 = ((*_1).1: u32);
- _4 = Lt(move _2, move _3);
- StorageDead(_3);
- StorageDead(_2);
- switchInt(move _4) -> [0: bb1, otherwise: bb2];
+ _3 = &((*_1).1: u32);
+ StorageLive(_4);
+ _4 = ((*_1).0: u32);
+ StorageLive(_5);
+ _5 = ((*_1).1: u32);
+ _6 = Lt(move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ switchInt(move _6) -> [0: bb1, otherwise: bb2];
}
bb1: {
- StorageDead(_8);
- StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_2);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
- StorageDead(_8);
- StorageDead(_7);
- _5 = ((*_1).0: u32);
- StorageLive(_6);
- _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable];
+ StorageDead(_3);
+ StorageDead(_2);
+ _7 = ((*_1).0: u32);
+ StorageLive(_8);
+ _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind unreachable];
}
bb3: {
- ((*_1).0: u32) = move _6;
- StorageDead(_6);
- _0 = Option::<u32>::Some(_5);
+ ((*_1).0: u32) = move _8;
+ StorageDead(_8);
+ _0 = Option::<u32>::Some(_7);
goto -> bb4;
}
bb4: {
- StorageDead(_4);
- StorageDead(_5);
+ StorageDead(_6);
+ StorageDead(_7);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
index cc12c0122..83c9e6c1a 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
@@ -7,65 +7,67 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
debug self => _1;
scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => _1;
- let mut _4: bool;
- let _5: u32;
- let mut _6: u32;
- let mut _7: &u32;
- let mut _8: &u32;
+ let mut _2: &u32;
+ let mut _3: &u32;
+ let mut _6: bool;
+ let _7: u32;
+ let mut _8: u32;
scope 3 {
- debug old => _5;
+ debug old => _7;
scope 4 {
}
}
scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _7;
- debug other => _8;
- let mut _2: u32;
- let mut _3: u32;
+ debug self => _2;
+ debug other => _3;
+ let mut _4: u32;
+ let mut _5: u32;
}
}
}
bb0: {
- StorageLive(_5);
- StorageLive(_4);
StorageLive(_7);
- StorageLive(_8);
+ StorageLive(_6);
StorageLive(_2);
- _2 = ((*_1).0: u32);
+ _2 = &((*_1).0: u32);
StorageLive(_3);
- _3 = ((*_1).1: u32);
- _4 = Lt(move _2, move _3);
- StorageDead(_3);
- StorageDead(_2);
- switchInt(move _4) -> [0: bb1, otherwise: bb2];
+ _3 = &((*_1).1: u32);
+ StorageLive(_4);
+ _4 = ((*_1).0: u32);
+ StorageLive(_5);
+ _5 = ((*_1).1: u32);
+ _6 = Lt(move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ switchInt(move _6) -> [0: bb1, otherwise: bb2];
}
bb1: {
- StorageDead(_8);
- StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_2);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
- StorageDead(_8);
- StorageDead(_7);
- _5 = ((*_1).0: u32);
- StorageLive(_6);
- _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue];
+ StorageDead(_3);
+ StorageDead(_2);
+ _7 = ((*_1).0: u32);
+ StorageLive(_8);
+ _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind continue];
}
bb3: {
- ((*_1).0: u32) = move _6;
- StorageDead(_6);
- _0 = Option::<u32>::Some(_5);
+ ((*_1).0: u32) = move _8;
+ StorageDead(_8);
+ _0 = Option::<u32>::Some(_7);
goto -> bb4;
}
bb4: {
- StorageDead(_4);
- StorageDead(_5);
+ StorageDead(_6);
+ StorageDead(_7);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.rs b/tests/mir-opt/pre-codegen/range_iter.rs
index 955214478..80b1a5b2f 100644
--- a/tests/mir-opt/pre-codegen/range_iter.rs
+++ b/tests/mir-opt/pre-codegen/range_iter.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
index 48b780aea..af5d385a9 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
@@ -3,9 +3,9 @@
fn ezmap(_1: Option<i32>) -> Option<i32> {
debug x => _1;
let mut _0: std::option::Option<i32>;
- scope 1 (inlined map::<i32, i32, {closure@$DIR/simple_option_map.rs:17:12: 17:15}>) {
+ scope 1 (inlined map::<i32, i32, {closure@$DIR/simple_option_map.rs:18:12: 18:15}>) {
debug slf => _1;
- debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:17:12: 17:15};
+ debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:18:12: 18:15};
let mut _2: isize;
let _3: i32;
let mut _4: i32;
@@ -18,6 +18,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
}
bb0: {
+ StorageLive(_2);
_2 = discriminant(_1);
switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
}
@@ -37,6 +38,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
}
bb3: {
+ StorageDead(_2);
return;
}
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs
index d4f28dda6..35f9ab3e1 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.rs
+++ b/tests/mir-opt/pre-codegen/simple_option_map.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
diff --git a/tests/mir-opt/pre-codegen/slice_filter.rs b/tests/mir-opt/pre-codegen/slice_filter.rs
index aba951acd..483e58766 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.rs
+++ b/tests/mir-opt/pre-codegen/slice_filter.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
// ignore-debug: standard library debug assertions add a panic that breaks this optimization
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
index ed286beb4..548767dca 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_a::{closure#0}` after PreCodegen
-fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: &usize;
@@ -10,74 +10,74 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
let _8: &usize;
let mut _9: &(usize, usize, usize, usize);
let _10: &usize;
- let _11: &usize;
- let mut _16: bool;
- let _17: &usize;
- let mut _22: bool;
- let _23: &usize;
- let mut _28: bool;
- let _29: &usize;
- let mut _34: &&usize;
+ let mut _11: &&usize;
+ let _12: &usize;
+ let mut _13: &&usize;
+ let mut _18: bool;
+ let mut _19: &&usize;
+ let _20: &usize;
+ let mut _21: &&usize;
+ let mut _26: bool;
+ let mut _27: &&usize;
+ let _28: &usize;
+ let mut _29: &&usize;
+ let mut _34: bool;
let mut _35: &&usize;
- let mut _36: &&usize;
+ let _36: &usize;
let mut _37: &&usize;
- let mut _38: &&usize;
- let mut _39: &&usize;
- let mut _40: &&usize;
- let mut _41: &&usize;
scope 1 {
debug a => _4;
debug b => _6;
debug c => _8;
debug d => _10;
scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _34;
- debug other => _35;
- let mut _12: &usize;
- let mut _13: &usize;
+ debug self => _11;
+ debug other => _13;
+ let mut _14: &usize;
+ let mut _15: &usize;
scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _12;
- debug other => _13;
- let mut _14: usize;
- let mut _15: usize;
+ debug self => _14;
+ debug other => _15;
+ let mut _16: usize;
+ let mut _17: usize;
}
}
scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _36;
- debug other => _37;
- let mut _18: &usize;
- let mut _19: &usize;
+ debug self => _19;
+ debug other => _21;
+ let mut _22: &usize;
+ let mut _23: &usize;
scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _18;
- debug other => _19;
- let mut _20: usize;
- let mut _21: usize;
+ debug self => _22;
+ debug other => _23;
+ let mut _24: usize;
+ let mut _25: usize;
}
}
scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _38;
- debug other => _39;
- let mut _24: &usize;
- let mut _25: &usize;
- scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _24;
- debug other => _25;
- let mut _26: usize;
- let mut _27: usize;
- }
- }
- scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _40;
- debug other => _41;
+ debug self => _27;
+ debug other => _29;
let mut _30: &usize;
let mut _31: &usize;
- scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
+ scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _30;
debug other => _31;
let mut _32: usize;
let mut _33: usize;
}
}
+ scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
+ debug self => _35;
+ debug other => _37;
+ let mut _38: &usize;
+ let mut _39: &usize;
+ scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
+ debug self => _38;
+ debug other => _39;
+ let mut _40: usize;
+ let mut _41: usize;
+ }
+ }
}
bb0: {
@@ -93,123 +93,147 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
StorageLive(_10);
_9 = deref_copy (*_2);
_10 = &((*_9).3: usize);
- StorageLive(_16);
- StorageLive(_34);
- StorageLive(_35);
+ StorageLive(_18);
StorageLive(_11);
- _11 = _8;
- _12 = deref_copy _4;
- _13 = deref_copy _11;
+ _11 = &_4;
+ StorageLive(_13);
+ StorageLive(_12);
+ _12 = _8;
+ _13 = &_12;
StorageLive(_14);
- _14 = (*_12);
StorageLive(_15);
- _15 = (*_13);
- _16 = Le(move _14, move _15);
+ _14 = deref_copy _4;
+ _15 = deref_copy _12;
+ StorageLive(_16);
+ _16 = (*_14);
+ StorageLive(_17);
+ _17 = (*_15);
+ _18 = Le(move _16, move _17);
+ StorageDead(_17);
+ StorageDead(_16);
StorageDead(_15);
StorageDead(_14);
- switchInt(move _16) -> [0: bb1, otherwise: bb2];
+ switchInt(move _18) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_12);
+ StorageDead(_13);
StorageDead(_11);
- StorageDead(_35);
- StorageDead(_34);
goto -> bb4;
}
bb2: {
+ StorageDead(_12);
+ StorageDead(_13);
StorageDead(_11);
- StorageDead(_35);
- StorageDead(_34);
- StorageLive(_22);
- StorageLive(_36);
- StorageLive(_37);
- StorageLive(_17);
- _17 = _6;
- _18 = deref_copy _10;
- _19 = deref_copy _17;
- StorageLive(_20);
- _20 = (*_18);
+ StorageLive(_26);
+ StorageLive(_19);
+ _19 = &_10;
StorageLive(_21);
- _21 = (*_19);
- _22 = Le(move _20, move _21);
- StorageDead(_21);
- StorageDead(_20);
- switchInt(move _22) -> [0: bb3, otherwise: bb8];
+ StorageLive(_20);
+ _20 = _6;
+ _21 = &_20;
+ StorageLive(_22);
+ StorageLive(_23);
+ _22 = deref_copy _10;
+ _23 = deref_copy _20;
+ StorageLive(_24);
+ _24 = (*_22);
+ StorageLive(_25);
+ _25 = (*_23);
+ _26 = Le(move _24, move _25);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_22);
+ switchInt(move _26) -> [0: bb3, otherwise: bb8];
}
bb3: {
- StorageDead(_17);
- StorageDead(_37);
- StorageDead(_36);
+ StorageDead(_20);
+ StorageDead(_21);
+ StorageDead(_19);
goto -> bb4;
}
bb4: {
- StorageLive(_28);
- StorageLive(_38);
- StorageLive(_39);
- StorageLive(_23);
- _23 = _4;
- _24 = deref_copy _8;
- _25 = deref_copy _23;
- StorageLive(_26);
- _26 = (*_24);
+ StorageLive(_34);
StorageLive(_27);
- _27 = (*_25);
- _28 = Le(move _26, move _27);
- StorageDead(_27);
- StorageDead(_26);
- switchInt(move _28) -> [0: bb5, otherwise: bb6];
+ _27 = &_8;
+ StorageLive(_29);
+ StorageLive(_28);
+ _28 = _4;
+ _29 = &_28;
+ StorageLive(_30);
+ StorageLive(_31);
+ _30 = deref_copy _8;
+ _31 = deref_copy _28;
+ StorageLive(_32);
+ _32 = (*_30);
+ StorageLive(_33);
+ _33 = (*_31);
+ _34 = Le(move _32, move _33);
+ StorageDead(_33);
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageDead(_30);
+ switchInt(move _34) -> [0: bb5, otherwise: bb6];
}
bb5: {
- StorageDead(_23);
- StorageDead(_39);
- StorageDead(_38);
+ StorageDead(_28);
+ StorageDead(_29);
+ StorageDead(_27);
_0 = const false;
goto -> bb7;
}
bb6: {
- StorageDead(_23);
- StorageDead(_39);
- StorageDead(_38);
+ StorageDead(_28);
+ StorageDead(_29);
+ StorageDead(_27);
+ StorageLive(_35);
+ _35 = &_6;
+ StorageLive(_37);
+ StorageLive(_36);
+ _36 = _10;
+ _37 = &_36;
+ StorageLive(_38);
+ StorageLive(_39);
+ _38 = deref_copy _6;
+ _39 = deref_copy _36;
StorageLive(_40);
+ _40 = (*_38);
StorageLive(_41);
- StorageLive(_29);
- _29 = _10;
- _30 = deref_copy _6;
- _31 = deref_copy _29;
- StorageLive(_32);
- _32 = (*_30);
- StorageLive(_33);
- _33 = (*_31);
- _0 = Le(move _32, move _33);
- StorageDead(_33);
- StorageDead(_32);
- StorageDead(_29);
+ _41 = (*_39);
+ _0 = Le(move _40, move _41);
StorageDead(_41);
StorageDead(_40);
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageDead(_36);
+ StorageDead(_37);
+ StorageDead(_35);
goto -> bb7;
}
bb7: {
- StorageDead(_28);
+ StorageDead(_34);
goto -> bb9;
}
bb8: {
- StorageDead(_17);
- StorageDead(_37);
- StorageDead(_36);
+ StorageDead(_20);
+ StorageDead(_21);
+ StorageDead(_19);
_0 = const true;
goto -> bb9;
}
bb9: {
- StorageDead(_22);
- StorageDead(_16);
+ StorageDead(_26);
+ StorageDead(_18);
StorageDead(_10);
StorageDead(_8);
StorageDead(_6);
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
index 80c8cebff..e2ed1d101 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_b::{closure#0}` after PreCodegen
-fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41}, _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: usize;
diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs
index 57ffb07e2..5225fc5c6 100644
--- a/tests/mir-opt/pre-codegen/slice_index.rs
+++ b/tests/mir-opt/pre-codegen/slice_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// ignore-debug the standard library debug assertions leak into this test
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
index 2fd669aee..729841ec5 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
@@ -19,11 +19,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _15: usize;
- let _16: usize;
scope 4 {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
scope 5 {
let _6: usize;
scope 6 {
@@ -56,8 +54,8 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
}
}
scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
debug self => _5;
@@ -82,8 +80,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_5 = &raw mut (*_1);
StorageLive(_6);
StorageLive(_14);
- StorageLive(_15);
- StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -104,8 +100,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_16);
- StorageDead(_15);
StorageDead(_14);
StorageDead(_6);
StorageDead(_5);
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
index 2fd669aee..729841ec5 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
@@ -19,11 +19,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _15: usize;
- let _16: usize;
scope 4 {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
scope 5 {
let _6: usize;
scope 6 {
@@ -56,8 +54,8 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
}
}
scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
debug self => _5;
@@ -82,8 +80,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_5 = &raw mut (*_1);
StorageLive(_6);
StorageLive(_14);
- StorageLive(_15);
- StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -104,8 +100,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_16);
- StorageDead(_15);
StorageDead(_14);
StorageDead(_6);
StorageDead(_5);
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir
index df6d2263d..d97c96ac8 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir
@@ -7,17 +7,13 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) {
debug self => _1;
debug index => _2;
- let _3: &[u32];
}
bb0: {
- StorageLive(_3);
- _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable];
+ _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable];
}
bb1: {
- _0 = _3;
- StorageDead(_3);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir
index cc1795c3f..4a976002f 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir
@@ -7,17 +7,13 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) {
debug self => _1;
debug index => _2;
- let _3: &[u32];
}
bb0: {
- StorageLive(_3);
- _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue];
+ _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue];
}
bb1: {
- _0 = _3;
- StorageDead(_3);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
index 4afe2eda1..ac1de7b4c 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
@@ -7,43 +7,43 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
let mut _3: usize;
let mut _4: std::ops::Range<usize>;
let mut _5: std::ops::Range<usize>;
- let mut _9: std::option::Option<usize>;
- let mut _12: isize;
- let mut _14: usize;
- let mut _15: bool;
- let mut _17: &impl Fn(usize, &T);
- let mut _18: (usize, &T);
- let _19: ();
- let mut _20: &mut std::ops::Range<usize>;
+ let mut _6: &mut std::ops::Range<usize>;
+ let mut _12: std::option::Option<usize>;
+ let mut _15: isize;
+ let mut _17: usize;
+ let mut _18: bool;
+ let mut _20: &impl Fn(usize, &T);
+ let mut _21: (usize, &T);
+ let _22: ();
scope 1 {
debug iter => _5;
- let _13: usize;
+ let _16: usize;
scope 2 {
- debug i => _13;
- let _16: &T;
+ debug i => _16;
+ let _19: &T;
scope 3 {
- debug x => _16;
+ debug x => _19;
}
}
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
- debug self => _20;
+ debug self => _6;
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _20;
- let mut _8: bool;
- let _10: usize;
- let mut _11: usize;
- let mut _21: &usize;
- let mut _22: &usize;
+ debug self => _6;
+ let mut _7: &usize;
+ let mut _8: &usize;
+ let mut _11: bool;
+ let _13: usize;
+ let mut _14: usize;
scope 7 {
- debug old => _10;
+ debug old => _13;
scope 8 {
}
}
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
- debug self => _21;
- debug other => _22;
- let mut _6: usize;
- let mut _7: usize;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: usize;
+ let mut _10: usize;
}
}
}
@@ -63,52 +63,55 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: usize);
+ StorageLive(_8);
+ _8 = &(_5.1: usize);
StorageLive(_9);
+ _9 = (_5.0: usize);
StorageLive(_10);
- StorageLive(_8);
- StorageLive(_21);
- StorageLive(_22);
- StorageLive(_6);
- _6 = (_5.0: usize);
- StorageLive(_7);
- _7 = (_5.1: usize);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: usize);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_22);
- StorageDead(_21);
- _9 = Option::<usize>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_22);
- StorageDead(_21);
- _10 = (_5.0: usize);
- StorageLive(_11);
- _11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: usize);
+ StorageLive(_14);
+ _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable];
}
bb4: {
- (_5.0: usize) = move _11;
- StorageDead(_11);
- _9 = Option::<usize>::Some(_10);
+ (_5.0: usize) = move _14;
+ StorageDead(_14);
+ _12 = Option::<usize>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_2) -> [return: bb7, unwind unreachable];
}
@@ -118,25 +121,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: usize);
- _14 = Len((*_1));
- _15 = Lt(_13, _14);
- assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind unreachable];
+ _16 = ((_12 as Some).0: usize);
+ _17 = Len((*_1));
+ _18 = Lt(_16, _17);
+ assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind unreachable];
}
bb9: {
- _16 = &(*_1)[_13];
- StorageLive(_17);
- _17 = &_2;
- StorageLive(_18);
- _18 = (_13, _16);
- _19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind unreachable];
+ _19 = &(*_1)[_16];
+ StorageLive(_20);
+ _20 = &_2;
+ StorageLive(_21);
+ _21 = (_16, _19);
+ _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind unreachable];
}
bb10: {
- StorageDead(_18);
- StorageDead(_17);
- StorageDead(_9);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
index 48092608d..3c49ecf95 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
@@ -7,43 +7,43 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
let mut _3: usize;
let mut _4: std::ops::Range<usize>;
let mut _5: std::ops::Range<usize>;
- let mut _9: std::option::Option<usize>;
- let mut _12: isize;
- let mut _14: usize;
- let mut _15: bool;
- let mut _17: &impl Fn(usize, &T);
- let mut _18: (usize, &T);
- let _19: ();
- let mut _20: &mut std::ops::Range<usize>;
+ let mut _6: &mut std::ops::Range<usize>;
+ let mut _12: std::option::Option<usize>;
+ let mut _15: isize;
+ let mut _17: usize;
+ let mut _18: bool;
+ let mut _20: &impl Fn(usize, &T);
+ let mut _21: (usize, &T);
+ let _22: ();
scope 1 {
debug iter => _5;
- let _13: usize;
+ let _16: usize;
scope 2 {
- debug i => _13;
- let _16: &T;
+ debug i => _16;
+ let _19: &T;
scope 3 {
- debug x => _16;
+ debug x => _19;
}
}
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
- debug self => _20;
+ debug self => _6;
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _20;
- let mut _8: bool;
- let _10: usize;
- let mut _11: usize;
- let mut _21: &usize;
- let mut _22: &usize;
+ debug self => _6;
+ let mut _7: &usize;
+ let mut _8: &usize;
+ let mut _11: bool;
+ let _13: usize;
+ let mut _14: usize;
scope 7 {
- debug old => _10;
+ debug old => _13;
scope 8 {
}
}
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
- debug self => _21;
- debug other => _22;
- let mut _6: usize;
- let mut _7: usize;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: usize;
+ let mut _10: usize;
}
}
}
@@ -63,52 +63,55 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: usize);
+ StorageLive(_8);
+ _8 = &(_5.1: usize);
StorageLive(_9);
+ _9 = (_5.0: usize);
StorageLive(_10);
- StorageLive(_8);
- StorageLive(_21);
- StorageLive(_22);
- StorageLive(_6);
- _6 = (_5.0: usize);
- StorageLive(_7);
- _7 = (_5.1: usize);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: usize);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_22);
- StorageDead(_21);
- _9 = Option::<usize>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_22);
- StorageDead(_21);
- _10 = (_5.0: usize);
- StorageLive(_11);
- _11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb12];
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: usize);
+ StorageLive(_14);
+ _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb12];
}
bb4: {
- (_5.0: usize) = move _11;
- StorageDead(_11);
- _9 = Option::<usize>::Some(_10);
+ (_5.0: usize) = move _14;
+ StorageDead(_14);
+ _12 = Option::<usize>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_2) -> [return: bb7, unwind continue];
}
@@ -118,25 +121,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: usize);
- _14 = Len((*_1));
- _15 = Lt(_13, _14);
- assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind: bb12];
+ _16 = ((_12 as Some).0: usize);
+ _17 = Len((*_1));
+ _18 = Lt(_16, _17);
+ assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind: bb12];
}
bb9: {
- _16 = &(*_1)[_13];
- StorageLive(_17);
- _17 = &_2;
- StorageLive(_18);
- _18 = (_13, _16);
- _19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind: bb12];
+ _19 = &(*_1)[_16];
+ StorageLive(_20);
+ _20 = &_2;
+ StorageLive(_21);
+ _21 = (_16, _19);
+ _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind: bb12];
}
bb10: {
- StorageDead(_18);
- StorageDead(_17);
- StorageDead(_9);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
index 549cb4f46..f3760463f 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
@@ -7,21 +7,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
let mut _13: std::slice::Iter<'_, T>;
let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
- let mut _17: std::option::Option<&T>;
- let mut _18: isize;
- let mut _20: &impl Fn(&T);
- let mut _21: (&T,);
- let _22: ();
- let mut _23: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _18: std::option::Option<&T>;
+ let mut _19: isize;
+ let mut _21: &impl Fn(&T);
+ let mut _22: (&T,);
+ let _23: ();
scope 1 {
debug iter => _15;
- let _19: &T;
+ let _20: &T;
scope 2 {
- debug x => _19;
+ debug x => _20;
}
scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
- debug self => _23;
- let mut _16: &mut std::slice::Iter<'_, T>;
+ debug self => _16;
+ let mut _17: &mut std::slice::Iter<'_, T>;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@@ -153,20 +153,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb4: {
+ StorageLive(_18);
+ _16 = &mut _15;
StorageLive(_17);
- StorageLive(_16);
- _16 = &mut (_15.0: std::slice::Iter<'_, T>);
- _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind unreachable];
+ _17 = &mut (_15.0: std::slice::Iter<'_, T>);
+ _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind unreachable];
}
bb5: {
- StorageDead(_16);
- _18 = discriminant(_17);
- switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_17);
+ _19 = discriminant(_18);
+ switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_17);
+ StorageDead(_18);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind unreachable];
}
@@ -176,18 +177,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
- _19 = ((_17 as Some).0: &T);
- StorageLive(_20);
- _20 = &_2;
+ _20 = ((_18 as Some).0: &T);
StorageLive(_21);
- _21 = (_19,);
- _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind unreachable];
+ _21 = &_2;
+ StorageLive(_22);
+ _22 = (_20,);
+ _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind unreachable];
}
bb9: {
+ StorageDead(_22);
StorageDead(_21);
- StorageDead(_20);
- StorageDead(_17);
+ StorageDead(_18);
goto -> bb4;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
index 3cdc49f60..e63f8b893 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
@@ -7,21 +7,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
let mut _13: std::slice::Iter<'_, T>;
let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
- let mut _17: std::option::Option<&T>;
- let mut _18: isize;
- let mut _20: &impl Fn(&T);
- let mut _21: (&T,);
- let _22: ();
- let mut _23: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _18: std::option::Option<&T>;
+ let mut _19: isize;
+ let mut _21: &impl Fn(&T);
+ let mut _22: (&T,);
+ let _23: ();
scope 1 {
debug iter => _15;
- let _19: &T;
+ let _20: &T;
scope 2 {
- debug x => _19;
+ debug x => _20;
}
scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
- debug self => _23;
- let mut _16: &mut std::slice::Iter<'_, T>;
+ debug self => _16;
+ let mut _17: &mut std::slice::Iter<'_, T>;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@@ -153,20 +153,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb4: {
+ StorageLive(_18);
+ _16 = &mut _15;
StorageLive(_17);
- StorageLive(_16);
- _16 = &mut (_15.0: std::slice::Iter<'_, T>);
- _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind: bb11];
+ _17 = &mut (_15.0: std::slice::Iter<'_, T>);
+ _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind: bb11];
}
bb5: {
- StorageDead(_16);
- _18 = discriminant(_17);
- switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_17);
+ _19 = discriminant(_18);
+ switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_17);
+ StorageDead(_18);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind continue];
}
@@ -176,18 +177,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
- _19 = ((_17 as Some).0: &T);
- StorageLive(_20);
- _20 = &_2;
+ _20 = ((_18 as Some).0: &T);
StorageLive(_21);
- _21 = (_19,);
- _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind: bb11];
+ _21 = &_2;
+ StorageLive(_22);
+ _22 = (_20,);
+ _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11];
}
bb9: {
+ StorageDead(_22);
StorageDead(_21);
- StorageDead(_20);
- StorageDead(_17);
+ StorageDead(_18);
goto -> bb4;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs
index 179005636..10a5c3070 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.rs
+++ b/tests/mir-opt/pre-codegen/slice_iter.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// ignore-debug the standard library debug assertions leak into this test
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
index 1d3317efd..485dc9179 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
@@ -1,21 +1,18 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
- _0 = inner(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:10:5: 10:14
- // mir::ConstOperand
- // + span: $DIR/spans.rs:10:5: 10:10
- // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
+ debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15
+ let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26
+ let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13
+ scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14
+ debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15
}
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
- return; // scope 0 at $DIR/spans.rs:11:2: 11:2
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
+ return; // scope 0 at $DIR/spans.rs:12:2: 12:2
}
}
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
index aba66861f..485dc9179 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
@@ -1,21 +1,18 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
- _0 = inner(move _2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:10:5: 10:14
- // mir::ConstOperand
- // + span: $DIR/spans.rs:10:5: 10:10
- // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
+ debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15
+ let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26
+ let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13
+ scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14
+ debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15
}
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
- return; // scope 0 at $DIR/spans.rs:11:2: 11:2
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
+ return; // scope 0 at $DIR/spans.rs:12:2: 12:2
}
}
diff --git a/tests/mir-opt/pre-codegen/spans.rs b/tests/mir-opt/pre-codegen/spans.rs
index 295eb0476..aa36648ce 100644
--- a/tests/mir-opt/pre-codegen/spans.rs
+++ b/tests/mir-opt/pre-codegen/spans.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that the comments we emit in MIR opts are accurate.
//
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/pre-codegen/try_identity.rs b/tests/mir-opt/pre-codegen/try_identity.rs
index a227c82d6..b6e4eaad7 100644
--- a/tests/mir-opt/pre-codegen/try_identity.rs
+++ b/tests/mir-opt/pre-codegen/try_identity.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
diff --git a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
index 8fe361f2b..1648f5dd8 100644
--- a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
@@ -92,8 +92,8 @@
StorageDead(_7);
- StorageDead(_6);
- StorageLive(_10);
- StorageLive(_11);
- StorageLive(_12);
+- StorageLive(_11);
+- StorageLive(_12);
StorageLive(_13);
_26 = const _;
_13 = &(*_26);
@@ -105,8 +105,9 @@
bb5: {
StorageDead(_15);
StorageDead(_13);
- _11 = &(*_12);
- _16 = Len((*_11));
+- _11 = &(*_12);
+- _16 = Len((*_11));
++ _16 = Len((*_12));
_17 = const 3_usize;
_18 = Ge(move _16, move _17);
switchInt(move _18) -> [0: bb7, otherwise: bb6];
@@ -114,12 +115,15 @@
bb6: {
StorageLive(_19);
- _19 = &(*_11)[1 of 3];
+- _19 = &(*_11)[1 of 3];
++ _19 = &(*_12)[1 of 3];
StorageLive(_20);
- _20 = &(*_11)[2:-1];
+- _20 = &(*_11)[2:-1];
++ _20 = &(*_12)[2:-1];
StorageLive(_21);
- _21 = &(*_11)[-1 of 3];
+- _21 = &(*_11)[-1 of 3];
- _10 = const ();
++ _21 = &(*_12)[-1 of 3];
StorageDead(_21);
StorageDead(_20);
StorageDead(_19);
@@ -132,8 +136,8 @@
}
bb8: {
- StorageDead(_12);
- StorageDead(_11);
+- StorageDead(_12);
+- StorageDead(_11);
- StorageDead(_10);
StorageLive(_22);
StorageLive(_23);
diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs
index 610660131..36134e019 100644
--- a/tests/mir-opt/reference_prop.rs
+++ b/tests/mir-opt/reference_prop.rs
@@ -8,16 +8,31 @@
fn opaque(_: impl Sized) {}
fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
+ // CHECK-LABEL: fn reference_propagation(
+
// Propagation through a reference.
{
+ // CHECK: bb0: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 5_usize;
let b = &a; // This borrow is only used once.
let c = *b; // This should be optimized.
opaque(()); // We use opaque to separate cases into basic blocks in the MIR.
}
- // Propagation through a two references.
+ // Propagation through two references.
{
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[a2:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[btmp:_.*]] = &[[a2]];
+ // CHECK: [[b]] = move [[btmp]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let a2 = 7_usize;
let mut b = &a;
@@ -29,6 +44,12 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation through a borrowed reference.
{
+ // CHECK: bb2: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let b = &a;
let d = &b;
@@ -36,8 +57,14 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
opaque(d); // prevent `d` from being removed.
}
- // Propagation through a borrowed reference.
+ // Propagation through a mutably borrowed reference.
{
+ // CHECK: bb3: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[d:_.*]] = &raw mut [[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let mut b = &a;
let d = &raw mut b;
@@ -47,6 +74,11 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation through an escaping borrow.
{
+ // CHECK: bb4: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 7_usize;
let b = &a;
let c = *b;
@@ -55,6 +87,14 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation through a transitively escaping borrow.
{
+ // CHECK: bb5: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b1:_.*]] = &[[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+ // CHECK: [[b2:_.*]] = [[b1]];
+ // CHECK: [[c2:_.*]] = [[a]];
+ // CHECK: [[b3:_.*]] = [[b2]];
+
let a = 7_usize;
let b1 = &a;
let c = *b1;
@@ -68,6 +108,10 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation a reborrow of an argument.
{
+ // CHECK: bb6: {
+ // CHECK-NOT: {{_.*}} = &(*_1);
+ // CHECK: [[b:_.*]] = (*_1);
+
let a = &*single;
let b = *a; // This should be optimized as `*single`.
opaque(());
@@ -75,6 +119,12 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Propagation a reborrow of a mutated argument.
{
+ // CHECK: bb7: {
+ // CHECK: [[a:_.*]] = &(*_2);
+ // CHECK: [[tmp:_.*]] = &(*_1);
+ // CHECK: _2 = move [[tmp]];
+ // CHECK: [[b:_.*]] = (*[[a]]);
+
let a = &*multiple;
multiple = &*single;
let b = *a; // This should not be optimized.
@@ -83,6 +133,13 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
// Fixed-point propagation through a borrowed reference.
{
+ // CHECK: bb8: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let b = &a;
let d = &b; // first round promotes debuginfo for `d`
@@ -90,8 +147,15 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
opaque(());
}
- // Fixed-point propagation through a borrowed reference.
+ // Fixed-point propagation through a mutably borrowed reference.
{
+ // CHECK: bb9: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &[[a]];
+ // CHECK: [[d:_.*]] = &mut [[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let mut b = &a;
let d = &mut b; // first round promotes debuginfo for `d`
@@ -101,16 +165,31 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
}
fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a mut T) {
+ // CHECK-LABEL: fn reference_propagation_mut(
+
// Propagation through a reference.
{
+ // CHECK: bb0: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let mut a = 5_usize;
let b = &mut a; // This borrow is only used once.
let c = *b; // This should be optimized.
opaque(());
}
- // Propagation through a two references.
+ // Propagation through two references.
{
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[a2:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[btmp:_.*]] = &mut [[a2]];
+ // CHECK: [[b]] = move [[btmp]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut a2 = 7_usize;
let mut b = &mut a;
@@ -122,6 +201,12 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation through a borrowed reference.
{
+ // CHECK: bb2: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let b = &mut a;
let d = &b;
@@ -129,8 +214,14 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
opaque(d); // prevent `d` from being removed.
}
- // Propagation through a borrowed reference.
+ // Propagation through a mutably borrowed reference.
{
+ // CHECK: bb3: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[d:_.*]] = &raw mut [[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut b = &mut a;
let d = &raw mut b;
@@ -140,6 +231,11 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation through an escaping borrow.
{
+ // CHECK: bb4: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 7_usize;
let b = &mut a;
let c = *b;
@@ -148,6 +244,14 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation through a transitively escaping borrow.
{
+ // CHECK: bb5: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b1:_.*]] = &mut [[a]];
+ // CHECK: [[c:_.*]] = (*[[b1]]);
+ // CHECK: [[b2:_.*]] = move [[b1]];
+ // CHECK: [[c2:_.*]] = (*[[b2]]);
+ // CHECK: [[b3:_.*]] = move [[b2]];
+
let mut a = 7_usize;
let b1 = &mut a;
let c = *b1;
@@ -161,6 +265,10 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation a reborrow of an argument.
{
+ // CHECK: bb6: {
+ // CHECK-NOT: {{_.*}} = &(*_1);
+ // CHECK: [[b:_.*]] = (*_1);
+
let a = &mut *single;
let b = *a; // This should be optimized as `*single`.
opaque(());
@@ -168,6 +276,12 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Propagation a reborrow of a mutated argument.
{
+ // CHECK: bb7: {
+ // CHECK: [[a:_.*]] = &mut (*_2);
+ // CHECK: [[tmp:_.*]] = &mut (*_1);
+ // CHECK: _2 = move [[tmp]];
+ // CHECK: [[b:_.*]] = (*[[a]]);
+
let a = &mut *multiple;
multiple = &mut *single;
let b = *a; // This should not be optimized.
@@ -176,6 +290,13 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
// Fixed-point propagation through a borrowed reference.
{
+ // CHECK: bb8: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let b = &mut a;
let d = &b; // first round promotes debuginfo for `d`
@@ -183,8 +304,15 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
opaque(());
}
- // Fixed-point propagation through a borrowed reference.
+ // Fixed-point propagation through a mutably borrowed reference.
{
+ // CHECK: bb9: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &mut [[a]];
+ // CHECK: [[d:_.*]] = &mut [[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut b = &mut a;
let d = &mut b; // first round promotes debuginfo for `d`
@@ -194,16 +322,31 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m
}
fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *const T) {
+ // CHECK-LABEL: fn reference_propagation_const_ptr(
+
// Propagation through a reference.
unsafe {
+ // CHECK: bb0: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 5_usize;
let b = &raw const a; // This borrow is only used once.
let c = *b; // This should be optimized.
opaque(());
}
- // Propagation through a two references.
+ // Propagation through two references.
unsafe {
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[a2:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[btmp:_.*]] = &raw const [[a2]];
+ // CHECK: [[b]] = move [[btmp]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let a2 = 7_usize;
let mut b = &raw const a;
@@ -215,6 +358,12 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation through a borrowed reference.
unsafe {
+ // CHECK: bb2: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let b = &raw const a;
let d = &b;
@@ -222,8 +371,14 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
opaque(d); // prevent `d` from being removed.
}
- // Propagation through a borrowed reference.
+ // Propagation through a mutably borrowed reference.
unsafe {
+ // CHECK: bb3: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &raw mut [[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let mut b = &raw const a;
let d = &raw mut b;
@@ -233,6 +388,11 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation through an escaping borrow.
unsafe {
+ // CHECK: bb4: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 7_usize;
let b = &raw const a;
let c = *b;
@@ -241,6 +401,14 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation through a transitively escaping borrow.
unsafe {
+ // CHECK: bb5: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b1:_.*]] = &raw const [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+ // CHECK: [[b2:_.*]] = [[b1]];
+ // CHECK: [[c2:_.*]] = [[a]];
+ // CHECK: [[b3:_.*]] = [[b2]];
+
let a = 7_usize;
let b1 = &raw const a;
let c = *b1;
@@ -254,6 +422,10 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation a reborrow of an argument.
unsafe {
+ // CHECK: bb6: {
+ // CHECK-NOT: {{_.*}} = &(*_1);
+ // CHECK: [[b:_.*]] = (*_1);
+
let a = &raw const *single;
let b = *a; // This should be optimized as `*single`.
opaque(());
@@ -261,6 +433,12 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation a reborrow of a mutated argument.
unsafe {
+ // CHECK: bb7: {
+ // CHECK: [[a:_.*]] = &raw const (*_2);
+ // CHECK: [[tmp:_.*]] = &raw const (*_1);
+ // CHECK: _2 = move [[tmp]];
+ // CHECK: [[b:_.*]] = (*[[a]]);
+
let a = &raw const *multiple;
multiple = &raw const *single;
let b = *a; // This should not be optimized.
@@ -269,6 +447,12 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Propagation through a reborrow.
unsafe {
+ // CHECK: bb8: {
+ // CHECK: [[a:_.*]] = const 13_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &raw const [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let a = 13_usize;
let b = &raw const a;
let c = &raw const *b;
@@ -278,6 +462,13 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Fixed-point propagation through a borrowed reference.
unsafe {
+ // CHECK: bb9: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let b = &raw const a;
let d = &b; // first round promotes debuginfo for `d`
@@ -287,6 +478,13 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
// Fixed-point propagation through a borrowed reference.
unsafe {
+ // CHECK: bb10: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw const [[a]];
+ // CHECK: [[d:_.*]] = &mut [[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let a = 5_usize;
let mut b = &raw const a;
let d = &mut b; // first round promotes debuginfo for `d`
@@ -296,16 +494,31 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con
}
fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) {
+ // CHECK-LABEL: fn reference_propagation_mut_ptr(
+
// Propagation through a reference.
unsafe {
+ // CHECK: bb0: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[c:_.*]] = [[a]];
+
let mut a = 5_usize;
let b = &raw mut a; // This borrow is only used once.
let c = *b; // This should be optimized.
opaque(());
}
- // Propagation through a two references.
+ // Propagation through two references.
unsafe {
+ // CHECK: bb1: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[a2:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[btmp:_.*]] = &raw mut [[a2]];
+ // CHECK: [[b]] = move [[btmp]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut a2 = 7_usize;
let mut b = &raw mut a;
@@ -317,6 +530,12 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation through a borrowed reference.
unsafe {
+ // CHECK: bb2: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let b = &raw mut a;
let d = &b;
@@ -324,8 +543,14 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
opaque(d); // prevent `d` from being removed.
}
- // Propagation through a borrowed reference.
+ // Propagation through a mutably borrowed reference.
unsafe {
+ // CHECK: bb3: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[d:_.*]] = &raw mut [[b]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut b = &raw mut a;
let d = &raw mut b;
@@ -335,6 +560,11 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation through an escaping borrow.
unsafe {
+ // CHECK: bb4: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 7_usize;
let b = &raw mut a;
let c = *b;
@@ -343,6 +573,14 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation through a transitively escaping borrow.
unsafe {
+ // CHECK: bb5: {
+ // CHECK: [[a:_.*]] = const 7_usize;
+ // CHECK: [[b1:_.*]] = &raw mut [[a]];
+ // CHECK: [[c:_.*]] = (*[[b1]]);
+ // CHECK: [[b2:_.*]] = [[b1]];
+ // CHECK: [[c2:_.*]] = (*[[b2]]);
+ // CHECK: [[b3:_.*]] = [[b2]];
+
let mut a = 7_usize;
let b1 = &raw mut a;
let c = *b1;
@@ -356,6 +594,10 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation a reborrow of an argument.
unsafe {
+ // CHECK: bb6: {
+ // CHECK-NOT: {{_.*}} = &(*_1);
+ // CHECK: [[b:_.*]] = (*_1);
+
let a = &raw mut *single;
let b = *a; // This should be optimized as `*single`.
opaque(());
@@ -363,6 +605,12 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Propagation a reborrow of a mutated argument.
unsafe {
+ // CHECK: bb7: {
+ // CHECK: [[a:_.*]] = &raw mut (*_2);
+ // CHECK: [[tmp:_.*]] = &raw mut (*_1);
+ // CHECK: _2 = move [[tmp]];
+ // CHECK: [[b:_.*]] = (*[[a]]);
+
let a = &raw mut *multiple;
multiple = &raw mut *single;
let b = *a; // This should not be optimized.
@@ -371,6 +619,13 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
// Fixed-point propagation through a borrowed reference.
unsafe {
+ // CHECK: bb8: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[d:_.*]] = &[[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let b = &raw mut a;
let d = &b; // first round promotes debuginfo for `d`
@@ -378,8 +633,15 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
opaque(());
}
- // Fixed-point propagation through a borrowed reference.
+ // Fixed-point propagation through a mutably borrowed reference.
unsafe {
+ // CHECK: bb9: {
+ // CHECK: [[a:_.*]] = const 5_usize;
+ // CHECK: [[b:_.*]] = &raw mut [[a]];
+ // CHECK: [[d:_.*]] = &mut [[b]];
+ // FIXME this could be [[a]]
+ // CHECK: [[c:_.*]] = (*[[b]]);
+
let mut a = 5_usize;
let mut b = &raw mut a;
let d = &mut b; // first round promotes debuginfo for `d`
@@ -390,8 +652,13 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T)
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn read_through_raw(x: &mut usize) -> usize {
- use std::intrinsics::mir::*;
+ // CHECK-LABEL: read_through_raw
+ // CHECK: bb0: {
+ // CHECK-NEXT: _0 = (*_1);
+ // CHECK-NEXT: _0 = (*_1);
+ // CHECK-NEXT: return;
+ use std::intrinsics::mir::*;
mir!(
let r1: &mut usize;
let r2: &mut usize;
@@ -413,8 +680,10 @@ fn read_through_raw(x: &mut usize) -> usize {
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn multiple_storage() {
- use std::intrinsics::mir::*;
+ // CHECK-LABEL: multiple_storage
+ // CHECK: _3 = (*_2);
+ use std::intrinsics::mir::*;
mir!(
let x: i32;
{
@@ -437,8 +706,10 @@ fn multiple_storage() {
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn dominate_storage() {
- use std::intrinsics::mir::*;
+ // CHECK-LABEL: dominate_storage
+ // CHECK: _5 = (*_2);
+ use std::intrinsics::mir::*;
mir!(
let x: i32;
let r: &i32;
@@ -465,8 +736,10 @@ fn dominate_storage() {
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
fn maybe_dead(m: bool) {
- use std::intrinsics::mir::*;
+ // CHECK-LABEL: fn maybe_dead(
+ // CHECK: (*_5) = const 7_i32;
+ use std::intrinsics::mir::*;
mir!(
let x: i32;
let y: i32;
@@ -506,6 +779,9 @@ fn maybe_dead(m: bool) {
}
fn mut_raw_then_mut_shr() -> (i32, i32) {
+ // CHECK-LABEL: fn mut_raw_then_mut_shr(
+ // CHECK-NOT: (*{{_.*}})
+
let mut x = 2;
let xref = &mut x;
let xraw = &mut *xref as *mut _;
@@ -517,6 +793,18 @@ fn mut_raw_then_mut_shr() -> (i32, i32) {
}
fn unique_with_copies() {
+ // CHECK-LABEL: fn unique_with_copies(
+ // CHECK: [[a:_.*]] = const 0_i32;
+ // CHECK: [[x:_.*]] = &raw mut [[a]];
+ // CHECK-NOT: [[a]]
+ // CHECK: [[tmp:_.*]] = (*[[x]]);
+ // CHECK-NEXT: opaque::<i32>(move [[tmp]])
+ // CHECK-NOT: [[a]]
+ // CHECK: StorageDead([[a]]);
+ // CHECK-NOT: [[a]]
+ // CHECK: [[tmp:_.*]] = (*[[x]]);
+ // CHECK-NEXT: opaque::<i32>(move [[tmp]])
+
let y = {
let mut a = 0;
let x = &raw mut a;
@@ -529,6 +817,17 @@ fn unique_with_copies() {
}
fn debuginfo() {
+ // CHECK-LABEL: fn debuginfo(
+ // FIXME: This features waits for DWARF implicit pointers in LLVM.
+ // CHECK: debug ref_mut_u8 => _{{.*}};
+ // CHECK: debug field => _{{.*}};
+ // CHECK: debug reborrow => _{{.*}};
+ // CHECK: debug variant_field => _{{.*}};
+ // CHECK: debug constant_index => _{{.*}};
+ // CHECK: debug subslice => _{{.*}};
+ // CHECK: debug constant_index_from_end => _{{.*}};
+ // CHECK: debug multiple_borrow => _{{.*}};
+
struct T(u8);
let ref_mut_u8 = &mut 5_u8;
@@ -551,6 +850,10 @@ fn debuginfo() {
}
fn many_debuginfo() {
+ // CHECK-LABEL: fn many_debuginfo(
+ // FIXME: This features waits for DWARF implicit pointers in LLVM.
+ // CHECK: debug many_borrow => _{{.*}};
+
let a = 0;
// Verify that we do not ICE on deeply nested borrows.
diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
index 6c469d744..54da6ee65 100644
--- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
+++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
@@ -13,8 +13,7 @@
let mut _8: bool;
bb0: {
-- FakeRead(ForMatchedPlace(None), _1);
-+ nop;
+ PlaceMention(_1);
_3 = discriminant(_1);
switchInt(move _3) -> [1: bb2, otherwise: bb1];
}
diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
index 6c469d744..54da6ee65 100644
--- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
+++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
@@ -13,8 +13,7 @@
let mut _8: bool;
bb0: {
-- FakeRead(ForMatchedPlace(None), _1);
-+ nop;
+ PlaceMention(_1);
_3 = discriminant(_1);
switchInt(move _3) -> [1: bb2, otherwise: bb1];
}
diff --git a/tests/mir-opt/remove_fake_borrows.rs b/tests/mir-opt/remove_fake_borrows.rs
index f0ee98f77..21c7b46ee 100644
--- a/tests/mir-opt/remove_fake_borrows.rs
+++ b/tests/mir-opt/remove_fake_borrows.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that the fake borrows for matches are removed after borrow checking.
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/remove_never_const.rs b/tests/mir-opt/remove_never_const.rs
index 160cc9555..c144edaff 100644
--- a/tests/mir-opt/remove_never_const.rs
+++ b/tests/mir-opt/remove_never_const.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// This was originally a regression test for #66975 - ensure that we do not generate never typed
// consts in codegen. We also have tests for this that catches the error, see
// tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs.
diff --git a/tests/mir-opt/remove_storage_markers.rs b/tests/mir-opt/remove_storage_markers.rs
index 330264461..6666ff3b7 100644
--- a/tests/mir-opt/remove_storage_markers.rs
+++ b/tests/mir-opt/remove_storage_markers.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: RemoveStorageMarkers
diff --git a/tests/mir-opt/remove_unneeded_drops.rs b/tests/mir-opt/remove_unneeded_drops.rs
index 178d0924c..cad79e0aa 100644
--- a/tests/mir-opt/remove_unneeded_drops.rs
+++ b/tests/mir-opt/remove_unneeded_drops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR remove_unneeded_drops.opt.RemoveUnneededDrops.diff
fn opt(x: bool) {
diff --git a/tests/mir-opt/remove_zsts.rs b/tests/mir-opt/remove_zsts.rs
index 1cf7ad6e3..e33a272fe 100644
--- a/tests/mir-opt/remove_zsts.rs
+++ b/tests/mir-opt/remove_zsts.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
union Foo {
x: (),
y: u64,
diff --git a/tests/mir-opt/retag.rs b/tests/mir-opt/retag.rs
index e0696de4d..1e4b017da 100644
--- a/tests/mir-opt/retag.rs
+++ b/tests/mir-opt/retag.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: AddRetag
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// ignore-tidy-linelength
diff --git a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir
index d72477440..285db435f 100644
--- a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir
+++ b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo` after SimplifyCfg-elaborate-drops
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo` after SimplifyCfg-elaborate-drops
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 {
+fn <impl at $DIR/retag.rs:13:1: 13:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 {
debug self => _1;
debug x => _2;
let mut _0: &mut i32;
diff --git a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
index d72477440..285db435f 100644
--- a/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
+++ b/tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo` after SimplifyCfg-elaborate-drops
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo` after SimplifyCfg-elaborate-drops
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 {
+fn <impl at $DIR/retag.rs:13:1: 13:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 {
debug self => _1;
debug x => _2;
let mut _0: &mut i32;
diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir
index de3eb0d52..9ad607b2f 100644
--- a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir
+++ b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo_shr` after SimplifyCfg-elaborate-drops
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo_shr` after SimplifyCfg-elaborate-drops
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 {
+fn <impl at $DIR/retag.rs:13:1: 13:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 {
debug self => _1;
debug x => _2;
let mut _0: &i32;
diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
index de3eb0d52..9ad607b2f 100644
--- a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
+++ b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo_shr` after SimplifyCfg-elaborate-drops
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo_shr` after SimplifyCfg-elaborate-drops
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 {
+fn <impl at $DIR/retag.rs:13:1: 13:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 {
debug self => _1;
debug x => _2;
let mut _0: &i32;
diff --git a/tests/mir-opt/return_an_array.rs b/tests/mir-opt/return_an_array.rs
index bea3c317c..09146a824 100644
--- a/tests/mir-opt/return_an_array.rs
+++ b/tests/mir-opt/return_an_array.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// this tests move up progration, which is not yet implemented
fn foo() -> [u8; 1024] {
diff --git a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
index ca1528b6a..fe4b33001 100644
--- a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
+++ b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
@@ -48,15 +48,17 @@
bb0: {
StorageLive(_3);
+ StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
_9 = discriminant(_1);
- switchInt(move _9) -> [0: bb7, 1: bb5, otherwise: bb6];
+ switchInt(move _9) -> [0: bb6, 1: bb5, otherwise: bb3];
}
bb1: {
StorageDead(_11);
StorageDead(_10);
+ StorageDead(_9);
_5 = discriminant(_3);
switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3];
}
@@ -90,10 +92,6 @@
}
bb6: {
- unreachable;
- }
-
- bb7: {
_10 = ((_1 as Ok).0: i32);
_3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _10);
goto -> bb1;
diff --git a/tests/mir-opt/separate_const_switch.rs b/tests/mir-opt/separate_const_switch.rs
index d333d4b6b..3f43cdf43 100644
--- a/tests/mir-opt/separate_const_switch.rs
+++ b/tests/mir-opt/separate_const_switch.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(control_flow_enum)]
#![feature(try_trait_v2)]
diff --git a/tests/mir-opt/simplify_arm.rs b/tests/mir-opt/simplify_arm.rs
index 4c471ce04..e933cb987 100644
--- a/tests/mir-opt/simplify_arm.rs
+++ b/tests/mir-opt/simplify_arm.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts
// EMIT_MIR simplify_arm.id.SimplifyArmIdentity.diff
// EMIT_MIR simplify_arm.id.SimplifyBranchSame.diff
diff --git a/tests/mir-opt/simplify_arm_identity.rs b/tests/mir-opt/simplify_arm_identity.rs
index e122cd50e..1b546c393 100644
--- a/tests/mir-opt/simplify_arm_identity.rs
+++ b/tests/mir-opt/simplify_arm_identity.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Checks that `SimplifyArmIdentity` is not applied if enums have incompatible layouts.
// Regression test for issue #66856.
//
diff --git a/tests/mir-opt/simplify_cfg.rs b/tests/mir-opt/simplify_cfg.rs
index cf7eac440..a87aaca54 100644
--- a/tests/mir-opt/simplify_cfg.rs
+++ b/tests/mir-opt/simplify_cfg.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that the goto chain starting from bb0 is collapsed.
// compile-flags: -Cpanic=abort
// no-prefer-dynamic
diff --git a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs
index e2578407f..5c4277898 100644
--- a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs
+++ b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
#![crate_type = "lib"]
diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff
index d39571583..64a435f22 100644
--- a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff
+++ b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff
@@ -3,18 +3,15 @@
fn main() -> () {
let mut _0: ();
- let mut _1: bool;
- let _2: ();
+ let _1: ();
bb0: {
- StorageLive(_1);
- _1 = const false;
- switchInt(const false) -> [0: bb3, otherwise: bb1];
+ goto -> bb3;
}
bb1: {
- _2 = noop() -> [return: bb2, unwind unreachable];
+ _1 = noop() -> [return: bb2, unwind unreachable];
}
bb2: {
@@ -26,7 +23,6 @@
}
bb4: {
- StorageDead(_1);
return;
}
}
diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff
index 81903c64d..146e00686 100644
--- a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff
+++ b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff
@@ -3,18 +3,15 @@
fn main() -> () {
let mut _0: ();
- let mut _1: bool;
- let _2: ();
+ let _1: ();
bb0: {
- StorageLive(_1);
- _1 = const false;
- switchInt(const false) -> [0: bb3, otherwise: bb1];
+ goto -> bb3;
}
bb1: {
- _2 = noop() -> [return: bb2, unwind continue];
+ _1 = noop() -> [return: bb2, unwind continue];
}
bb2: {
@@ -26,7 +23,6 @@
}
bb4: {
- StorageDead(_1);
return;
}
}
diff --git a/tests/mir-opt/simplify_if.rs b/tests/mir-opt/simplify_if.rs
index fff23b3ce..19b5806f7 100644
--- a/tests/mir-opt/simplify_if.rs
+++ b/tests/mir-opt/simplify_if.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#[inline(never)]
fn noop() {}
diff --git a/tests/mir-opt/simplify_locals.rs b/tests/mir-opt/simplify_locals.rs
index 7bbc0481c..d4052e521 100644
--- a/tests/mir-opt/simplify_locals.rs
+++ b/tests/mir-opt/simplify_locals.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: SimplifyLocals-before-const-prop
diff --git a/tests/mir-opt/simplify_locals_fixedpoint.rs b/tests/mir-opt/simplify_locals_fixedpoint.rs
index 4da18b7fe..b0c6e2d8e 100644
--- a/tests/mir-opt/simplify_locals_fixedpoint.rs
+++ b/tests/mir-opt/simplify_locals_fixedpoint.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Zmir-opt-level=1
diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.rs b/tests/mir-opt/simplify_locals_removes_unused_consts.rs
index 1e404c3a4..42879254d 100644
--- a/tests/mir-opt/simplify_locals_removes_unused_consts.rs
+++ b/tests/mir-opt/simplify_locals_removes_unused_consts.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: SimplifyLocals-before-const-prop
// compile-flags: -C overflow-checks=no
diff --git a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs
index de6585741..615b97220 100644
--- a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs
+++ b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: SimplifyLocals-before-const-prop
fn map(x: Option<Box<()>>) -> Option<Box<()>> {
diff --git a/tests/mir-opt/simplify_match.rs b/tests/mir-opt/simplify_match.rs
index 5d8e94b09..eb385005c 100644
--- a/tests/mir-opt/simplify_match.rs
+++ b/tests/mir-opt/simplify_match.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#[inline(never)]
fn noop() {}
diff --git a/tests/mir-opt/simplify_try_if_let.rs b/tests/mir-opt/simplify_try_if_let.rs
index fba67de40..3a59d7850 100644
--- a/tests/mir-opt/simplify_try_if_let.rs
+++ b/tests/mir-opt/simplify_try_if_let.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Zmir-opt-level=1 -Zunsound-mir-opts
// ignore-test
// FIXME: the pass is unsound and causes ICEs in the MIR validator
diff --git a/tests/mir-opt/slice_drop_shim.rs b/tests/mir-opt/slice_drop_shim.rs
index 344c1af2c..cac0a3491 100644
--- a/tests/mir-opt/slice_drop_shim.rs
+++ b/tests/mir-opt/slice_drop_shim.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Zmir-opt-level=0
diff --git a/tests/mir-opt/spanview_block.main.built.after.html b/tests/mir-opt/spanview_block.main.built.after.html
index 56f4e4f93..54ef00f56 100644
--- a/tests/mir-opt/spanview_block.main.built.after.html
+++ b/tests/mir-opt/spanview_block.main.built.after.html
@@ -60,8 +60,8 @@
</style>
</head>
<body>
-<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0: $DIR/spanview_block.rs:5:11: 5:13:
- 5:11-5:13: Assign: _0 = const ()
- 5:13-5:13: Return: return"><span class="annotation">0⦊</span>{}<span class="annotation">⦉0</span></span></span></span></div>
+<div class="code" style="counter-reset: line 5"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0: $DIR/spanview_block.rs:6:11: 6:13:
+ 6:11-6:13: Assign: _0 = const ()
+ 6:13-6:13: Return: return"><span class="annotation">0⦊</span>{}<span class="annotation">⦉0</span></span></span></span></div>
</body>
</html>
diff --git a/tests/mir-opt/spanview_block.rs b/tests/mir-opt/spanview_block.rs
index 0ecf35ad6..e8bc3d163 100644
--- a/tests/mir-opt/spanview_block.rs
+++ b/tests/mir-opt/spanview_block.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test spanview block output
// compile-flags: -Z dump-mir-spanview=block
diff --git a/tests/mir-opt/spanview_statement.main.built.after.html b/tests/mir-opt/spanview_statement.main.built.after.html
index 91af08d80..5e782b05f 100644
--- a/tests/mir-opt/spanview_statement.main.built.after.html
+++ b/tests/mir-opt/spanview_statement.main.built.after.html
@@ -60,8 +60,8 @@
</style>
</head>
<body>
-<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0[0]: $DIR/spanview_statement.rs:5:11: 5:13:
- 5:11-5:13: Assign: _0 = const ()"><span class="annotation">0[0]⦊</span>{}<span class="annotation">⦉0[0]</span></span></span><span><span class="code odd" style="--layer: 1" title="0:Return: $DIR/spanview_statement.rs:5:13: 5:13:
- 5:13-5:13: Return: return"><span class="annotation">0:Return⦊</span>‸<span class="annotation">⦉0:Return</span></span></span></span></div>
+<div class="code" style="counter-reset: line 5"><span class="line"><span class="code" style="--layer: 0">fn main() </span><span><span class="code even" style="--layer: 1" title="0[0]: $DIR/spanview_statement.rs:6:11: 6:13:
+ 6:11-6:13: Assign: _0 = const ()"><span class="annotation">0[0]⦊</span>{}<span class="annotation">⦉0[0]</span></span></span><span><span class="code odd" style="--layer: 1" title="0:Return: $DIR/spanview_statement.rs:6:13: 6:13:
+ 6:13-6:13: Return: return"><span class="annotation">0:Return⦊</span>‸<span class="annotation">⦉0:Return</span></span></span></span></div>
</body>
</html>
diff --git a/tests/mir-opt/spanview_statement.rs b/tests/mir-opt/spanview_statement.rs
index 457052617..d547e6cb1 100644
--- a/tests/mir-opt/spanview_statement.rs
+++ b/tests/mir-opt/spanview_statement.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test spanview output (the default value for `-Z dump-mir-spanview` is "statement")
// compile-flags: -Z dump-mir-spanview
diff --git a/tests/mir-opt/spanview_terminator.main.built.after.html b/tests/mir-opt/spanview_terminator.main.built.after.html
index 1f42faedd..2a651489e 100644
--- a/tests/mir-opt/spanview_terminator.main.built.after.html
+++ b/tests/mir-opt/spanview_terminator.main.built.after.html
@@ -60,7 +60,7 @@
</style>
</head>
<body>
-<div class="code" style="counter-reset: line 4"><span class="line"><span class="code" style="--layer: 0">fn main() {}</span><span><span class="code even" style="--layer: 1" title="0:Return: $DIR/spanview_terminator.rs:5:13: 5:13:
- 5:13-5:13: Return: return"><span class="annotation">0:Return⦊</span>‸<span class="annotation">⦉0:Return</span></span></span></span></div>
+<div class="code" style="counter-reset: line 5"><span class="line"><span class="code" style="--layer: 0">fn main() {}</span><span><span class="code even" style="--layer: 1" title="0:Return: $DIR/spanview_terminator.rs:6:13: 6:13:
+ 6:13-6:13: Return: return"><span class="annotation">0:Return⦊</span>‸<span class="annotation">⦉0:Return</span></span></span></span></div>
</body>
</html>
diff --git a/tests/mir-opt/spanview_terminator.rs b/tests/mir-opt/spanview_terminator.rs
index 76fced188..a2c68b98e 100644
--- a/tests/mir-opt/spanview_terminator.rs
+++ b/tests/mir-opt/spanview_terminator.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test spanview terminator output
// compile-flags: -Z dump-mir-spanview=terminator
diff --git a/tests/mir-opt/sroa/lifetimes.rs b/tests/mir-opt/sroa/lifetimes.rs
index 2356d212f..cc5c0c9bb 100644
--- a/tests/mir-opt/sroa/lifetimes.rs
+++ b/tests/mir-opt/sroa/lifetimes.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ScalarReplacementOfAggregates
// compile-flags: -Cpanic=abort
// no-prefer-dynamic
diff --git a/tests/mir-opt/sroa/structs.rs b/tests/mir-opt/sroa/structs.rs
index 7946eeaea..73563e12c 100644
--- a/tests/mir-opt/sroa/structs.rs
+++ b/tests/mir-opt/sroa/structs.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ScalarReplacementOfAggregates
// compile-flags: -Cpanic=abort
// no-prefer-dynamic
diff --git a/tests/mir-opt/ssa_unreachable_116212.rs b/tests/mir-opt/ssa_unreachable_116212.rs
index f58866587..9f1cf223e 100644
--- a/tests/mir-opt/ssa_unreachable_116212.rs
+++ b/tests/mir-opt/ssa_unreachable_116212.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Regression test for issue #116212.
#![feature(never_type)]
diff --git a/tests/mir-opt/storage_ranges.main.nll.0.mir b/tests/mir-opt/storage_ranges.main.nll.0.mir
index 13732daa7..782efd5ac 100644
--- a/tests/mir-opt/storage_ranges.main.nll.0.mir
+++ b/tests/mir-opt/storage_ranges.main.nll.0.mir
@@ -15,7 +15,7 @@
| '?1 live at {bb0[0..=22]}
| '?2 live at {bb0[10]}
| '?3 live at {bb0[11]}
-| '?2: '?3 due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:6:17: 6:25 (#0)
+| '?2: '?3 due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:7:17: 7:25 (#0)
|
fn main() -> () {
let mut _0: ();
diff --git a/tests/mir-opt/storage_ranges.rs b/tests/mir-opt/storage_ranges.rs
index 996051a29..5a68d5684 100644
--- a/tests/mir-opt/storage_ranges.rs
+++ b/tests/mir-opt/storage_ranges.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR storage_ranges.main.nll.0.mir
fn main() {
diff --git a/tests/mir-opt/switch_to_self.rs b/tests/mir-opt/switch_to_self.rs
index 6678e4b3b..fc270fd33 100644
--- a/tests/mir-opt/switch_to_self.rs
+++ b/tests/mir-opt/switch_to_self.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that MatchBranchSimplification doesn't ICE on a SwitchInt where
// one of the targets is the block that the SwitchInt terminates.
#![crate_type = "lib"]
diff --git a/tests/mir-opt/tls_access.rs b/tests/mir-opt/tls_access.rs
index 19344c868..450dd9b47 100644
--- a/tests/mir-opt/tls_access.rs
+++ b/tests/mir-opt/tls_access.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR tls_access.main.PreCodegen.after.mir
// compile-flags: -Zmir-opt-level=0
diff --git a/tests/mir-opt/uninhabited_enum.rs b/tests/mir-opt/uninhabited_enum.rs
index 19db54815..8816f31f9 100644
--- a/tests/mir-opt/uninhabited_enum.rs
+++ b/tests/mir-opt/uninhabited_enum.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(never_type)]
pub enum Void {}
diff --git a/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff
index 12ce6505a..7919450cd 100644
--- a/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff
+++ b/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff
@@ -1,12 +1,12 @@
-- // MIR for `main` before UninhabitedEnumBranching
-+ // MIR for `main` after UninhabitedEnumBranching
+- // MIR for `byref` before UninhabitedEnumBranching
++ // MIR for `byref` after UninhabitedEnumBranching
- fn main() -> () {
+ fn byref() -> () {
let mut _0: ();
let _1: Plop;
- let mut _2: Test1;
+ let mut _2: Test3;
let _3: &str;
- let mut _4: &Test1;
+ let mut _4: &Test3;
let mut _5: isize;
let _6: &str;
let _7: &str;
@@ -23,15 +23,15 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = Test1::C;
- _1 = Plop { xx: const 51_u32, test1: move _2 };
+ _2 = Test3::C;
+ _1 = Plop { xx: const 51_u32, test3: move _2 };
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = &(_1.1: Test1);
+ _4 = &(_1.1: Test3);
_5 = discriminant((*_4));
- switchInt(move _5) -> [0: bb3, 1: bb4, 2: bb5, 3: bb1, otherwise: bb2];
-+ switchInt(move _5) -> [2: bb5, 3: bb1, otherwise: bb2];
++ switchInt(move _5) -> [0: bb12, 1: bb12, 2: bb5, 3: bb1, otherwise: bb12];
}
bb1: {
@@ -71,9 +71,9 @@
StorageDead(_4);
StorageDead(_3);
StorageLive(_9);
- _10 = discriminant((_1.1: Test1));
+ _10 = discriminant((_1.1: Test3));
- switchInt(move _10) -> [0: bb8, 1: bb9, 2: bb10, 3: bb7, otherwise: bb2];
-+ switchInt(move _10) -> [2: bb10, 3: bb7, otherwise: bb2];
++ switchInt(move _10) -> [0: bb12, 1: bb12, 2: bb10, 3: bb7, otherwise: bb12];
}
bb7: {
@@ -110,6 +110,10 @@
_0 = const ();
StorageDead(_1);
return;
++ }
++
++ bb12: {
++ unreachable;
}
}
diff --git a/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff
new file mode 100644
index 000000000..5e15298a7
--- /dev/null
+++ b/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff
@@ -0,0 +1,48 @@
+- // MIR for `custom_discriminant` before UninhabitedEnumBranching
++ // MIR for `custom_discriminant` after UninhabitedEnumBranching
+
+ fn custom_discriminant() -> () {
+ let mut _0: ();
+ let _1: &str;
+ let mut _2: Test2;
+ let mut _3: isize;
+ let _4: &str;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = Test2::D;
+ _3 = discriminant(_2);
+- switchInt(move _3) -> [4: bb3, 5: bb1, otherwise: bb2];
++ switchInt(move _3) -> [4: bb3, 5: bb1, otherwise: bb5];
+ }
+
+ bb1: {
+ StorageLive(_4);
+ _4 = const "E";
+ _1 = &(*_4);
+ StorageDead(_4);
+ goto -> bb4;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+ _1 = const "D";
+ goto -> bb4;
+ }
+
+ bb4: {
+ StorageDead(_2);
+ StorageDead(_1);
+ _0 = const ();
+ return;
++ }
++
++ bb5: {
++ unreachable;
+ }
+ }
+
diff --git a/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
deleted file mode 100644
index 474f43104..000000000
--- a/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
+++ /dev/null
@@ -1,60 +0,0 @@
-// MIR for `main` after SimplifyCfg-after-uninhabited-enum-branching
-
-fn main() -> () {
- let mut _0: ();
- let _1: &str;
- let mut _2: Test1;
- let mut _3: isize;
- let _4: &str;
- let _5: &str;
- let _6: &str;
- let mut _7: Test2;
- let mut _8: isize;
- let _9: &str;
-
- bb0: {
- StorageLive(_1);
- StorageLive(_2);
- _2 = Test1::C;
- _3 = discriminant(_2);
- switchInt(move _3) -> [2: bb1, otherwise: bb2];
- }
-
- bb1: {
- StorageLive(_5);
- _5 = const "C";
- _1 = &(*_5);
- StorageDead(_5);
- StorageDead(_2);
- StorageDead(_1);
- StorageLive(_6);
- StorageLive(_7);
- _7 = Test2::D;
- _8 = discriminant(_7);
- switchInt(move _8) -> [4: bb4, 5: bb3, otherwise: bb2];
- }
-
- bb2: {
- unreachable;
- }
-
- bb3: {
- StorageLive(_9);
- _9 = const "E";
- _6 = &(*_9);
- StorageDead(_9);
- goto -> bb5;
- }
-
- bb4: {
- _6 = const "D";
- goto -> bb5;
- }
-
- bb5: {
- StorageDead(_7);
- StorageDead(_6);
- _0 = const ();
- return;
- }
-}
diff --git a/tests/mir-opt/uninhabited_enum_branching.rs b/tests/mir-opt/uninhabited_enum_branching.rs
index 0ef604c30..60389117b 100644
--- a/tests/mir-opt/uninhabited_enum_branching.rs
+++ b/tests/mir-opt/uninhabited_enum_branching.rs
@@ -1,10 +1,11 @@
-enum Empty { }
+// unit-test: UninhabitedEnumBranching
+enum Empty {}
// test matching an enum with uninhabited variants
enum Test1 {
A(Empty),
B(Empty),
- C
+ C,
}
// test an enum where the discriminants don't match the variant indexes
@@ -14,17 +15,75 @@ enum Test2 {
E = 5,
}
-// EMIT_MIR uninhabited_enum_branching.main.UninhabitedEnumBranching.diff
-// EMIT_MIR uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
-fn main() {
+// test matching an enum with uninhabited variants and multiple inhabited
+enum Test3 {
+ A(Empty),
+ B(Empty),
+ C,
+ D,
+}
+
+struct Plop {
+ xx: u32,
+ test3: Test3,
+}
+
+// EMIT_MIR uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff
+fn simple() {
+ // CHECK-LABEL: fn simple(
+ // CHECK: [[discr:_.*]] = discriminant(
+ // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb1, otherwise: [[unreachable]]];
+ // CHECK: [[unreachable]]: {
+ // CHECK-NEXT: unreachable;
match Test1::C {
Test1::A(_) => "A(Empty)",
Test1::B(_) => "B(Empty)",
Test1::C => "C",
};
+}
+// EMIT_MIR uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff
+fn custom_discriminant() {
+ // CHECK-LABEL: fn custom_discriminant(
+ // CHECK: [[discr:_.*]] = discriminant(
+ // CHECK: switchInt(move [[discr]]) -> [4: bb3, 5: bb1, otherwise: bb5];
+ // CHECK: bb5: {
+ // CHECK-NEXT: unreachable;
match Test2::D {
Test2::D => "D",
Test2::E => "E",
};
}
+
+// EMIT_MIR uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff
+fn byref() {
+ // CHECK-LABEL: fn byref(
+ let plop = Plop { xx: 51, test3: Test3::C };
+
+ // CHECK: [[ref_discr:_.*]] = discriminant((*
+ // CHECK: switchInt(move [[ref_discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb5, 3: bb1, otherwise: [[unreachable]]];
+ match &plop.test3 {
+ Test3::A(_) => "A(Empty)",
+ Test3::B(_) => "B(Empty)",
+ Test3::C => "C",
+ Test3::D => "D",
+ };
+
+ // CHECK: [[discr:_.*]] = discriminant(
+ // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable]], 1: [[unreachable]], 2: bb10, 3: bb7, otherwise: [[unreachable]]];
+ match plop.test3 {
+ Test3::A(_) => "A(Empty)",
+ Test3::B(_) => "B(Empty)",
+ Test3::C => "C",
+ Test3::D => "D",
+ };
+
+ // CHECK: [[unreachable]]: {
+ // CHECK-NEXT: unreachable;
+}
+
+fn main() {
+ simple();
+ custom_discriminant();
+ byref();
+}
diff --git a/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff
index 9db95abec..410db7980 100644
--- a/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff
+++ b/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff
@@ -1,17 +1,13 @@
-- // MIR for `main` before UninhabitedEnumBranching
-+ // MIR for `main` after UninhabitedEnumBranching
+- // MIR for `simple` before UninhabitedEnumBranching
++ // MIR for `simple` after UninhabitedEnumBranching
- fn main() -> () {
+ fn simple() -> () {
let mut _0: ();
let _1: &str;
let mut _2: Test1;
let mut _3: isize;
let _4: &str;
let _5: &str;
- let _6: &str;
- let mut _7: Test2;
- let mut _8: isize;
- let _9: &str;
bb0: {
StorageLive(_1);
@@ -19,7 +15,7 @@
_2 = Test1::C;
_3 = discriminant(_2);
- switchInt(move _3) -> [0: bb3, 1: bb4, 2: bb1, otherwise: bb2];
-+ switchInt(move _3) -> [2: bb1, otherwise: bb2];
++ switchInt(move _3) -> [0: bb6, 1: bb6, 2: bb1, otherwise: bb6];
}
bb1: {
@@ -50,31 +46,12 @@
bb5: {
StorageDead(_2);
StorageDead(_1);
- StorageLive(_6);
- StorageLive(_7);
- _7 = Test2::D;
- _8 = discriminant(_7);
- switchInt(move _8) -> [4: bb7, 5: bb6, otherwise: bb2];
- }
-
- bb6: {
- StorageLive(_9);
- _9 = const "E";
- _6 = &(*_9);
- StorageDead(_9);
- goto -> bb8;
- }
-
- bb7: {
- _6 = const "D";
- goto -> bb8;
- }
-
- bb8: {
- StorageDead(_7);
- StorageDead(_6);
_0 = const ();
return;
++ }
++
++ bb6: {
++ unreachable;
}
}
diff --git a/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
deleted file mode 100644
index 9c0c5d189..000000000
--- a/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
+++ /dev/null
@@ -1,85 +0,0 @@
-// MIR for `main` after SimplifyCfg-after-uninhabited-enum-branching
-
-fn main() -> () {
- let mut _0: ();
- let _1: Plop;
- let mut _2: Test1;
- let _3: &str;
- let mut _4: &Test1;
- let mut _5: isize;
- let _6: &str;
- let _7: &str;
- let _8: &str;
- let _9: &str;
- let mut _10: isize;
- let _11: &str;
- let _12: &str;
- let _13: &str;
- scope 1 {
- debug plop => _1;
- }
-
- bb0: {
- StorageLive(_1);
- StorageLive(_2);
- _2 = Test1::C;
- _1 = Plop { xx: const 51_u32, test1: move _2 };
- StorageDead(_2);
- StorageLive(_3);
- StorageLive(_4);
- _4 = &(_1.1: Test1);
- _5 = discriminant((*_4));
- switchInt(move _5) -> [2: bb3, 3: bb1, otherwise: bb2];
- }
-
- bb1: {
- StorageLive(_8);
- _8 = const "D";
- _3 = &(*_8);
- StorageDead(_8);
- goto -> bb4;
- }
-
- bb2: {
- unreachable;
- }
-
- bb3: {
- StorageLive(_7);
- _7 = const "C";
- _3 = &(*_7);
- StorageDead(_7);
- goto -> bb4;
- }
-
- bb4: {
- StorageDead(_4);
- StorageDead(_3);
- StorageLive(_9);
- _10 = discriminant((_1.1: Test1));
- switchInt(move _10) -> [2: bb6, 3: bb5, otherwise: bb2];
- }
-
- bb5: {
- StorageLive(_13);
- _13 = const "D";
- _9 = &(*_13);
- StorageDead(_13);
- goto -> bb7;
- }
-
- bb6: {
- StorageLive(_12);
- _12 = const "C";
- _9 = &(*_12);
- StorageDead(_12);
- goto -> bb7;
- }
-
- bb7: {
- StorageDead(_9);
- _0 = const ();
- StorageDead(_1);
- return;
- }
-}
diff --git a/tests/mir-opt/uninhabited_enum_branching2.rs b/tests/mir-opt/uninhabited_enum_branching2.rs
deleted file mode 100644
index e22e94314..000000000
--- a/tests/mir-opt/uninhabited_enum_branching2.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-enum Empty { }
-
-// test matching an enum with uninhabited variants
-enum Test1 {
- A(Empty),
- B(Empty),
- C,
- D,
-}
-
-struct Plop {
- xx: u32,
- test1: Test1,
-}
-
-// EMIT_MIR uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff
-// EMIT_MIR uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
-fn main() {
- let plop = Plop { xx: 51, test1: Test1::C };
-
- match &plop.test1 {
- Test1::A(_) => "A(Empty)",
- Test1::B(_) => "B(Empty)",
- Test1::C => "C",
- Test1::D => "D",
- };
-
- match plop.test1 {
- Test1::A(_) => "A(Empty)",
- Test1::B(_) => "B(Empty)",
- Test1::C => "C",
- Test1::D => "D",
- };
-}
diff --git a/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
index 498e1e20f..79948139f 100644
--- a/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
+++ b/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
@@ -9,7 +9,7 @@
bb0: {
_2 = discriminant(_1);
- switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1];
-+ switchInt(move _2) -> [1: bb3, otherwise: bb1];
++ switchInt(move _2) -> [0: bb5, 1: bb3, otherwise: bb1];
}
bb1: {
@@ -29,6 +29,10 @@
bb4: {
return;
++ }
++
++ bb5: {
++ unreachable;
}
}
diff --git a/tests/mir-opt/uninhabited_fallthrough_elimination.rs b/tests/mir-opt/uninhabited_fallthrough_elimination.rs
index 0853883f8..7dd41aea5 100644
--- a/tests/mir-opt/uninhabited_fallthrough_elimination.rs
+++ b/tests/mir-opt/uninhabited_fallthrough_elimination.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
enum Empty {}
enum S {
diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff
new file mode 100644
index 000000000..f6e594ffa
--- /dev/null
+++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff
@@ -0,0 +1,45 @@
+- // MIR for `as_match` before UnreachablePropagation
++ // MIR for `as_match` after UnreachablePropagation
+
+ fn as_match() -> () {
+ let mut _0: ();
+ let mut _1: std::option::Option<Empty>;
+ let mut _2: isize;
+ let _3: Empty;
+ let mut _4: !;
++ let mut _5: bool;
+ scope 1 {
+ debug _x => _3;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = empty() -> [return: bb1, unwind unreachable];
+ }
+
+ bb1: {
+ _2 = discriminant(_1);
+- switchInt(move _2) -> [0: bb4, 1: bb2, otherwise: bb3];
++ _5 = Eq(_2, const 0_isize);
++ assume(move _5);
++ goto -> bb4;
+ }
+
+ bb2: {
+- StorageLive(_3);
+- _3 = move ((_1 as Some).0: Empty);
+- StorageLive(_4);
+ unreachable;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff
new file mode 100644
index 000000000..2813d6467
--- /dev/null
+++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff
@@ -0,0 +1,45 @@
+- // MIR for `as_match` before UnreachablePropagation
++ // MIR for `as_match` after UnreachablePropagation
+
+ fn as_match() -> () {
+ let mut _0: ();
+ let mut _1: std::option::Option<Empty>;
+ let mut _2: isize;
+ let _3: Empty;
+ let mut _4: !;
++ let mut _5: bool;
+ scope 1 {
+ debug _x => _3;
+ }
+
+ bb0: {
+ StorageLive(_1);
+ _1 = empty() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ _2 = discriminant(_1);
+- switchInt(move _2) -> [0: bb4, 1: bb2, otherwise: bb3];
++ _5 = Eq(_2, const 0_isize);
++ assume(move _5);
++ goto -> bb4;
+ }
+
+ bb2: {
+- StorageLive(_3);
+- _3 = move ((_1 as Some).0: Empty);
+- StorageLive(_4);
+ unreachable;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff
index eb5a0c39b..619597327 100644
--- a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-abort.diff
+++ b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff
@@ -1,13 +1,14 @@
-- // MIR for `main` before UnreachablePropagation
-+ // MIR for `main` after UnreachablePropagation
+- // MIR for `if_let` before UnreachablePropagation
++ // MIR for `if_let` after UnreachablePropagation
- fn main() -> () {
+ fn if_let() -> () {
let mut _0: ();
let mut _1: std::option::Option<Empty>;
let mut _2: isize;
let _5: ();
let mut _6: bool;
let mut _7: !;
++ let mut _8: bool;
scope 1 {
debug _x => _3;
let _3: Empty;
@@ -25,7 +26,9 @@
bb1: {
_2 = discriminant(_1);
- switchInt(move _2) -> [1: bb2, otherwise: bb6];
-+ switchInt(move _2) -> [1: bb2, otherwise: bb3];
++ _8 = Ne(_2, const 1_isize);
++ assume(move _8);
++ goto -> bb6;
}
bb2: {
@@ -36,29 +39,31 @@
- StorageLive(_6);
- _6 = const true;
- switchInt(move _6) -> [0: bb4, otherwise: bb3];
-- }
--
-- bb3: {
++ unreachable;
+ }
+
+ bb3: {
- _4 = const 21_i32;
- _5 = const ();
- goto -> bb5;
-- }
--
-- bb4: {
++ unreachable;
+ }
+
+ bb4: {
- _4 = const 42_i32;
- _5 = const ();
- goto -> bb5;
-- }
--
-- bb5: {
++ unreachable;
+ }
+
+ bb5: {
- StorageDead(_6);
- StorageDead(_5);
- StorageLive(_7);
unreachable;
}
-- bb6: {
-+ bb3: {
+ bb6: {
_0 = const ();
StorageDead(_1);
return;
diff --git a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff
index 906dce981..476e2f559 100644
--- a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff
+++ b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff
@@ -1,13 +1,14 @@
-- // MIR for `main` before UnreachablePropagation
-+ // MIR for `main` after UnreachablePropagation
+- // MIR for `if_let` before UnreachablePropagation
++ // MIR for `if_let` after UnreachablePropagation
- fn main() -> () {
+ fn if_let() -> () {
let mut _0: ();
let mut _1: std::option::Option<Empty>;
let mut _2: isize;
let _5: ();
let mut _6: bool;
let mut _7: !;
++ let mut _8: bool;
scope 1 {
debug _x => _3;
let _3: Empty;
@@ -25,7 +26,9 @@
bb1: {
_2 = discriminant(_1);
- switchInt(move _2) -> [1: bb2, otherwise: bb6];
-+ switchInt(move _2) -> [1: bb2, otherwise: bb3];
++ _8 = Ne(_2, const 1_isize);
++ assume(move _8);
++ goto -> bb6;
}
bb2: {
@@ -36,29 +39,31 @@
- StorageLive(_6);
- _6 = const true;
- switchInt(move _6) -> [0: bb4, otherwise: bb3];
-- }
--
-- bb3: {
++ unreachable;
+ }
+
+ bb3: {
- _4 = const 21_i32;
- _5 = const ();
- goto -> bb5;
-- }
--
-- bb4: {
++ unreachable;
+ }
+
+ bb4: {
- _4 = const 42_i32;
- _5 = const ();
- goto -> bb5;
-- }
--
-- bb5: {
++ unreachable;
+ }
+
+ bb5: {
- StorageDead(_6);
- StorageDead(_5);
- StorageLive(_7);
unreachable;
}
-- bb6: {
-+ bb3: {
+ bb6: {
_0 = const ();
StorageDead(_1);
return;
diff --git a/tests/mir-opt/unreachable.rs b/tests/mir-opt/unreachable.rs
index 23fad4737..5b96681d9 100644
--- a/tests/mir-opt/unreachable.rs
+++ b/tests/mir-opt/unreachable.rs
@@ -1,12 +1,31 @@
+// unit-test: UnreachablePropagation
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
enum Empty {}
fn empty() -> Option<Empty> {
None
}
-// EMIT_MIR unreachable.main.UnreachablePropagation.diff
-fn main() {
+// EMIT_MIR unreachable.if_let.UnreachablePropagation.diff
+fn if_let() {
+ // CHECK-LABEL: fn if_let(
+ // CHECK: bb0: {
+ // CHECK: {{_.*}} = empty()
+ // CHECK: bb1: {
+ // CHECK: [[ne:_.*]] = Ne({{.*}}, const 1_isize);
+ // CHECK-NEXT: assume(move [[ne]]);
+ // CHECK-NEXT: goto -> bb6;
+ // CHECK: bb2: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb3: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb4: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb5: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb6: {
+ // CHECK: return;
if let Some(_x) = empty() {
let mut _y;
@@ -19,3 +38,29 @@ fn main() {
match _x { }
}
}
+
+// EMIT_MIR unreachable.as_match.UnreachablePropagation.diff
+fn as_match() {
+ // CHECK-LABEL: fn as_match(
+ // CHECK: bb0: {
+ // CHECK: {{_.*}} = empty()
+ // CHECK: bb1: {
+ // CHECK: [[eq:_.*]] = Eq({{.*}}, const 0_isize);
+ // CHECK-NEXT: assume(move [[eq]]);
+ // CHECK-NEXT: goto -> bb4;
+ // CHECK: bb2: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb3: {
+ // CHECK-NEXT: unreachable;
+ // CHECK: bb4: {
+ // CHECK: return;
+ match empty() {
+ None => {}
+ Some(_x) => match _x {}
+ }
+}
+
+fn main() {
+ if_let();
+ as_match();
+}
diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff
index 713757ce6..11d7924e7 100644
--- a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff
+++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff
@@ -9,6 +9,7 @@
let _5: ();
let mut _6: bool;
let mut _7: !;
++ let mut _8: bool;
scope 1 {
debug x => _1;
scope 2 {
@@ -35,7 +36,10 @@
StorageLive(_5);
StorageLive(_6);
_6 = _1;
- switchInt(move _6) -> [0: bb4, otherwise: bb3];
+- switchInt(move _6) -> [0: bb4, otherwise: bb3];
++ _8 = Ne(_6, const false);
++ assume(move _8);
++ goto -> bb3;
}
bb3: {
diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff
index a0479fb91..df6f5609f 100644
--- a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff
+++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff
@@ -9,6 +9,7 @@
let _5: ();
let mut _6: bool;
let mut _7: !;
++ let mut _8: bool;
scope 1 {
debug x => _1;
scope 2 {
@@ -35,7 +36,10 @@
StorageLive(_5);
StorageLive(_6);
_6 = _1;
- switchInt(move _6) -> [0: bb4, otherwise: bb3];
+- switchInt(move _6) -> [0: bb4, otherwise: bb3];
++ _8 = Ne(_6, const false);
++ assume(move _8);
++ goto -> bb3;
}
bb3: {
diff --git a/tests/mir-opt/unreachable_diverging.rs b/tests/mir-opt/unreachable_diverging.rs
index b7d308b86..b1df6f852 100644
--- a/tests/mir-opt/unreachable_diverging.rs
+++ b/tests/mir-opt/unreachable_diverging.rs
@@ -1,4 +1,6 @@
+// unit-test: UnreachablePropagation
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
pub enum Empty {}
fn empty() -> Option<Empty> {
@@ -11,6 +13,23 @@ fn loop_forever() {
// EMIT_MIR unreachable_diverging.main.UnreachablePropagation.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: bb0: {
+ // CHECK: {{_.*}} = empty()
+ // CHECK: bb1: {
+ // CHECK: switchInt({{.*}}) -> [1: bb2, otherwise: bb6];
+ // CHECK: bb2: {
+ // CHECK: [[ne:_.*]] = Ne({{.*}}, const false);
+ // CHECK: assume(move [[ne]]);
+ // CHECK: goto -> bb3;
+ // CHECK: bb3: {
+ // CHECK: {{_.*}} = loop_forever()
+ // CHECK: bb4: {
+ // CHECK: unreachable;
+ // CHECK: bb5: {
+ // CHECK: unreachable;
+ // CHECK: bb6: {
+ // CHECK: return;
let x = true;
if let Some(bomb) = empty() {
if x {
diff --git a/tests/mir-opt/unusual_item_types.rs b/tests/mir-opt/unusual_item_types.rs
index 6dad63641..49b663b4f 100644
--- a/tests/mir-opt/unusual_item_types.rs
+++ b/tests/mir-opt/unusual_item_types.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that we don't ICE when trying to dump MIR for unusual item types and
// that we don't create filenames containing `<` and `>`
// compile-flags: -Zmir-opt-level=0
diff --git a/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir b/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir
index e2edbfcd4..a5121ae55 100644
--- a/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir
+++ b/tests/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/unusual_item_types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT` after built
+// MIR for `<impl at $DIR/unusual_item_types.rs:10:1: 10:7>::ASSOCIATED_CONSTANT` after built
-const <impl at $DIR/unusual_item_types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT: i32 = {
+const <impl at $DIR/unusual_item_types.rs:10:1: 10:7>::ASSOCIATED_CONSTANT: i32 = {
let mut _0: i32;
bb0: {
diff --git a/tests/mir-opt/while_storage.rs b/tests/mir-opt/while_storage.rs
deleted file mode 100644
index d4fb54da5..000000000
--- a/tests/mir-opt/while_storage.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// Test that we correctly generate StorageDead statements for while loop
-// conditions on all branches
-
-fn get_bool(c: bool) -> bool {
- c
-}
-
-// EMIT_MIR while_storage.while_loop.PreCodegen.after.mir
-fn while_loop(c: bool) {
- while get_bool(c) {
- if get_bool(c) {
- break;
- }
- }
-}
-
-fn main() {
- while_loop(false);
-}
diff --git a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir
deleted file mode 100644
index c04fdeb63..000000000
--- a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir
+++ /dev/null
@@ -1,46 +0,0 @@
-// MIR for `while_loop` after PreCodegen
-
-fn while_loop(_1: bool) -> () {
- debug c => _1;
- let mut _0: ();
- let mut _2: bool;
- let mut _3: bool;
-
- bb0: {
- goto -> bb1;
- }
-
- bb1: {
- StorageLive(_2);
- _2 = get_bool(_1) -> [return: bb2, unwind unreachable];
- }
-
- bb2: {
- switchInt(move _2) -> [0: bb7, otherwise: bb3];
- }
-
- bb3: {
- StorageLive(_3);
- _3 = get_bool(_1) -> [return: bb4, unwind unreachable];
- }
-
- bb4: {
- switchInt(move _3) -> [0: bb5, otherwise: bb6];
- }
-
- bb5: {
- StorageDead(_3);
- StorageDead(_2);
- goto -> bb1;
- }
-
- bb6: {
- StorageDead(_3);
- goto -> bb7;
- }
-
- bb7: {
- StorageDead(_2);
- return;
- }
-}
diff --git a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir
deleted file mode 100644
index 7dc4f7ab1..000000000
--- a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir
+++ /dev/null
@@ -1,46 +0,0 @@
-// MIR for `while_loop` after PreCodegen
-
-fn while_loop(_1: bool) -> () {
- debug c => _1;
- let mut _0: ();
- let mut _2: bool;
- let mut _3: bool;
-
- bb0: {
- goto -> bb1;
- }
-
- bb1: {
- StorageLive(_2);
- _2 = get_bool(_1) -> [return: bb2, unwind continue];
- }
-
- bb2: {
- switchInt(move _2) -> [0: bb7, otherwise: bb3];
- }
-
- bb3: {
- StorageLive(_3);
- _3 = get_bool(_1) -> [return: bb4, unwind continue];
- }
-
- bb4: {
- switchInt(move _3) -> [0: bb5, otherwise: bb6];
- }
-
- bb5: {
- StorageDead(_3);
- StorageDead(_2);
- goto -> bb1;
- }
-
- bb6: {
- StorageDead(_3);
- goto -> bb7;
- }
-
- bb7: {
- StorageDead(_2);
- return;
- }
-}
diff --git a/tests/pretty/format-args-str-escape.pp b/tests/pretty/format-args-str-escape.pp
new file mode 100644
index 000000000..b84bc2303
--- /dev/null
+++ b/tests/pretty/format-args-str-escape.pp
@@ -0,0 +1,21 @@
+#![feature(prelude_import)]
+#![no_std]
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+// pretty-compare-only
+// pretty-mode:expanded
+// pp-exact:format-args-str-escape.pp
+
+fn main() {
+ { ::std::io::_print(format_args!("\u{1b}[1mHello, world!\u{1b}[0m\n")); };
+ { ::std::io::_print(format_args!("\u{1b}[1mHello, world!\u{1b}[0m\n")); };
+ {
+ ::std::io::_print(format_args!("Not an escape sequence: \\u{{1B}}[1mbold\\x1B[0m\n"));
+ };
+ {
+ ::std::io::_print(format_args!("{0}\n",
+ "\x1B[1mHello, world!\x1B[0m"));
+ };
+}
diff --git a/tests/pretty/format-args-str-escape.rs b/tests/pretty/format-args-str-escape.rs
new file mode 100644
index 000000000..e596fcfd8
--- /dev/null
+++ b/tests/pretty/format-args-str-escape.rs
@@ -0,0 +1,10 @@
+// pretty-compare-only
+// pretty-mode:expanded
+// pp-exact:format-args-str-escape.pp
+
+fn main() {
+ println!("\x1B[1mHello, world!\x1B[0m");
+ println!("\u{1B}[1mHello, world!\u{1B}[0m");
+ println!("Not an escape sequence: \\u{{1B}}[1mbold\\x1B[0m");
+ println!("{}", "\x1B[1mHello, world!\x1B[0m");
+}
diff --git a/tests/pretty/hir-fn-variadic.pp b/tests/pretty/hir-fn-variadic.pp
new file mode 100644
index 000000000..577d9400a
--- /dev/null
+++ b/tests/pretty/hir-fn-variadic.pp
@@ -0,0 +1,15 @@
+// pretty-compare-only
+// pretty-mode:hir
+// pp-exact:hir-fn-variadic.pp
+
+#![feature(c_variadic)]
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+
+extern "C" {
+ fn foo(x: i32, va1: ...);
+}
+
+unsafe extern "C" fn bar(_: i32, mut va2: ...) -> usize { va2.arg::<usize>() }
diff --git a/tests/pretty/hir-fn-variadic.rs b/tests/pretty/hir-fn-variadic.rs
new file mode 100644
index 000000000..efb2754df
--- /dev/null
+++ b/tests/pretty/hir-fn-variadic.rs
@@ -0,0 +1,13 @@
+// pretty-compare-only
+// pretty-mode:hir
+// pp-exact:hir-fn-variadic.pp
+
+#![feature(c_variadic)]
+
+extern "C" {
+ pub fn foo(x: i32, va1: ...);
+}
+
+pub unsafe extern "C" fn bar(_: i32, mut va2: ...) -> usize {
+ va2.arg::<usize>()
+}
diff --git a/tests/run-coverage/abort.rs b/tests/run-coverage/abort.rs
deleted file mode 100644
index 98264bdc1..000000000
--- a/tests/run-coverage/abort.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-#![feature(c_unwind)]
-#![allow(unused_assignments)]
-
-extern "C" fn might_abort(should_abort: bool) {
- if should_abort {
- println!("aborting...");
- panic!("panics and aborts");
- } else {
- println!("Don't Panic");
- }
-}
-
-fn main() -> Result<(), u8> {
- let mut countdown = 10;
- while countdown > 0 {
- if countdown < 5 {
- might_abort(false);
- }
- // See discussion (below the `Notes` section) on coverage results for the closing brace.
- if countdown < 5 { might_abort(false); } // Counts for different regions on one line.
- // For the following example, the closing brace is the last character on the line.
- // This shows the character after the closing brace is highlighted, even if that next
- // character is a newline.
- if countdown < 5 { might_abort(false); }
- countdown -= 1;
- }
- Ok(())
-}
-
-// Notes:
-// 1. Compare this program and its coverage results to those of the similar tests
-// `panic_unwind.rs` and `try_error_result.rs`.
-// 2. This test confirms the coverage generated when a program includes `UnwindAction::Terminate`.
-// 3. The test does not invoke the abort. By executing to a successful completion, the coverage
-// results show where the program did and did not execute.
-// 4. If the program actually aborted, the coverage counters would not be saved (which "works as
-// intended"). Coverage results would show no executed coverage regions.
-// 6. If `should_abort` is `true` and the program aborts, the program exits with a `132` status
-// (on Linux at least).
-
-/*
-
-Expect the following coverage results:
-
-```text
- 16| 11| while countdown > 0 {
- 17| 10| if countdown < 5 {
- 18| 4| might_abort(false);
- 19| 6| }
-```
-
-This is actually correct.
-
-The condition `countdown < 5` executed 10 times (10 loop iterations).
-
-It evaluated to `true` 4 times, and executed the `might_abort()` call.
-
-It skipped the body of the `might_abort()` call 6 times. If an `if` does not include an explicit
-`else`, the coverage implementation injects a counter, at the character immediately after the `if`s
-closing brace, to count the "implicit" `else`. This is the only way to capture the coverage of the
-non-true condition.
-
-As another example of why this is important, say the condition was `countdown < 50`, which is always
-`true`. In that case, we wouldn't have a test for what happens if `might_abort()` is not called.
-The closing brace would have a count of `0`, highlighting the missed coverage.
-*/
diff --git a/tests/run-coverage/assert.rs b/tests/run-coverage/assert.rs
deleted file mode 100644
index 85e6662a6..000000000
--- a/tests/run-coverage/assert.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-#![allow(unused_assignments)]
-// failure-status: 101
-
-fn might_fail_assert(one_plus_one: u32) {
- println!("does 1 + 1 = {}?", one_plus_one);
- assert_eq!(1 + 1, one_plus_one, "the argument was wrong");
-}
-
-fn main() -> Result<(), u8> {
- let mut countdown = 10;
- while countdown > 0 {
- if countdown == 1 {
- might_fail_assert(3);
- } else if countdown < 5 {
- might_fail_assert(2);
- }
- countdown -= 1;
- }
- Ok(())
-}
-
-// Notes:
-// 1. Compare this program and its coverage results to those of the very similar test
-// `panic_unwind.rs`, and similar tests `abort.rs` and `try_error_result.rs`.
-// 2. This test confirms the coverage generated when a program passes or fails an `assert!()` or
-// related `assert_*!()` macro.
-// 3. Notably, the `assert` macros *do not* generate `TerminatorKind::Assert`. The macros produce
-// conditional expressions, `TerminatorKind::SwitchInt` branches, and a possible call to
-// `begin_panic_fmt()` (that begins a panic unwind, if the assertion test fails).
-// 4. `TerminatoKind::Assert` is, however, also present in the MIR generated for this test
-// (and in many other coverage tests). The `Assert` terminator is typically generated by the
-// Rust compiler to check for runtime failures, such as numeric overflows.
diff --git a/tests/run-coverage/async.rs b/tests/run-coverage/async.rs
deleted file mode 100644
index efd9e62d6..000000000
--- a/tests/run-coverage/async.rs
+++ /dev/null
@@ -1,128 +0,0 @@
-#![allow(unused_assignments, dead_code)]
-
-// compile-flags: --edition=2018 -C opt-level=1
-
-async fn c(x: u8) -> u8 {
- if x == 8 {
- 1
- } else {
- 0
- }
-}
-
-async fn d() -> u8 { 1 }
-
-async fn e() -> u8 { 1 } // unused function; executor does not block on `g()`
-
-async fn f() -> u8 { 1 }
-
-async fn foo() -> [bool; 10] { [false; 10] } // unused function; executor does not block on `h()`
-
-pub async fn g(x: u8) {
- match x {
- y if e().await == y => (),
- y if f().await == y => (),
- _ => (),
- }
-}
-
-async fn h(x: usize) { // The function signature is counted when called, but the body is not
- // executed (not awaited) so the open brace has a `0` count (at least when
- // displayed with `llvm-cov show` in color-mode).
- match x {
- y if foo().await[y] => (),
- _ => (),
- }
-}
-
-async fn i(x: u8) { // line coverage is 1, but there are 2 regions:
- // (a) the function signature, counted when the function is called; and
- // (b) the open brace for the function body, counted once when the body is
- // executed asynchronously.
- match x {
- y if c(x).await == y + 1 => { d().await; }
- y if f().await == y + 1 => (),
- _ => (),
- }
-}
-
-fn j(x: u8) {
- // non-async versions of `c()`, `d()`, and `f()` to make it similar to async `i()`.
- fn c(x: u8) -> u8 {
- if x == 8 {
- 1 // This line appears covered, but the 1-character expression span covering the `1`
- // is not executed. (`llvm-cov show` displays a `^0` below the `1` ). This is because
- // `fn j()` executes the open brace for the function body, followed by the function's
- // first executable statement, `match x`. Inner function declarations are not
- // "visible" to the MIR for `j()`, so the code region counts all lines between the
- // open brace and the first statement as executed, which is, in a sense, true.
- // `llvm-cov show` overcomes this kind of situation by showing the actual counts
- // of the enclosed coverages, (that is, the `1` expression was not executed, and
- // accurately displays a `0`).
- } else {
- 0
- }
- }
- fn d() -> u8 { 1 } // inner function is defined in-line, but the function is not executed
- fn f() -> u8 { 1 }
- match x {
- y if c(x) == y + 1 => { d(); }
- y if f() == y + 1 => (),
- _ => (),
- }
-}
-
-fn k(x: u8) { // unused function
- match x {
- 1 => (),
- 2 => (),
- _ => (),
- }
-}
-
-fn l(x: u8) {
- match x {
- 1 => (),
- 2 => (),
- _ => (),
- }
-}
-
-async fn m(x: u8) -> u8 { x - 1 }
-
-fn main() {
- let _ = g(10);
- let _ = h(9);
- let mut future = Box::pin(i(8));
- j(7);
- l(6);
- let _ = m(5);
- executor::block_on(future.as_mut());
-}
-
-mod executor {
- use core::{
- future::Future,
- pin::Pin,
- task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
- };
-
- pub fn block_on<F: Future>(mut future: F) -> F::Output {
- let mut future = unsafe { Pin::new_unchecked(&mut future) };
- use std::hint::unreachable_unchecked;
- static VTABLE: RawWakerVTable = RawWakerVTable::new(
- |_| unsafe { unreachable_unchecked() }, // clone
- |_| unsafe { unreachable_unchecked() }, // wake
- |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- |_| (),
- );
- let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
- let mut context = Context::from_waker(&waker);
-
- loop {
- if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
- break val;
- }
- }
- }
-}
diff --git a/tests/run-coverage/async2.rs b/tests/run-coverage/async2.rs
deleted file mode 100644
index 2884ff297..000000000
--- a/tests/run-coverage/async2.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-// compile-flags: --edition=2018
-
-fn non_async_func() {
- println!("non_async_func was covered");
- let b = true;
- if b {
- println!("non_async_func println in block");
- }
-}
-
-async fn async_func() {
- println!("async_func was covered");
- let b = true;
- if b {
- println!("async_func println in block");
- }
-}
-
-async fn async_func_just_println() {
- println!("async_func_just_println was covered");
-}
-
-fn main() {
- println!("codecovsample::main");
-
- non_async_func();
-
- executor::block_on(async_func());
- executor::block_on(async_func_just_println());
-}
-
-mod executor {
- use core::{
- future::Future,
- pin::Pin,
- task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
- };
-
- pub fn block_on<F: Future>(mut future: F) -> F::Output {
- let mut future = unsafe { Pin::new_unchecked(&mut future) };
- use std::hint::unreachable_unchecked;
- static VTABLE: RawWakerVTable = RawWakerVTable::new(
- |_| unsafe { unreachable_unchecked() }, // clone
- |_| unsafe { unreachable_unchecked() }, // wake
- |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- |_| (),
- );
- let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
- let mut context = Context::from_waker(&waker);
-
- loop {
- if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
- break val;
- }
- }
- }
-}
diff --git a/tests/run-coverage/closure.rs b/tests/run-coverage/closure.rs
deleted file mode 100644
index 16a2c4e33..000000000
--- a/tests/run-coverage/closure.rs
+++ /dev/null
@@ -1,220 +0,0 @@
-#![allow(unused_assignments, unused_variables)]
-// compile-flags: -C opt-level=2
-
-// This test used to be sensitive to certain coverage-specific hacks in
-// `rustc_middle/mir/mono.rs`, but those hacks were later cleaned up by
-// <https://github.com/rust-lang/rust/pull/83666>.
-
-fn main() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
- let is_false = !is_true;
-
- let mut some_string = Some(String::from("the string content"));
- println!(
- "The string or alt: {}"
- ,
- some_string
- .
- unwrap_or_else
- (
- ||
- {
- let mut countdown = 0;
- if is_false {
- countdown = 10;
- }
- "alt string 1".to_owned()
- }
- )
- );
-
- some_string = Some(String::from("the string content"));
- let
- a
- =
- ||
- {
- let mut countdown = 0;
- if is_false {
- countdown = 10;
- }
- "alt string 2".to_owned()
- };
- println!(
- "The string or alt: {}"
- ,
- some_string
- .
- unwrap_or_else
- (
- a
- )
- );
-
- some_string = None;
- println!(
- "The string or alt: {}"
- ,
- some_string
- .
- unwrap_or_else
- (
- ||
- {
- let mut countdown = 0;
- if is_false {
- countdown = 10;
- }
- "alt string 3".to_owned()
- }
- )
- );
-
- some_string = None;
- let
- a
- =
- ||
- {
- let mut countdown = 0;
- if is_false {
- countdown = 10;
- }
- "alt string 4".to_owned()
- };
- println!(
- "The string or alt: {}"
- ,
- some_string
- .
- unwrap_or_else
- (
- a
- )
- );
-
- let
- quote_closure
- =
- |val|
- {
- let mut countdown = 0;
- if is_false {
- countdown = 10;
- }
- format!("'{}'", val)
- };
- println!(
- "Repeated, quoted string: {:?}"
- ,
- std::iter::repeat("repeat me")
- .take(5)
- .map
- (
- quote_closure
- )
- .collect::<Vec<_>>()
- );
-
- let
- _unused_closure
- =
- |
- mut countdown
- |
- {
- if is_false {
- countdown = 10;
- }
- "closure should be unused".to_owned()
- };
-
- let mut countdown = 10;
- let _short_unused_closure = | _unused_arg: u8 | countdown += 1;
-
-
- let short_used_covered_closure_macro = | used_arg: u8 | println!("called");
- let short_used_not_covered_closure_macro = | used_arg: u8 | println!("not called");
- let _short_unused_closure_macro = | _unused_arg: u8 | println!("not called");
-
-
-
-
- let _short_unused_closure_block = | _unused_arg: u8 | { println!("not called") };
-
- let _shortish_unused_closure = | _unused_arg: u8 | {
- println!("not called")
- };
-
- let _as_short_unused_closure = |
- _unused_arg: u8
- | { println!("not called") };
-
- let _almost_as_short_unused_closure = |
- _unused_arg: u8
- | { println!("not called") }
- ;
-
-
-
-
-
- let _short_unused_closure_line_break_no_block = | _unused_arg: u8 |
-println!("not called")
- ;
-
- let _short_unused_closure_line_break_no_block2 =
- | _unused_arg: u8 |
- println!(
- "not called"
- )
- ;
-
- let short_used_not_covered_closure_line_break_no_block_embedded_branch =
- | _unused_arg: u8 |
- println!(
- "not called: {}",
- if is_true { "check" } else { "me" }
- )
- ;
-
- let short_used_not_covered_closure_line_break_block_embedded_branch =
- | _unused_arg: u8 |
- {
- println!(
- "not called: {}",
- if is_true { "check" } else { "me" }
- )
- }
- ;
-
- let short_used_covered_closure_line_break_no_block_embedded_branch =
- | _unused_arg: u8 |
- println!(
- "not called: {}",
- if is_true { "check" } else { "me" }
- )
- ;
-
- let short_used_covered_closure_line_break_block_embedded_branch =
- | _unused_arg: u8 |
- {
- println!(
- "not called: {}",
- if is_true { "check" } else { "me" }
- )
- }
- ;
-
- if is_false {
- short_used_not_covered_closure_macro(0);
- short_used_not_covered_closure_line_break_no_block_embedded_branch(0);
- short_used_not_covered_closure_line_break_block_embedded_branch(0);
- }
- short_used_covered_closure_macro(0);
- short_used_covered_closure_line_break_no_block_embedded_branch(0);
- short_used_covered_closure_line_break_block_embedded_branch(0);
-}
diff --git a/tests/run-coverage/closure_bug.rs b/tests/run-coverage/closure_bug.rs
deleted file mode 100644
index 739bc5f0b..000000000
--- a/tests/run-coverage/closure_bug.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-// Regression test for #115930.
-// All of these closures are identical, and should produce identical output in
-// the coverage report. However, an unstable sort was causing them to be treated
-// inconsistently when preparing coverage spans.
-
-fn main() {
- let truthy = std::env::args().len() == 1;
-
- let a
- =
- |
- |
- if truthy { true } else { false };
-
- a();
- if truthy { a(); }
-
- let b
- =
- |
- |
- if truthy { true } else { false };
-
- b();
- if truthy { b(); }
-
- let c
- =
- |
- |
- if truthy { true } else { false };
-
- c();
- if truthy { c(); }
-
- let d
- =
- |
- |
- if truthy { true } else { false };
-
- d();
- if truthy { d(); }
-}
diff --git a/tests/run-coverage/closure_macro.rs b/tests/run-coverage/closure_macro.rs
deleted file mode 100644
index 9b289141c..000000000
--- a/tests/run-coverage/closure_macro.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-// compile-flags: --edition=2018
-#![feature(coverage_attribute)]
-
-macro_rules! bail {
- ($msg:literal $(,)?) => {
- if $msg.len() > 0 {
- println!("no msg");
- } else {
- println!($msg);
- }
- return Err(String::from($msg));
- };
-}
-
-macro_rules! on_error {
- ($value:expr, $error_message:expr) => {
- $value.or_else(|e| { // FIXME(85000): no coverage in closure macros
- let message = format!($error_message, e);
- if message.len() > 0 {
- println!("{}", message);
- Ok(String::from("ok"))
- } else {
- bail!("error");
- }
- })
- };
-}
-
-fn load_configuration_files() -> Result<String, String> {
- Ok(String::from("config"))
-}
-
-pub fn main() -> Result<(), String> {
- println!("Starting service");
- let config = on_error!(load_configuration_files(), "Error loading configs: {}")?;
-
- let startup_delay_duration = String::from("arg");
- let _ = (config, startup_delay_duration);
- Ok(())
-}
diff --git a/tests/run-coverage/closure_macro_async.rs b/tests/run-coverage/closure_macro_async.rs
deleted file mode 100644
index b4275599e..000000000
--- a/tests/run-coverage/closure_macro_async.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-// compile-flags: --edition=2018
-#![feature(coverage_attribute)]
-
-macro_rules! bail {
- ($msg:literal $(,)?) => {
- if $msg.len() > 0 {
- println!("no msg");
- } else {
- println!($msg);
- }
- return Err(String::from($msg));
- };
-}
-
-macro_rules! on_error {
- ($value:expr, $error_message:expr) => {
- $value.or_else(|e| { // FIXME(85000): no coverage in closure macros
- let message = format!($error_message, e);
- if message.len() > 0 {
- println!("{}", message);
- Ok(String::from("ok"))
- } else {
- bail!("error");
- }
- })
- };
-}
-
-fn load_configuration_files() -> Result<String, String> {
- Ok(String::from("config"))
-}
-
-pub async fn test() -> Result<(), String> {
- println!("Starting service");
- let config = on_error!(load_configuration_files(), "Error loading configs: {}")?;
-
- let startup_delay_duration = String::from("arg");
- let _ = (config, startup_delay_duration);
- Ok(())
-}
-
-#[coverage(off)]
-fn main() {
- executor::block_on(test()).unwrap();
-}
-
-mod executor {
- use core::{
- future::Future,
- pin::Pin,
- task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
- };
-
- #[coverage(off)]
- pub fn block_on<F: Future>(mut future: F) -> F::Output {
- let mut future = unsafe { Pin::new_unchecked(&mut future) };
- use std::hint::unreachable_unchecked;
- static VTABLE: RawWakerVTable = RawWakerVTable::new(
- #[coverage(off)]
- |_| unsafe { unreachable_unchecked() }, // clone
- #[coverage(off)]
- |_| unsafe { unreachable_unchecked() }, // wake
- #[coverage(off)]
- |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- #[coverage(off)]
- |_| (),
- );
- let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
- let mut context = Context::from_waker(&waker);
-
- loop {
- if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
- break val;
- }
- }
- }
-}
diff --git a/tests/run-coverage/conditions.rs b/tests/run-coverage/conditions.rs
deleted file mode 100644
index fa7f2a116..000000000
--- a/tests/run-coverage/conditions.rs
+++ /dev/null
@@ -1,86 +0,0 @@
-#![allow(unused_assignments, unused_variables)]
-
-fn main() {
- let mut countdown = 0;
- if true {
- countdown = 10;
- }
-
- const B: u32 = 100;
- let x = if countdown > 7 {
- countdown -= 4;
- B
- } else if countdown > 2 {
- if countdown < 1 || countdown > 5 || countdown != 9 {
- countdown = 0;
- }
- countdown -= 5;
- countdown
- } else {
- return;
- };
-
- let mut countdown = 0;
- if true {
- countdown = 10;
- }
-
- if countdown > 7 {
- countdown -= 4;
- } else if countdown > 2 {
- if countdown < 1 || countdown > 5 || countdown != 9 {
- countdown = 0;
- }
- countdown -= 5;
- } else {
- return;
- }
-
- if true {
- let mut countdown = 0;
- if true {
- countdown = 10;
- }
-
- if countdown > 7 {
- countdown -= 4;
- }
- else if countdown > 2 {
- if countdown < 1 || countdown > 5 || countdown != 9 {
- countdown = 0;
- }
- countdown -= 5;
- } else {
- return;
- }
- }
-
- let mut countdown = 0;
- if true {
- countdown = 1;
- }
-
- let z = if countdown > 7 {
- countdown -= 4;
- } else if countdown > 2 {
- if countdown < 1 || countdown > 5 || countdown != 9 {
- countdown = 0;
- }
- countdown -= 5;
- } else {
- let should_be_reachable = countdown;
- println!("reached");
- return;
- };
-
- let w = if countdown > 7 {
- countdown -= 4;
- } else if countdown > 2 {
- if countdown < 1 || countdown > 5 || countdown != 9 {
- countdown = 0;
- }
- countdown -= 5;
- } else {
- return;
- };
-}
diff --git a/tests/run-coverage/continue.rs b/tests/run-coverage/continue.rs
deleted file mode 100644
index 624aa9834..000000000
--- a/tests/run-coverage/continue.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-#![allow(unused_assignments, unused_variables)]
-
-fn main() {
- let is_true = std::env::args().len() == 1;
-
- let mut x = 0;
- for _ in 0..10 {
- match is_true {
- true => {
- continue;
- }
- _ => {
- x = 1;
- }
- }
- x = 3;
- }
- for _ in 0..10 {
- match is_true {
- false => {
- x = 1;
- }
- _ => {
- continue;
- }
- }
- x = 3;
- }
- for _ in 0..10 {
- match is_true {
- true => {
- x = 1;
- }
- _ => {
- continue;
- }
- }
- x = 3;
- }
- for _ in 0..10 {
- if is_true {
- continue;
- }
- x = 3;
- }
- for _ in 0..10 {
- match is_true {
- false => {
- x = 1;
- }
- _ => {
- let _ = x;
- }
- }
- x = 3;
- }
- for _ in 0..10 {
- match is_true {
- false => {
- x = 1;
- }
- _ => {
- break;
- }
- }
- x = 3;
- }
- let _ = x;
-}
diff --git a/tests/run-coverage/dead_code.rs b/tests/run-coverage/dead_code.rs
deleted file mode 100644
index 3492712a6..000000000
--- a/tests/run-coverage/dead_code.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#![allow(dead_code, unused_assignments, unused_variables)]
-
-pub fn unused_pub_fn_not_in_library() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
-
- let mut countdown = 0;
- if is_true {
- countdown = 10;
- }
-}
-
-fn unused_fn() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
-
- let mut countdown = 0;
- if is_true {
- countdown = 10;
- }
-}
-
-fn main() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
-
- let mut countdown = 0;
- if is_true {
- countdown = 10;
- }
-}
diff --git a/tests/run-coverage/drop_trait.rs b/tests/run-coverage/drop_trait.rs
deleted file mode 100644
index 7b062719c..000000000
--- a/tests/run-coverage/drop_trait.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-#![allow(unused_assignments)]
-// failure-status: 1
-
-struct Firework {
- strength: i32,
-}
-
-impl Drop for Firework {
- fn drop(&mut self) {
- println!("BOOM times {}!!!", self.strength);
- }
-}
-
-fn main() -> Result<(), u8> {
- let _firecracker = Firework { strength: 1 };
-
- let _tnt = Firework { strength: 100 };
-
- if true {
- println!("Exiting with error...");
- return Err(1);
- }
-
- let _ = Firework { strength: 1000 };
-
- Ok(())
-}
-
-// Expected program output:
-// Exiting with error...
-// BOOM times 100!!!
-// BOOM times 1!!!
-// Error: 1
diff --git a/tests/run-coverage/generics.rs b/tests/run-coverage/generics.rs
deleted file mode 100644
index bf4c2d8d6..000000000
--- a/tests/run-coverage/generics.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-#![allow(unused_assignments)]
-// failure-status: 1
-
-struct Firework<T> where T: Copy + std::fmt::Display {
- strength: T,
-}
-
-impl<T> Firework<T> where T: Copy + std::fmt::Display {
- #[inline(always)]
- fn set_strength(&mut self, new_strength: T) {
- self.strength = new_strength;
- }
-}
-
-impl<T> Drop for Firework<T> where T: Copy + std::fmt::Display {
- #[inline(always)]
- fn drop(&mut self) {
- println!("BOOM times {}!!!", self.strength);
- }
-}
-
-fn main() -> Result<(), u8> {
- let mut firecracker = Firework { strength: 1 };
- firecracker.set_strength(2);
-
- let mut tnt = Firework { strength: 100.1 };
- tnt.set_strength(200.1);
- tnt.set_strength(300.3);
-
- if true {
- println!("Exiting with error...");
- return Err(1);
- }
-
- let _ = Firework { strength: 1000 };
-
- Ok(())
-}
-
-// Expected program output:
-// Exiting with error...
-// BOOM times 100!!!
-// BOOM times 1!!!
-// Error: 1
diff --git a/tests/run-coverage/if.rs b/tests/run-coverage/if.rs
deleted file mode 100644
index 8ad5042ff..000000000
--- a/tests/run-coverage/if.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-#![allow(unused_assignments, unused_variables)]
-
-fn main() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let
- is_true
- =
- std::env::args().len()
- ==
- 1
- ;
- let
- mut
- countdown
- =
- 0
- ;
- if
- is_true
- {
- countdown
- =
- 10
- ;
- }
-}
diff --git a/tests/run-coverage/if_else.rs b/tests/run-coverage/if_else.rs
deleted file mode 100644
index 3244e1e3a..000000000
--- a/tests/run-coverage/if_else.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-#![allow(unused_assignments, unused_variables)]
-
-fn main() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
-
- let mut countdown = 0;
- if
- is_true
- {
- countdown
- =
- 10
- ;
- }
- else // Note coverage region difference without semicolon
- {
- countdown
- =
- 100
- }
-
- if
- is_true
- {
- countdown
- =
- 10
- ;
- }
- else
- {
- countdown
- =
- 100
- ;
- }
-}
diff --git a/tests/run-coverage/inline-dead.rs b/tests/run-coverage/inline-dead.rs
deleted file mode 100644
index 854fa0629..000000000
--- a/tests/run-coverage/inline-dead.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Regression test for issue #98833.
-// compile-flags: -Zinline-mir -Cdebug-assertions=off
-
-fn main() {
- println!("{}", live::<false>());
-
- let f = |x: bool| {
- debug_assert!(
- x
- );
- };
- f(false);
-}
-
-#[inline]
-fn live<const B: bool>() -> u32 {
- if B {
- dead()
- } else {
- 0
- }
-}
-
-#[inline]
-fn dead() -> u32 {
- 42
-}
diff --git a/tests/run-coverage/inline.rs b/tests/run-coverage/inline.rs
deleted file mode 100644
index 9cfab9ddb..000000000
--- a/tests/run-coverage/inline.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-// compile-flags: -Zinline-mir
-
-use std::fmt::Display;
-
-fn main() {
- permutations(&['a', 'b', 'c']);
-}
-
-#[inline(always)]
-fn permutations<T: Copy + Display>(xs: &[T]) {
- let mut ys = xs.to_owned();
- permutate(&mut ys, 0);
-}
-
-fn permutate<T: Copy + Display>(xs: &mut [T], k: usize) {
- let n = length(xs);
- if k == n {
- display(xs);
- } else if k < n {
- for i in k..n {
- swap(xs, i, k);
- permutate(xs, k + 1);
- swap(xs, i, k);
- }
- } else {
- error();
- }
-}
-
-fn length<T>(xs: &[T]) -> usize {
- xs.len()
-}
-
-#[inline]
-fn swap<T: Copy>(xs: &mut [T], i: usize, j: usize) {
- let t = xs[i];
- xs[i] = xs[j];
- xs[j] = t;
-}
-
-fn display<T: Display>(xs: &[T]) {
- for x in xs {
- print!("{}", x);
- }
- println!();
-}
-
-#[inline(always)]
-fn error() {
- panic!("error");
-}
diff --git a/tests/run-coverage/inner_items.rs b/tests/run-coverage/inner_items.rs
deleted file mode 100644
index bcb62b303..000000000
--- a/tests/run-coverage/inner_items.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-#![allow(unused_assignments, unused_variables, dead_code)]
-
-fn main() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
-
- let mut countdown = 0;
- if is_true {
- countdown = 10;
- }
-
- mod in_mod {
- const IN_MOD_CONST: u32 = 1000;
- }
-
- fn in_func(a: u32) {
- let b = 1;
- let c = a + b;
- println!("c = {}", c)
- }
-
- struct InStruct {
- in_struct_field: u32,
- }
-
- const IN_CONST: u32 = 1234;
-
- trait InTrait {
- fn trait_func(&mut self, incr: u32);
-
- fn default_trait_func(&mut self) {
- in_func(IN_CONST);
- self.trait_func(IN_CONST);
- }
- }
-
- impl InTrait for InStruct {
- fn trait_func(&mut self, incr: u32) {
- self.in_struct_field += incr;
- in_func(self.in_struct_field);
- }
- }
-
- type InType = String;
-
- if is_true {
- in_func(countdown);
- }
-
- let mut val = InStruct {
- in_struct_field: 101,
- };
-
- val.default_trait_func();
-}
diff --git a/tests/run-coverage/issue-83601.rs b/tests/run-coverage/issue-83601.rs
deleted file mode 100644
index 0b72a8194..000000000
--- a/tests/run-coverage/issue-83601.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Shows that rust-lang/rust/83601 is resolved
-
-#[derive(Debug, PartialEq, Eq)]
-struct Foo(u32);
-
-fn main() {
- let bar = Foo(1);
- assert_eq!(bar, Foo(1));
- let baz = Foo(0);
- assert_ne!(baz, Foo(1));
- println!("{:?}", Foo(1));
- println!("{:?}", bar);
- println!("{:?}", baz);
-}
diff --git a/tests/run-coverage/issue-84561.rs b/tests/run-coverage/issue-84561.rs
deleted file mode 100644
index facf5b5b4..000000000
--- a/tests/run-coverage/issue-84561.rs
+++ /dev/null
@@ -1,182 +0,0 @@
-// This demonstrated Issue #84561: function-like macros produce unintuitive coverage results.
-
-// failure-status: 101
-#[derive(PartialEq, Eq)]
-struct Foo(u32);
-fn test3() {
- let is_true = std::env::args().len() == 1;
- let bar = Foo(1);
- assert_eq!(bar, Foo(1));
- let baz = Foo(0);
- assert_ne!(baz, Foo(1));
- println!("{:?}", Foo(1));
- println!("{:?}", bar);
- println!("{:?}", baz);
-
- assert_eq!(Foo(1), Foo(1));
- assert_ne!(Foo(0), Foo(1));
- assert_eq!(Foo(2), Foo(2));
- let bar = Foo(0);
- assert_ne!(bar, Foo(3));
- assert_ne!(Foo(0), Foo(4));
- assert_eq!(Foo(3), Foo(3), "with a message");
- println!("{:?}", bar);
- println!("{:?}", Foo(1));
-
- assert_ne!(Foo(0), Foo(5), "{}", if is_true { "true message" } else { "false message" });
- assert_ne!(
- Foo(0)
- ,
- Foo(5)
- ,
- "{}"
- ,
- if
- is_true
- {
- "true message"
- } else {
- "false message"
- }
- );
-
- let is_true = std::env::args().len() == 1;
-
- assert_eq!(
- Foo(1),
- Foo(1)
- );
- assert_ne!(
- Foo(0),
- Foo(1)
- );
- assert_eq!(
- Foo(2),
- Foo(2)
- );
- let bar = Foo(1);
- assert_ne!(
- bar,
- Foo(3)
- );
- if is_true {
- assert_ne!(
- Foo(0),
- Foo(4)
- );
- } else {
- assert_eq!(
- Foo(3),
- Foo(3)
- );
- }
- if is_true {
- assert_ne!(
- Foo(0),
- Foo(4),
- "with a message"
- );
- } else {
- assert_eq!(
- Foo(3),
- Foo(3),
- "with a message"
- );
- }
- assert_ne!(
- if is_true {
- Foo(0)
- } else {
- Foo(1)
- },
- Foo(5)
- );
- assert_ne!(
- Foo(5),
- if is_true {
- Foo(0)
- } else {
- Foo(1)
- }
- );
- assert_ne!(
- if is_true {
- assert_eq!(
- Foo(3),
- Foo(3)
- );
- Foo(0)
- } else {
- assert_ne!(
- if is_true {
- Foo(0)
- } else {
- Foo(1)
- },
- Foo(5)
- );
- Foo(1)
- },
- Foo(5),
- "with a message"
- );
- assert_eq!(
- Foo(1),
- Foo(3),
- "this assert should fail"
- );
- assert_eq!(
- Foo(3),
- Foo(3),
- "this assert should not be reached"
- );
-}
-
-impl std::fmt::Debug for Foo {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- write!(f, "try and succeed")?;
- Ok(())
- }
-}
-
-static mut DEBUG_LEVEL_ENABLED: bool = false;
-
-macro_rules! debug {
- ($($arg:tt)+) => (
- if unsafe { DEBUG_LEVEL_ENABLED } {
- println!($($arg)+);
- }
- );
-}
-
-fn test1() {
- debug!("debug is enabled");
- debug!("debug is enabled");
- let _ = 0;
- debug!("debug is enabled");
- unsafe {
- DEBUG_LEVEL_ENABLED = true;
- }
- debug!("debug is enabled");
-}
-
-macro_rules! call_debug {
- ($($arg:tt)+) => (
- fn call_print(s: &str) {
- print!("{}", s);
- }
-
- call_print("called from call_debug: ");
- debug!($($arg)+);
- );
-}
-
-fn test2() {
- call_debug!("debug is enabled");
-}
-
-fn main() {
- test1();
- test2();
- test3();
-}
diff --git a/tests/run-coverage/issue-93054.rs b/tests/run-coverage/issue-93054.rs
deleted file mode 100644
index da546cfee..000000000
--- a/tests/run-coverage/issue-93054.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-#![allow(dead_code, unreachable_code)]
-
-// Regression test for #93054: Functions using uninhabited types often only have a single,
-// unreachable basic block which doesn't get instrumented. This should not cause llvm-cov to fail.
-// Since these kinds functions can't be invoked anyway, it's ok to not have coverage data for them.
-
-// compile-flags: --edition=2021
-
-enum Never {}
-
-impl Never {
- fn foo(self) {
- match self {}
- make().map(|never| match never {});
- }
-
- fn bar(&self) {
- match *self {}
- }
-}
-
-async fn foo2(never: Never) {
- match never {}
-}
-
-fn make() -> Option<Never> {
- None
-}
-
-fn main() {}
diff --git a/tests/run-coverage/lazy_boolean.rs b/tests/run-coverage/lazy_boolean.rs
deleted file mode 100644
index bb6219e85..000000000
--- a/tests/run-coverage/lazy_boolean.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-#![allow(unused_assignments, unused_variables)]
-
-fn main() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
-
- let (mut a, mut b, mut c) = (0, 0, 0);
- if is_true {
- a = 1;
- b = 10;
- c = 100;
- }
- let
- somebool
- =
- a < b
- ||
- b < c
- ;
- let
- somebool
- =
- b < a
- ||
- b < c
- ;
- let somebool = a < b && b < c;
- let somebool = b < a && b < c;
-
- if
- !
- is_true
- {
- a = 2
- ;
- }
-
- if
- is_true
- {
- b = 30
- ;
- }
- else
- {
- c = 400
- ;
- }
-
- if !is_true {
- a = 2;
- }
-
- if is_true {
- b = 30;
- } else {
- c = 400;
- }
-}
diff --git a/tests/run-coverage/loop_break_value.rs b/tests/run-coverage/loop_break_value.rs
deleted file mode 100644
index dbc4fad7a..000000000
--- a/tests/run-coverage/loop_break_value.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#![allow(unused_assignments, unused_variables)]
-
-fn main() {
- let result
- =
- loop
- {
- break
- 10
- ;
- }
- ;
-}
diff --git a/tests/run-coverage/loops_branches.rs b/tests/run-coverage/loops_branches.rs
deleted file mode 100644
index f3a343bcc..000000000
--- a/tests/run-coverage/loops_branches.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-#![allow(unused_assignments, unused_variables, while_true)]
-
-// This test confirms that (1) unexecuted infinite loops are handled correctly by the
-// InstrumentCoverage MIR pass; and (2) Counter Expressions that subtract from zero can be dropped.
-
-struct DebugTest;
-
-impl std::fmt::Debug for DebugTest {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- if true {
- if false {
- while true {}
- }
- write!(f, "cool")?;
- } else {
- }
-
- for i in 0..10 {
- if true {
- if false {
- while true {}
- }
- write!(f, "cool")?;
- } else {
- }
- }
- Ok(())
- }
-}
-
-struct DisplayTest;
-
-impl std::fmt::Display for DisplayTest {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- if false {
- } else {
- if false {
- while true {}
- }
- write!(f, "cool")?;
- }
- for i in 0..10 {
- if false {
- } else {
- if false {
- while true {}
- }
- write!(f, "cool")?;
- }
- }
- Ok(())
- }
-}
-
-fn main() {
- let debug_test = DebugTest;
- println!("{:?}", debug_test);
- let display_test = DisplayTest;
- println!("{}", display_test);
-}
diff --git a/tests/run-coverage/match_or_pattern.rs b/tests/run-coverage/match_or_pattern.rs
deleted file mode 100644
index ab7aee51d..000000000
--- a/tests/run-coverage/match_or_pattern.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-fn main() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
-
- let mut a: u8 = 0;
- let mut b: u8 = 0;
- if is_true {
- a = 2;
- b = 0;
- }
- match (a, b) {
- // Or patterns generate MIR `SwitchInt` with multiple targets to the same `BasicBlock`.
- // This test confirms a fix for Issue #79569.
- (0 | 1, 2 | 3) => {}
- _ => {}
- }
- if is_true {
- a = 0;
- b = 0;
- }
- match (a, b) {
- (0 | 1, 2 | 3) => {}
- _ => {}
- }
- if is_true {
- a = 2;
- b = 2;
- }
- match (a, b) {
- (0 | 1, 2 | 3) => {}
- _ => {}
- }
- if is_true {
- a = 0;
- b = 2;
- }
- match (a, b) {
- (0 | 1, 2 | 3) => {}
- _ => {}
- }
-}
diff --git a/tests/run-coverage/nested_loops.rs b/tests/run-coverage/nested_loops.rs
deleted file mode 100644
index 4c7c78427..000000000
--- a/tests/run-coverage/nested_loops.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-fn main() {
- let is_true = std::env::args().len() == 1;
- let mut countdown = 10;
-
- 'outer: while countdown > 0 {
- let mut a = 100;
- let mut b = 100;
- for _ in 0..50 {
- if a < 30 {
- break;
- }
- a -= 5;
- b -= 5;
- if b < 90 {
- a -= 10;
- if is_true {
- break 'outer;
- } else {
- a -= 2;
- }
- }
- }
- countdown -= 1;
- }
-}
diff --git a/tests/run-coverage/no_cov_crate.rs b/tests/run-coverage/no_cov_crate.rs
deleted file mode 100644
index e12e4bc55..000000000
--- a/tests/run-coverage/no_cov_crate.rs
+++ /dev/null
@@ -1,88 +0,0 @@
-// Enables `coverage(off)` on the entire crate
-#![feature(coverage_attribute)]
-
-#[coverage(off)]
-fn do_not_add_coverage_1() {
- println!("called but not covered");
-}
-
-fn do_not_add_coverage_2() {
- #![coverage(off)]
- println!("called but not covered");
-}
-
-#[coverage(off)]
-#[allow(dead_code)]
-fn do_not_add_coverage_not_called() {
- println!("not called and not covered");
-}
-
-fn add_coverage_1() {
- println!("called and covered");
-}
-
-fn add_coverage_2() {
- println!("called and covered");
-}
-
-#[allow(dead_code)]
-fn add_coverage_not_called() {
- println!("not called but covered");
-}
-
-// FIXME: These test-cases illustrate confusing results of nested functions.
-// See https://github.com/rust-lang/rust/issues/93319
-mod nested_fns {
- #[coverage(off)]
- pub fn outer_not_covered(is_true: bool) {
- fn inner(is_true: bool) {
- if is_true {
- println!("called and covered");
- } else {
- println!("absolutely not covered");
- }
- }
- println!("called but not covered");
- inner(is_true);
- }
-
- pub fn outer(is_true: bool) {
- println!("called and covered");
- inner_not_covered(is_true);
-
- #[coverage(off)]
- fn inner_not_covered(is_true: bool) {
- if is_true {
- println!("called but not covered");
- } else {
- println!("absolutely not covered");
- }
- }
- }
-
- pub fn outer_both_covered(is_true: bool) {
- println!("called and covered");
- inner(is_true);
-
- fn inner(is_true: bool) {
- if is_true {
- println!("called and covered");
- } else {
- println!("absolutely not covered");
- }
- }
- }
-}
-
-fn main() {
- let is_true = std::env::args().len() == 1;
-
- do_not_add_coverage_1();
- do_not_add_coverage_2();
- add_coverage_1();
- add_coverage_2();
-
- nested_fns::outer_not_covered(is_true);
- nested_fns::outer(is_true);
- nested_fns::outer_both_covered(is_true);
-}
diff --git a/tests/run-coverage/panic_unwind.rs b/tests/run-coverage/panic_unwind.rs
deleted file mode 100644
index 638d2eb6a..000000000
--- a/tests/run-coverage/panic_unwind.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-#![allow(unused_assignments)]
-// failure-status: 101
-
-fn might_panic(should_panic: bool) {
- if should_panic {
- println!("panicking...");
- panic!("panics");
- } else {
- println!("Don't Panic");
- }
-}
-
-fn main() -> Result<(), u8> {
- let mut countdown = 10;
- while countdown > 0 {
- if countdown == 1 {
- might_panic(true);
- } else if countdown < 5 {
- might_panic(false);
- }
- countdown -= 1;
- }
- Ok(())
-}
-
-// Notes:
-// 1. Compare this program and its coverage results to those of the similar tests `abort.rs` and
-// `try_error_result.rs`.
-// 2. Since the `panic_unwind.rs` test is allowed to unwind, it is also allowed to execute the
-// normal program exit cleanup, including writing out the current values of the coverage
-// counters.
diff --git a/tests/run-coverage/partial_eq.rs b/tests/run-coverage/partial_eq.rs
deleted file mode 100644
index dd8b42c18..000000000
--- a/tests/run-coverage/partial_eq.rs
+++ /dev/null
@@ -1,46 +0,0 @@
-// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the
-// structure of this test.
-
-#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
-pub struct Version {
- major: usize,
- minor: usize,
- patch: usize,
-}
-
-impl Version {
- pub fn new(major: usize, minor: usize, patch: usize) -> Self {
- Self {
- major,
- minor,
- patch,
- }
- }
-}
-
-fn main() {
- let version_3_2_1 = Version::new(3, 2, 1);
- let version_3_3_0 = Version::new(3, 3, 0);
-
- println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version_3_3_0);
-}
-
-/*
-
-This test verifies a bug was fixed that otherwise generated this error:
-
-thread 'rustc' panicked at 'No counters provided the source_hash for function:
- Instance {
- def: Item(WithOptConstParam {
- did: DefId(0:101 ~ autocfg[c44a]::version::{impl#2}::partial_cmp),
- const_param_did: None
- }),
- args: []
- }'
-The `PartialOrd` derived by `Version` happened to generate a MIR that generated coverage
-without a code region associated with any `Counter`. Code regions were associated with at least
-one expression, which is allowed, but the `function_source_hash` was only passed to the codegen
-(coverage mapgen) phase from a `Counter`s code region. A new method was added to pass the
-`function_source_hash` without a code region, if necessary.
-
-*/
diff --git a/tests/run-coverage/simple_loop.rs b/tests/run-coverage/simple_loop.rs
deleted file mode 100644
index 6f7f23475..000000000
--- a/tests/run-coverage/simple_loop.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-#![allow(unused_assignments)]
-
-fn main() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
-
- let mut countdown = 0;
-
- if
- is_true
- {
- countdown
- =
- 10
- ;
- }
-
- loop
- {
- if
- countdown
- ==
- 0
- {
- break
- ;
- }
- countdown
- -=
- 1
- ;
- }
-}
diff --git a/tests/run-coverage/simple_match.rs b/tests/run-coverage/simple_match.rs
deleted file mode 100644
index be99e59a8..000000000
--- a/tests/run-coverage/simple_match.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-#![allow(unused_assignments, unused_variables)]
-
-fn main() {
- // Initialize test constants in a way that cannot be determined at compile time, to ensure
- // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
- // dependent conditions.
- let is_true = std::env::args().len() == 1;
-
- let mut countdown = 1;
- if is_true {
- countdown = 0;
- }
-
- for
- _
- in
- 0..2
- {
- let z
- ;
- match
- countdown
- {
- x
- if
- x
- <
- 1
- =>
- {
- z = countdown
- ;
- let y = countdown
- ;
- countdown = 10
- ;
- }
- _
- =>
- {}
- }
- }
-}
diff --git a/tests/run-coverage/test_harness.rs b/tests/run-coverage/test_harness.rs
deleted file mode 100644
index 12a755734..000000000
--- a/tests/run-coverage/test_harness.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Verify that the entry point injected by the test harness doesn't cause
-// weird artifacts in the coverage report (e.g. issue #10749).
-
-// compile-flags: --test
-
-#[allow(dead_code)]
-fn unused() {}
-
-#[test]
-fn my_test() {}
diff --git a/tests/run-coverage/tight_inf_loop.rs b/tests/run-coverage/tight_inf_loop.rs
deleted file mode 100644
index cef99027a..000000000
--- a/tests/run-coverage/tight_inf_loop.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
- if false {
- loop {}
- }
-}
diff --git a/tests/run-coverage/try_error_result.rs b/tests/run-coverage/try_error_result.rs
deleted file mode 100644
index 557cbf22b..000000000
--- a/tests/run-coverage/try_error_result.rs
+++ /dev/null
@@ -1,118 +0,0 @@
-#![allow(unused_assignments)]
-// failure-status: 1
-
-fn call(return_error: bool) -> Result<(), ()> {
- if return_error {
- Err(())
- } else {
- Ok(())
- }
-}
-
-fn test1() -> Result<(), ()> {
- let mut
- countdown = 10
- ;
- for
- _
- in
- 0..10
- {
- countdown
- -= 1
- ;
- if
- countdown < 5
- {
- call(/*return_error=*/ true)?;
- call(/*return_error=*/ false)?;
- }
- else
- {
- call(/*return_error=*/ false)?;
- }
- }
- Ok(())
-}
-
-struct Thing1;
-impl Thing1 {
- fn get_thing_2(&self, return_error: bool) -> Result<Thing2, ()> {
- if return_error {
- Err(())
- } else {
- Ok(Thing2 {})
- }
- }
-}
-
-struct Thing2;
-impl Thing2 {
- fn call(&self, return_error: bool) -> Result<u32, ()> {
- if return_error {
- Err(())
- } else {
- Ok(57)
- }
- }
-}
-
-fn test2() -> Result<(), ()> {
- let thing1 = Thing1{};
- let mut
- countdown = 10
- ;
- for
- _
- in
- 0..10
- {
- countdown
- -= 1
- ;
- if
- countdown < 5
- {
- thing1.get_thing_2(/*err=*/ false)?.call(/*err=*/ true).expect_err("call should fail");
- thing1
- .
- get_thing_2(/*return_error=*/ false)
- ?
- .
- call(/*return_error=*/ true)
- .
- expect_err(
- "call should fail"
- );
- let val = thing1.get_thing_2(/*return_error=*/ true)?.call(/*return_error=*/ true)?;
- assert_eq!(val, 57);
- let val = thing1.get_thing_2(/*return_error=*/ true)?.call(/*return_error=*/ false)?;
- assert_eq!(val, 57);
- }
- else
- {
- let val = thing1.get_thing_2(/*return_error=*/ false)?.call(/*return_error=*/ false)?;
- assert_eq!(val, 57);
- let val = thing1
- .get_thing_2(/*return_error=*/ false)?
- .call(/*return_error=*/ false)?;
- assert_eq!(val, 57);
- let val = thing1
- .get_thing_2(/*return_error=*/ false)
- ?
- .call(/*return_error=*/ false)
- ?
- ;
- assert_eq!(val, 57);
- }
- }
- Ok(())
-}
-
-fn main() -> Result<(), ()> {
- test1().expect_err("test1 should fail");
- test2()
- ?
- ;
- Ok(())
-}
diff --git a/tests/run-coverage/unused.rs b/tests/run-coverage/unused.rs
deleted file mode 100644
index d985af135..000000000
--- a/tests/run-coverage/unused.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-#![allow(dead_code, unused_assignments, unused_must_use, unused_variables)]
-
-fn foo<T>(x: T) {
- let mut i = 0;
- while i < 10 {
- i != 0 || i != 0;
- i += 1;
- }
-}
-
-fn unused_template_func<T>(x: T) {
- let mut i = 0;
- while i < 10 {
- i != 0 || i != 0;
- i += 1;
- }
-}
-
-fn unused_func(mut a: u32) {
- if a != 0 {
- a += 1;
- }
-}
-
-fn unused_func2(mut a: u32) {
- if a != 0 {
- a += 1;
- }
-}
-
-fn unused_func3(mut a: u32) {
- if a != 0 {
- a += 1;
- }
-}
-
-fn main() -> Result<(), u8> {
- foo::<u32>(0);
- foo::<f32>(0.0);
- Ok(())
-}
diff --git a/tests/run-coverage/while.rs b/tests/run-coverage/while.rs
deleted file mode 100644
index 781b90b35..000000000
--- a/tests/run-coverage/while.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
- let num = 9;
- while num >= 10 {
- }
-}
diff --git a/tests/run-coverage/while_early_ret.rs b/tests/run-coverage/while_early_ret.rs
deleted file mode 100644
index b2f0eee2c..000000000
--- a/tests/run-coverage/while_early_ret.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-#![allow(unused_assignments)]
-// failure-status: 1
-
-fn main() -> Result<(), u8> {
- let mut countdown = 10;
- while
- countdown
- >
- 0
- {
- if
- countdown
- <
- 5
- {
- return
- if
- countdown
- >
- 8
- {
- Ok(())
- }
- else
- {
- Err(1)
- }
- ;
- }
- countdown
- -=
- 1
- ;
- }
- Ok(())
-}
-
-// ISSUE(77553): Originally, this test had `Err(1)` on line 22 (instead of `Ok(())`) and
-// `std::process::exit(2)` on line 26 (instead of `Err(1)`); and this worked as expected on Linux
-// and MacOS. But on Windows (MSVC, at least), the call to `std::process::exit()` exits the program
-// without saving the InstrProf coverage counters. The use of `std::process:exit()` is not critical
-// to the coverage test for early returns, but this is a limitation that should be fixed.
diff --git a/tests/run-coverage/yield.rs b/tests/run-coverage/yield.rs
deleted file mode 100644
index 361275c92..000000000
--- a/tests/run-coverage/yield.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#![feature(generators, generator_trait)]
-#![allow(unused_assignments)]
-
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
-
-fn main() {
- let mut generator = || {
- yield 1;
- return "foo";
- };
-
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Yielded(1) => {}
- _ => panic!("unexpected value from resume"),
- }
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Complete("foo") => {}
- _ => panic!("unexpected value from resume"),
- }
-
- let mut generator = || {
- yield 1;
- yield 2;
- yield 3;
- return "foo";
- };
-
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Yielded(1) => {}
- _ => panic!("unexpected value from resume"),
- }
- match Pin::new(&mut generator).resume(()) {
- GeneratorState::Yielded(2) => {}
- _ => panic!("unexpected value from resume"),
- }
-}
diff --git a/tests/run-make-fulldeps/issue-19371/foo.rs b/tests/run-make-fulldeps/issue-19371/foo.rs
index 1c9d33dcc..1a9464916 100644
--- a/tests/run-make-fulldeps/issue-19371/foo.rs
+++ b/tests/run-make-fulldeps/issue-19371/foo.rs
@@ -7,7 +7,7 @@ extern crate rustc_span;
use rustc_interface::interface;
use rustc_session::config::{Input, Options, OutFileName, OutputType, OutputTypes};
-use rustc_span::source_map::FileName;
+use rustc_span::FileName;
use std::path::PathBuf;
@@ -57,10 +57,12 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
locale_resources: &[],
lint_caps: Default::default(),
parse_sess_created: None,
+ hash_untracked_state: None,
register_lints: None,
override_queries: None,
make_codegen_backend: None,
registry: rustc_driver::diagnostics_registry(),
+ using_internal_features: std::sync::Arc::default(),
expanded_args: Default::default(),
};
diff --git a/tests/run-make/const_fn_mir/Makefile b/tests/run-make/const_fn_mir/Makefile
index 6d72c1227..339944613 100644
--- a/tests/run-make/const_fn_mir/Makefile
+++ b/tests/run-make/const_fn_mir/Makefile
@@ -3,9 +3,4 @@ include ../tools.mk
all:
$(RUSTC) main.rs --emit=mir -o "$(TMPDIR)"/dump.mir
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/dump.mir dump.mir
-else
- $(DIFF) dump.mir "$(TMPDIR)"/dump.mir
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/dump.mir dump.mir
diff --git a/tests/run-make/coverage-llvmir/filecheck.testprog.txt b/tests/run-make/coverage-llvmir/filecheck.testprog.txt
index 9d63fabd7..8ab18da21 100644
--- a/tests/run-make/coverage-llvmir/filecheck.testprog.txt
+++ b/tests/run-make/coverage-llvmir/filecheck.testprog.txt
@@ -3,12 +3,12 @@
WINDOWS: $__llvm_profile_runtime_user = comdat any
-CHECK: @__covrec_{{[A-F0-9]+}}u = linkonce_odr hidden constant
-CHECK-SAME: section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8
-
CHECK: @__llvm_coverage_mapping = private constant
CHECK-SAME: section "[[INSTR_PROF_COVMAP]]", align 8
+CHECK: @__covrec_{{[A-F0-9]+}}u = linkonce_odr hidden constant
+CHECK-SAME: section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8
+
WINDOWS: @__llvm_profile_runtime = external{{.*}}global i32
CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|internal}} global
diff --git a/tests/run-make/crate-hash-rustc-version/Makefile b/tests/run-make/crate-hash-rustc-version/Makefile
index f1d2a3604..6bf504bf0 100644
--- a/tests/run-make/crate-hash-rustc-version/Makefile
+++ b/tests/run-make/crate-hash-rustc-version/Makefile
@@ -4,7 +4,7 @@ include ../tools.mk
# Ensure that crates compiled with different rustc versions cannot
# be dynamically linked.
-FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0
+FLAGS := -Cprefer-dynamic -Csymbol-mangling-version=v0
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
EXT=".so"
diff --git a/tests/run-make/dump-ice-to-disk/check.sh b/tests/run-make/dump-ice-to-disk/check.sh
index ab6f9ab60..ff6e4be35 100644
--- a/tests/run-make/dump-ice-to-disk/check.sh
+++ b/tests/run-make/dump-ice-to-disk/check.sh
@@ -11,6 +11,12 @@ export RUSTC_ICE=$TMPDIR
$RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-default-set.log 2>&1
default_set=$(cat $TMPDIR/rustc-ice-*.txt | wc -l)
content=$(cat $TMPDIR/rustc-ice-*.txt)
+# Ensure that the ICE dump path doesn't contain `:` because they cause problems on Windows
+windows_safe=$(echo rustc-ice-*.txt | grep ':')
+if [ ! -z "$windows_safe" ]; then
+ exit 1
+fi
+
rm $TMPDIR/rustc-ice-*.txt
RUST_BACKTRACE=short $RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-short.log 2>&1
short=$(cat $TMPDIR/rustc-ice-*.txt | wc -l)
diff --git a/tests/run-make/emit-stack-sizes/foo.rs b/tests/run-make/emit-stack-sizes/foo.rs
index ee51ae328..fd0b51205 100644
--- a/tests/run-make/emit-stack-sizes/foo.rs
+++ b/tests/run-make/emit-stack-sizes/foo.rs
@@ -1,3 +1,4 @@
#![crate_type = "lib"]
+#[inline(never)]
pub fn foo() {}
diff --git a/tests/run-make/intrinsic-unreachable/exit-ret.rs b/tests/run-make/intrinsic-unreachable/exit-ret.rs
index e7b9694d9..c8ba5b459 100644
--- a/tests/run-make/intrinsic-unreachable/exit-ret.rs
+++ b/tests/run-make/intrinsic-unreachable/exit-ret.rs
@@ -2,6 +2,7 @@
use std::arch::asm;
#[deny(unreachable_code)]
+#[inline(never)]
pub fn exit(n: usize) -> i32 {
unsafe {
// Pretend this asm is an exit() syscall.
diff --git a/tests/run-make/intrinsic-unreachable/exit-unreachable.rs b/tests/run-make/intrinsic-unreachable/exit-unreachable.rs
index ec85db733..75f893eb2 100644
--- a/tests/run-make/intrinsic-unreachable/exit-unreachable.rs
+++ b/tests/run-make/intrinsic-unreachable/exit-unreachable.rs
@@ -5,6 +5,7 @@ use std::arch::asm;
use std::intrinsics;
#[allow(unreachable_code)]
+#[inline(never)]
pub fn exit(n: usize) -> i32 {
unsafe {
// Pretend this asm is an exit() syscall.
diff --git a/tests/run-make/issue-71519/Makefile b/tests/run-make/issue-71519/Makefile
deleted file mode 100644
index 0ee83328b..000000000
--- a/tests/run-make/issue-71519/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-include ../tools.mk
-
-# ignore-msvc
-# needs-rust-lld
-# ignore-s390x lld does not yet support s390x as target
-all:
- RUSTC_LOG=rustc_codegen_ssa::back::link=info $(RUSTC) -Z gcc-ld=lld -C link-args=-Wl,-v main.rs 2> $(TMPDIR)/output.txt
- $(CGREP) -e "^LLD [0-9]+\.[0-9]+\.[0-9]+" < $(TMPDIR)/output.txt
diff --git a/tests/run-make/issue-71519/main.rs b/tests/run-make/issue-71519/main.rs
deleted file mode 100644
index f8d09e897..000000000
--- a/tests/run-make/issue-71519/main.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-// test linking using cc with rust-lld injected into search path as ld
-// see rust-lang/rust#71519 for more info
-
-fn main() {}
diff --git a/tests/run-make/issue-96498/Makefile b/tests/run-make/issue-96498/Makefile
deleted file mode 100644
index efdd328c6..000000000
--- a/tests/run-make/issue-96498/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# only-windows
-# needs-rust-lld
-
-include ../tools.mk
-
-# Ensure that LLD can link
-all:
- $(RUSTC) -C linker=rust-lld foo.rs
diff --git a/tests/run-make/metadata-dep-info/Makefile b/tests/run-make/metadata-dep-info/Makefile
index f9043f214..d48cbe0f2 100644
--- a/tests/run-make/metadata-dep-info/Makefile
+++ b/tests/run-make/metadata-dep-info/Makefile
@@ -1,11 +1,5 @@
include ../tools.mk
-ifdef RUSTC_BLESS_TEST
- RUSTC_TEST_OP = cp
-else
- RUSTC_TEST_OP = $(DIFF)
-endif
-
all:
$(RUSTC) --emit=metadata,dep-info --crate-type lib dash-separated.rs -C extra-filename=_something-extra
# Strip TMPDIR since it is a machine specific absolute path
diff --git a/tests/run-make/overwrite-input/Makefile b/tests/run-make/overwrite-input/Makefile
index c62b5aab1..721bf62b2 100644
--- a/tests/run-make/overwrite-input/Makefile
+++ b/tests/run-make/overwrite-input/Makefile
@@ -3,11 +3,5 @@ include ../tools.mk
all:
$(RUSTC) main.rs -o main.rs 2> $(TMPDIR)/file.stderr || echo "failed successfully"
$(RUSTC) main.rs -o . 2> $(TMPDIR)/folder.stderr || echo "failed successfully"
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/file.stderr file.stderr
- cp "$(TMPDIR)"/folder.stderr folder.stderr
-else
- $(DIFF) file.stderr "$(TMPDIR)"/file.stderr
- $(DIFF) folder.stderr "$(TMPDIR)"/folder.stderr
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/file.stderr file.stderr
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/folder.stderr folder.stderr
diff --git a/tests/run-make/raw-dylib-alt-calling-convention/Makefile b/tests/run-make/raw-dylib-alt-calling-convention/Makefile
index 1744c431f..14d23a5d2 100644
--- a/tests/run-make/raw-dylib-alt-calling-convention/Makefile
+++ b/tests/run-make/raw-dylib-alt-calling-convention/Makefile
@@ -16,17 +16,9 @@ else
endif
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.txt output.txt
-else
- $(DIFF) output.txt "$(TMPDIR)"/output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
ifdef IS_MSVC
"$(TMPDIR)"/driver true > "$(TMPDIR)"/output.msvc.txt
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.msvc.txt output.msvc.txt
-else
- $(DIFF) output.msvc.txt "$(TMPDIR)"/output.msvc.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.msvc.txt output.msvc.txt
endif
diff --git a/tests/run-make/raw-dylib-import-name-type/Makefile b/tests/run-make/raw-dylib-import-name-type/Makefile
index 671523298..901d3e861 100644
--- a/tests/run-make/raw-dylib-import-name-type/Makefile
+++ b/tests/run-make/raw-dylib-import-name-type/Makefile
@@ -14,9 +14,4 @@ else
$(CC) "$(TMPDIR)"/extern.obj extern.gnu.def --no-leading-underscore -shared -o "$(TMPDIR)"/extern.dll
endif
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.txt output.txt
-else
- $(DIFF) output.txt "$(TMPDIR)"/output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
diff --git a/tests/run-make/raw-dylib-inline-cross-dylib/Makefile b/tests/run-make/raw-dylib-inline-cross-dylib/Makefile
index 6d1d04bfd..195b5fda5 100644
--- a/tests/run-make/raw-dylib-inline-cross-dylib/Makefile
+++ b/tests/run-make/raw-dylib-inline-cross-dylib/Makefile
@@ -27,9 +27,4 @@ else
$(CC) "$(TMPDIR)"/extern_2.obj -shared -o "$(TMPDIR)"/extern_2.dll
endif
$(call RUN,driver) > "$(TMPDIR)"/output.txt
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.txt output.txt
-else
- $(DIFF) output.txt "$(TMPDIR)"/output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
diff --git a/tests/run-make/raw-dylib-link-ordinal/Makefile b/tests/run-make/raw-dylib-link-ordinal/Makefile
index 374a0b59d..49e959cdb 100644
--- a/tests/run-make/raw-dylib-link-ordinal/Makefile
+++ b/tests/run-make/raw-dylib-link-ordinal/Makefile
@@ -14,9 +14,4 @@ else
$(CC) "$(TMPDIR)"/exporter.obj exporter.def -shared -o "$(TMPDIR)"/exporter.dll
endif
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.txt output.txt
-else
- $(DIFF) output.txt "$(TMPDIR)"/output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
diff --git a/tests/run-make/raw-dylib-stdcall-ordinal/Makefile b/tests/run-make/raw-dylib-stdcall-ordinal/Makefile
index 178c15ab3..70e4de62c 100644
--- a/tests/run-make/raw-dylib-stdcall-ordinal/Makefile
+++ b/tests/run-make/raw-dylib-stdcall-ordinal/Makefile
@@ -15,9 +15,4 @@ else
$(CC) "$(TMPDIR)"/exporter.obj exporter-gnu.def -shared -o "$(TMPDIR)"/exporter.dll
endif
"$(TMPDIR)"/driver > "$(TMPDIR)"/actual_output.txt
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/actual_output.txt expected_output.txt
-else
- $(DIFF) expected_output.txt "$(TMPDIR)"/actual_output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/actual_output.txt expected_output.txt
diff --git a/tests/run-make/remap-path-prefix-dwarf/Makefile b/tests/run-make/remap-path-prefix-dwarf/Makefile
index c9ede1b60..8905a00ea 100644
--- a/tests/run-make/remap-path-prefix-dwarf/Makefile
+++ b/tests/run-make/remap-path-prefix-dwarf/Makefile
@@ -3,17 +3,26 @@
# ignore-windows
+include ../tools.mk
+
SRC_DIR := $(abspath .)
SRC_DIR_PARENT := $(abspath ..)
-include ../tools.mk
+ifeq ($(UNAME),Darwin)
+ DEBUGINFOOPTS := -Csplit-debuginfo=off
+else
+ DEBUGINFOOPTS :=
+endif
all: \
abs_input_outside_working_dir \
rel_input_remap_working_dir \
+ rel_input_remap_working_dir_scope \
rel_input_remap_working_dir_parent \
rel_input_remap_working_dir_child \
+ rel_input_remap_working_dir_diagnostics \
abs_input_inside_working_dir \
+ abs_input_inside_working_dir_scope \
abs_input_outside_working_dir
# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within
@@ -27,6 +36,17 @@ abs_input_inside_working_dir:
# No weird duplication of remapped components (see #78479)
"$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir.rlib | $(CGREP) -v "REMAPPED/REMAPPED"
+# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within
+# the working directory of the compiler. We are remapping the path that contains `src`.
+abs_input_inside_working_dir_scope:
+ # We explicitly switch to a directory that *is* a prefix of the directory our
+ # source code is contained in.
+ cd $(SRC_DIR) && $(RUSTC) $(SRC_DIR)/src/quux.rs -o "$(TMPDIR)/abs_input_inside_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix $(SRC_DIR)=REMAPPED -Zremap-path-scope=object $(DEBUGINFOOPTS)
+ # We expect the path to the main source file to be remapped.
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir_scope.rlib | $(CGREP) "REMAPPED/src/quux.rs"
+ # No weird duplication of remapped components (see #78479)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir_scope.rlib | $(CGREP) -v "REMAPPED/REMAPPED"
+
# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path is *not* within
# the working directory of the compiler. We are remapping both the path that contains `src` and
# the working directory to the same thing. This setup corresponds to a workaround that is needed
@@ -52,6 +72,21 @@ rel_input_remap_working_dir:
# No weird duplication of remapped components (see #78479)
"$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir.rlib" | $(CGREP) -v "REMAPPED/REMAPPED"
+# The compiler is called with a *RELATIVE PATH* as input. We are remapping the working directory of
+# the compiler, which naturally is an implicit prefix of our relative input path. Debuginfo will
+# expand the relative path to an absolute path and we expect the working directory to be remapped
+# in that expansion.
+rel_input_remap_working_dir_scope:
+ cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)=REMAPPED" -Zremap-path-scope=object $(DEBUGINFOOPTS)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) "REMAPPED/src/quux.rs"
+ # No weird duplication of remapped components (see #78479)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/REMAPPED"
+
+rel_input_remap_working_dir_diagnostics:
+ cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)=REMAPPED" -Zremap-path-scope=diagnostics $(DEBUGINFOOPTS)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/src/quux.rs"
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/REMAPPED"
+
# The compiler is called with a *RELATIVE PATH* as input. We are remapping a *SUB-DIRECTORY* of the
# compiler's working directory. This test makes sure that that directory is remapped even though it
# won't actually show up in this form in the compiler's SourceMap and instead is only constructed
diff --git a/tests/run-make/remap-path-prefix/Makefile b/tests/run-make/remap-path-prefix/Makefile
index 2a7378fdf..35f65240f 100644
--- a/tests/run-make/remap-path-prefix/Makefile
+++ b/tests/run-make/remap-path-prefix/Makefile
@@ -2,8 +2,38 @@ include ../tools.mk
# ignore-windows
+ifeq ($(UNAME),Darwin)
+ DEBUGINFOOPTS := -Csplit-debuginfo=off
+else
+ DEBUGINFOOPTS :=
+endif
+
+all: remap remap-with-scope
+
# Checks if remapping works if the remap-from string contains path to the working directory plus more
-all:
+remap:
$(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux --crate-type=lib --emit=metadata auxiliary/lib.rs
grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+remap-with-scope:
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=object $(DEBUGINFOOPTS) --crate-type=lib --emit=metadata auxiliary/lib.rs
+ grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=diagnostics $(DEBUGINFOOPTS) --crate-type=lib --emit=metadata auxiliary/lib.rs
+ ! grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=diagnostics,object $(DEBUGINFOOPTS) --crate-type=lib --emit=metadata auxiliary/lib.rs
+ grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=split-debuginfo $(DEBUGINFOOPTS) --crate-type=lib --emit=metadata auxiliary/lib.rs
+ ! grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+ # FIXME: We should test the split debuginfo files, but we don't currently a good infra for that
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=split-debuginfo -Zunstable-options -Csplit-debuginfo=packed --crate-type=lib --emit=metadata auxiliary/lib.rs
+ grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
diff --git a/tests/run-make/rust-lld-custom-target/Makefile b/tests/run-make/rust-lld-custom-target/Makefile
new file mode 100644
index 000000000..007493ab0
--- /dev/null
+++ b/tests/run-make/rust-lld-custom-target/Makefile
@@ -0,0 +1,7 @@
+include ../tools.mk
+
+# needs-rust-lld
+# only-x86_64-unknown-linux-gnu
+all:
+ RUSTC_LOG=rustc_codegen_ssa::back::link=info $(RUSTC) --crate-type cdylib --target custom-target.json -Clink-args=-Wl,-v lib.rs 2> $(TMPDIR)/output.txt
+ $(CGREP) -e "^LLD [0-9]+\.[0-9]+\.[0-9]+" < $(TMPDIR)/output.txt
diff --git a/tests/run-make/rust-lld-custom-target/custom-target.json b/tests/run-make/rust-lld-custom-target/custom-target.json
new file mode 100644
index 000000000..7828a99f2
--- /dev/null
+++ b/tests/run-make/rust-lld-custom-target/custom-target.json
@@ -0,0 +1,57 @@
+{
+ "arch": "x86_64",
+ "cpu": "x86-64",
+ "crt-static-respected": true,
+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
+ "dynamic-linking": true,
+ "env": "gnu",
+ "has-rpath": true,
+ "has-thread-local": true,
+ "link-self-contained": {
+ "components": [
+ "linker"
+ ]
+ },
+ "linker-flavor": "gnu-lld-cc",
+ "llvm-target": "x86_64-unknown-linux-gnu",
+ "max-atomic-width": 64,
+ "os": "linux",
+ "plt-by-default": false,
+ "position-independent-executables": true,
+ "pre-link-args": {
+ "gnu-cc": [
+ "-m64"
+ ],
+ "gnu-lld-cc": [
+ "-m64"
+ ]
+ },
+ "relro-level": "full",
+ "stack-probes": {
+ "kind": "inline-or-call",
+ "min-llvm-version-for-inline": [
+ 16,
+ 0,
+ 0
+ ]
+ },
+ "static-position-independent-executables": true,
+ "supported-sanitizers": [
+ "address",
+ "cfi",
+ "leak",
+ "memory",
+ "thread",
+ "safestack"
+ ],
+ "supported-split-debuginfo": [
+ "packed",
+ "unpacked",
+ "off"
+ ],
+ "supports-xray": true,
+ "target-family": [
+ "unix"
+ ],
+ "target-pointer-width": "64"
+}
diff --git a/tests/run-make/rust-lld-custom-target/lib.rs b/tests/run-make/rust-lld-custom-target/lib.rs
new file mode 100644
index 000000000..d8f5e3108
--- /dev/null
+++ b/tests/run-make/rust-lld-custom-target/lib.rs
@@ -0,0 +1,9 @@
+// Test linking using `cc` with `rust-lld`, using a custom target with features described in MCP 510
+// see https://github.com/rust-lang/compiler-team/issues/510 for more info:
+//
+// Starting from the `x86_64-unknown-linux-gnu` target spec, we add the following options:
+// - a linker-flavor using lld via a C compiler
+// - the self-contained linker component is enabled
+
+#![feature(no_core)]
+#![no_core]
diff --git a/tests/run-make/silly-file-names/Makefile b/tests/run-make/silly-file-names/Makefile
new file mode 100644
index 000000000..e51266c08
--- /dev/null
+++ b/tests/run-make/silly-file-names/Makefile
@@ -0,0 +1,12 @@
+# ignore-cross-compile we need to execute the binary
+# ignore-windows we create files with < and > in their names
+
+include ../tools.mk
+
+all:
+ echo '"comes from a file with a name that begins with <"' > "$(TMPDIR)/<leading-lt"
+ echo '"comes from a file with a name that ends with >"' > "$(TMPDIR)/trailing-gt>"
+ cp silly-file-names.rs "$(TMPDIR)/silly-file-names.rs"
+ $(RUSTC) "$(TMPDIR)/silly-file-names.rs" -o "$(TMPDIR)/silly-file-names"
+ "$(TMPDIR)/silly-file-names" > "$(TMPDIR)/silly-file-names.run.stdout"
+ $(RUSTC_TEST_OP) "$(TMPDIR)/silly-file-names.run.stdout" silly-file-names.run.stdout
diff --git a/tests/run-make/silly-file-names/silly-file-names.rs b/tests/run-make/silly-file-names/silly-file-names.rs
new file mode 100644
index 000000000..a20082091
--- /dev/null
+++ b/tests/run-make/silly-file-names/silly-file-names.rs
@@ -0,0 +1,4 @@
+fn main() {
+ println!(include!("<leading-lt"));
+ println!(include!("trailing-gt>"));
+}
diff --git a/tests/run-make/silly-file-names/silly-file-names.run.stdout b/tests/run-make/silly-file-names/silly-file-names.run.stdout
new file mode 100644
index 000000000..fbc4c89e0
--- /dev/null
+++ b/tests/run-make/silly-file-names/silly-file-names.run.stdout
@@ -0,0 +1,2 @@
+comes from a file with a name that begins with <
+comes from a file with a name that ends with >
diff --git a/tests/run-make/split-debuginfo/Makefile b/tests/run-make/split-debuginfo/Makefile
index 71e014c1f..9e05c8dc1 100644
--- a/tests/run-make/split-debuginfo/Makefile
+++ b/tests/run-make/split-debuginfo/Makefile
@@ -104,7 +104,7 @@ packed-lto-single:
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
rm $(TMPDIR)/libbaz.rlib
-packed-remapped: packed-remapped-split packed-remapped-single
+packed-remapped: packed-remapped-split packed-remapped-single packed-remapped-scope packed-remapped-wrong-scope
# - Debuginfo in `.dwo` files
# - `.o` and binary refer to remapped `.dwo` paths which do not exist
@@ -134,6 +134,36 @@ packed-remapped-single:
rm $(TMPDIR)/foo.dwp
rm $(TMPDIR)/$(call BIN,foo)
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` deleted
+# - `.dwo` never created
+# - `.dwp` present
+packed-remapped-scope:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
+ -Z remap-path-scope=split-debuginfo-path foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/foo.dwp
+ rm $(TMPDIR)/$(call BIN,foo)
+
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` deleted
+# - `.dwo` never created
+# - `.dwp` present
+packed-remapped-wrong-scope:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
+ -Z remap-path-scope=macro foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/foo.dwp
+ rm $(TMPDIR)/$(call BIN,foo)
+
packed-crosscrate: packed-crosscrate-split packed-crosscrate-single
# - Debuginfo in `.dwo` files
@@ -230,7 +260,7 @@ unpacked-lto-single:
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
rm $(TMPDIR)/libbaz.rlib
-unpacked-remapped: unpacked-remapped-split unpacked-remapped-single
+unpacked-remapped: unpacked-remapped-split unpacked-remapped-single unpacked-remapped-scope unpacked-remapped-wrong-scope
# - Debuginfo in `.dwo` files
# - `.o` and binary refer to remapped `.dwo` paths which do not exist
@@ -260,6 +290,36 @@ unpacked-remapped-single:
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
rm $(TMPDIR)/$(call BIN,foo)
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` present
+# - `.dwo` never created
+# - `.dwp` never created
+unpacked-remapped-scope:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
+ -Z remap-path-scope=split-debuginfo-path foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
+ rm $(TMPDIR)/*.o
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,foo)
+
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` present
+# - `.dwo` never created
+# - `.dwp` never created
+unpacked-remapped-wrong-scope:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
+ -Z remap-path-scope=macro foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1
+ rm $(TMPDIR)/*.o
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,foo)
+
unpacked-crosscrate: unpacked-crosscrate-split unpacked-crosscrate-single
# - Debuginfo in `.dwo` files
diff --git a/tests/run-make/tools.mk b/tests/run-make/tools.mk
index 6121a91e9..1d4e91113 100644
--- a/tests/run-make/tools.mk
+++ b/tests/run-make/tools.mk
@@ -21,6 +21,28 @@ CGREP := "$(S)/src/etc/cat-and-grep.sh"
# diff with common flags for multi-platform diffs against text output
DIFF := diff -u --strip-trailing-cr
+# With RUSTC_TEST_OP you can elegantly support blessing of run-make tests. Do
+# like this in a Makefile recipe:
+#
+# "$(TMPDIR)"/your-test > "$(TMPDIR)"/your-test.run.stdout
+# $(RUSTC_TEST_OP) "$(TMPDIR)"/your-test.run.stdout your-test.run.stdout
+#
+# When running the test normally with
+#
+# ./x test tests/run-make/your-test
+#
+# the actual output will be diffed against the expected output. When running in
+# bless-mode with
+#
+# ./x test --bless tests/run-make/your-test
+#
+# the actual output will be blessed as the expected output.
+ifdef RUSTC_BLESS_TEST
+ RUSTC_TEST_OP = cp
+else
+ RUSTC_TEST_OP = $(DIFF)
+endif
+
# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in
# Makefiles. Other platforms, including many developer platforms, default to
# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh`
diff --git a/tests/run-make/unknown-mod-stdin/Makefile b/tests/run-make/unknown-mod-stdin/Makefile
index c19317653..313b0ba83 100644
--- a/tests/run-make/unknown-mod-stdin/Makefile
+++ b/tests/run-make/unknown-mod-stdin/Makefile
@@ -4,12 +4,5 @@ include ../tools.mk
all:
echo 'mod unknown;' | $(RUSTC) --crate-type rlib - >$(TMPDIR)/unknown-mod.stdout 2>$(TMPDIR)/unknown-mod.stderr || echo "failed successfully"
-
-# Bless like this: RUSTC_BLESS_TEST=1 ./x.py test tests/run-make/unknown-mod-stdin
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/unknown-mod.stdout unknown-mod.stdout
- cp "$(TMPDIR)"/unknown-mod.stderr unknown-mod.stderr
-else
- $(DIFF) unknown-mod.stdout "$(TMPDIR)"/unknown-mod.stdout
- $(DIFF) unknown-mod.stderr "$(TMPDIR)"/unknown-mod.stderr
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/unknown-mod.stdout unknown-mod.stdout
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/unknown-mod.stderr unknown-mod.stderr
diff --git a/tests/run-make/unknown-mod-stdin/unknown-mod.stderr b/tests/run-make/unknown-mod-stdin/unknown-mod.stderr
index d7258fe4f..81ff83938 100644
--- a/tests/run-make/unknown-mod-stdin/unknown-mod.stderr
+++ b/tests/run-make/unknown-mod-stdin/unknown-mod.stderr
@@ -5,6 +5,7 @@ error[E0583]: file not found for module `unknown`
| ^^^^^^^^^^^^
|
= help: to create the module `unknown`, create file "unknown.rs" or "unknown/mod.rs"
+ = note: if there is a `mod unknown` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/run-make/use-extern-for-plugins/Makefile b/tests/run-make/use-extern-for-plugins/Makefile
deleted file mode 100644
index b8ec7e8dc..000000000
--- a/tests/run-make/use-extern-for-plugins/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-include ../tools.mk
-
-# ignore-freebsd
-# ignore-openbsd
-# ignore-solaris
-
-HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //')
-ifeq ($(findstring i686,$(HOST)),i686)
-TARGET := $(subst i686,x86_64,$(HOST))
-else
-TARGET := $(subst x86_64,i686,$(HOST))
-endif
-
-all:
- $(RUSTC) foo.rs -C extra-filename=-host
- $(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET)
- $(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET)
diff --git a/tests/run-make/use-extern-for-plugins/bar.rs b/tests/run-make/use-extern-for-plugins/bar.rs
deleted file mode 100644
index 704d21203..000000000
--- a/tests/run-make/use-extern-for-plugins/bar.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-#![feature(no_core)]
-#![no_core]
-#![crate_type = "lib"]
-#![crate_name = "a"]
-
-#[macro_export]
-macro_rules! bar {
- () => ()
-}
diff --git a/tests/run-make/use-extern-for-plugins/baz.rs b/tests/run-make/use-extern-for-plugins/baz.rs
deleted file mode 100644
index 49a96a0c8..000000000
--- a/tests/run-make/use-extern-for-plugins/baz.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#![feature(no_core)]
-#![no_core]
-#![crate_type = "lib"]
-
-#[macro_use]
-extern crate a;
-
-bar!();
diff --git a/tests/run-make/use-extern-for-plugins/foo.rs b/tests/run-make/use-extern-for-plugins/foo.rs
deleted file mode 100644
index dffdc0798..000000000
--- a/tests/run-make/use-extern-for-plugins/foo.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#![no_std]
-#![crate_type = "lib"]
-#![crate_name = "a"]
-
-#[macro_export]
-macro_rules! foo {
- () => ()
-}
diff --git a/tests/run-make/wasm-override-linker/Makefile b/tests/run-make/wasm-override-linker/Makefile
new file mode 100644
index 000000000..52339f926
--- /dev/null
+++ b/tests/run-make/wasm-override-linker/Makefile
@@ -0,0 +1,13 @@
+# needs-matching-clang
+
+include ../tools.mk
+
+ifeq ($(TARGET),wasm32-unknown-unknown)
+all:
+ $(RUSTC) foo.rs --crate-type cdylib --target $(TARGET) -C linker=$(CLANG)
+else ifeq ($(TARGET),wasm64-unknown-unknown)
+all:
+ $(RUSTC) foo.rs --crate-type cdylib --target $(TARGET) -C linker=$(CLANG)
+else
+all:
+endif
diff --git a/tests/run-make/wasm-override-linker/foo.rs b/tests/run-make/wasm-override-linker/foo.rs
new file mode 100644
index 000000000..f4167a4fc
--- /dev/null
+++ b/tests/run-make/wasm-override-linker/foo.rs
@@ -0,0 +1,6 @@
+#![crate_type = "cdylib"]
+
+#[no_mangle]
+pub extern "C" fn add(a: i32, b: i32) -> i32 {
+ a + b
+}
diff --git a/tests/run-make/windows-safeseh/Makefile b/tests/run-make/windows-safeseh/Makefile
new file mode 100644
index 000000000..d6a403961
--- /dev/null
+++ b/tests/run-make/windows-safeseh/Makefile
@@ -0,0 +1,19 @@
+# only-windows
+# needs-rust-lld
+
+include ../tools.mk
+
+all: foo bar
+
+# Ensure that LLD can link when an .rlib contains a synthetic object
+# file referencing exported or used symbols.
+foo:
+ $(RUSTC) -C linker=rust-lld foo.rs
+
+# Ensure that LLD can link when /WHOLEARCHIVE: is used with an .rlib.
+# Previously, lib.rmeta was not marked as (trivially) SAFESEH-aware.
+bar: baz
+ $(RUSTC) -C linker=rust-lld -C link-arg=/WHOLEARCHIVE:libbaz.rlib bar.rs
+
+baz:
+ $(RUSTC) baz.rs
diff --git a/tests/run-make/windows-safeseh/bar.rs b/tests/run-make/windows-safeseh/bar.rs
new file mode 100644
index 000000000..f328e4d9d
--- /dev/null
+++ b/tests/run-make/windows-safeseh/bar.rs
@@ -0,0 +1 @@
+fn main() {}
diff --git a/tests/run-make/windows-safeseh/baz.rs b/tests/run-make/windows-safeseh/baz.rs
new file mode 100644
index 000000000..8d5b9dc5a
--- /dev/null
+++ b/tests/run-make/windows-safeseh/baz.rs
@@ -0,0 +1,4 @@
+#![crate_type = "rlib"]
+
+#[no_mangle]
+extern "C" fn baz() {}
diff --git a/tests/run-make/issue-96498/foo.rs b/tests/run-make/windows-safeseh/foo.rs
index 93ac3641b..93ac3641b 100644
--- a/tests/run-make/issue-96498/foo.rs
+++ b/tests/run-make/windows-safeseh/foo.rs
diff --git a/tests/rustdoc-gui/anchors.goml b/tests/rustdoc-gui/anchors.goml
index 30b83f0da..72e0bcd77 100644
--- a/tests/rustdoc-gui/anchors.goml
+++ b/tests/rustdoc-gui/anchors.goml
@@ -56,7 +56,7 @@ define-function: (
assert-css: ("#top-doc-prose-title", {"color": |title_color|})
- assert-css: (".sidebar a", {"color": |sidebar_link_color|})
+ assert-css: (".sidebar .block a", {"color": |sidebar_link_color|})
assert-css: (".main-heading h1 a", {"color": |title_color|})
// We move the cursor over the "Implementations" title so the anchor is displayed.
diff --git a/tests/rustdoc-gui/code-tags.goml b/tests/rustdoc-gui/code-tags.goml
index 3405d3295..577f932e5 100644
--- a/tests/rustdoc-gui/code-tags.goml
+++ b/tests/rustdoc-gui/code-tags.goml
@@ -1,6 +1,6 @@
// This test ensures that items and documentation code blocks are wrapped in <pre><code>
-// We need to disable this check because `implementors/test_docs/trait.AnotherOne.js`
+// We need to disable this check because `trait.impl/test_docs/trait.AnotherOne.js`
// doesn't exist.
fail-on-request-error: false
go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
diff --git a/tests/rustdoc-gui/huge-logo.goml b/tests/rustdoc-gui/huge-logo.goml
index 6d3eb6606..bfc24c326 100644
--- a/tests/rustdoc-gui/huge-logo.goml
+++ b/tests/rustdoc-gui/huge-logo.goml
@@ -4,8 +4,8 @@ go-to: "file://" + |DOC_PATH| + "/huge_logo/index.html"
set-window-size: (1280, 1024)
// offsetWidth = width of sidebar
-assert-property: (".sidebar .logo-container", {"offsetWidth": "200", "offsetHeight": 100})
-assert-property: (".sidebar .logo-container img", {"offsetWidth": "100", "offsetHeight": 100})
+assert-property: (".sidebar-crate .logo-container", {"offsetWidth": "48", "offsetHeight": 48})
+assert-property: (".sidebar-crate .logo-container img", {"offsetWidth": "48", "offsetHeight": 48})
set-window-size: (400, 600)
// offset = size + margin
diff --git a/tests/rustdoc-gui/impl_on_foreign_order.goml b/tests/rustdoc-gui/impl_on_foreign_order.goml
new file mode 100644
index 000000000..a6f5343be
--- /dev/null
+++ b/tests/rustdoc-gui/impl_on_foreign_order.goml
@@ -0,0 +1,6 @@
+// This test ensures that the "implementations on foreign types" of a trait are correctly sorted.
+go-to: "file://" + |DOC_PATH| + "/test_docs/foreign_impl_order/trait.Foo.html"
+assert-text: ("details:nth-of-type(1) h3", "impl Foo<1> for [u8; 1]")
+assert-text: ("details:nth-of-type(2) h3", "impl Foo<2> for [u8; 2]")
+assert-text: ("details:nth-of-type(3) h3", "impl Foo<3> for [u8; 3]")
+assert-text: ("details:nth-of-type(4) h3", "impl Foo<4> for [u8; 4]")
diff --git a/tests/rustdoc-gui/item-decl-colors.goml b/tests/rustdoc-gui/item-decl-colors.goml
index a77784273..7bbd20c4e 100644
--- a/tests/rustdoc-gui/item-decl-colors.goml
+++ b/tests/rustdoc-gui/item-decl-colors.goml
@@ -1,6 +1,6 @@
// This test ensures that the color of the items in the type decl are working as expected.
-// We need to disable this check because `implementors/test_docs/trait.TraitWithoutGenerics.js`
+// We need to disable this check because `trait.impl/test_docs/trait.TraitWithoutGenerics.js`
// doesn't exist.
fail-on-request-error: false
diff --git a/tests/rustdoc-gui/no-docblock.goml b/tests/rustdoc-gui/no-docblock.goml
index 1b4638ef0..2115b6f53 100644
--- a/tests/rustdoc-gui/no-docblock.goml
+++ b/tests/rustdoc-gui/no-docblock.goml
@@ -1,6 +1,6 @@
// This test checks that there are margins applied to methods with no docblocks.
-// We need to disable this check because `implementors/test_docs/trait.TraitWithNoDocblock.js`
+// We need to disable this check because `trait.impl/test_docs/trait.TraitWithNoDocblock.js`
// doesn't exist.
fail-on-request-error: false
diff --git a/tests/rustdoc-gui/rust-logo.goml b/tests/rustdoc-gui/rust-logo.goml
index cd453aea2..696cab34d 100644
--- a/tests/rustdoc-gui/rust-logo.goml
+++ b/tests/rustdoc-gui/rust-logo.goml
@@ -1,18 +1,18 @@
// This test ensures that the correct style is applied to the rust logo in the sidebar.
-go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+go-to: "file://" + |DOC_PATH| + "/staged_api/index.html"
define-function: (
"check-logo",
(theme, filter),
block {
// Going to the doc page.
- go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+ go-to: "file://" + |DOC_PATH| + "/staged_api/index.html"
// Changing theme.
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
assert-css: (".rust-logo", {"filter": |filter|})
// Going to the source code page.
- go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
+ go-to: "file://" + |DOC_PATH| + "/src/staged_api/lib.rs.html"
// Changing theme (since it's local files, the local storage works by folder).
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
reload:
@@ -26,6 +26,15 @@ define-function: (
assert-false: ".rust-logo"
// Check there is no filter.
assert-css: (".sidebar .logo-container img", {"filter": "none"})
+ // Now we check that this page has no logo at all
+ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+ assert-false: ".rust-logo"
+ assert-false: ".logo-container"
+ assert-false: ".sub-logo-container"
+ go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
+ assert-false: ".rust-logo"
+ assert-false: ".logo-container"
+ assert-false: ".sub-logo-container"
},
)
diff --git a/tests/rustdoc-gui/search-result-impl-disambiguation.goml b/tests/rustdoc-gui/search-result-impl-disambiguation.goml
new file mode 100644
index 000000000..6d12032e8
--- /dev/null
+++ b/tests/rustdoc-gui/search-result-impl-disambiguation.goml
@@ -0,0 +1,43 @@
+// ignore-tidy-linelength
+
+// Checks that, if a type has two methods with the same name, they both get
+// linked correctly.
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+
+// This should link to the inherent impl
+write: (".search-input", "ZyxwvutMethodDisambiguation -> bool")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+// Check the disambiguated link.
+assert-count: ("a.result-method", 1)
+assert-attribute: ("a.result-method", {
+ "href": "../test_docs/struct.ZyxwvutMethodDisambiguation.html#impl-ZyxwvutMethodDisambiguation/method.method_impl_disambiguation"
+})
+click: "a.result-method"
+wait-for: "#impl-ZyxwvutMethodDisambiguation"
+assert-document-property: ({
+ "URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation"
+}, ENDS_WITH)
+assert: "section:target"
+
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+
+// This should link to the trait impl
+write: (".search-input", "ZyxwvutMethodDisambiguation, usize -> usize")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+// Check the disambiguated link.
+assert-count: ("a.result-method", 1)
+assert-attribute: ("a.result-method", {
+ "href": "../test_docs/struct.ZyxwvutMethodDisambiguation.html#impl-ZyxwvutTrait-for-ZyxwvutMethodDisambiguation/method.method_impl_disambiguation"
+})
+click: "a.result-method"
+wait-for: "#impl-ZyxwvutMethodDisambiguation"
+assert-document-property: ({
+ "URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation-1"
+}, ENDS_WITH)
+assert: "section:target"
diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml
index 427201e1b..db1605ff2 100644
--- a/tests/rustdoc-gui/search-tab.goml
+++ b/tests/rustdoc-gui/search-tab.goml
@@ -79,8 +79,8 @@ call-function: ("check-colors", {
set-window-size: (851, 600)
// Check the size and count in tabs
-assert-text: ("#search-tabs > button:nth-child(1) > .count", " (23) ")
-assert-text: ("#search-tabs > button:nth-child(2) > .count", " (4)  ")
+assert-text: ("#search-tabs > button:nth-child(1) > .count", " (25) ")
+assert-text: ("#search-tabs > button:nth-child(2) > .count", " (5)  ")
assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0)  ")
store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})
assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|})
diff --git a/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml
index 6cd725043..b55a1cfd9 100644
--- a/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml
+++ b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml
@@ -1,7 +1,7 @@
// This test ensures that the "Auto-hide item contents for large items" setting is working as
// expected.
-// We need to disable this check because `implementors/test_docs/trait.Iterator.js` doesn't exist.
+// We need to disable this check because `trait.impl/test_docs/trait.Iterator.js` doesn't exist.
fail-on-request-error: false
define-function: (
diff --git a/tests/rustdoc-gui/sidebar-mobile.goml b/tests/rustdoc-gui/sidebar-mobile.goml
index 4b8337ace..d3a82d9eb 100644
--- a/tests/rustdoc-gui/sidebar-mobile.goml
+++ b/tests/rustdoc-gui/sidebar-mobile.goml
@@ -26,7 +26,7 @@ assert-css: (".sidebar", {"left": "0px"})
// Make sure the "struct Foo" header is hidden, since the mobile topbar already does it.
assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='Foo']/parent::h2", {"display": "none"})
// Make sure the global navigation is still here.
-assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='In test_docs']/parent::h2", {"display": "block"})
+assert-css: ("//nav[contains(@class, 'sidebar')]//h2/a[text()='In crate test_docs']/parent::h2", {"display": "block"})
// Click elsewhere.
click: "body"
@@ -50,7 +50,7 @@ assert-position: ("#method\.must_use", {"y": 46})
// Check that the bottom-most item on the sidebar menu can be scrolled fully into view.
click: ".sidebar-menu-toggle"
scroll-to: ".block.keyword li:nth-child(1)"
-compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 543.19})
+compare-elements-position-near: (".block.keyword li:nth-child(1)", ".mobile-topbar", {"y": 544})
// Now checking the background color of the sidebar.
show-text: true
diff --git a/tests/rustdoc-gui/sidebar-source-code-display.goml b/tests/rustdoc-gui/sidebar-source-code-display.goml
index 88546ed25..cea4db146 100644
--- a/tests/rustdoc-gui/sidebar-source-code-display.goml
+++ b/tests/rustdoc-gui/sidebar-source-code-display.goml
@@ -174,14 +174,14 @@ click: "#src-sidebar-toggle"
wait-for-css: (".sidebar", {"left": "-1000px"})
// We scroll to line 117 to change the scroll position.
scroll-to: '//*[@id="117"]'
-assert-window-property: {"pageYOffset": "2542"}
+assert-window-property: {"pageYOffset": "2516"}
// Expanding the sidebar...
click: "#src-sidebar-toggle"
wait-for-css: (".sidebar", {"left": "0px"})
click: "#src-sidebar-toggle"
wait-for-css: (".sidebar", {"left": "-1000px"})
// The "scrollTop" property should be the same.
-assert-window-property: {"pageYOffset": "2542"}
+assert-window-property: {"pageYOffset": "2516"}
// We now check that opening the sidebar and clicking a link will close it.
// The behavior here on mobile is different than the behavior on desktop,
diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml
index 520481d3b..eff66d803 100644
--- a/tests/rustdoc-gui/sidebar.goml
+++ b/tests/rustdoc-gui/sidebar.goml
@@ -50,9 +50,9 @@ set-local-storage: {"rustdoc-theme": "light"}
// We reload the page so the local storage settings are being used.
reload:
-assert-text: (".sidebar > .location", "Crate test_docs")
-// In modules, we only have one "location" element.
-assert-count: (".sidebar .location", 1)
+assert-text: (".sidebar > .sidebar-crate > h2 > a", "test_docs")
+// Crate root has no "location" element
+assert-count: (".sidebar .location", 0)
assert-count: (".sidebar h2", 1)
assert-text: ("#all-types", "All Items")
assert-css: ("#all-types", {"color": "#356da4"})
@@ -74,8 +74,9 @@ assert-text: ("#structs + .item-table .item-name > a", "Foo")
click: "#structs + .item-table .item-name > a"
// PAGE: struct.Foo.html
+assert-count: (".sidebar .sidebar-crate", 1)
assert-count: (".sidebar .location", 1)
-assert-count: (".sidebar h2", 2)
+assert-count: (".sidebar h2", 3)
// We check that there is no crate listed outside of the top level.
assert-false: ".sidebar-elems > .crate"
@@ -94,7 +95,8 @@ click: ".sidebar-elems ul.crate > li:first-child > a"
// PAGE: lib2/index.html
go-to: "file://" + |DOC_PATH| + "/lib2/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
-assert-text: (".sidebar > .location", "Crate lib2")
+assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
+assert-count: (".sidebar .location", 0)
// We check that we have the crates list and that the "current" on is now "lib2".
assert-text: (".sidebar-elems ul.crate > li > a.current", "lib2")
// We now go to the "foobar" function page.
@@ -108,22 +110,39 @@ click: "#functions + .item-table .item-name > a"
// PAGE: fn.foobar.html
// In items containing no items (like functions or constants) and in modules, we have no
-// "location" elements. Only the parent module h2.
+// "location" elements. Only the crate and optional parent module.
+// This page, being directly below the crate, only has its heading.
+assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
assert-count: (".sidebar .location", 0)
assert-count: (".sidebar h2", 1)
-assert-text: (".sidebar .sidebar-elems h2", "In lib2")
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"
go-to: "./module/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
+assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
assert-text: (".sidebar > .location", "Module module")
+assert-count: (".sidebar .location", 1)
+// Module page requires three headings:
+// - Presistent crate branding (name and version)
+// - Module name, followed by TOC for module headings
+// - "In crate [name]" parent pointer, followed by sibling navigation
+assert-count: (".sidebar h2", 3)
+assert-text: (".sidebar > .sidebar-elems > h2", "In crate lib2")
+assert-property: (".sidebar > .sidebar-elems > h2 > a", {
+ "href": "/lib2/index.html",
+}, ENDS_WITH)
// We check that we don't have the crate list.
assert-false: ".sidebar-elems > .crate"
go-to: "./sub_module/sub_sub_module/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
+assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
assert-text: (".sidebar > .location", "Module sub_sub_module")
+assert-text: (".sidebar > .sidebar-elems > h2", "In lib2::module::sub_module")
+assert-property: (".sidebar > .sidebar-elems > h2 > a", {
+ "href": "/module/sub_module/index.html",
+}, ENDS_WITH)
// We check that we don't have the crate list.
assert-false: ".sidebar-elems .crate"
assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions")
@@ -152,14 +171,14 @@ assert-property: (".sidebar", {"clientWidth": "200"})
// Checks that all.html and index.html have their sidebar link in the same place.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
-store-property: (".sidebar .location a", {
+store-property: (".sidebar .sidebar-crate h2 a", {
"clientWidth": index_sidebar_width,
"clientHeight": index_sidebar_height,
"offsetTop": index_sidebar_y,
"offsetLeft": index_sidebar_x,
})
go-to: "file://" + |DOC_PATH| + "/test_docs/all.html"
-assert-property: (".sidebar .location a", {
+assert-property: (".sidebar .sidebar-crate h2 a", {
"clientWidth": |index_sidebar_width|,
"clientHeight": |index_sidebar_height|,
"offsetTop": |index_sidebar_y|,
diff --git a/tests/rustdoc-gui/source-anchor-scroll.goml b/tests/rustdoc-gui/source-anchor-scroll.goml
index 0e4913caf..940851ea1 100644
--- a/tests/rustdoc-gui/source-anchor-scroll.goml
+++ b/tests/rustdoc-gui/source-anchor-scroll.goml
@@ -8,13 +8,13 @@ set-window-size: (600, 800)
assert-property: ("html", {"scrollTop": "0"})
click: '//a[text() = "barbar" and @href="#5-7"]'
-assert-property: ("html", {"scrollTop": "149"})
+assert-property: ("html", {"scrollTop": "123"})
click: '//a[text() = "bar" and @href="#28-36"]'
-assert-property: ("html", {"scrollTop": "180"})
+assert-property: ("html", {"scrollTop": "154"})
click: '//a[text() = "sub_fn" and @href="#2-4"]'
-assert-property: ("html", {"scrollTop": "77"})
+assert-property: ("html", {"scrollTop": "51"})
// We now check that clicking on lines doesn't change the scroll
// Extra information: the "sub_fn" function header is on line 1.
click: '//*[@id="6"]'
-assert-property: ("html", {"scrollTop": "77"})
+assert-property: ("html", {"scrollTop": "51"})
diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml
index f19e3ce80..ad57380ae 100644
--- a/tests/rustdoc-gui/source-code-page.goml
+++ b/tests/rustdoc-gui/source-code-page.goml
@@ -89,9 +89,9 @@ assert-css: (".src-line-numbers", {"text-align": "right"})
// do anything (and certainly not add a `#NaN` to the URL!).
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
// We use this assert-position to know where we will click.
-assert-position: ("//*[@id='1']", {"x": 88, "y": 112})
+assert-position: ("//*[@id='1']", {"x": 88, "y": 86})
// We click on the left of the "1" anchor but still in the "src-line-number" `<pre>`.
-click: (87, 103)
+click: (87, 77)
assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
// Checking the source code sidebar.
@@ -163,16 +163,16 @@ assert-css: ("nav.sub", {"flex-direction": "row"})
// To check this, we maintain the invariant:
//
// offsetTop[nav.sub form] = offsetTop[#main-content] - offsetHeight[nav.sub form] - offsetTop[nav.sub form]
-assert-property: ("nav.sub form", {"offsetTop": 28, "offsetHeight": 34})
-assert-property: ("#main-content", {"offsetTop": 90})
-// 28 = 90 - 34 - 28
+assert-property: ("nav.sub form", {"offsetTop": 15, "offsetHeight": 34})
+assert-property: ("#main-content", {"offsetTop": 64})
+// 15 = 64 - 34 - 15
// Now do the same check on moderately-sized, tablet mobile.
set-window-size: (700, 700)
assert-css: ("nav.sub", {"flex-direction": "row"})
-assert-property: ("nav.sub form", {"offsetTop": 21, "offsetHeight": 34})
-assert-property: ("#main-content", {"offsetTop": 76})
-// 21 = 76 - 34 - 21
+assert-property: ("nav.sub form", {"offsetTop": 8, "offsetHeight": 34})
+assert-property: ("#main-content", {"offsetTop": 50})
+// 8 = 50 - 34 - 8
// Check the sidebar directory entries have a marker and spacing (tablet).
store-property: ("#src-sidebar > .title", {
@@ -198,7 +198,12 @@ call-function: ("check-sidebar-dir-entry", {
"y": |source_sidebar_title_y| + |source_sidebar_title_height| + 6,
})
+// The logo is not present on this page.
+assert-false: ".sub-logo-container > img"
+
+// Check the staged-api page instead, which does.
// Now we check that the logo has a bottom margin so it's not stuck to the search input.
+go-to: "file://" + |DOC_PATH| + "/src/staged_api/lib.rs.html"
assert-css: (".sub-logo-container > img", {"margin-bottom": "8px"})
store-property: (".sub-logo-container", {"clientHeight": logo_height})
assert-position: (".search-form", {"y": |logo_height| + 8})
diff --git a/tests/rustdoc-gui/src/lib2/lib.rs b/tests/rustdoc-gui/src/lib2/lib.rs
index 34e67d9d2..a2a3c3187 100644
--- a/tests/rustdoc-gui/src/lib2/lib.rs
+++ b/tests/rustdoc-gui/src/lib2/lib.rs
@@ -147,13 +147,13 @@ pub struct LongItemInfo2;
#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
impl SimpleTrait for LongItemInfo2 {}
-pub struct WhereWhitespace<T>;
+pub struct WhereWhitespace<T>(T);
impl<T> WhereWhitespace<T> {
pub fn new<F>(f: F) -> Self
where
F: FnMut() -> i32,
- {}
+ {todo!()}
}
impl<K, T> Whitespace<&K> for WhereWhitespace<T>
@@ -187,6 +187,11 @@ impl ItemInfoAlignmentTest {
pub mod scroll_traits {
use std::iter::*;
+ struct Intersperse<T>(T);
+ struct IntersperseWith<T, U>(T, U);
+ struct Flatten<T>(T);
+ struct Peekable<T>(T);
+
/// Shamelessly (partially) copied from `std::iter::Iterator`.
/// It allows us to check that the scroll is working as expected on "hidden" items.
pub trait Iterator {
diff --git a/tests/rustdoc-gui/src/staged_api/lib.rs b/tests/rustdoc-gui/src/staged_api/lib.rs
index 0c914470e..9b5ad1c5f 100644
--- a/tests/rustdoc-gui/src/staged_api/lib.rs
+++ b/tests/rustdoc-gui/src/staged_api/lib.rs
@@ -1,6 +1,8 @@
#![feature(staged_api)]
+#![feature(rustdoc_internals)]
#![allow(internal_features)]
#![stable(feature = "some_feature", since = "1.3.5")]
+#![doc(rust_logo)]
#[stable(feature = "some_feature", since = "1.3.5")]
pub struct Foo {}
diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs
index 38180aef7..c7d115bdb 100644
--- a/tests/rustdoc-gui/src/test_docs/lib.rs
+++ b/tests/rustdoc-gui/src/test_docs/lib.rs
@@ -160,6 +160,33 @@ pub mod keyword {}
/// Just some type alias.
pub type SomeType = u32;
+/// Another type alias, this time with methods.
+pub type SomeOtherTypeWithMethodsAndInlining = Foo;
+
+impl SomeOtherTypeWithMethodsAndInlining {
+ pub fn some_other_method_directly(&self) {}
+}
+
+/// Another type alias, this time with methods.
+pub struct UnderlyingFooBarBaz;
+pub type SomeOtherTypeWithMethodsAndInliningAndTraits = UnderlyingFooBarBaz;
+
+impl AsRef<str> for UnderlyingFooBarBaz {
+ fn as_ref(&self) -> &str {
+ "hello"
+ }
+}
+
+impl UnderlyingFooBarBaz {
+ pub fn inherent_fn(&self) {}
+}
+
+impl AsRef<u8> for SomeOtherTypeWithMethodsAndInliningAndTraits {
+ fn as_ref(&self) -> &u8 {
+ b"hello"
+ }
+}
+
pub mod huge_amount_of_consts {
include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
}
@@ -529,3 +556,40 @@ pub mod cfgs {
/// Some docs.
pub mod cfgs {}
}
+
+pub struct ZyxwvutMethodDisambiguation;
+
+impl ZyxwvutMethodDisambiguation {
+ pub fn method_impl_disambiguation(&self) -> bool {
+ true
+ }
+}
+
+pub trait ZyxwvutTrait {
+ fn method_impl_disambiguation(&self, x: usize) -> usize;
+}
+
+impl ZyxwvutTrait for ZyxwvutMethodDisambiguation {
+ fn method_impl_disambiguation(&self, x: usize) -> usize {
+ x
+ }
+}
+
+pub mod foreign_impl_order {
+ pub trait Foo<const W: usize> {
+ fn f(&mut self, with: [u8; W]);
+ }
+
+ impl Foo<4> for [u8; 4] {
+ fn f(&mut self, fg: [u8; 4]) {}
+ }
+ impl Foo<2> for [u8; 2] {
+ fn f(&mut self, fg: [u8; 2]) {}
+ }
+ impl Foo<1> for [u8; 1] {
+ fn f(&mut self, fg: [u8; 1]) {}
+ }
+ impl Foo<3> for [u8; 3] {
+ fn f(&mut self, fg: [u8; 3]) {}
+ }
+}
diff --git a/tests/rustdoc-gui/trait-sidebar-item-order.goml b/tests/rustdoc-gui/trait-sidebar-item-order.goml
index 9330ef040..73e362ca8 100644
--- a/tests/rustdoc-gui/trait-sidebar-item-order.goml
+++ b/tests/rustdoc-gui/trait-sidebar-item-order.goml
@@ -1,6 +1,6 @@
// Checks that the elements in the sidebar are alphabetically sorted.
-// We need to disable this check because `implementors/test_docs/trait.AnotherOne.js`
+// We need to disable this check because `trait.impl/test_docs/trait.AnotherOne.js`
// doesn't exist.
fail-on-request-error: false
diff --git a/tests/rustdoc-gui/type-declation-overflow.goml b/tests/rustdoc-gui/type-declation-overflow.goml
index f212781e9..5780f5c88 100644
--- a/tests/rustdoc-gui/type-declation-overflow.goml
+++ b/tests/rustdoc-gui/type-declation-overflow.goml
@@ -2,7 +2,7 @@
// This test ensures that the items declaration content overflow is handled inside the <pre> directly.
// We need to disable this check because
-// `implementors/test_docs/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.js`
+// `trait.impl/test_docs/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.js`
// doesn't exist.
fail-on-request-error: false
diff --git a/tests/rustdoc-gui/type-impls.goml b/tests/rustdoc-gui/type-impls.goml
new file mode 100644
index 000000000..870a9cbe5
--- /dev/null
+++ b/tests/rustdoc-gui/type-impls.goml
@@ -0,0 +1,86 @@
+// The goal of this test is to check that the inlined type alias impls, generated with JS,
+// have the same display than the "local" ones.
+go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeOtherTypeWithMethodsAndInlining.html"
+
+// method directly on type alias
+wait-for: "//*[@id='method.some_other_method_directly']"
+
+// methods on foo
+assert: "//*[@id='method.as_ref']"
+assert: "//*[@id='method.must_use']"
+assert: "//*[@id='method.warning1']"
+assert: "//*[@id='method.warning2']"
+
+// sidebar items
+assert: "//*[@class='sidebar-elems']//li/a[@href='#method.must_use']"
+assert: "//*[@class='sidebar-elems']//li/a[@href='#method.some_other_method_directly']"
+assert: "//*[@class='sidebar-elems']//li/a[@href='#method.warning1']"
+assert: "//*[@class='sidebar-elems']//li/a[@href='#method.warning2']"
+assert: "//*[@class='sidebar-elems']//li/a[@href='#impl-AsRef%3Cstr%3E-for-Foo']"
+
+// sorting
+assert-text: (".block.method li:nth-child(1)", 'must_use')
+assert-text: (".block.method li:nth-child(2)", 'some_other_method_directly')
+assert-text: (".block.method li:nth-child(3)", 'warning1')
+assert-text: (".block.method li:nth-child(4)", 'warning2')
+
+// Now try trait implementation merging and duplicate renumbering
+go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeOtherTypeWithMethodsAndInliningAndTraits.html"
+
+// method directly on type alias
+assert: "//*[@id='method.as_ref']"
+assert-count: ("//*[@id='method.as_ref']", 1)
+// method on underlying type
+assert: "//*[@id='method.as_ref-1']"
+
+// sidebar items
+assert-count: (
+ "//*[@class='sidebar-elems']//h3/a[@href='#trait-implementations']",
+ 1
+)
+assert-text: ("//*[@class='sidebar-elems']//li/a[@href='#impl-AsRef%3Cstr%3E-for-UnderlyingFooBarBaz']", "AsRef<str>")
+assert-text: (
+ "//*[@class='sidebar-elems']//li/a[@href='#impl-AsRef%3Cu8%3E-for-UnderlyingFooBarBaz']",
+ "AsRef<u8>"
+)
+assert-count: ("#trait-implementations-list", 1)
+assert-count: ("#trait-implementations-list > details", 2)
+// Both links point at the underlying trait
+store-property: ("//*[@id='method.as_ref']//a[@class='fn']", {"href": href})
+assert-property: ("//*[@id='method.as_ref-1']//a[@class='fn']", {"href": |href|})
+// Both links have a self-anchor
+assert: "//*[@id='method.as_ref']//a[@class='anchor'][@href='#method.as_ref']"
+assert: "//*[@id='method.as_ref-1']//a[@class='anchor'][@href='#method.as_ref-1']"
+
+///////////////////////////////////////////////////////////////////////////
+// Now, if JavaScript is disabled, only the first method will be present //
+///////////////////////////////////////////////////////////////////////////
+javascript: false
+go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeOtherTypeWithMethodsAndInlining.html"
+
+// method directly on type alias
+wait-for: "//*[@id='method.some_other_method_directly']"
+
+// methods on foo
+assert-false: "//*[@id='method.must_use']"
+assert-false: "//*[@id='method.warning1']"
+assert-false: "//*[@id='method.warning2']"
+
+// Now try trait implementation merging and duplicate renumbering
+go-to: "file://" + |DOC_PATH| + "/test_docs/type.SomeOtherTypeWithMethodsAndInliningAndTraits.html"
+
+// methods directly on type alias
+assert: "//*[@id='method.as_ref']"
+assert-count: ("//*[@id='method.as_ref']", 1)
+// method on target type
+assert-false: "//*[@id='method.as_ref-1']"
+
+// sidebar items
+assert-count: (
+ "//*[@class='sidebar-elems']//h3/a[@href='#trait-implementations']",
+ 1
+)
+assert-false: "//a[@href='#impl-AsRef%3Cstr%3E-for-UnderlyingFooBarBaz']"
+assert: "//a[@href='#impl-AsRef%3Cu8%3E-for-UnderlyingFooBarBaz']"
+assert-count: ("#trait-implementations-list", 1)
+assert-count: ("#trait-implementations-list > details", 1)
diff --git a/tests/rustdoc-js-std/simd-type-signatures.js b/tests/rustdoc-js-std/simd-type-signatures.js
new file mode 100644
index 000000000..5c7cf372b
--- /dev/null
+++ b/tests/rustdoc-js-std/simd-type-signatures.js
@@ -0,0 +1,70 @@
+// exact-check
+// ignore-order
+// ignore-tidy-linelength
+
+// This test case verifies that the href points at the correct impl
+
+const FILTER_CRATE = "std";
+
+const EXPECTED = [
+ {
+ 'query': 'simd<i16>, simd<i16> -> simd<i16>',
+ 'others': [
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'simd_max',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+LANES%3E/method.simd_max'
+ },
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'simd_min',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+LANES%3E/method.simd_min'
+ },
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'simd_clamp',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+LANES%3E/method.simd_clamp'
+ },
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'saturating_add',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci16,+LANES%3E/method.saturating_add'
+ },
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'saturating_sub',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci16,+LANES%3E/method.saturating_sub'
+ },
+ ],
+ },
+ {
+ 'query': 'simd<i8>, simd<i8> -> simd<i8>',
+ 'others': [
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'simd_max',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+LANES%3E/method.simd_max'
+ },
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'simd_min',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+LANES%3E/method.simd_min'
+ },
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'simd_clamp',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+LANES%3E/method.simd_clamp'
+ },
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'saturating_add',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci8,+LANES%3E/method.saturating_add'
+ },
+ {
+ 'path': 'std::simd::prelude::Simd',
+ 'name': 'saturating_sub',
+ 'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci8,+LANES%3E/method.saturating_sub'
+ },
+ ],
+ },
+];
diff --git a/tests/rustdoc-js/auxiliary/equivalent.rs b/tests/rustdoc-js/auxiliary/equivalent.rs
new file mode 100644
index 000000000..a19b5a2d4
--- /dev/null
+++ b/tests/rustdoc-js/auxiliary/equivalent.rs
@@ -0,0 +1,15 @@
+use std::borrow::Borrow;
+
+pub trait Equivalent<K: ?Sized> {
+ fn equivalent(&self, key: &K) -> bool;
+}
+
+impl<Q: ?Sized, K: ?Sized> Equivalent<K> for Q
+where
+ Q: Eq,
+ K: Borrow<Q>,
+{
+ fn equivalent(&self, key: &K) -> bool {
+ PartialEq::eq(self, key.borrow())
+ }
+}
diff --git a/tests/rustdoc-js/impl-trait.js b/tests/rustdoc-js/impl-trait.js
index 710e594b5..00d67d639 100644
--- a/tests/rustdoc-js/impl-trait.js
+++ b/tests/rustdoc-js/impl-trait.js
@@ -1,3 +1,4 @@
+// exact-check
// ignore-order
const EXPECTED = [
@@ -20,9 +21,16 @@ const EXPECTED = [
{
'query': '-> Aaaaaaa',
'others': [
- { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
- { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
{ 'path': 'impl_trait', 'name': 'bbbbbbb' },
+ { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
+ { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
+ { 'path': 'impl_trait::Ccccccc', 'name': 'ggggggg' },
+ ],
+ },
+ {
+ 'query': '-> Bbbbbbb',
+ 'others': [
+ { 'path': 'impl_trait::Ccccccc', 'name': 'ggggggg' },
],
},
{
@@ -31,13 +39,14 @@ const EXPECTED = [
{ 'path': 'impl_trait', 'name': 'Aaaaaaa' },
],
'in_args': [
- { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
{ 'path': 'impl_trait::Ccccccc', 'name': 'eeeeeee' },
+ { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
],
'returned': [
- { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
- { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
{ 'path': 'impl_trait', 'name': 'bbbbbbb' },
+ { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' },
+ { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' },
+ { 'path': 'impl_trait::Ccccccc', 'name': 'ggggggg' },
],
},
];
diff --git a/tests/rustdoc-js/impl-trait.rs b/tests/rustdoc-js/impl-trait.rs
index fb8869b46..d20fdd60e 100644
--- a/tests/rustdoc-js/impl-trait.rs
+++ b/tests/rustdoc-js/impl-trait.rs
@@ -1,6 +1,9 @@
pub trait Aaaaaaa {}
+pub trait Bbbbbbb {}
+
impl Aaaaaaa for () {}
+impl Bbbbbbb for () {}
pub fn bbbbbbb() -> impl Aaaaaaa {
()
@@ -18,4 +21,7 @@ impl Ccccccc {
pub fn fffffff(&self, x: impl Aaaaaaa) -> impl Aaaaaaa {
x
}
+ pub fn ggggggg(&self) -> impl Aaaaaaa + Bbbbbbb {
+ ()
+ }
}
diff --git a/tests/rustdoc-js/search-method-disambiguate.js b/tests/rustdoc-js/search-method-disambiguate.js
new file mode 100644
index 000000000..70aa895f9
--- /dev/null
+++ b/tests/rustdoc-js/search-method-disambiguate.js
@@ -0,0 +1,28 @@
+// exact-check
+// ignore-order
+// ignore-tidy-linelength
+
+const FILTER_CRATE = "search_method_disambiguate";
+
+const EXPECTED = [
+ {
+ 'query': 'MyTy -> bool',
+ 'others': [
+ {
+ 'path': 'search_method_disambiguate::MyTy',
+ 'name': 'my_method',
+ 'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cbool%3E/method.my_method'
+ },
+ ],
+ },
+ {
+ 'query': 'MyTy -> u8',
+ 'others': [
+ {
+ 'path': 'search_method_disambiguate::MyTy',
+ 'name': 'my_method',
+ 'href': '../search_method_disambiguate/struct.MyTy.html#impl-X-for-MyTy%3Cu8%3E/method.my_method'
+ },
+ ],
+ }
+];
diff --git a/tests/rustdoc-js/search-method-disambiguate.rs b/tests/rustdoc-js/search-method-disambiguate.rs
new file mode 100644
index 000000000..ae884447a
--- /dev/null
+++ b/tests/rustdoc-js/search-method-disambiguate.rs
@@ -0,0 +1,22 @@
+pub trait X {
+ type InnerType;
+ fn my_method(&self) -> Self::InnerType;
+}
+
+pub struct MyTy<T> {
+ pub t: T,
+}
+
+impl X for MyTy<bool> {
+ type InnerType = bool;
+ fn my_method(&self) -> bool {
+ self.t
+ }
+}
+
+impl X for MyTy<u8> {
+ type InnerType = u8;
+ fn my_method(&self) -> u8 {
+ self.t
+ }
+}
diff --git a/tests/rustdoc-js/search-non-local-trait-impl.js b/tests/rustdoc-js/search-non-local-trait-impl.js
new file mode 100644
index 000000000..9ebeceb69
--- /dev/null
+++ b/tests/rustdoc-js/search-non-local-trait-impl.js
@@ -0,0 +1,9 @@
+// exact-check
+
+// This test ensures that methods from blanket impls of not available foreign traits
+// don't show up in the search results.
+
+const EXPECTED = {
+ 'query': 'equivalent',
+ 'others': [],
+};
diff --git a/tests/rustdoc-js/search-non-local-trait-impl.rs b/tests/rustdoc-js/search-non-local-trait-impl.rs
new file mode 100644
index 000000000..462b75b0b
--- /dev/null
+++ b/tests/rustdoc-js/search-non-local-trait-impl.rs
@@ -0,0 +1,8 @@
+// aux-crate:priv:equivalent=equivalent.rs
+// compile-flags: -Zunstable-options --extern equivalent
+// edition:2018
+
+extern crate equivalent;
+
+#[derive(Clone, PartialEq, Eq, Debug)]
+pub struct LayoutError;
diff --git a/tests/rustdoc-json/doc_hidden_failure.rs b/tests/rustdoc-json/doc_hidden_failure.rs
index 0d2c6b220..e2ce66c99 100644
--- a/tests/rustdoc-json/doc_hidden_failure.rs
+++ b/tests/rustdoc-json/doc_hidden_failure.rs
@@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/98007>.
-#![feature(no_core)]
-#![no_core]
-
mod auto {
mod action_row {
pub struct ActionRowBuilder;
diff --git a/tests/rustdoc-json/enums/field_hidden.rs b/tests/rustdoc-json/enums/field_hidden.rs
index 5c0d0ffd3..74d96248d 100644
--- a/tests/rustdoc-json/enums/field_hidden.rs
+++ b/tests/rustdoc-json/enums/field_hidden.rs
@@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/100529>.
-#![no_core]
-#![feature(no_core)]
-
// @has "$.index[*][?(@.name=='ParseError')]"
// @has "$.index[*][?(@.name=='UnexpectedEndTag')]"
// @is "$.index[*][?(@.name=='UnexpectedEndTag')].inner.variant.kind.tuple" [null]
diff --git a/tests/rustdoc-json/enums/kind.rs b/tests/rustdoc-json/enums/kind.rs
index e283c0740..684836834 100644
--- a/tests/rustdoc-json/enums/kind.rs
+++ b/tests/rustdoc-json/enums/kind.rs
@@ -1,8 +1,5 @@
// ignore-tidy-linelength
-#![feature(no_core)]
-#![no_core]
-
pub enum Foo {
// @set Unit = "$.index[*][?(@.name=='Unit')].id"
// @is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"'
diff --git a/tests/rustdoc-json/enums/tuple_fields_hidden.rs b/tests/rustdoc-json/enums/tuple_fields_hidden.rs
index 3aeb03564..53cdf83ff 100644
--- a/tests/rustdoc-json/enums/tuple_fields_hidden.rs
+++ b/tests/rustdoc-json/enums/tuple_fields_hidden.rs
@@ -1,6 +1,3 @@
-#![feature(no_core)]
-#![no_core]
-
// @set 1.1.0 = "$.index[*][?(@.docs=='1.1.0')].id"
// @set 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id"
// @set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id"
diff --git a/tests/rustdoc-json/enums/use_glob.rs b/tests/rustdoc-json/enums/use_glob.rs
index 49990ec53..bec89530b 100644
--- a/tests/rustdoc-json/enums/use_glob.rs
+++ b/tests/rustdoc-json/enums/use_glob.rs
@@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/104942>
-#![feature(no_core)]
-#![no_core]
-
// @set Color = "$.index[*][?(@.name == 'Color')].id"
pub enum Color {
Red,
diff --git a/tests/rustdoc-json/enums/use_variant.rs b/tests/rustdoc-json/enums/use_variant.rs
index 8190e1cbe..c7e0c21f1 100644
--- a/tests/rustdoc-json/enums/use_variant.rs
+++ b/tests/rustdoc-json/enums/use_variant.rs
@@ -1,6 +1,3 @@
-#![feature(no_core)]
-#![no_core]
-
// @set AlwaysNone = "$.index[*][?(@.name == 'AlwaysNone')].id"
pub enum AlwaysNone {
// @set None = "$.index[*][?(@.name == 'None')].id"
diff --git a/tests/rustdoc-json/fn_pointer/generics.rs b/tests/rustdoc-json/fn_pointer/generics.rs
index 3b82561ec..8b3a8c0a7 100644
--- a/tests/rustdoc-json/fn_pointer/generics.rs
+++ b/tests/rustdoc-json/fn_pointer/generics.rs
@@ -1,8 +1,5 @@
// ignore-tidy-linelength
-#![feature(no_core)]
-#![no_core]
-
// @count "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[*]" 1
// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[0][0]" '"val"'
// @is "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type_alias.type.function_pointer.decl.inputs[0][1].borrowed_ref.lifetime" \"\'c\"
diff --git a/tests/rustdoc-json/fns/extern_c_variadic.rs b/tests/rustdoc-json/fns/extern_c_variadic.rs
index d6ea343b9..eef9ae99e 100644
--- a/tests/rustdoc-json/fns/extern_c_variadic.rs
+++ b/tests/rustdoc-json/fns/extern_c_variadic.rs
@@ -1,6 +1,3 @@
-#![feature(no_core)]
-#![no_core]
-
extern "C" {
// @is "$.index[*][?(@.name == 'not_variadic')].inner.function.decl.c_variadic" false
pub fn not_variadic(_: i32);
diff --git a/tests/rustdoc-json/fns/generic_args.rs b/tests/rustdoc-json/fns/generic_args.rs
index 539d17f83..2f6cf3bf6 100644
--- a/tests/rustdoc-json/fns/generic_args.rs
+++ b/tests/rustdoc-json/fns/generic_args.rs
@@ -1,8 +1,5 @@
// ignore-tidy-linelength
-#![feature(no_core)]
-#![no_core]
-
// @set foo = "$.index[*][?(@.name=='Foo')].id"
pub trait Foo {}
diff --git a/tests/rustdoc-json/fns/generic_returns.rs b/tests/rustdoc-json/fns/generic_returns.rs
index 27d842066..8e82efef4 100644
--- a/tests/rustdoc-json/fns/generic_returns.rs
+++ b/tests/rustdoc-json/fns/generic_returns.rs
@@ -1,8 +1,5 @@
// ignore-tidy-linelength
-#![feature(no_core)]
-#![no_core]
-
// @count "$.index[*][?(@.name=='generic_returns')].inner.module.items[*]" 2
// @set foo = "$.index[*][?(@.name=='Foo')].id"
diff --git a/tests/rustdoc-json/fns/generics.rs b/tests/rustdoc-json/fns/generics.rs
index 5239a6f21..44dc6d854 100644
--- a/tests/rustdoc-json/fns/generics.rs
+++ b/tests/rustdoc-json/fns/generics.rs
@@ -1,8 +1,5 @@
// ignore-tidy-linelength
-#![feature(no_core)]
-#![no_core]
-
// @set wham_id = "$.index[*][?(@.name=='Wham')].id"
pub trait Wham {}
diff --git a/tests/rustdoc-json/generic-associated-types/gats.rs b/tests/rustdoc-json/generic-associated-types/gats.rs
index 99c57ff65..56d6e7a49 100644
--- a/tests/rustdoc-json/generic-associated-types/gats.rs
+++ b/tests/rustdoc-json/generic-associated-types/gats.rs
@@ -1,11 +1,5 @@
// ignore-tidy-linelength
-#![no_core]
-#![feature(lang_items, no_core)]
-
-#[lang = "sized"]
-pub trait Sized {}
-
pub trait Display {}
pub trait LendingIterator {
diff --git a/tests/rustdoc-json/glob_import.rs b/tests/rustdoc-json/glob_import.rs
index f37ce0abb..7de1ed78f 100644
--- a/tests/rustdoc-json/glob_import.rs
+++ b/tests/rustdoc-json/glob_import.rs
@@ -1,13 +1,10 @@
// This is a regression test for <https://github.com/rust-lang/rust/issues/98003>.
-#![feature(no_core)]
#![no_std]
-#![no_core]
// @has "$.index[*][?(@.name=='glob')]"
// @has "$.index[*][?(@.inner.import)].inner.import.name" \"*\"
-
mod m1 {
pub fn f() {}
}
diff --git a/tests/rustdoc-json/impls/auto.rs b/tests/rustdoc-json/impls/auto.rs
index ace37e5b3..96c3ab08b 100644
--- a/tests/rustdoc-json/impls/auto.rs
+++ b/tests/rustdoc-json/impls/auto.rs
@@ -1,9 +1,12 @@
-#![feature(no_core, auto_traits, lang_items)]
+#![feature(no_core, auto_traits, lang_items, arbitrary_self_types)]
#![no_core]
#[lang = "sized"]
trait Sized {}
+#[lang = "receiver"]
+pub trait Receiver {}
+
pub auto trait Bar {}
/// has span
@@ -12,8 +15,8 @@ impl Foo {
}
// Testing spans, so all tests below code
-// @is "$.index[*][?(@.docs=='has span')].span.begin" "[10, 0]"
-// @is "$.index[*][?(@.docs=='has span')].span.end" "[12, 1]"
+// @is "$.index[*][?(@.docs=='has span')].span.begin" "[13, 0]"
+// @is "$.index[*][?(@.docs=='has span')].span.end" "[15, 1]"
// FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
// is "$.index[*][?(@.inner.impl.synthetic==true)].span" null
pub struct Foo;
diff --git a/tests/rustdoc-json/impls/impl_item_visibility.rs b/tests/rustdoc-json/impls/impl_item_visibility.rs
index efa54d91d..d3c15cd23 100644
--- a/tests/rustdoc-json/impls/impl_item_visibility.rs
+++ b/tests/rustdoc-json/impls/impl_item_visibility.rs
@@ -1,6 +1,3 @@
-#![feature(no_core)]
-#![no_core]
-
pub struct Foo;
/// impl Foo priv
@@ -9,18 +6,16 @@ impl Foo {
}
// @!has '$.index[*][?(@.docs=="impl Foo priv")]'
-
/// impl Foo pub
impl Foo {
pub fn qux() {}
}
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
-
/// impl Foo hidden
impl Foo {
#[doc(hidden)]
- pub fn __quazl(){}
+ pub fn __quazl() {}
}
// FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
index 3c6fefc4c..fa3a36df8 100644
--- a/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
+++ b/tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs
@@ -1,6 +1,4 @@
// compile-flags: --document-hidden-items
-#![feature(no_core)]
-#![no_core]
pub struct Foo;
@@ -11,18 +9,16 @@ impl Foo {
// FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
-
/// impl Foo pub
impl Foo {
pub fn qux() {}
}
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
-
/// impl Foo hidden
impl Foo {
#[doc(hidden)]
- pub fn __quazl(){}
+ pub fn __quazl() {}
}
// FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
diff --git a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
index b98d1e416..7c68a2412 100644
--- a/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
+++ b/tests/rustdoc-json/impls/impl_item_visibility_show_private.rs
@@ -1,6 +1,4 @@
// compile-flags: --document-private-items
-#![feature(no_core)]
-#![no_core]
pub struct Foo;
@@ -10,18 +8,16 @@ impl Foo {
}
// @is '$.index[*][?(@.docs=="impl Foo priv")].visibility' '"default"'
-
/// impl Foo pub
impl Foo {
pub fn qux() {}
}
// @is '$.index[*][?(@.docs=="impl Foo pub")].visibility' '"default"'
-
/// impl Foo hidden
impl Foo {
#[doc(hidden)]
- pub fn __quazl(){}
+ pub fn __quazl() {}
}
// FIXME(#111564): Is this the right behaviour?
// @is '$.index[*][?(@.docs=="impl Foo hidden")].visibility' '"default"'
diff --git a/tests/rustdoc-json/impls/import_from_private.rs b/tests/rustdoc-json/impls/import_from_private.rs
index d2b0665dc..3da03df25 100644
--- a/tests/rustdoc-json/impls/import_from_private.rs
+++ b/tests/rustdoc-json/impls/import_from_private.rs
@@ -1,14 +1,12 @@
// https://github.com/rust-lang/rust/issues/100252
-#![feature(no_core)]
-#![no_core]
-
mod bar {
- // @set baz = "$.index[*][?(@.inner.struct)].id"
+ // @set baz = "$.index[*][?(@.name == 'Baz')].id"
pub struct Baz;
- // @set impl = "$.index[*][?(@.inner.impl)].id"
+ // @set impl = "$.index[*][?(@.docs == 'impl')].id"
+ /// impl
impl Baz {
- // @set doit = "$.index[*][?(@.inner.function)].id"
+ // @set doit = "$.index[*][?(@.name == 'doit')].id"
pub fn doit() {}
}
}
@@ -18,5 +16,5 @@ pub use bar::Baz;
// @is "$.index[*].inner.module.items[*]" $import
// @is "$.index[*].inner.import.id" $baz
-// @is "$.index[*].inner.struct.impls[*]" $impl
-// @is "$.index[*].inner.impl.items[*]" $doit
+// @has "$.index[*][?(@.name == 'Baz')].inner.struct.impls[*]" $impl
+// @is "$.index[*][?(@.docs=='impl')].inner.impl.items[*]" $doit
diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs
index d2ac316d4..7857626d6 100644
--- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs
+++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-2.rs
@@ -1,7 +1,5 @@
-#![feature(no_core)]
-#![no_core]
-
-// @count "$.index[*][?(@.inner.impl)]" 1
+// @has "$.index[*][?(@.docs=='Here')]"
+// @!has "$.index[*][?(@.docs=='Not Here')]"
// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
// @has "$.index[*][?(@.name=='PubTrait')]"
@@ -11,5 +9,7 @@ pub trait PubTrait {}
pub struct HiddenPubStruct;
pub struct NotHiddenPubStruct;
+/// Not Here
impl PubTrait for HiddenPubStruct {}
+/// Here
impl PubTrait for NotHiddenPubStruct {}
diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs
index fcd27ca4b..836f1fe87 100644
--- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs
+++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id-3.rs
@@ -1,8 +1,5 @@
// compile-flags: --document-hidden-items
-#![feature(no_core)]
-#![no_core]
-
// @has "$.index[*][?(@.name == 'HiddenPubStruct')]"
// @has "$.index[*][?(@.inner.impl)]"
// @has "$.index[*][?(@.name=='PubTrait')]"
diff --git a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
index 141c54a57..97db9c93a 100644
--- a/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
+++ b/tests/rustdoc-json/impls/issue-112852-dangling-trait-impl-id.rs
@@ -1,21 +1,21 @@
-#![feature(no_core)]
-#![no_core]
-
-// @count "$.index[*][?(@.inner.impl)]" 1
-// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
-// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
// @has "$.index[*][?(@.name=='PubTrait')]"
pub trait PubTrait {}
#[doc(hidden)]
pub mod hidden {
+ // @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
pub struct HiddenPubStruct;
+ // @!has "$.index[*][?(@.docs == 'Not Here')]"
+ /// Not Here
impl crate::PubTrait for HiddenPubStruct {}
}
pub mod not_hidden {
+ // @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
pub struct NotHiddenPubStruct;
+ // @has "$.index[*][?(@.docs == 'Here')]"
+ /// Here
impl crate::PubTrait for NotHiddenPubStruct {}
}
diff --git a/tests/rustdoc-json/impls/local_for_local.rs b/tests/rustdoc-json/impls/local_for_local.rs
index 37a720003..015e89c22 100644
--- a/tests/rustdoc-json/impls/local_for_local.rs
+++ b/tests/rustdoc-json/impls/local_for_local.rs
@@ -1,6 +1,3 @@
-#![feature(no_core)]
-#![no_core]
-
// @set struct = "$.index[*][?(@.name=='Struct')].id"
pub struct Struct;
// @set trait = "$.index[*][?(@.name=='Trait')].id"
@@ -9,7 +6,7 @@ pub trait Trait {}
/// impl
impl Trait for Struct {}
-// @is "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl
+// @has "$.index[*][?(@.name=='Struct')].inner.struct.impls[*]" $impl
// @is "$.index[*][?(@.name=='Trait')].inner.trait.implementations[*]" $impl
// @is "$.index[*][?(@.docs=='impl')].inner.impl.trait.id" $trait
// @is "$.index[*][?(@.docs=='impl')].inner.impl.for.resolved_path.id" $struct
diff --git a/tests/rustdoc-json/impls/local_for_local_primitive.rs b/tests/rustdoc-json/impls/local_for_local_primitive.rs
index 769dd3f0a..acc3a879f 100644
--- a/tests/rustdoc-json/impls/local_for_local_primitive.rs
+++ b/tests/rustdoc-json/impls/local_for_local_primitive.rs
@@ -1,6 +1,4 @@
-#![feature(no_core)]
#![feature(rustc_attrs)]
-#![no_core]
// @set Local = "$.index[*][?(@.name=='Local')].id"
pub trait Local {}
diff --git a/tests/rustdoc-json/lifetime/longest.rs b/tests/rustdoc-json/lifetime/longest.rs
index dc28258a8..419b0b4fc 100644
--- a/tests/rustdoc-json/lifetime/longest.rs
+++ b/tests/rustdoc-json/lifetime/longest.rs
@@ -1,8 +1,5 @@
// ignore-tidy-linelength
-#![feature(no_core)]
-#![no_core]
-
// @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].name" \"\'a\"
// @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}'
// @is "$.index[*][?(@.name=='longest')].inner.function.generics.params[0].kind" '{"lifetime": {"outlives": []}}'
@@ -26,5 +23,9 @@
// @is "$.index[*][?(@.name=='longest')].inner.function.decl.output.borrowed_ref.type.primitive" \"str\"
pub fn longest<'a>(l: &'a str, r: &'a str) -> &'a str {
- if l.len() > r.len() { l } else { r }
+ if l.len() > r.len() {
+ l
+ } else {
+ r
+ }
}
diff --git a/tests/rustdoc-json/lifetime/outlives.rs b/tests/rustdoc-json/lifetime/outlives.rs
index 6e105b382..549e4c200 100644
--- a/tests/rustdoc-json/lifetime/outlives.rs
+++ b/tests/rustdoc-json/lifetime/outlives.rs
@@ -1,8 +1,5 @@
// ignore-tidy-linelength
-#![feature(no_core)]
-#![no_core]
-
// @count "$.index[*][?(@.name=='foo')].inner.function.generics.params[*]" 3
// @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates" []
// @is "$.index[*][?(@.name=='foo')].inner.function.generics.params[0].name" \"\'a\"
diff --git a/tests/rustdoc-json/methods/abi.rs b/tests/rustdoc-json/methods/abi.rs
index b8279298c..917e9e079 100644
--- a/tests/rustdoc-json/methods/abi.rs
+++ b/tests/rustdoc-json/methods/abi.rs
@@ -1,8 +1,6 @@
// ignore-tidy-linelength
#![feature(abi_vectorcall)]
-#![feature(no_core)]
-#![no_core]
// @has "$.index[*][?(@.name=='Foo')]"
pub struct Foo;
diff --git a/tests/rustdoc-json/non_lifetime_binders.rs b/tests/rustdoc-json/non_lifetime_binders.rs
index cabee0b1c..d925fcd52 100644
--- a/tests/rustdoc-json/non_lifetime_binders.rs
+++ b/tests/rustdoc-json/non_lifetime_binders.rs
@@ -3,18 +3,9 @@
#![feature(non_lifetime_binders)]
#![allow(incomplete_features)]
-#![no_core]
-#![feature(lang_items, no_core)]
-
-#[lang = "sized"]
-pub trait Sized {}
-
pub trait Trait {}
-#[lang = "phantom_data"]
-struct PhantomData<T_>;
-
-pub struct Wrapper<T_>(PhantomData<T_>);
+pub struct Wrapper<T_>(std::marker::PhantomData<T_>);
// @count "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[*]" 2
// @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].name" \"\'a\"
diff --git a/tests/rustdoc-json/primitives/primitive_overloading.rs b/tests/rustdoc-json/primitives/primitive_overloading.rs
index 81e0acdc6..50e23fc06 100644
--- a/tests/rustdoc-json/primitives/primitive_overloading.rs
+++ b/tests/rustdoc-json/primitives/primitive_overloading.rs
@@ -3,14 +3,10 @@
// Regression test for <https://github.com/rust-lang/rust/issues/98006>.
#![feature(rustc_attrs)]
-#![feature(no_core)]
-
-#![no_core]
// @has "$.index[*][?(@.name=='usize')]"
// @has "$.index[*][?(@.name=='prim')]"
#[rustc_doc_primitive = "usize"]
/// This is the built-in type `usize`.
-mod prim {
-}
+mod prim {}
diff --git a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
index 37ca279b3..a8f5500d6 100644
--- a/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
+++ b/tests/rustdoc-json/reexport/export_extern_crate_as_self.rs
@@ -1,8 +1,5 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/100531>
-#![feature(no_core)]
-#![no_core]
-
#![crate_name = "export_extern_crate_as_self"]
// ignore-tidy-linelength
diff --git a/tests/rustdoc-json/reexport/glob_collision.rs b/tests/rustdoc-json/reexport/glob_collision.rs
index dee35ba78..9a75f4c0c 100644
--- a/tests/rustdoc-json/reexport/glob_collision.rs
+++ b/tests/rustdoc-json/reexport/glob_collision.rs
@@ -1,8 +1,5 @@
// Regression test for https://github.com/rust-lang/rust/issues/100973
-#![feature(no_core)]
-#![no_core]
-
// @set m1 = "$.index[*][?(@.name == 'm1' && @.inner.module)].id"
// @is "$.index[*][?(@.name == 'm1')].inner.module.items" []
// @is "$.index[*][?(@.name == 'm1')].inner.module.is_stripped" true
diff --git a/tests/rustdoc-json/reexport/glob_extern.rs b/tests/rustdoc-json/reexport/glob_extern.rs
index 78edfaf0a..ed0c4a420 100644
--- a/tests/rustdoc-json/reexport/glob_extern.rs
+++ b/tests/rustdoc-json/reexport/glob_extern.rs
@@ -1,8 +1,5 @@
// edition:2018
-#![no_core]
-#![feature(no_core)]
-
// @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true"
mod mod1 {
extern "C" {
diff --git a/tests/rustdoc-json/reexport/glob_private.rs b/tests/rustdoc-json/reexport/glob_private.rs
index ae4e87d23..11ea5aa35 100644
--- a/tests/rustdoc-json/reexport/glob_private.rs
+++ b/tests/rustdoc-json/reexport/glob_private.rs
@@ -1,8 +1,5 @@
// edition:2018
-#![no_core]
-#![feature(no_core)]
-
// @is "$.index[*][?(@.name=='mod1')].inner.module.is_stripped" "true"
mod mod1 {
// @is "$.index[*][?(@.name=='mod2')].inner.module.is_stripped" "true"
diff --git a/tests/rustdoc-json/reexport/in_root_and_mod.rs b/tests/rustdoc-json/reexport/in_root_and_mod.rs
index f81445bd4..a4133e2f0 100644
--- a/tests/rustdoc-json/reexport/in_root_and_mod.rs
+++ b/tests/rustdoc-json/reexport/in_root_and_mod.rs
@@ -1,6 +1,3 @@
-#![feature(no_core)]
-#![no_core]
-
// @!has "$.index[*][?(@.name=='foo')]"
mod foo {
// @has "$.index[*][?(@.name=='Foo')]"
diff --git a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs
index c5c41b25f..37f7b26fc 100644
--- a/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs
+++ b/tests/rustdoc-json/reexport/in_root_and_mod_pub.rs
@@ -1,6 +1,3 @@
-#![feature(no_core)]
-#![no_core]
-
pub mod foo {
// @set bar_id = "$.index[*][?(@.name=='Bar')].id"
// @ismany "$.index[*][?(@.name=='foo')].inner.module.items[*]" $bar_id
diff --git a/tests/rustdoc-json/reexport/macro.rs b/tests/rustdoc-json/reexport/macro.rs
index ac0632b98..be09cb476 100644
--- a/tests/rustdoc-json/reexport/macro.rs
+++ b/tests/rustdoc-json/reexport/macro.rs
@@ -1,8 +1,5 @@
// edition:2018
-#![no_core]
-#![feature(no_core)]
-
// @set repro_id = "$.index[*][?(@.name=='repro')].id"
#[macro_export]
macro_rules! repro {
diff --git a/tests/rustdoc-json/reexport/mod_not_included.rs b/tests/rustdoc-json/reexport/mod_not_included.rs
index 1c49f213d..bc072be81 100644
--- a/tests/rustdoc-json/reexport/mod_not_included.rs
+++ b/tests/rustdoc-json/reexport/mod_not_included.rs
@@ -1,8 +1,5 @@
// Regression test for https://github.com/rust-lang/rust/issues/101103
-#![feature(no_core)]
-#![no_core]
-
mod m1 {
pub fn x() {}
}
diff --git a/tests/rustdoc-json/reexport/private_twice_one_inline.rs b/tests/rustdoc-json/reexport/private_twice_one_inline.rs
index 8c8152bd1..d7b766235 100644
--- a/tests/rustdoc-json/reexport/private_twice_one_inline.rs
+++ b/tests/rustdoc-json/reexport/private_twice_one_inline.rs
@@ -4,12 +4,8 @@
// Test for the ICE in https://github.com/rust-lang/rust/issues/83057
// An external type re-exported with different attributes shouldn't cause an error
-#![no_core]
-#![feature(no_core)]
-
extern crate pub_struct as foo;
#[doc(inline)]
-
// @set crate_use_id = "$.index[*][?(@.docs=='Hack A')].id"
// @set foo_id = "$.index[*][?(@.docs=='Hack A')].inner.import.id"
/// Hack A
diff --git a/tests/rustdoc-json/reexport/private_two_names.rs b/tests/rustdoc-json/reexport/private_two_names.rs
index cdcbf2a2b..e6f037eb4 100644
--- a/tests/rustdoc-json/reexport/private_two_names.rs
+++ b/tests/rustdoc-json/reexport/private_two_names.rs
@@ -3,9 +3,6 @@
// Test for the ICE in https://github.com/rust-lang/rust/issues/83720
// A pub-in-private type re-exported under two different names shouldn't cause an error
-#![no_core]
-#![feature(no_core)]
-
// @!has "$.index[*][?(@.name=='style')]"
mod style {
// @set color_struct_id = "$.index[*][?(@.inner.struct && @.name=='Color')].id"
diff --git a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs
index a2a25d084..15d194ef5 100644
--- a/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs
+++ b/tests/rustdoc-json/reexport/pub_use_doc_hidden.rs
@@ -1,15 +1,13 @@
// Regression test for <https://github.com/rust-lang/rust/issues/106379>
-#![feature(no_core)]
-#![no_core]
-
mod repeat_n {
#[doc(hidden)]
+ /// not here
pub struct RepeatN {}
}
+/// not here
pub use repeat_n::RepeatN;
// @count "$.index[*][?(@.name=='pub_use_doc_hidden')].inner.items[*]" 0
-// @!has "$.index[*][?(@.kind=='struct')]"
-// @!has "$.index[*][?(@.kind=='import')]"
+// @!has "$.index[*][?(@.docs == 'not here')]"
diff --git a/tests/rustdoc-json/reexport/reexport_of_hidden.rs b/tests/rustdoc-json/reexport/reexport_of_hidden.rs
new file mode 100644
index 000000000..1b6ff5fad
--- /dev/null
+++ b/tests/rustdoc-json/reexport/reexport_of_hidden.rs
@@ -0,0 +1,10 @@
+// compile-flags: --document-hidden-items
+
+// @has "$.index[*].inner[?(@.import.name=='UsedHidden')]"
+// @has "$.index[*][?(@.name=='Hidden')]"
+pub mod submodule {
+ #[doc(hidden)]
+ pub struct Hidden {}
+}
+
+pub use submodule::Hidden as UsedHidden;
diff --git a/tests/rustdoc-json/reexport/rename_private.rs b/tests/rustdoc-json/reexport/rename_private.rs
index 911446023..3924282a4 100644
--- a/tests/rustdoc-json/reexport/rename_private.rs
+++ b/tests/rustdoc-json/reexport/rename_private.rs
@@ -1,8 +1,5 @@
// edition:2018
-#![no_core]
-#![feature(no_core)]
-
// @!has "$.index[*][?(@.name=='inner')]"
mod inner {
// @has "$.index[*][?(@.name=='Public')]"
diff --git a/tests/rustdoc-json/reexport/rename_public.rs b/tests/rustdoc-json/reexport/rename_public.rs
index d0fd314bd..636937874 100644
--- a/tests/rustdoc-json/reexport/rename_public.rs
+++ b/tests/rustdoc-json/reexport/rename_public.rs
@@ -1,8 +1,5 @@
// edition:2018
-#![no_core]
-#![feature(no_core)]
-
// @set inner_id = "$.index[*][?(@.name=='inner')].id"
pub mod inner {
// @set public_id = "$.index[*][?(@.name=='Public')].id"
diff --git a/tests/rustdoc-json/reexport/same_name_different_types.rs b/tests/rustdoc-json/reexport/same_name_different_types.rs
index 6a765b733..42ba6c400 100644
--- a/tests/rustdoc-json/reexport/same_name_different_types.rs
+++ b/tests/rustdoc-json/reexport/same_name_different_types.rs
@@ -1,8 +1,5 @@
// Regression test for <https://github.com/rust-lang/rust/issues/107677>.
-#![feature(no_core)]
-#![no_core]
-
pub mod nested {
// @set foo_struct = "$.index[*][?(@.docs == 'Foo the struct')].id"
diff --git a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs
index a00547dc3..1e1710e1c 100644
--- a/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs
+++ b/tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs
@@ -2,9 +2,7 @@
// Regression test for <https://github.com/rust-lang/rust/issues/97432>.
-#![feature(no_core)]
#![no_std]
-#![no_core]
mod inner {
// @set trait_id = "$.index[*][?(@.name=='Trait')].id"
diff --git a/tests/rustdoc-json/reexport/simple_private.rs b/tests/rustdoc-json/reexport/simple_private.rs
index 462efee51..2ca8c7fa6 100644
--- a/tests/rustdoc-json/reexport/simple_private.rs
+++ b/tests/rustdoc-json/reexport/simple_private.rs
@@ -1,6 +1,4 @@
// edition:2018
-#![no_core]
-#![feature(no_core)]
// @!has "$.index[*][?(@.name=='inner')]"
mod inner {
diff --git a/tests/rustdoc-json/reexport/simple_public.rs b/tests/rustdoc-json/reexport/simple_public.rs
index 1373f96f8..04611eeb9 100644
--- a/tests/rustdoc-json/reexport/simple_public.rs
+++ b/tests/rustdoc-json/reexport/simple_public.rs
@@ -1,8 +1,5 @@
// edition:2018
-#![no_core]
-#![feature(no_core)]
-
// @set inner_id = "$.index[*][?(@.name=='inner')].id"
pub mod inner {
diff --git a/tests/rustdoc-json/return_private.rs b/tests/rustdoc-json/return_private.rs
index 0ce81b5e5..a9301b3fe 100644
--- a/tests/rustdoc-json/return_private.rs
+++ b/tests/rustdoc-json/return_private.rs
@@ -1,9 +1,6 @@
// Regression test for <https://github.com/rust-lang/rust/issues/96161>.
// ignore-tidy-linelength
-#![feature(no_core)]
-#![no_core]
-
mod secret {
pub struct Secret;
}
diff --git a/tests/rustdoc-json/stripped_modules.rs b/tests/rustdoc-json/stripped_modules.rs
index d2664b49e..d5ab1173d 100644
--- a/tests/rustdoc-json/stripped_modules.rs
+++ b/tests/rustdoc-json/stripped_modules.rs
@@ -1,6 +1,3 @@
-#![no_core]
-#![feature(no_core)]
-
// @!has "$.index[*][?(@.name=='no_pub_inner')]"
mod no_pub_inner {
fn priv_inner() {}
diff --git a/tests/rustdoc-json/traits/implementors.rs b/tests/rustdoc-json/traits/implementors.rs
index 7d351ad61..c27553c75 100644
--- a/tests/rustdoc-json/traits/implementors.rs
+++ b/tests/rustdoc-json/traits/implementors.rs
@@ -1,19 +1,18 @@
-#![feature(no_core)]
-#![no_core]
-
-// @set wham = "$.index[*][?(@.name=='Wham')].id"
-// @count "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" 1
-// @set gmWham = "$.index[*][?(@.name=='Wham')].inner.trait.implementations[0]"
pub trait Wham {}
-
-// @count "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" 1
-// @is "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[0]" $gmWham
-// @set gm = "$.index[*][?(@.name=='Wham')].id"
-
-// jsonpath_lib isnt expressive enough (for now) to get the "impl" item, so we
-// just check it isn't pointing to the type, but when you port to jsondocck-ng
-// check what the impl item is
-// @!is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[0]" $gm
pub struct GeorgeMichael {}
+/// Wham for George Michael
impl Wham for GeorgeMichael {}
+
+// Find IDs.
+// @set wham = "$.index[*][?(@.name=='Wham')].id"
+// @set gmWham = "$.index[*][?(@.docs=='Wham for George Michael')].id"
+// @set gm = "$.index[*][?(@.name=='GeorgeMichael')].id"
+
+// Both struct and trait point to impl.
+// @has "$.index[*][?(@.name=='GeorgeMichael')].inner.struct.impls[*]" $gmWham
+// @is "$.index[*][?(@.name=='Wham')].inner.trait.implementations[*]" $gmWham
+
+// Impl points to both struct and trait.
+// @is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.trait.id" $wham
+// @is "$.index[*][?(@.docs == 'Wham for George Michael')].inner.impl.for.resolved_path.id" $gm
diff --git a/tests/rustdoc-json/traits/private_supertrait.rs b/tests/rustdoc-json/traits/private_supertrait.rs
index 49238e5e8..67b5a858a 100644
--- a/tests/rustdoc-json/traits/private_supertrait.rs
+++ b/tests/rustdoc-json/traits/private_supertrait.rs
@@ -1,9 +1,5 @@
// ignore-tidy-linelength
-#![feature(no_core)]
-#![no_core]
-
-
// @!has "$.index[*][?(@.name == 'sealed')]"
mod sealed {
// @set sealed_id = "$.index[*][?(@.name=='Sealed')].id"
diff --git a/tests/rustdoc-json/traits/supertrait.rs b/tests/rustdoc-json/traits/supertrait.rs
index 2123ac404..bbae3557c 100644
--- a/tests/rustdoc-json/traits/supertrait.rs
+++ b/tests/rustdoc-json/traits/supertrait.rs
@@ -1,9 +1,5 @@
// ignore-tidy-linelength
-#![feature(no_core)]
-#![feature(lang_items)]
-#![no_core]
-
// @set loud_id = "$.index[*][?(@.name=='Loud')].id"
pub trait Loud {}
diff --git a/tests/rustdoc-json/type/inherent_associated_type.rs b/tests/rustdoc-json/type/inherent_associated_type.rs
index 64c6c53ce..f86031479 100644
--- a/tests/rustdoc-json/type/inherent_associated_type.rs
+++ b/tests/rustdoc-json/type/inherent_associated_type.rs
@@ -1,8 +1,6 @@
// ignore-tidy-linelength
#![feature(inherent_associated_types)]
-#![feature(no_core)]
#![allow(incomplete_features)]
-#![no_core]
// @set OwnerMetadata = '$.index[*][?(@.name=="OwnerMetadata")].id'
pub struct OwnerMetadata;
diff --git a/tests/rustdoc-json/type/inherent_associated_type_bound.rs b/tests/rustdoc-json/type/inherent_associated_type_bound.rs
index 8e39f4718..6da23c8fb 100644
--- a/tests/rustdoc-json/type/inherent_associated_type_bound.rs
+++ b/tests/rustdoc-json/type/inherent_associated_type_bound.rs
@@ -16,5 +16,5 @@ pub struct Carrier<'a>(&'a ());
pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {}
impl<'a> Carrier<'a> {
- pub type Focus<T> = &'a mut T;
+ pub type Focus<T> = &'a mut T where T: 'a;
}
diff --git a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs
index 5c500ce6c..806b6d125 100644
--- a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs
+++ b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs
@@ -1,2 +1,2 @@
// check-fail
-// compile-flags: --check-cfg=names()
+// compile-flags: --check-cfg=cfg()
diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.rs b/tests/rustdoc-ui/check-cfg/check-cfg.rs
index fa8789ad3..96fa9e08d 100644
--- a/tests/rustdoc-ui/check-cfg/check-cfg.rs
+++ b/tests/rustdoc-ui/check-cfg/check-cfg.rs
@@ -1,5 +1,5 @@
// check-pass
-// compile-flags: --check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
/// uniz is nor a builtin nor pass as arguments so is unexpected
#[cfg(uniz)]
diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.stderr b/tests/rustdoc-ui/check-cfg/check-cfg.stderr
index 03fb6f96f..d010c1f7e 100644
--- a/tests/rustdoc-ui/check-cfg/check-cfg.stderr
+++ b/tests/rustdoc-ui/check-cfg/check-cfg.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `uniz`
--> $DIR/check-cfg.rs:5:7
|
LL | #[cfg(uniz)]
diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr
index 4f2ded78c..ad0498042 100644
--- a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr
+++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr
@@ -28,6 +28,8 @@ LL | |
LL | | /// main;
LL | | /// ```
| |_______^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.rs b/tests/rustdoc-ui/doctest/check-cfg-test.rs
index 49a801c3f..38cd59aa7 100644
--- a/tests/rustdoc-ui/doctest/check-cfg-test.rs
+++ b/tests/rustdoc-ui/doctest/check-cfg-test.rs
@@ -1,5 +1,5 @@
// check-pass
-// compile-flags: --test --nocapture --check-cfg=values(feature,"test") -Z unstable-options
+// compile-flags: --test --nocapture --check-cfg=cfg(feature,values("test")) -Z unstable-options
// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.stderr b/tests/rustdoc-ui/doctest/check-cfg-test.stderr
index f84543c20..0bfd569e3 100644
--- a/tests/rustdoc-ui/doctest/check-cfg-test.stderr
+++ b/tests/rustdoc-ui/doctest/check-cfg-test.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `invalid`
--> $DIR/check-cfg-test.rs:9:7
|
LL | #[cfg(feature = "invalid")]
diff --git a/tests/rustdoc-ui/error-in-impl-trait/closure.rs b/tests/rustdoc-ui/error-in-impl-trait/closure.rs
index f1fd85bb2..628c61a6a 100644
--- a/tests/rustdoc-ui/error-in-impl-trait/closure.rs
+++ b/tests/rustdoc-ui/error-in-impl-trait/closure.rs
@@ -1,5 +1,5 @@
// check-pass
-// manually desugared version of an `async fn` (but with a closure instead of a generator)
+// manually desugared version of an `async fn` (but with a closure instead of a coroutine)
pub fn a() -> impl Fn() -> u32 {
|| content::doesnt::matter()
}
diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs
index e49fe0798..7151ebd59 100644
--- a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs
+++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs
@@ -1,7 +1,6 @@
-// check-pass
-
pub fn f() -> impl Sized {
pub enum E {
+ //~^ ERROR: recursive type
V(E),
}
diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.stderr b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.stderr
new file mode 100644
index 000000000..edb5dfd4d
--- /dev/null
+++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.stderr
@@ -0,0 +1,17 @@
+error[E0072]: recursive type `f::E` has infinite size
+ --> $DIR/infinite-recursive-type-2.rs:2:5
+ |
+LL | pub enum E {
+ | ^^^^^^^^^^
+LL |
+LL | V(E),
+ | - recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | V(Box<E>),
+ | ++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs
index 096130d77..1f8550517 100644
--- a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs
+++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs
@@ -1,7 +1,6 @@
-// check-pass
-
fn f() -> impl Sized {
enum E {
+ //~^ ERROR: recursive type
V(E),
}
diff --git a/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.stderr b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.stderr
new file mode 100644
index 000000000..349a56941
--- /dev/null
+++ b/tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.stderr
@@ -0,0 +1,17 @@
+error[E0072]: recursive type `f::E` has infinite size
+ --> $DIR/infinite-recursive-type.rs:2:5
+ |
+LL | enum E {
+ | ^^^^^^
+LL |
+LL | V(E),
+ | - recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | V(Box<E>),
+ | ++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/rustdoc/issue-31808.rs b/tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs
index e55c5bd4f..6e4709403 100644
--- a/tests/rustdoc/issue-31808.rs
+++ b/tests/rustdoc-ui/ice-assoc-const-for-primitive-31808.rs
@@ -1,5 +1,10 @@
+// check-pass
+
// Test that associated item impls on primitive types don't crash rustdoc
+// https://github.com/rust-lang/rust/issues/31808
+#![crate_name="issue_31808"]
+
pub trait Foo {
const BAR: usize;
type BAZ;
diff --git a/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.stderr b/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.stderr
index 83e0d3962..b25849f25 100644
--- a/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.stderr
+++ b/tests/rustdoc-ui/intra-doc/broken-link-in-unused-doc-string.stderr
@@ -22,6 +22,7 @@ LL | /// [1]
| ^ no item named `1` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs b/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs
index c3f4fd63b..07fc239a8 100644
--- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs
+++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.rs
@@ -4,3 +4,8 @@ trait X {
fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
//~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
//~| ERROR associated type takes 0 generic arguments but 1 generic argument
+//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
+//~| ERROR associated type takes 0 generic arguments but 1 generic argument
+//~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments
+//~| ERROR associated type takes 0 generic arguments but 1 generic argument
+//~| ERROR trait `X` cannot be made into an object
diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
index 527729a82..50d552847 100644
--- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
+++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
@@ -28,6 +28,86 @@ note: associated type defined here, with 0 generic parameters
LL | type Y<'a>;
| ^
-error: aborting due to 2 previous errors
+error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:26
+ |
+LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
+ | ^ expected 1 lifetime argument
+ |
+note: associated type defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
+ |
+LL | type Y<'a>;
+ | ^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing lifetime argument
+ |
+LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
+ | +++
+
+error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:26
+ |
+LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
+ | ^--- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: associated type defined here, with 0 generic parameters
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
+ |
+LL | type Y<'a>;
+ | ^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:26
+ |
+LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
+ | ^ expected 1 lifetime argument
+ |
+note: associated type defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
+ |
+LL | type Y<'a>;
+ | ^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing lifetime argument
+ |
+LL | fn f<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {}
+ | +++
+
+error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:26
+ |
+LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
+ | ^--- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: associated type defined here, with 0 generic parameters
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
+ |
+LL | type Y<'a>;
+ | ^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0038]: the trait `X` cannot be made into an object
+ --> $DIR/invalid_const_in_lifetime_position.rs:4:20
+ |
+LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
+ | ^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object
+ |
+note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+ --> $DIR/invalid_const_in_lifetime_position.rs:2:10
+ |
+LL | trait X {
+ | - this trait cannot be made into an object...
+LL | type Y<'a>;
+ | ^ ...because it contains the generic associated type `Y`
+ = help: consider moving `Y` to another trait
+
+error: aborting due to 7 previous errors
-For more information about this error, try `rustc --explain E0107`.
+Some errors have detailed explanations: E0038, E0107.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/tests/rustdoc-ui/issues/issue-105742.rs b/tests/rustdoc-ui/issues/issue-105742.rs
index 1fbb70c78..5e493515c 100644
--- a/tests/rustdoc-ui/issues/issue-105742.rs
+++ b/tests/rustdoc-ui/issues/issue-105742.rs
@@ -21,6 +21,8 @@ pub trait SVec: Index<
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
+ //~| missing generics for associated type `SVec::Item`
+ //~| missing generics for associated type `SVec::Item`
Output = <Index<<Self as SVec>::Item,
//~^ expected 1 lifetime argument
//~| expected 1 generic argument
@@ -30,6 +32,8 @@ pub trait SVec: Index<
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
+ //~| missing generics for associated type `SVec::Item`
+ //~| missing generics for associated type `SVec::Item`
Output = <Self as SVec>::Item> as SVec>::Item,
//~^ expected 1 lifetime argument
//~| expected 1 generic argument
@@ -47,6 +51,10 @@ pub trait SVec: Index<
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
//~| missing generics for associated type `SVec::Item`
+ //~| missing generics for associated type `SVec::Item`
+ //~| missing generics for associated type `SVec::Item`
+ //~| missing generics for associated type `SVec::Item`
+ //~| missing generics for associated type `SVec::Item`
> {
type Item<'a, T>;
diff --git a/tests/rustdoc-ui/issues/issue-105742.stderr b/tests/rustdoc-ui/issues/issue-105742.stderr
index b63176c91..ad1020a1f 100644
--- a/tests/rustdoc-ui/issues/issue-105742.stderr
+++ b/tests/rustdoc-ui/issues/issue-105742.stderr
@@ -5,7 +5,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
@@ -21,7 +21,7 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
@@ -31,13 +31,13 @@ LL | <Self as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:24:37
+ --> $DIR/issue-105742.rs:26:37
|
LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
@@ -47,13 +47,13 @@ LL | Output = <Index<<Self as SVec>::Item<'a>,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:24:37
+ --> $DIR/issue-105742.rs:26:37
|
LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
@@ -63,13 +63,13 @@ LL | Output = <Index<<Self as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:30
+ --> $DIR/issue-105742.rs:37:30
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
@@ -79,13 +79,13 @@ LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:30
+ --> $DIR/issue-105742.rs:37:30
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
@@ -95,13 +95,13 @@ LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:46
+ --> $DIR/issue-105742.rs:37:46
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
@@ -111,13 +111,13 @@ LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:46
+ --> $DIR/issue-105742.rs:37:46
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
@@ -133,7 +133,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
@@ -149,7 +149,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
@@ -165,10 +165,11 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | <Self as SVec>::Item<'a>,
@@ -181,106 +182,113 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | <Self as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:24:37
+ --> $DIR/issue-105742.rs:26:37
|
LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | Output = <Index<<Self as SVec>::Item<'a>,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:24:37
+ --> $DIR/issue-105742.rs:26:37
|
LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | Output = <Index<<Self as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:30
+ --> $DIR/issue-105742.rs:37:30
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:30
+ --> $DIR/issue-105742.rs:37:30
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:46
+ --> $DIR/issue-105742.rs:37:46
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:46
+ --> $DIR/issue-105742.rs:37:46
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
@@ -323,10 +331,11 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | <Self as SVec>::Item<'a>,
@@ -339,119 +348,126 @@ LL | <Self as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | <Self as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:24:37
+ --> $DIR/issue-105742.rs:26:37
|
LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | Output = <Index<<Self as SVec>::Item<'a>,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:24:37
+ --> $DIR/issue-105742.rs:26:37
|
LL | Output = <Index<<Self as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | Output = <Index<<Self as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:30
+ --> $DIR/issue-105742.rs:37:30
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:30
+ --> $DIR/issue-105742.rs:37:30
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:46
+ --> $DIR/issue-105742.rs:37:46
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:33:46
+ --> $DIR/issue-105742.rs:37:46
|
LL | Output = <Self as SVec>::Item> as SVec>::Item,
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing generic argument
|
LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
| +++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:53:38
+ --> $DIR/issue-105742.rs:61:38
|
LL | fn len(&self) -> <Self as SVec>::Item;
| ^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ --
@@ -461,13 +477,13 @@ LL | fn len(&self) -> <Self as SVec>::Item<'_>;
| ++++
error[E0107]: missing generics for associated type `SVec::Item`
- --> $DIR/issue-105742.rs:53:38
+ --> $DIR/issue-105742.rs:61:38
|
LL | fn len(&self) -> <Self as SVec>::Item;
| ^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
- --> $DIR/issue-105742.rs:51:10
+ --> $DIR/issue-105742.rs:59:10
|
LL | type Item<'a, T>;
| ^^^^ -
@@ -476,7 +492,143 @@ help: add missing generic argument
LL | fn len(&self) -> <Self as SVec>::Item<T>;
| +++
-error: aborting due to 29 previous errors
+error[E0107]: missing generics for associated type `SVec::Item`
+ --> $DIR/issue-105742.rs:15:21
+ |
+LL | <Self as SVec>::Item,
+ | ^^^^ expected 1 lifetime argument
+ |
+note: associated type defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/issue-105742.rs:59:10
+ |
+LL | type Item<'a, T>;
+ | ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing lifetime argument
+ |
+LL | <Self as SVec>::Item<'a>,
+ | ++++
+
+error[E0107]: missing generics for associated type `SVec::Item`
+ --> $DIR/issue-105742.rs:15:21
+ |
+LL | <Self as SVec>::Item,
+ | ^^^^ expected 1 generic argument
+ |
+note: associated type defined here, with 1 generic parameter: `T`
+ --> $DIR/issue-105742.rs:59:10
+ |
+LL | type Item<'a, T>;
+ | ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing generic argument
+ |
+LL | <Self as SVec>::Item<T>,
+ | +++
+
+error[E0107]: missing generics for associated type `SVec::Item`
+ --> $DIR/issue-105742.rs:26:37
+ |
+LL | Output = <Index<<Self as SVec>::Item,
+ | ^^^^ expected 1 lifetime argument
+ |
+note: associated type defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/issue-105742.rs:59:10
+ |
+LL | type Item<'a, T>;
+ | ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing lifetime argument
+ |
+LL | Output = <Index<<Self as SVec>::Item<'a>,
+ | ++++
+
+error[E0107]: missing generics for associated type `SVec::Item`
+ --> $DIR/issue-105742.rs:26:37
+ |
+LL | Output = <Index<<Self as SVec>::Item,
+ | ^^^^ expected 1 generic argument
+ |
+note: associated type defined here, with 1 generic parameter: `T`
+ --> $DIR/issue-105742.rs:59:10
+ |
+LL | type Item<'a, T>;
+ | ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing generic argument
+ |
+LL | Output = <Index<<Self as SVec>::Item<T>,
+ | +++
+
+error[E0107]: missing generics for associated type `SVec::Item`
+ --> $DIR/issue-105742.rs:37:30
+ |
+LL | Output = <Self as SVec>::Item> as SVec>::Item,
+ | ^^^^ expected 1 lifetime argument
+ |
+note: associated type defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/issue-105742.rs:59:10
+ |
+LL | type Item<'a, T>;
+ | ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing lifetime argument
+ |
+LL | Output = <Self as SVec>::Item<'a>> as SVec>::Item,
+ | ++++
+
+error[E0107]: missing generics for associated type `SVec::Item`
+ --> $DIR/issue-105742.rs:37:30
+ |
+LL | Output = <Self as SVec>::Item> as SVec>::Item,
+ | ^^^^ expected 1 generic argument
+ |
+note: associated type defined here, with 1 generic parameter: `T`
+ --> $DIR/issue-105742.rs:59:10
+ |
+LL | type Item<'a, T>;
+ | ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing generic argument
+ |
+LL | Output = <Self as SVec>::Item<T>> as SVec>::Item,
+ | +++
+
+error[E0107]: missing generics for associated type `SVec::Item`
+ --> $DIR/issue-105742.rs:37:46
+ |
+LL | Output = <Self as SVec>::Item> as SVec>::Item,
+ | ^^^^ expected 1 lifetime argument
+ |
+note: associated type defined here, with 1 lifetime parameter: `'a`
+ --> $DIR/issue-105742.rs:59:10
+ |
+LL | type Item<'a, T>;
+ | ^^^^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing lifetime argument
+ |
+LL | Output = <Self as SVec>::Item> as SVec>::Item<'a>,
+ | ++++
+
+error[E0107]: missing generics for associated type `SVec::Item`
+ --> $DIR/issue-105742.rs:37:46
+ |
+LL | Output = <Self as SVec>::Item> as SVec>::Item,
+ | ^^^^ expected 1 generic argument
+ |
+note: associated type defined here, with 1 generic parameter: `T`
+ --> $DIR/issue-105742.rs:59:10
+ |
+LL | type Item<'a, T>;
+ | ^^^^ -
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: add missing generic argument
+ |
+LL | Output = <Self as SVec>::Item> as SVec>::Item<T>,
+ | +++
+
+error: aborting due to 37 previous errors
Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`.
diff --git a/tests/rustdoc-ui/issues/issue-107918.rs b/tests/rustdoc-ui/issues/issue-107918.rs
index 13788df0f..0ddb3dc92 100644
--- a/tests/rustdoc-ui/issues/issue-107918.rs
+++ b/tests/rustdoc-ui/issues/issue-107918.rs
@@ -1,7 +1,7 @@
// aux-build:panic-handler.rs
// compile-flags: --document-private-items
// build-pass
-// ignore-windows
+// only-linux
#![no_std]
#![no_main]
diff --git a/tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout b/tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout
index bbf66a315..6021bce69 100644
--- a/tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout
+++ b/tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout
@@ -14,11 +14,11 @@ Lint groups provided by rustc:
$NAMES $SUB_LINTS
-Lint checks provided by plugins loaded by this crate:
+Lint checks loaded by this crate:
$NAMES $LEVELS $MEANINGS
-Lint groups provided by plugins loaded by this crate:
+Lint groups loaded by this crate:
$NAMES $SUB_LINTS
diff --git a/tests/rustdoc-ui/issues/issue-96287.stderr b/tests/rustdoc-ui/issues/issue-96287.stderr
index 7722eb960..c4809a311 100644
--- a/tests/rustdoc-ui/issues/issue-96287.stderr
+++ b/tests/rustdoc-ui/issues/issue-96287.stderr
@@ -2,7 +2,12 @@ error[E0220]: associated type `Assoc` not found for `V`
--> $DIR/issue-96287.rs:7:33
|
LL | pub type Foo<V> = impl Trait<V::Assoc>;
- | ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc`
+ | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc`
+ |
+help: consider restricting type parameter `V`
+ |
+LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
+ | ++++++++++++++++
error: aborting due to previous error
diff --git a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs
index c34ea0567..ce94a06c3 100644
--- a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs
+++ b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs
@@ -1,12 +1,7 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
#![deny(unknown_lints)]
//~^ NOTE defined here
#![allow(rustdoc::missing_doc_code_examples)]
//~^ ERROR unknown lint
-//~| ERROR unknown lint
-//~| ERROR unknown lint
//~| NOTE lint is unstable
-//~| NOTE lint is unstable
-//~| NOTE lint is unstable
-//~| NOTE see issue
-//~| NOTE see issue
//~| NOTE see issue
diff --git a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr
index 326dcfe3b..b8a08e943 100644
--- a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr
+++ b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr
@@ -1,5 +1,5 @@
error: unknown lint: `rustdoc::missing_doc_code_examples`
- --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:3:1
+ --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:4:1
|
LL | #![allow(rustdoc::missing_doc_code_examples)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,30 +8,10 @@ LL | #![allow(rustdoc::missing_doc_code_examples)]
= note: see issue #101730 <https://github.com/rust-lang/rust/issues/101730> for more information
= help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable
note: the lint level is defined here
- --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:1:9
+ --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:2:9
|
LL | #![deny(unknown_lints)]
| ^^^^^^^^^^^^^
-error: unknown lint: `rustdoc::missing_doc_code_examples`
- --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:3:1
- |
-LL | #![allow(rustdoc::missing_doc_code_examples)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `rustdoc::missing_doc_code_examples` lint is unstable
- = note: see issue #101730 <https://github.com/rust-lang/rust/issues/101730> for more information
- = help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable
-
-error: unknown lint: `rustdoc::missing_doc_code_examples`
- --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:3:1
- |
-LL | #![allow(rustdoc::missing_doc_code_examples)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: the `rustdoc::missing_doc_code_examples` lint is unstable
- = note: see issue #101730 <https://github.com/rust-lang/rust/issues/101730> for more information
- = help: add `#![feature(rustdoc_missing_doc_code_examples)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
+error: aborting due to previous error
diff --git a/tests/rustdoc/not-wf-ambiguous-normalization.rs b/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs
index 1e9f925f8..3e4825d83 100644
--- a/tests/rustdoc/not-wf-ambiguous-normalization.rs
+++ b/tests/rustdoc-ui/not-wf-ambiguous-normalization.rs
@@ -12,6 +12,7 @@ struct DefaultAllocator;
// `<DefaultAllocator as Allocator>::Buffer` to be ambiguous,
// which caused an ICE with `-Znormalize-docs`.
impl<T> Allocator for DefaultAllocator {
+ //~^ ERROR: type annotations needed
type Buffer = ();
}
diff --git a/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr b/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr
new file mode 100644
index 000000000..34b20a0b3
--- /dev/null
+++ b/tests/rustdoc-ui/not-wf-ambiguous-normalization.stderr
@@ -0,0 +1,9 @@
+error[E0282]: type annotations needed
+ --> $DIR/not-wf-ambiguous-normalization.rs:14:23
+ |
+LL | impl<T> Allocator for DefaultAllocator {
+ | ^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/rustdoc-ui/recursive-deref-ice.rs b/tests/rustdoc-ui/recursive-deref-ice.rs
index c44fd27f4..9e62841f9 100644
--- a/tests/rustdoc-ui/recursive-deref-ice.rs
+++ b/tests/rustdoc-ui/recursive-deref-ice.rs
@@ -4,7 +4,10 @@
pub struct Attribute;
-pub struct Map<'hir> {}
+pub struct Map<'hir> {
+ lt: &'hir (),
+}
+
impl<'hir> Map<'hir> {
pub fn attrs(&self) -> &'hir [Attribute] { &[] }
}
diff --git a/tests/rustdoc-ui/unable-fulfill-trait.rs b/tests/rustdoc-ui/unable-fulfill-trait.rs
index 703570822..10887ab19 100644
--- a/tests/rustdoc-ui/unable-fulfill-trait.rs
+++ b/tests/rustdoc-ui/unable-fulfill-trait.rs
@@ -3,7 +3,8 @@
pub struct Foo<'a, 'b, T> {
field1: dyn Bar<'a, 'b,>,
//~^ ERROR
- //~^^ ERROR
+ //~| ERROR
+ //~| ERROR
}
pub trait Bar<'x, 's, U>
diff --git a/tests/rustdoc-ui/unable-fulfill-trait.stderr b/tests/rustdoc-ui/unable-fulfill-trait.stderr
index 72f35cb92..d7735a4fd 100644
--- a/tests/rustdoc-ui/unable-fulfill-trait.stderr
+++ b/tests/rustdoc-ui/unable-fulfill-trait.stderr
@@ -5,7 +5,7 @@ LL | field1: dyn Bar<'a, 'b,>,
| ^^^ expected 1 generic argument
|
note: trait defined here, with 1 generic parameter: `U`
- --> $DIR/unable-fulfill-trait.rs:9:11
+ --> $DIR/unable-fulfill-trait.rs:10:11
|
LL | pub trait Bar<'x, 's, U>
| ^^^ -
@@ -20,7 +20,24 @@ error[E0227]: ambiguous lifetime bound, explicit lifetime bound required
LL | field1: dyn Bar<'a, 'b,>,
| ^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error[E0478]: lifetime bound not satisfied
+ --> $DIR/unable-fulfill-trait.rs:4:13
+ |
+LL | field1: dyn Bar<'a, 'b,>,
+ | ^^^^^^^^^^^^^^^^
+ |
+note: lifetime parameter instantiated with the lifetime `'b` as defined here
+ --> $DIR/unable-fulfill-trait.rs:3:20
+ |
+LL | pub struct Foo<'a, 'b, T> {
+ | ^^
+note: but lifetime parameter must outlive the lifetime `'a` as defined here
+ --> $DIR/unable-fulfill-trait.rs:3:16
+ |
+LL | pub struct Foo<'a, 'b, T> {
+ | ^^
+
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0107, E0227.
+Some errors have detailed explanations: E0107, E0227, E0478.
For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/rustdoc-ui/unescaped_backticks.stderr b/tests/rustdoc-ui/unescaped_backticks.stderr
index 83822f778..2b4e491b1 100644
--- a/tests/rustdoc-ui/unescaped_backticks.stderr
+++ b/tests/rustdoc-ui/unescaped_backticks.stderr
@@ -302,6 +302,7 @@ LL | | /// level changes.
= help: if you meant to use a literal backtick, escape it
change: or `None` if it isn't.
to this: or `None\` if it isn't.
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unescaped backtick
--> $DIR/unescaped_backticks.rs:323:5
@@ -321,6 +322,7 @@ LL | | /// level changes.
= help: if you meant to use a literal backtick, escape it
change: `on_event` should be called.
to this: `on_event\` should be called.
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unescaped backtick
--> $DIR/unescaped_backticks.rs:323:5
@@ -340,6 +342,7 @@ LL | | /// level changes.
= help: if you meant to use a literal backtick, escape it
change: [`rebuild_interest_cache`][rebuild] is called after the value of the max
to this: [`rebuild_interest_cache\`][rebuild] is called after the value of the max
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unescaped backtick
--> $DIR/unescaped_backticks.rs:349:56
diff --git a/tests/rustdoc/issue-25001.rs b/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs
index 268fae594..ffb0765d3 100644
--- a/tests/rustdoc/issue-25001.rs
+++ b/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/25001
+#![crate_name="issue_25001"]
+
// @has issue_25001/struct.Foo.html
pub struct Foo<T>(T);
diff --git a/tests/rustdoc/issue-28478.rs b/tests/rustdoc/anchor-id-trait-tymethod-28478.rs
index 497276e68..5685040dc 100644
--- a/tests/rustdoc/issue-28478.rs
+++ b/tests/rustdoc/anchor-id-trait-tymethod-28478.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/28478
+#![crate_name="issue_28478"]
+
#![feature(associated_type_defaults)]
// @has issue_28478/trait.Bar.html
diff --git a/tests/rustdoc/async-trait-sig.rs b/tests/rustdoc/async-trait-sig.rs
index 2578bc8f7..db1848f71 100644
--- a/tests/rustdoc/async-trait-sig.rs
+++ b/tests/rustdoc/async-trait-sig.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {
diff --git a/tests/rustdoc/async-trait.rs b/tests/rustdoc/async-trait.rs
index a473e4674..8de95aac2 100644
--- a/tests/rustdoc/async-trait.rs
+++ b/tests/rustdoc/async-trait.rs
@@ -1,7 +1,6 @@
// aux-build:async-trait-dep.rs
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
extern crate async_trait_dep;
diff --git a/tests/rustdoc/auxiliary/async-trait-dep.rs b/tests/rustdoc/auxiliary/async-trait-dep.rs
index 10a55dd02..d455ee99e 100644
--- a/tests/rustdoc/auxiliary/async-trait-dep.rs
+++ b/tests/rustdoc/auxiliary/async-trait-dep.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait Meow {
diff --git a/tests/rustdoc/auxiliary/enum-variant.rs b/tests/rustdoc/auxiliary/enum-variant.rs
new file mode 100644
index 000000000..a0a7fd894
--- /dev/null
+++ b/tests/rustdoc/auxiliary/enum-variant.rs
@@ -0,0 +1,48 @@
+#![crate_name = "bar"]
+
+pub enum E {
+ A = 12,
+ B,
+ C = 1245,
+}
+
+pub enum F {
+ A,
+ B,
+}
+
+#[repr(u32)]
+pub enum G {
+ A = 12,
+ B,
+ C(u32),
+}
+
+pub enum H {
+ A,
+ C(u32),
+}
+
+#[repr(C)]
+pub enum N {
+ A,
+ B,
+}
+
+#[repr(C)]
+pub enum O {
+ A(u32),
+ B,
+}
+
+#[repr(u32)]
+pub enum P {
+ A,
+ B,
+}
+
+#[repr(u32)]
+pub enum Q {
+ A(u32),
+ B,
+}
diff --git a/tests/rustdoc/issue-29503.rs b/tests/rustdoc/blanket-impl-29503.rs
index 01ae44385..d6a132e1c 100644
--- a/tests/rustdoc/issue-29503.rs
+++ b/tests/rustdoc/blanket-impl-29503.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/29503
+#![crate_name="issue_29503"]
+
use std::fmt;
// @has issue_29503/trait.MyTrait.html
diff --git a/tests/rustdoc/blanket-reexport-item.rs b/tests/rustdoc/blanket-reexport-item.rs
index 437f0001f..315a38c30 100644
--- a/tests/rustdoc/blanket-reexport-item.rs
+++ b/tests/rustdoc/blanket-reexport-item.rs
@@ -1,6 +1,6 @@
#![crate_name = "foo"]
-// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-S"]//h3[@class="code-header"]' 'impl<T, U> Into<U> for T'
+// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-T"]//h3[@class="code-header"]' 'impl<T, U> Into<U> for T'
pub struct S2 {}
mod m {
pub struct S {}
diff --git a/tests/rustdoc/const-effect-param.rs b/tests/rustdoc/const-effect-param.rs
index f50a9b96d..b6379c05a 100644
--- a/tests/rustdoc/const-effect-param.rs
+++ b/tests/rustdoc/const-effect-param.rs
@@ -1,3 +1,5 @@
+// Check that we don't render host effect parameters & arguments.
+
#![crate_name = "foo"]
#![feature(effects, const_trait_impl)]
diff --git a/tests/rustdoc/const-generics/add-impl.rs b/tests/rustdoc/const-generics/add-impl.rs
index 195e47bc8..df490d2c6 100644
--- a/tests/rustdoc/const-generics/add-impl.rs
+++ b/tests/rustdoc/const-generics/add-impl.rs
@@ -7,7 +7,7 @@ pub struct Simd<T, const WIDTH: usize> {
inner: T,
}
-// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl Add<Simd<u8, 16>> for Simd<u8, 16>'
+// @has foo/struct.Simd.html '//div[@id="trait-implementations-list"]//h3[@class="code-header"]' 'impl Add for Simd<u8, 16>'
impl Add for Simd<u8, 16> {
type Output = Self;
diff --git a/tests/rustdoc/const-generics/const-impl.rs b/tests/rustdoc/const-generics/const-impl.rs
index 152b643bf..f4eefcc1c 100644
--- a/tests/rustdoc/const-generics/const-impl.rs
+++ b/tests/rustdoc/const-generics/const-impl.rs
@@ -2,7 +2,9 @@
#![feature(adt_const_params)]
#![crate_name = "foo"]
-#[derive(PartialEq, Eq)]
+use std::marker::ConstParamTy;
+
+#[derive(PartialEq, Eq, ConstParamTy)]
pub enum Order {
Sorted,
Unsorted,
@@ -31,7 +33,7 @@ impl<T> VSet<T, { Order::Unsorted }> {
pub struct Escape<const S: &'static str>;
-// @has foo/struct.Escape.html '//*[@id="impl-Escape%3Cr%23%22%3Cscript%3Ealert(%22Escape%22);%3C/script%3E%22%23%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
+// @has foo/struct.Escape.html '//*[@id="impl-Escape%3C%22%3Cscript%3Ealert(%5C%22Escape%5C%22);%3C/script%3E%22%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
impl Escape<r#"<script>alert("Escape");</script>"#> {
pub fn f() {}
}
diff --git a/tests/rustdoc/issue-33302.rs b/tests/rustdoc/const-rendering-macros-33302.rs
index a316f3ad9..0f5cb9214 100644
--- a/tests/rustdoc/issue-33302.rs
+++ b/tests/rustdoc/const-rendering-macros-33302.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/33302
+#![crate_name="issue_33302"]
+
// Ensure constant and array length values are not taken from source
// code, which wreaks havoc with macros.
diff --git a/tests/rustdoc/crate-version-escape.rs b/tests/rustdoc/crate-version-escape.rs
index 8413709f1..f134d9baa 100644
--- a/tests/rustdoc/crate-version-escape.rs
+++ b/tests/rustdoc/crate-version-escape.rs
@@ -2,4 +2,4 @@
#![crate_name = "foo"]
-// @has 'foo/index.html' '//li[@class="version"]' 'Version <script>alert("hi")</script>'
+// @has 'foo/index.html' '//*[@class="version"]' '<script>alert("hi")</script>'
diff --git a/tests/rustdoc/crate-version-extra.rs b/tests/rustdoc/crate-version-extra.rs
new file mode 100644
index 000000000..72a2c4ba5
--- /dev/null
+++ b/tests/rustdoc/crate-version-extra.rs
@@ -0,0 +1,7 @@
+// compile-flags: '--crate-version=1.3.37-nightly (203c57dbe 2023-09-17)'
+
+#![crate_name="foo"]
+
+// main version next to logo, extra version data below it
+// @has 'foo/index.html' '//h2/span[@class="version"]' '1.3.37-nightly'
+// @has 'foo/index.html' '//nav[@class="sidebar"]/div[@class="version"]' '(203c57dbe 2023-09-17)'
diff --git a/tests/rustdoc/crate-version.rs b/tests/rustdoc/crate-version.rs
index 2592c9853..d4be845b7 100644
--- a/tests/rustdoc/crate-version.rs
+++ b/tests/rustdoc/crate-version.rs
@@ -1,3 +1,3 @@
// compile-flags: --crate-version=1.3.37
-// @has 'crate_version/index.html' '//*[@class="version"]' 'Version 1.3.37'
+// @has 'crate_version/index.html' '//*[@class="version"]' '1.3.37'
diff --git a/tests/rustdoc/decl-trailing-whitespace.declaration.html b/tests/rustdoc/decl-trailing-whitespace.declaration.html
index d73393633..59c318c16 100644
--- a/tests/rustdoc/decl-trailing-whitespace.declaration.html
+++ b/tests/rustdoc/decl-trailing-whitespace.declaration.html
@@ -1,22 +1,16 @@
<code>pub trait Write {
// Required methods
fn <a href="#tymethod.poll_write" class="fn">poll_write</a>(
- self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
+ self,
cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
buf: &amp;mut [<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]
) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
-<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>(
- self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
- cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;
- ) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
-<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>(
- self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
- cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;
- ) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
+<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>(self, cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
+<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>(self, cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
// Provided method
fn <a href="#method.poll_write_vectored" class="fn">poll_write_vectored</a>(
- self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
+ self,
cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
bufs: &amp;[<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]
) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt; { ... }
diff --git a/tests/rustdoc/decl-trailing-whitespace.rs b/tests/rustdoc/decl-trailing-whitespace.rs
index d2a12435d..667837743 100644
--- a/tests/rustdoc/decl-trailing-whitespace.rs
+++ b/tests/rustdoc/decl-trailing-whitespace.rs
@@ -9,21 +9,21 @@ pub struct Error;
pub trait Write {
// @snapshot 'declaration' - '//*[@class="rust item-decl"]//code'
fn poll_write(
- self: Option<String>,
+ self,
cx: &mut Option<String>,
buf: &mut [usize]
) -> Option<Result<usize, Error>>;
fn poll_flush(
- self: Option<String>,
+ self,
cx: &mut Option<String>
) -> Option<Result<(), Error>>;
fn poll_close(
- self: Option<String>,
+ self,
cx: &mut Option<String>,
) -> Option<Result<(), Error>>;
fn poll_write_vectored(
- self: Option<String>,
+ self,
cx: &mut Option<String>,
bufs: &[usize]
) -> Option<Result<usize, Error>> {}
diff --git a/tests/rustdoc/issue-21474.rs b/tests/rustdoc/deduplicate-glob-import-impl-21474.rs
index 5de26abac..2a675b4b6 100644
--- a/tests/rustdoc/issue-21474.rs
+++ b/tests/rustdoc/deduplicate-glob-import-impl-21474.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/21474
+#![crate_name="issue_21474"]
+
pub use inner::*;
mod inner {
diff --git a/tests/rustdoc/issue-22025.rs b/tests/rustdoc/deduplicate-trait-impl-22025.rs
index a721a15f4..65a556e3a 100644
--- a/tests/rustdoc/issue-22025.rs
+++ b/tests/rustdoc/deduplicate-trait-impl-22025.rs
@@ -1,6 +1,9 @@
// aux-build:issue-22025.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/22025
+#![crate_name="issue_22025"]
+
extern crate issue_22025;
pub use issue_22025::foo::{Foo, Bar};
diff --git a/tests/rustdoc/deprecated-future-staged-api.rs b/tests/rustdoc/deprecated-future-staged-api.rs
index 2670e7f5d..09120b8d4 100644
--- a/tests/rustdoc/deprecated-future-staged-api.rs
+++ b/tests/rustdoc/deprecated-future-staged-api.rs
@@ -1,12 +1,12 @@
#![feature(staged_api)]
-#![stable(feature = "deprecated-future-staged-api", since = "1.0.0")]
+#![stable(feature = "deprecated_future_staged_api", since = "1.0.0")]
// @has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \
// 'Deprecation planned'
// @has deprecated_future_staged_api/struct.S1.html '//*[@class="stab deprecated"]' \
// 'Deprecating in 99.99.99: effectively never'
#[deprecated(since = "99.99.99", note = "effectively never")]
-#[stable(feature = "deprecated-future-staged-api", since = "1.0.0")]
+#[stable(feature = "deprecated_future_staged_api", since = "1.0.0")]
pub struct S1;
// @has deprecated_future_staged_api/index.html '//*[@class="stab deprecated"]' \
@@ -14,5 +14,5 @@ pub struct S1;
// @has deprecated_future_staged_api/struct.S2.html '//*[@class="stab deprecated"]' \
// 'Deprecating in a future Rust version: literally never'
#[deprecated(since = "TBD", note = "literally never")]
-#[stable(feature = "deprecated-future-staged-api", since = "1.0.0")]
+#[stable(feature = "deprecated_future_staged_api", since = "1.0.0")]
pub struct S2;
diff --git a/tests/rustdoc/deref/deref-mut-methods.rs b/tests/rustdoc/deref/deref-mut-methods.rs
index fdf843422..65681f812 100644
--- a/tests/rustdoc/deref/deref-mut-methods.rs
+++ b/tests/rustdoc/deref/deref-mut-methods.rs
@@ -9,7 +9,7 @@ impl Foo {
}
// @has foo/struct.Bar.html
-// @has - '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.foo"]' 'foo'
+// @has - '//*[@class="sidebar-elems"]//*[@class="block deref-methods"]//a[@href="#method.foo"]' 'foo'
pub struct Bar {
foo: Foo,
}
diff --git a/tests/rustdoc/deref/deref-recursive-pathbuf.rs b/tests/rustdoc/deref/deref-recursive-pathbuf.rs
index be2b42b5a..7aee3147b 100644
--- a/tests/rustdoc/deref/deref-recursive-pathbuf.rs
+++ b/tests/rustdoc/deref/deref-recursive-pathbuf.rs
@@ -8,9 +8,9 @@
// @has '-' '//*[@id="deref-methods-Path"]' 'Methods from Deref<Target = Path>'
// @has '-' '//*[@class="impl-items"]//*[@id="method.exists"]' 'pub fn exists(&self)'
// @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-PathBuf"]' 'Methods from Deref<Target=PathBuf>'
-// @has '-' '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.as_path"]' 'as_path'
+// @has '-' '//*[@class="sidebar-elems"]//*[@class="block deref-methods"]//a[@href="#method.as_path"]' 'as_path'
// @has '-' '//div[@class="sidebar-elems"]//h3/a[@href="#deref-methods-Path"]' 'Methods from Deref<Target=Path>'
-// @has '-' '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.exists"]' 'exists'
+// @has '-' '//*[@class="sidebar-elems"]//*[@class="block deref-methods"]//a[@href="#method.exists"]' 'exists'
#![crate_name = "foo"]
diff --git a/tests/rustdoc/issue-32890.rs b/tests/rustdoc/disambiguate-anchors-32890.rs
index 970954433..d88601d65 100644
--- a/tests/rustdoc/issue-32890.rs
+++ b/tests/rustdoc/disambiguate-anchors-32890.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/32890
+#![crate_name="issue_32890"]
+
// @has issue_32890/struct.Foo.html
pub struct Foo<T>(T);
diff --git a/tests/rustdoc/issue-29449.rs b/tests/rustdoc/disambiguate-anchors-header-29449.rs
index 0d829cf6f..38a4954fc 100644
--- a/tests/rustdoc/issue-29449.rs
+++ b/tests/rustdoc/disambiguate-anchors-header-29449.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/29449
+#![crate_name="issue_29449"]
+
// @has issue_29449/struct.Foo.html
pub struct Foo;
diff --git a/tests/rustdoc/issue-33069.rs b/tests/rustdoc/doc-hidden-trait-implementors-33069.rs
index 0213a53ca..35570668e 100644
--- a/tests/rustdoc/issue-33069.rs
+++ b/tests/rustdoc/doc-hidden-trait-implementors-33069.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/33069
+#![crate_name="issue_33069"]
+
pub trait Bar {}
#[doc(hidden)]
diff --git a/tests/rustdoc/issue-30252.rs b/tests/rustdoc/doctest-cfg-feature-30252.rs
index c3777362a..ceb8076fe 100644
--- a/tests/rustdoc/issue-30252.rs
+++ b/tests/rustdoc/doctest-cfg-feature-30252.rs
@@ -1,5 +1,8 @@
// compile-flags:--test --cfg feature="bar"
+// https://github.com/rust-lang/rust/issues/30252
+#![crate_name="issue_30252"]
+
/// ```rust
/// assert_eq!(cfg!(feature = "bar"), true);
/// ```
diff --git a/tests/rustdoc/doctest-hide-empty-line-23106.rs b/tests/rustdoc/doctest-hide-empty-line-23106.rs
new file mode 100644
index 000000000..8e1e2cf09
--- /dev/null
+++ b/tests/rustdoc/doctest-hide-empty-line-23106.rs
@@ -0,0 +1,10 @@
+// compile-flags:--test
+
+// https://github.com/rust-lang/rust/issues/23106
+#![crate_name="issue_23106"]
+
+/// ```
+/// #
+/// ```
+pub fn main() {
+}
diff --git a/tests/rustdoc/issue-32556.rs b/tests/rustdoc/doctest-ignore-32556.rs
index e1cf11509..99da9358b 100644
--- a/tests/rustdoc/issue-32556.rs
+++ b/tests/rustdoc/doctest-ignore-32556.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/32556
+#![crate_name="issue_32556"]
+
/// Blah blah blah
/// ```ignore (testing rustdoc's handling of ignore)
/// bad_assert!();
diff --git a/tests/rustdoc/issue-23744.rs b/tests/rustdoc/doctest-markdown-inline-parse-23744.rs
index 642817396..128e2daba 100644
--- a/tests/rustdoc/issue-23744.rs
+++ b/tests/rustdoc/doctest-markdown-inline-parse-23744.rs
@@ -1,5 +1,8 @@
// compile-flags:--test
+// https://github.com/rust-lang/rust/issues/23744
+#![crate_name="issue_23744"]
+
/// Example of rustdoc incorrectly parsing <code>```rust,should_panic</code>.
///
/// ```should_panic
diff --git a/tests/rustdoc/issue-25944.rs b/tests/rustdoc/doctest-multi-line-string-literal-25944.rs
index 49625294b..eec796e4f 100644
--- a/tests/rustdoc/issue-25944.rs
+++ b/tests/rustdoc/doctest-multi-line-string-literal-25944.rs
@@ -1,5 +1,8 @@
// compile-flags:--test
+// https://github.com/rust-lang/rust/issues/25944
+#![crate_name="issue_25944"]
+
/// ```
/// let a = r#"
/// foo
diff --git a/tests/rustdoc/enum-variant-value.rs b/tests/rustdoc/enum-variant-value.rs
new file mode 100644
index 000000000..096f8cd41
--- /dev/null
+++ b/tests/rustdoc/enum-variant-value.rs
@@ -0,0 +1,191 @@
+// This test ensures that the variant value is displayed with underscores but without
+// a type name at the end.
+
+// aux-build:enum-variant.rs
+
+#![crate_name = "foo"]
+
+extern crate bar;
+
+// In this case, since all variants are C-like variants and at least one of them
+// has its value set, we display values for all of them.
+
+// @has 'foo/enum.A.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 12,'
+// @has - '//*[@class="rust item-decl"]/code' 'B = 13,'
+// @has - '//*[@class="rust item-decl"]/code' 'C = 1_245,'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 12$'
+// @matches - '//*[@id="variant.B"]/h3' '^B = 13$'
+// @matches - '//*[@id="variant.C"]/h3' '^C = 1_245$'
+pub enum A {
+ A = 12,
+ B,
+ C = 1245,
+}
+
+// In this case, all variants are C-like variants but none of them has its value set.
+// Therefore we don't display values.
+
+// @has 'foo/enum.B.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A,'
+// @has - '//*[@class="rust item-decl"]/code' 'B,'
+// @matches - '//*[@id="variant.A"]/h3' '^A$'
+// @matches - '//*[@id="variant.B"]/h3' '^B$'
+pub enum B {
+ A,
+ B,
+}
+
+// In this case, not all variants are C-like variants so we don't display values.
+
+// @has 'foo/enum.C.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 12,'
+// @has - '//*[@class="rust item-decl"]/code' 'B,'
+// @has - '//*[@class="rust item-decl"]/code' 'C(u32),'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 12$'
+// @matches - '//*[@id="variant.B"]/h3' '^B$'
+// @has - '//*[@id="variant.C"]/h3' 'C(u32)'
+#[repr(u32)]
+pub enum C {
+ A = 12,
+ B,
+ C(u32),
+}
+
+// In this case, not all variants are C-like variants and no C-like variant has its
+// value set, so we don't display values.
+
+// @has 'foo/enum.D.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A,'
+// @has - '//*[@class="rust item-decl"]/code' 'C(u32),'
+// @matches - '//*[@id="variant.A"]/h3' '^A$'
+// @has - '//*[@id="variant.C"]/h3' 'C(u32)'
+pub enum D {
+ A,
+ C(u32),
+}
+
+// @has 'foo/enum.E.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 12,'
+// @has - '//*[@class="rust item-decl"]/code' 'B = 13,'
+// @has - '//*[@class="rust item-decl"]/code' 'C = 1_245,'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 12$'
+// @matches - '//*[@id="variant.B"]/h3' '^B = 13$'
+// @matches - '//*[@id="variant.C"]/h3' '^C = 1_245$'
+pub use bar::E;
+
+// @has 'foo/enum.F.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A,'
+// @has - '//*[@class="rust item-decl"]/code' 'B,'
+// @matches - '//*[@id="variant.A"]/h3' '^A$'
+// @matches - '//*[@id="variant.B"]/h3' '^B$'
+pub use bar::F;
+
+// @has 'foo/enum.G.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 12,'
+// @has - '//*[@class="rust item-decl"]/code' 'B,'
+// @has - '//*[@class="rust item-decl"]/code' 'C(u32),'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 12$'
+// @matches - '//*[@id="variant.B"]/h3' '^B$'
+// @has - '//*[@id="variant.C"]/h3' 'C(u32)'
+pub use bar::G;
+
+// @has 'foo/enum.H.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A,'
+// @has - '//*[@class="rust item-decl"]/code' 'C(u32),'
+// @matches - '//*[@id="variant.A"]/h3' '^A$'
+// @has - '//*[@id="variant.C"]/h3' 'C(u32)'
+pub use bar::H;
+
+// Testing more complex cases.
+pub const X: isize = 2;
+// @has 'foo/enum.I.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 2,'
+// @has - '//*[@class="rust item-decl"]/code' 'B = 4,'
+// @has - '//*[@class="rust item-decl"]/code' 'C = 9,'
+// @has - '//*[@class="rust item-decl"]/code' 'D = -1,'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 2$'
+// @matches - '//*[@id="variant.B"]/h3' '^B = 4$'
+// @matches - '//*[@id="variant.C"]/h3' '^C = 9$'
+// @matches - '//*[@id="variant.D"]/h3' '^D = -1$'
+#[repr(isize)]
+pub enum I {
+ A = X,
+ B = X * 2,
+ C = Self::B as isize + X + 3,
+ D = -1,
+}
+
+// Testing `repr`.
+
+// @has 'foo/enum.J.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 0,'
+// @has - '//*[@class="rust item-decl"]/code' 'B = 1,'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 0$'
+// @matches - '//*[@id="variant.B"]/h3' '^B = 1$'
+#[repr(C)]
+pub enum J {
+ A,
+ B,
+}
+
+// @has 'foo/enum.K.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A(u32),'
+// @has - '//*[@class="rust item-decl"]/code' 'B,'
+// @has - '//*[@id="variant.A"]/h3' 'A(u32)'
+// @matches - '//*[@id="variant.B"]/h3' '^B$'
+#[repr(C)]
+pub enum K {
+ A(u32),
+ B,
+}
+
+// @has 'foo/enum.L.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 0,'
+// @has - '//*[@class="rust item-decl"]/code' 'B = 1,'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 0$'
+// @matches - '//*[@id="variant.B"]/h3' '^B = 1$'
+#[repr(u32)]
+pub enum L {
+ A,
+ B,
+}
+
+// @has 'foo/enum.M.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A(u32),'
+// @has - '//*[@class="rust item-decl"]/code' 'B,'
+// @has - '//*[@id="variant.A"]/h3' 'A(u32)'
+// @matches - '//*[@id="variant.B"]/h3' '^B$'
+#[repr(u32)]
+pub enum M {
+ A(u32),
+ B,
+}
+
+// @has 'foo/enum.N.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 0,'
+// @has - '//*[@class="rust item-decl"]/code' 'B = 1,'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 0$'
+// @matches - '//*[@id="variant.B"]/h3' '^B = 1$'
+pub use bar::N;
+
+// @has 'foo/enum.O.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A(u32),'
+// @has - '//*[@class="rust item-decl"]/code' 'B,'
+// @has - '//*[@id="variant.A"]/h3' 'A(u32)'
+// @matches - '//*[@id="variant.B"]/h3' '^B$'
+pub use bar::O;
+
+// @has 'foo/enum.P.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A = 0,'
+// @has - '//*[@class="rust item-decl"]/code' 'B = 1,'
+// @matches - '//*[@id="variant.A"]/h3' '^A = 0$'
+// @matches - '//*[@id="variant.B"]/h3' '^B = 1$'
+pub use bar::P;
+
+// @has 'foo/enum.Q.html'
+// @has - '//*[@class="rust item-decl"]/code' 'A(u32),'
+// @has - '//*[@class="rust item-decl"]/code' 'B,'
+// @has - '//*[@id="variant.A"]/h3' 'A(u32)'
+// @matches - '//*[@id="variant.B"]/h3' '^B$'
+pub use bar::Q;
diff --git a/tests/rustdoc/issue-22038.rs b/tests/rustdoc/extern-fn-22038.rs
index de6cc7870..72d39c32a 100644
--- a/tests/rustdoc/issue-22038.rs
+++ b/tests/rustdoc/extern-fn-22038.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/22038
+#![crate_name="issue_22038"]
+
extern "C" {
// @has issue_22038/fn.foo1.html \
// '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn foo1()'
diff --git a/tests/rustdoc/generic-impl.rs b/tests/rustdoc/generic-impl.rs
index 6f68b1574..f62540c6b 100644
--- a/tests/rustdoc/generic-impl.rs
+++ b/tests/rustdoc/generic-impl.rs
@@ -5,9 +5,9 @@ use std::fmt;
// @!has foo/struct.Bar.html '//*[@id="impl-ToString-for-Bar"]' ''
pub struct Bar;
-// @has foo/struct.Foo.html '//*[@id="impl-ToString-for-Foo"]//h3[@class="code-header"]' 'impl<T> ToString for T'
+// @has foo/struct.Foo.html '//*[@id="impl-ToString-for-T"]//h3[@class="code-header"]' 'impl<T> ToString for T'
pub struct Foo;
-// @has foo/struct.Foo.html '//*[@class="sidebar-elems"]//section//a[@href="#impl-ToString-for-Foo"]' 'ToString'
+// @has foo/struct.Foo.html '//*[@class="sidebar-elems"]//section//a[@href="#impl-ToString-for-T"]' 'ToString'
impl fmt::Display for Foo {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
diff --git a/tests/rustdoc/issue-34025.rs b/tests/rustdoc/hidden-extern-34025.rs
index 9b9f21cb3..81ccf2a0e 100644
--- a/tests/rustdoc/issue-34025.rs
+++ b/tests/rustdoc/hidden-extern-34025.rs
@@ -1,3 +1,4 @@
+// https://github.com/rust-lang/rust/issues/34025
#![crate_name = "foo"]
// @!has 'foo/sys/index.html'
diff --git a/tests/rustdoc/hidden-impls.rs b/tests/rustdoc/hidden-impls.rs
index 26e2e0e06..3283fbfec 100644
--- a/tests/rustdoc/hidden-impls.rs
+++ b/tests/rustdoc/hidden-impls.rs
@@ -12,6 +12,6 @@ pub mod __hidden {
// @has foo/trait.Clone.html
// @!hasraw - 'Foo'
-// @has implementors/core/clone/trait.Clone.js
+// @has trait.impl/core/clone/trait.Clone.js
// @!hasraw - 'Foo'
pub use std::clone::Clone;
diff --git a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs
index 6006354eb..d728f772a 100644
--- a/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs
+++ b/tests/rustdoc/hide-complex-unevaluated-const-arguments.rs
@@ -4,9 +4,11 @@
//
// Read the documentation of `rustdoc::clean::utils::print_const_expr`
// for further details.
-#![feature(const_trait_impl, generic_const_exprs)]
+#![feature(const_trait_impl, generic_const_exprs, adt_const_params, generic_const_items)]
#![allow(incomplete_features)]
+use std::marker::ConstParamTy;
+
// @has hide_complex_unevaluated_const_arguments/trait.Stage.html
pub trait Stage {
// A helper constant that prevents const expressions containing it
@@ -29,11 +31,13 @@ pub trait Stage {
//
// @has - '//*[@id="associatedconstant.ARRAY1"]' \
// 'const ARRAY1: [u8; { _ }]'
- const ARRAY1: [u8; Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)];
+ const ARRAY1: [u8; Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)]
+ where [(); Struct::new(/* ... */).do_something(Self::ABSTRACT * 1_000)]:;
// @has - '//*[@id="associatedconstant.VERBOSE"]' \
// 'const VERBOSE: [u16; { _ }]'
- const VERBOSE: [u16; compute("thing", 9 + 9) * Self::ABSTRACT];
+ const VERBOSE: [u16; compute("thing", 9 + 9) * Self::ABSTRACT]
+ where [(); compute("thing", 9 + 9) * Self::ABSTRACT]:;
// Check that we do not leak the private struct field contained within
// the path. The output could definitely be improved upon
@@ -69,6 +73,7 @@ pub trait Sub: Sup<{ 90 * 20 * 4 }, { Struct { private: () } }> {}
pub trait Sup<const N: usize, const S: Struct> {}
+#[derive(ConstParamTy, PartialEq, Eq)]
pub struct Struct { private: () }
impl Struct {
diff --git a/tests/rustdoc/html-no-source.rs b/tests/rustdoc/html-no-source.rs
index 25615a73c..b91aa4120 100644
--- a/tests/rustdoc/html-no-source.rs
+++ b/tests/rustdoc/html-no-source.rs
@@ -11,20 +11,20 @@
// @files 'src/foo' '[]'
// @has foo/fn.foo.html
-// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · '
-// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
+// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · '
+// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · '
#[stable(feature = "bar", since = "1.0")]
pub fn foo() {}
// @has foo/struct.Bar.html
-// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · '
-// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
+// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · '
+// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · '
#[stable(feature = "bar", since = "1.0")]
pub struct Bar;
impl Bar {
- // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0'
- // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·'
+ // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0.0'
+ // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0.0 ·'
#[stable(feature = "foobar", since = "2.0")]
pub fn bar() {}
}
diff --git a/tests/rustdoc/issue-28927.rs b/tests/rustdoc/ice-reexport-crate-root-28927.rs
index 38a520850..26debfc60 100644
--- a/tests/rustdoc/issue-28927.rs
+++ b/tests/rustdoc/ice-reexport-crate-root-28927.rs
@@ -2,5 +2,8 @@
// aux-build:issue-28927-1.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/28927
+#![crate_name="issue_28927"]
+
pub extern crate issue_28927_1 as inner1;
pub use inner1 as foo;
diff --git a/tests/rustdoc/issue-21092.rs b/tests/rustdoc/impl-assoc-type-21092.rs
index b054145a4..f01f098a9 100644
--- a/tests/rustdoc/issue-21092.rs
+++ b/tests/rustdoc/impl-assoc-type-21092.rs
@@ -1,6 +1,9 @@
// aux-build:issue-21092.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/21092
+#![crate_name="issue_21092"]
+
extern crate issue_21092;
// @has issue_21092/struct.Bar.html
diff --git a/tests/rustdoc/impl-parts-crosscrate.rs b/tests/rustdoc/impl-parts-crosscrate.rs
index 34733f1f8..da109ea70 100644
--- a/tests/rustdoc/impl-parts-crosscrate.rs
+++ b/tests/rustdoc/impl-parts-crosscrate.rs
@@ -12,7 +12,7 @@ pub struct Bar<T> { t: T }
// full impl string. Instead, just make sure something from each part
// is mentioned.
-// @hasraw implementors/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar
+// @hasraw trait.impl/rustdoc_impl_parts_crosscrate/trait.AnAutoTrait.js Bar
// @hasraw - Send
// @hasraw - !AnAutoTrait
// @hasraw - Copy
diff --git a/tests/rustdoc/issue-33592.rs b/tests/rustdoc/impl-type-parameter-33592.rs
index 7a128f0b8..77f53710e 100644
--- a/tests/rustdoc/issue-33592.rs
+++ b/tests/rustdoc/impl-type-parameter-33592.rs
@@ -1,3 +1,4 @@
+// https://github.com/rust-lang/rust/issues/33592
#![crate_name = "foo"]
pub trait Foo<T> {}
diff --git a/tests/rustdoc/implementor-stable-version.rs b/tests/rustdoc/implementor-stable-version.rs
index a1f3fd5a8..9c5b9b7e3 100644
--- a/tests/rustdoc/implementor-stable-version.rs
+++ b/tests/rustdoc/implementor-stable-version.rs
@@ -1,21 +1,21 @@
-#![stable(feature = "bar", since = "OLD 1.0")]
+#![stable(feature = "bar", since = "3.3.3")]
#![crate_name = "foo"]
#![feature(staged_api)]
-#[stable(feature = "bar", since = "OLD 1.0")]
+#[stable(feature = "bar", since = "3.3.3")]
pub trait Bar {}
-#[stable(feature = "baz", since = "OLD 1.0")]
+#[stable(feature = "baz", since = "3.3.3")]
pub trait Baz {}
-#[stable(feature = "baz", since = "OLD 1.0")]
+#[stable(feature = "baz", since = "3.3.3")]
pub struct Foo;
-// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' 'NEW 2.0'
-#[stable(feature = "foobar", since = "NEW 2.0")]
+// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' '4.4.4'
+#[stable(feature = "foobar", since = "4.4.4")]
impl Bar for Foo {}
-// @!has foo/trait.Baz.html '//div[@id="implementors-list"]//span[@class="since"]' 'OLD 1.0'
-#[stable(feature = "foobaz", since = "OLD 1.0")]
+// @!has foo/trait.Baz.html '//div[@id="implementors-list"]//span[@class="since"]' '3.3.3'
+#[stable(feature = "foobaz", since = "3.3.3")]
impl Baz for Foo {}
diff --git a/tests/rustdoc/inline_cross/attributes.rs b/tests/rustdoc/inline_cross/attributes.rs
new file mode 100644
index 000000000..c0b75c48f
--- /dev/null
+++ b/tests/rustdoc/inline_cross/attributes.rs
@@ -0,0 +1,7 @@
+// aux-crate:attributes=attributes.rs
+// edition:2021
+#![crate_name = "user"]
+
+// @has 'user/struct.NonExhaustive.html'
+// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[non_exhaustive]'
+pub use attributes::NonExhaustive;
diff --git a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs
index 767564ed1..564ca7d67 100644
--- a/tests/rustdoc/inline_cross/auxiliary/async-fn.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/async-fn.rs
@@ -1,4 +1,3 @@
-#![feature(async_fn_in_trait)]
// edition: 2021
pub async fn load() -> i32 {
diff --git a/tests/rustdoc/inline_cross/auxiliary/attributes.rs b/tests/rustdoc/inline_cross/auxiliary/attributes.rs
new file mode 100644
index 000000000..c6f155d4b
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/attributes.rs
@@ -0,0 +1,2 @@
+#[non_exhaustive]
+pub struct NonExhaustive;
diff --git a/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs b/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs
new file mode 100644
index 000000000..b0c21ffae
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs
@@ -0,0 +1,16 @@
+#![feature(effects, const_trait_impl)]
+
+#[const_trait]
+pub trait Resource {}
+
+pub const fn load<R: ~const Resource>() -> i32 {
+ 0
+}
+
+pub const fn lock<R: Resource>() {}
+
+#[allow(non_upper_case_globals)]
+pub trait Clash<const host: u64> {}
+
+#[allow(non_upper_case_globals)]
+pub const fn clash<T: Clash<host>, const host: u64>() {}
diff --git a/tests/rustdoc/inline_cross/auxiliary/const-fn.rs b/tests/rustdoc/inline_cross/auxiliary/const-fn.rs
deleted file mode 100644
index 26332b419..000000000
--- a/tests/rustdoc/inline_cross/auxiliary/const-fn.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#![feature(effects)]
-
-pub const fn load() -> i32 {
- 0
-}
diff --git a/tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs b/tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs
new file mode 100644
index 000000000..1e31f1892
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs
@@ -0,0 +1,45 @@
+pub type BoxedStr = Box<str>;
+pub type IntMap = std::collections::HashMap<i64, u64>;
+
+pub struct TyPair<T, U = T>(T, U);
+
+pub type T0 = TyPair<i32>;
+pub type T1 = TyPair<i32, u32>;
+pub type T2<K> = TyPair<i32, K>;
+pub type T3<Q> = TyPair<Q, Q>;
+
+pub struct CtPair<const C: u32, const D: u32 = C>;
+
+pub type C0 = CtPair<43, 43>;
+pub type C1 = CtPair<0, 1>;
+pub type C2 = CtPair<{1 + 2}, 3>;
+
+pub struct Re<'a, U = &'a ()>(&'a (), U);
+
+pub type R0<'q> = Re<'q>;
+pub type R1<'q> = Re<'q, &'q ()>;
+pub type R2<'q> = Re<'q, &'static ()>;
+pub type H0 = fn(for<'a> fn(Re<'a>));
+pub type H1 = for<'b> fn(for<'a> fn(Re<'a, &'b ()>));
+pub type H2 = for<'a> fn(for<'b> fn(Re<'a, &'b ()>));
+
+pub struct Proj<T: Basis, U = <T as Basis>::Assoc>(T, U);
+pub trait Basis { type Assoc; }
+impl Basis for () { type Assoc = bool; }
+
+pub type P0 = Proj<()>;
+pub type P1 = Proj<(), bool>;
+pub type P2 = Proj<(), ()>;
+
+pub struct Alpha<T = for<'any> fn(&'any ())>(T);
+
+pub type A0 = Alpha;
+pub type A1 = Alpha<for<'arbitrary> fn(&'arbitrary ())>;
+
+pub struct Multi<A = u64, B = u64>(A, B);
+
+pub type M0 = Multi<u64, ()>;
+
+pub trait Trait<'a, T = &'a ()> {}
+
+pub type F = dyn for<'a> Trait<'a>;
diff --git a/tests/rustdoc/inline_cross/auxiliary/fn-type.rs b/tests/rustdoc/inline_cross/auxiliary/fn-type.rs
new file mode 100644
index 000000000..dacda516b
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/fn-type.rs
@@ -0,0 +1 @@
+pub type F = for<'z, 'a, '_unused> fn(&'z for<'b> fn(&'b str), &'a ()) -> &'a ();
diff --git a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
index 42cfc3dc3..fa61312eb 100644
--- a/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
@@ -15,7 +15,7 @@ pub fn func4<T: Iterator<Item = impl Clone>>(_x: T) {}
pub fn func5(
_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>,
- _a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>,
+ _a: impl for<'beta, 'alpha, '_gamma> Auxiliary<'alpha, Item<'beta> = fn(&'beta ())>,
) {}
pub trait Other {
diff --git a/tests/rustdoc/auxiliary/issue-21801.rs b/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs
index 732612ff0..732612ff0 100644
--- a/tests/rustdoc/auxiliary/issue-21801.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/issue-21801.rs
diff --git a/tests/rustdoc/auxiliary/issue-23207-1.rs b/tests/rustdoc/inline_cross/auxiliary/issue-23207-1.rs
index 8531d5f1a..8531d5f1a 100644
--- a/tests/rustdoc/auxiliary/issue-23207-1.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/issue-23207-1.rs
diff --git a/tests/rustdoc/auxiliary/issue-23207-2.rs b/tests/rustdoc/inline_cross/auxiliary/issue-23207-2.rs
index b92b16653..b92b16653 100644
--- a/tests/rustdoc/auxiliary/issue-23207-2.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/issue-23207-2.rs
diff --git a/tests/rustdoc/auxiliary/issue-27362-aux.rs b/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs
index 077bdc33e..077bdc33e 100644
--- a/tests/rustdoc/auxiliary/issue-27362-aux.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/issue-27362-aux.rs
diff --git a/tests/rustdoc/auxiliary/issue-29584.rs b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs
index a9b8796c0..a9b8796c0 100644
--- a/tests/rustdoc/auxiliary/issue-29584.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/issue-29584.rs
diff --git a/tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs b/tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs
new file mode 100644
index 000000000..9170be168
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs
@@ -0,0 +1,10 @@
+#![feature(non_lifetime_binders)]
+
+pub trait Trait<T> {}
+
+pub fn f(_: impl for<T> Trait<T>) {}
+
+pub fn g<T>(_: T)
+where
+ T: for<U> Trait<U>,
+{}
diff --git a/tests/rustdoc/inline_cross/auxiliary/repr.rs b/tests/rustdoc/inline_cross/auxiliary/repr.rs
index 4a6648a64..35f08c11b 100644
--- a/tests/rustdoc/inline_cross/auxiliary/repr.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/repr.rs
@@ -10,7 +10,7 @@ pub struct ReprSimd {
}
#[repr(transparent)]
pub struct ReprTransparent {
- field: u8,
+ pub field: u8,
}
#[repr(isize)]
pub enum ReprIsize {
@@ -20,3 +20,23 @@ pub enum ReprIsize {
pub enum ReprU8 {
Bla,
}
+
+#[repr(transparent)] // private
+pub struct ReprTransparentPrivField {
+ field: u32, // non-1-ZST field
+}
+
+#[repr(transparent)] // public
+pub struct ReprTransparentPriv1ZstFields {
+ marker0: Marker,
+ pub main: u64, // non-1-ZST field
+ marker1: Marker,
+}
+
+#[repr(transparent)] // private
+pub struct ReprTransparentPrivFieldPub1ZstFields {
+ main: [u16; 0], // non-1-ZST field
+ pub marker: Marker,
+}
+
+pub struct Marker; // 1-ZST
diff --git a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs
index c72f01115..08a3f5176 100644
--- a/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
pub trait Trait {
fn create() -> impl Iterator<Item = u64> {
std::iter::empty()
diff --git a/tests/rustdoc/inline_cross/const-effect-param.rs b/tests/rustdoc/inline_cross/const-effect-param.rs
new file mode 100644
index 000000000..1d003e28f
--- /dev/null
+++ b/tests/rustdoc/inline_cross/const-effect-param.rs
@@ -0,0 +1,29 @@
+// Regression test for issue #116629.
+// Check that we don't render host effect parameters & arguments.
+
+// aux-crate:const_effect_param=const-effect-param.rs
+// edition: 2021
+#![crate_name = "user"]
+
+// Don't render the host param on `load` and the host arg `host` passed to `Resource`.
+// @has user/fn.load.html
+// @has - '//pre[@class="rust item-decl"]' "pub const fn load<R>() -> i32\
+// where \
+// R: Resource"
+pub use const_effect_param::load;
+
+// Don't render the host arg `true` passed to `Resource`.
+// @has user/fn.lock.html
+// @has - '//pre[@class="rust item-decl"]' "pub const fn lock<R>()\
+// where \
+// R: Resource"
+pub use const_effect_param::lock;
+
+// Regression test for an issue introduced in PR #116670.
+// Don't hide the const param `host` since it actually isn't the host effect param.
+// @has user/fn.clash.html
+// @has - '//pre[@class="rust item-decl"]' \
+// "pub const fn clash<T, const host: u64>()\
+// where \
+// T: Clash<host>"
+pub use const_effect_param::clash;
diff --git a/tests/rustdoc/issue-27362.rs b/tests/rustdoc/inline_cross/const-fn-27362.rs
index 097e4e3b0..39b904662 100644
--- a/tests/rustdoc/issue-27362.rs
+++ b/tests/rustdoc/inline_cross/const-fn-27362.rs
@@ -1,6 +1,9 @@
// aux-build:issue-27362-aux.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/27362
+#![crate_name="issue_27362"]
+
extern crate issue_27362_aux;
pub use issue_27362_aux::*;
diff --git a/tests/rustdoc/inline_cross/const-fn.rs b/tests/rustdoc/inline_cross/const-fn.rs
deleted file mode 100644
index 24934b873..000000000
--- a/tests/rustdoc/inline_cross/const-fn.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Regression test for issue #116629.
-// Check that we render the correct generic params of const fn
-
-// aux-crate:const_fn=const-fn.rs
-// edition: 2021
-#![crate_name = "user"]
-
-// @has user/fn.load.html
-// @has - '//pre[@class="rust item-decl"]' "pub const fn load() -> i32"
-pub use const_fn::load;
diff --git a/tests/rustdoc/issue-23207.rs b/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs
index 1a4b849ee..4e9596db5 100644
--- a/tests/rustdoc/issue-23207.rs
+++ b/tests/rustdoc/inline_cross/deduplicate-inlined-items-23207.rs
@@ -2,6 +2,9 @@
// aux-build:issue-23207-2.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/23207
+#![crate_name="issue_23207"]
+
extern crate issue_23207_2;
// @has issue_23207/fmt/index.html
diff --git a/tests/rustdoc/inline_cross/default-generic-args.rs b/tests/rustdoc/inline_cross/default-generic-args.rs
new file mode 100644
index 000000000..c9a87a199
--- /dev/null
+++ b/tests/rustdoc/inline_cross/default-generic-args.rs
@@ -0,0 +1,104 @@
+#![crate_name = "user"]
+// aux-crate:default_generic_args=default-generic-args.rs
+// edition:2021
+
+// @has user/type.BoxedStr.html
+// @has - '//*[@class="rust item-decl"]//code' "Box<str>"
+pub use default_generic_args::BoxedStr;
+
+// @has user/type.IntMap.html
+// @has - '//*[@class="rust item-decl"]//code' "HashMap<i64, u64>"
+pub use default_generic_args::IntMap;
+
+// @has user/type.T0.html
+// @has - '//*[@class="rust item-decl"]//code' "TyPair<i32>"
+pub use default_generic_args::T0;
+
+// @has user/type.T1.html
+// @has - '//*[@class="rust item-decl"]//code' "TyPair<i32, u32>"
+pub use default_generic_args::T1;
+
+// @has user/type.T2.html
+// @has - '//*[@class="rust item-decl"]//code' "TyPair<i32, K>"
+pub use default_generic_args::T2;
+
+// @has user/type.T3.html
+// @has - '//*[@class="rust item-decl"]//code' "TyPair<Q>"
+pub use default_generic_args::T3;
+
+// @has user/type.C0.html
+// @has - '//*[@class="rust item-decl"]//code' "CtPair<43>"
+pub use default_generic_args::C0;
+
+// @has user/type.C1.html
+// @has - '//*[@class="rust item-decl"]//code' "CtPair<0, 1>"
+pub use default_generic_args::C1;
+
+// @has user/type.C2.html
+// @has - '//*[@class="rust item-decl"]//code' "CtPair<default_generic_args::::C2::{constant#0}, 3>"
+pub use default_generic_args::C2;
+
+// @has user/type.R0.html
+// @has - '//*[@class="rust item-decl"]//code' "Re<'q>"
+pub use default_generic_args::R0;
+
+// @has user/type.R1.html
+// @has - '//*[@class="rust item-decl"]//code' "Re<'q>"
+pub use default_generic_args::R1;
+
+// @has user/type.R2.html
+// Check that we consider regions:
+// @has - '//*[@class="rust item-decl"]//code' "Re<'q, &'static ()>"
+pub use default_generic_args::R2;
+
+// @has user/type.H0.html
+// Check that we handle higher-ranked regions correctly:
+// @has - '//*[@class="rust item-decl"]//code' "fn(_: for<'a> fn(_: Re<'a>))"
+pub use default_generic_args::H0;
+
+// @has user/type.H1.html
+// Check that we don't conflate distinct universially quantified regions (#1):
+// @has - '//*[@class="rust item-decl"]//code' "for<'b> fn(_: for<'a> fn(_: Re<'a, &'b ()>))"
+pub use default_generic_args::H1;
+
+// @has user/type.H2.html
+// Check that we don't conflate distinct universially quantified regions (#2):
+// @has - '//*[@class="rust item-decl"]//code' "for<'a> fn(_: for<'b> fn(_: Re<'a, &'b ()>))"
+pub use default_generic_args::H2;
+
+// @has user/type.P0.html
+// @has - '//*[@class="rust item-decl"]//code' "Proj<()>"
+pub use default_generic_args::P0;
+
+// @has user/type.P1.html
+// @has - '//*[@class="rust item-decl"]//code' "Proj<(), bool>"
+pub use default_generic_args::P1;
+
+// @has user/type.P2.html
+// @has - '//*[@class="rust item-decl"]//code' "Proj<(), ()>"
+pub use default_generic_args::P2;
+
+// @has user/type.A0.html
+// Ensure that we elide generic arguments that are alpha-equivalent to their respective
+// generic parameter (modulo substs) (#1):
+// @has - '//*[@class="rust item-decl"]//code' "Alpha"
+pub use default_generic_args::A0;
+
+// @has user/type.A1.html
+// Ensure that we elide generic arguments that are alpha-equivalent to their respective
+// generic parameter (modulo substs) (#1):
+// @has - '//*[@class="rust item-decl"]//code' "Alpha"
+pub use default_generic_args::A1;
+
+// @has user/type.M0.html
+// Test that we don't elide `u64` even if it coincides with `A`'s default precisely because
+// `()` is not the default of `B`. Mindlessly eliding `u64` would lead to `M<()>` which is a
+// different type (`M<(), u64>` versus `M<u64, ()>`).
+// @has - '//*[@class="rust item-decl"]//code' "Multi<u64, ()>"
+pub use default_generic_args::M0;
+
+// @has user/type.F.html
+// FIXME: Ideally, we would elide `&'a ()` but `'a` is an escaping bound var which we can't reason
+// about at the moment since we don't keep track of bound vars.
+// @has - '//*[@class="rust item-decl"]//code' "dyn for<'a> Trait<'a, &'a ()>"
+pub use default_generic_args::F;
diff --git a/tests/rustdoc/issue-29584.rs b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs
index 4364a9649..b246e94e0 100644
--- a/tests/rustdoc/issue-29584.rs
+++ b/tests/rustdoc/inline_cross/doc-hidden-extern-trait-impl-29584.rs
@@ -1,6 +1,9 @@
// aux-build:issue-29584.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/29584
+#![crate_name="issue_29584"]
+
extern crate issue_29584;
// @has issue_29584/struct.Foo.html
diff --git a/tests/rustdoc/inline_cross/dyn_trait.rs b/tests/rustdoc/inline_cross/dyn_trait.rs
index 679972f03..9871be79c 100644
--- a/tests/rustdoc/inline_cross/dyn_trait.rs
+++ b/tests/rustdoc/inline_cross/dyn_trait.rs
@@ -75,16 +75,16 @@ pub use dyn_trait::AmbiguousBoundWrappedEarly1;
pub use dyn_trait::AmbiguousBoundWrappedStatic;
// @has user/type.NoBoundsWrappedDefaulted.html
-// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait, Global>;"
+// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait>;"
pub use dyn_trait::NoBoundsWrappedDefaulted;
// @has user/type.NoBoundsWrappedEarly.html
-// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait + 'e, Global>;"
+// @has - '//*[@class="rust item-decl"]//code' "Box<dyn Trait + 'e>;"
pub use dyn_trait::NoBoundsWrappedEarly;
// @has user/fn.nbwl.html
-// @has - '//pre[@class="rust item-decl"]' "nbwl<'l>(_: Box<dyn Trait + 'l, Global>)"
+// @has - '//pre[@class="rust item-decl"]' "nbwl<'l>(_: Box<dyn Trait + 'l>)"
pub use dyn_trait::no_bounds_wrapped_late as nbwl;
// @has user/fn.nbwel.html
-// @has - '//pre[@class="rust item-decl"]' "nbwel(_: Box<dyn Trait + '_, Global>)"
+// @has - '//pre[@class="rust item-decl"]' "nbwel(_: Box<dyn Trait + '_>)"
// NB: It might seem counterintuitive to display the explicitly elided lifetime `'_` here instead of
// eliding it but this behavior is correct: The default is `'static` here which != `'_`.
pub use dyn_trait::no_bounds_wrapped_elided as nbwel;
diff --git a/tests/rustdoc/inline_cross/fn-type.rs b/tests/rustdoc/inline_cross/fn-type.rs
new file mode 100644
index 000000000..e65790d3b
--- /dev/null
+++ b/tests/rustdoc/inline_cross/fn-type.rs
@@ -0,0 +1,12 @@
+// Make sure that we print the higher-ranked parameters of cross-crate function pointer types.
+// They should be rendered exactly as the user wrote it, i.e., in source order and with unused
+// parameters present, not stripped.
+
+// aux-crate:fn_type=fn-type.rs
+// edition: 2021
+#![crate_name = "user"]
+
+// @has user/type.F.html
+// @has - '//*[@class="rust item-decl"]//code' \
+// "for<'z, 'a, '_unused> fn(_: &'z for<'b> fn(_: &'b str), _: &'a ()) -> &'a ();"
+pub use fn_type::F;
diff --git a/tests/rustdoc/inline_cross/impl_trait.rs b/tests/rustdoc/inline_cross/impl_trait.rs
index 5c802c514..3a2f5d160 100644
--- a/tests/rustdoc/inline_cross/impl_trait.rs
+++ b/tests/rustdoc/inline_cross/impl_trait.rs
@@ -4,7 +4,7 @@
extern crate impl_trait_aux;
// @has impl_trait/fn.func.html
-// @has - '//pre[@class="rust item-decl"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)"
+// @has - '//pre[@class="rust item-decl"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)"
// @!has - '//pre[@class="rust item-decl"]' 'where'
pub use impl_trait_aux::func;
@@ -29,11 +29,11 @@ pub use impl_trait_aux::func4;
// @has impl_trait/fn.func5.html
// @has - '//pre[@class="rust item-decl"]' "func5("
// @has - '//pre[@class="rust item-decl"]' "_f: impl for<'any> Fn(&'any str, &'any str) -> bool + for<'r> Other<T<'r> = ()>,"
-// @has - '//pre[@class="rust item-decl"]' "_a: impl for<'alpha, 'beta> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>"
+// @has - '//pre[@class="rust item-decl"]' "_a: impl for<'beta, 'alpha, '_gamma> Auxiliary<'alpha, Item<'beta> = fn(_: &'beta ())>"
// @!has - '//pre[@class="rust item-decl"]' 'where'
pub use impl_trait_aux::func5;
// @has impl_trait/struct.Foo.html
-// @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)"
+// @has - '//*[@id="method.method"]//h4[@class="code-header"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)"
// @!has - '//*[@id="method.method"]//h4[@class="code-header"]' 'where'
pub use impl_trait_aux::Foo;
diff --git a/tests/rustdoc/inline_cross/implementors-js.rs b/tests/rustdoc/inline_cross/implementors-js.rs
index c79f05d8d..c17d52d0f 100644
--- a/tests/rustdoc/inline_cross/implementors-js.rs
+++ b/tests/rustdoc/inline_cross/implementors-js.rs
@@ -4,13 +4,13 @@
extern crate implementors_inline;
-// @!has implementors/implementors_js/trait.MyTrait.js
-// @has implementors/implementors_inline/my_trait/trait.MyTrait.js
-// @!has implementors/implementors_inline/prelude/trait.MyTrait.js
+// @!has trait.impl/implementors_js/trait.MyTrait.js
+// @has trait.impl/implementors_inline/my_trait/trait.MyTrait.js
+// @!has trait.impl/implementors_inline/prelude/trait.MyTrait.js
// @has implementors_inline/my_trait/trait.MyTrait.html
-// @has - '//script/@src' '../../implementors/implementors_inline/my_trait/trait.MyTrait.js'
+// @has - '//script/@src' '../../trait.impl/implementors_inline/my_trait/trait.MyTrait.js'
// @has implementors_js/trait.MyTrait.html
-// @has - '//script/@src' '../implementors/implementors_inline/my_trait/trait.MyTrait.js'
+// @has - '//script/@src' '../trait.impl/implementors_inline/my_trait/trait.MyTrait.js'
/// When re-exporting this trait, the HTML will be inlined,
/// but, vitally, the JavaScript will be located only at the
/// one canonical path.
diff --git a/tests/rustdoc/inline_cross/non_lifetime_binders.rs b/tests/rustdoc/inline_cross/non_lifetime_binders.rs
new file mode 100644
index 000000000..9d3085c3e
--- /dev/null
+++ b/tests/rustdoc/inline_cross/non_lifetime_binders.rs
@@ -0,0 +1,13 @@
+// aux-crate:non_lifetime_binders=non_lifetime_binders.rs
+// edition: 2021
+#![crate_name = "user"]
+
+// @has user/fn.f.html
+// @has - '//pre[@class="rust item-decl"]' "f(_: impl for<T> Trait<T>)"
+pub use non_lifetime_binders::f;
+
+// @has user/fn.g.html
+// @has - '//pre[@class="rust item-decl"]' "g<T>(_: T)\
+// where \
+// T: for<U> Trait<U>"
+pub use non_lifetime_binders::g;
diff --git a/tests/rustdoc/inline_cross/repr.rs b/tests/rustdoc/inline_cross/repr.rs
index 9e107cee9..2f3d8f003 100644
--- a/tests/rustdoc/inline_cross/repr.rs
+++ b/tests/rustdoc/inline_cross/repr.rs
@@ -9,21 +9,32 @@ extern crate repr;
// @has 'foo/struct.ReprC.html'
// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(C, align(8))]'
-#[doc(inline)]
pub use repr::ReprC;
// @has 'foo/struct.ReprSimd.html'
// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(simd, packed(2))]'
-#[doc(inline)]
pub use repr::ReprSimd;
// @has 'foo/struct.ReprTransparent.html'
// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]'
-#[doc(inline)]
pub use repr::ReprTransparent;
// @has 'foo/enum.ReprIsize.html'
// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(isize)]'
-#[doc(inline)]
pub use repr::ReprIsize;
// @has 'foo/enum.ReprU8.html'
// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(u8)]'
-#[doc(inline)]
pub use repr::ReprU8;
+
+// Regression test for <https://github.com/rust-lang/rust/issues/90435>.
+// Check that we show `#[repr(transparent)]` iff the non-1-ZST field is public or at least one
+// field is public in case all fields are 1-ZST fields.
+
+// @has 'foo/struct.ReprTransparentPrivField.html'
+// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]'
+pub use repr::ReprTransparentPrivField;
+
+// @has 'foo/struct.ReprTransparentPriv1ZstFields.html'
+// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]'
+pub use repr::ReprTransparentPriv1ZstFields;
+
+// @has 'foo/struct.ReprTransparentPrivFieldPub1ZstFields.html'
+// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]'
+pub use repr::ReprTransparentPrivFieldPub1ZstFields;
diff --git a/tests/rustdoc/issue-21801.rs b/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs
index 29d2ec64c..bcbb2e9f4 100644
--- a/tests/rustdoc/issue-21801.rs
+++ b/tests/rustdoc/inline_cross/sugar-closure-crate-21801.rs
@@ -1,6 +1,9 @@
// aux-build:issue-21801.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/21801
+#![crate_name="issue_21801"]
+
extern crate issue_21801;
// @has issue_21801/struct.Foo.html
diff --git a/tests/rustdoc/intra-doc/prim-associated-traits.rs b/tests/rustdoc/intra-doc/prim-associated-traits.rs
index 8639a24f7..71d7d2189 100644
--- a/tests/rustdoc/intra-doc/prim-associated-traits.rs
+++ b/tests/rustdoc/intra-doc/prim-associated-traits.rs
@@ -41,6 +41,6 @@ pub struct Number {
pub u_128: u128,
pub ch: char,
pub boolean: bool,
- pub string: str,
+ pub string: &'static str,
pub n: !,
}
diff --git a/tests/rustdoc/issue-115295-macro-const-display.rs b/tests/rustdoc/issue-115295-macro-const-display.rs
new file mode 100644
index 000000000..2916c7a84
--- /dev/null
+++ b/tests/rustdoc/issue-115295-macro-const-display.rs
@@ -0,0 +1,40 @@
+#![crate_name = "foo"]
+
+// @has foo/trait.Trait.html
+pub trait Trait<T> {}
+
+// @has foo/struct.WithConst.html
+pub struct WithConst<const N: usize>;
+
+macro_rules! spans_from_macro {
+ () => {
+ impl WithConst<42> {
+ pub fn new() -> Self {
+ Self
+ }
+ }
+ impl Trait<WithConst<42>> for WithConst<42> {}
+ impl Trait<WithConst<43>> for WithConst<{ 43 }> {}
+ impl Trait<WithConst<{ 44 }>> for WithConst<44> {}
+ pub struct Other {
+ pub field: WithConst<42>,
+ }
+ };
+}
+
+// @has - '//*[@class="impl"]//h3[@class="code-header"]' \
+// "impl Trait<WithConst<41>> for WithConst<41>"
+impl Trait<WithConst<41>> for WithConst<41> {}
+
+// @has - '//*[@class="impl"]//h3[@class="code-header"]' \
+// "impl WithConst<42>"
+// @has - '//*[@class="impl"]//h3[@class="code-header"]' \
+// "impl Trait<WithConst<42>> for WithConst<42>"
+// @has - '//*[@class="impl"]//h3[@class="code-header"]' \
+// "impl Trait<WithConst<43>> for WithConst<{ 43 }>"
+// @has - '//*[@class="impl"]//h3[@class="code-header"]' \
+// "impl Trait<WithConst<44>> for WithConst<44>"
+
+// @has foo/struct.Other.html
+// @has - //pre "pub field: WithConst<42>"
+spans_from_macro!();
diff --git a/tests/rustdoc/issue-23106.rs b/tests/rustdoc/issue-23106.rs
deleted file mode 100644
index 8cda2fc33..000000000
--- a/tests/rustdoc/issue-23106.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// compile-flags:--test
-
-/// ```
-/// #
-/// ```
-pub fn main() {
-}
diff --git a/tests/rustdoc/issue-43701.rs b/tests/rustdoc/issue-43701.rs
index 44335e961..de772881e 100644
--- a/tests/rustdoc/issue-43701.rs
+++ b/tests/rustdoc/issue-43701.rs
@@ -2,4 +2,4 @@
pub use std::vec::Vec;
-// @!has implementors/core/clone/trait.Clone.js
+// @!has trait.impl/core/clone/trait.Clone.js
diff --git a/tests/rustdoc/issue-78701.rs b/tests/rustdoc/issue-78701.rs
index e3e46468f..3f1638d5f 100644
--- a/tests/rustdoc/issue-78701.rs
+++ b/tests/rustdoc/issue-78701.rs
@@ -6,7 +6,7 @@
// @has 'foo/struct.AnotherStruct.html'
// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3C()%3E"]' 1
-// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3CT%3E"]' 1
+// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-T"]' 1
pub trait Something {}
diff --git a/tests/rustdoc/issue-33178.rs b/tests/rustdoc/link-extern-crate-33178.rs
index ed643f5ae..6a63712c4 100644
--- a/tests/rustdoc/issue-33178.rs
+++ b/tests/rustdoc/link-extern-crate-33178.rs
@@ -3,6 +3,9 @@
// build-aux-docs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/33178
+#![crate_name="issue_33178"]
+
// @has issue_33178/index.html
// @has - '//a[@title="mod empty"][@href="../empty/index.html"]' empty
pub extern crate empty;
diff --git a/tests/rustdoc/issue-30109.rs b/tests/rustdoc/link-extern-crate-item-30109.rs
index e9447538a..c83234352 100644
--- a/tests/rustdoc/issue-30109.rs
+++ b/tests/rustdoc/link-extern-crate-item-30109.rs
@@ -2,6 +2,9 @@
// aux-build:issue-30109-1.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/30109
+#![crate_name="issue_30109"]
+
pub mod quux {
extern crate issue_30109_1 as bar;
use self::bar::Bar;
diff --git a/tests/rustdoc/issue-33178-1.rs b/tests/rustdoc/link-extern-crate-title-33178.rs
index 4dc425346..d2f115a38 100644
--- a/tests/rustdoc/issue-33178-1.rs
+++ b/tests/rustdoc/link-extern-crate-title-33178.rs
@@ -2,6 +2,9 @@
// aux-build:variant-struct.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/33178
+#![crate_name="issue_33178_1"]
+
// @has issue_33178_1/index.html
// @!has - //a/@title empty
pub extern crate empty;
diff --git a/tests/rustdoc/logo-class-default.rs b/tests/rustdoc/logo-class-default.rs
index d2d439199..6b46b4605 100644
--- a/tests/rustdoc/logo-class-default.rs
+++ b/tests/rustdoc/logo-class-default.rs
@@ -1,4 +1,4 @@
-// Note: this test is paired with logo-class.rs.
-// @has logo_class_default/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' ''
-// @has src/logo_class_default/logo-class-default.rs.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' ''
+// Note: this test is paired with logo-class.rs and logo-class-rust.rs.
+// @!has logo_class_default/struct.SomeStruct.html '//*[@class="logo-container"]/img' ''
+// @!has src/logo_class_default/logo-class-default.rs.html '//*[@class="sub-logo-container"]/img' ''
pub struct SomeStruct;
diff --git a/tests/rustdoc/logo-class-rust.rs b/tests/rustdoc/logo-class-rust.rs
new file mode 100644
index 000000000..d4f6113c0
--- /dev/null
+++ b/tests/rustdoc/logo-class-rust.rs
@@ -0,0 +1,7 @@
+#![feature(rustdoc_internals)]
+#![allow(internal_features)]
+#![doc(rust_logo)]
+// Note: this test is paired with logo-class.rs and logo-class-default.rs.
+// @has logo_class_rust/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' ''
+// @has src/logo_class_rust/logo-class-rust.rs.html '//*[@class="sub-logo-container"]/img[@class="rust-logo"]' ''
+pub struct SomeStruct;
diff --git a/tests/rustdoc/logo-class.rs b/tests/rustdoc/logo-class.rs
index d3aa446da..d15ce134c 100644
--- a/tests/rustdoc/logo-class.rs
+++ b/tests/rustdoc/logo-class.rs
@@ -1,6 +1,6 @@
#![doc(html_logo_url =
"https://raw.githubusercontent.com/sagebind/isahc/master/media/isahc.svg.png")]
-// Note: this test is paired with logo-class-default.rs.
+// Note: this test is paired with logo-class-default.rs and logo-class-rust.rs.
// @has logo_class/struct.SomeStruct.html '//*[@class="logo-container"]/img[@src="https://raw.githubusercontent.com/sagebind/isahc/master/media/isahc.svg.png"]' ''
// @!has logo_class/struct.SomeStruct.html '//*[@class="logo-container"]/img[@class="rust-logo"]' ''
diff --git a/tests/rustdoc/issue-23812.rs b/tests/rustdoc/macro-doc-comment-23812.rs
index 08fd1833b..57c18510b 100644
--- a/tests/rustdoc/issue-23812.rs
+++ b/tests/rustdoc/macro-doc-comment-23812.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/23812
+#![crate_name="issue_23812"]
+
macro_rules! doc {
(#[$outer:meta] mod $i:ident { #![$inner:meta] }) =>
(
diff --git a/tests/rustdoc/issue-27862.rs b/tests/rustdoc/markdown-table-escape-pipe-27862.rs
index 77522f1be..9af75d248 100644
--- a/tests/rustdoc/issue-27862.rs
+++ b/tests/rustdoc/markdown-table-escape-pipe-27862.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/27862
+#![crate_name="issue_27862"]
+
/// Tests | Table
/// ------|-------------
/// t = b | id = \|x\| x
diff --git a/tests/rustdoc/normalize-assoc-item.rs b/tests/rustdoc/normalize-assoc-item.rs
index c6fd5e110..d39e1b15a 100644
--- a/tests/rustdoc/normalize-assoc-item.rs
+++ b/tests/rustdoc/normalize-assoc-item.rs
@@ -30,7 +30,7 @@ pub fn f2() -> <isize as Trait>::X {
}
pub struct S {
- // @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.box_me_up"]' 'box_me_up: Box<S, Global>'
+ // @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.box_me_up"]' 'box_me_up: Box<S>'
pub box_me_up: <S as Trait>::X,
// @has 'normalize_assoc_item/struct.S.html' '//span[@id="structfield.generic"]' 'generic: (usize, isize)'
pub generic: <Generic<usize> as Trait>::X,
@@ -76,7 +76,7 @@ extern crate inner;
// @has 'normalize_assoc_item/fn.foo.html' '//pre[@class="rust item-decl"]' "pub fn foo() -> i32"
pub use inner::foo;
-// @has 'normalize_assoc_item/fn.h.html' '//pre[@class="rust item-decl"]' "pub fn h<T>() -> IntoIter<T, Global>"
+// @has 'normalize_assoc_item/fn.h.html' '//pre[@class="rust item-decl"]' "pub fn h<T>() -> IntoIter<T>"
pub fn h<T>() -> <Vec<T> as IntoIterator>::IntoIter {
vec![].into_iter()
}
diff --git a/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs b/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs
index 3fb00c7db..6b94d7994 100644
--- a/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs
+++ b/tests/rustdoc/notable-trait/doc-notable_trait_box_is_not_an_iterator.rs
@@ -3,25 +3,28 @@
#![feature(no_core)]
#![no_core]
#[lang = "owned_box"]
-pub struct Box<T>;
+pub struct Box<T>(*const T);
impl<T> Box<T> {
pub fn new(x: T) -> Box<T> {
- Box
+ Box(std::ptr::null())
}
}
+#[lang = "sized"]
+trait Sized {}
+
#[doc(notable_trait)]
pub trait FakeIterator {}
impl<I: FakeIterator> FakeIterator for Box<I> {}
#[lang = "pin"]
-pub struct Pin<T>;
+pub struct Pin<T>(T);
impl<T> Pin<T> {
pub fn new(x: T) -> Pin<T> {
- Pin
+ Pin(x)
}
}
diff --git a/tests/rustdoc/primitive/primitive-generic-impl.rs b/tests/rustdoc/primitive/primitive-generic-impl.rs
index 2da8ae6ff..558336d73 100644
--- a/tests/rustdoc/primitive/primitive-generic-impl.rs
+++ b/tests/rustdoc/primitive/primitive-generic-impl.rs
@@ -1,7 +1,7 @@
#![feature(rustc_attrs)]
#![crate_name = "foo"]
-// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-i32"]//h3[@class="code-header"]' 'impl<T> ToString for T'
+// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-T"]//h3[@class="code-header"]' 'impl<T> ToString for T'
#[rustc_doc_primitive = "i32"]
/// Some useless docs, wouhou!
diff --git a/tests/rustdoc/issue-32395.rs b/tests/rustdoc/render-enum-variant-structlike-32395.rs
index 5552300f9..2200d8ec6 100644
--- a/tests/rustdoc/issue-32395.rs
+++ b/tests/rustdoc/render-enum-variant-structlike-32395.rs
@@ -2,6 +2,9 @@
// build-aux-docs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/32395
+#![crate_name="issue_32395"]
+
// @has variant_struct/enum.Foo.html
// @!hasraw - 'pub qux'
// @!hasraw - 'pub(crate) qux'
diff --git a/tests/rustdoc/repr.rs b/tests/rustdoc/repr.rs
new file mode 100644
index 000000000..fbb46e126
--- /dev/null
+++ b/tests/rustdoc/repr.rs
@@ -0,0 +1,29 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/90435>.
+// Check that we show `#[repr(transparent)]` iff the non-1-ZST field is public or at least one
+// field is public in case all fields are 1-ZST fields.
+
+// @has 'repr/struct.ReprTransparentPrivField.html'
+// @!has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]'
+#[repr(transparent)] // private
+pub struct ReprTransparentPrivField {
+ field: u32, // non-1-ZST field
+}
+
+// @has 'repr/struct.ReprTransparentPriv1ZstFields.html'
+// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]'
+#[repr(transparent)] // public
+pub struct ReprTransparentPriv1ZstFields {
+ marker0: Marker,
+ pub main: u64, // non-1-ZST field
+ marker1: Marker,
+}
+
+// @has 'repr/struct.ReprTransparentPub1ZstField.html'
+// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]'
+#[repr(transparent)] // public
+pub struct ReprTransparentPub1ZstField {
+ marker0: Marker,
+ pub marker1: Marker,
+}
+
+struct Marker; // 1-ZST
diff --git a/tests/rustdoc/issue-23511.rs b/tests/rustdoc/search-index-primitive-inherent-method-23511.rs
index 21d028424..1d0fe27e1 100644
--- a/tests/rustdoc/issue-23511.rs
+++ b/tests/rustdoc/search-index-primitive-inherent-method-23511.rs
@@ -2,6 +2,9 @@
#![feature(rustdoc_internals)]
#![no_std]
+// https://github.com/rust-lang/rust/issues/23511
+#![crate_name="issue_23511"]
+
pub mod str {
#![rustc_doc_primitive = "str"]
diff --git a/tests/rustdoc/sidebar-items.rs b/tests/rustdoc/sidebar-items.rs
index 6f7afa59b..b746f6982 100644
--- a/tests/rustdoc/sidebar-items.rs
+++ b/tests/rustdoc/sidebar-items.rs
@@ -14,6 +14,7 @@
// @has - '//*[@class="sidebar-elems"]//section//a' 'Output'
// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#provided-associated-types"]' 'Provided Associated Types'
// @has - '//*[@class="sidebar-elems"]//section//a' 'Extra'
+// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#object-safety"]' 'Object Safety'
pub trait Foo {
const FOO: usize;
const BAR: u32 = 0;
@@ -24,6 +25,12 @@ pub trait Foo {
fn bar() -> Self::Output;
}
+// @has foo/trait.Safe.html
+// @!has - '//div[@class="sidebar-elems"]//h3/a[@href="#object-safety"]' ''
+pub trait Safe {
+ fn access(&self);
+}
+
// @has foo/struct.Bar.html
// @has - '//div[@class="sidebar-elems"]//h3/a[@href="#fields"]' 'Fields'
// @has - '//*[@class="sidebar-elems"]//section//a[@href="#structfield.f"]' 'f'
diff --git a/tests/rustdoc/sidebar-links-to-foreign-impl.rs b/tests/rustdoc/sidebar-links-to-foreign-impl.rs
index caa17dfbb..733a18ad9 100644
--- a/tests/rustdoc/sidebar-links-to-foreign-impl.rs
+++ b/tests/rustdoc/sidebar-links-to-foreign-impl.rs
@@ -7,8 +7,8 @@
// @has - '//h2[@id="foreign-impls"]' 'Implementations on Foreign Types'
// @has - '//*[@class="sidebar-elems"]//section//a[@href="#impl-Foo-for-u32"]' 'u32'
// @has - '//*[@id="impl-Foo-for-u32"]//h3[@class="code-header"]' 'impl Foo for u32'
-// @has - "//*[@class=\"sidebar-elems\"]//section//a[@href=\"#impl-Foo-for-%26'a+str\"]" "&'a str"
-// @has - "//*[@id=\"impl-Foo-for-%26'a+str\"]//h3[@class=\"code-header\"]" "impl<'a> Foo for &'a str"
+// @has - "//*[@class=\"sidebar-elems\"]//section//a[@href=\"#impl-Foo-for-%26str\"]" "&'a str"
+// @has - "//*[@id=\"impl-Foo-for-%26str\"]//h3[@class=\"code-header\"]" "impl<'a> Foo for &'a str"
pub trait Foo {}
impl Foo for u32 {}
diff --git a/tests/rustdoc/source-version-separator.rs b/tests/rustdoc/source-version-separator.rs
index 14580373b..7256f7315 100644
--- a/tests/rustdoc/source-version-separator.rs
+++ b/tests/rustdoc/source-version-separator.rs
@@ -3,23 +3,23 @@
#![feature(staged_api)]
// @has foo/trait.Bar.html
-// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
+// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · '
#[stable(feature = "bar", since = "1.0")]
pub trait Bar {
- // @has - '//*[@id="tymethod.foo"]/*[@class="rightside"]' '3.0 · source'
+ // @has - '//*[@id="tymethod.foo"]/*[@class="rightside"]' '3.0.0 · source'
#[stable(feature = "foobar", since = "3.0")]
fn foo();
}
-// @has - '//div[@id="implementors-list"]//*[@class="rightside"]' '4.0 · source'
+// @has - '//div[@id="implementors-list"]//*[@class="rightside"]' '4.0.0 · source'
// @has foo/struct.Foo.html
-// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
+// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · '
#[stable(feature = "baz", since = "1.0")]
pub struct Foo;
impl Foo {
- // @has - '//*[@id="method.foofoo"]/*[@class="rightside"]' '3.0 · source'
+ // @has - '//*[@id="method.foofoo"]/*[@class="rightside"]' '3.0.0 · source'
#[stable(feature = "foobar", since = "3.0")]
pub fn foofoo() {}
}
diff --git a/tests/rustdoc/issue-26606.rs b/tests/rustdoc/src-link-external-macro-26606.rs
index d5cb2c710..de717a527 100644
--- a/tests/rustdoc/issue-26606.rs
+++ b/tests/rustdoc/src-link-external-macro-26606.rs
@@ -2,10 +2,13 @@
// ignore-cross-compile
// build-aux-docs
+// https://github.com/rust-lang/rust/issues/26606
+#![crate_name="issue_26606"]
+
// @has issue_26606_macro/macro.make_item.html
#[macro_use]
extern crate issue_26606_macro;
// @has issue_26606/constant.FOO.html
-// @has - '//a[@href="../src/issue_26606/issue-26606.rs.html#11"]' 'source'
+// @has - '//a[@href="../src/issue_26606/src-link-external-macro-26606.rs.html#14"]' 'source'
make_item!(FOO);
diff --git a/tests/rustdoc/src-links-auto-impls.rs b/tests/rustdoc/src-links-auto-impls.rs
index 1c8d15731..08a497d4c 100644
--- a/tests/rustdoc/src-links-auto-impls.rs
+++ b/tests/rustdoc/src-links-auto-impls.rs
@@ -5,8 +5,8 @@
// @!has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="src"]' 'source'
// @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header"]' 'impl Sync for Unsized'
// @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="src"]' 'source'
-// @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header"]' 'impl<T> Any for T'
-// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="src rightside"]' 'source'
+// @has - '//*[@id="impl-Any-for-T"]/h3[@class="code-header"]' 'impl<T> Any for T'
+// @has - '//*[@id="impl-Any-for-T"]//a[@class="src rightside"]' 'source'
pub struct Unsized {
data: [u8],
}
diff --git a/tests/rustdoc/issue-34274.rs b/tests/rustdoc/src-links-inlined-34274.rs
index ce5be84a5..a3c9bf7e4 100644
--- a/tests/rustdoc/issue-34274.rs
+++ b/tests/rustdoc/src-links-inlined-34274.rs
@@ -2,6 +2,7 @@
// build-aux-docs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/34274
#![crate_name = "foo"]
extern crate issue_34274;
diff --git a/tests/rustdoc/issue-26995.rs b/tests/rustdoc/src-mod-path-absolute-26995.rs
index fedc9f517..b67fd9b26 100644
--- a/tests/rustdoc/issue-26995.rs
+++ b/tests/rustdoc/src-mod-path-absolute-26995.rs
@@ -1,6 +1,9 @@
// ignore-windows
// compile-flags: --no-defaults
+// https://github.com/rust-lang/rust/issues/26995
+#![crate_name="issue_26995"]
+
// @has src/issue_26995/dev/null.html
// @has issue_26995/null/index.html '//a/@href' '../../src/issue_26995/dev/null.html'
#[path="/dev/null"]
diff --git a/tests/rustdoc/issue-32374.rs b/tests/rustdoc/staged-api-deprecated-unstable-32374.rs
index 985bf03a1..d282dea90 100644
--- a/tests/rustdoc/issue-32374.rs
+++ b/tests/rustdoc/staged-api-deprecated-unstable-32374.rs
@@ -1,6 +1,8 @@
+// https://github.com/rust-lang/rust/issues/32374
#![feature(staged_api)]
#![doc(issue_tracker_base_url = "https://issue_url/")]
#![unstable(feature = "test", issue = "32374")]
+#![crate_name="issue_32374"]
// @matches issue_32374/index.html '//*[@class="item-name"]/span[@class="stab deprecated"]' \
// 'Deprecated'
diff --git a/tests/rustdoc/issue-27759.rs b/tests/rustdoc/staged-api-feature-issue-27759.rs
index 65e0f7cb8..56a45a600 100644
--- a/tests/rustdoc/issue-27759.rs
+++ b/tests/rustdoc/staged-api-feature-issue-27759.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/27759
+#![crate_name="issue_27759"]
+
#![feature(staged_api)]
#![doc(issue_tracker_base_url = "http://issue_url/")]
diff --git a/tests/rustdoc/strip-enum-variant.no-not-shown.html b/tests/rustdoc/strip-enum-variant.no-not-shown.html
index 782198956..e07233529 100644
--- a/tests/rustdoc/strip-enum-variant.no-not-shown.html
+++ b/tests/rustdoc/strip-enum-variant.no-not-shown.html
@@ -1 +1 @@
-<ul class="block"><li><a href="#variant.Shown">Shown</a></li></ul> \ No newline at end of file
+<ul class="block variant"><li><a href="#variant.Shown">Shown</a></li></ul> \ No newline at end of file
diff --git a/tests/rustdoc/strip-enum-variant.rs b/tests/rustdoc/strip-enum-variant.rs
index 8753a7dc6..2512fa34b 100644
--- a/tests/rustdoc/strip-enum-variant.rs
+++ b/tests/rustdoc/strip-enum-variant.rs
@@ -3,7 +3,7 @@
// @!has - '//code' 'NotShown'
// @has - '//code' '// some variants omitted'
// Also check that `NotShown` isn't displayed in the sidebar.
-// @snapshot no-not-shown - '//*[@class="sidebar-elems"]/section/*[@class="block"][1]'
+// @snapshot no-not-shown - '//*[@class="sidebar-elems"]/section/*[@class="block variant"]'
pub enum MyThing {
Shown,
#[doc(hidden)]
diff --git a/tests/rustdoc/issue-27104.rs b/tests/rustdoc/strip-priv-imports-pass-27104.rs
index 9f2fd9071..e400a8f50 100644
--- a/tests/rustdoc/issue-27104.rs
+++ b/tests/rustdoc/strip-priv-imports-pass-27104.rs
@@ -2,6 +2,9 @@
// aux-build:empty.rs
// ignore-cross-compile
+// https://github.com/rust-lang/rust/issues/27104
+#![crate_name="issue_27104"]
+
// @has issue_27104/index.html
// @!hasraw - 'extern crate std'
// @!hasraw - 'use std::prelude::'
diff --git a/tests/rustdoc/issue-31899.rs b/tests/rustdoc/summary-codeblock-31899.rs
index 3eee37446..c1b33058c 100644
--- a/tests/rustdoc/issue-31899.rs
+++ b/tests/rustdoc/summary-codeblock-31899.rs
@@ -1,3 +1,6 @@
+// https://github.com/rust-lang/rust/issues/31899
+#![crate_name="issue_31899"]
+
// @has issue_31899/index.html
// @hasraw - 'Make this line a bit longer.'
// @!hasraw - 'rust rust-example-rendered'
diff --git a/tests/rustdoc/issue-30366.rs b/tests/rustdoc/summary-reference-link-30366.rs
index c6274a058..5b9854c53 100644
--- a/tests/rustdoc/issue-30366.rs
+++ b/tests/rustdoc/summary-reference-link-30366.rs
@@ -1,5 +1,8 @@
// @has issue_30366/index.html '//a/@href' 'http://www.rust-lang.org/'
+// https://github.com/rust-lang/rust/issues/30366
+#![crate_name="issue_30366"]
+
/// Describe it. [Link somewhere][1].
///
/// [1]: http://www.rust-lang.org/
diff --git a/tests/rustdoc/titles.rs b/tests/rustdoc/titles.rs
index f6a059de6..f9da5a813 100644
--- a/tests/rustdoc/titles.rs
+++ b/tests/rustdoc/titles.rs
@@ -2,7 +2,8 @@
#![feature(rustc_attrs)]
// @matches 'foo/index.html' '//h1' 'Crate foo'
-// @matches 'foo/index.html' '//h2[@class="location"]' 'Crate foo'
+// @matches 'foo/index.html' '//div[@class="sidebar-crate"]/h2/a' 'foo'
+// @count 'foo/index.html' '//h2[@class="location"]' 0
// @matches 'foo/foo_mod/index.html' '//h1' 'Module foo::foo_mod'
// @matches 'foo/foo_mod/index.html' '//h2[@class="location"]' 'Module foo_mod'
diff --git a/tests/rustdoc/trait-object-safe.rs b/tests/rustdoc/trait-object-safe.rs
new file mode 100644
index 000000000..818843f75
--- /dev/null
+++ b/tests/rustdoc/trait-object-safe.rs
@@ -0,0 +1,27 @@
+#![crate_name = "foo"]
+
+// @has 'foo/trait.Unsafe.html'
+// @has - '//*[@class="object-safety-info"]' 'This trait is not object safe.'
+// @has - '//*[@id="object-safety"]' 'Object Safety'
+pub trait Unsafe {
+ fn foo() -> Self;
+}
+
+// @has 'foo/trait.Unsafe2.html'
+// @has - '//*[@class="object-safety-info"]' 'This trait is not object safe.'
+// @has - '//*[@id="object-safety"]' 'Object Safety'
+pub trait Unsafe2<T> {
+ fn foo(i: T);
+}
+
+// @has 'foo/trait.Safe.html'
+// @!has - '//*[@class="object-safety-info"]' ''
+// @!has - '//*[@id="object-safety"]' ''
+pub trait Safe {
+ fn foo(&self);
+}
+
+// @has 'foo/struct.Foo.html'
+// @!has - '//*[@class="object-safety-info"]' ''
+// @!has - '//*[@id="object-safety"]' ''
+pub struct Foo;
diff --git a/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs b/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs
new file mode 100644
index 000000000..3607612c2
--- /dev/null
+++ b/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs
@@ -0,0 +1,9 @@
+pub struct MyStruct<T>(T);
+
+pub trait MyTrait1 {
+ fn method_trait_1();
+}
+
+impl MyTrait1 for MyStruct<u16> {
+ fn method_trait_1() {}
+}
diff --git a/tests/rustdoc/type-alias/cross-crate-115718.rs b/tests/rustdoc/type-alias/cross-crate-115718.rs
new file mode 100644
index 000000000..372e62e42
--- /dev/null
+++ b/tests/rustdoc/type-alias/cross-crate-115718.rs
@@ -0,0 +1,34 @@
+// aux-build: parent-crate-115718.rs
+
+// https://github.com/rust-lang/rust/issues/115718
+#![crate_name = "foo"]
+
+extern crate parent_crate_115718;
+
+use parent_crate_115718::MyStruct;
+
+pub trait MyTrait2 {
+ fn method_trait_2();
+}
+
+impl MyTrait2 for MyStruct<u16> {
+ fn method_trait_2() {}
+}
+
+pub trait MyTrait3 {
+ fn method_trait_3();
+}
+
+impl MyTrait3 for MyType {
+ fn method_trait_3() {}
+}
+
+// @hasraw 'type.impl/parent_crate_115718/struct.MyStruct.js' 'method_trait_1'
+// @hasraw 'type.impl/parent_crate_115718/struct.MyStruct.js' 'method_trait_2'
+// Avoid duplicating these docs.
+// @!hasraw 'foo/type.MyType.html' 'method_trait_1'
+// @!hasraw 'foo/type.MyType.html' 'method_trait_2'
+// The one made directly on the type alias should be attached to the HTML instead.
+// @!hasraw 'type.impl/parent_crate_115718/struct.MyStruct.js' 'method_trait_3'
+// @hasraw 'foo/type.MyType.html' 'method_trait_3'
+pub type MyType = MyStruct<u16>;
diff --git a/tests/rustdoc/issue-112515-impl-ty-alias.rs b/tests/rustdoc/type-alias/deeply-nested-112515.rs
index 161188ee5..161188ee5 100644
--- a/tests/rustdoc/issue-112515-impl-ty-alias.rs
+++ b/tests/rustdoc/type-alias/deeply-nested-112515.rs
diff --git a/tests/rustdoc/issue-32077-type-alias-impls.rs b/tests/rustdoc/type-alias/deref-32077.rs
index ac486c36a..186ebb1a6 100644
--- a/tests/rustdoc/issue-32077-type-alias-impls.rs
+++ b/tests/rustdoc/type-alias/deref-32077.rs
@@ -22,20 +22,21 @@ impl Bar for GenericStruct<u32> {}
// We check that "Aliased type" is also present as a title in the sidebar.
// @has - '//*[@class="sidebar-elems"]//h3/a[@href="#aliased-type"]' 'Aliased type'
// We check that we have the implementation of the type alias itself.
-// @has - '//*[@id="impl-TypedefStruct"]/h3' 'impl TypedefStruct'
+// @has - '//*[@id="impl-GenericStruct%3Cu8%3E"]/h3' 'impl TypedefStruct'
// @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()'
-// @has - '//*[@id="impl-GenericStruct%3CT%3E"]/h3' 'impl<T> GenericStruct<T>'
-// @has - '//*[@id="method.on_gen"]/h4' 'pub fn on_gen(arg: T)'
-// @has - '//*[@id="impl-Foo-for-GenericStruct%3CT%3E"]/h3' 'impl<T> Foo for GenericStruct<T>'
// This trait implementation doesn't match the type alias parameters so shouldn't appear in docs.
// @!has - '//h3' 'impl Bar for GenericStruct<u32> {}'
// Same goes for the `Deref` impl.
// @!has - '//h2' 'Methods from Deref<Target = u32>'
// @count - '//nav[@class="sidebar"]//a' 'on_alias' 1
-// @count - '//nav[@class="sidebar"]//a' 'on_gen' 1
-// @count - '//nav[@class="sidebar"]//a' 'Foo' 1
+// @!has - '//nav[@class="sidebar"]//a' 'on_gen'
+// @!has - '//nav[@class="sidebar"]//a' 'Foo'
// @!has - '//nav[@class="sidebar"]//a' 'Bar'
// @!has - '//nav[@class="sidebar"]//a' 'on_u32'
+// TypedefStruct inlined to GenericStruct
+// @hasraw 'type.impl/foo/struct.GenericStruct.js' 'TypedefStruct'
+// @hasraw 'type.impl/foo/struct.GenericStruct.js' 'method.on_gen'
+// @hasraw 'type.impl/foo/struct.GenericStruct.js' 'Foo'
pub type TypedefStruct = GenericStruct<u8>;
impl TypedefStruct {
@@ -53,8 +54,11 @@ impl std::ops::Deref for GenericStruct<u32> {
pub struct Wrap<T>(GenericStruct<T>);
// @has 'foo/type.Alias.html'
-// @has - '//h2' 'Methods from Deref<Target = u32>'
-// @has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl<T> Deref for Wrap<T>'
+// @!has - '//h2' 'Methods from Deref<Target = u32>'
+// @!has - '//*[@id="impl-Deref-for-Wrap%3CT%3E"]/h3' 'impl<T> Deref for Wrap<T>'
+// @hasraw 'type.impl/foo/struct.Wrap.js' 'impl-Deref-for-Wrap%3CT%3E'
+// Deref Methods aren't gathered for type aliases, though the actual impl is.
+// @!hasraw 'type.impl/foo/struct.Wrap.js' 'BITS'
pub type Alias = Wrap<u32>;
impl<T> std::ops::Deref for Wrap<T> {
diff --git a/tests/rustdoc/type-alias/same-crate-115718.rs b/tests/rustdoc/type-alias/same-crate-115718.rs
new file mode 100644
index 000000000..26e5db85c
--- /dev/null
+++ b/tests/rustdoc/type-alias/same-crate-115718.rs
@@ -0,0 +1,34 @@
+// https://github.com/rust-lang/rust/issues/115718
+#![crate_name = "foo"]
+
+pub trait MyTrait1 {
+ fn method_trait_1();
+}
+
+pub trait MyTrait2 {
+ fn method_trait_2();
+}
+
+pub struct MyStruct<T>(T);
+
+impl MyStruct<u32> {
+ pub fn method_u32() {}
+}
+
+impl MyStruct<u16> {
+ pub fn method_u16() {}
+}
+
+impl MyTrait1 for MyStruct<u32> {
+ fn method_trait_1() {}
+}
+
+impl MyTrait2 for MyStruct<u16> {
+ fn method_trait_2() {}
+}
+
+// @hasraw 'type.impl/foo/struct.MyStruct.js' 'method_u16'
+// @!hasraw 'type.impl/foo/struct.MyStruct.js' 'method_u32'
+// @!hasraw 'type.impl/foo/struct.MyStruct.js' 'method_trait_1'
+// @hasraw 'type.impl/foo/struct.MyStruct.js' 'method_trait_2'
+pub type MyType = MyStruct<u16>;
diff --git a/tests/rustdoc/version-separator-without-source.rs b/tests/rustdoc/version-separator-without-source.rs
index 04ea46a7f..4a855b7bb 100644
--- a/tests/rustdoc/version-separator-without-source.rs
+++ b/tests/rustdoc/version-separator-without-source.rs
@@ -4,20 +4,20 @@
#![crate_name = "foo"]
// @has foo/fn.foo.html
-// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · '
-// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
+// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · '
+// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · '
#[stable(feature = "bar", since = "1.0")]
pub fn foo() {}
// @has foo/struct.Bar.html
-// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · '
-// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0 · source · '
+// @has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · '
+// @!has - '//div[@class="main-heading"]/*[@class="out-of-band"]' '1.0.0 · source · '
#[stable(feature = "bar", since = "1.0")]
pub struct Bar;
impl Bar {
- // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0'
- // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0 ·'
+ // @has - '//*[@id="method.bar"]/*[@class="since rightside"]' '2.0.0'
+ // @!has - '//*[@id="method.bar"]/*[@class="rightside"]' '2.0.0 ·'
#[stable(feature = "foobar", since = "2.0")]
pub fn bar() {}
}
diff --git a/tests/rustdoc/where-clause-order.rs b/tests/rustdoc/where-clause-order.rs
index b10f8f685..e3184b646 100644
--- a/tests/rustdoc/where-clause-order.rs
+++ b/tests/rustdoc/where-clause-order.rs
@@ -7,7 +7,7 @@ where
}
// @has 'foo/trait.SomeTrait.html'
-// @has - "//*[@id='impl-SomeTrait%3C(A,+B,+C,+D,+E)%3E-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, "
+// @has - "//*[@id='impl-SomeTrait-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, "
impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)
where
A: PartialOrd<A> + PartialEq<A>,
@@ -17,3 +17,14 @@ where
E: PartialOrd<E> + PartialEq<E> + ?Sized,
{
}
+
+// @has - "//*[@id='impl-SomeTrait%3C(A,+B,+C,+D)%3E-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, "
+impl<A, B, C, D, E> SomeTrait<(A, B, C, D)> for (A, B, C, D, E)
+where
+ A: PartialOrd<A> + PartialEq<A>,
+ B: PartialOrd<B> + PartialEq<B>,
+ C: PartialOrd<C> + PartialEq<C>,
+ D: PartialOrd<D> + PartialEq<D>,
+ E: PartialOrd<E> + PartialEq<E> + ?Sized,
+{
+}
diff --git a/tests/rustdoc/whitespace-after-where-clause.enum.html b/tests/rustdoc/whitespace-after-where-clause.enum.html
index 20b60b68e..ff4971f33 100644
--- a/tests/rustdoc/whitespace-after-where-clause.enum.html
+++ b/tests/rustdoc/whitespace-after-where-clause.enum.html
@@ -1,5 +1,5 @@
<pre class="rust item-decl"><code>pub enum Cow&lt;'a, B&gt;<span class="where fmt-newline">where
- B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{
+ B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{
Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>),
Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>),
}</code></pre> \ No newline at end of file
diff --git a/tests/rustdoc/whitespace-after-where-clause.enum2.html b/tests/rustdoc/whitespace-after-where-clause.enum2.html
index 065ce757d..bfc50f8ad 100644
--- a/tests/rustdoc/whitespace-after-where-clause.enum2.html
+++ b/tests/rustdoc/whitespace-after-where-clause.enum2.html
@@ -1,4 +1,4 @@
-<pre class="rust item-decl"><code>pub enum Cow2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + 'a&gt; {
+<pre class="rust item-decl"><code>pub enum Cow2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + 'a&gt; {
Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>),
Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>),
}</code></pre> \ No newline at end of file
diff --git a/tests/rustdoc/whitespace-after-where-clause.rs b/tests/rustdoc/whitespace-after-where-clause.rs
index b540c7c97..832d3728e 100644
--- a/tests/rustdoc/whitespace-after-where-clause.rs
+++ b/tests/rustdoc/whitespace-after-where-clause.rs
@@ -6,7 +6,8 @@
// @has 'foo/trait.ToOwned.html'
// @snapshot trait - '//*[@class="rust item-decl"]'
pub trait ToOwned<T>
-where T: Clone
+where
+ T: Clone,
{
type Owned;
fn to_owned(&self) -> Self::Owned;
@@ -26,7 +27,7 @@ pub trait ToOwned2<T: Clone> {
// @snapshot enum - '//*[@class="rust item-decl"]'
pub enum Cow<'a, B: ?Sized + 'a>
where
- B: ToOwned<Clone>,
+ B: ToOwned<()>,
{
Borrowed(&'a B),
Whatever(u32),
@@ -35,7 +36,7 @@ where
// @has 'foo/enum.Cow2.html'
// @snapshot enum2 - '//*[@class="rust item-decl"]'
// There should be a whitespace before `{` in this case!
-pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
+pub enum Cow2<'a, B: ?Sized + ToOwned<()> + 'a> {
Borrowed(&'a B),
Whatever(u32),
}
@@ -44,7 +45,7 @@ pub enum Cow2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
// @snapshot struct - '//*[@class="rust item-decl"]'
pub struct Struct<'a, B: ?Sized + 'a>
where
- B: ToOwned<Clone>,
+ B: ToOwned<()>,
{
pub a: &'a B,
pub b: u32,
@@ -53,7 +54,7 @@ where
// @has 'foo/struct.Struct2.html'
// @snapshot struct2 - '//*[@class="rust item-decl"]'
// There should be a whitespace before `{` in this case!
-pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
+pub struct Struct2<'a, B: ?Sized + ToOwned<()> + 'a> {
pub a: &'a B,
pub b: u32,
}
@@ -62,7 +63,7 @@ pub struct Struct2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
// @snapshot union - '//*[@class="rust item-decl"]'
pub union Union<'a, B: ?Sized + 'a>
where
- B: ToOwned<Clone>,
+ B: ToOwned<()>,
{
a: &'a B,
b: u32,
@@ -71,7 +72,7 @@ where
// @has 'foo/union.Union2.html'
// @snapshot union2 - '//*[@class="rust item-decl"]'
// There should be a whitespace before `{` in this case!
-pub union Union2<'a, B: ?Sized + ToOwned<Clone> + 'a> {
+pub union Union2<'a, B: ?Sized + ToOwned<()> + 'a> {
a: &'a B,
b: u32,
}
diff --git a/tests/rustdoc/whitespace-after-where-clause.struct.html b/tests/rustdoc/whitespace-after-where-clause.struct.html
index 948ddc499..ca6853586 100644
--- a/tests/rustdoc/whitespace-after-where-clause.struct.html
+++ b/tests/rustdoc/whitespace-after-where-clause.struct.html
@@ -1,5 +1,5 @@
<pre class="rust item-decl"><code>pub struct Struct&lt;'a, B&gt;<span class="where fmt-newline">where
- B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{
+ B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{
pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>,
pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>,
}</code></pre> \ No newline at end of file
diff --git a/tests/rustdoc/whitespace-after-where-clause.struct2.html b/tests/rustdoc/whitespace-after-where-clause.struct2.html
index c647e8d71..5aa8110c1 100644
--- a/tests/rustdoc/whitespace-after-where-clause.struct2.html
+++ b/tests/rustdoc/whitespace-after-where-clause.struct2.html
@@ -1,4 +1,4 @@
-<pre class="rust item-decl"><code>pub struct Struct2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + 'a&gt; {
+<pre class="rust item-decl"><code>pub struct Struct2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + 'a&gt; {
pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&amp;'a B</a>,
pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>,
}</code></pre> \ No newline at end of file
diff --git a/tests/rustdoc/whitespace-after-where-clause.union.html b/tests/rustdoc/whitespace-after-where-clause.union.html
index 38b6cb8b5..40b0c6712 100644
--- a/tests/rustdoc/whitespace-after-where-clause.union.html
+++ b/tests/rustdoc/whitespace-after-where-clause.union.html
@@ -1,4 +1,4 @@
<pre class="rust item-decl"><code>pub union Union&lt;'a, B&gt;<span class="where fmt-newline">where
- B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{
+ B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{
/* private fields */
}</code></pre> \ No newline at end of file
diff --git a/tests/rustdoc/whitespace-after-where-clause.union2.html b/tests/rustdoc/whitespace-after-where-clause.union2.html
index 66ad30c92..177a161b8 100644
--- a/tests/rustdoc/whitespace-after-where-clause.union2.html
+++ b/tests/rustdoc/whitespace-after-where-clause.union2.html
@@ -1,3 +1,3 @@
-<pre class="rust item-decl"><code>pub union Union2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>&gt; + 'a&gt; {
+<pre class="rust item-decl"><code>pub union Union2&lt;'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>&gt; + 'a&gt; {
/* private fields */
}</code></pre> \ No newline at end of file
diff --git a/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs
new file mode 100644
index 000000000..aeb68bf05
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.rs
@@ -0,0 +1,15 @@
+// Test the `rustc::span_use_eq_ctxt` internal lint
+// #[cfg(bootstrap)]
+// ignore-stage1
+// compile-flags: -Z unstable-options
+
+#![feature(rustc_private)]
+#![deny(rustc::span_use_eq_ctxt)]
+#![crate_type = "lib"]
+
+extern crate rustc_span;
+use rustc_span::Span;
+
+pub fn f(s: Span, t: Span) -> bool {
+ s.ctxt() == t.ctxt() //~ ERROR use `.eq_ctxt()` instead of `.ctxt() == .ctxt()`
+}
diff --git a/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.stderr b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.stderr
new file mode 100644
index 000000000..3d8a7dd1e
--- /dev/null
+++ b/tests/ui-fulldeps/internal-lints/span_use_eq_ctxt.stderr
@@ -0,0 +1,14 @@
+error: use `.eq_ctxt()` instead of `.ctxt() == .ctxt()`
+ --> $DIR/span_use_eq_ctxt.rs:14:5
+ |
+LL | s.ctxt() == t.ctxt()
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/span_use_eq_ctxt.rs:7:9
+ |
+LL | #![deny(rustc::span_use_eq_ctxt)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs
index 3f7429a5f..ae7f341fe 100644
--- a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs
+++ b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs
@@ -29,8 +29,8 @@ fn main() {
TyKind::FnPtr(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Dynamic(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Closure(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
- TyKind::Generator(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
- TyKind::GeneratorWitness(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::Coroutine(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
+ TyKind::CoroutineWitness(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Never => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Tuple(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Alias(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
diff --git a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr
index 1f49d6b64..45b7c26fa 100644
--- a/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr
+++ b/tests/ui-fulldeps/internal-lints/ty_tykind_usage.stderr
@@ -109,13 +109,13 @@ LL | TyKind::Closure(..) => (),
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:32:9
|
-LL | TyKind::Generator(..) => (),
+LL | TyKind::Coroutine(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:33:9
|
-LL | TyKind::GeneratorWitness(..) => (),
+LL | TyKind::CoroutineWitness(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
diff --git a/tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs b/tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs
deleted file mode 100644
index c24cdc97a..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// force-host
-
-#![feature(rustc_private)]
-
-extern crate rustc_driver;
-use rustc_driver::plugin::Registry;
-
-#[no_mangle]
-fn __rustc_plugin_registrar(_: &mut Registry) {}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs b/tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs
deleted file mode 100644
index 3f6caecaa..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-#![feature(plugin, rustc_private)]
-#![crate_type = "dylib"]
-
-extern crate rustc_ast_pretty;
-extern crate rustc_driver;
-extern crate rustc_hir;
-extern crate rustc_lint;
-#[macro_use]
-extern crate rustc_session;
-extern crate rustc_ast;
-extern crate rustc_span;
-
-use rustc_ast_pretty::pprust;
-use rustc_driver::plugin::Registry;
-use rustc_hir as hir;
-use rustc_hir::intravisit;
-use rustc_hir::Node;
-use rustc_lint::{LateContext, LateLintPass, LintContext};
-use rustc_span::def_id::LocalDefId;
-use rustc_span::source_map;
-
-#[no_mangle]
-fn __rustc_plugin_registrar(reg: &mut Registry) {
- reg.lint_store.register_lints(&[&MISSING_ALLOWED_ATTR]);
- reg.lint_store.register_late_pass(|_| Box::new(MissingAllowedAttrPass));
-}
-
-declare_lint! {
- MISSING_ALLOWED_ATTR,
- Deny,
- "Checks for missing `allowed_attr` attribute"
-}
-
-declare_lint_pass!(MissingAllowedAttrPass => [MISSING_ALLOWED_ATTR]);
-
-impl<'tcx> LateLintPass<'tcx> for MissingAllowedAttrPass {
- fn check_fn(
- &mut self,
- cx: &LateContext<'tcx>,
- _: intravisit::FnKind<'tcx>,
- _: &'tcx hir::FnDecl,
- _: &'tcx hir::Body,
- span: source_map::Span,
- def_id: LocalDefId,
- ) {
- let id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
- let item = match cx.tcx.hir().get(id) {
- Node::Item(item) => item,
- _ => cx.tcx.hir().expect_item(cx.tcx.hir().get_parent_item(id).def_id),
- };
-
- let allowed = |attr| pprust::attribute_to_string(attr).contains("allowed_attr");
- if !cx.tcx.hir().attrs(item.hir_id()).iter().any(allowed) {
- cx.lint(
- MISSING_ALLOWED_ATTR,
- "Missing 'allowed_attr' attribute",
- |lint| lint.set_span(span)
- );
- }
- }
-}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs
deleted file mode 100644
index 6304c07d2..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-// force-host
-
-#![feature(rustc_private)]
-
-extern crate rustc_driver;
-extern crate rustc_hir;
-extern crate rustc_lint;
-#[macro_use]
-extern crate rustc_session;
-extern crate rustc_ast;
-extern crate rustc_span;
-
-use rustc_ast::attr;
-use rustc_driver::plugin::Registry;
-use rustc_lint::{LateContext, LateLintPass, LintContext};
-use rustc_span::def_id::CRATE_DEF_ID;
-use rustc_span::symbol::Symbol;
-
-declare_lint! {
- CRATE_NOT_OKAY,
- Warn,
- "crate not marked with #![crate_okay]"
-}
-
-declare_lint_pass!(Pass => [CRATE_NOT_OKAY]);
-
-impl<'tcx> LateLintPass<'tcx> for Pass {
- fn check_crate(&mut self, cx: &LateContext) {
- let attrs = cx.tcx.hir().attrs(rustc_hir::CRATE_HIR_ID);
- let span = cx.tcx.def_span(CRATE_DEF_ID);
- if !attr::contains_name(attrs, Symbol::intern("crate_okay")) {
- cx.lint(CRATE_NOT_OKAY, "crate is not marked with #![crate_okay]", |lint| {
- lint.set_span(span)
- });
- }
- }
-}
-
-#[no_mangle]
-fn __rustc_plugin_registrar(reg: &mut Registry) {
- reg.lint_store.register_lints(&[&CRATE_NOT_OKAY]);
- reg.lint_store.register_late_pass(|_| Box::new(Pass));
-}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs
deleted file mode 100644
index 150f0c6b9..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-// force-host
-
-#![feature(rustc_private)]
-
-// Load rustc as a plugin to get macros.
-extern crate rustc_driver;
-extern crate rustc_hir;
-extern crate rustc_lint;
-#[macro_use]
-extern crate rustc_session;
-
-use rustc_driver::plugin::Registry;
-use rustc_lint::{LateContext, LateLintPass, LintContext, LintId};
-
-declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
-
-declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'");
-
-declare_lint_pass!(Pass => [TEST_LINT, PLEASE_LINT]);
-
-impl<'tcx> LateLintPass<'tcx> for Pass {
- fn check_item(&mut self, cx: &LateContext, it: &rustc_hir::Item) {
- match it.ident.as_str() {
- "lintme" => cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)),
- "pleaselintme" => {
- cx.lint(PLEASE_LINT, "item is named 'pleaselintme'", |lint| lint.set_span(it.span))
- }
- _ => {}
- }
- }
-}
-
-#[no_mangle]
-fn __rustc_plugin_registrar(reg: &mut Registry) {
- reg.lint_store.register_lints(&[&TEST_LINT, &PLEASE_LINT]);
- reg.lint_store.register_late_pass(|_| Box::new(Pass));
- reg.lint_store.register_group(
- true,
- "lint_me",
- None,
- vec![LintId::of(&TEST_LINT), LintId::of(&PLEASE_LINT)],
- );
-}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs
deleted file mode 100644
index acc5fe760..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// force-host
-
-#![feature(rustc_private)]
-
-extern crate rustc_ast;
-
-// Load rustc as a plugin to get macros
-extern crate rustc_driver;
-extern crate rustc_lint;
-#[macro_use]
-extern crate rustc_session;
-
-use rustc_ast::ast;
-use rustc_driver::plugin::Registry;
-use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
-
-declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
-
-declare_lint_pass!(Pass => [TEST_LINT]);
-
-impl EarlyLintPass for Pass {
- fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
- if it.ident.name.as_str() == "lintme" {
- cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span));
- }
- }
-}
-
-#[no_mangle]
-fn __rustc_plugin_registrar(reg: &mut Registry) {
- reg.lint_store.register_lints(&[&TEST_LINT]);
- reg.lint_store.register_early_pass(|| Box::new(Pass));
-}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs
deleted file mode 100644
index 21de4aa70..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-#![feature(rustc_private)]
-
-extern crate rustc_ast;
-
-// Load rustc as a plugin to get macros
-extern crate rustc_driver;
-extern crate rustc_lint;
-#[macro_use]
-extern crate rustc_session;
-
-use rustc_ast as ast;
-use rustc_driver::plugin::Registry;
-use rustc_lint::{EarlyContext, EarlyLintPass, LintContext, LintId};
-
-declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff");
-declare_tool_lint!(
- /// Some docs
- pub clippy::TEST_GROUP,
- Warn, "Warn about other stuff"
-);
-
-declare_tool_lint!(
- /// Some docs
- pub rustc::TEST_RUSTC_TOOL_LINT,
- Deny,
- "Deny internal stuff"
-);
-
-declare_lint_pass!(Pass => [TEST_LINT, TEST_GROUP, TEST_RUSTC_TOOL_LINT]);
-
-impl EarlyLintPass for Pass {
- fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
- if it.ident.name.as_str() == "lintme" {
- cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span));
- }
- if it.ident.name.as_str() == "lintmetoo" {
- cx.lint(TEST_GROUP, "item is named 'lintmetoo'", |lint| lint.set_span(it.span));
- }
- }
-}
-
-#[no_mangle]
-fn __rustc_plugin_registrar(reg: &mut Registry) {
- reg.lint_store.register_lints(&[&TEST_RUSTC_TOOL_LINT, &TEST_LINT, &TEST_GROUP]);
- reg.lint_store.register_early_pass(|| Box::new(Pass));
- reg.lint_store.register_group(
- true,
- "clippy::group",
- Some("clippy_group"),
- vec![LintId::of(&TEST_LINT), LintId::of(&TEST_GROUP)],
- );
-}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs
deleted file mode 100644
index 954a1e554..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
-
-pub fn foo() {}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs
deleted file mode 100644
index 9b075c1a5..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// force-host
-
-#![feature(rustc_private)]
-
-extern crate rustc_middle;
-extern crate rustc_driver;
-
-use rustc_driver::plugin::Registry;
-
-#[no_mangle]
-fn __rustc_plugin_registrar(_reg: &mut Registry) {}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs
deleted file mode 100644
index fd6e9e20f..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#![crate_type = "dylib"]
-#![feature(rustc_private)]
-
-extern crate rustc_middle;
-extern crate rustc_driver;
-
-use rustc_driver::plugin::Registry;
-
-#[no_mangle]
-fn __rustc_plugin_registrar(_: &mut Registry) {}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs
deleted file mode 100644
index fd6e9e20f..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#![crate_type = "dylib"]
-#![feature(rustc_private)]
-
-extern crate rustc_middle;
-extern crate rustc_driver;
-
-use rustc_driver::plugin::Registry;
-
-#[no_mangle]
-fn __rustc_plugin_registrar(_: &mut Registry) {}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs b/tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs
deleted file mode 100644
index e83dfe804..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// force-host
-
-#![feature(rustc_private)]
-
-extern crate rustc_middle;
-extern crate rustc_driver;
-
-use std::any::Any;
-use std::cell::RefCell;
-use rustc_driver::plugin::Registry;
-
-struct Foo {
- foo: isize
-}
-
-impl Drop for Foo {
- fn drop(&mut self) {}
-}
-
-#[no_mangle]
-fn __rustc_plugin_registrar(_: &mut Registry) {
- thread_local!(static FOO: RefCell<Option<Box<Any+Send>>> = RefCell::new(None));
- FOO.with(|s| *s.borrow_mut() = Some(Box::new(Foo { foo: 10 }) as Box<Any+Send>));
-}
diff --git a/tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs b/tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs
deleted file mode 100644
index 3ba73538e..000000000
--- a/tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
-#![feature(rustc_private)]
-
-extern crate rustc_middle;
-extern crate rustc_driver;
-
-use rustc_driver::plugin::Registry;
-
-#[no_mangle]
-fn __rustc_plugin_registrar(_: &mut Registry) {}
diff --git a/tests/ui-fulldeps/plugin/feature-gate-plugin.rs b/tests/ui-fulldeps/plugin/feature-gate-plugin.rs
deleted file mode 100644
index 85eaf5336..000000000
--- a/tests/ui-fulldeps/plugin/feature-gate-plugin.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// aux-build:empty-plugin.rs
-// ignore-stage1
-
-#![plugin(empty_plugin)]
-//~^ ERROR compiler plugins are deprecated
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui-fulldeps/plugin/feature-gate-plugin.stderr b/tests/ui-fulldeps/plugin/feature-gate-plugin.stderr
deleted file mode 100644
index 5e40561c7..000000000
--- a/tests/ui-fulldeps/plugin/feature-gate-plugin.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0658]: compiler plugins are deprecated
- --> $DIR/feature-gate-plugin.rs:4:1
- |
-LL | #![plugin(empty_plugin)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #29597 <https://github.com/rust-lang/rust/issues/29597> for more information
- = help: add `#![feature(plugin)]` to the crate attributes to enable
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/feature-gate-plugin.rs:4:1
- |
-LL | #![plugin(empty_plugin)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui-fulldeps/plugin/gated-plugin.rs b/tests/ui-fulldeps/plugin/gated-plugin.rs
deleted file mode 100644
index 85eaf5336..000000000
--- a/tests/ui-fulldeps/plugin/gated-plugin.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// aux-build:empty-plugin.rs
-// ignore-stage1
-
-#![plugin(empty_plugin)]
-//~^ ERROR compiler plugins are deprecated
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui-fulldeps/plugin/gated-plugin.stderr b/tests/ui-fulldeps/plugin/gated-plugin.stderr
deleted file mode 100644
index f48f1eab6..000000000
--- a/tests/ui-fulldeps/plugin/gated-plugin.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0658]: compiler plugins are deprecated
- --> $DIR/gated-plugin.rs:4:1
- |
-LL | #![plugin(empty_plugin)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #29597 <https://github.com/rust-lang/rust/issues/29597> for more information
- = help: add `#![feature(plugin)]` to the crate attributes to enable
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/gated-plugin.rs:4:1
- |
-LL | #![plugin(empty_plugin)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui-fulldeps/plugin/issue-15778-fail.rs b/tests/ui-fulldeps/plugin/issue-15778-fail.rs
deleted file mode 100644
index beecaadf9..000000000
--- a/tests/ui-fulldeps/plugin/issue-15778-fail.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// aux-build:lint-for-crate.rs
-// ignore-stage1
-// compile-flags: -D crate-not-okay
-
-#![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay]
-#![plugin(lint_for_crate)]
-//~^ WARN use of deprecated attribute `plugin`
-
-pub fn main() { }
diff --git a/tests/ui-fulldeps/plugin/issue-15778-fail.stderr b/tests/ui-fulldeps/plugin/issue-15778-fail.stderr
deleted file mode 100644
index a37893e12..000000000
--- a/tests/ui-fulldeps/plugin/issue-15778-fail.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/issue-15778-fail.rs:6:1
- |
-LL | #![plugin(lint_for_crate)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: crate is not marked with #![crate_okay]
- --> $DIR/issue-15778-fail.rs:5:1
- |
-LL | / #![feature(plugin)]
-LL | | #![plugin(lint_for_crate)]
-LL | |
-LL | |
-LL | | pub fn main() { }
- | |_________________^
- |
- = note: requested on the command line with `-D crate-not-okay`
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/tests/ui-fulldeps/plugin/issue-40001.rs b/tests/ui-fulldeps/plugin/issue-40001.rs
deleted file mode 100644
index e14338fdb..000000000
--- a/tests/ui-fulldeps/plugin/issue-40001.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// run-pass
-// aux-build:issue-40001-plugin.rs
-// ignore-stage1
-
-#![feature(plugin, register_tool)]
-#![plugin(issue_40001_plugin)] //~ WARNING compiler plugins are deprecated
-#![register_tool(plugin)]
-
-#[plugin::allowed_attr]
-fn main() {}
diff --git a/tests/ui-fulldeps/plugin/issue-40001.stderr b/tests/ui-fulldeps/plugin/issue-40001.stderr
deleted file mode 100644
index 73ec06924..000000000
--- a/tests/ui-fulldeps/plugin/issue-40001.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/issue-40001.rs:6:1
- |
-LL | #![plugin(issue_40001_plugin)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: 1 warning emitted
-
diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs
deleted file mode 100644
index 9f8a87960..000000000
--- a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// aux-build:lint-group-plugin-test.rs
-// ignore-stage1
-// compile-flags: -D lint-me
-
-#![feature(plugin)]
-
-#![plugin(lint_group_plugin_test)]
-//~^ WARN use of deprecated attribute `plugin`
-
-fn lintme() { } //~ ERROR item is named 'lintme'
-
-fn pleaselintme() { } //~ ERROR item is named 'pleaselintme'
-
-pub fn main() {
- lintme();
- pleaselintme();
-}
diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr
deleted file mode 100644
index 6e17bbde0..000000000
--- a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-group-plugin-deny-cmdline.rs:7:1
- |
-LL | #![plugin(lint_group_plugin_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: item is named 'lintme'
- --> $DIR/lint-group-plugin-deny-cmdline.rs:10:1
- |
-LL | fn lintme() { }
- | ^^^^^^^^^^^^^^^
- |
- = note: `-D test-lint` implied by `-D lint-me`
- = help: to override `-D lint-me` add `#[allow(test_lint)]`
-
-error: item is named 'pleaselintme'
- --> $DIR/lint-group-plugin-deny-cmdline.rs:12:1
- |
-LL | fn pleaselintme() { }
- | ^^^^^^^^^^^^^^^^^^^^^
- |
- = note: `-D please-lint` implied by `-D lint-me`
- = help: to override `-D lint-me` add `#[allow(please_lint)]`
-
-error: aborting due to 2 previous errors; 1 warning emitted
-
diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin.rs b/tests/ui-fulldeps/plugin/lint-group-plugin.rs
deleted file mode 100644
index 7b74be7a9..000000000
--- a/tests/ui-fulldeps/plugin/lint-group-plugin.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// run-pass
-// aux-build:lint-group-plugin-test.rs
-// ignore-stage1
-
-#![feature(plugin)]
-#![plugin(lint_group_plugin_test)] //~ WARNING use of deprecated attribute
-#![allow(dead_code)]
-
-fn lintme() { } //~ WARNING item is named 'lintme'
-fn pleaselintme() { } //~ WARNING item is named 'pleaselintme'
-
-#[allow(lint_me)]
-pub fn main() {
- fn lintme() { }
-
- fn pleaselintme() { }
-}
diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin.stderr b/tests/ui-fulldeps/plugin/lint-group-plugin.stderr
deleted file mode 100644
index 6f429dad0..000000000
--- a/tests/ui-fulldeps/plugin/lint-group-plugin.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-group-plugin.rs:6:1
- |
-LL | #![plugin(lint_group_plugin_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: item is named 'lintme'
- --> $DIR/lint-group-plugin.rs:9:1
- |
-LL | fn lintme() { }
- | ^^^^^^^^^^^^^^^
- |
- = note: `#[warn(test_lint)]` on by default
-
-warning: item is named 'pleaselintme'
- --> $DIR/lint-group-plugin.rs:10:1
- |
-LL | fn pleaselintme() { }
- | ^^^^^^^^^^^^^^^^^^^^^
- |
- = note: `#[warn(please_lint)]` on by default
-
-warning: 3 warnings emitted
-
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs
deleted file mode 100644
index 1cc16e2fd..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// check-pass
-// aux-build:lint-plugin-test.rs
-// ignore-stage1
-// compile-flags: -A test-lint
-
-#![feature(plugin)]
-#![plugin(lint_plugin_test)] //~ WARNING compiler plugins are deprecated
-
-fn lintme() { }
-
-pub fn main() {
-}
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr
deleted file mode 100644
index f06703a27..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-plugin-cmdline-allow.rs:7:1
- |
-LL | #![plugin(lint_plugin_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: 1 warning emitted
-
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs
deleted file mode 100644
index 0bd95dfbd..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// check-pass
-// aux-build:lint-plugin-test.rs
-// ignore-stage1
-// compile-flags: -Z crate-attr=plugin(lint_plugin_test)
-
-#![feature(plugin)]
-
-fn lintme() { } //~ WARNING item is named 'lintme'
-
-#[allow(test_lint)]
-pub fn main() {
- fn lintme() { }
-}
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr
deleted file mode 100644
index 82679c9e1..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: item is named 'lintme'
- --> $DIR/lint-plugin-cmdline-load.rs:8:1
- |
-LL | fn lintme() { }
- | ^^^^^^^^^^^^^^^
- |
- = note: `#[warn(test_lint)]` on by default
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> <crate attribute>:1:1
- |
-LL | plugin(lint_plugin_test)
- | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: 2 warnings emitted
-
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs
deleted file mode 100644
index 04230a8e8..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// aux-build:lint-plugin-test.rs
-// ignore-stage1
-
-#![feature(plugin)]
-#![plugin(lint_plugin_test)]
-//~^ WARN use of deprecated attribute `plugin`
-#![deny(test_lint)]
-
-fn lintme() { } //~ ERROR item is named 'lintme'
-
-pub fn main() {
- lintme();
-}
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr
deleted file mode 100644
index 5e8891bf1..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-error: item is named 'lintme'
- --> $DIR/lint-plugin-deny-attr.rs:9:1
- |
-LL | fn lintme() { }
- | ^^^^^^^^^^^^^^^
- |
-note: the lint level is defined here
- --> $DIR/lint-plugin-deny-attr.rs:7:9
- |
-LL | #![deny(test_lint)]
- | ^^^^^^^^^
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-plugin-deny-attr.rs:5:1
- |
-LL | #![plugin(lint_plugin_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs
deleted file mode 100644
index c460cfd5f..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// aux-build:lint-plugin-test.rs
-// ignore-stage1
-// compile-flags: -D test-lint
-
-#![feature(plugin)]
-#![plugin(lint_plugin_test)]
-//~^ WARN use of deprecated attribute `plugin`
-
-fn lintme() { } //~ ERROR item is named 'lintme'
-
-pub fn main() {
- lintme();
-}
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr
deleted file mode 100644
index d5d6b5352..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: item is named 'lintme'
- --> $DIR/lint-plugin-deny-cmdline.rs:9:1
- |
-LL | fn lintme() { }
- | ^^^^^^^^^^^^^^^
- |
- = note: requested on the command line with `-D test-lint`
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-plugin-deny-cmdline.rs:6:1
- |
-LL | #![plugin(lint_plugin_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs
deleted file mode 100644
index cf31b3ec1..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// aux-build:lint-plugin-test.rs
-// ignore-stage1
-
-#![feature(plugin)]
-#![plugin(lint_plugin_test)]
-//~^ WARN use of deprecated attribute `plugin`
-#![forbid(test_lint)]
-
-fn lintme() {} //~ ERROR item is named 'lintme'
-
-#[allow(test_lint)]
-//~^ ERROR allow(test_lint) incompatible
-//~| ERROR allow(test_lint) incompatible
-pub fn main() {
- lintme();
-}
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr
deleted file mode 100644
index ae34b25cc..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr
+++ /dev/null
@@ -1,41 +0,0 @@
-error[E0453]: allow(test_lint) incompatible with previous forbid
- --> $DIR/lint-plugin-forbid-attrs.rs:11:9
- |
-LL | #![forbid(test_lint)]
- | --------- `forbid` level set here
-...
-LL | #[allow(test_lint)]
- | ^^^^^^^^^ overruled by previous forbid
-
-error: item is named 'lintme'
- --> $DIR/lint-plugin-forbid-attrs.rs:9:1
- |
-LL | fn lintme() {}
- | ^^^^^^^^^^^^^^
- |
-note: the lint level is defined here
- --> $DIR/lint-plugin-forbid-attrs.rs:7:11
- |
-LL | #![forbid(test_lint)]
- | ^^^^^^^^^
-
-error[E0453]: allow(test_lint) incompatible with previous forbid
- --> $DIR/lint-plugin-forbid-attrs.rs:11:9
- |
-LL | #![forbid(test_lint)]
- | --------- `forbid` level set here
-...
-LL | #[allow(test_lint)]
- | ^^^^^^^^^ overruled by previous forbid
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-plugin-forbid-attrs.rs:5:1
- |
-LL | #![plugin(lint_plugin_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to 3 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0453`.
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs
deleted file mode 100644
index b9d1aa85a..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// aux-build:lint-plugin-test.rs
-// ignore-stage1
-// compile-flags: -F test-lint
-
-#![feature(plugin)]
-#![plugin(lint_plugin_test)]
-//~^ WARN use of deprecated attribute `plugin`
-fn lintme() { } //~ ERROR item is named 'lintme'
-
-#[allow(test_lint)] //~ ERROR allow(test_lint) incompatible
- //~| ERROR allow(test_lint) incompatible
-
-pub fn main() {
- lintme();
-}
diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr
deleted file mode 100644
index 491c4d206..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr
+++ /dev/null
@@ -1,35 +0,0 @@
-error[E0453]: allow(test_lint) incompatible with previous forbid
- --> $DIR/lint-plugin-forbid-cmdline.rs:10:9
- |
-LL | #[allow(test_lint)]
- | ^^^^^^^^^ overruled by previous forbid
- |
- = note: `forbid` lint level was set on command line
-
-error: item is named 'lintme'
- --> $DIR/lint-plugin-forbid-cmdline.rs:8:1
- |
-LL | fn lintme() { }
- | ^^^^^^^^^^^^^^^
- |
- = note: requested on the command line with `-F test-lint`
-
-error[E0453]: allow(test_lint) incompatible with previous forbid
- --> $DIR/lint-plugin-forbid-cmdline.rs:10:9
- |
-LL | #[allow(test_lint)]
- | ^^^^^^^^^ overruled by previous forbid
- |
- = note: `forbid` lint level was set on command line
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-plugin-forbid-cmdline.rs:6:1
- |
-LL | #![plugin(lint_plugin_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to 3 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0453`.
diff --git a/tests/ui-fulldeps/plugin/lint-plugin.rs b/tests/ui-fulldeps/plugin/lint-plugin.rs
deleted file mode 100644
index 66057eea6..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-// aux-build:lint-plugin-test.rs
-// ignore-stage1
-#![feature(plugin)]
-#![plugin(lint_plugin_test)] //~ WARNING use of deprecated attribute
-#![allow(dead_code)]
-
-fn lintme() { } //~ WARNING item is named 'lintme'
-
-#[allow(test_lint)]
-pub fn main() {
- fn lintme() { }
-}
diff --git a/tests/ui-fulldeps/plugin/lint-plugin.stderr b/tests/ui-fulldeps/plugin/lint-plugin.stderr
deleted file mode 100644
index dd5d3d72e..000000000
--- a/tests/ui-fulldeps/plugin/lint-plugin.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: item is named 'lintme'
- --> $DIR/lint-plugin.rs:8:1
- |
-LL | fn lintme() { }
- | ^^^^^^^^^^^^^^^
- |
- = note: `#[warn(test_lint)]` on by default
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-plugin.rs:5:1
- |
-LL | #![plugin(lint_plugin_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: 2 warnings emitted
-
diff --git a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs
deleted file mode 100644
index 83a8b3e1a..000000000
--- a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// check-pass
-// aux-build:lint-tool-test.rs
-// ignore-stage1
-// compile-flags: -A test-lint
-
-#![feature(plugin)]
-#![plugin(lint_tool_test)] //~ WARNING compiler plugins are deprecated
-
-fn lintme() {}
-//~^ WARNING item is named 'lintme' [clippy::test_lint]
-
-pub fn main() {}
diff --git a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr
deleted file mode 100644
index 0e6617959..000000000
--- a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr
+++ /dev/null
@@ -1,34 +0,0 @@
-warning: lint name `test_lint` is deprecated and may not have an effect in the future.
- |
- = help: change it to clippy::test_lint
- = note: requested on the command line with `-A test_lint`
- = note: `#[warn(renamed_and_removed_lints)]` on by default
-
-warning: lint name `test_lint` is deprecated and may not have an effect in the future.
- |
- = help: change it to clippy::test_lint
- = note: requested on the command line with `-A test_lint`
-
-warning: item is named 'lintme'
- --> $DIR/lint-tool-cmdline-allow.rs:9:1
- |
-LL | fn lintme() {}
- | ^^^^^^^^^^^^^^
- |
- = note: `#[warn(clippy::test_lint)]` on by default
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-tool-cmdline-allow.rs:7:1
- |
-LL | #![plugin(lint_tool_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: lint name `test_lint` is deprecated and may not have an effect in the future.
- |
- = help: change it to clippy::test_lint
- = note: requested on the command line with `-A test_lint`
-
-warning: 5 warnings emitted
-
diff --git a/tests/ui-fulldeps/plugin/lint-tool-test.rs b/tests/ui-fulldeps/plugin/lint-tool-test.rs
deleted file mode 100644
index f92bcd213..000000000
--- a/tests/ui-fulldeps/plugin/lint-tool-test.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// aux-build:lint-tool-test.rs
-// ignore-stage1
-// compile-flags: --cfg foo
-
-#![feature(plugin)]
-#![plugin(lint_tool_test)]
-//~^ WARN use of deprecated attribute `plugin`
-#![allow(dead_code)]
-#![cfg_attr(foo, warn(test_lint))]
-//~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future
-//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future
-//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future
-#![deny(clippy_group)]
-//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
-//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
-//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
-
-fn lintme() { } //~ ERROR item is named 'lintme'
-
-#[allow(clippy::group)]
-fn lintmetoo() {}
-
-#[allow(clippy::test_lint)]
-pub fn main() {
- fn lintme() { }
- fn lintmetoo() { } //~ ERROR item is named 'lintmetoo'
-}
-
-#[allow(test_group)]
-//~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future
-//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future
-//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future
-#[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist`
-fn hello() {
- fn lintmetoo() { }
-}
diff --git a/tests/ui-fulldeps/plugin/lint-tool-test.stderr b/tests/ui-fulldeps/plugin/lint-tool-test.stderr
deleted file mode 100644
index 027cf8f80..000000000
--- a/tests/ui-fulldeps/plugin/lint-tool-test.stderr
+++ /dev/null
@@ -1,95 +0,0 @@
-warning: lint name `test_lint` is deprecated and may not have an effect in the future.
- --> $DIR/lint-tool-test.rs:9:23
- |
-LL | #![cfg_attr(foo, warn(test_lint))]
- | ^^^^^^^^^ help: change it to: `clippy::test_lint`
- |
- = note: `#[warn(renamed_and_removed_lints)]` on by default
-
-warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
- --> $DIR/lint-tool-test.rs:13:9
- |
-LL | #![deny(clippy_group)]
- | ^^^^^^^^^^^^ help: change it to: `clippy::group`
-
-warning: lint name `test_group` is deprecated and may not have an effect in the future.
- --> $DIR/lint-tool-test.rs:29:9
- |
-LL | #[allow(test_group)]
- | ^^^^^^^^^^ help: change it to: `clippy::test_group`
-
-warning: lint name `test_lint` is deprecated and may not have an effect in the future.
- --> $DIR/lint-tool-test.rs:9:23
- |
-LL | #![cfg_attr(foo, warn(test_lint))]
- | ^^^^^^^^^ help: change it to: `clippy::test_lint`
-
-warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
- --> $DIR/lint-tool-test.rs:13:9
- |
-LL | #![deny(clippy_group)]
- | ^^^^^^^^^^^^ help: change it to: `clippy::group`
-
-error: item is named 'lintme'
- --> $DIR/lint-tool-test.rs:18:1
- |
-LL | fn lintme() { }
- | ^^^^^^^^^^^^^^^
- |
-note: the lint level is defined here
- --> $DIR/lint-tool-test.rs:13:9
- |
-LL | #![deny(clippy_group)]
- | ^^^^^^^^^^^^
- = note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]`
-
-error: item is named 'lintmetoo'
- --> $DIR/lint-tool-test.rs:26:5
- |
-LL | fn lintmetoo() { }
- | ^^^^^^^^^^^^^^^^^^
- |
- = note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]`
-
-warning: lint name `test_group` is deprecated and may not have an effect in the future.
- --> $DIR/lint-tool-test.rs:29:9
- |
-LL | #[allow(test_group)]
- | ^^^^^^^^^^ help: change it to: `clippy::test_group`
-
-warning: unknown lint: `this_lint_does_not_exist`
- --> $DIR/lint-tool-test.rs:33:8
- |
-LL | #[deny(this_lint_does_not_exist)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: `#[warn(unknown_lints)]` on by default
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lint-tool-test.rs:6:1
- |
-LL | #![plugin(lint_tool_test)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: lint name `test_lint` is deprecated and may not have an effect in the future.
- --> $DIR/lint-tool-test.rs:9:23
- |
-LL | #![cfg_attr(foo, warn(test_lint))]
- | ^^^^^^^^^ help: change it to: `clippy::test_lint`
-
-warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
- --> $DIR/lint-tool-test.rs:13:9
- |
-LL | #![deny(clippy_group)]
- | ^^^^^^^^^^^^ help: change it to: `clippy::group`
-
-warning: lint name `test_group` is deprecated and may not have an effect in the future.
- --> $DIR/lint-tool-test.rs:29:9
- |
-LL | #[allow(test_group)]
- | ^^^^^^^^^^ help: change it to: `clippy::test_group`
-
-error: aborting due to 2 previous errors; 11 warnings emitted
-
diff --git a/tests/ui-fulldeps/plugin/lto-syntax-extension.rs b/tests/ui-fulldeps/plugin/lto-syntax-extension.rs
deleted file mode 100644
index 5964e70f1..000000000
--- a/tests/ui-fulldeps/plugin/lto-syntax-extension.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// run-pass
-// aux-build:lto-syntax-extension-lib.rs
-// aux-build:lto-syntax-extension-plugin.rs
-// compile-flags:-C lto
-// ignore-stage1
-// no-prefer-dynamic
-
-#![feature(plugin)]
-#![plugin(lto_syntax_extension_plugin)] //~ WARNING compiler plugins are deprecated
-
-extern crate lto_syntax_extension_lib;
-
-fn main() {
- lto_syntax_extension_lib::foo();
-}
diff --git a/tests/ui-fulldeps/plugin/lto-syntax-extension.stderr b/tests/ui-fulldeps/plugin/lto-syntax-extension.stderr
deleted file mode 100644
index 555493f32..000000000
--- a/tests/ui-fulldeps/plugin/lto-syntax-extension.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/lto-syntax-extension.rs:9:1
- |
-LL | #![plugin(lto_syntax_extension_plugin)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: 1 warning emitted
-
diff --git a/tests/ui-fulldeps/plugin/macro-crate-rlib.rs b/tests/ui-fulldeps/plugin/macro-crate-rlib.rs
deleted file mode 100644
index 38bd34053..000000000
--- a/tests/ui-fulldeps/plugin/macro-crate-rlib.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// aux-build:rlib-crate-test.rs
-// ignore-stage1
-// ignore-cross-compile gives a different error message
-
-#![feature(plugin)]
-#![plugin(rlib_crate_test)]
-//~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib
-
-fn main() {}
diff --git a/tests/ui-fulldeps/plugin/macro-crate-rlib.stderr b/tests/ui-fulldeps/plugin/macro-crate-rlib.stderr
deleted file mode 100644
index 0651cee56..000000000
--- a/tests/ui-fulldeps/plugin/macro-crate-rlib.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0457]: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format
- --> $DIR/macro-crate-rlib.rs:6:11
- |
-LL | #![plugin(rlib_crate_test)]
- | ^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0457`.
diff --git a/tests/ui-fulldeps/plugin/multiple-plugins.rs b/tests/ui-fulldeps/plugin/multiple-plugins.rs
deleted file mode 100644
index 9af3ebd57..000000000
--- a/tests/ui-fulldeps/plugin/multiple-plugins.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-// aux-build:multiple-plugins-1.rs
-// aux-build:multiple-plugins-2.rs
-// ignore-stage1
-
-// Check that the plugin registrar of multiple plugins doesn't conflict
-
-#![feature(plugin)]
-#![plugin(multiple_plugins_1)] //~ WARN use of deprecated attribute `plugin`
-#![plugin(multiple_plugins_2)] //~ WARN use of deprecated attribute `plugin`
-
-fn main() {}
diff --git a/tests/ui-fulldeps/plugin/multiple-plugins.stderr b/tests/ui-fulldeps/plugin/multiple-plugins.stderr
deleted file mode 100644
index 878ffabfc..000000000
--- a/tests/ui-fulldeps/plugin/multiple-plugins.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/multiple-plugins.rs:9:1
- |
-LL | #![plugin(multiple_plugins_1)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/multiple-plugins.rs:10:1
- |
-LL | #![plugin(multiple_plugins_2)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
-
-warning: 2 warnings emitted
-
diff --git a/tests/ui-fulldeps/plugin/outlive-expansion-phase.rs b/tests/ui-fulldeps/plugin/outlive-expansion-phase.rs
deleted file mode 100644
index fb22888d9..000000000
--- a/tests/ui-fulldeps/plugin/outlive-expansion-phase.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-pass
-// aux-build:outlive-expansion-phase.rs
-// ignore-stage1
-
-#![feature(plugin)]
-#![plugin(outlive_expansion_phase)] //~ WARNING compiler plugins are deprecated
-
-pub fn main() {}
diff --git a/tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr b/tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr
deleted file mode 100644
index e40a08ae7..000000000
--- a/tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/outlive-expansion-phase.rs:6:1
- |
-LL | #![plugin(outlive_expansion_phase)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-warning: 1 warning emitted
-
diff --git a/tests/ui-fulldeps/plugin/plugin-args.rs b/tests/ui-fulldeps/plugin/plugin-args.rs
deleted file mode 100644
index 488f2b775..000000000
--- a/tests/ui-fulldeps/plugin/plugin-args.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// aux-build:empty-plugin.rs
-// ignore-stage1
-
-#![feature(plugin)]
-#![plugin(empty_plugin(args))]
-//~^ ERROR malformed `plugin` attribute
-//~| WARNING compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui-fulldeps/plugin/plugin-args.stderr b/tests/ui-fulldeps/plugin/plugin-args.stderr
deleted file mode 100644
index 177f33005..000000000
--- a/tests/ui-fulldeps/plugin/plugin-args.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0498]: malformed `plugin` attribute
- --> $DIR/plugin-args.rs:5:11
- |
-LL | #![plugin(empty_plugin(args))]
- | ^^^^^^^^^^^^^^^^^^ malformed attribute
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/plugin-args.rs:5:1
- |
-LL | #![plugin(empty_plugin(args))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0498`.
diff --git a/tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs b/tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs
deleted file mode 100644
index 4d26e08d8..000000000
--- a/tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// check-pass
-// aux-build:empty-plugin.rs
-// ignore-cross-compile
-//
-// empty_plugin will not compile on a cross-compiled target because
-// librustc_ast is not compiled for it.
-
-extern crate empty_plugin; // OK, plugin crates are still crates
-
-fn main() {}
diff --git a/tests/ui-fulldeps/pprust-expr-roundtrip.rs b/tests/ui-fulldeps/pprust-expr-roundtrip.rs
index 541be7ebb..685a029dc 100644
--- a/tests/ui-fulldeps/pprust-expr-roundtrip.rs
+++ b/tests/ui-fulldeps/pprust-expr-roundtrip.rs
@@ -38,9 +38,9 @@ use rustc_ast::*;
use rustc_ast_pretty::pprust;
use rustc_parse::new_parser_from_source_str;
use rustc_session::parse::ParseSess;
-use rustc_span::source_map::FilePathMapping;
-use rustc_span::source_map::{FileName, Spanned, DUMMY_SP};
+use rustc_span::source_map::{FilePathMapping, Spanned};
use rustc_span::symbol::Ident;
+use rustc_span::{FileName, DUMMY_SP};
use thin_vec::{thin_vec, ThinVec};
fn parse_expr(ps: &ParseSess, src: &str) -> Option<P<Expr>> {
@@ -130,7 +130,7 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) {
iter_exprs(depth - 1, &mut |e| {
g(ExprKind::Closure(Box::new(Closure {
binder: ClosureBinder::NotPresent,
- capture_clause: CaptureBy::Value,
+ capture_clause: CaptureBy::Value { move_kw: DUMMY_SP },
constness: Const::No,
asyncness: Async::No,
movability: Movability::Movable,
diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
index ca09f1f01..014cd5a73 100644
--- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
+++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr
@@ -414,6 +414,8 @@ error: `#[lint(...)]` is not a valid attribute
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:601:1
diff --git a/tests/ui-fulldeps/stable-mir/check_instance.rs b/tests/ui-fulldeps/stable-mir/check_instance.rs
new file mode 100644
index 000000000..a34087775
--- /dev/null
+++ b/tests/ui-fulldeps/stable-mir/check_instance.rs
@@ -0,0 +1,122 @@
+// run-pass
+//! Test that users are able to use stable mir APIs to retrieve monomorphized instances
+
+// ignore-stage1
+// ignore-cross-compile
+// ignore-remote
+// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837
+// edition: 2021
+
+#![feature(rustc_private)]
+#![feature(assert_matches)]
+#![feature(control_flow_enum)]
+
+extern crate rustc_middle;
+#[macro_use]
+extern crate rustc_smir;
+extern crate rustc_driver;
+extern crate rustc_interface;
+extern crate stable_mir;
+
+use mir::{mono::Instance, TerminatorKind::*};
+use rustc_middle::ty::TyCtxt;
+use rustc_smir::rustc_internal;
+use stable_mir::ty::{RigidTy, TyKind};
+use stable_mir::*;
+use std::io::Write;
+use std::ops::ControlFlow;
+
+const CRATE_NAME: &str = "input";
+
+/// This function uses the Stable MIR APIs to get information about the test crate.
+fn test_stable_mir(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
+ let items = stable_mir::all_local_items();
+
+ // Get all items and split generic vs monomorphic items.
+ let (generic, mono): (Vec<_>, Vec<_>) =
+ items.into_iter().partition(|item| item.requires_monomorphization());
+ assert_eq!(mono.len(), 3, "Expected 2 mono functions and one constant");
+ assert_eq!(generic.len(), 2, "Expected 2 generic functions");
+
+ // For all monomorphic items, get the correspondent instances.
+ let instances = mono
+ .iter()
+ .filter_map(|item| mir::mono::Instance::try_from(*item).ok())
+ .collect::<Vec<mir::mono::Instance>>();
+ assert_eq!(instances.len(), mono.len());
+
+ // For all generic items, try_from should fail.
+ assert!(generic.iter().all(|item| mir::mono::Instance::try_from(*item).is_err()));
+
+ for instance in instances {
+ test_body(instance.body())
+ }
+ ControlFlow::Continue(())
+}
+
+/// Inspect the instance body
+fn test_body(body: mir::Body) {
+ for term in body.blocks.iter().map(|bb| &bb.terminator) {
+ match &term.kind {
+ Call { func, .. } => {
+ let TyKind::RigidTy(ty) = func.ty(body.locals()).kind() else { unreachable!() };
+ let RigidTy::FnDef(def, args) = ty else { unreachable!() };
+ let result = Instance::resolve(def, &args);
+ assert!(result.is_ok());
+ }
+ Goto { .. } | Assert { .. } | SwitchInt { .. } | Return | Drop { .. } => {
+ /* Do nothing */
+ }
+ _ => {
+ unreachable!("Unexpected terminator {term:?}")
+ }
+ }
+ }
+}
+
+/// This test will generate and analyze a dummy crate using the stable mir.
+/// For that, it will first write the dummy crate into a file.
+/// Then it will create a `StableMir` using custom arguments and then
+/// it will run the compiler.
+fn main() {
+ let path = "instance_input.rs";
+ generate_input(&path).unwrap();
+ let args = vec![
+ "rustc".to_string(),
+ "-Cpanic=abort".to_string(),
+ "--crate-type=lib".to_string(),
+ "--crate-name".to_string(),
+ CRATE_NAME.to_string(),
+ path.to_string(),
+ ];
+ run!(args, tcx, test_stable_mir(tcx)).unwrap();
+}
+
+fn generate_input(path: &str) -> std::io::Result<()> {
+ let mut file = std::fs::File::create(path)?;
+ write!(
+ file,
+ r#"
+ pub fn ty_param<T>(t: &T) -> T where T: Clone {{
+ t.clone()
+ }}
+
+ pub fn const_param<const LEN: usize>(a: [bool; LEN]) -> bool {{
+ LEN > 0 && a[0]
+ }}
+
+ pub fn monomorphic() {{
+ let v = vec![10];
+ let dup = ty_param(&v);
+ assert_eq!(v, dup);
+ }}
+
+ pub mod foo {{
+ pub fn bar_mono(i: i32) -> i64 {{
+ i as i64
+ }}
+ }}
+ "#
+ )?;
+ Ok(())
+}
diff --git a/tests/ui-fulldeps/stable-mir/compilation-result.rs b/tests/ui-fulldeps/stable-mir/compilation-result.rs
index 3ec1519fb..fc56e2481 100644
--- a/tests/ui-fulldeps/stable-mir/compilation-result.rs
+++ b/tests/ui-fulldeps/stable-mir/compilation-result.rs
@@ -4,19 +4,22 @@
// ignore-stage1
// ignore-cross-compile
// ignore-remote
+// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837
// edition: 2021
#![feature(rustc_private)]
#![feature(assert_matches)]
extern crate rustc_middle;
+#[macro_use]
extern crate rustc_smir;
+extern crate rustc_driver;
+extern crate rustc_interface;
extern crate stable_mir;
use rustc_middle::ty::TyCtxt;
use rustc_smir::rustc_internal;
use std::io::Write;
-use std::ops::ControlFlow;
/// This test will generate and analyze a dummy crate using the stable mir.
/// For that, it will first write the dummy crate into a file.
@@ -33,28 +36,26 @@ fn main() {
}
fn test_continue(args: Vec<String>) {
- let continue_fn = |_: TyCtxt| ControlFlow::Continue::<(), bool>(true);
- let result = rustc_internal::StableMir::new(args, continue_fn).run();
+ let result = run!(args, ControlFlow::Continue::<(), bool>(true));
assert_eq!(result, Ok(true));
}
fn test_break(args: Vec<String>) {
- let continue_fn = |_: TyCtxt| ControlFlow::Break::<bool, i32>(false);
- let result = rustc_internal::StableMir::new(args, continue_fn).run();
+ let result = run!(args, ControlFlow::Break::<bool, i32>(false));
assert_eq!(result, Err(stable_mir::CompilerError::Interrupted(false)));
}
+#[allow(unreachable_code)]
fn test_skipped(mut args: Vec<String>) {
args.push("--version".to_string());
- let unreach_fn = |_: TyCtxt| -> ControlFlow<()> { unreachable!() };
- let result = rustc_internal::StableMir::new(args, unreach_fn).run();
+ let result = run!(args, unreachable!() as ControlFlow<()>);
assert_eq!(result, Err(stable_mir::CompilerError::Skipped));
}
+#[allow(unreachable_code)]
fn test_failed(mut args: Vec<String>) {
args.push("--cfg=broken".to_string());
- let unreach_fn = |_: TyCtxt| -> ControlFlow<()> { unreachable!() };
- let result = rustc_internal::StableMir::new(args, unreach_fn).run();
+ let result = run!(args, unreachable!() as ControlFlow<()>);
assert_eq!(result, Err(stable_mir::CompilerError::CompilationFailed));
}
diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs
index ce4ee3c24..ed6b786f5 100644
--- a/tests/ui-fulldeps/stable-mir/crate-info.rs
+++ b/tests/ui-fulldeps/stable-mir/crate-info.rs
@@ -4,6 +4,7 @@
// ignore-stage1
// ignore-cross-compile
// ignore-remote
+// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837
// edition: 2021
#![feature(rustc_private)]
@@ -12,14 +13,17 @@
extern crate rustc_hir;
extern crate rustc_middle;
+#[macro_use]
extern crate rustc_smir;
+extern crate rustc_driver;
+extern crate rustc_interface;
extern crate stable_mir;
use rustc_hir::def::DefKind;
use rustc_middle::ty::TyCtxt;
use rustc_smir::rustc_internal;
-
-use stable_mir::fold::Foldable;
+use stable_mir::mir::mono::Instance;
+use stable_mir::ty::{RigidTy, TyKind};
use std::assert_matches::assert_matches;
use std::io::Write;
use std::ops::ControlFlow;
@@ -38,59 +42,59 @@ fn test_stable_mir(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
let items = stable_mir::all_local_items();
assert!(get_item(&items, (DefKind::Fn, "foo::bar")).is_some());
- // Find the `std` crate.
- assert!(stable_mir::find_crate("std").is_some());
+ // Find the `std` crate and assert that there is only one of it.
+ assert!(stable_mir::find_crates("std").len() == 1);
let bar = get_item(&items, (DefKind::Fn, "bar")).unwrap();
let body = bar.body();
- assert_eq!(body.locals.len(), 2);
+ assert_eq!(body.locals().len(), 2);
assert_eq!(body.blocks.len(), 1);
let block = &body.blocks[0];
assert_eq!(block.statements.len(), 1);
- match &block.statements[0] {
- stable_mir::mir::Statement::Assign(..) => {}
+ match &block.statements[0].kind {
+ stable_mir::mir::StatementKind::Assign(..) => {}
other => panic!("{other:?}"),
}
- match &block.terminator {
- stable_mir::mir::Terminator::Return => {}
+ match &block.terminator.kind {
+ stable_mir::mir::TerminatorKind::Return => {}
other => panic!("{other:?}"),
}
let foo_bar = get_item(&items, (DefKind::Fn, "foo_bar")).unwrap();
let body = foo_bar.body();
- assert_eq!(body.locals.len(), 7);
+ assert_eq!(body.locals().len(), 5);
assert_eq!(body.blocks.len(), 4);
let block = &body.blocks[0];
- match &block.terminator {
- stable_mir::mir::Terminator::Call { .. } => {}
+ match &block.terminator.kind {
+ stable_mir::mir::TerminatorKind::Call { .. } => {}
other => panic!("{other:?}"),
}
let types = get_item(&items, (DefKind::Fn, "types")).unwrap();
let body = types.body();
- assert_eq!(body.locals.len(), 6);
+ assert_eq!(body.locals().len(), 6);
assert_matches!(
- body.locals[0].kind(),
+ body.locals()[0].ty.kind(),
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
);
assert_matches!(
- body.locals[1].kind(),
+ body.locals()[1].ty.kind(),
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
);
assert_matches!(
- body.locals[2].kind(),
+ body.locals()[2].ty.kind(),
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Char)
);
assert_matches!(
- body.locals[3].kind(),
+ body.locals()[3].ty.kind(),
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Int(stable_mir::ty::IntTy::I32))
);
assert_matches!(
- body.locals[4].kind(),
+ body.locals()[4].ty.kind(),
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Uint(stable_mir::ty::UintTy::U64))
);
assert_matches!(
- body.locals[5].kind(),
+ body.locals()[5].ty.kind(),
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Float(
stable_mir::ty::FloatTy::F64
))
@@ -100,8 +104,8 @@ fn test_stable_mir(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
let body = drop.body();
assert_eq!(body.blocks.len(), 2);
let block = &body.blocks[0];
- match &block.terminator {
- stable_mir::mir::Terminator::Drop { .. } => {}
+ match &block.terminator.kind {
+ stable_mir::mir::TerminatorKind::Drop { .. } => {}
other => panic!("{other:?}"),
}
@@ -109,47 +113,25 @@ fn test_stable_mir(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
let body = assert.body();
assert_eq!(body.blocks.len(), 2);
let block = &body.blocks[0];
- match &block.terminator {
- stable_mir::mir::Terminator::Assert { .. } => {}
+ match &block.terminator.kind {
+ stable_mir::mir::TerminatorKind::Assert { .. } => {}
other => panic!("{other:?}"),
}
let monomorphic = get_item(&items, (DefKind::Fn, "monomorphic")).unwrap();
- for block in monomorphic.body().blocks {
- match &block.terminator {
- stable_mir::mir::Terminator::Call { func, .. } => match func {
- stable_mir::mir::Operand::Constant(c) => match &c.literal.literal {
- stable_mir::ty::ConstantKind::Allocated(alloc) => {
- assert!(alloc.bytes.is_empty());
- match c.literal.ty.kind() {
- stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::FnDef(
- def,
- mut args,
- )) => {
- let func = def.body();
- match func.locals[1]
- .fold(&mut args)
- .continue_value()
- .unwrap()
- .kind()
- {
- stable_mir::ty::TyKind::RigidTy(
- stable_mir::ty::RigidTy::Uint(_),
- ) => {}
- stable_mir::ty::TyKind::RigidTy(
- stable_mir::ty::RigidTy::Tuple(_),
- ) => {}
- other => panic!("{other:?}"),
- }
- }
- other => panic!("{other:?}"),
- }
- }
+ let instance = Instance::try_from(monomorphic.clone()).unwrap();
+ for block in instance.body().blocks {
+ match &block.terminator.kind {
+ stable_mir::mir::TerminatorKind::Call { func, .. } => {
+ let TyKind::RigidTy(ty) = func.ty(&body.locals()).kind() else { unreachable!() };
+ let RigidTy::FnDef(def, args) = ty else { unreachable!() };
+ let next_func = Instance::resolve(def, &args).unwrap();
+ match next_func.body().locals()[1].ty.kind() {
+ TyKind::RigidTy(RigidTy::Uint(_)) | TyKind::RigidTy(RigidTy::Tuple(_)) => {}
other => panic!("{other:?}"),
- },
- other => panic!("{other:?}"),
- },
- stable_mir::mir::Terminator::Return => {}
+ }
+ }
+ stable_mir::mir::TerminatorKind::Return => {}
other => panic!("{other:?}"),
}
}
@@ -158,6 +140,29 @@ fn test_stable_mir(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
// Ensure we don't panic trying to get the body of a constant.
foo_const.body();
+ let locals_fn = get_item(&items, (DefKind::Fn, "locals")).unwrap();
+ let body = locals_fn.body();
+ assert_eq!(body.locals().len(), 4);
+ assert_matches!(
+ body.ret_local().ty.kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Char)
+ );
+ assert_eq!(body.arg_locals().len(), 2);
+ assert_matches!(
+ body.arg_locals()[0].ty.kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Int(stable_mir::ty::IntTy::I32))
+ );
+ assert_matches!(
+ body.arg_locals()[1].ty.kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Uint(stable_mir::ty::UintTy::U64))
+ );
+ assert_eq!(body.inner_locals().len(), 1);
+ // If conditions have an extra inner local to hold their results
+ assert_matches!(
+ body.inner_locals()[0].ty.kind(),
+ stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
+ );
+
ControlFlow::Continue(())
}
@@ -185,7 +190,7 @@ fn main() {
CRATE_NAME.to_string(),
path.to_string(),
];
- rustc_internal::StableMir::new(args, test_stable_mir).run().unwrap();
+ run!(args, tcx, test_stable_mir(tcx)).unwrap();
}
fn generate_input(path: &str) -> std::io::Result<()> {
@@ -229,6 +234,14 @@ fn generate_input(path: &str) -> std::io::Result<()> {
pub fn assert(x: i32) -> i32 {{
x + 1
+ }}
+
+ pub fn locals(a: i32, _: u64) -> char {{
+ if a > 5 {{
+ 'a'
+ }} else {{
+ 'b'
+ }}
}}"#
)?;
Ok(())
diff --git a/tests/ui-fulldeps/stable-mir/smir_internal.rs b/tests/ui-fulldeps/stable-mir/smir_internal.rs
new file mode 100644
index 000000000..b0596b188
--- /dev/null
+++ b/tests/ui-fulldeps/stable-mir/smir_internal.rs
@@ -0,0 +1,64 @@
+// run-pass
+//! Test that users are able to use retrieve internal constructs from stable ones to help with
+//! the migration.
+
+// ignore-stage1
+// ignore-cross-compile
+// ignore-remote
+// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837
+// edition: 2021
+
+#![feature(rustc_private)]
+#![feature(assert_matches)]
+#![feature(control_flow_enum)]
+
+#[macro_use]
+extern crate rustc_smir;
+extern crate rustc_driver;
+extern crate rustc_interface;
+extern crate rustc_middle;
+extern crate stable_mir;
+
+use rustc_middle::ty::TyCtxt;
+use rustc_smir::rustc_internal;
+use std::io::Write;
+use std::ops::ControlFlow;
+
+const CRATE_NAME: &str = "input";
+
+fn test_translation(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
+ let main_fn = stable_mir::entry_fn().unwrap();
+ let body = main_fn.body();
+ let orig_ty = body.locals()[0].ty;
+ let rustc_ty = rustc_internal::internal(&orig_ty);
+ assert!(rustc_ty.is_unit());
+ ControlFlow::Continue(())
+}
+
+/// This test will generate and analyze a dummy crate using the stable mir.
+/// For that, it will first write the dummy crate into a file.
+/// Then it will create a `StableMir` using custom arguments and then
+/// it will run the compiler.
+fn main() {
+ let path = "internal_input.rs";
+ generate_input(&path).unwrap();
+ let args = vec![
+ "rustc".to_string(),
+ "--crate-name".to_string(),
+ CRATE_NAME.to_string(),
+ path.to_string(),
+ ];
+ run!(args, tcx, test_translation(tcx)).unwrap();
+}
+
+fn generate_input(path: &str) -> std::io::Result<()> {
+ let mut file = std::fs::File::create(path)?;
+ write!(
+ file,
+ r#"
+ pub fn main() {{
+ }}
+ "#
+ )?;
+ Ok(())
+}
diff --git a/tests/ui-fulldeps/stable-mir/smir_visitor.rs b/tests/ui-fulldeps/stable-mir/smir_visitor.rs
new file mode 100644
index 000000000..de5148bb5
--- /dev/null
+++ b/tests/ui-fulldeps/stable-mir/smir_visitor.rs
@@ -0,0 +1,148 @@
+// run-pass
+//! Sanity check Stable MIR Visitor
+
+// ignore-stage1
+// ignore-cross-compile
+// ignore-remote
+// ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837
+// edition: 2021
+
+#![feature(rustc_private)]
+#![feature(assert_matches)]
+#![feature(control_flow_enum)]
+
+extern crate rustc_middle;
+#[macro_use]
+extern crate rustc_smir;
+extern crate rustc_driver;
+extern crate rustc_interface;
+extern crate stable_mir;
+
+use std::collections::HashSet;
+use rustc_middle::ty::TyCtxt;
+use rustc_smir::rustc_internal;
+use stable_mir::*;
+use stable_mir::mir::MirVisitor;
+use std::io::Write;
+use std::ops::ControlFlow;
+
+const CRATE_NAME: &str = "input";
+
+fn test_visitor(_tcx: TyCtxt<'_>) -> ControlFlow<()> {
+ let main_fn = stable_mir::entry_fn();
+ let main_body = main_fn.unwrap().body();
+ let main_visitor = TestVisitor::collect(&main_body);
+ assert!(main_visitor.ret_val.is_some());
+ assert!(main_visitor.args.is_empty());
+ assert!(main_visitor.tys.contains(&main_visitor.ret_val.unwrap().ty));
+ assert!(!main_visitor.calls.is_empty());
+
+ let exit_fn = main_visitor.calls.last().unwrap();
+ assert!(exit_fn.mangled_name().contains("exit_fn"), "Unexpected last function: {exit_fn:?}");
+
+ let exit_body = exit_fn.body();
+ let exit_visitor = TestVisitor::collect(&exit_body);
+ assert!(exit_visitor.ret_val.is_some());
+ assert_eq!(exit_visitor.args.len(), 1);
+ assert!(exit_visitor.tys.contains(&exit_visitor.ret_val.unwrap().ty));
+ assert!(exit_visitor.tys.contains(&exit_visitor.args[0].ty));
+ ControlFlow::Continue(())
+}
+
+struct TestVisitor<'a> {
+ pub body: &'a mir::Body,
+ pub tys: HashSet<ty::Ty>,
+ pub ret_val: Option<mir::LocalDecl>,
+ pub args: Vec<mir::LocalDecl>,
+ pub calls: Vec<mir::mono::Instance>
+}
+
+impl<'a> TestVisitor<'a> {
+ fn collect(body: &'a mir::Body) -> TestVisitor<'a> {
+ let mut visitor = TestVisitor {
+ body: &body,
+ tys: Default::default(),
+ ret_val: None,
+ args: vec![],
+ calls: vec![],
+ };
+ visitor.visit_body(&body);
+ visitor
+ }
+}
+
+impl<'a> mir::MirVisitor for TestVisitor<'a> {
+ fn visit_ty(&mut self, ty: &ty::Ty, _location: mir::visit::Location) {
+ self.tys.insert(*ty);
+ self.super_ty(ty)
+ }
+
+ fn visit_ret_decl(&mut self, local: mir::Local, decl: &mir::LocalDecl) {
+ assert!(local == mir::RETURN_LOCAL);
+ assert!(self.ret_val.is_none());
+ self.ret_val = Some(decl.clone());
+ self.super_ret_decl(local, decl);
+ }
+
+ fn visit_arg_decl(&mut self, local: mir::Local, decl: &mir::LocalDecl) {
+ self.args.push(decl.clone());
+ assert_eq!(local, self.args.len());
+ self.super_arg_decl(local, decl);
+ }
+
+ fn visit_terminator(&mut self, term: &mir::Terminator, location: mir::visit::Location) {
+ if let mir::TerminatorKind::Call { func, .. } = &term.kind {
+ let ty::TyKind::RigidTy(ty) = func.ty(self.body.locals()).kind() else { unreachable!
+ () };
+ let ty::RigidTy::FnDef(def, args) = ty else { unreachable!() };
+ self.calls.push(mir::mono::Instance::resolve(def, &args).unwrap());
+ }
+ self.super_terminator(term, location);
+ }
+}
+
+/// This test will generate and analyze a dummy crate using the stable mir.
+/// For that, it will first write the dummy crate into a file.
+/// Then it will create a `StableMir` using custom arguments and then
+/// it will run the compiler.
+fn main() {
+ let path = "sim_visitor_input.rs";
+ generate_input(&path).unwrap();
+ let args = vec![
+ "rustc".to_string(),
+ "-Cpanic=abort".to_string(),
+ "--crate-name".to_string(),
+ CRATE_NAME.to_string(),
+ path.to_string(),
+ ];
+ run!(args, tcx, test_visitor(tcx)).unwrap();
+}
+
+fn generate_input(path: &str) -> std::io::Result<()> {
+ let mut file = std::fs::File::create(path)?;
+ write!(
+ file,
+ r#"
+ fn main() -> std::process::ExitCode {{
+ let inputs = Inputs::new();
+ let total = inputs.values.iter().sum();
+ exit_fn(total)
+ }}
+
+ fn exit_fn(code: u8) -> std::process::ExitCode {{
+ std::process::ExitCode::from(code)
+ }}
+
+ struct Inputs {{
+ values: [u8; 3],
+ }}
+
+ impl Inputs {{
+ fn new() -> Inputs {{
+ Inputs {{ values: [0, 1, 2] }}
+ }}
+ }}
+ "#
+ )?;
+ Ok(())
+}
diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs
index 1f049b178..0cdf22971 100644
--- a/tests/ui/abi/compatibility.rs
+++ b/tests/ui/abi/compatibility.rs
@@ -30,6 +30,7 @@
// revisions: loongarch64
//[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
//[loongarch64] needs-llvm-components: loongarch
+//[loongarch64] min-llvm-version: 17
// revisions: wasm
//[wasm] compile-flags: --target wasm32-unknown-unknown
//[wasm] needs-llvm-components: webassembly
diff --git a/tests/ui/allocator/not-an-allocator.stderr b/tests/ui/allocator/not-an-allocator.stderr
index 62bb0679f..e1967b700 100644
--- a/tests/ui/allocator/not-an-allocator.stderr
+++ b/tests/ui/allocator/not-an-allocator.stderr
@@ -18,6 +18,7 @@ LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@@ -29,6 +30,7 @@ LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@@ -40,6 +42,7 @@ LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors
diff --git a/tests/ui/array-slice-vec/vector-no-ann.stderr b/tests/ui/array-slice-vec/vector-no-ann.stderr
index d2ea08aa4..619417a73 100644
--- a/tests/ui/array-slice-vec/vector-no-ann.stderr
+++ b/tests/ui/array-slice-vec/vector-no-ann.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Vec<T>`
--> $DIR/vector-no-ann.rs:2:9
|
LL | let _foo = Vec::new();
- | ^^^^
+ | ^^^^ ---------- type must be known at this point
|
help: consider giving `_foo` an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/asm/aarch64/interpolated-idents.stderr b/tests/ui/asm/aarch64/interpolated-idents.stderr
index f6c50c2e1..74cb992f2 100644
--- a/tests/ui/asm/aarch64/interpolated-idents.stderr
+++ b/tests/ui/asm/aarch64/interpolated-idents.stderr
@@ -33,12 +33,7 @@ LL | asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $in
LL | / m!(in out lateout inout inlateout const sym
LL | | pure nomem readonly preserves_flags
LL | | noreturn nostack options);
- | | -
- | |________________________________|
- | |________________________________in this macro invocation
- | |________________________________in this macro invocation
- | |________________________________in this macro invocation
- | in this macro invocation
+ | |________________________________- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/asm/x86_64/interpolated-idents.stderr b/tests/ui/asm/x86_64/interpolated-idents.stderr
index 80a8c8c77..a91bc768f 100644
--- a/tests/ui/asm/x86_64/interpolated-idents.stderr
+++ b/tests/ui/asm/x86_64/interpolated-idents.stderr
@@ -33,12 +33,7 @@ LL | asm!("", $in(x) x, $out(x) x, $lateout(x) x, $inout(x) x, $in
LL | / m!(in out lateout inout inlateout const sym
LL | | pure nomem readonly preserves_flags
LL | | noreturn nostack att_syntax options);
- | | -
- | |___________________________________________|
- | |___________________________________________in this macro invocation
- | |___________________________________________in this macro invocation
- | |___________________________________________in this macro invocation
- | in this macro invocation
+ | |___________________________________________- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/asm/x86_64/issue-96797.rs b/tests/ui/asm/x86_64/issue-96797.rs
index 951dd949b..6c22c2f6c 100644
--- a/tests/ui/asm/x86_64/issue-96797.rs
+++ b/tests/ui/asm/x86_64/issue-96797.rs
@@ -11,7 +11,14 @@ use std::arch::global_asm;
#[no_mangle]
fn my_func() {}
-global_asm!("call_foobar: jmp {}", sym foobar);
+global_asm!("
+.globl call_foobar
+.type call_foobar,@function
+.pushsection .text.call_foobar,\"ax\",@progbits
+call_foobar: jmp {}
+.size call_foobar, .-call_foobar
+.popsection
+", sym foobar);
fn foobar() {}
diff --git a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
index 5435f2232..e39224f2c 100644
--- a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
+++ b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
@@ -14,14 +14,12 @@ note: candidate #2 is defined in an impl of the trait `Bar` for the type `i32`
|
LL | const ID: i32 = 3;
| ^^^^^^^^^^^^^
-help: disambiguate the associated constant for candidate #1
- |
-LL | const X: i32 = <i32 as Foo>::ID;
- | ~~~~~~~~~~~~~~
-help: disambiguate the associated constant for candidate #2
+help: use fully-qualified syntax to disambiguate
|
LL | const X: i32 = <i32 as Bar>::ID;
| ~~~~~~~~~~~~~~
+LL | const X: i32 = <i32 as Foo>::ID;
+ | ~~~~~~~~~~~~~~
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
index d65991234..ac5ec8e05 100644
--- a/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
+++ b/tests/ui/associated-consts/defaults-not-assumed-fail.stderr
@@ -24,6 +24,7 @@ note: erroneous constant encountered
LL | assert_eq!(<() as Tr>::B, 0); // causes the error above
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/associated-consts/issue-105330.rs b/tests/ui/associated-consts/issue-105330.rs
index 86e45f10b..6c6dae864 100644
--- a/tests/ui/associated-consts/issue-105330.rs
+++ b/tests/ui/associated-consts/issue-105330.rs
@@ -9,13 +9,11 @@ impl TraitWAssocConst for impl Demo { //~ ERROR E0404
}
fn foo<A: TraitWAssocConst<A=32>>() { //~ ERROR E0658
- foo::<Demo>()(); //~ ERROR E0271
- //~^ ERROR E0618
- //~| ERROR E0277
+ foo::<Demo>()();
}
-fn main<A: TraitWAssocConst<A=32>>() { //~ ERROR E0131
+fn main<A: TraitWAssocConst<A=32>>() {
//~^ ERROR E0658
- foo::<Demo>(); //~ ERROR E0277
- //~^ ERROR E0271
+ //~| ERROR E0131
+ foo::<Demo>();
}
diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr
index 927422fa8..aeedf6b19 100644
--- a/tests/ui/associated-consts/issue-105330.stderr
+++ b/tests/ui/associated-consts/issue-105330.stderr
@@ -25,7 +25,7 @@ LL | fn foo<A: TraitWAssocConst<A=32>>() {
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
error[E0658]: associated const equality is incomplete
- --> $DIR/issue-105330.rs:17:29
+ --> $DIR/issue-105330.rs:15:29
|
LL | fn main<A: TraitWAssocConst<A=32>>() {
| ^^^^
@@ -33,91 +33,19 @@ LL | fn main<A: TraitWAssocConst<A=32>>() {
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
--> $DIR/issue-105330.rs:6:27
|
LL | impl TraitWAssocConst for impl Demo {
| ^^^^^^^^^
error[E0131]: `main` function is not allowed to have generic parameters
- --> $DIR/issue-105330.rs:17:8
+ --> $DIR/issue-105330.rs:15:8
|
LL | fn main<A: TraitWAssocConst<A=32>>() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` cannot have generic parameters
-error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
- --> $DIR/issue-105330.rs:12:11
- |
-LL | foo::<Demo>()();
- | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo`
- |
-help: this trait has no implementations, consider adding one
- --> $DIR/issue-105330.rs:1:1
- |
-LL | pub trait TraitWAssocConst {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:11
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo`
-
-error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32`
- --> $DIR/issue-105330.rs:12:11
- |
-LL | foo::<Demo>()();
- | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A`
- |
- = note: expected constant `32`
- found constant `<Demo as TraitWAssocConst>::A`
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:28
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^ required by this bound in `foo`
-
-error[E0618]: expected function, found `()`
- --> $DIR/issue-105330.rs:12:5
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ----------------------------------- `foo::<Demo>` defined here returns `()`
-LL | foo::<Demo>()();
- | ^^^^^^^^^^^^^--
- | |
- | call expression requires function
-
-error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied
- --> $DIR/issue-105330.rs:19:11
- |
-LL | foo::<Demo>();
- | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo`
- |
-help: this trait has no implementations, consider adding one
- --> $DIR/issue-105330.rs:1:1
- |
-LL | pub trait TraitWAssocConst {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:11
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo`
-
-error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32`
- --> $DIR/issue-105330.rs:19:11
- |
-LL | foo::<Demo>();
- | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A`
- |
- = note: expected constant `32`
- found constant `<Demo as TraitWAssocConst>::A`
-note: required by a bound in `foo`
- --> $DIR/issue-105330.rs:11:28
- |
-LL | fn foo<A: TraitWAssocConst<A=32>>() {
- | ^^^^ required by this bound in `foo`
-
-error: aborting due to 11 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0131, E0271, E0277, E0404, E0562, E0618, E0658.
+Some errors have detailed explanations: E0131, E0404, E0562, E0658.
For more information about an error, try `rustc --explain E0131`.
diff --git a/tests/ui/associated-consts/issue-58022.rs b/tests/ui/associated-consts/issue-58022.rs
index 2a8a1eaa6..8e2a441f2 100644
--- a/tests/ui/associated-consts/issue-58022.rs
+++ b/tests/ui/associated-consts/issue-58022.rs
@@ -11,6 +11,7 @@ impl Bar<[u8]> {
const SIZE: usize = 32;
fn new(slice: &[u8; Self::SIZE]) -> Self {
+ //~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
Foo(Box::new(*slice))
//~^ ERROR: expected function, tuple struct or tuple variant, found trait `Foo`
}
diff --git a/tests/ui/associated-consts/issue-58022.stderr b/tests/ui/associated-consts/issue-58022.stderr
index 56d85c066..82cbc9ed3 100644
--- a/tests/ui/associated-consts/issue-58022.stderr
+++ b/tests/ui/associated-consts/issue-58022.stderr
@@ -7,13 +7,27 @@ LL |
LL | fn new(slice: &[u8; Foo::SIZE]) -> Self;
| ^^^^^^^^^ cannot refer to the associated constant of trait
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/issue-58022.rs:13:41
+ |
+LL | fn new(slice: &[u8; Self::SIZE]) -> Self {
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Bar<[u8]>`, the trait `Sized` is not implemented for `[u8]`
+note: required because it appears within the type `Bar<[u8]>`
+ --> $DIR/issue-58022.rs:8:12
+ |
+LL | pub struct Bar<T: ?Sized>(T);
+ | ^^^
+ = note: the return type of a function must have a statically known size
+
error[E0423]: expected function, tuple struct or tuple variant, found trait `Foo`
- --> $DIR/issue-58022.rs:14:9
+ --> $DIR/issue-58022.rs:15:9
|
LL | Foo(Box::new(*slice))
| ^^^ not a function, tuple struct or tuple variant
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0423, E0790.
-For more information about an error, try `rustc --explain E0423`.
+Some errors have detailed explanations: E0277, E0423, E0790.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr
index 464b59c24..0620725ca 100644
--- a/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr
+++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr
@@ -10,6 +10,18 @@ note: required by a bound in `Ty::Pr`
LL | type Pr<T: Copy> = T;
| ^^^^ required by this bound in `Ty::Pr`
-error: aborting due to previous error
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/generic-associated-types-bad.rs:16:27
+ |
+LL | const _: Ty::Pr<String> = String::new();
+ | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+note: required by a bound in `Ty::Pr`
+ --> $DIR/generic-associated-types-bad.rs:10:16
+ |
+LL | type Pr<T: Copy> = T;
+ | ^^^^ required by this bound in `Ty::Pr`
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr
index 4f371b24e..fcf828c21 100644
--- a/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr
+++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `Vec<()>: Copy` is not satisfied
- --> $DIR/generic-associated-types-bad.rs:20:12
+ --> $DIR/generic-associated-types-bad.rs:21:12
|
LL | let _: Ty::Pr<Vec<()>>;
| ^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<()>`
diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr
index 74ec39424..94c205218 100644
--- a/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr
+++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr
@@ -1,5 +1,5 @@
error: lifetime may not live long enough
- --> $DIR/generic-associated-types-bad.rs:25:12
+ --> $DIR/generic-associated-types-bad.rs:26:12
|
LL | fn user<'a>() {
| -- lifetime `'a` defined here
diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.rs b/tests/ui/associated-inherent-types/generic-associated-types-bad.rs
index e66392a0a..f5deec422 100644
--- a/tests/ui/associated-inherent-types/generic-associated-types-bad.rs
+++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.rs
@@ -14,6 +14,7 @@ impl Ty {
#[cfg(item)]
const _: Ty::Pr<String> = String::new(); //[item]~ the trait bound `String: Copy` is not satisfied
+//[item]~^ the trait bound `String: Copy` is not satisfied
fn main() {
#[cfg(local)]
diff --git a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
index 6f206f2b8..866a53f57 100644
--- a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
+++ b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
@@ -33,7 +33,7 @@ error[E0223]: ambiguous associated type
--> $DIR/issue-109071.rs:15:22
|
LL | fn T() -> Option<Self::Item> {}
- | ^^^^^^^^^^ help: use the fully-qualified path: `<Windows<T> as IntoIterator>::Item`
+ | ^^^^^^^^^^ help: use fully-qualified syntax: `<Windows<T> as IntoIterator>::Item`
error: aborting due to 4 previous errors
diff --git a/tests/ui/associated-inherent-types/issue-109789.stderr b/tests/ui/associated-inherent-types/issue-109789.stderr
index 84fc85cd0..e844f6795 100644
--- a/tests/ui/associated-inherent-types/issue-109789.stderr
+++ b/tests/ui/associated-inherent-types/issue-109789.stderr
@@ -15,6 +15,7 @@ LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {}
|
= note: expected struct `Foo<fn(&'static ())>`
found struct `Foo<for<'a> fn(&'a ())>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr
index 88c72042c..9206b4f6d 100644
--- a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr
+++ b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:12
|
LL | let _: S::<bool>::Pr = ();
- | ^^^^^^^^^^^^^ help: use the fully-qualified path: `<S<bool> as Tr>::Pr`
+ | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<S<bool> as Tr>::Pr`
error: aborting due to previous error
diff --git a/tests/ui/associated-inherent-types/regionck-1.stderr b/tests/ui/associated-inherent-types/regionck-1.stderr
index b17d89ca3..62a008682 100644
--- a/tests/ui/associated-inherent-types/regionck-1.stderr
+++ b/tests/ui/associated-inherent-types/regionck-1.stderr
@@ -2,9 +2,14 @@ error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regionck-1.rs:9:30
|
LL | type NoTyOutliv<'a, T> = &'a T;
- | ^^^^^- help: consider adding a where clause: `where T: 'a`
- | |
- | ...so that the reference type `&'a T` does not outlive the data it points at
+ | -- ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
+ | |
+ | the parameter type `T` must be valid for the lifetime `'a` as defined here...
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | type NoTyOutliv<'a, T: 'a> = &'a T;
+ | ++++
error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references
--> $DIR/regionck-1.rs:10:31
diff --git a/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr b/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr
index 97088b79f..f7a47be8d 100644
--- a/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr
+++ b/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/ambiguous-associated-type-with-generics.rs:13:13
|
LL | let _x: <dyn Trait<i32>>::Ty;
- | ^^^^^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<dyn Trait<i32> as Assoc>::Ty`
+ | ^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<dyn Trait<i32> as Assoc>::Ty`
error: aborting due to previous error
diff --git a/tests/ui/associated-item/associated-item-duplicate-names-3.stderr b/tests/ui/associated-item/associated-item-duplicate-names-3.stderr
index d0c170620..a2346e292 100644
--- a/tests/ui/associated-item/associated-item-duplicate-names-3.stderr
+++ b/tests/ui/associated-item/associated-item-duplicate-names-3.stderr
@@ -13,7 +13,7 @@ error[E0223]: ambiguous associated type
--> $DIR/associated-item-duplicate-names-3.rs:18:12
|
LL | let x: Baz::Bar = 5;
- | ^^^^^^^^ help: use the fully-qualified path: `<Baz as Foo>::Bar`
+ | ^^^^^^^^ help: use fully-qualified syntax: `<Baz as Foo>::Bar`
error: aborting due to 2 previous errors
diff --git a/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs b/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs
new file mode 100644
index 000000000..c1047d856
--- /dev/null
+++ b/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs
@@ -0,0 +1,28 @@
+use std::collections::HashMap;
+use std::hash::Hash;
+
+trait LowT: Identify {}
+
+trait Identify {
+ type Id: Clone + Hash + PartialEq + Eq;
+ fn identify(&self) -> Self::Id;
+}
+
+struct MapStore<L, I>
+where
+ L: LowT + Identify<Id = I>,
+{
+ lows: HashMap<I, L>,
+}
+
+impl<L, I> MapStore<L, I>
+where
+ L: LowT + Identify<Id = I>,
+ I: Clone + Hash + PartialEq + Eq,
+{
+ fn remove_low(&mut self, low: &impl LowT) {
+ let _low = self.lows.remove(low.identify()).unwrap(); //~ ERROR mismatched types
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.stderr b/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.stderr
new file mode 100644
index 000000000..78bf93c32
--- /dev/null
+++ b/tests/ui/associated-type-bounds/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/do-not-look-at-parent-item-in-suggestion-for-type-param-of-current-assoc-item.rs:24:37
+ |
+LL | let _low = self.lows.remove(low.identify()).unwrap();
+ | ------ ^^^^^^^^^^^^^^ expected `&I`, found associated type
+ | |
+ | arguments to this method are incorrect
+ |
+ = note: expected reference `&I`
+ found associated type `<impl LowT as Identify>::Id`
+ = help: consider constraining the associated type `<impl LowT as Identify>::Id` to `&I`
+ = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
+note: method defined here
+ --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/associated-type-bounds/duplicate.rs b/tests/ui/associated-type-bounds/duplicate.rs
index 4b8bf52c3..5019804d4 100644
--- a/tests/ui/associated-type-bounds/duplicate.rs
+++ b/tests/ui/associated-type-bounds/duplicate.rs
@@ -5,258 +5,258 @@ use std::iter;
use std::mem::ManuallyDrop;
struct SI1<T: Iterator<Item: Copy, Item: Send>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: T,
}
struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: T,
}
struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: T,
}
struct SW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: T,
}
struct SW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: T,
}
struct SW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: T,
}
enum EI1<T: Iterator<Item: Copy, Item: Send>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
V(T),
}
enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
V(T),
}
enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
V(T),
}
enum EW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
V(T),
}
enum EW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
V(T),
}
enum EW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
V(T),
}
union UI1<T: Iterator<Item: Copy, Item: Send>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: ManuallyDrop<T>,
}
union UI2<T: Iterator<Item: Copy, Item: Copy>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: ManuallyDrop<T>,
}
union UI3<T: Iterator<Item: 'static, Item: 'static>> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
f: ManuallyDrop<T>,
}
union UW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: ManuallyDrop<T>,
}
union UW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: ManuallyDrop<T>,
}
union UW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
f: ManuallyDrop<T>,
}
fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FW1<T>()
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
fn FW2<T>()
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
fn FW3<T>()
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
iter::empty()
}
fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
iter::empty()
}
fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
iter::empty()
}
fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TAW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
= T;
type TAW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
= T;
type TAW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
= T;
type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRS1: Iterator<Item: Copy, Item: Send> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
-//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRS2: Iterator<Item: Copy, Item: Copy> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
-//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRS3: Iterator<Item: 'static, Item: 'static> {}
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
-//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
trait TRW1<T>
where
T: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRW2<T>
where
T: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRW3<T>
where
T: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRSW1
where
Self: Iterator<Item: Copy, Item: Send>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
- //~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+ //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRSW2
where
Self: Iterator<Item: Copy, Item: Copy>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
- //~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+ //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRSW3
where
Self: Iterator<Item: 'static, Item: 'static>,
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
- //~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
+ //~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
{
}
trait TRA1 {
type A: Iterator<Item: Copy, Item: Send>;
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
}
trait TRA2 {
type A: Iterator<Item: Copy, Item: Copy>;
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
}
trait TRA3 {
type A: Iterator<Item: 'static, Item: 'static>;
- //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+ //~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
}
type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
-//~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719]
+//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
fn main() {}
diff --git a/tests/ui/associated-type-bounds/duplicate.stderr b/tests/ui/associated-type-bounds/duplicate.stderr
index 08721eff7..3888e6223 100644
--- a/tests/ui/associated-type-bounds/duplicate.stderr
+++ b/tests/ui/associated-type-bounds/duplicate.stderr
@@ -1,4 +1,4 @@
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:7:36
|
LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> {
@@ -6,7 +6,7 @@ LL | struct SI1<T: Iterator<Item: Copy, Item: Send>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:11:36
|
LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
@@ -14,7 +14,7 @@ LL | struct SI2<T: Iterator<Item: Copy, Item: Copy>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:15:39
|
LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
@@ -22,7 +22,7 @@ LL | struct SI3<T: Iterator<Item: 'static, Item: 'static>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:21:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -30,7 +30,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:28:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -38,7 +38,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:35:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -46,7 +46,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:41:34
|
LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> {
@@ -54,7 +54,7 @@ LL | enum EI1<T: Iterator<Item: Copy, Item: Send>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:45:34
|
LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
@@ -62,7 +62,7 @@ LL | enum EI2<T: Iterator<Item: Copy, Item: Copy>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:49:37
|
LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
@@ -70,7 +70,7 @@ LL | enum EI3<T: Iterator<Item: 'static, Item: 'static>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:55:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -78,7 +78,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:62:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -86,7 +86,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:69:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -94,7 +94,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:75:35
|
LL | union UI1<T: Iterator<Item: Copy, Item: Send>> {
@@ -102,7 +102,7 @@ LL | union UI1<T: Iterator<Item: Copy, Item: Send>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:79:35
|
LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> {
@@ -110,7 +110,7 @@ LL | union UI2<T: Iterator<Item: Copy, Item: Copy>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:83:38
|
LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> {
@@ -118,7 +118,7 @@ LL | union UI3<T: Iterator<Item: 'static, Item: 'static>> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:89:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -126,7 +126,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:96:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -134,7 +134,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:103:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -142,7 +142,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:109:32
|
LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
@@ -150,7 +150,7 @@ LL | fn FI1<T: Iterator<Item: Copy, Item: Send>>() {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:111:32
|
LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
@@ -158,7 +158,7 @@ LL | fn FI2<T: Iterator<Item: Copy, Item: Copy>>() {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:113:35
|
LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
@@ -166,7 +166,7 @@ LL | fn FI3<T: Iterator<Item: 'static, Item: 'static>>() {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:117:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -174,7 +174,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:123:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -182,7 +182,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:129:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -190,7 +190,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:134:42
|
LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
@@ -198,7 +198,7 @@ LL | fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:138:42
|
LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
@@ -206,7 +206,7 @@ LL | fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:142:45
|
LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
@@ -214,7 +214,7 @@ LL | fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:146:40
|
LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
@@ -222,7 +222,7 @@ LL | fn FAPIT1(_: impl Iterator<Item: Copy, Item: Send>) {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:148:40
|
LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
@@ -230,7 +230,7 @@ LL | fn FAPIT2(_: impl Iterator<Item: Copy, Item: Copy>) {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:150:43
|
LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
@@ -238,7 +238,7 @@ LL | fn FAPIT3(_: impl Iterator<Item: 'static, Item: 'static>) {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:153:35
|
LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
@@ -246,7 +246,7 @@ LL | type TAI1<T: Iterator<Item: Copy, Item: Send>> = T;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:155:35
|
LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
@@ -254,7 +254,7 @@ LL | type TAI2<T: Iterator<Item: Copy, Item: Copy>> = T;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:157:38
|
LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
@@ -262,7 +262,7 @@ LL | type TAI3<T: Iterator<Item: 'static, Item: 'static>> = T;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:161:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -270,7 +270,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:166:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -278,7 +278,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:171:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -286,7 +286,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:175:36
|
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
@@ -294,7 +294,7 @@ LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:177:36
|
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
@@ -302,7 +302,7 @@ LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:179:39
|
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
@@ -310,7 +310,7 @@ LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:181:40
|
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
@@ -318,7 +318,7 @@ LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:183:40
|
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
@@ -326,7 +326,7 @@ LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:185:43
|
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
@@ -334,7 +334,7 @@ LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:188:36
|
LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
@@ -342,7 +342,7 @@ LL | trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:190:36
|
LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
@@ -350,7 +350,7 @@ LL | trait TRI2<T: Iterator<Item: Copy, Item: Copy>> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:192:39
|
LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
@@ -358,7 +358,7 @@ LL | trait TRI3<T: Iterator<Item: 'static, Item: 'static>> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:194:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
@@ -366,15 +366,17 @@ LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:194:34
|
LL | trait TRS1: Iterator<Item: Copy, Item: Send> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
@@ -382,15 +384,17 @@ LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:197:34
|
LL | trait TRS2: Iterator<Item: Copy, Item: Copy> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:200:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
@@ -398,15 +402,17 @@ LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:200:37
|
LL | trait TRS3: Iterator<Item: 'static, Item: 'static> {}
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:205:29
|
LL | T: Iterator<Item: Copy, Item: Send>,
@@ -414,7 +420,7 @@ LL | T: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:211:29
|
LL | T: Iterator<Item: Copy, Item: Copy>,
@@ -422,7 +428,7 @@ LL | T: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:217:32
|
LL | T: Iterator<Item: 'static, Item: 'static>,
@@ -430,7 +436,7 @@ LL | T: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:223:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
@@ -438,15 +444,17 @@ LL | Self: Iterator<Item: Copy, Item: Send>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:223:32
|
LL | Self: Iterator<Item: Copy, Item: Send>,
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:230:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
@@ -454,15 +462,17 @@ LL | Self: Iterator<Item: Copy, Item: Copy>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:230:32
|
LL | Self: Iterator<Item: Copy, Item: Copy>,
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
@@ -470,15 +480,17 @@ LL | Self: Iterator<Item: 'static, Item: 'static>,
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:237:35
|
LL | Self: Iterator<Item: 'static, Item: 'static>,
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:255:40
|
LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
@@ -486,7 +498,7 @@ LL | type TADyn1 = dyn Iterator<Item: Copy, Item: Send>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:257:44
|
LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
@@ -494,7 +506,7 @@ LL | type TADyn2 = Box<dyn Iterator<Item: Copy, Item: Copy>>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:259:43
|
LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
@@ -502,7 +514,7 @@ LL | type TADyn3 = dyn Iterator<Item: 'static, Item: 'static>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:243:34
|
LL | type A: Iterator<Item: Copy, Item: Send>;
@@ -510,7 +522,7 @@ LL | type A: Iterator<Item: Copy, Item: Send>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:247:34
|
LL | type A: Iterator<Item: Copy, Item: Copy>;
@@ -518,7 +530,7 @@ LL | type A: Iterator<Item: Copy, Item: Copy>;
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/duplicate.rs:251:37
|
LL | type A: Iterator<Item: 'static, Item: 'static>;
diff --git a/tests/ui/associated-type-bounds/elision.stderr b/tests/ui/associated-type-bounds/elision.stderr
index cc10bbcc0..a29e32a78 100644
--- a/tests/ui/associated-type-bounds/elision.stderr
+++ b/tests/ui/associated-type-bounds/elision.stderr
@@ -17,7 +17,7 @@ LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()>
| ----------------------------- -------------- ^^^^^^^^ expected `Option<&()>`, found `Option<impl Iterator<Item = &'_ ()>>`
| | |
| | expected `Option<&()>` because of return type
- | this type parameter
+ | found this type parameter
|
= note: expected enum `Option<&()>`
found enum `Option<impl Iterator<Item = &'_ ()>>`
diff --git a/tests/ui/associated-type-bounds/issue-71443-1.stderr b/tests/ui/associated-type-bounds/issue-71443-1.stderr
index 15cc9646b..09c8ec2e2 100644
--- a/tests/ui/associated-type-bounds/issue-71443-1.stderr
+++ b/tests/ui/associated-type-bounds/issue-71443-1.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-71443-1.rs:6:5
|
LL | fn hello<F: for<'a> Iterator<Item: 'a>>() {
- | - help: try adding a return type: `-> Incorrect`
+ | - help: try adding a return type: `-> Incorrect`
LL | Incorrect
| ^^^^^^^^^ expected `()`, found `Incorrect`
diff --git a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
index 61299550e..2a308f837 100644
--- a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
+++ b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated types `IntoIter` (from trait `IntoIterator`), `IntoIter` (from trait `IntoIterator`), `Item` (from trait `IntoIterator`), `Item` (from trait `IntoIterator`) must be specified
+error[E0191]: the value of the associated types `Item`, `Item`, `IntoIter` and `IntoIter` in `IntoIterator` must be specified
--> $DIR/overlaping-bound-suggestion.rs:7:13
|
LL | inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr
index b8be132e6..65f7a72fb 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.current.stderr
@@ -25,7 +25,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr
index b8be132e6..65f7a72fb 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.next.stderr
@@ -25,7 +25,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
index 58ce41d1a..4f332fa13 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs
@@ -1,6 +1,6 @@
// edition: 2021
-#![feature(return_type_notation, async_fn_in_trait)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr
index 95ef7d82f..1714dac12 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr
@@ -25,7 +25,7 @@ LL | fn bar<T: Trait<method() -> (): Send>>() {}
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/bad-inputs-and-output.rs:3:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr
index 98c1a2827..c4dc5d362 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.current_with.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr
index 1066c420c..6c2645ae5 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.current_without.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr
index 98c1a2827..c4dc5d362 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.next_with.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr
index 1066c420c..6c2645ae5 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.next_without.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:8:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.rs b/tests/ui/associated-type-bounds/return-type-notation/basic.rs
index 3dd9249a7..7f0647534 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.rs
@@ -2,7 +2,7 @@
// edition: 2021
// [with] check-pass
-#![feature(return_type_notation, async_fn_in_trait)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr
index 9962f4706..9d4bb356c 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
index edce1045e..5b96676d0 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/basic.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr
index b631dd0eb..d2a445f33 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.current.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr
index b631dd0eb..d2a445f33 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.next.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:5:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.rs b/tests/ui/associated-type-bounds/return-type-notation/equality.rs
index 6884305d7..d5a29616a 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.rs
@@ -1,6 +1,6 @@
// edition: 2021
-#![feature(return_type_notation, async_fn_in_trait)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
use std::future::Future;
diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr
index 490bfdc4c..1a2f84715 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:3:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.rs b/tests/ui/associated-type-bounds/return-type-notation/missing.rs
index a52562d78..0679b96f6 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/missing.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/missing.rs
@@ -1,6 +1,6 @@
// edition: 2021
-#![feature(return_type_notation, async_fn_in_trait)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Trait {
diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr
index 5b1c4cb0b..fb6538fa0 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/missing.rs:3:12
|
-LL | #![feature(return_type_notation, async_fn_in_trait)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.fixed b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.fixed
new file mode 100644
index 000000000..b9f26a402
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.fixed
@@ -0,0 +1,14 @@
+// run-rustfix
+trait O {
+ type M;
+}
+trait U<A: O> {
+ const N: A::M;
+}
+impl<D> O for D {
+ type M = u8;
+}
+impl<C: O<M = u8>> U<C> for u16 {
+ const N: C::M = 4u8; //~ ERROR mismatched types
+}
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.rs b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.rs
new file mode 100644
index 000000000..abff6af73
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.rs
@@ -0,0 +1,14 @@
+// run-rustfix
+trait O {
+ type M;
+}
+trait U<A: O> {
+ const N: A::M;
+}
+impl<D> O for D {
+ type M = u8;
+}
+impl<C: O> U<C> for u16 {
+ const N: C::M = 4u8; //~ ERROR mismatched types
+}
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.stderr b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.stderr
new file mode 100644
index 000000000..b104f38ce
--- /dev/null
+++ b/tests/ui/associated-type-bounds/suggest-contraining-assoc-type-because-of-assoc-const.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/suggest-contraining-assoc-type-because-of-assoc-const.rs:12:21
+ |
+LL | const N: C::M = 4u8;
+ | ^^^ expected associated type, found `u8`
+ |
+ = note: expected associated type `<C as O>::M`
+ found type `u8`
+help: consider constraining the associated type `<C as O>::M` to `u8`
+ |
+LL | impl<C: O<M = u8>> U<C> for u16 {
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr b/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr
index 236552baf..df01e1e37 100644
--- a/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr
+++ b/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr
@@ -10,11 +10,11 @@ LL | type Color;
LL | fn a<C:Vehicle+Box>(_: C::Color) {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn a<C:Vehicle+Box>(_: <C as Box>::Color) {
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn a<C:Vehicle+Box>(_: <C as Vehicle>::Color) {
| ~~~~~~~~~~~~~~~~
@@ -31,11 +31,11 @@ LL | type Color;
LL | fn b<C>(_: C::Color) where C : Vehicle+Box {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn b<C>(_: <C as Box>::Color) where C : Vehicle+Box {
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn b<C>(_: <C as Vehicle>::Color) where C : Vehicle+Box {
| ~~~~~~~~~~~~~~~~
@@ -52,11 +52,11 @@ LL | type Color;
LL | fn c<C>(_: C::Color) where C : Vehicle, C : Box {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn c<C>(_: <C as Box>::Color) where C : Vehicle, C : Box {
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn c<C>(_: <C as Vehicle>::Color) where C : Vehicle, C : Box {
| ~~~~~~~~~~~~~~~~
@@ -73,11 +73,11 @@ LL | type Color;
LL | fn e(&self, _: X::Color) where X : Box;
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn e(&self, _: <X as Box>::Color) where X : Box;
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn e(&self, _: <X as Vehicle>::Color) where X : Box;
| ~~~~~~~~~~~~~~~~
@@ -94,11 +94,11 @@ LL | type Color;
LL | fn f(&self, _: X::Color) where X : Box { }
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn f(&self, _: <X as Box>::Color) where X : Box { }
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn f(&self, _: <X as Vehicle>::Color) where X : Box { }
| ~~~~~~~~~~~~~~~~
@@ -115,11 +115,11 @@ LL | type Color;
LL | fn d(&self, _: X::Color) where X : Box { }
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn d(&self, _: <X as Box>::Color) where X : Box { }
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn d(&self, _: <X as Vehicle>::Color) where X : Box { }
| ~~~~~~~~~~~~~~~~
diff --git a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
index e765f9323..66037054e 100644
--- a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
+++ b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
@@ -18,11 +18,11 @@ LL | type Color;
LL | fn dent<C:BoxCar>(c: C, color: C::Color) {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) {
| ~~~~~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn dent<C:BoxCar>(c: C, color: <C as Box>::Color) {
| ~~~~~~~~~~~~
@@ -45,7 +45,7 @@ LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
T: Vehicle::Color = COLOR,
T: Box::Color = COLOR
-error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `Vehicle`) must be specified
+error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:30
|
LL | type Color;
@@ -71,16 +71,16 @@ LL | type Color;
LL | fn paint<C:BoxCar>(c: C, d: C::Color) {
| ^^^^^^^^ ambiguous associated type `Color`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn paint<C:BoxCar>(c: C, d: <C as Vehicle>::Color) {
| ~~~~~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) {
| ~~~~~~~~~~~~
-error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `Vehicle`) must be specified
+error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32
|
LL | type Color;
diff --git a/tests/ui/associated-types/associated-types-coherence-failure.stderr b/tests/ui/associated-types/associated-types-coherence-failure.stderr
index 40c02dca3..211613b37 100644
--- a/tests/ui/associated-types/associated-types-coherence-failure.stderr
+++ b/tests/ui/associated-types/associated-types-coherence-failure.stderr
@@ -2,19 +2,19 @@ error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Co
--> $DIR/associated-types-coherence-failure.rs:21:1
|
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
- | ------------------------------------------------------------ first implementation here
+ | ----------------------------------------------------------------------------- first implementation here
...
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_`
--> $DIR/associated-types-coherence-failure.rs:28:1
|
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
- | ------------------------------------------------------------ first implementation here
+ | ----------------------------------------------------------------------------- first implementation here
...
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
error: aborting due to 2 previous errors
diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
index 1ff6fd4b8..d361643f0 100644
--- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
+++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
@@ -13,7 +13,7 @@ error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:22:17
|
LL | trait Foo where Foo::Assoc: Bar {
- | ^^^^^^^^^^ help: use the fully-qualified path: `<Self as Foo>::Assoc`
+ | ^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Foo>::Assoc`
error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:27:10
@@ -21,7 +21,7 @@ error[E0223]: ambiguous associated type
LL | type X = std::ops::Deref::Target;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
-help: use the fully-qualified path
+help: use fully-qualified syntax
|
LL | type X = <CString as Deref>::Target;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -37,7 +37,7 @@ error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:13:23
|
LL | fn grab(&self) -> Grab::Value;
- | ^^^^^^^^^^^ help: use the fully-qualified path: `<Self as Grab>::Value`
+ | ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value`
error[E0223]: ambiguous associated type
--> $DIR/associated-types-in-ambiguous-context.rs:16:22
diff --git a/tests/ui/associated-types/associated-types-incomplete-object.rs b/tests/ui/associated-types/associated-types-incomplete-object.rs
index 4627dfd2b..f6e4bdfbf 100644
--- a/tests/ui/associated-types/associated-types-incomplete-object.rs
+++ b/tests/ui/associated-types/associated-types-incomplete-object.rs
@@ -21,11 +21,11 @@ pub fn main() {
let a = &42isize as &dyn Foo<A=usize, B=char>;
let b = &42isize as &dyn Foo<A=usize>;
- //~^ ERROR the value of the associated type `B` (from trait `Foo`) must be specified
+ //~^ ERROR the value of the associated type `B` in `Foo` must be specified
let c = &42isize as &dyn Foo<B=char>;
- //~^ ERROR the value of the associated type `A` (from trait `Foo`) must be specified
+ //~^ ERROR the value of the associated type `A` in `Foo` must be specified
let d = &42isize as &dyn Foo;
- //~^ ERROR the value of the associated types `A` (from trait `Foo`), `B` (from trait
+ //~^ ERROR the value of the associated types `A` and `B` in `Foo`
}
diff --git a/tests/ui/associated-types/associated-types-incomplete-object.stderr b/tests/ui/associated-types/associated-types-incomplete-object.stderr
index 32866c714..0c9761afe 100644
--- a/tests/ui/associated-types/associated-types-incomplete-object.stderr
+++ b/tests/ui/associated-types/associated-types-incomplete-object.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `B` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `B` in `Foo` must be specified
--> $DIR/associated-types-incomplete-object.rs:23:30
|
LL | type B;
@@ -7,7 +7,7 @@ LL | type B;
LL | let b = &42isize as &dyn Foo<A=usize>;
| ^^^^^^^^^^^^ help: specify the associated type: `Foo<A=usize, B = Type>`
-error[E0191]: the value of the associated type `A` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `A` in `Foo` must be specified
--> $DIR/associated-types-incomplete-object.rs:26:30
|
LL | type A;
@@ -16,7 +16,7 @@ LL | type A;
LL | let c = &42isize as &dyn Foo<B=char>;
| ^^^^^^^^^^^ help: specify the associated type: `Foo<B=char, A = Type>`
-error[E0191]: the value of the associated types `A` (from trait `Foo`), `B` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated types `A` and `B` in `Foo` must be specified
--> $DIR/associated-types-incomplete-object.rs:29:30
|
LL | type A;
diff --git a/tests/ui/associated-types/associated-types-issue-20346.stderr b/tests/ui/associated-types/associated-types-issue-20346.stderr
index b1708b96e..f38407986 100644
--- a/tests/ui/associated-types/associated-types-issue-20346.stderr
+++ b/tests/ui/associated-types/associated-types-issue-20346.stderr
@@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<
--> $DIR/associated-types-issue-20346.rs:34:36
|
LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
- | - this type parameter
+ | - found this type parameter
...
LL | is_iterator_of::<Option<T>, _>(&adapter);
| ------------------------------ ^^^^^^^^ type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<T>`
diff --git a/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs b/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs
index c373c5855..cc0101d63 100644
--- a/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs
+++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs
@@ -21,6 +21,7 @@ trait Other {
impl<T:Get> Other for T {
fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
//~^ ERROR the trait bound `(T, U): Get` is not satisfied
+ //~| ERROR the trait bound `(T, U): Get` is not satisfied
}
fn main() { }
diff --git a/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
index b3f2e16ba..9ebc45387 100644
--- a/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
+++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr
@@ -21,6 +21,18 @@ help: consider further restricting `Self`
LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
| +++++++++++++++
-error: aborting due to 2 previous errors
+error[E0277]: the trait bound `(T, U): Get` is not satisfied
+ --> $DIR/associated-types-no-suitable-supertrait.rs:22:5
+ |
+LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/associated-types-no-suitable-supertrait.rs:12:1
+ |
+LL | trait Get {
+ | ^^^^^^^^^
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/associated-types/associated-types-path-1.stderr b/tests/ui/associated-types/associated-types-path-1.stderr
index a67f77e37..cab9dcec0 100644
--- a/tests/ui/associated-types/associated-types-path-1.stderr
+++ b/tests/ui/associated-types/associated-types-path-1.stderr
@@ -16,11 +16,11 @@ LL | type A;
LL | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {}
| ^^^^ ambiguous associated type `A`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {}
| ~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {}
| ~~~~~~~~~~~~
diff --git a/tests/ui/associated-types/hr-associated-type-bound-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-2.stderr
index 749986f09..8ccbc9fb5 100644
--- a/tests/ui/associated-types/hr-associated-type-bound-2.stderr
+++ b/tests/ui/associated-types/hr-associated-type-bound-2.stderr
@@ -1,8 +1,10 @@
error[E0275]: overflow evaluating the requirement `for<'b> u32: X<'b>`
--> $DIR/hr-associated-type-bound-2.rs:11:1
|
-LL | impl X<'_> for u32
- | ^^^^^^^^^^^^^^^^^^
+LL | / impl X<'_> for u32
+LL | | where
+LL | | for<'b> <Self as X<'b>>::U: Clone,
+ | |______________________________________^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`hr_associated_type_bound_2`)
note: required for `u32` to implement `for<'b> X<'b>`
diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr
index 366670269..1a749007a 100644
--- a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr
+++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr
@@ -45,6 +45,7 @@ LL | trait Z<'a, T: ?Sized>
...
LL | for<'b> <T as Z<'b, u16>>::W: Clone,
| ^^^^^ required by this bound in `Z`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/associated-types/hr-associated-type-projection-1.stderr b/tests/ui/associated-types/hr-associated-type-projection-1.stderr
index dd0389c34..425cfdca0 100644
--- a/tests/ui/associated-types/hr-associated-type-projection-1.stderr
+++ b/tests/ui/associated-types/hr-associated-type-projection-1.stderr
@@ -2,7 +2,9 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
--> $DIR/hr-associated-type-projection-1.rs:13:33
|
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T {
- | - this type parameter ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
+ | - ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
+ | |
+ | expected this type parameter
|
= note: expected type parameter `T`
found associated type `<T as Deref>::Target`
diff --git a/tests/ui/associated-types/impl-wf-cycle-1.stderr b/tests/ui/associated-types/impl-wf-cycle-1.stderr
index 206060f19..53022dcb4 100644
--- a/tests/ui/associated-types/impl-wf-cycle-1.stderr
+++ b/tests/ui/associated-types/impl-wf-cycle-1.stderr
@@ -1,8 +1,12 @@
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
--> $DIR/impl-wf-cycle-1.rs:15:1
|
-LL | impl<T: Grault> Grault for (T,)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: Grault> Grault for (T,)
+LL | |
+LL | | where
+LL | | Self::A: Baz,
+LL | | Self::B: Fiz,
+ | |_________________^
|
note: required for `(T,)` to implement `Grault`
--> $DIR/impl-wf-cycle-1.rs:15:17
diff --git a/tests/ui/associated-types/impl-wf-cycle-2.stderr b/tests/ui/associated-types/impl-wf-cycle-2.stderr
index 771ba751e..81c58be92 100644
--- a/tests/ui/associated-types/impl-wf-cycle-2.stderr
+++ b/tests/ui/associated-types/impl-wf-cycle-2.stderr
@@ -1,8 +1,11 @@
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _`
--> $DIR/impl-wf-cycle-2.rs:7:1
|
-LL | impl<T: Grault> Grault for (T,)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: Grault> Grault for (T,)
+LL | |
+LL | | where
+LL | | Self::A: Copy,
+ | |__________________^
|
note: required for `(T,)` to implement `Grault`
--> $DIR/impl-wf-cycle-2.rs:7:17
diff --git a/tests/ui/associated-types/issue-22560.stderr b/tests/ui/associated-types/issue-22560.stderr
index 2b88cf0b4..46e6e3951 100644
--- a/tests/ui/associated-types/issue-22560.stderr
+++ b/tests/ui/associated-types/issue-22560.stderr
@@ -9,7 +9,7 @@ LL | type Test = dyn Add + Sub;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified
--> $DIR/issue-22560.rs:9:17
|
LL | type Output;
diff --git a/tests/ui/associated-types/issue-23595-1.stderr b/tests/ui/associated-types/issue-23595-1.stderr
index 4307477a5..3443c4925 100644
--- a/tests/ui/associated-types/issue-23595-1.stderr
+++ b/tests/ui/associated-types/issue-23595-1.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated types `ChildKey` (from trait `Hierarchy`), `Children` (from trait `Hierarchy`), `Value` (from trait `Hierarchy`) must be specified
+error[E0191]: the value of the associated types `Value`, `ChildKey` and `Children` in `Hierarchy` must be specified
--> $DIR/issue-23595-1.rs:8:58
|
LL | type Value;
diff --git a/tests/ui/associated-types/missing-associated-types.stderr b/tests/ui/associated-types/missing-associated-types.stderr
index f617df984..e9669afe8 100644
--- a/tests/ui/associated-types/missing-associated-types.stderr
+++ b/tests/ui/associated-types/missing-associated-types.stderr
@@ -9,7 +9,7 @@ LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs> {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `Add`), `Output` (from trait `Mul`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Mul`, `Output` in `Sub` must be specified
--> $DIR/missing-associated-types.rs:12:21
|
LL | type A;
@@ -38,7 +38,7 @@ LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs> {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `A` (from trait `Z`), `B` (from trait `Z`), `Output` (from trait `Add`), `Output` (from trait `Div`), `Output` (from trait `Div`), `Output` (from trait `Mul`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `A` and `B` in `Z`, `Output` and `Output` in `Div`, `Output` in `Add`, `Output` in `Mul`, `Output` in `Sub` must be specified
--> $DIR/missing-associated-types.rs:15:21
|
LL | type A;
@@ -74,7 +74,7 @@ LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Y<Rhs> {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Sub` must be specified
--> $DIR/missing-associated-types.rs:18:21
|
LL | type A;
@@ -102,7 +102,7 @@ LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Fine<Rhs> {}`
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
-error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
+error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified
--> $DIR/missing-associated-types.rs:21:21
|
LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
@@ -115,7 +115,7 @@ help: specify the associated types
LL | type Bat<Rhs> = dyn Add<Rhs, Output = Type> + Sub<Rhs, Output = Type> + Fine<Rhs>;
| ~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
-error[E0191]: the value of the associated types `Output` (from trait `Div`), `Output` (from trait `Mul`) must be specified
+error[E0191]: the value of the associated types `Output` in `Div`, `Output` in `Mul` must be specified
--> $DIR/missing-associated-types.rs:24:21
|
LL | type Bal<Rhs> = dyn X<Rhs>;
diff --git a/tests/ui/async-await/async-await-let-else.stderr b/tests/ui/async-await/async-await-let-else.stderr
index 9a1c17822..b360aab6b 100644
--- a/tests/ui/async-await/async-await-let-else.stderr
+++ b/tests/ui/async-await/async-await-let-else.stderr
@@ -22,7 +22,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely
--> $DIR/async-await-let-else.rs:47:13
|
LL | async fn foo2(x: Option<bool>) {
- | - within this `impl Future<Output = ()>`
+ | ------------------------------ within this `impl Future<Output = ()>`
...
LL | is_send(foo2(Some(true)));
| ------- ^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely
@@ -30,7 +30,7 @@ LL | is_send(foo2(Some(true)));
| required by a bound introduced by this call
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/async-await-let-else.rs:24:29
|
LL | async fn bar2<T>(_: T) -> ! {
@@ -39,7 +39,7 @@ LL | | panic!()
LL | | }
| |_^
= note: required because it captures the following types: `impl Future<Output = !>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/async-await-let-else.rs:18:32
|
LL | async fn foo2(x: Option<bool>) {
diff --git a/tests/ui/async-await/async-trait-fn.current.stderr b/tests/ui/async-await/async-trait-fn.current.stderr
deleted file mode 100644
index 7ccf2f230..000000000
--- a/tests/ui/async-await/async-trait-fn.current.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:6:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:7:5
- |
-LL | async fn bar(&self) {}
- | -----^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:8:5
- |
-LL | async fn baz() {
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/async-trait-fn.next.stderr b/tests/ui/async-await/async-trait-fn.next.stderr
deleted file mode 100644
index 7ccf2f230..000000000
--- a/tests/ui/async-await/async-trait-fn.next.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:6:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:7:5
- |
-LL | async fn bar(&self) {}
- | -----^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:8:5
- |
-LL | async fn baz() {
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/async-trait-fn.rs b/tests/ui/async-await/async-trait-fn.rs
index 04123badb..4e5e3ba83 100644
--- a/tests/ui/async-await/async-trait-fn.rs
+++ b/tests/ui/async-await/async-trait-fn.rs
@@ -1,9 +1,10 @@
// edition:2018
+// check-pass
trait T {
- async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
- async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async`
- async fn baz() { //~ ERROR functions in traits cannot be declared `async`
+ async fn foo() {}
+ async fn bar(&self) {}
+ async fn baz() {
// Nested item must not ICE.
fn a() {}
}
diff --git a/tests/ui/async-await/async-trait-fn.stderr b/tests/ui/async-await/async-trait-fn.stderr
deleted file mode 100644
index 68ebe3507..000000000
--- a/tests/ui/async-await/async-trait-fn.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:4:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:5:5
- |
-LL | async fn bar(&self) {}
- | -----^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/async-trait-fn.rs:6:5
- |
-LL | async fn baz() {
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr
index 2114fb59b..f9e5bf675 100644
--- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr
+++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr
@@ -23,7 +23,7 @@ LL | S::f();
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/async-unsafe-fn-call-in-safe.rs:24:5
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:26:5
|
LL | f();
| ^^^ call to unsafe function
diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs
index c941dc27a..14cc0dc61 100644
--- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs
+++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.rs
@@ -20,6 +20,10 @@ async fn g() {
}
fn main() {
- S::f(); //[mir]~ ERROR call to unsafe function is unsafe
- f(); //[mir]~ ERROR call to unsafe function is unsafe
+ S::f();
+ //[mir]~^ ERROR call to unsafe function is unsafe
+ //[thir]~^^ ERROR call to unsafe function `S::f` is unsafe
+ f();
+ //[mir]~^ ERROR call to unsafe function is unsafe
+ //[thir]~^^ ERROR call to unsafe function `f` is unsafe
}
diff --git a/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr b/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr
index 68d97d3fd..ba3303fe7 100644
--- a/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr
+++ b/tests/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr
@@ -14,6 +14,22 @@ LL | f();
|
= note: consult the function's documentation for information on how to avoid undefined behavior
-error: aborting due to 2 previous errors
+error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:23:5
+ |
+LL | S::f();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block
+ --> $DIR/async-unsafe-fn-call-in-safe.rs:26:5
+ |
+LL | f();
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/async-await/generator-desc.rs b/tests/ui/async-await/coroutine-desc.rs
index 500812016..500812016 100644
--- a/tests/ui/async-await/generator-desc.rs
+++ b/tests/ui/async-await/coroutine-desc.rs
diff --git a/tests/ui/async-await/generator-desc.stderr b/tests/ui/async-await/coroutine-desc.stderr
index d3e951cfe..e4cb0915a 100644
--- a/tests/ui/async-await/generator-desc.stderr
+++ b/tests/ui/async-await/coroutine-desc.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/generator-desc.rs:10:19
+ --> $DIR/coroutine-desc.rs:10:19
|
LL | fun(async {}, async {});
| --- -------- ^^^^^^^^ expected `async` block, found a different `async` block
@@ -7,16 +7,16 @@ LL | fun(async {}, async {});
| | the expected `async` block
| arguments to this function are incorrect
|
- = note: expected `async` block `{async block@$DIR/generator-desc.rs:10:9: 10:17}`
- found `async` block `{async block@$DIR/generator-desc.rs:10:19: 10:27}`
+ = note: expected `async` block `{async block@$DIR/coroutine-desc.rs:10:9: 10:17}`
+ found `async` block `{async block@$DIR/coroutine-desc.rs:10:19: 10:27}`
note: function defined here
- --> $DIR/generator-desc.rs:8:4
+ --> $DIR/coroutine-desc.rs:8:4
|
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
| ^^^ -----
error[E0308]: mismatched types
- --> $DIR/generator-desc.rs:12:16
+ --> $DIR/coroutine-desc.rs:12:16
|
LL | fun(one(), two());
| --- ^^^^^ expected future, found a different future
@@ -26,13 +26,13 @@ LL | fun(one(), two());
= help: consider `await`ing on both `Future`s
= note: distinct uses of `impl Trait` result in different opaque types
note: function defined here
- --> $DIR/generator-desc.rs:8:4
+ --> $DIR/coroutine-desc.rs:8:4
|
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
| ^^^ -----
error[E0308]: mismatched types
- --> $DIR/generator-desc.rs:14:26
+ --> $DIR/coroutine-desc.rs:14:26
|
LL | fun((async || {})(), (async || {})());
| --- -- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body
@@ -40,10 +40,10 @@ LL | fun((async || {})(), (async || {})());
| | the expected `async` closure body
| arguments to this function are incorrect
|
- = note: expected `async` closure body `{async closure body@$DIR/generator-desc.rs:14:19: 14:21}`
- found `async` closure body `{async closure body@$DIR/generator-desc.rs:14:36: 14:38}`
+ = note: expected `async` closure body `{async closure body@$DIR/coroutine-desc.rs:14:19: 14:21}`
+ found `async` closure body `{async closure body@$DIR/coroutine-desc.rs:14:36: 14:38}`
note: function defined here
- --> $DIR/generator-desc.rs:8:4
+ --> $DIR/coroutine-desc.rs:8:4
|
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
| ^^^ -----
diff --git a/tests/ui/async-await/generator-not-future.rs b/tests/ui/async-await/coroutine-not-future.rs
index 37d7cfa6f..b18635fea 100644
--- a/tests/ui/async-await/generator-not-future.rs
+++ b/tests/ui/async-await/coroutine-not-future.rs
@@ -1,42 +1,42 @@
// edition:2018
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::future::Future;
-use std::ops::Generator;
+use std::ops::Coroutine;
async fn async_fn() {}
fn returns_async_block() -> impl Future<Output = ()> {
async {}
}
-fn returns_generator() -> impl Generator<(), Yield = (), Return = ()> {
+fn returns_coroutine() -> impl Coroutine<(), Yield = (), Return = ()> {
|| {
let _: () = yield ();
}
}
fn takes_future(_f: impl Future<Output = ()>) {}
-fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
+fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
fn main() {
// okay:
takes_future(async_fn());
takes_future(returns_async_block());
takes_future(async {});
- takes_generator(returns_generator());
- takes_generator(|| {
+ takes_coroutine(returns_coroutine());
+ takes_coroutine(|| {
let _: () = yield ();
});
- // async futures are not generators:
- takes_generator(async_fn());
+ // async futures are not coroutines:
+ takes_coroutine(async_fn());
//~^ ERROR the trait bound
- takes_generator(returns_async_block());
+ takes_coroutine(returns_async_block());
//~^ ERROR the trait bound
- takes_generator(async {});
+ takes_coroutine(async {});
//~^ ERROR the trait bound
- // generators are not futures:
- takes_future(returns_generator());
+ // coroutines are not futures:
+ takes_future(returns_coroutine());
//~^ ERROR is not a future
takes_future(|ctx| {
//~^ ERROR is not a future
diff --git a/tests/ui/async-await/coroutine-not-future.stderr b/tests/ui/async-await/coroutine-not-future.stderr
new file mode 100644
index 000000000..130c5ef52
--- /dev/null
+++ b/tests/ui/async-await/coroutine-not-future.stderr
@@ -0,0 +1,81 @@
+error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
+ --> $DIR/coroutine-not-future.rs:31:21
+ |
+LL | takes_coroutine(async_fn());
+ | --------------- ^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `takes_coroutine`
+ --> $DIR/coroutine-not-future.rs:18:39
+ |
+LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
+
+error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
+ --> $DIR/coroutine-not-future.rs:33:21
+ |
+LL | takes_coroutine(returns_async_block());
+ | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `takes_coroutine`
+ --> $DIR/coroutine-not-future.rs:18:39
+ |
+LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
+
+error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:35:21: 35:29}: Coroutine<_>` is not satisfied
+ --> $DIR/coroutine-not-future.rs:35:21
+ |
+LL | takes_coroutine(async {});
+ | --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:35:21: 35:29}`
+ | |
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `takes_coroutine`
+ --> $DIR/coroutine-not-future.rs:18:39
+ |
+LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
+
+error[E0277]: `impl Coroutine<Yield = (), Return = ()>` is not a future
+ --> $DIR/coroutine-not-future.rs:39:18
+ |
+LL | takes_future(returns_coroutine());
+ | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Coroutine<Yield = (), Return = ()>` is not a future
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Future` is not implemented for `impl Coroutine<Yield = (), Return = ()>`
+ = note: impl Coroutine<Yield = (), Return = ()> must be a future or must implement `IntoFuture` to be awaited
+note: required by a bound in `takes_future`
+ --> $DIR/coroutine-not-future.rs:17:26
+ |
+LL | fn takes_future(_f: impl Future<Output = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
+
+error[E0277]: `{coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23}` is not a future
+ --> $DIR/coroutine-not-future.rs:41:18
+ |
+LL | takes_future(|ctx| {
+ | _____------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | | ctx = yield ();
+LL | | });
+ | |_____^ `{coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23}` is not a future
+ |
+ = help: the trait `Future` is not implemented for `{coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23}`
+ = note: {coroutine@$DIR/coroutine-not-future.rs:41:18: 41:23} must be a future or must implement `IntoFuture` to be awaited
+note: required by a bound in `takes_future`
+ --> $DIR/coroutine-not-future.rs:17:26
+ |
+LL | fn takes_future(_f: impl Future<Output = ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs
new file mode 100644
index 000000000..ced4434a7
--- /dev/null
+++ b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.rs
@@ -0,0 +1,10 @@
+// check-fail
+// edition:2021
+
+// test for issue-114912 - debug ice: attempted to add with overflow
+
+async fn main() {
+ //~^ ERROR `main` function is not allowed to be `async`
+ [0usize; 0xffff_ffff_ffff_ffff].await;
+ //~^ ERROR `[usize; usize::MAX]` is not a future
+}
diff --git a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr
new file mode 100644
index 000000000..8c9d06c79
--- /dev/null
+++ b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr
@@ -0,0 +1,23 @@
+error[E0277]: `[usize; usize::MAX]` is not a future
+ --> $DIR/debug-ice-attempted-to-add-with-overflow.rs:8:37
+ |
+LL | [0usize; 0xffff_ffff_ffff_ffff].await;
+ | -^^^^^
+ | ||
+ | |`[usize; usize::MAX]` is not a future
+ | help: remove the `.await`
+ |
+ = help: the trait `Future` is not implemented for `[usize; usize::MAX]`
+ = note: [usize; usize::MAX] must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `[usize; usize::MAX]` to implement `IntoFuture`
+
+error[E0752]: `main` function is not allowed to be `async`
+ --> $DIR/debug-ice-attempted-to-add-with-overflow.rs:6:1
+ |
+LL | async fn main() {
+ | ^^^^^^^^^^^^^^^ `main` function is not allowed to be `async`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0752.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
index cfb0ebe38..0d3ee8a93 100644
--- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
+++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.stderr
@@ -23,6 +23,7 @@ LL | | });
|
= note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
= note: ...but it actually implements `FnOnce<(&(),)>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr
deleted file mode 100644
index c47b99e65..000000000
--- a/tests/ui/async-await/edition-deny-async-fns-2015.current.stderr
+++ /dev/null
@@ -1,98 +0,0 @@
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:5:1
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:7:12
- |
-LL | fn baz() { async fn foo() {} }
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:9:1
- |
-LL | async fn async_baz() {
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:10:5
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:16:5
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:20:5
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:38:9
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:28:9
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:33:13
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/edition-deny-async-fns-2015.rs:20:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 10 previous errors
-
-Some errors have detailed explanations: E0670, E0706.
-For more information about an error, try `rustc --explain E0670`.
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr
deleted file mode 100644
index c47b99e65..000000000
--- a/tests/ui/async-await/edition-deny-async-fns-2015.next.stderr
+++ /dev/null
@@ -1,98 +0,0 @@
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:5:1
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:7:12
- |
-LL | fn baz() { async fn foo() {} }
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:9:1
- |
-LL | async fn async_baz() {
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:10:5
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:16:5
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:20:5
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:38:9
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:28:9
- |
-LL | async fn foo() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:33:13
- |
-LL | async fn bar() {}
- | ^^^^^ to use `async fn`, switch to Rust 2018 or later
- |
- = help: pass `--edition 2021` to `rustc`
- = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/edition-deny-async-fns-2015.rs:20:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 10 previous errors
-
-Some errors have detailed explanations: E0670, E0706.
-For more information about an error, try `rustc --explain E0670`.
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.rs b/tests/ui/async-await/edition-deny-async-fns-2015.rs
index 6bd6d879a..9059f99ba 100644
--- a/tests/ui/async-await/edition-deny-async-fns-2015.rs
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.rs
@@ -16,7 +16,6 @@ impl Foo {
trait Bar {
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
- //~^ ERROR functions in traits cannot be declared `async`
}
fn main() {
diff --git a/tests/ui/async-await/edition-deny-async-fns-2015.stderr b/tests/ui/async-await/edition-deny-async-fns-2015.stderr
index ba918eb28..c40cdc5ac 100644
--- a/tests/ui/async-await/edition-deny-async-fns-2015.stderr
+++ b/tests/ui/async-await/edition-deny-async-fns-2015.stderr
@@ -53,7 +53,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:36:9
+ --> $DIR/edition-deny-async-fns-2015.rs:35:9
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -62,7 +62,7 @@ LL | async fn bar() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:26:9
+ --> $DIR/edition-deny-async-fns-2015.rs:25:9
|
LL | async fn foo() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -71,7 +71,7 @@ LL | async fn foo() {}
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0670]: `async fn` is not permitted in Rust 2015
- --> $DIR/edition-deny-async-fns-2015.rs:31:13
+ --> $DIR/edition-deny-async-fns-2015.rs:30:13
|
LL | async fn bar() {}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
@@ -79,20 +79,6 @@ LL | async fn bar() {}
= help: pass `--edition 2021` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/edition-deny-async-fns-2015.rs:18:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 10 previous errors
+error: aborting due to 9 previous errors
-Some errors have detailed explanations: E0670, E0706.
-For more information about an error, try `rustc --explain E0670`.
+For more information about this error, try `rustc --explain E0670`.
diff --git a/tests/ui/async-await/feature-gate-async_fn_in_trait.rs b/tests/ui/async-await/feature-gate-async_fn_in_trait.rs
deleted file mode 100644
index 792f378cb..000000000
--- a/tests/ui/async-await/feature-gate-async_fn_in_trait.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// edition:2021
-
-// RPITIT is not enough to allow use of async functions
-#![allow(incomplete_features)]
-#![feature(return_position_impl_trait_in_trait)]
-
-trait T {
- async fn foo(); //~ ERROR functions in traits cannot be declared `async`
-}
-
-// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
-// feature-gate-return_position_impl_trait_in_trait.rs)
-trait T2 {
- async fn foo() -> impl Sized; //~ ERROR functions in traits cannot be declared `async`
-}
-
-trait T3 {
- fn foo() -> impl std::future::Future<Output = ()>;
-}
-
-impl T3 for () {
- async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
-}
-
-fn main() {}
diff --git a/tests/ui/async-await/feature-gate-async_fn_in_trait.stderr b/tests/ui/async-await/feature-gate-async_fn_in_trait.stderr
deleted file mode 100644
index 2a5fbd1ec..000000000
--- a/tests/ui/async-await/feature-gate-async_fn_in_trait.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/feature-gate-async_fn_in_trait.rs:8:5
- |
-LL | async fn foo();
- | -----^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/feature-gate-async_fn_in_trait.rs:14:5
- |
-LL | async fn foo() -> impl Sized;
- | -----^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/feature-gate-async_fn_in_trait.rs:22:5
- |
-LL | async fn foo() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
index d63911b0d..b0447a582 100644
--- a/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
+++ b/tests/ui/async-await/future-sizes/async-awaiting-fut.stdout
@@ -19,18 +19,18 @@ print-type-size variant `Suspend0`: 2052 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size padding: 1 bytes
print-type-size local `.fut`: 1025 bytes, alignment: 1 bytes
-print-type-size local `..generator_field4`: 1 bytes
+print-type-size local `..coroutine_field4`: 1 bytes
print-type-size local `.__awaitee`: 1 bytes
print-type-size variant `Suspend1`: 3076 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size padding: 1026 bytes
-print-type-size local `..generator_field4`: 1 bytes, alignment: 1 bytes
+print-type-size local `..coroutine_field4`: 1 bytes, alignment: 1 bytes
print-type-size local `.__awaitee`: 1025 bytes
print-type-size variant `Suspend2`: 2052 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size padding: 1 bytes
print-type-size local `.fut`: 1025 bytes, alignment: 1 bytes
-print-type-size local `..generator_field4`: 1 bytes
+print-type-size local `..coroutine_field4`: 1 bytes
print-type-size local `.__awaitee`: 1 bytes
print-type-size variant `Returned`: 1025 bytes
print-type-size upvar `.fut`: 1025 bytes, offset: 0 bytes, alignment: 1 bytes
diff --git a/tests/ui/async-await/generator-not-future.stderr b/tests/ui/async-await/generator-not-future.stderr
deleted file mode 100644
index 540501b98..000000000
--- a/tests/ui/async-await/generator-not-future.stderr
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0277]: the trait bound `impl Future<Output = ()>: Generator<_>` is not satisfied
- --> $DIR/generator-not-future.rs:31:21
- |
-LL | takes_generator(async_fn());
- | --------------- ^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future<Output = ()>`
- | |
- | required by a bound introduced by this call
- |
-note: required by a bound in `takes_generator`
- --> $DIR/generator-not-future.rs:18:39
- |
-LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator`
-
-error[E0277]: the trait bound `impl Future<Output = ()>: Generator<_>` is not satisfied
- --> $DIR/generator-not-future.rs:33:21
- |
-LL | takes_generator(returns_async_block());
- | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future<Output = ()>`
- | |
- | required by a bound introduced by this call
- |
-note: required by a bound in `takes_generator`
- --> $DIR/generator-not-future.rs:18:39
- |
-LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator`
-
-error[E0277]: the trait bound `{async block@$DIR/generator-not-future.rs:35:21: 35:29}: Generator<_>` is not satisfied
- --> $DIR/generator-not-future.rs:35:21
- |
-LL | takes_generator(async {});
- | --------------- ^^^^^^^^ the trait `Generator<_>` is not implemented for `{async block@$DIR/generator-not-future.rs:35:21: 35:29}`
- | |
- | required by a bound introduced by this call
- |
-note: required by a bound in `takes_generator`
- --> $DIR/generator-not-future.rs:18:39
- |
-LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator`
-
-error[E0277]: `impl Generator<Yield = (), Return = ()>` is not a future
- --> $DIR/generator-not-future.rs:39:18
- |
-LL | takes_future(returns_generator());
- | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Generator<Yield = (), Return = ()>` is not a future
- | |
- | required by a bound introduced by this call
- |
- = help: the trait `Future` is not implemented for `impl Generator<Yield = (), Return = ()>`
- = note: impl Generator<Yield = (), Return = ()> must be a future or must implement `IntoFuture` to be awaited
-note: required by a bound in `takes_future`
- --> $DIR/generator-not-future.rs:17:26
- |
-LL | fn takes_future(_f: impl Future<Output = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
-
-error[E0277]: `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future
- --> $DIR/generator-not-future.rs:41:18
- |
-LL | takes_future(|ctx| {
- | _____------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | | ctx = yield ();
-LL | | });
- | |_____^ `{generator@$DIR/generator-not-future.rs:41:18: 41:23}` is not a future
- |
- = help: the trait `Future` is not implemented for `{generator@$DIR/generator-not-future.rs:41:18: 41:23}`
- = note: {generator@$DIR/generator-not-future.rs:41:18: 41:23} must be a future or must implement `IntoFuture` to be awaited
-note: required by a bound in `takes_future`
- --> $DIR/generator-not-future.rs:17:26
- |
-LL | fn takes_future(_f: impl Future<Output = ()>) {}
- | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/in-trait/async-associated-types.rs b/tests/ui/async-await/in-trait/async-associated-types.rs
index 3e2739a16..8d8950047 100644
--- a/tests/ui/async-await/in-trait/async-associated-types.rs
+++ b/tests/ui/async-await/in-trait/async-associated-types.rs
@@ -1,20 +1,19 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
trait MyTrait<'a, 'b, T> where Self: 'a, T: Debug + Sized + 'b {
type MyAssoc;
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> Self::MyAssoc;
}
impl<'a, 'b, T: Debug + Sized + 'b, U: 'a> MyTrait<'a, 'b, T> for U {
type MyAssoc = (&'a U, &'b T);
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a U, &'b T) {
(self, key)
}
diff --git a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
index 06413fe6f..c8fd2d8f6 100644
--- a/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
+++ b/tests/ui/async-await/in-trait/async-default-fn-overridden.rs
@@ -1,15 +1,16 @@
// run-pass
// edition:2021
-#![feature(async_fn_in_trait)]
use std::future::Future;
trait AsyncTrait {
+ #[allow(async_fn_in_trait)]
async fn default_impl() {
assert!(false);
}
+ #[allow(async_fn_in_trait)]
async fn call_default_impl() {
Self::default_impl().await
}
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
index 38ba29718..c26f6625f 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.rs
@@ -1,9 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
use std::pin::Pin;
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
index 168ef8e9e..b70b36adb 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed-in-trait.stderr
@@ -1,11 +1,11 @@
error[E0053]: method `foo` has an incompatible type for trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:15:28
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:11:5
|
LL | async fn foo(&self) -> i32 {
- | ^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Pin<Box<dyn Future<Output = i32>>>`, found future
|
note: type in trait
- --> $DIR/async-example-desugared-boxed-in-trait.rs:11:22
+ --> $DIR/async-example-desugared-boxed-in-trait.rs:7:22
|
LL | fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
index 1b1b3cffd..c5a984102 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.rs
@@ -1,9 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
use std::pin::Pin;
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
index 60fa534a6..6392ce86e 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-boxed.rs:15:5
+ --> $DIR/async-example-desugared-boxed.rs:11:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
index 3505690f1..ce93bd626 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-extra.rs
@@ -1,15 +1,14 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
-#![allow(incomplete_features)]
+#![feature(lint_reasons)]
use std::future::Future;
use std::pin::Pin;
use std::task::Poll;
pub trait MyTrait {
+ #[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
index feeda719e..f7a351eff 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-in-trait.rs
@@ -1,10 +1,6 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
trait MyTrait {
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
index 71473e745..c287b9a5b 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.rs
@@ -1,9 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
use std::task::Poll;
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
index 567a36a86..1eda6fe65 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/async-example-desugared-manual.rs:23:5
+ --> $DIR/async-example-desugared-manual.rs:19:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
diff --git a/tests/ui/async-await/in-trait/async-example-desugared.rs b/tests/ui/async-await/in-trait/async-example-desugared.rs
index 0a5023176..78904d87a 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared.rs
+++ b/tests/ui/async-await/in-trait/async-example-desugared.rs
@@ -1,13 +1,10 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::future::Future;
trait MyTrait {
+ #[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-example.rs b/tests/ui/async-await/in-trait/async-example.rs
index abf94ef74..a32f979df 100644
--- a/tests/ui/async-await/in-trait/async-example.rs
+++ b/tests/ui/async-await/in-trait/async-example.rs
@@ -1,11 +1,11 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait {
+ #[allow(async_fn_in_trait)]
async fn foo(&self) -> i32;
+
+ #[allow(async_fn_in_trait)]
async fn bar(&self) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
index a73d55adf..8dc0574c7 100644
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.rs
@@ -2,9 +2,6 @@
// known-bug: #102682
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
use std::hash::Hash;
diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
index 5c8d64fc6..3cc35b214 100644
--- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
+++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr
@@ -1,36 +1,30 @@
error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:12:28
+ --> $DIR/async-generics-and-bounds.rs:9:5
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `U` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics-and-bounds.rs:12:18
+help: consider adding an explicit lifetime bound
|
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:12:28
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Hash, U: 'a;
+ | ++++ ++ ++ +++++++
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics-and-bounds.rs:12:28
+ --> $DIR/async-generics-and-bounds.rs:9:5
|
LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `T` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics-and-bounds.rs:12:18
+help: consider adding an explicit lifetime bound
|
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics-and-bounds.rs:12:28
- |
-LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash;
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: Debug + Sized, U: Hash, T: 'a;
+ | ++++ ++ ++ +++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/in-trait/async-generics.rs b/tests/ui/async-await/in-trait/async-generics.rs
index 67000e577..6004916a4 100644
--- a/tests/ui/async-await/in-trait/async-generics.rs
+++ b/tests/ui/async-await/in-trait/async-generics.rs
@@ -2,9 +2,6 @@
// known-bug: #102682
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait<T, U> {
async fn foo(&self) -> &(T, U);
}
diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.stderr
index 6ae73d9e3..3b27f8fe2 100644
--- a/tests/ui/async-await/in-trait/async-generics.stderr
+++ b/tests/ui/async-await/in-trait/async-generics.stderr
@@ -1,36 +1,30 @@
error[E0311]: the parameter type `U` may not live long enough
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:6:5
|
LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `U` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `U` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics.rs:9:18
+help: consider adding an explicit lifetime bound
|
-LL | async fn foo(&self) -> &(T, U);
- | ^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:9:28
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where U: 'a;
+ | ++++ ++ ++ +++++++++++
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/async-generics.rs:9:28
+ --> $DIR/async-generics.rs:6:5
|
LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+ | ^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^
+ | | |
+ | | the parameter type `T` must be valid for the anonymous lifetime as defined here...
+ | ...so that the reference type `&(T, U)` does not outlive the data it points at
|
-note: the parameter type `T` must be valid for the anonymous lifetime as defined here...
- --> $DIR/async-generics.rs:9:18
+help: consider adding an explicit lifetime bound
|
-LL | async fn foo(&self) -> &(T, U);
- | ^
-note: ...so that the reference type `&(T, U)` does not outlive the data it points at
- --> $DIR/async-generics.rs:9:28
- |
-LL | async fn foo(&self) -> &(T, U);
- | ^^^^^^^
+LL | async fn foo<'a>(&'a self) -> &'a (T, U) where T: 'a;
+ | ++++ ++ ++ +++++++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
index d5481d277..3721b0135 100644
--- a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
+++ b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs
@@ -1,12 +1,10 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
trait MyTrait<'a, 'b, T> {
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T) where T: Debug + Sized;
}
diff --git a/tests/ui/async-await/in-trait/async-lifetimes.rs b/tests/ui/async-await/in-trait/async-lifetimes.rs
index f298e45d2..cb4b871cb 100644
--- a/tests/ui/async-await/in-trait/async-lifetimes.rs
+++ b/tests/ui/async-await/in-trait/async-lifetimes.rs
@@ -1,10 +1,8 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait<'a, 'b, T> {
+ #[allow(async_fn_in_trait)]
async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T);
}
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.rs b/tests/ui/async-await/in-trait/async-recursive-generic.rs
index 6839abd38..c6031ce28 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.rs
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.rs
@@ -1,8 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait<T> {
async fn foo_recursive(&self, n: usize) -> T;
}
diff --git a/tests/ui/async-await/in-trait/async-recursive-generic.stderr b/tests/ui/async-await/in-trait/async-recursive-generic.stderr
index cab173bdd..cf0bcd741 100644
--- a/tests/ui/async-await/in-trait/async-recursive-generic.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive-generic.stderr
@@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive-generic.rs:11:48
+ --> $DIR/async-recursive-generic.rs:8:5
|
LL | async fn foo_recursive(&self, n: usize) -> T {
- | ^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
diff --git a/tests/ui/async-await/in-trait/async-recursive.rs b/tests/ui/async-await/in-trait/async-recursive.rs
index 61119f809..09f1ffe49 100644
--- a/tests/ui/async-await/in-trait/async-recursive.rs
+++ b/tests/ui/async-await/in-trait/async-recursive.rs
@@ -1,8 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
trait MyTrait {
async fn foo_recursive(&self, n: usize) -> i32;
}
diff --git a/tests/ui/async-await/in-trait/async-recursive.stderr b/tests/ui/async-await/in-trait/async-recursive.stderr
index 9feff37b3..b959652ea 100644
--- a/tests/ui/async-await/in-trait/async-recursive.stderr
+++ b/tests/ui/async-await/in-trait/async-recursive.stderr
@@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/async-recursive.rs:11:48
+ --> $DIR/async-recursive.rs:8:5
|
LL | async fn foo_recursive(&self, n: usize) -> i32 {
- | ^^^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
diff --git a/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
index bba886f17..57c9b3ae8 100644
--- a/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
+++ b/tests/ui/async-await/in-trait/auxiliary/foreign-async-fn.rs
@@ -1,7 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
-
pub trait Foo {
async fn test();
}
diff --git a/tests/ui/async-await/in-trait/bad-signatures.rs b/tests/ui/async-await/in-trait/bad-signatures.rs
index 98dddc126..5adede5b5 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.rs
+++ b/tests/ui/async-await/in-trait/bad-signatures.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait MyTrait {
async fn bar(&abc self);
diff --git a/tests/ui/async-await/in-trait/bad-signatures.stderr b/tests/ui/async-await/in-trait/bad-signatures.stderr
index 7cbd96e24..127a343a9 100644
--- a/tests/ui/async-await/in-trait/bad-signatures.stderr
+++ b/tests/ui/async-await/in-trait/bad-signatures.stderr
@@ -1,11 +1,11 @@
error: expected identifier, found keyword `self`
- --> $DIR/bad-signatures.rs:6:23
+ --> $DIR/bad-signatures.rs:5:23
|
LL | async fn bar(&abc self);
| ^^^^ expected identifier, found keyword
error: expected one of `:`, `@`, or `|`, found keyword `self`
- --> $DIR/bad-signatures.rs:6:23
+ --> $DIR/bad-signatures.rs:5:23
|
LL | async fn bar(&abc self);
| -----^^^^
diff --git a/tests/ui/async-await/in-trait/coherence-constrained.rs b/tests/ui/async-await/in-trait/coherence-constrained.rs
new file mode 100644
index 000000000..8e62b3e0e
--- /dev/null
+++ b/tests/ui/async-await/in-trait/coherence-constrained.rs
@@ -0,0 +1,26 @@
+// edition: 2021
+
+trait Foo {
+ type T;
+
+ async fn foo(&self) -> Self::T;
+}
+
+struct Bar;
+
+impl Foo for Bar {
+ type T = ();
+
+ async fn foo(&self) {}
+ //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+}
+
+impl Foo for Bar {
+ //~^ ERROR conflicting implementations of trait `Foo` for type `Bar`
+ type T = ();
+
+ async fn foo(&self) {}
+ //~^ ERROR type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/coherence-constrained.stderr b/tests/ui/async-await/in-trait/coherence-constrained.stderr
new file mode 100644
index 000000000..570a357ca
--- /dev/null
+++ b/tests/ui/async-await/in-trait/coherence-constrained.stderr
@@ -0,0 +1,25 @@
+error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+ --> $DIR/coherence-constrained.rs:14:5
+ |
+LL | async fn foo(&self) {}
+ | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()`
+
+error[E0284]: type annotations needed: cannot satisfy `<Bar as Foo>::T == ()`
+ --> $DIR/coherence-constrained.rs:22:5
+ |
+LL | async fn foo(&self) {}
+ | ^^^^^^^^^^^^^^^^^^^ cannot satisfy `<Bar as Foo>::T == ()`
+
+error[E0119]: conflicting implementations of trait `Foo` for type `Bar`
+ --> $DIR/coherence-constrained.rs:18:1
+ |
+LL | impl Foo for Bar {
+ | ---------------- first implementation here
+...
+LL | impl Foo for Bar {
+ | ^^^^^^^^^^^^^^^^ conflicting implementation for `Bar`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0119, E0284.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
index afd3db5e0..18b0fa485 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
@@ -1,7 +1,6 @@
// edition: 2021
// known-bug: #108309
-#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
struct MyStruct;
diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
index 7c750bf51..5e2be0862 100644
--- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
+++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr
@@ -1,24 +1,24 @@
error[E0053]: method `foo` has an incompatible type for trait
- --> $DIR/dont-project-to-specializable-projection.rs:14:35
+ --> $DIR/dont-project-to-specializable-projection.rs:13:5
|
LL | default async fn foo(_: T) -> &'static str {
- | ^^^^^^^^^^^^ expected associated type, found future
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found future
|
note: type in trait
- --> $DIR/dont-project-to-specializable-projection.rs:10:27
+ --> $DIR/dont-project-to-specializable-projection.rs:9:5
|
LL | async fn foo(_: T) -> &'static str;
- | ^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected signature `fn(_) -> impl Future<Output = &'static str>`
found signature `fn(_) -> impl Future<Output = &'static str>`
error: async associated function in trait cannot be specialized
- --> $DIR/dont-project-to-specializable-projection.rs:14:5
+ --> $DIR/dont-project-to-specializable-projection.rs:13:5
|
LL | default async fn foo(_: T) -> &'static str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed
+ = note: specialization behaves in inconsistent and surprising ways with async functions in traits, and for now is disallowed
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/in-trait/early-bound-1.rs b/tests/ui/async-await/in-trait/early-bound-1.rs
index 6b3b14201..ddcb477a1 100644
--- a/tests/ui/async-await/in-trait/early-bound-1.rs
+++ b/tests/ui/async-await/in-trait/early-bound-1.rs
@@ -1,10 +1,8 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
-#![allow(incomplete_features)]
-
pub trait Foo {
+ #[allow(async_fn_in_trait)]
async fn foo(&mut self);
}
diff --git a/tests/ui/async-await/in-trait/early-bound-2.rs b/tests/ui/async-await/in-trait/early-bound-2.rs
index 270443229..3eba5bf75 100644
--- a/tests/ui/async-await/in-trait/early-bound-2.rs
+++ b/tests/ui/async-await/in-trait/early-bound-2.rs
@@ -1,10 +1,10 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {
+ #[allow(async_fn_in_trait)]
async fn foo(&mut self);
}
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err.rs b/tests/ui/async-await/in-trait/fn-not-async-err.rs
index 9598d53bc..60077a7e0 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err.rs
+++ b/tests/ui/async-await/in-trait/fn-not-async-err.rs
@@ -1,6 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait MyTrait {
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err.stderr b/tests/ui/async-await/in-trait/fn-not-async-err.stderr
index 579801d0f..cd085074a 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err.stderr
+++ b/tests/ui/async-await/in-trait/fn-not-async-err.stderr
@@ -1,5 +1,5 @@
error: method `foo` should be async because the method from the trait is async
- --> $DIR/fn-not-async-err.rs:11:5
+ --> $DIR/fn-not-async-err.rs:10:5
|
LL | async fn foo(&self) -> i32;
| --------------------------- required because the trait method is async
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.rs b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
index 78017429f..ed626edc4 100644
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.rs
+++ b/tests/ui/async-await/in-trait/fn-not-async-err2.rs
@@ -1,6 +1,6 @@
// edition: 2021
+// check-pass
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
@@ -11,7 +11,6 @@ trait MyTrait {
impl MyTrait for i32 {
fn foo(&self) -> impl Future<Output = i32> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
async { *self }
}
}
diff --git a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr b/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
deleted file mode 100644
index 37d9669c0..000000000
--- a/tests/ui/async-await/in-trait/fn-not-async-err2.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
- --> $DIR/fn-not-async-err2.rs:13:22
- |
-LL | fn foo(&self) -> impl Future<Output = i32> {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0562`.
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.rs b/tests/ui/async-await/in-trait/generics-mismatch.rs
index fc29783c0..51fdc2fe8 100644
--- a/tests/ui/async-await/in-trait/generics-mismatch.rs
+++ b/tests/ui/async-await/in-trait/generics-mismatch.rs
@@ -1,6 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait Foo {
diff --git a/tests/ui/async-await/in-trait/generics-mismatch.stderr b/tests/ui/async-await/in-trait/generics-mismatch.stderr
index 3518aa05c..647cc698f 100644
--- a/tests/ui/async-await/in-trait/generics-mismatch.stderr
+++ b/tests/ui/async-await/in-trait/generics-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `foo` has an incompatible generic parameter for trait `Foo`
- --> $DIR/generics-mismatch.rs:11:18
+ --> $DIR/generics-mismatch.rs:10:18
|
LL | trait Foo {
| ---
diff --git a/tests/ui/async-await/in-trait/implied-bounds.rs b/tests/ui/async-await/in-trait/implied-bounds.rs
index 52bceb3cc..0d8177c8e 100644
--- a/tests/ui/async-await/in-trait/implied-bounds.rs
+++ b/tests/ui/async-await/in-trait/implied-bounds.rs
@@ -1,12 +1,13 @@
// check-pass
// edition: 2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait TcpStack {
type Connection<'a>: Sized where Self: 'a;
fn connect<'a>(&'a self) -> Self::Connection<'a>;
+
+ #[allow(async_fn_in_trait)]
async fn async_connect<'a>(&'a self) -> Self::Connection<'a>;
}
diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
index 2fe6b473d..8443cbcf4 100644
--- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
@@ -2,8 +2,6 @@
// build-fail
//~^^ ERROR cycle detected when computing layout of
-#![feature(async_fn_in_trait)]
-
fn main() {
let _ = async {
A.first().await.second().await;
diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
index 41e84466a..ce02c1e99 100644
--- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
+++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr
@@ -1,8 +1,8 @@
-error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`
+error[E0391]: cycle detected when computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:33:27: 35:6}`
|
= note: ...which requires computing layout of `<<A as First>::Second as Second>::{opaque#0}`...
- = note: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:35:27: 37:6}`, completing the cycle
- = note: cycle used when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:8:13: 10:6}`
+ = note: ...which again requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:33:27: 35:6}`, completing the cycle
+ = note: cycle used when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:6:13: 8:6}`
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to previous error
diff --git a/tests/ui/async-await/in-trait/issue-102138.rs b/tests/ui/async-await/in-trait/issue-102138.rs
index f61b34ed9..221b830fc 100644
--- a/tests/ui/async-await/in-trait/issue-102138.rs
+++ b/tests/ui/async-await/in-trait/issue-102138.rs
@@ -1,7 +1,6 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
@@ -10,6 +9,8 @@ async fn yield_now() {}
trait AsyncIterator {
type Item;
+
+ #[allow(async_fn_in_trait)]
async fn next(&mut self) -> Option<Self::Item>;
}
diff --git a/tests/ui/async-await/in-trait/issue-102219.rs b/tests/ui/async-await/in-trait/issue-102219.rs
index 9a35f6515..1f32cf691 100644
--- a/tests/ui/async-await/in-trait/issue-102219.rs
+++ b/tests/ui/async-await/in-trait/issue-102219.rs
@@ -2,9 +2,9 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
trait T {
+ #[allow(async_fn_in_trait)]
async fn foo();
}
diff --git a/tests/ui/async-await/in-trait/issue-102310.rs b/tests/ui/async-await/in-trait/issue-102310.rs
index 49c3e9fee..c6321dfcb 100644
--- a/tests/ui/async-await/in-trait/issue-102310.rs
+++ b/tests/ui/async-await/in-trait/issue-102310.rs
@@ -1,10 +1,10 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
pub trait SpiDevice {
+ #[allow(async_fn_in_trait)]
async fn transaction<F, R>(&mut self);
}
diff --git a/tests/ui/async-await/in-trait/issue-104678.rs b/tests/ui/async-await/in-trait/issue-104678.rs
index e396df4e5..db2fa3026 100644
--- a/tests/ui/async-await/in-trait/issue-104678.rs
+++ b/tests/ui/async-await/in-trait/issue-104678.rs
@@ -1,13 +1,13 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
pub trait Pool {
type Conn;
+ #[allow(async_fn_in_trait)]
async fn async_callback<'a, F: FnOnce(&'a Self::Conn) -> Fut, Fut: Future<Output = ()>>(
&'a self,
callback: F,
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.rs b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
index bb793df5d..b45d1758d 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.rs
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait MyTrait {
async fn foo<'a>(&self);
diff --git a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr b/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
index 86592269c..3841ab934 100644
--- a/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
+++ b/tests/ui/async-await/in-trait/lifetime-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
- --> $DIR/lifetime-mismatch.rs:11:17
+ --> $DIR/lifetime-mismatch.rs:10:17
|
LL | async fn foo<'a>(&self);
| ---- lifetimes in impl do not match this method in trait
diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.rs b/tests/ui/async-await/in-trait/missing-feature-flag.rs
index 34dd50a1c..898299a7d 100644
--- a/tests/ui/async-await/in-trait/missing-feature-flag.rs
+++ b/tests/ui/async-await/in-trait/missing-feature-flag.rs
@@ -1,6 +1,5 @@
// edition:2018
-#![feature(async_fn_in_trait)]
#![feature(min_specialization)]
struct MyStruct;
diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.stderr b/tests/ui/async-await/in-trait/missing-feature-flag.stderr
index f6aba1fcd..b7a9e98fc 100644
--- a/tests/ui/async-await/in-trait/missing-feature-flag.stderr
+++ b/tests/ui/async-await/in-trait/missing-feature-flag.stderr
@@ -1,5 +1,5 @@
error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/missing-feature-flag.rs:12:1
+ --> $DIR/missing-feature-flag.rs:11:1
|
LL | async fn foo(_: T) -> &'static str;
| ----------------------------------- `foo` from trait
@@ -7,8 +7,14 @@ LL | async fn foo(_: T) -> &'static str;
LL | impl<T> MyTrait<T> for MyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
+error[E0308]: mismatched types
+ --> $DIR/missing-feature-flag.rs:15:42
+ |
+LL | async fn foo(_: i32) -> &'static str {}
+ | ^^ expected `&str`, found `()`
+
error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
- --> $DIR/missing-feature-flag.rs:16:5
+ --> $DIR/missing-feature-flag.rs:15:5
|
LL | impl<T> MyTrait<T> for MyStruct {}
| ------------------------------- parent `impl` is here
@@ -18,12 +24,6 @@ LL | async fn foo(_: i32) -> &'static str {}
|
= note: to specialize, `foo` in the parent `impl` must be marked `default`
-error[E0308]: mismatched types
- --> $DIR/missing-feature-flag.rs:16:42
- |
-LL | async fn foo(_: i32) -> &'static str {}
- | ^^ expected `&str`, found `()`
-
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0046, E0308, E0520.
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.rs b/tests/ui/async-await/in-trait/missing-send-bound.rs
index dbcc66576..596aece74 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.rs
+++ b/tests/ui/async-await/in-trait/missing-send-bound.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait Foo {
async fn bar();
diff --git a/tests/ui/async-await/in-trait/missing-send-bound.stderr b/tests/ui/async-await/in-trait/missing-send-bound.stderr
index 7e59d94d4..139bd06c7 100644
--- a/tests/ui/async-await/in-trait/missing-send-bound.stderr
+++ b/tests/ui/async-await/in-trait/missing-send-bound.stderr
@@ -1,17 +1,17 @@
error: future cannot be sent between threads safely
- --> $DIR/missing-send-bound.rs:14:20
+ --> $DIR/missing-send-bound.rs:13:20
|
LL | assert_is_send(test::<T>());
| ^^^^^^^^^^^ future returned by `test` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>`
note: future is not `Send` as it awaits another future which is not `Send`
- --> $DIR/missing-send-bound.rs:10:5
+ --> $DIR/missing-send-bound.rs:9:5
|
LL | T::bar().await;
| ^^^^^^^^ await occurs here on type `impl Future<Output = ()>`, which is not `Send`
note: required by a bound in `assert_is_send`
- --> $DIR/missing-send-bound.rs:18:27
+ --> $DIR/missing-send-bound.rs:17:27
|
LL | fn assert_is_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_is_send`
diff --git a/tests/ui/async-await/in-trait/nested-rpit.rs b/tests/ui/async-await/in-trait/nested-rpit.rs
index 9cdc23bbc..ccae08acc 100644
--- a/tests/ui/async-await/in-trait/nested-rpit.rs
+++ b/tests/ui/async-await/in-trait/nested-rpit.rs
@@ -1,14 +1,13 @@
// edition: 2021
// check-pass
-#![feature(async_fn_in_trait)]
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::future::Future;
use std::marker::PhantomData;
trait Lockable<K, V> {
+ #[allow(async_fn_in_trait)]
async fn lock_all_entries(&self) -> impl Future<Output = Guard<'_>>;
}
diff --git a/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs b/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs
index c4008f2b7..9eb396f32 100644
--- a/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs
+++ b/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs
@@ -5,12 +5,12 @@
// We were not normalizing opaques with escaping bound vars during codegen,
// leading to later errors during debuginfo computation.
-#![feature(async_fn_in_trait)]
#[derive(Clone, Copy)]
pub struct SharedState {}
pub trait State {
+ #[allow(async_fn_in_trait)]
async fn execute(self, shared_state: &SharedState);
}
diff --git a/tests/ui/async-await/in-trait/object-safety.rs b/tests/ui/async-await/in-trait/object-safety.rs
index 441539e5d..5e5375b08 100644
--- a/tests/ui/async-await/in-trait/object-safety.rs
+++ b/tests/ui/async-await/in-trait/object-safety.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait Foo {
async fn foo(&self);
diff --git a/tests/ui/async-await/in-trait/object-safety.stderr b/tests/ui/async-await/in-trait/object-safety.stderr
index ccdf9d887..5b9fd98ac 100644
--- a/tests/ui/async-await/in-trait/object-safety.stderr
+++ b/tests/ui/async-await/in-trait/object-safety.stderr
@@ -1,11 +1,11 @@
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:10:12
+ --> $DIR/object-safety.rs:9:12
|
LL | let x: &dyn Foo = todo!();
| ^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:6:14
+ --> $DIR/object-safety.rs:5:14
|
LL | trait Foo {
| --- this trait cannot be made into an object...
diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.rs b/tests/ui/async-await/in-trait/return-not-existing-pair.rs
index a14dfceed..2286316dd 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-pair.rs
+++ b/tests/ui/async-await/in-trait/return-not-existing-pair.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(async_fn_in_trait)]
trait MyTrait<'a, 'b, T> {
async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.stderr b/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
index e573b8517..4694e6080 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
+++ b/tests/ui/async-await/in-trait/return-not-existing-pair.stderr
@@ -1,5 +1,5 @@
error[E0726]: implicit elided lifetime not allowed here
- --> $DIR/return-not-existing-pair.rs:10:20
+ --> $DIR/return-not-existing-pair.rs:9:20
|
LL | impl<'a, 'b, T, U> MyTrait<T> for U {
| ^^^^^^^^^^ expected lifetime parameters
@@ -10,13 +10,13 @@ LL | impl<'a, 'b, T, U> MyTrait<'_, '_, T> for U {
| +++++++
error[E0412]: cannot find type `ConnImpl` in this scope
- --> $DIR/return-not-existing-pair.rs:6:48
+ --> $DIR/return-not-existing-pair.rs:5:48
|
LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
| ^^^^^^^^ not found in this scope
error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl
- --> $DIR/return-not-existing-pair.rs:12:5
+ --> $DIR/return-not-existing-pair.rs:11:5
|
LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T);
| ------------------------------------------------------------ `&self` used in trait
@@ -25,7 +25,7 @@ LL | async fn foo(_: T) -> (&'a U, &'b T) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl
error[E0308]: mismatched types
- --> $DIR/return-not-existing-pair.rs:12:42
+ --> $DIR/return-not-existing-pair.rs:11:42
|
LL | async fn foo(_: T) -> (&'a U, &'b T) {}
| ^^ expected `(&U, &T)`, found `()`
diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
index 254b9a782..d23ef093b 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
+++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs
@@ -1,6 +1,5 @@
// edition:2021
-#![feature(return_position_impl_trait_in_trait)]
struct Wrapper<T>(T);
diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
index 059934d24..a66dd13bb 100644
--- a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
+++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.stderr
@@ -1,5 +1,5 @@
error[E0412]: cannot find type `Missing` in this scope
- --> $DIR/return-not-existing-type-wrapping-rpitit.rs:8:25
+ --> $DIR/return-not-existing-type-wrapping-rpitit.rs:7:25
|
LL | fn bar() -> Wrapper<Missing<impl Sized>>;
| ^^^^^^^ not found in this scope
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.rs b/tests/ui/async-await/in-trait/return-type-suggestion.rs
index cdab4ea0f..2b19b24cf 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.rs
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.rs
@@ -1,6 +1,5 @@
// edition: 2021
-#![feature(async_fn_in_trait)]
trait A {
async fn e() {
diff --git a/tests/ui/async-await/in-trait/return-type-suggestion.stderr b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
index 179c9ed93..363870619 100644
--- a/tests/ui/async-await/in-trait/return-type-suggestion.stderr
+++ b/tests/ui/async-await/in-trait/return-type-suggestion.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/return-type-suggestion.rs:7:9
+ --> $DIR/return-type-suggestion.rs:6:9
|
LL | Ok(())
| ^^^^^^ expected `()`, found `Result<(), _>`
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
index 33c005874..affe6cded 100644
--- a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.fixed
@@ -1,7 +1,6 @@
// run-rustfix
// edition: 2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(unused)]
trait Foo {
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
index 96b623d69..02bfee1a2 100644
--- a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.rs
@@ -1,7 +1,6 @@
// run-rustfix
// edition: 2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(unused)]
trait Foo {
diff --git a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
index 4319a1411..da51f10af 100644
--- a/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
+++ b/tests/ui/async-await/in-trait/send-on-async-fn-in-trait.stderr
@@ -1,5 +1,5 @@
error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
- --> $DIR/send-on-async-fn-in-trait.rs:14:16
+ --> $DIR/send-on-async-fn-in-trait.rs:13:16
|
LL | needs_send(T::test());
| ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
@@ -8,7 +8,7 @@ LL | needs_send(T::test());
|
= help: the trait `Send` is not implemented for `impl Future<Output = ()>`
note: required by a bound in `needs_send`
- --> $DIR/send-on-async-fn-in-trait.rs:13:27
+ --> $DIR/send-on-async-fn-in-trait.rs:12:27
|
LL | fn needs_send(_: impl Send) {}
| ^^^^ required by this bound in `needs_send`
@@ -19,7 +19,7 @@ LL + fn test() -> impl std::future::Future<Output = ()> + Send { async {} }
|
error[E0277]: `impl Future<Output = i32>` cannot be sent between threads safely
- --> $DIR/send-on-async-fn-in-trait.rs:16:16
+ --> $DIR/send-on-async-fn-in-trait.rs:15:16
|
LL | needs_send(T::test2());
| ---------- ^^^^^^^^^^ `impl Future<Output = i32>` cannot be sent between threads safely
@@ -28,7 +28,7 @@ LL | needs_send(T::test2());
|
= help: the trait `Send` is not implemented for `impl Future<Output = i32>`
note: required by a bound in `needs_send`
- --> $DIR/send-on-async-fn-in-trait.rs:13:27
+ --> $DIR/send-on-async-fn-in-trait.rs:12:27
|
LL | fn needs_send(_: impl Send) {}
| ^^^^ required by this bound in `needs_send`
diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
index 83b69d72a..f0d750714 100644
--- a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
+++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.rs
@@ -1,8 +1,6 @@
// aux-build:foreign-async-fn.rs
// edition:2021
-#![feature(async_fn_in_trait)]
-
extern crate foreign_async_fn;
use foreign_async_fn::Foo;
diff --git a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
index f337a04ba..482707351 100644
--- a/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
+++ b/tests/ui/async-await/in-trait/send-on-foreign-async-fn-in-trait.stderr
@@ -1,5 +1,5 @@
error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
- --> $DIR/send-on-foreign-async-fn-in-trait.rs:11:16
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:9:16
|
LL | needs_send(T::test());
| ---------- ^^^^^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
@@ -8,12 +8,12 @@ LL | needs_send(T::test());
|
= help: the trait `Send` is not implemented for `impl Future<Output = ()>`
note: `<T as Foo>::test` is an `async fn` in trait, which does not automatically imply that its future is `Send`
- --> $DIR/auxiliary/foreign-async-fn.rs:6:5
+ --> $DIR/auxiliary/foreign-async-fn.rs:4:5
|
LL | async fn test();
| ^^^^^^^^^^^^^^^^
note: required by a bound in `needs_send`
- --> $DIR/send-on-foreign-async-fn-in-trait.rs:10:27
+ --> $DIR/send-on-foreign-async-fn-in-trait.rs:8:27
|
LL | fn needs_send(_: impl Send) {}
| ^^^^ required by this bound in `needs_send`
diff --git a/tests/ui/async-await/in-trait/unconstrained-impl-region.rs b/tests/ui/async-await/in-trait/unconstrained-impl-region.rs
new file mode 100644
index 000000000..c06f9f005
--- /dev/null
+++ b/tests/ui/async-await/in-trait/unconstrained-impl-region.rs
@@ -0,0 +1,19 @@
+// edition: 2021
+
+pub(crate) trait Inbox<M> {
+ async fn next(self) -> M;
+}
+
+pub(crate) trait Actor: Sized {
+ type Message;
+
+ async fn on_mount(self, _: impl Inbox<Self::Message>);
+}
+
+impl<'a> Actor for () {
+//~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+ type Message = &'a ();
+ async fn on_mount(self, _: impl Inbox<&'a ()>) {}
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr b/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr
new file mode 100644
index 000000000..2cb0da2e8
--- /dev/null
+++ b/tests/ui/async-await/in-trait/unconstrained-impl-region.stderr
@@ -0,0 +1,9 @@
+error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/unconstrained-impl-region.rs:13:6
+ |
+LL | impl<'a> Actor for () {
+ | ^^ unconstrained lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0207`.
diff --git a/tests/ui/async-await/in-trait/warn.rs b/tests/ui/async-await/in-trait/warn.rs
new file mode 100644
index 000000000..71f3822df
--- /dev/null
+++ b/tests/ui/async-await/in-trait/warn.rs
@@ -0,0 +1,22 @@
+// edition: 2021
+
+#![deny(async_fn_in_trait)]
+
+pub trait Foo {
+ async fn not_send();
+ //~^ ERROR use of `async fn` in public traits is discouraged
+}
+
+mod private {
+ pub trait FooUnreachable {
+ async fn not_send();
+ // No warning
+ }
+}
+
+pub(crate) trait FooCrate {
+ async fn not_send();
+ // No warning
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/in-trait/warn.stderr b/tests/ui/async-await/in-trait/warn.stderr
new file mode 100644
index 000000000..d0278628c
--- /dev/null
+++ b/tests/ui/async-await/in-trait/warn.stderr
@@ -0,0 +1,20 @@
+error: use of `async fn` in public traits is discouraged as auto trait bounds cannot be specified
+ --> $DIR/warn.rs:6:5
+ |
+LL | async fn not_send();
+ | ^^^^^
+ |
+ = note: you can suppress this lint if you plan to use the trait only in your own code, or do not care about auto traits like `Send` on the `Future`
+note: the lint level is defined here
+ --> $DIR/warn.rs:3:9
+ |
+LL | #![deny(async_fn_in_trait)]
+ | ^^^^^^^^^^^^^^^^^
+help: you can alternatively desugar to a normal `fn` that returns `impl Future` and add any desired bounds such as `Send`, but these cannot be relaxed without a breaking API change
+ |
+LL - async fn not_send();
+LL + fn not_send() -> impl std::future::Future<Output = ()> + Send;
+ |
+
+error: aborting due to previous error
+
diff --git a/tests/ui/async-await/issue-108572.fixed b/tests/ui/async-await/issue-108572.fixed
new file mode 100644
index 000000000..8f0133d97
--- /dev/null
+++ b/tests/ui/async-await/issue-108572.fixed
@@ -0,0 +1,16 @@
+// edition: 2021
+// run-rustfix
+#![allow(unused_must_use, dead_code)]
+
+use std::future::Future;
+fn foo() -> impl Future<Output=()> {
+ async { }
+}
+
+fn bar(cx: &mut std::task::Context<'_>) {
+ let fut = foo();
+ let mut pinned = std::pin::pin!(fut);
+ pinned.as_mut().poll(cx);
+ //~^ ERROR no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope [E0599]
+}
+fn main() {}
diff --git a/tests/ui/async-await/issue-108572.rs b/tests/ui/async-await/issue-108572.rs
index efcb8b8eb..359658076 100644
--- a/tests/ui/async-await/issue-108572.rs
+++ b/tests/ui/async-await/issue-108572.rs
@@ -1,12 +1,15 @@
// edition: 2021
+// run-rustfix
+#![allow(unused_must_use, dead_code)]
use std::future::Future;
fn foo() -> impl Future<Output=()> {
async { }
}
-fn main() {
+fn bar(cx: &mut std::task::Context<'_>) {
let fut = foo();
- fut.poll();
+ fut.poll(cx);
//~^ ERROR no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope [E0599]
}
+fn main() {}
diff --git a/tests/ui/async-await/issue-108572.stderr b/tests/ui/async-await/issue-108572.stderr
index 0dbcf4d66..588669092 100644
--- a/tests/ui/async-await/issue-108572.stderr
+++ b/tests/ui/async-await/issue-108572.stderr
@@ -1,11 +1,16 @@
error[E0599]: no method named `poll` found for opaque type `impl Future<Output = ()>` in the current scope
- --> $DIR/issue-108572.rs:10:9
+ --> $DIR/issue-108572.rs:12:9
|
-LL | fut.poll();
+LL | fut.poll(cx);
| ^^^^ method not found in `impl Future<Output = ()>`
|
= help: method `poll` found on `Pin<&mut impl Future<Output = ()>>`, see documentation for `std::pin::Pin`
= help: self type must be pinned to call `Future::poll`, see https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#pinning-in-practice
+help: consider pinning the expression
+ |
+LL ~ let mut pinned = std::pin::pin!(fut);
+LL ~ pinned.as_mut().poll(cx);
+ |
error: aborting due to previous error
diff --git a/tests/ui/async-await/issue-60709.rs b/tests/ui/async-await/issue-60709.rs
index 61f6ed1b7..2cda40e9e 100644
--- a/tests/ui/async-await/issue-60709.rs
+++ b/tests/ui/async-await/issue-60709.rs
@@ -1,5 +1,5 @@
// This used to compile the future down to ud2, due to uninhabited types being
-// handled incorrectly in generators.
+// handled incorrectly in coroutines.
// compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018
// run-pass
diff --git a/tests/ui/async-await/issue-61793.rs b/tests/ui/async-await/issue-61793.rs
index 9180e1d81..bb861cf60 100644
--- a/tests/ui/async-await/issue-61793.rs
+++ b/tests/ui/async-await/issue-61793.rs
@@ -1,5 +1,5 @@
// This testcase used to ICE in codegen due to inconsistent field reordering
-// in the generator state, claiming a ZST field was after a non-ZST field,
+// in the coroutine state, claiming a ZST field was after a non-ZST field,
// while those two fields were at the same offset (which is impossible).
// That is, memory ordering of `(X, ())`, but offsets of `((), X)`.
diff --git a/tests/ui/async-await/issue-62658.rs b/tests/ui/async-await/issue-62658.rs
index d0af01e0c..8e6d070ea 100644
--- a/tests/ui/async-await/issue-62658.rs
+++ b/tests/ui/async-await/issue-62658.rs
@@ -1,4 +1,4 @@
-// This test created a generator whose size was not rounded to a multiple of its
+// This test created a coroutine whose size was not rounded to a multiple of its
// alignment. This caused an assertion error in codegen.
// build-pass
diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr
index 573da1034..4bbb7731b 100644
--- a/tests/ui/async-await/issue-64130-3-other.stderr
+++ b/tests/ui/async-await/issue-64130-3-other.stderr
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output
--> $DIR/issue-64130-3-other.rs:25:12
|
LL | async fn bar() {
- | - within this `impl Future<Output = ()>`
+ | -------------- within this `impl Future<Output = ()>`
...
LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
diff --git a/tests/ui/async-await/issue-66312.rs b/tests/ui/async-await/issue-66312.rs
index 9224971ec..fbc58697d 100644
--- a/tests/ui/async-await/issue-66312.rs
+++ b/tests/ui/async-await/issue-66312.rs
@@ -6,7 +6,7 @@ trait Test<T> {
async fn f() {
let x = Some(2);
- if x.is_some() {
+ if x.is_some() { //~ ERROR mismatched types
println!("Some");
}
}
diff --git a/tests/ui/async-await/issue-66312.stderr b/tests/ui/async-await/issue-66312.stderr
index 80d294a10..dad5807cb 100644
--- a/tests/ui/async-await/issue-66312.stderr
+++ b/tests/ui/async-await/issue-66312.stderr
@@ -7,6 +7,13 @@ LL | fn is_some(self: T);
= note: type of `self` must be `Self` or a type that dereferences to it
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/issue-66312.rs:9:8
+ |
+LL | if x.is_some() {
+ | ^^^^^^^^^^^ expected `bool`, found `()`
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0307`.
+Some errors have detailed explanations: E0307, E0308.
+For more information about an error, try `rustc --explain E0307`.
diff --git a/tests/ui/async-await/issue-68112.stderr b/tests/ui/async-await/issue-68112.stderr
index 17b619ebe..1cd8beac2 100644
--- a/tests/ui/async-await/issue-68112.stderr
+++ b/tests/ui/async-await/issue-68112.stderr
@@ -45,7 +45,7 @@ LL | require_send(send_fut);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/issue-68112.rs:47:31
|
LL | async fn ready2<T>(t: T) -> T {
diff --git a/tests/ui/async-await/issue-70935-complex-spans.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr
index ab834daa8..d0605d7e1 100644
--- a/tests/ui/async-await/issue-70935-complex-spans.stderr
+++ b/tests/ui/async-await/issue-70935-complex-spans.stderr
@@ -18,7 +18,7 @@ note: required because it's used within this closure
|
LL | baz(|| async {
| ^^
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/issue-70935-complex-spans.rs:12:67
|
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> {
diff --git a/tests/ui/async-await/issue-73137.rs b/tests/ui/async-await/issue-73137.rs
index c43ce2cad..2d16f1936 100644
--- a/tests/ui/async-await/issue-73137.rs
+++ b/tests/ui/async-await/issue-73137.rs
@@ -28,7 +28,7 @@ fn main() {
a: async { 0 }.await,
};
- // An error in the generator transform caused `b` to be overwritten with `a` when `b` was
+ // An error in the coroutine transform caused `b` to be overwritten with `a` when `b` was
// borrowed.
nop(&action.b);
assert_ne!(0usize, unsafe { std::mem::transmute(action.b) });
diff --git a/tests/ui/async-await/issues/issue-51719.rs b/tests/ui/async-await/issues/issue-51719.rs
index 09241f982..1cf388cd8 100644
--- a/tests/ui/async-await/issues/issue-51719.rs
+++ b/tests/ui/async-await/issues/issue-51719.rs
@@ -1,10 +1,10 @@
// edition:2018
//
-// Tests that the .await syntax can't be used to make a generator
+// Tests that the .await syntax can't be used to make a coroutine
async fn foo() {}
-fn make_generator() {
+fn make_coroutine() {
let _gen = || foo().await;
//~^ ERROR `await` is only allowed inside `async` functions and blocks
}
diff --git a/tests/ui/async-await/issues/issue-59972.rs b/tests/ui/async-await/issues/issue-59972.rs
index c2e24a96b..f60ec04c3 100644
--- a/tests/ui/async-await/issues/issue-59972.rs
+++ b/tests/ui/async-await/issues/issue-59972.rs
@@ -1,4 +1,4 @@
-// Incorrect handling of uninhabited types could cause us to mark generator
+// Incorrect handling of uninhabited types could cause us to mark coroutine
// types as entirely uninhabited, when they were in fact constructible. This
// caused us to hit "unreachable" code (illegal instruction on x86).
diff --git a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
index 66a3b07c3..ee28a2733 100644
--- a/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
+++ b/tests/ui/async-await/issues/issue-60655-latebound-regions.rs
@@ -19,7 +19,7 @@ async fn async_nop(_: &u8) {}
pub type ServeFut = impl Future<Output=()>;
-// Late bound regions occur in the generator witness type here.
+// Late bound regions occur in the coroutine witness type here.
fn serve() -> ServeFut {
async move {
let x = 5;
diff --git a/tests/ui/async-await/issues/issue-64477-2.rs b/tests/ui/async-await/issues/issue-64477-2.rs
index 2360b57cc..53ec3b065 100644
--- a/tests/ui/async-await/issues/issue-64477-2.rs
+++ b/tests/ui/async-await/issues/issue-64477-2.rs
@@ -2,7 +2,7 @@
//
// In the past, the code generated by `format!` produced temporaries in the surrounding scope that
// borrowed the arguments through `&dyn Trait`. These temporaries do not implement `Send`, which
-// meant that when `format!` was used in an async block, the resulting generator was not `Send`.
+// meant that when `format!` was used in an async block, the resulting coroutine was not `Send`.
// See https://github.com/rust-lang/rust/issues/64477#issuecomment-534669068 for details
// and https://github.com/rust-lang/rust/issues/64477#issuecomment-531882958 for an example.
//
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
index 725caddae..9ed7a5d21 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-completion.rs
@@ -1,4 +1,4 @@
-// issue 65419 - Attempting to run an async fn after completion mentions generators when it should
+// issue 65419 - Attempting to run an async fn after completion mentions coroutines when it should
// be talking about `async fn`s instead.
// run-fail
@@ -8,7 +8,7 @@
// ignore-wasm no panic or subprocess support
// ignore-emscripten no panic or subprocess support
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
async fn foo() {
}
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
index 5909c3a5e..51e9a54e4 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-async-fn-resume-after-panic.rs
@@ -1,4 +1,4 @@
-// issue 65419 - Attempting to run an async fn after completion mentions generators when it should
+// issue 65419 - Attempting to run an async fn after completion mentions coroutines when it should
// be talking about `async fn`s instead. Should also test what happens when it panics.
// run-fail
@@ -8,7 +8,7 @@
// edition:2018
// ignore-wasm no panic or subprocess support
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::panic;
diff --git a/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs b/tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs
index 9fc5667d6..e16b86f95 100644
--- a/tests/ui/async-await/issues/issue-65419/issue-65419-generator-resume-after-completion.rs
+++ b/tests/ui/async-await/issues/issue-65419/issue-65419-coroutine-resume-after-completion.rs
@@ -1,17 +1,17 @@
-// issue 65419 - Attempting to run an `async fn` after completion mentions generators when it should
-// be talking about `async fn`s instead. Regression test added to make sure generators still
+// issue 65419 - Attempting to run an `async fn` after completion mentions coroutines when it should
+// be talking about `async fn`s instead. Regression test added to make sure coroutines still
// panic when resumed after completion.
// run-fail
-// error-pattern:generator resumed after completion
+// error-pattern:coroutine resumed after completion
// edition:2018
// ignore-wasm no panic or subprocess support
// ignore-emscripten no panic or subprocess support
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::{
- ops::Generator,
+ ops::Coroutine,
pin::Pin,
};
diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr
index f36269e8f..2a712aee9 100644
--- a/tests/ui/async-await/issues/issue-67893.stderr
+++ b/tests/ui/async-await/issues/issue-67893.stderr
@@ -6,14 +6,14 @@ LL | g(issue_67893::run())
| |
| required by a bound introduced by this call
|
- ::: $DIR/auxiliary/issue_67893.rs:9:20
+ ::: $DIR/auxiliary/issue_67893.rs:9:1
|
LL | pub async fn run() {
- | - within this `impl Future<Output = ()>`
+ | ------------------ within this `impl Future<Output = ()>`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
= note: required because it captures the following types: `Arc<Mutex<()>>`, `MutexGuard<'_, ()>`, `impl Future<Output = ()>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/auxiliary/issue_67893.rs:9:20
|
LL | pub async fn run() {
diff --git a/tests/ui/async-await/issues/issue-95307.rs b/tests/ui/async-await/issues/issue-95307.rs
index f7e48070c..35dce2c62 100644
--- a/tests/ui/async-await/issues/issue-95307.rs
+++ b/tests/ui/async-await/issues/issue-95307.rs
@@ -5,8 +5,7 @@
pub trait C {
async fn new() -> [u8; _];
- //~^ ERROR: functions in traits cannot be declared `async`
- //~| ERROR: using `_` for array lengths is unstable
+ //~^ ERROR: using `_` for array lengths is unstable
//~| ERROR: in expressions, `_` can only be used on the left-hand side of an assignment
}
diff --git a/tests/ui/async-await/issues/issue-95307.stderr b/tests/ui/async-await/issues/issue-95307.stderr
index a497cebe3..fdc6d5de1 100644
--- a/tests/ui/async-await/issues/issue-95307.stderr
+++ b/tests/ui/async-await/issues/issue-95307.stderr
@@ -1,16 +1,3 @@
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-95307.rs:7:5
- |
-LL | async fn new() -> [u8; _];
- | -----^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
error: in expressions, `_` can only be used on the left-hand side of an assignment
--> $DIR/issue-95307.rs:7:28
|
@@ -26,7 +13,6 @@ LL | async fn new() -> [u8; _];
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0658, E0706.
-For more information about an error, try `rustc --explain E0658`.
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
index f789ad2a0..9442609e8 100644
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
+++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
@@ -1,17 +1,17 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:1
|
LL | async fn rec_1() {
- | ^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
+ --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:1
|
LL | async fn rec_2() {
- | ^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
diff --git a/tests/ui/async-await/no-async-const.rs b/tests/ui/async-await/no-async-const.rs
index 963460c11..c9941d1c5 100644
--- a/tests/ui/async-await/no-async-const.rs
+++ b/tests/ui/async-await/no-async-const.rs
@@ -3,3 +3,4 @@
pub async const fn x() {}
//~^ ERROR expected one of `extern`, `fn`, or `unsafe`, found keyword `const`
+//~| ERROR functions cannot be both `const` and `async`
diff --git a/tests/ui/async-await/no-async-const.stderr b/tests/ui/async-await/no-async-const.stderr
index a51dc88a4..524d778c0 100644
--- a/tests/ui/async-await/no-async-const.stderr
+++ b/tests/ui/async-await/no-async-const.stderr
@@ -9,5 +9,14 @@ LL | pub async const fn x() {}
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
-error: aborting due to previous error
+error: functions cannot be both `const` and `async`
+ --> $DIR/no-async-const.rs:4:5
+ |
+LL | pub async const fn x() {}
+ | ----^^^^^-^^^^^----------
+ | | |
+ | | `const` because of this
+ | `async` because of this
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/no-unsafe-async.rs b/tests/ui/async-await/no-unsafe-async.rs
index f40154e16..7c6811d81 100644
--- a/tests/ui/async-await/no-unsafe-async.rs
+++ b/tests/ui/async-await/no-unsafe-async.rs
@@ -9,3 +9,5 @@ impl S {
#[cfg(FALSE)]
unsafe async fn f() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async`
+
+fn main() {}
diff --git a/tests/ui/async-await/no-unsafe-async.stderr b/tests/ui/async-await/no-unsafe-async.stderr
index f23d17d6b..49b112f93 100644
--- a/tests/ui/async-await/no-unsafe-async.stderr
+++ b/tests/ui/async-await/no-unsafe-async.stderr
@@ -1,16 +1,11 @@
error: expected one of `extern` or `fn`, found keyword `async`
--> $DIR/no-unsafe-async.rs:7:12
|
-LL | impl S {
- | - while parsing this item list starting here
-LL | #[cfg(FALSE)]
LL | unsafe async fn g() {}
| -------^^^^^
| | |
| | expected one of `extern` or `fn`
| help: `async` must come before `unsafe`: `async unsafe`
-LL | }
- | - the item list ends here
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
diff --git a/tests/ui/async-await/non-trivial-drop.rs b/tests/ui/async-await/non-trivial-drop.rs
index 3fed7c972..1004303d5 100644
--- a/tests/ui/async-await/non-trivial-drop.rs
+++ b/tests/ui/async-await/non-trivial-drop.rs
@@ -1,7 +1,7 @@
// build-pass
// edition:2018
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
foo();
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.rs b/tests/ui/async-await/partial-drop-partial-reinit.rs
index 75acb442e..815cc916b 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.rs
+++ b/tests/ui/async-await/partial-drop-partial-reinit.rs
@@ -26,7 +26,7 @@ impl Drop for NotSend {
impl !Send for NotSend {}
async fn foo() {
- //~^ NOTE used within this `async fn` body
+ //~^ NOTE used within this `async` fn body
//~| NOTE within this `impl Future
let mut x = (NotSend {},);
drop(x.0);
diff --git a/tests/ui/async-await/partial-drop-partial-reinit.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr
index 85e1830c7..310a29239 100644
--- a/tests/ui/async-await/partial-drop-partial-reinit.stderr
+++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr
@@ -7,12 +7,12 @@ LL | gimme_send(foo());
| required by a bound introduced by this call
...
LL | async fn foo() {
- | - within this `impl Future<Output = ()>`
+ | -------------- within this `impl Future<Output = ()>`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend`
= note: required because it appears within the type `(NotSend,)`
= note: required because it captures the following types: `(NotSend,)`, `impl Future<Output = ()>`
-note: required because it's used within this `async fn` body
+note: required because it's used within this `async` fn body
--> $DIR/partial-drop-partial-reinit.rs:28:16
|
LL | async fn foo() {
diff --git a/tests/ui/async-await/pin-needed-to-poll.stderr b/tests/ui/async-await/pin-needed-to-poll.stderr
index b1f4a73aa..964709dae 100644
--- a/tests/ui/async-await/pin-needed-to-poll.stderr
+++ b/tests/ui/async-await/pin-needed-to-poll.stderr
@@ -6,14 +6,12 @@ LL | struct Sleep;
...
LL | self.sleep.poll(cx)
| ^^^^ method not found in `Sleep`
- --> $SRC_DIR/core/src/future/future.rs:LL:COL
|
- = note: the method is available for `Pin<&mut Sleep>` here
+help: consider pinning the expression
|
-help: consider wrapping the receiver expression with the appropriate type
+LL ~ let mut pinned = std::pin::pin!(self.sleep);
+LL ~ pinned.as_mut().poll(cx)
|
-LL | Pin::new(&mut self.sleep).poll(cx)
- | +++++++++++++ +
error: aborting due to previous error
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
index 63f64f445..64917329c 100644
--- a/tests/ui/async-await/recursive-async-impl-trait-type.stderr
+++ b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
@@ -1,8 +1,8 @@
error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:5:40
+ --> $DIR/recursive-async-impl-trait-type.rs:5:1
|
LL | async fn recursive_async_function() -> () {
- | ^^ recursive `async fn`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.rs b/tests/ui/async-await/return-type-notation/issue-110963-early.rs
index 0ecbca5c1..07f2130ba 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.rs
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.rs
@@ -2,7 +2,6 @@
// known-bug: #110963
#![feature(return_type_notation)]
-#![feature(async_fn_in_trait)]
trait HealthCheck {
async fn check<'a: 'a>(&'a mut self) -> bool;
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
index 969094a2c..feae2698e 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
+++ b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr
@@ -8,7 +8,7 @@ LL | #![feature(return_type_notation)]
= note: `#[warn(incomplete_features)]` on by default
error[E0308]: mismatched types
- --> $DIR/issue-110963-early.rs:15:5
+ --> $DIR/issue-110963-early.rs:14:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
@@ -21,13 +21,13 @@ LL | | });
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
- --> $DIR/issue-110963-early.rs:35:17
+ --> $DIR/issue-110963-early.rs:34:17
|
LL | F: Future + Send + 'static,
| ^^^^
error[E0308]: mismatched types
- --> $DIR/issue-110963-early.rs:15:5
+ --> $DIR/issue-110963-early.rs:14:5
|
LL | / spawn(async move {
LL | | let mut hc = hc;
@@ -40,10 +40,11 @@ LL | | });
= note: expected trait `Send`
found trait `for<'a> Send`
note: the lifetime requirement is introduced here
- --> $DIR/issue-110963-early.rs:35:17
+ --> $DIR/issue-110963-early.rs:34:17
|
LL | F: Future + Send + 'static,
| ^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors; 1 warning emitted
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.rs b/tests/ui/async-await/return-type-notation/issue-110963-late.rs
index 17b5d775d..7533844fb 100644
--- a/tests/ui/async-await/return-type-notation/issue-110963-late.rs
+++ b/tests/ui/async-await/return-type-notation/issue-110963-late.rs
@@ -3,7 +3,6 @@
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
-#![feature(async_fn_in_trait)]
trait HealthCheck {
async fn check(&mut self) -> bool;
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
index 8f4590203..6a47f1ab9 100644
--- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr
@@ -1,5 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(return_type_notation)]
= note: `#[warn(incomplete_features)]` on by default
error[E0277]: `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:22:11
|
LL | build(Bar);
| ----- ^^^ `impl Future<Output = ()> { <_ as Foo>::bar() }` cannot be sent between threads safely
@@ -17,7 +17,7 @@ LL | build(Bar);
|
= help: the trait `for<'a> Send` is not implemented for `impl Future<Output = ()> { <_ as Foo>::bar() }`
note: this is a known limitation of the trait solver that will be lifted in the future
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:23:11
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:22:11
|
LL | build(Bar);
| ------^^^-
@@ -25,7 +25,7 @@ LL | build(Bar);
| | the trait solver is unable to infer the generic types that should be inferred from this argument
| add turbofish arguments to this call to specify the types manually, even if it's redundant
note: required by a bound in `build`
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:20:39
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:19:39
|
LL | fn build<T>(_: T) where T: Foo<bar(): Send> {}
| ^^^^ required by this bound in `build`
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
index 6fab71787..4837815fa 100644
--- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr
@@ -1,5 +1,5 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/normalizing-self-auto-trait-issue-109924.rs:8:12
+ --> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
index b2cd9707d..e581e5ffd 100644
--- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
+++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs
@@ -4,7 +4,6 @@
//[next] compile-flags: -Ztrait-solver=next
// edition:2021
-#![feature(async_fn_in_trait)]
#![feature(return_type_notation)]
//[next]~^ WARN the feature `return_type_notation` is incomplete
diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
index e55104ee9..0ceb62d44 100644
--- a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
+++ b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs
@@ -1,7 +1,7 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
use std::future::Future;
diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
index 8626648b5..4a52e807b 100644
--- a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
+++ b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/rtn-implied-in-supertrait.rs:4:68
+ --> $DIR/rtn-implied-in-supertrait.rs:4:12
|
-LL | #![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
index 028e526b5..891b30638 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
+++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
@@ -1,6 +1,6 @@
// edition:2021
-#![feature(async_fn_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Super1<'a> {
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
index 5bc8dbde4..d9caab587 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/super-method-bound-ambig.rs:3:31
+ --> $DIR/super-method-bound-ambig.rs:3:12
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr
index 891c802c5..5f482b608 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.current.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound.rs:6:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr
index 891c802c5..5f482b608 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.next.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound.rs:6:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.rs b/tests/ui/async-await/return-type-notation/super-method-bound.rs
index 58ea3578d..6025cda2f 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.rs
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.rs
@@ -1,7 +1,7 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Super<'a> {
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.stderr
index ac0668d3c..64fda71c1 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/super-method-bound.rs:4:31
+ --> $DIR/super-method-bound.rs:4:12
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr
index 05cb0ca4a..928b32169 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.current.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-bound.rs:5:49
|
-LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr
index 05cb0ca4a..928b32169 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.next.stderr
@@ -1,7 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/supertrait-bound.rs:5:49
|
-LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
+LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.rs b/tests/ui/async-await/return-type-notation/supertrait-bound.rs
index 19bcfe304..a85596a9f 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.rs
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete and may not be safe to use
trait IntFactory {
diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
index c8cec4946..eb6917fc7 100644
--- a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
+++ b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/supertrait-bound.rs:3:49
+ --> $DIR/supertrait-bound.rs:3:12
|
-LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr
index 1aa008fe4..e2bbb6013 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.current.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ty-or-ct-params.rs:5:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr
index 1aa008fe4..e2bbb6013 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.next.stderr
@@ -1,8 +1,7 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ty-or-ct-params.rs:5:31
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
index 7871a2fed..ac320cfc6 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs
@@ -1,6 +1,6 @@
// edition: 2021
-#![feature(async_fn_in_trait, return_type_notation)]
+#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait Foo {
diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
index 76928c5d7..da94d9d1e 100644
--- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
+++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr
@@ -1,8 +1,8 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/ty-or-ct-params.rs:3:31
+ --> $DIR/ty-or-ct-params.rs:3:12
|
-LL | #![feature(async_fn_in_trait, return_type_notation)]
- | ^^^^^^^^^^^^^^^^^^^^
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
diff --git a/tests/ui/async-await/send-bound-async-closure.rs b/tests/ui/async-await/send-bound-async-closure.rs
index 4e9e7309b..2ec006da3 100644
--- a/tests/ui/async-await/send-bound-async-closure.rs
+++ b/tests/ui/async-await/send-bound-async-closure.rs
@@ -2,7 +2,7 @@
// check-pass
// This test verifies that we do not create a query cycle when typechecking has several inference
-// variables that point to the same generator interior type.
+// variables that point to the same coroutine interior type.
use std::future::Future;
use std::pin::Pin;
diff --git a/tests/ui/async-await/task-context-arg.rs b/tests/ui/async-await/task-context-arg.rs
index 937723ca7..45b18d56b 100644
--- a/tests/ui/async-await/task-context-arg.rs
+++ b/tests/ui/async-await/task-context-arg.rs
@@ -10,7 +10,7 @@
use std::future::Future;
// The compiler produces a closure as part of this function. That closure initially takes an
-// argument _task_context. Later, when the MIR for that closure is transformed into a generator
+// argument _task_context. Later, when the MIR for that closure is transformed into a coroutine
// state machine, _task_context is demoted to not be an argument, but just part of an unnamed
// argument. If we emit debug info saying that both _task_context and the unnamed argument are both
// argument number 2, then LLVM will fail with "conflicting debug info for argument". See
diff --git a/tests/ui/async-await/unnecessary-await.rs b/tests/ui/async-await/unnecessary-await.rs
index cd1e28714..93b68f018 100644
--- a/tests/ui/async-await/unnecessary-await.rs
+++ b/tests/ui/async-await/unnecessary-await.rs
@@ -31,4 +31,9 @@ async fn with_macros() {
f!(());
}
+// Regression test for issue #117014.
+async fn desugaring_span_ctxt() {
+ for x in [] {}.await //~ ERROR `()` is not a future
+}
+
fn main() {}
diff --git a/tests/ui/async-await/unnecessary-await.stderr b/tests/ui/async-await/unnecessary-await.stderr
index 9a2a035b2..620370a61 100644
--- a/tests/ui/async-await/unnecessary-await.stderr
+++ b/tests/ui/async-await/unnecessary-await.stderr
@@ -49,6 +49,19 @@ LL | f!(());
= note: required for `()` to implement `IntoFuture`
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 3 previous errors
+error[E0277]: `()` is not a future
+ --> $DIR/unnecessary-await.rs:36:20
+ |
+LL | for x in [] {}.await
+ | -^^^^^
+ | ||
+ | |`()` is not a future
+ | help: remove the `.await`
+ |
+ = help: the trait `Future` is not implemented for `()`
+ = note: () must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `()` to implement `IntoFuture`
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/atomic-from-mut-not-available.stderr b/tests/ui/atomic-from-mut-not-available.stderr
index d1ebca8a2..c15d19b15 100644
--- a/tests/ui/atomic-from-mut-not-available.stderr
+++ b/tests/ui/atomic-from-mut-not-available.stderr
@@ -3,6 +3,10 @@ error[E0599]: no function or associated item named `from_mut` found for struct `
|
LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64);
| ^^^^^^^^ function or associated item not found in `AtomicU64`
+ |
+note: if you're trying to build a new `AtomicU64`, consider using `AtomicU64::new` which returns `AtomicU64`
+ --> $SRC_DIR/core/src/sync/atomic.rs:LL:COL
+ = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/attributes/const-stability-on-macro.rs b/tests/ui/attributes/const-stability-on-macro.rs
index 412af195d..af268ccd5 100644
--- a/tests/ui/attributes/const-stability-on-macro.rs
+++ b/tests/ui/attributes/const-stability-on-macro.rs
@@ -1,7 +1,7 @@
#![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")]
-#[rustc_const_stable(feature = "foo", since = "0")]
+#[rustc_const_stable(feature = "foo", since = "3.3.3")]
//~^ ERROR macros cannot have const stability attributes
macro_rules! foo {
() => {};
diff --git a/tests/ui/attributes/const-stability-on-macro.stderr b/tests/ui/attributes/const-stability-on-macro.stderr
index c3da02c79..28f31e3d4 100644
--- a/tests/ui/attributes/const-stability-on-macro.stderr
+++ b/tests/ui/attributes/const-stability-on-macro.stderr
@@ -1,8 +1,8 @@
error: macros cannot have const stability attributes
--> $DIR/const-stability-on-macro.rs:4:1
|
-LL | #[rustc_const_stable(feature = "foo", since = "0")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid const stability attribute
+LL | #[rustc_const_stable(feature = "foo", since = "3.3.3")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid const stability attribute
LL |
LL | macro_rules! foo {
| ---------------- const stability attribute affects this macro
diff --git a/tests/ui/attributes/statement-attribute-validation.rs b/tests/ui/attributes/statement-attribute-validation.rs
new file mode 100644
index 000000000..31407364a
--- /dev/null
+++ b/tests/ui/attributes/statement-attribute-validation.rs
@@ -0,0 +1,39 @@
+// test for #117058 - check that attributes are validated on various kinds of statements.
+
+struct A;
+
+fn func() {}
+
+fn main() {
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ if true {
+ } else {
+ }
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ (1);
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ match 1 {
+ _ => {}
+ }
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ while false {}
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ {}
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ A {};
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ func();
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ A;
+ #[allow(two-words)]
+ //~^ ERROR expected one of `(`, `,`, `::`, or `=`, found `-`
+ loop {}
+}
diff --git a/tests/ui/attributes/statement-attribute-validation.stderr b/tests/ui/attributes/statement-attribute-validation.stderr
new file mode 100644
index 000000000..06f447be5
--- /dev/null
+++ b/tests/ui/attributes/statement-attribute-validation.stderr
@@ -0,0 +1,56 @@
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:8:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:13:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:16:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:21:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:24:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:27:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:30:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:33:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: expected one of `(`, `,`, `::`, or `=`, found `-`
+ --> $DIR/statement-attribute-validation.rs:36:16
+ |
+LL | #[allow(two-words)]
+ | ^ expected one of `(`, `,`, `::`, or `=`
+
+error: aborting due to 9 previous errors
+
diff --git a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr
index a1fb4d678..225b8e8f3 100644
--- a/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr
+++ b/tests/ui/attributes/unix_sigpipe/unix_sigpipe-crate.stderr
@@ -3,11 +3,15 @@ error: `unix_sigpipe` attribute cannot be used at crate level
|
LL | #![unix_sigpipe = "inherit"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[unix_sigpipe = "inherit"]
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - #![unix_sigpipe = "inherit"]
+LL + #[unix_sigpipe = "inherit"]
+ |
error: aborting due to previous error
diff --git a/tests/ui/auto-traits/has-arguments.rs b/tests/ui/auto-traits/has-arguments.rs
new file mode 100644
index 000000000..f579eb677
--- /dev/null
+++ b/tests/ui/auto-traits/has-arguments.rs
@@ -0,0 +1,10 @@
+#![feature(auto_traits)]
+
+auto trait Trait1<'outer> {}
+//~^ ERROR auto traits cannot have generic parameters
+
+fn f<'a>(x: impl Trait1<'a>) {}
+
+fn main() {
+ f("");
+}
diff --git a/tests/ui/auto-traits/has-arguments.stderr b/tests/ui/auto-traits/has-arguments.stderr
new file mode 100644
index 000000000..3bba74bad
--- /dev/null
+++ b/tests/ui/auto-traits/has-arguments.stderr
@@ -0,0 +1,11 @@
+error[E0567]: auto traits cannot have generic parameters
+ --> $DIR/has-arguments.rs:3:18
+ |
+LL | auto trait Trait1<'outer> {}
+ | ------^^^^^^^^ help: remove the parameters
+ | |
+ | auto trait cannot have generic parameters
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0567`.
diff --git a/tests/ui/auto-traits/pre-cfg.rs b/tests/ui/auto-traits/pre-cfg.rs
new file mode 100644
index 000000000..e6e840dcb
--- /dev/null
+++ b/tests/ui/auto-traits/pre-cfg.rs
@@ -0,0 +1,8 @@
+// check-pass
+
+#[cfg(FALSE)]
+auto trait Foo {}
+//~^ WARN `auto` traits are unstable
+//~| WARN unstable syntax can change at any point in the future, causing a hard error!
+
+fn main() {}
diff --git a/tests/ui/auto-traits/pre-cfg.stderr b/tests/ui/auto-traits/pre-cfg.stderr
new file mode 100644
index 000000000..6efa05b43
--- /dev/null
+++ b/tests/ui/auto-traits/pre-cfg.stderr
@@ -0,0 +1,13 @@
+warning: `auto` traits are unstable
+ --> $DIR/pre-cfg.rs:4:1
+ |
+LL | auto trait Foo {}
+ | ^^^^
+ |
+ = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
+ = help: add `#![feature(auto_traits)]` to the crate attributes to enable
+ = warning: unstable syntax can change at any point in the future, causing a hard error!
+ = note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/binding/issue-53114-borrow-checks.rs b/tests/ui/binding/issue-53114-borrow-checks.rs
index 7646472f4..6ab1f4f47 100644
--- a/tests/ui/binding/issue-53114-borrow-checks.rs
+++ b/tests/ui/binding/issue-53114-borrow-checks.rs
@@ -1,8 +1,9 @@
+// check-pass
// Issue #53114: NLL's borrow check had some deviations from the old borrow
// checker, and both had some deviations from our ideal state. This test
// captures the behavior of how `_` bindings are handled with respect to how we
// flag expressions that are meant to request unsafe blocks.
-#![allow(irrefutable_let_patterns)]
+#![allow(irrefutable_let_patterns, dropping_references)]
struct M;
fn let_wild_gets_moved_expr() {
@@ -19,29 +20,23 @@ fn let_wild_gets_moved_expr() {
fn match_moved_expr_to_wild() {
let m = M;
drop(m);
- match m { _ => { } } // #53114: should eventually be accepted too
- //~^ ERROR [E0382]
+ match m { _ => { } } // #53114: accepted too
let mm = (M, M); // variation on above with `_` in substructure
match mm { (_x, _) => { } }
match mm { (_, _y) => { } }
- //~^ ERROR [E0382]
match mm { (_, _) => { } }
- //~^ ERROR [E0382]
}
fn if_let_moved_expr_to_wild() {
let m = M;
drop(m);
- if let _ = m { } // #53114: should eventually be accepted too
- //~^ ERROR [E0382]
+ if let _ = m { } // #53114: accepted too
let mm = (M, M); // variation on above with `_` in substructure
if let (_x, _) = mm { }
if let (_, _y) = mm { }
- //~^ ERROR [E0382]
if let (_, _) = mm { }
- //~^ ERROR [E0382]
}
fn let_wild_gets_borrowed_expr() {
diff --git a/tests/ui/binding/issue-53114-borrow-checks.stderr b/tests/ui/binding/issue-53114-borrow-checks.stderr
deleted file mode 100644
index 0ec2ae883..000000000
--- a/tests/ui/binding/issue-53114-borrow-checks.stderr
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0382]: use of moved value: `m`
- --> $DIR/issue-53114-borrow-checks.rs:22:11
- |
-LL | let m = M;
- | - move occurs because `m` has type `M`, which does not implement the `Copy` trait
-LL | drop(m);
- | - value moved here
-LL | match m { _ => { } } // #53114: should eventually be accepted too
- | ^ value used here after move
-
-error[E0382]: use of partially moved value: `mm`
- --> $DIR/issue-53114-borrow-checks.rs:27:11
- |
-LL | match mm { (_x, _) => { } }
- | -- value partially moved here
-LL | match mm { (_, _y) => { } }
- | ^^ value used here after partial move
- |
- = note: partial move occurs because `mm.0` has type `M`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | match mm { (ref _x, _) => { } }
- | +++
-
-error[E0382]: use of partially moved value: `mm`
- --> $DIR/issue-53114-borrow-checks.rs:29:11
- |
-LL | match mm { (_, _y) => { } }
- | -- value partially moved here
-LL |
-LL | match mm { (_, _) => { } }
- | ^^ value used here after partial move
- |
- = note: partial move occurs because `mm.1` has type `M`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | match mm { (_, ref _y) => { } }
- | +++
-
-error[E0382]: use of moved value: `m`
- --> $DIR/issue-53114-borrow-checks.rs:36:16
- |
-LL | let m = M;
- | - move occurs because `m` has type `M`, which does not implement the `Copy` trait
-LL | drop(m);
- | - value moved here
-LL | if let _ = m { } // #53114: should eventually be accepted too
- | ^ value used here after move
-
-error[E0382]: use of partially moved value: `mm`
- --> $DIR/issue-53114-borrow-checks.rs:41:22
- |
-LL | if let (_x, _) = mm { }
- | -- value partially moved here
-LL | if let (_, _y) = mm { }
- | ^^ value used here after partial move
- |
- = note: partial move occurs because `mm.0` has type `M`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | if let (ref _x, _) = mm { }
- | +++
-
-error[E0382]: use of partially moved value: `mm`
- --> $DIR/issue-53114-borrow-checks.rs:43:21
- |
-LL | if let (_, _y) = mm { }
- | -- value partially moved here
-LL |
-LL | if let (_, _) = mm { }
- | ^^ value used here after partial move
- |
- = note: partial move occurs because `mm.1` has type `M`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | if let (_, ref _y) = mm { }
- | +++
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/binop/false-binop-caused-by-missing-semi.fixed b/tests/ui/binop/false-binop-caused-by-missing-semi.fixed
new file mode 100644
index 000000000..b47372c90
--- /dev/null
+++ b/tests/ui/binop/false-binop-caused-by-missing-semi.fixed
@@ -0,0 +1,10 @@
+// run-rustfix
+fn foo() {}
+fn main() {
+ let mut y = 42;
+ let x = &mut y;
+ foo();
+ *x = 0; //~ ERROR invalid left-hand side of assignment
+ let _ = x;
+ println!("{y}");
+}
diff --git a/tests/ui/binop/false-binop-caused-by-missing-semi.rs b/tests/ui/binop/false-binop-caused-by-missing-semi.rs
new file mode 100644
index 000000000..14671de7e
--- /dev/null
+++ b/tests/ui/binop/false-binop-caused-by-missing-semi.rs
@@ -0,0 +1,10 @@
+// run-rustfix
+fn foo() {}
+fn main() {
+ let mut y = 42;
+ let x = &mut y;
+ foo()
+ *x = 0; //~ ERROR invalid left-hand side of assignment
+ let _ = x;
+ println!("{y}");
+}
diff --git a/tests/ui/binop/false-binop-caused-by-missing-semi.stderr b/tests/ui/binop/false-binop-caused-by-missing-semi.stderr
new file mode 100644
index 000000000..fca042b1c
--- /dev/null
+++ b/tests/ui/binop/false-binop-caused-by-missing-semi.stderr
@@ -0,0 +1,17 @@
+error[E0070]: invalid left-hand side of assignment
+ --> $DIR/false-binop-caused-by-missing-semi.rs:7:8
+ |
+LL | / foo()
+LL | | *x = 0;
+ | | - ^
+ | |______|
+ | cannot assign to this expression
+ |
+help: you might have meant to write a semicolon here
+ |
+LL | foo();
+ | +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0070`.
diff --git a/tests/ui/block-result/block-must-not-have-result-res.stderr b/tests/ui/block-result/block-must-not-have-result-res.stderr
index 0080d06dd..b7427462b 100644
--- a/tests/ui/block-result/block-must-not-have-result-res.stderr
+++ b/tests/ui/block-result/block-must-not-have-result-res.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/block-must-not-have-result-res.rs:5:9
|
LL | fn drop(&mut self) {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | true
| ^^^^ expected `()`, found `bool`
diff --git a/tests/ui/block-result/issue-20862.stderr b/tests/ui/block-result/issue-20862.stderr
index 17b524fe3..1df3a6836 100644
--- a/tests/ui/block-result/issue-20862.stderr
+++ b/tests/ui/block-result/issue-20862.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-20862.rs:2:5
|
LL | fn foo(x: i32) {
- | - help: a return type might be missing here: `-> _`
+ | - help: a return type might be missing here: `-> _`
LL | |y| x + y
| ^^^^^^^^^ expected `()`, found closure
|
diff --git a/tests/ui/block-result/issue-22645.stderr b/tests/ui/block-result/issue-22645.stderr
index 677b40aaa..1064848f5 100644
--- a/tests/ui/block-result/issue-22645.stderr
+++ b/tests/ui/block-result/issue-22645.stderr
@@ -17,7 +17,7 @@ error[E0308]: mismatched types
--> $DIR/issue-22645.rs:15:3
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | let b = Bob + 3.5;
LL | b + 3
| ^^^^^ expected `()`, found `Bob`
diff --git a/tests/ui/block-result/issue-5500.stderr b/tests/ui/block-result/issue-5500.stderr
index 8cd4bd658..417991e9e 100644
--- a/tests/ui/block-result/issue-5500.stderr
+++ b/tests/ui/block-result/issue-5500.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-5500.rs:2:5
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | &panic!()
| ^^^^^^^^^ expected `()`, found `&_`
|
diff --git a/tests/ui/borrowck/alias-liveness/escaping-bounds-2.rs b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.rs
new file mode 100644
index 000000000..05884f674
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.rs
@@ -0,0 +1,14 @@
+trait Trait {
+ type Gat<'a: 'b, 'b: 'c, 'c>: 'c;
+}
+
+fn get_func<'a, T: Trait>(_: &'a str) -> fn(T::Gat<'a, '_, 'static>) {
+ loop {}
+}
+
+fn test<T: Trait>() {
+ let func = get_func::<T>(&String::new()); //~ ERROR temporary value dropped
+ drop(func);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr
new file mode 100644
index 000000000..7fd0cb9bb
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/escaping-bounds-2.stderr
@@ -0,0 +1,19 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/escaping-bounds-2.rs:10:31
+ |
+LL | let func = get_func::<T>(&String::new());
+ | ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
+ | |
+ | creates a temporary value which is freed while still in use
+LL | drop(func);
+ | ---- borrow later used here
+ |
+help: consider using a `let` binding to create a longer lived value
+ |
+LL ~ let binding = String::new();
+LL ~ let func = get_func::<T>(&binding);
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/borrowck/alias-liveness/escaping-bounds.rs b/tests/ui/borrowck/alias-liveness/escaping-bounds.rs
new file mode 100644
index 000000000..3ccdc78e6
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/escaping-bounds.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+// Ensure that we don't ICE when an alias that has escaping bound vars is
+// required to be live. This is because the code that allows us to deduce an
+// appropriate outlives bound for a given alias type (in this test, a
+// projection) does not handle aliases with escaping bound vars.
+// See <https://github.com/rust-lang/rust/issues/117455>.
+
+trait Foo {
+ type Assoc<'a, 'b>: 'static;
+}
+
+struct MentionsLifetimeAndType<'a, T>(&'a (), T);
+
+fn foo<'a, 'b, T: Foo>(_: <T as Foo>::Assoc<'a, 'b>) {}
+
+fn test<'b, T: Foo>() {
+ let y: MentionsLifetimeAndType<'_, for<'a> fn(<T as Foo>::Assoc<'a, 'b>)> =
+ MentionsLifetimeAndType(&(), foo);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/gat-static.rs b/tests/ui/borrowck/alias-liveness/gat-static.rs
new file mode 100644
index 000000000..92153124a
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/gat-static.rs
@@ -0,0 +1,29 @@
+// check-pass
+
+trait Foo {
+ type Assoc<'a>
+ where
+ Self: 'a;
+
+ fn assoc(&mut self) -> Self::Assoc<'_>;
+}
+
+fn overlapping_mut<T>(mut t: T)
+where
+ T: Foo,
+ for<'a> T::Assoc<'a>: 'static,
+{
+ let a = t.assoc();
+ let b = t.assoc();
+}
+
+fn live_past_borrow<T>(mut t: T)
+where
+ T: Foo,
+ for<'a> T::Assoc<'a>: 'static {
+ let x = t.assoc();
+ drop(t);
+ drop(x);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.rs b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.rs
new file mode 100644
index 000000000..1f26c7bab
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.rs
@@ -0,0 +1,16 @@
+// known-bug: #42940
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+trait Outlives<'a>: 'a {}
+impl<'a, T: 'a> Outlives<'a> for T {}
+
+// Test that we treat `for<'a> Opaque: 'a` as `Opaque: 'static`
+fn test<'o>(v: &'o Vec<i32>) -> impl Captures<'o> + for<'a> Outlives<'a> {}
+
+fn statik() -> impl Sized {
+ test(&vec![])
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr
new file mode 100644
index 000000000..58a42d8af
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/higher-ranked-outlives-for-capture.stderr
@@ -0,0 +1,16 @@
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/higher-ranked-outlives-for-capture.rs:13:11
+ |
+LL | test(&vec![])
+ | ------^^^^^^-
+ | | |
+ | | creates a temporary value which is freed while still in use
+ | argument requires that borrow lasts for `'static`
+LL | }
+ | - temporary value is freed at the end of this statement
+ |
+ = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/borrowck/alias-liveness/higher-ranked.rs b/tests/ui/borrowck/alias-liveness/higher-ranked.rs
new file mode 100644
index 000000000..afd0d3b31
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/higher-ranked.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+trait Outlives<'a>: 'a {}
+impl<'a, T: 'a> Outlives<'a> for T {}
+
+// Test that we treat `for<'a> Opaque: 'a` as `Opaque: 'static`
+fn test<'o>(v: &'o Vec<i32>) -> impl Captures<'o> + for<'a> Outlives<'a> {}
+
+fn opaque_doesnt_use_temporary() {
+ let a = test(&vec![]);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/opaque-capture.rs b/tests/ui/borrowck/alias-liveness/opaque-capture.rs
new file mode 100644
index 000000000..f4ca2728b
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/opaque-capture.rs
@@ -0,0 +1,17 @@
+// check-pass
+
+// Check that opaques capturing early and late-bound vars correctly mark
+// regions required to be live using the item bounds.
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+fn captures_temp_late<'a>(x: &'a Vec<i32>) -> impl Sized + Captures<'a> + 'static {}
+fn captures_temp_early<'a: 'a>(x: &'a Vec<i32>) -> impl Sized + Captures<'a> + 'static {}
+
+fn test() {
+ let x = captures_temp_early(&vec![]);
+ let y = captures_temp_late(&vec![]);
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/opaque-type-param.rs b/tests/ui/borrowck/alias-liveness/opaque-type-param.rs
new file mode 100644
index 000000000..a292463b2
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/opaque-type-param.rs
@@ -0,0 +1,14 @@
+// known-bug: #42940
+
+trait Trait {}
+impl Trait for () {}
+
+fn foo<'a>(s: &'a str) -> impl Trait + 'static {
+ bar(s)
+}
+
+fn bar<P: AsRef<str>>(s: P) -> impl Trait + 'static {
+ ()
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr
new file mode 100644
index 000000000..e1fbbc14f
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr
@@ -0,0 +1,13 @@
+error[E0700]: hidden type for `impl Trait + 'static` captures lifetime that does not appear in bounds
+ --> $DIR/opaque-type-param.rs:7:5
+ |
+LL | fn foo<'a>(s: &'a str) -> impl Trait + 'static {
+ | -- -------------------- opaque type defined here
+ | |
+ | hidden type `impl Trait + 'static` captures the lifetime `'a` as defined here
+LL | bar(s)
+ | ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/borrowck/alias-liveness/rpit-static.rs b/tests/ui/borrowck/alias-liveness/rpit-static.rs
new file mode 100644
index 000000000..45da3edb8
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/rpit-static.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+fn foo(x: &mut i32) -> impl Sized + Captures<'_> + 'static {}
+
+fn overlapping_mut() {
+ let i = &mut 1;
+ let x = foo(i);
+ let y = foo(i);
+}
+
+fn live_past_borrow() {
+ let y;
+ {
+ let x = &mut 1;
+ y = foo(x);
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/rpitit-static.rs b/tests/ui/borrowck/alias-liveness/rpitit-static.rs
new file mode 100644
index 000000000..2cc68d2bf
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/rpitit-static.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+trait Foo {
+ fn rpitit(&mut self) -> impl Sized + 'static;
+}
+
+fn live_past_borrow<T: Foo>(mut t: T) {
+ let x = t.rpitit();
+ drop(t);
+ drop(x);
+}
+
+fn overlapping_mut<T: Foo>(mut t: T) {
+ let a = t.rpitit();
+ let b = t.rpitit();
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/rtn-static.rs b/tests/ui/borrowck/alias-liveness/rtn-static.rs
new file mode 100644
index 000000000..1f136b8b9
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/rtn-static.rs
@@ -0,0 +1,23 @@
+// check-pass
+
+#![feature(return_type_notation)]
+//~^ WARN the feature `return_type_notation` is incomplete
+
+trait Foo {
+ fn borrow(&mut self) -> impl Sized + '_;
+}
+
+fn live_past_borrow<T: Foo<borrow(): 'static>>(mut t: T) {
+ let x = t.borrow();
+ drop(t);
+ drop(x);
+}
+
+// Test that the `'_` item bound in `borrow` does not cause us to
+// overlook the `'static` RTN bound.
+fn overlapping_mut<T: Foo<borrow(): 'static>>(mut t: T) {
+ let x = t.borrow();
+ let x = t.borrow();
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/alias-liveness/rtn-static.stderr b/tests/ui/borrowck/alias-liveness/rtn-static.stderr
new file mode 100644
index 000000000..e9202db2c
--- /dev/null
+++ b/tests/ui/borrowck/alias-liveness/rtn-static.stderr
@@ -0,0 +1,11 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/rtn-static.rs:3:12
+ |
+LL | #![feature(return_type_notation)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-match.rs b/tests/ui/borrowck/borrowck-move-out-from-array-match.rs
index ced4d002b..d2a5da66d 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-match.rs
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-match.rs
@@ -42,8 +42,8 @@ fn move_out_by_const_index_and_subslice() {
[_x, _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_y @ .., _, _] => {}
+ //~^ ERROR use of partially moved value
}
}
@@ -53,8 +53,8 @@ fn move_out_by_const_index_end_and_subslice() {
[.., _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _, _y @ ..] => {}
+ //~^ ERROR use of partially moved value
}
}
@@ -64,8 +64,8 @@ fn move_out_by_const_index_field_and_subslice() {
[(_x, _), _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_y @ .., _, _] => {}
+ //~^ ERROR use of partially moved value
}
}
@@ -75,8 +75,8 @@ fn move_out_by_const_index_end_field_and_subslice() {
[.., (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _, _y @ ..] => {}
+ //~^ ERROR use of partially moved value
}
}
@@ -108,8 +108,8 @@ fn move_out_by_subslice_and_subslice() {
[x @ .., _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _y @ ..] => {}
+ //~^ ERROR use of partially moved value
}
}
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-match.stderr b/tests/ui/borrowck/borrowck-move-out-from-array-match.stderr
index 67b00c1dd..d82777684 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-match.stderr
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-match.stderr
@@ -44,13 +44,13 @@ LL | [_, _, (ref _x, _)] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:44:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:45:10
|
LL | [_x, _, _] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_y @ .., _, _] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -59,13 +59,13 @@ LL | [ref _x, _, _] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:55:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:56:16
|
LL | [.., _x] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _, _y @ ..] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -74,13 +74,13 @@ LL | [.., ref _x] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:66:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:67:10
|
LL | [(_x, _), _, _] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_y @ .., _, _] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -89,13 +89,13 @@ LL | [(ref _x, _), _, _] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:77:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:78:16
|
LL | [.., (_x, _)] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _, _y @ ..] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -134,13 +134,13 @@ LL | [_, _, ref _y @ ..] => {}
| +++
error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-match.rs:110:11
+ --> $DIR/borrowck-move-out-from-array-match.rs:111:13
|
LL | [x @ .., _] => {}
| - value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _y @ ..] => {}
+ | ^^ value used here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs b/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs
index 97db70f34..1e401b7e9 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.rs
@@ -1,3 +1,4 @@
+// check-pass
// Due to #53114, which causes a "read" of the `_` patterns,
// the borrow-checker refuses this code, while it should probably be allowed.
// Once the bug is fixed, the test, which is derived from a
@@ -15,7 +16,6 @@ fn move_out_from_begin_and_one_from_end() {
[_, _, _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., _y, _] => {}
}
}
@@ -26,7 +26,6 @@ fn move_out_from_begin_field_and_end_field() {
[_, _, (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., (_, _y)] => {}
}
}
@@ -39,7 +38,6 @@ fn move_out_by_const_index_and_subslice() {
[_x, _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _y @ ..] => {}
}
}
@@ -50,7 +48,6 @@ fn move_out_by_const_index_end_and_subslice() {
[.., _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_y @ .., _] => {}
}
}
@@ -61,7 +58,6 @@ fn move_out_by_const_index_field_and_subslice() {
[(_x, _), _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _y @ ..] => {}
}
}
@@ -72,7 +68,6 @@ fn move_out_by_const_index_end_field_and_subslice() {
[.., (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_y @ .., _] => {}
}
}
@@ -83,7 +78,6 @@ fn move_out_by_const_subslice_and_index_field() {
[_, _y @ ..] => {}
}
match a {
- //~^ ERROR use of partially moved value
[(_x, _), _, _] => {}
}
}
@@ -94,7 +88,6 @@ fn move_out_by_const_subslice_and_end_index_field() {
[_y @ .., _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., (_x, _)] => {}
}
}
@@ -107,7 +100,6 @@ fn move_out_by_subslice_and_subslice() {
[x @ .., _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, _y @ ..] => {}
}
}
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr b/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr
deleted file mode 100644
index 47429ea3e..000000000
--- a/tests/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr
+++ /dev/null
@@ -1,138 +0,0 @@
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:17:11
- |
-LL | [_, _, _x] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, _, ref _x] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:28:11
- |
-LL | [_, _, (_x, _)] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, _, (ref _x, _)] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:41:11
- |
-LL | [_x, _, _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref _x, _, _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:52:11
- |
-LL | [.., _x] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [.., ref _x] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:63:11
- |
-LL | [(_x, _), _, _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [(ref _x, _), _, _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:74:11
- |
-LL | [.., (_x, _)] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [.., (ref _x, _)] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11
- |
-LL | [_, _y @ ..] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, ref _y @ ..] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11
- |
-LL | [_y @ .., _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref _y @ .., _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11
- |
-LL | [x @ .., _, _] => {}
- | - value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref x @ .., _, _] => {}
- | +++
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs b/tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs
index 604a25cdc..fbcf126f3 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-use-match.rs
@@ -42,8 +42,8 @@ fn move_out_by_const_index_and_subslice() {
[_x, _, _] => {}
}
match a {
- //~^ ERROR [E0382]
[ref _y @ .., _, _] => {}
+ //~^ ERROR [E0382]
}
}
@@ -53,8 +53,8 @@ fn move_out_by_const_index_end_and_subslice() {
[.., _x] => {}
}
match a {
- //~^ ERROR [E0382]
[_, _, ref _y @ ..] => {}
+ //~^ ERROR [E0382]
}
}
@@ -64,8 +64,8 @@ fn move_out_by_const_index_field_and_subslice() {
[(_x, _), _, _] => {}
}
match a {
- //~^ ERROR [E0382]
[ref _y @ .., _, _] => {}
+ //~^ ERROR [E0382]
}
}
@@ -75,8 +75,8 @@ fn move_out_by_const_index_end_field_and_subslice() {
[.., (_x, _)] => {}
}
match a {
- //~^ ERROR [E0382]
[_, _, ref _y @ ..] => {}
+ //~^ ERROR [E0382]
}
}
@@ -108,8 +108,8 @@ fn move_out_by_subslice_and_subslice() {
[x @ .., _] => {}
}
match a {
- //~^ ERROR [E0382]
[_, ref _y @ ..] => {}
+ //~^ ERROR [E0382]
}
}
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr b/tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr
index bfab13d42..da76b5c4a 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-use-match.stderr
@@ -43,14 +43,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [_, _, (ref _x, _)] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:44:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:45:10
|
LL | [_x, _, _] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [ref _y @ .., _, _] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -58,14 +58,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [ref _x, _, _] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:55:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:56:16
|
LL | [.., _x] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _, ref _y @ ..] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -73,14 +73,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [.., ref _x] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:66:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:67:10
|
LL | [(_x, _), _, _] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [ref _y @ .., _, _] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -88,14 +88,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [(ref _x, _), _, _] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:77:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:78:16
|
LL | [.., (_x, _)] => {}
| -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, _, ref _y @ ..] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
@@ -133,14 +133,14 @@ help: borrow this binding in the pattern to avoid moving the value
LL | [_, _, ref _y @ ..] => {}
| +++
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-match.rs:110:11
+error[E0382]: borrow of partially moved value: `a`
+ --> $DIR/borrowck-move-out-from-array-use-match.rs:111:13
|
LL | [x @ .., _] => {}
| - value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
+...
+LL | [_, ref _y @ ..] => {}
+ | ^^^^^^ value borrowed here after partial move
|
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs b/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs
index 017ca90b8..2f6ce430b 100644
--- a/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs
+++ b/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs
@@ -1,3 +1,4 @@
+// check-pass
// Due to #53114, which causes a "read" of the `_` patterns,
// the borrow-checker refuses this code, while it should probably be allowed.
// Once the bug is fixed, the test, which is derived from a
@@ -15,7 +16,6 @@ fn move_out_from_begin_and_one_from_end() {
[_, _, _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., ref _y, _] => {}
}
}
@@ -26,7 +26,6 @@ fn move_out_from_begin_field_and_end_field() {
[_, _, (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., (_, ref _y)] => {}
}
}
@@ -39,7 +38,6 @@ fn move_out_by_const_index_and_subslice() {
[_x, _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, ref _y @ ..] => {}
}
}
@@ -50,7 +48,6 @@ fn move_out_by_const_index_end_and_subslice() {
[.., _x] => {}
}
match a {
- //~^ ERROR use of partially moved value
[ref _y @ .., _] => {}
}
}
@@ -61,7 +58,6 @@ fn move_out_by_const_index_field_and_subslice() {
[(_x, _), _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, ref _y @ ..] => {}
}
}
@@ -72,7 +68,6 @@ fn move_out_by_const_index_end_field_and_subslice() {
[.., (_x, _)] => {}
}
match a {
- //~^ ERROR use of partially moved value
[ref _y @ .., _] => {}
}
}
@@ -83,7 +78,6 @@ fn move_out_by_const_subslice_and_index_field() {
[_, _y @ ..] => {}
}
match a {
- //~^ ERROR use of partially moved value
[(ref _x, _), _, _] => {}
}
}
@@ -94,7 +88,6 @@ fn move_out_by_const_subslice_and_end_index_field() {
[_y @ .., _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[.., (ref _x, _)] => {}
}
}
@@ -107,7 +100,6 @@ fn move_out_by_subslice_and_subslice() {
[x @ .., _, _] => {}
}
match a {
- //~^ ERROR use of partially moved value
[_, ref _y @ ..] => {}
}
}
diff --git a/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr b/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr
deleted file mode 100644
index 8412c24fe..000000000
--- a/tests/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr
+++ /dev/null
@@ -1,138 +0,0 @@
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:17:11
- |
-LL | [_, _, _x] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, _, ref _x] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:28:11
- |
-LL | [_, _, (_x, _)] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, _, (ref _x, _)] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:41:11
- |
-LL | [_x, _, _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref _x, _, _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:52:11
- |
-LL | [.., _x] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [.., ref _x] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:63:11
- |
-LL | [(_x, _), _, _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [(ref _x, _), _, _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:74:11
- |
-LL | [.., (_x, _)] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [.., (ref _x, _)] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11
- |
-LL | [_, _y @ ..] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [_, ref _y @ ..] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11
- |
-LL | [_y @ .., _] => {}
- | -- value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref _y @ .., _] => {}
- | +++
-
-error[E0382]: use of partially moved value: `a`
- --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11
- |
-LL | [x @ .., _, _] => {}
- | - value partially moved here
-LL | }
-LL | match a {
- | ^ value used here after partial move
- |
- = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
-help: borrow this binding in the pattern to avoid moving the value
- |
-LL | [ref x @ .., _, _] => {}
- | +++
-
-error: aborting due to 9 previous errors
-
-For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/borrowck/issue-62107-match-arm-scopes.rs b/tests/ui/borrowck/issue-62107-match-arm-scopes.rs
index 93ce34d2f..7dbcad9d3 100644
--- a/tests/ui/borrowck/issue-62107-match-arm-scopes.rs
+++ b/tests/ui/borrowck/issue-62107-match-arm-scopes.rs
@@ -1,8 +1,8 @@
fn main() {
let e: i32;
match e {
- //~^ ERROR E0381
ref u if true => {}
+ //~^ ERROR E0381
ref v if true => {
let tx = 0;
&tx;
diff --git a/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr b/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr
index 9683da919..8fe8fa710 100644
--- a/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr
+++ b/tests/ui/borrowck/issue-62107-match-arm-scopes.stderr
@@ -1,10 +1,11 @@
error[E0381]: used binding `e` isn't initialized
- --> $DIR/issue-62107-match-arm-scopes.rs:3:11
+ --> $DIR/issue-62107-match-arm-scopes.rs:4:9
|
LL | let e: i32;
| - binding declared here but left uninitialized
LL | match e {
- | ^ `e` used here but it isn't initialized
+LL | ref u if true => {}
+ | ^^^^^ `e` used here but it isn't initialized
|
help: consider assigning a value
|
diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs
index d067ff447..b52939ffc 100644
--- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs
+++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.rs
@@ -13,10 +13,10 @@ impl MarketMultiplier {
}
}
-async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
+async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
//~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument was supplied
//~^^ ERROR struct takes 1 generic argument but 0 generic arguments were supplied
- LockedMarket(generator.lock().unwrap().buy())
+ LockedMarket(coroutine.lock().unwrap().buy())
}
struct LockedMarket<T>(T);
diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr
index 73e0aaf1e..516c1d065 100644
--- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr
+++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr
@@ -1,7 +1,7 @@
error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
-LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
+LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
| ^^^^^^^^^^^^---- help: remove these generics
| |
| expected 0 lifetime arguments
@@ -15,7 +15,7 @@ LL | struct LockedMarket<T>(T);
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
-LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
+LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
| ^^^^^^^^^^^^ expected 1 generic argument
|
note: struct defined here, with 1 generic parameter: `T`
@@ -25,7 +25,7 @@ LL | struct LockedMarket<T>(T);
| ^^^^^^^^^^^^ -
help: add missing generic argument
|
-LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
+LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
| +++
error: aborting due to 2 previous errors
diff --git a/tests/ui/borrowck/let_underscore_temporary.rs b/tests/ui/borrowck/let_underscore_temporary.rs
index 835cd2079..a5ea3b3a7 100644
--- a/tests/ui/borrowck/let_underscore_temporary.rs
+++ b/tests/ui/borrowck/let_underscore_temporary.rs
@@ -52,4 +52,42 @@ fn let_ascribe(string: &Option<&str>, mut num: Option<i32>) {
};
}
+fn matched(string: &Option<&str>, mut num: Option<i32>) {
+ match if let Some(s) = *string { s.len() } else { 0 } {
+ _ => {}
+ };
+ match if let Some(s) = &num { s } else { &0 } {
+ _ => {}
+ };
+ match if let Some(s) = &mut num {
+ *s += 1;
+ s
+ } else {
+ &mut 0
+ //~^ ERROR temporary value dropped while borrowed
+ } {
+ _ => {}
+ };
+ match if let Some(ref s) = num { s } else { &0 } {
+ _ => {}
+ };
+ match if let Some(mut s) = num {
+ s += 1;
+ s
+ } else {
+ 0
+ } {
+ _ => {}
+ };
+ match if let Some(ref mut s) = num {
+ *s += 1;
+ s
+ } else {
+ &mut 0
+ //~^ ERROR temporary value dropped while borrowed
+ } {
+ _ => {}
+ };
+}
+
fn main() {}
diff --git a/tests/ui/borrowck/let_underscore_temporary.stderr b/tests/ui/borrowck/let_underscore_temporary.stderr
index 74f3598c4..6bccf3291 100644
--- a/tests/ui/borrowck/let_underscore_temporary.stderr
+++ b/tests/ui/borrowck/let_underscore_temporary.stderr
@@ -74,6 +74,44 @@ LL | | };
|
= note: consider using a `let` binding to create a longer lived value
-error: aborting due to 4 previous errors
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/let_underscore_temporary.rs:66:14
+ |
+LL | match if let Some(s) = &mut num {
+ | ___________-
+LL | | *s += 1;
+LL | | s
+LL | | } else {
+LL | | &mut 0
+ | | ^ creates a temporary value which is freed while still in use
+LL | |
+LL | | } {
+ | | -
+ | | |
+ | |_____temporary value is freed at the end of this statement
+ | borrow later used here
+ |
+ = note: consider using a `let` binding to create a longer lived value
+
+error[E0716]: temporary value dropped while borrowed
+ --> $DIR/let_underscore_temporary.rs:86:14
+ |
+LL | match if let Some(ref mut s) = num {
+ | ___________-
+LL | | *s += 1;
+LL | | s
+LL | | } else {
+LL | | &mut 0
+ | | ^ creates a temporary value which is freed while still in use
+LL | |
+LL | | } {
+ | | -
+ | | |
+ | |_____temporary value is freed at the end of this statement
+ | borrow later used here
+ |
+ = note: consider using a `let` binding to create a longer lived value
+
+error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr
index 930fea915..7ebea3c03 100644
--- a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr
+++ b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr
@@ -53,6 +53,7 @@ note: ...does not necessarily outlive the lifetime `'c` as defined here
|
LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) {
| ^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0195]: lifetime parameters or bounds on method `wrong_bound2` do not match the trait declaration
--> $DIR/regions-bound-missing-bound-in-impl.rs:42:20
diff --git a/tests/ui/bounds-lifetime.rs b/tests/ui/bounds-lifetime.rs
index 31aa4011b..e3e635a4e 100644
--- a/tests/ui/bounds-lifetime.rs
+++ b/tests/ui/bounds-lifetime.rs
@@ -2,6 +2,6 @@ type A = for<'b, 'a: 'b> fn(); //~ ERROR lifetime bounds cannot be used in this
type B = for<'b, 'a: 'b,> fn(); //~ ERROR lifetime bounds cannot be used in this context
type C = for<'b, 'a: 'b +> fn(); //~ ERROR lifetime bounds cannot be used in this context
type D = for<'a, T> fn(); //~ ERROR only lifetime parameters can be used in this context
-type E = dyn for<T> Fn(); //~ ERROR only lifetime parameters can be used in this context
+type E = dyn for<T, U> Fn(); //~ ERROR only lifetime parameters can be used in this context
fn main() {}
diff --git a/tests/ui/bounds-lifetime.stderr b/tests/ui/bounds-lifetime.stderr
index f0bfe784c..bbae835d8 100644
--- a/tests/ui/bounds-lifetime.stderr
+++ b/tests/ui/bounds-lifetime.stderr
@@ -28,8 +28,8 @@ LL | type D = for<'a, T> fn();
error[E0658]: only lifetime parameters can be used in this context
--> $DIR/bounds-lifetime.rs:5:18
|
-LL | type E = dyn for<T> Fn();
- | ^
+LL | type E = dyn for<T, U> Fn();
+ | ^ ^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= help: add `#![feature(non_lifetime_binders)]` to the crate attributes to enable
diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr
index e2b177b95..0e2c6c60b 100644
--- a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr
+++ b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr
@@ -2,14 +2,17 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/builtin-superkinds-self-type.rs:10:16
|
LL | impl <T: Sync> Foo for T { }
- | ^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | ^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/builtin-superkinds-self-type.rs:6:24
|
LL | trait Foo : Sized+Sync+'static {
| ^^^^^^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl <T: Sync + 'static> Foo for T { }
| +++++++++
diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr
index 5a02f4aa9..69e19e1d4 100644
--- a/tests/ui/c-variadic/issue-86053-1.stderr
+++ b/tests/ui/c-variadic/issue-86053-1.stderr
@@ -50,13 +50,7 @@ error: only foreign or `unsafe extern "C"` functions may be C-variadic
--> $DIR/issue-86053-1.rs:11:12
|
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
- | ^^^
-
-error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/issue-86053-1.rs:11:36
- |
-LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
- | ^^^
+ | ^^^ ^^^
error[E0412]: cannot find type `F` in this scope
--> $DIR/issue-86053-1.rs:11:48
@@ -76,6 +70,6 @@ help: you might be missing a type parameter
LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self ,
| +++
-error: aborting due to 11 previous errors
+error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/cast/ptr-to-ptr-different-regions.rs b/tests/ui/cast/ptr-to-ptr-different-regions.rs
new file mode 100644
index 000000000..5592e613a
--- /dev/null
+++ b/tests/ui/cast/ptr-to-ptr-different-regions.rs
@@ -0,0 +1,24 @@
+// check-pass
+
+// https://github.com/rust-lang/rust/issues/113257
+
+#![deny(trivial_casts)] // The casts here are not trivial.
+
+struct Foo<'a> { a: &'a () }
+
+fn extend_lifetime_very_very_safely<'a>(v: *const Foo<'a>) -> *const Foo<'static> {
+ // This should pass because raw pointer casts can do anything they want.
+ v as *const Foo<'static>
+}
+
+trait Trait {}
+
+fn assert_static<'a>(ptr: *mut (dyn Trait + 'a)) -> *mut (dyn Trait + 'static) {
+ ptr as _
+}
+
+fn main() {
+ let unit = ();
+ let foo = Foo { a: &unit };
+ let _long: *const Foo<'static> = extend_lifetime_very_very_safely(&foo);
+}
diff --git a/tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr b/tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
index 9ce4710d6..75df314e0 100644
--- a/tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
+++ b/tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
@@ -25,6 +25,7 @@ LL | #![cfg_attr(foo, crate_type="bin")]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `crate_name` within an `#![cfg_attr] attribute is deprecated`
--> $DIR/future-compat-crate-attributes-using-cfg_attr.rs:9:18
@@ -34,6 +35,7 @@ LL | #![cfg_attr(foo, crate_name="bar")]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #91632 <https://github.com/rust-lang/rust/issues/91632>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/check-cfg/allow-at-crate-level.rs b/tests/ui/check-cfg/allow-at-crate-level.rs
index ce3383a29..1629d2e0b 100644
--- a/tests/ui/check-cfg/allow-at-crate-level.rs
+++ b/tests/ui/check-cfg/allow-at-crate-level.rs
@@ -1,7 +1,7 @@
// This test check that #![allow(unexpected_cfgs)] works with --cfg
//
// check-pass
-// compile-flags: --cfg=unexpected --check-cfg=names() -Z unstable-options
+// compile-flags: --cfg=unexpected --check-cfg=cfg() -Z unstable-options
#![allow(unexpected_cfgs)]
diff --git a/tests/ui/check-cfg/allow-macro-cfg.rs b/tests/ui/check-cfg/allow-macro-cfg.rs
index 8016a4d19..ea26355ac 100644
--- a/tests/ui/check-cfg/allow-macro-cfg.rs
+++ b/tests/ui/check-cfg/allow-macro-cfg.rs
@@ -1,7 +1,7 @@
// This test check that local #[allow(unexpected_cfgs)] works
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[allow(unexpected_cfgs)]
fn foo() {
diff --git a/tests/ui/check-cfg/allow-same-level.rs b/tests/ui/check-cfg/allow-same-level.rs
index 6c869dc42..29491e0b3 100644
--- a/tests/ui/check-cfg/allow-same-level.rs
+++ b/tests/ui/check-cfg/allow-same-level.rs
@@ -1,7 +1,7 @@
// This test check that #[allow(unexpected_cfgs)] doesn't work if put on the same level
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[allow(unexpected_cfgs)]
#[cfg(FALSE)]
diff --git a/tests/ui/check-cfg/allow-same-level.stderr b/tests/ui/check-cfg/allow-same-level.stderr
index 7797de584..b0c459fab 100644
--- a/tests/ui/check-cfg/allow-same-level.stderr
+++ b/tests/ui/check-cfg/allow-same-level.stderr
@@ -1,9 +1,10 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `FALSE`
--> $DIR/allow-same-level.rs:7:7
|
LL | #[cfg(FALSE)]
| ^^^^^
|
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/check-cfg/allow-top-level.rs b/tests/ui/check-cfg/allow-top-level.rs
index d14b0eae5..df06f655d 100644
--- a/tests/ui/check-cfg/allow-top-level.rs
+++ b/tests/ui/check-cfg/allow-top-level.rs
@@ -1,7 +1,7 @@
// This test check that a top-level #![allow(unexpected_cfgs)] works
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#![allow(unexpected_cfgs)]
diff --git a/tests/ui/check-cfg/allow-upper-level.rs b/tests/ui/check-cfg/allow-upper-level.rs
index 04340694d..bd5c97815 100644
--- a/tests/ui/check-cfg/allow-upper-level.rs
+++ b/tests/ui/check-cfg/allow-upper-level.rs
@@ -1,7 +1,7 @@
// This test check that #[allow(unexpected_cfgs)] work if put on an upper level
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[allow(unexpected_cfgs)]
mod aa {
diff --git a/tests/ui/check-cfg/compact-names.rs b/tests/ui/check-cfg/compact-names.rs
index bff807400..4f7168255 100644
--- a/tests/ui/check-cfg/compact-names.rs
+++ b/tests/ui/check-cfg/compact-names.rs
@@ -1,7 +1,7 @@
// This test check that we correctly emit an warning for compact cfg
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#![feature(cfg_target_compact)]
diff --git a/tests/ui/check-cfg/compact-names.stderr b/tests/ui/check-cfg/compact-names.stderr
index f1fc4285a..b0228774b 100644
--- a/tests/ui/check-cfg/compact-names.stderr
+++ b/tests/ui/check-cfg/compact-names.stderr
@@ -1,9 +1,10 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `target_architecture`
--> $DIR/compact-names.rs:11:28
|
LL | #[cfg(target(os = "linux", architecture = "arm"))]
| ^^^^^^^^^^^^^^^^^^^^
|
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/check-cfg/compact-values.rs b/tests/ui/check-cfg/compact-values.rs
index 1f1705784..13c072fe9 100644
--- a/tests/ui/check-cfg/compact-values.rs
+++ b/tests/ui/check-cfg/compact-values.rs
@@ -1,7 +1,7 @@
// This test check that we correctly emit an warning for compact cfg
//
// check-pass
-// compile-flags:--check-cfg=values() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#![feature(cfg_target_compact)]
diff --git a/tests/ui/check-cfg/compact-values.stderr b/tests/ui/check-cfg/compact-values.stderr
index b7269a652..bb2f4915b 100644
--- a/tests/ui/check-cfg/compact-values.stderr
+++ b/tests/ui/check-cfg/compact-values.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `X`
--> $DIR/compact-values.rs:11:28
|
LL | #[cfg(target(os = "linux", arch = "X"))]
diff --git a/tests/ui/check-cfg/concat-values.rs b/tests/ui/check-cfg/concat-values.rs
new file mode 100644
index 000000000..0f9178ce6
--- /dev/null
+++ b/tests/ui/check-cfg/concat-values.rs
@@ -0,0 +1,13 @@
+// check-pass
+// compile-flags: -Z unstable-options
+// compile-flags: --check-cfg=cfg(my_cfg,values("foo")) --check-cfg=cfg(my_cfg,values("bar"))
+
+#[cfg(my_cfg)]
+//~^ WARNING unexpected `cfg` condition value
+fn my_cfg() {}
+
+#[cfg(my_cfg = "unk")]
+//~^ WARNING unexpected `cfg` condition value
+fn my_cfg() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/concat-values.stderr b/tests/ui/check-cfg/concat-values.stderr
new file mode 100644
index 000000000..da2bd7d6a
--- /dev/null
+++ b/tests/ui/check-cfg/concat-values.stderr
@@ -0,0 +1,19 @@
+warning: unexpected `cfg` condition value: (none)
+ --> $DIR/concat-values.rs:5:7
+ |
+LL | #[cfg(my_cfg)]
+ | ^^^^^^
+ |
+ = note: expected values for `my_cfg` are: `bar`, `foo`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `unk`
+ --> $DIR/concat-values.rs:9:7
+ |
+LL | #[cfg(my_cfg = "unk")]
+ | ^^^^^^^^^^^^^^
+ |
+ = note: expected values for `my_cfg` are: `bar`, `foo`
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/diagnotics.rs b/tests/ui/check-cfg/diagnotics.rs
index 49e127d07..45875bddc 100644
--- a/tests/ui/check-cfg/diagnotics.rs
+++ b/tests/ui/check-cfg/diagnotics.rs
@@ -1,5 +1,5 @@
// check-pass
-// compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo") --check-cfg=values(no_values) -Z unstable-options
+// compile-flags: --check-cfg=cfg(feature,values("foo")) --check-cfg=cfg(no_values) -Z unstable-options
#[cfg(featur)]
//~^ WARNING unexpected `cfg` condition name
diff --git a/tests/ui/check-cfg/diagnotics.stderr b/tests/ui/check-cfg/diagnotics.stderr
index 8b9fef09d..31c0db03a 100644
--- a/tests/ui/check-cfg/diagnotics.stderr
+++ b/tests/ui/check-cfg/diagnotics.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `featur`
--> $DIR/diagnotics.rs:4:7
|
LL | #[cfg(featur)]
@@ -7,19 +7,18 @@ LL | #[cfg(featur)]
= help: expected values for `feature` are: `foo`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `featur`
--> $DIR/diagnotics.rs:8:7
|
LL | #[cfg(featur = "foo")]
| ^^^^^^^^^^^^^^
|
- = help: expected values for `feature` are: `foo`
help: there is a config with a similar name and value
|
LL | #[cfg(feature = "foo")]
| ~~~~~~~
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `featur`
--> $DIR/diagnotics.rs:12:7
|
LL | #[cfg(featur = "fo")]
@@ -31,13 +30,13 @@ help: there is a config with a similar name and different values
LL | #[cfg(feature = "foo")]
| ~~~~~~~~~~~~~~~
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `no_value`
--> $DIR/diagnotics.rs:19:7
|
LL | #[cfg(no_value)]
| ^^^^^^^^ help: there is a config with a similar name: `no_values`
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `no_value`
--> $DIR/diagnotics.rs:23:7
|
LL | #[cfg(no_value = "foo")]
@@ -48,7 +47,7 @@ help: there is a config with a similar name and no value
LL | #[cfg(no_values)]
| ~~~~~~~~~
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `bar`
--> $DIR/diagnotics.rs:27:7
|
LL | #[cfg(no_values = "bar")]
diff --git a/tests/ui/check-cfg/empty-names.rs b/tests/ui/check-cfg/empty-names.rs
deleted file mode 100644
index 046ff0364..000000000
--- a/tests/ui/check-cfg/empty-names.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Check warning for unexpected cfg
-//
-// check-pass
-// compile-flags: --check-cfg=names() -Z unstable-options
-
-#[cfg(unknown_key = "value")]
-//~^ WARNING unexpected `cfg` condition name
-pub fn f() {}
-
-fn main() {}
diff --git a/tests/ui/check-cfg/empty-names.stderr b/tests/ui/check-cfg/empty-names.stderr
deleted file mode 100644
index f926d1133..000000000
--- a/tests/ui/check-cfg/empty-names.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-warning: unexpected `cfg` condition name
- --> $DIR/empty-names.rs:6:7
- |
-LL | #[cfg(unknown_key = "value")]
- | ^^^^^^^^^^^^^^^^^^^^^
- |
- = note: `#[warn(unexpected_cfgs)]` on by default
-
-warning: 1 warning emitted
-
diff --git a/tests/ui/check-cfg/empty-values.rs b/tests/ui/check-cfg/empty-values.rs
deleted file mode 100644
index 9bda42e5d..000000000
--- a/tests/ui/check-cfg/empty-values.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Check warning for unexpected cfg value
-//
-// check-pass
-// compile-flags: --check-cfg=values() -Z unstable-options
-
-#[cfg(test = "value")]
-//~^ WARNING unexpected `cfg` condition value
-pub fn f() {}
-
-fn main() {}
diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
new file mode 100644
index 000000000..53ccc0f4d
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
@@ -0,0 +1,25 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names-values.rs:12:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-names-values.rs:16:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: unexpected `empty_cfg` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 3 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr
new file mode 100644
index 000000000..5e8b74054
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr
@@ -0,0 +1,25 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names-values.rs:12:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-names-values.rs:16:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: unexpected `empty_names_values` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 3 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
new file mode 100644
index 000000000..7705a665e
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr
@@ -0,0 +1,33 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names-values.rs:12:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-names-values.rs:16:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: unexpected `cfg` condition value: `unk`
+ --> $DIR/exhaustive-names-values.rs:20:7
+ |
+LL | #[cfg(feature = "unk")]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `std`
+
+warning: unexpected condition value `` for condition name `feature`
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected values
+
+warning: 4 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr
new file mode 100644
index 000000000..f0224a2e3
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr
@@ -0,0 +1,33 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names-values.rs:12:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-names-values.rs:16:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: unexpected `cfg` condition value: `unk`
+ --> $DIR/exhaustive-names-values.rs:20:7
+ |
+LL | #[cfg(feature = "unk")]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `std`
+
+warning: unexpected `full` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 4 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names-values.rs b/tests/ui/check-cfg/exhaustive-names-values.rs
new file mode 100644
index 000000000..f553d93ca
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names-values.rs
@@ -0,0 +1,34 @@
+// Check warning for unexpected cfg in the code and in the CLI
+// arguments (here the revision cfg).
+//
+// check-pass
+// revisions: empty_names_values empty_cfg feature full
+// compile-flags: -Z unstable-options
+// [empty_names_values]compile-flags: --check-cfg=names() --check-cfg=values()
+// [empty_cfg]compile-flags: --check-cfg=cfg()
+// [feature]compile-flags: --check-cfg=cfg(feature,values("std"))
+// [full]compile-flags: --check-cfg=cfg(feature,values("std")) --check-cfg=cfg()
+
+#[cfg(unknown_key = "value")]
+//~^ WARNING unexpected `cfg` condition name
+pub fn f() {}
+
+#[cfg(test = "value")]
+//~^ WARNING unexpected `cfg` condition value
+pub fn f() {}
+
+#[cfg(feature = "unk")]
+//[feature]~^ WARNING unexpected `cfg` condition value
+//[full]~^^ WARNING unexpected `cfg` condition value
+pub fn feat() {}
+
+#[cfg(feature = "std")]
+pub fn feat() {}
+
+#[cfg(windows)]
+pub fn win() {}
+
+#[cfg(unix)]
+pub fn unix() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/exhaustive-names.empty_names.stderr b/tests/ui/check-cfg/exhaustive-names.empty_names.stderr
new file mode 100644
index 000000000..6190ff714
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names.empty_names.stderr
@@ -0,0 +1,15 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names.rs:8:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `empty_names` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr b/tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr
new file mode 100644
index 000000000..f338434cd
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr
@@ -0,0 +1,15 @@
+warning: unexpected `cfg` condition name: `unknown_key`
+ --> $DIR/exhaustive-names.rs:8:7
+ |
+LL | #[cfg(unknown_key = "value")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `exhaustive_names` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/exhaustive-names.rs b/tests/ui/check-cfg/exhaustive-names.rs
new file mode 100644
index 000000000..b86a7f84e
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-names.rs
@@ -0,0 +1,12 @@
+// Check warning for unexpected cfg
+//
+// check-pass
+// revisions: empty_names exhaustive_names
+// [empty_names]compile-flags: --check-cfg=names() -Z unstable-options
+// [exhaustive_names]compile-flags: --check-cfg=cfg() -Z unstable-options
+
+#[cfg(unknown_key = "value")]
+//~^ WARNING unexpected `cfg` condition name
+pub fn f() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr
new file mode 100644
index 000000000..999b27028
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr
@@ -0,0 +1,17 @@
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-values.rs:9:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `empty_cfg` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/empty-values.stderr b/tests/ui/check-cfg/exhaustive-values.empty_values.stderr
index a0168b2ca..77ddc3510 100644
--- a/tests/ui/check-cfg/empty-values.stderr
+++ b/tests/ui/check-cfg/exhaustive-values.empty_values.stderr
@@ -1,5 +1,5 @@
-warning: unexpected `cfg` condition value
- --> $DIR/empty-values.rs:6:7
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-values.rs:9:7
|
LL | #[cfg(test = "value")]
| ^^^^----------
diff --git a/tests/ui/check-cfg/exhaustive-values.rs b/tests/ui/check-cfg/exhaustive-values.rs
new file mode 100644
index 000000000..8a1689ba8
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-values.rs
@@ -0,0 +1,13 @@
+// Check warning for unexpected cfg value
+//
+// check-pass
+// revisions: empty_values empty_cfg without_names
+// [empty_values]compile-flags: --check-cfg=values() -Z unstable-options
+// [empty_cfg]compile-flags: --check-cfg=cfg() -Z unstable-options
+// [without_names]compile-flags: --check-cfg=cfg(any()) -Z unstable-options
+
+#[cfg(test = "value")]
+//~^ WARNING unexpected `cfg` condition value
+pub fn f() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/exhaustive-values.without_names.stderr b/tests/ui/check-cfg/exhaustive-values.without_names.stderr
new file mode 100644
index 000000000..77ddc3510
--- /dev/null
+++ b/tests/ui/check-cfg/exhaustive-values.without_names.stderr
@@ -0,0 +1,13 @@
+warning: unexpected `cfg` condition value: `value`
+ --> $DIR/exhaustive-values.rs:9:7
+ |
+LL | #[cfg(test = "value")]
+ | ^^^^----------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/check-cfg/invalid-arguments.any_values.stderr b/tests/ui/check-cfg/invalid-arguments.any_values.stderr
new file mode 100644
index 000000000..f9a9c4a6e
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.any_values.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(any(),values())` (`values()` cannot be specified before the names)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.anything_else.stderr b/tests/ui/check-cfg/invalid-arguments.anything_else.stderr
index 850924d99..925664bb3 100644
--- a/tests/ui/check-cfg/invalid-arguments.anything_else.stderr
+++ b/tests/ui/check-cfg/invalid-arguments.anything_else.stderr
@@ -1,2 +1,2 @@
-error: invalid `--check-cfg` argument: `anything_else(...)` (expected `names(name1, name2, ... nameN)` or `values(name, "value1", "value2", ... "valueN")`)
+error: invalid `--check-cfg` argument: `anything_else(...)` (expected `cfg(name, values("value1", "value2", ... "valueN"))`)
diff --git a/tests/ui/check-cfg/invalid-arguments.giberich.stderr b/tests/ui/check-cfg/invalid-arguments.giberich.stderr
new file mode 100644
index 000000000..d427033fc
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.giberich.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(...)` (expected `cfg(name, values("value1", "value2", ... "valueN"))`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr b/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr
new file mode 100644
index 000000000..0dc44d9ac
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.ident_in_values_1.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(bar))` (`values()` arguments must be string literals or `any()`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr b/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr
new file mode 100644
index 000000000..d0a1453e3
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.ident_in_values_2.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values("bar",bar,"bar"))` (`values()` arguments must be string literals or `any()`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr b/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr
new file mode 100644
index 000000000..9239f8cce
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.mixed_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(any(),values(any()))` (`values()` cannot be specified before the names)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr b/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr
new file mode 100644
index 000000000..4c406143d
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.mixed_values_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values("bar",any()))` (`values()` arguments cannot specify string literals and `any()` at the same time)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr b/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr
new file mode 100644
index 000000000..6f1db1b13
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.multiple_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(any(),any())` (`any()` cannot be specified multiple times)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr b/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr
new file mode 100644
index 000000000..bce305b09
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.multiple_values.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(),values())` (`values()` cannot be specified multiple times)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr b/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr
new file mode 100644
index 000000000..748ce231a
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(any(),any()))` (`any()` in `values()` cannot be specified multiple times)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr b/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr
new file mode 100644
index 000000000..daf38147f
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.not_empty_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(any(foo))` (`any()` must be empty)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr b/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr
new file mode 100644
index 000000000..79f83e802
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(any(bar)))` (`any()` must be empty)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.rs b/tests/ui/check-cfg/invalid-arguments.rs
index 5090ce3e8..a56f48e0a 100644
--- a/tests/ui/check-cfg/invalid-arguments.rs
+++ b/tests/ui/check-cfg/invalid-arguments.rs
@@ -2,9 +2,35 @@
//
// check-fail
// revisions: anything_else names_simple_ident values_simple_ident values_string_literals
-// [anything_else]compile-flags: -Z unstable-options --check-cfg=anything_else(...)
-// [names_simple_ident]compile-flags: -Z unstable-options --check-cfg=names("NOT_IDENT")
-// [values_simple_ident]compile-flags: -Z unstable-options --check-cfg=values("NOT_IDENT")
-// [values_string_literals]compile-flags: -Z unstable-options --check-cfg=values(test,12)
+// revisions: string_for_name_1 string_for_name_2 multiple_any multiple_values
+// revisions: multiple_values_any not_empty_any not_empty_values_any
+// revisions: values_any_missing_values values_any_before_ident ident_in_values_1
+// revisions: ident_in_values_2 unknown_meta_item_1 unknown_meta_item_2 unknown_meta_item_3
+// revisions: mixed_values_any mixed_any any_values giberich unterminated
+//
+// compile-flags: -Z unstable-options
+// [anything_else]compile-flags: --check-cfg=anything_else(...)
+// [names_simple_ident]compile-flags: --check-cfg=names("NOT_IDENT")
+// [values_simple_ident]compile-flags: --check-cfg=values("NOT_IDENT")
+// [values_string_literals]compile-flags: --check-cfg=values(test,12)
+// [string_for_name_1]compile-flags: --check-cfg=cfg("NOT_IDENT")
+// [string_for_name_2]compile-flags: --check-cfg=cfg(foo,"NOT_IDENT",bar)
+// [multiple_any]compile-flags: --check-cfg=cfg(any(),any())
+// [multiple_values]compile-flags: --check-cfg=cfg(foo,values(),values())
+// [multiple_values_any]compile-flags: --check-cfg=cfg(foo,values(any(),any()))
+// [not_empty_any]compile-flags: --check-cfg=cfg(any(foo))
+// [not_empty_values_any]compile-flags: --check-cfg=cfg(foo,values(any(bar)))
+// [values_any_missing_values]compile-flags: --check-cfg=cfg(foo,any())
+// [values_any_before_ident]compile-flags: --check-cfg=cfg(values(any()),foo)
+// [ident_in_values_1]compile-flags: --check-cfg=cfg(foo,values(bar))
+// [ident_in_values_2]compile-flags: --check-cfg=cfg(foo,values("bar",bar,"bar"))
+// [unknown_meta_item_1]compile-flags: --check-cfg=abc()
+// [unknown_meta_item_2]compile-flags: --check-cfg=cfg(foo,test())
+// [unknown_meta_item_3]compile-flags: --check-cfg=cfg(foo,values(test()))
+// [mixed_values_any]compile-flags: --check-cfg=cfg(foo,values("bar",any()))
+// [mixed_any]compile-flags: --check-cfg=cfg(any(),values(any()))
+// [any_values]compile-flags: --check-cfg=cfg(any(),values())
+// [giberich]compile-flags: --check-cfg=cfg(...)
+// [unterminated]compile-flags: --check-cfg=cfg(
fn main() {}
diff --git a/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr b/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr
new file mode 100644
index 000000000..c6f6834ff
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.string_for_name_1.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg("NOT_IDENT")` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr b/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr
new file mode 100644
index 000000000..ab3dc86cd
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.string_for_name_2.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,"NOT_IDENT",bar)` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr
new file mode 100644
index 000000000..c04b15ec2
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `abc()` (expected `cfg(name, values("value1", "value2", ... "valueN"))`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr
new file mode 100644
index 000000000..cee65f988
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,test())` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr
new file mode 100644
index 000000000..2441e2537
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,values(test()))` (`values()` arguments must be string literals or `any()`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.unterminated.stderr b/tests/ui/check-cfg/invalid-arguments.unterminated.stderr
new file mode 100644
index 000000000..80161a6aa
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.unterminated.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(` (expected `cfg(name, values("value1", "value2", ... "valueN"))`)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr b/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr
new file mode 100644
index 000000000..fc93ec8fb
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(values(any()),foo)` (`values()` cannot be specified before the names)
+
diff --git a/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr b/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr
new file mode 100644
index 000000000..f41672fcb
--- /dev/null
+++ b/tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr
@@ -0,0 +1,2 @@
+error: invalid `--check-cfg` argument: `cfg(foo,any())` (`cfg(any())` can only be provided in isolation)
+
diff --git a/tests/ui/check-cfg/invalid-cfg-name.rs b/tests/ui/check-cfg/invalid-cfg-name.rs
deleted file mode 100644
index 8499d3d44..000000000
--- a/tests/ui/check-cfg/invalid-cfg-name.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Check warning for invalid configuration name
-//
-// edition:2018
-// check-pass
-// compile-flags: --check-cfg=names() -Z unstable-options
-
-#[cfg(widnows)]
-//~^ WARNING unexpected `cfg` condition name
-pub fn f() {}
-
-#[cfg(windows)]
-pub fn g() {}
-
-pub fn main() {}
diff --git a/tests/ui/check-cfg/invalid-cfg-value.rs b/tests/ui/check-cfg/invalid-cfg-value.rs
deleted file mode 100644
index 9e428d367..000000000
--- a/tests/ui/check-cfg/invalid-cfg-value.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Check warning for invalid configuration value
-//
-// edition:2018
-// check-pass
-// compile-flags: --check-cfg=values(feature,"serde","full") --cfg=feature="rand" -Z unstable-options
-
-#[cfg(feature = "sedre")]
-//~^ WARNING unexpected `cfg` condition value
-pub fn f() {}
-
-#[cfg(feature = "serde")]
-pub fn g() {}
-
-#[cfg(feature = "rand")]
-//~^ WARNING unexpected `cfg` condition value
-pub fn h() {}
-
-pub fn main() {}
diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.cfg.stderr
index 07c514aed..daa200440 100644
--- a/tests/ui/check-cfg/mix.stderr
+++ b/tests/ui/check-cfg/mix.cfg.stderr
@@ -1,40 +1,42 @@
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:11:7
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/mix.rs:15:7
|
LL | #[cfg(widnows)]
| ^^^^^^^ help: there is a config with a similar name: `windows`
|
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:15:7
+warning: unexpected `cfg` condition value: (none)
+ --> $DIR/mix.rs:19:7
|
LL | #[cfg(feature)]
| ^^^^^^^- help: specify a config value: `= "foo"`
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:22:7
+warning: unexpected `cfg` condition value: `bar`
+ --> $DIR/mix.rs:26:7
|
LL | #[cfg(feature = "bar")]
| ^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:26:7
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:30:7
|
LL | #[cfg(feature = "zebra")]
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:30:12
+warning: unexpected `cfg` condition name: `uu`
+ --> $DIR/mix.rs:34:12
|
LL | #[cfg_attr(uu, test)]
| ^^
+ |
+ = help: expected names are: `cfg`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `names_values`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
warning: unexpected condition value `bar` for condition name `feature`
|
@@ -44,142 +46,142 @@ warning: unexpected `unknown_name` as condition name
|
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:39:10
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/mix.rs:43:10
|
LL | cfg!(widnows);
| ^^^^^^^ help: there is a config with a similar name: `windows`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:42:10
+warning: unexpected `cfg` condition value: `bar`
+ --> $DIR/mix.rs:46:10
|
LL | cfg!(feature = "bar");
| ^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:44:10
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:48:10
|
LL | cfg!(feature = "zebra");
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:46:10
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:50:10
|
LL | cfg!(xxx = "foo");
| ^^^^^^^^^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:48:10
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:52:10
|
LL | cfg!(xxx);
| ^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:50:14
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:54:14
|
LL | cfg!(any(xxx, windows));
| ^^^
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:52:14
+warning: unexpected `cfg` condition value: `bad`
+ --> $DIR/mix.rs:56:14
|
LL | cfg!(any(feature = "bad", windows));
| ^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:54:23
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:58:23
|
LL | cfg!(any(windows, xxx));
| ^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:56:20
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:60:20
|
LL | cfg!(all(unix, xxx));
| ^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:58:14
+warning: unexpected `cfg` condition name: `aa`
+ --> $DIR/mix.rs:62:14
|
LL | cfg!(all(aa, bb));
| ^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:58:18
+warning: unexpected `cfg` condition name: `bb`
+ --> $DIR/mix.rs:62:18
|
LL | cfg!(all(aa, bb));
| ^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:61:14
+warning: unexpected `cfg` condition name: `aa`
+ --> $DIR/mix.rs:65:14
|
LL | cfg!(any(aa, bb));
| ^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:61:18
+warning: unexpected `cfg` condition name: `bb`
+ --> $DIR/mix.rs:65:18
|
LL | cfg!(any(aa, bb));
| ^^
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:64:20
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:68:20
|
LL | cfg!(any(unix, feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:66:14
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:70:14
|
LL | cfg!(any(xxx, feature = "zebra"));
| ^^^
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:66:19
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:70:19
|
LL | cfg!(any(xxx, feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:69:14
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:73:14
|
LL | cfg!(any(xxx, unix, xxx));
| ^^^
-warning: unexpected `cfg` condition name
- --> $DIR/mix.rs:69:25
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:73:25
|
LL | cfg!(any(xxx, unix, xxx));
| ^^^
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:72:14
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:14
|
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:72:33
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:33
|
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `foo`
-warning: unexpected `cfg` condition value
- --> $DIR/mix.rs:72:52
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:52
|
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/check-cfg/mix.names_values.stderr b/tests/ui/check-cfg/mix.names_values.stderr
new file mode 100644
index 000000000..daa200440
--- /dev/null
+++ b/tests/ui/check-cfg/mix.names_values.stderr
@@ -0,0 +1,192 @@
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/mix.rs:15:7
+ |
+LL | #[cfg(widnows)]
+ | ^^^^^^^ help: there is a config with a similar name: `windows`
+ |
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: (none)
+ --> $DIR/mix.rs:19:7
+ |
+LL | #[cfg(feature)]
+ | ^^^^^^^- help: specify a config value: `= "foo"`
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `bar`
+ --> $DIR/mix.rs:26:7
+ |
+LL | #[cfg(feature = "bar")]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:30:7
+ |
+LL | #[cfg(feature = "zebra")]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `uu`
+ --> $DIR/mix.rs:34:12
+ |
+LL | #[cfg_attr(uu, test)]
+ | ^^
+ |
+ = help: expected names are: `cfg`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `names_values`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
+
+warning: unexpected condition value `bar` for condition name `feature`
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected values
+
+warning: unexpected `unknown_name` as condition name
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
+
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/mix.rs:43:10
+ |
+LL | cfg!(widnows);
+ | ^^^^^^^ help: there is a config with a similar name: `windows`
+
+warning: unexpected `cfg` condition value: `bar`
+ --> $DIR/mix.rs:46:10
+ |
+LL | cfg!(feature = "bar");
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:48:10
+ |
+LL | cfg!(feature = "zebra");
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:50:10
+ |
+LL | cfg!(xxx = "foo");
+ | ^^^^^^^^^^^
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:52:10
+ |
+LL | cfg!(xxx);
+ | ^^^
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:54:14
+ |
+LL | cfg!(any(xxx, windows));
+ | ^^^
+
+warning: unexpected `cfg` condition value: `bad`
+ --> $DIR/mix.rs:56:14
+ |
+LL | cfg!(any(feature = "bad", windows));
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:58:23
+ |
+LL | cfg!(any(windows, xxx));
+ | ^^^
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:60:20
+ |
+LL | cfg!(all(unix, xxx));
+ | ^^^
+
+warning: unexpected `cfg` condition name: `aa`
+ --> $DIR/mix.rs:62:14
+ |
+LL | cfg!(all(aa, bb));
+ | ^^
+
+warning: unexpected `cfg` condition name: `bb`
+ --> $DIR/mix.rs:62:18
+ |
+LL | cfg!(all(aa, bb));
+ | ^^
+
+warning: unexpected `cfg` condition name: `aa`
+ --> $DIR/mix.rs:65:14
+ |
+LL | cfg!(any(aa, bb));
+ | ^^
+
+warning: unexpected `cfg` condition name: `bb`
+ --> $DIR/mix.rs:65:18
+ |
+LL | cfg!(any(aa, bb));
+ | ^^
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:68:20
+ |
+LL | cfg!(any(unix, feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:70:14
+ |
+LL | cfg!(any(xxx, feature = "zebra"));
+ | ^^^
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:70:19
+ |
+LL | cfg!(any(xxx, feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:73:14
+ |
+LL | cfg!(any(xxx, unix, xxx));
+ | ^^^
+
+warning: unexpected `cfg` condition name: `xxx`
+ --> $DIR/mix.rs:73:25
+ |
+LL | cfg!(any(xxx, unix, xxx));
+ | ^^^
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:14
+ |
+LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:33
+ |
+LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: unexpected `cfg` condition value: `zebra`
+ --> $DIR/mix.rs:76:52
+ |
+LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `foo`
+
+warning: 28 warnings emitted
+
diff --git a/tests/ui/check-cfg/mix.rs b/tests/ui/check-cfg/mix.rs
index 9adf5c46e..d7b3b4953 100644
--- a/tests/ui/check-cfg/mix.rs
+++ b/tests/ui/check-cfg/mix.rs
@@ -3,7 +3,11 @@
// we correctly lint on the `cfg!` macro and `cfg_attr` attribute.
//
// check-pass
-// compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo") --cfg feature="bar" --cfg unknown_name -Z unstable-options
+// revisions: names_values cfg
+// compile-flags: --cfg feature="bar" --cfg unknown_name -Z unstable-options
+// compile-flags: --check-cfg=cfg(names_values,cfg)
+// [names_values]compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo")
+// [cfg]compile-flags: --check-cfg=cfg(feature,values("foo"))
#[cfg(windows)]
fn do_windows_stuff() {}
diff --git a/tests/ui/check-cfg/no-values.stderr b/tests/ui/check-cfg/no-expected-values.empty.stderr
index ffa87dc58..5d261b2a5 100644
--- a/tests/ui/check-cfg/no-values.stderr
+++ b/tests/ui/check-cfg/no-expected-values.empty.stderr
@@ -1,5 +1,5 @@
-warning: unexpected `cfg` condition value
- --> $DIR/no-values.rs:6:7
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:12:7
|
LL | #[cfg(feature = "foo")]
| ^^^^^^^--------
@@ -9,8 +9,8 @@ LL | #[cfg(feature = "foo")]
= note: no expected value for `feature`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
- --> $DIR/no-values.rs:10:7
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:16:7
|
LL | #[cfg(test = "foo")]
| ^^^^--------
diff --git a/tests/ui/check-cfg/no-expected-values.mixed.stderr b/tests/ui/check-cfg/no-expected-values.mixed.stderr
new file mode 100644
index 000000000..5d261b2a5
--- /dev/null
+++ b/tests/ui/check-cfg/no-expected-values.mixed.stderr
@@ -0,0 +1,23 @@
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:12:7
+ |
+LL | #[cfg(feature = "foo")]
+ | ^^^^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `feature`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:16:7
+ |
+LL | #[cfg(test = "foo")]
+ | ^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/no-expected-values.rs b/tests/ui/check-cfg/no-expected-values.rs
new file mode 100644
index 000000000..9e2a9f09a
--- /dev/null
+++ b/tests/ui/check-cfg/no-expected-values.rs
@@ -0,0 +1,20 @@
+// Check that we detect unexpected value when none are allowed
+//
+// check-pass
+// revisions: values simple mixed empty
+// compile-flags: -Z unstable-options
+// compile-flags: --check-cfg=cfg(values,simple,mixed,empty)
+// [values]compile-flags: --check-cfg=values(test) --check-cfg=values(feature)
+// [simple]compile-flags: --check-cfg=cfg(test) --check-cfg=cfg(feature)
+// [mixed]compile-flags: --check-cfg=cfg(test,feature)
+// [empty]compile-flags: --check-cfg=cfg(test,feature,values())
+
+#[cfg(feature = "foo")]
+//~^ WARNING unexpected `cfg` condition value
+fn do_foo() {}
+
+#[cfg(test = "foo")]
+//~^ WARNING unexpected `cfg` condition value
+fn do_foo() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/no-expected-values.simple.stderr b/tests/ui/check-cfg/no-expected-values.simple.stderr
new file mode 100644
index 000000000..5d261b2a5
--- /dev/null
+++ b/tests/ui/check-cfg/no-expected-values.simple.stderr
@@ -0,0 +1,23 @@
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:12:7
+ |
+LL | #[cfg(feature = "foo")]
+ | ^^^^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `feature`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:16:7
+ |
+LL | #[cfg(test = "foo")]
+ | ^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/no-expected-values.values.stderr b/tests/ui/check-cfg/no-expected-values.values.stderr
new file mode 100644
index 000000000..5d261b2a5
--- /dev/null
+++ b/tests/ui/check-cfg/no-expected-values.values.stderr
@@ -0,0 +1,23 @@
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:12:7
+ |
+LL | #[cfg(feature = "foo")]
+ | ^^^^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `feature`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `foo`
+ --> $DIR/no-expected-values.rs:16:7
+ |
+LL | #[cfg(test = "foo")]
+ | ^^^^--------
+ | |
+ | help: remove the value
+ |
+ = note: no expected value for `test`
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/check-cfg/no-values.rs b/tests/ui/check-cfg/no-values.rs
deleted file mode 100644
index 8c80f56cb..000000000
--- a/tests/ui/check-cfg/no-values.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Check that we detect unexpected value when none are allowed
-//
-// check-pass
-// compile-flags: --check-cfg=values(test) --check-cfg=values(feature) -Z unstable-options
-
-#[cfg(feature = "foo")]
-//~^ WARNING unexpected `cfg` condition value
-fn do_foo() {}
-
-#[cfg(test = "foo")]
-//~^ WARNING unexpected `cfg` condition value
-fn do_foo() {}
-
-fn main() {}
diff --git a/tests/ui/check-cfg/order-independant.names_after.stderr b/tests/ui/check-cfg/order-independant.names_after.stderr
index 91b81428b..a308358e4 100644
--- a/tests/ui/check-cfg/order-independant.names_after.stderr
+++ b/tests/ui/check-cfg/order-independant.names_after.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: (none)
--> $DIR/order-independant.rs:8:7
|
LL | #[cfg(a)]
@@ -7,7 +7,7 @@ LL | #[cfg(a)]
= note: expected values for `a` are: `b`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `unk`
--> $DIR/order-independant.rs:12:7
|
LL | #[cfg(a = "unk")]
diff --git a/tests/ui/check-cfg/order-independant.names_before.stderr b/tests/ui/check-cfg/order-independant.names_before.stderr
index 91b81428b..a308358e4 100644
--- a/tests/ui/check-cfg/order-independant.names_before.stderr
+++ b/tests/ui/check-cfg/order-independant.names_before.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: (none)
--> $DIR/order-independant.rs:8:7
|
LL | #[cfg(a)]
@@ -7,7 +7,7 @@ LL | #[cfg(a)]
= note: expected values for `a` are: `b`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `unk`
--> $DIR/order-independant.rs:12:7
|
LL | #[cfg(a = "unk")]
diff --git a/tests/ui/check-cfg/stmt-no-ice.rs b/tests/ui/check-cfg/stmt-no-ice.rs
index cf76487ed..383e830a1 100644
--- a/tests/ui/check-cfg/stmt-no-ice.rs
+++ b/tests/ui/check-cfg/stmt-no-ice.rs
@@ -1,7 +1,7 @@
// This test checks that there is no ICE with this code
//
// check-pass
-// compile-flags:--check-cfg=names() -Z unstable-options
+// compile-flags:--check-cfg=cfg() -Z unstable-options
fn main() {
#[cfg(crossbeam_loom)]
diff --git a/tests/ui/check-cfg/stmt-no-ice.stderr b/tests/ui/check-cfg/stmt-no-ice.stderr
index da65b5969..900ea4e4d 100644
--- a/tests/ui/check-cfg/stmt-no-ice.stderr
+++ b/tests/ui/check-cfg/stmt-no-ice.stderr
@@ -1,9 +1,10 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `crossbeam_loom`
--> $DIR/stmt-no-ice.rs:7:11
|
LL | #[cfg(crossbeam_loom)]
| ^^^^^^^^^^^^^^
|
+ = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/check-cfg/invalid-cfg-name.stderr b/tests/ui/check-cfg/unexpected-cfg-name.exhaustive.stderr
index ed09f8cb6..513f7ac7f 100644
--- a/tests/ui/check-cfg/invalid-cfg-name.stderr
+++ b/tests/ui/check-cfg/unexpected-cfg-name.exhaustive.stderr
@@ -1,5 +1,5 @@
-warning: unexpected `cfg` condition name
- --> $DIR/invalid-cfg-name.rs:7:7
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/unexpected-cfg-name.rs:9:7
|
LL | #[cfg(widnows)]
| ^^^^^^^ help: there is a config with a similar name: `windows`
diff --git a/tests/ui/check-cfg/unexpected-cfg-name.names.stderr b/tests/ui/check-cfg/unexpected-cfg-name.names.stderr
new file mode 100644
index 000000000..513f7ac7f
--- /dev/null
+++ b/tests/ui/check-cfg/unexpected-cfg-name.names.stderr
@@ -0,0 +1,10 @@
+warning: unexpected `cfg` condition name: `widnows`
+ --> $DIR/unexpected-cfg-name.rs:9:7
+ |
+LL | #[cfg(widnows)]
+ | ^^^^^^^ help: there is a config with a similar name: `windows`
+ |
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/check-cfg/unexpected-cfg-name.rs b/tests/ui/check-cfg/unexpected-cfg-name.rs
new file mode 100644
index 000000000..15c3aa6e0
--- /dev/null
+++ b/tests/ui/check-cfg/unexpected-cfg-name.rs
@@ -0,0 +1,16 @@
+// Check warning for unexpected configuration name
+//
+// check-pass
+// revisions: names exhaustive
+// compile-flags: --check-cfg=cfg(names,exhaustive)
+// [names]compile-flags: --check-cfg=names() -Z unstable-options
+// [exhaustive]compile-flags: --check-cfg=cfg() -Z unstable-options
+
+#[cfg(widnows)]
+//~^ WARNING unexpected `cfg` condition name
+pub fn f() {}
+
+#[cfg(windows)]
+pub fn g() {}
+
+pub fn main() {}
diff --git a/tests/ui/check-cfg/invalid-cfg-value.stderr b/tests/ui/check-cfg/unexpected-cfg-value.cfg.stderr
index 776d264a7..2ed7f9005 100644
--- a/tests/ui/check-cfg/invalid-cfg-value.stderr
+++ b/tests/ui/check-cfg/unexpected-cfg-value.cfg.stderr
@@ -1,5 +1,5 @@
-warning: unexpected `cfg` condition value
- --> $DIR/invalid-cfg-value.rs:7:7
+warning: unexpected `cfg` condition value: `sedre`
+ --> $DIR/unexpected-cfg-value.rs:11:7
|
LL | #[cfg(feature = "sedre")]
| ^^^^^^^^^^-------
@@ -9,8 +9,8 @@ LL | #[cfg(feature = "sedre")]
= note: expected values for `feature` are: `full`, `serde`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
- --> $DIR/invalid-cfg-value.rs:14:7
+warning: unexpected `cfg` condition value: `rand`
+ --> $DIR/unexpected-cfg-value.rs:18:7
|
LL | #[cfg(feature = "rand")]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/check-cfg/unexpected-cfg-value.rs b/tests/ui/check-cfg/unexpected-cfg-value.rs
new file mode 100644
index 000000000..a84458071
--- /dev/null
+++ b/tests/ui/check-cfg/unexpected-cfg-value.rs
@@ -0,0 +1,22 @@
+// Check warning for invalid configuration value in the code and
+// in the cli
+//
+// check-pass
+// revisions: values cfg
+// compile-flags: --cfg=feature="rand" -Z unstable-options
+// compile-flags: --check-cfg=cfg(values,cfg)
+// [values]compile-flags: --check-cfg=values(feature,"serde","full")
+// [cfg]compile-flags: --check-cfg=cfg(feature,values("serde","full"))
+
+#[cfg(feature = "sedre")]
+//~^ WARNING unexpected `cfg` condition value
+pub fn f() {}
+
+#[cfg(feature = "serde")]
+pub fn g() {}
+
+#[cfg(feature = "rand")]
+//~^ WARNING unexpected `cfg` condition value
+pub fn h() {}
+
+pub fn main() {}
diff --git a/tests/ui/check-cfg/unexpected-cfg-value.values.stderr b/tests/ui/check-cfg/unexpected-cfg-value.values.stderr
new file mode 100644
index 000000000..2ed7f9005
--- /dev/null
+++ b/tests/ui/check-cfg/unexpected-cfg-value.values.stderr
@@ -0,0 +1,25 @@
+warning: unexpected `cfg` condition value: `sedre`
+ --> $DIR/unexpected-cfg-value.rs:11:7
+ |
+LL | #[cfg(feature = "sedre")]
+ | ^^^^^^^^^^-------
+ | |
+ | help: there is a expected value with a similar name: `"serde"`
+ |
+ = note: expected values for `feature` are: `full`, `serde`
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: unexpected `cfg` condition value: `rand`
+ --> $DIR/unexpected-cfg-value.rs:18:7
+ |
+LL | #[cfg(feature = "rand")]
+ | ^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: `full`, `serde`
+
+warning: unexpected condition value `rand` for condition name `feature`
+ |
+ = help: was set with `--cfg` but isn't in the `--check-cfg` expected values
+
+warning: 3 warnings emitted
+
diff --git a/tests/ui/check-cfg/unknown-values.rs b/tests/ui/check-cfg/unknown-values.rs
new file mode 100644
index 000000000..c082a2f25
--- /dev/null
+++ b/tests/ui/check-cfg/unknown-values.rs
@@ -0,0 +1,17 @@
+// Check that no warning is emitted for unknown cfg value
+//
+// check-pass
+// revisions: simple mixed with_values
+// compile-flags: -Z unstable-options
+// compile-flags: --check-cfg=cfg(simple,mixed,with_values)
+// [simple]compile-flags: --check-cfg=cfg(foo,values(any()))
+// [mixed]compile-flags: --check-cfg=cfg(foo) --check-cfg=cfg(foo,values(any()))
+// [with_values]compile-flags:--check-cfg=cfg(foo,values(any())) --check-cfg=cfg(foo,values("aa"))
+
+#[cfg(foo = "value")]
+pub fn f() {}
+
+#[cfg(foo)]
+pub fn f() {}
+
+fn main() {}
diff --git a/tests/ui/check-cfg/values-target-json.stderr b/tests/ui/check-cfg/values-target-json.stderr
index c705152d9..e71149f33 100644
--- a/tests/ui/check-cfg/values-target-json.stderr
+++ b/tests/ui/check-cfg/values-target-json.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `linuz`
--> $DIR/values-target-json.rs:13:7
|
LL | #[cfg(target_os = "linuz")]
diff --git a/tests/ui/check-cfg/well-known-names.rs b/tests/ui/check-cfg/well-known-names.rs
index e57fb69a1..1dcb419b4 100644
--- a/tests/ui/check-cfg/well-known-names.rs
+++ b/tests/ui/check-cfg/well-known-names.rs
@@ -1,7 +1,7 @@
// This test checks that we lint on non well known names and that we don't lint on well known names
//
// check-pass
-// compile-flags: --check-cfg=names() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[cfg(target_oz = "linux")]
//~^ WARNING unexpected `cfg` condition name
diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr
index 34c5d6172..3001289b7 100644
--- a/tests/ui/check-cfg/well-known-names.stderr
+++ b/tests/ui/check-cfg/well-known-names.stderr
@@ -1,14 +1,16 @@
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `target_oz`
--> $DIR/well-known-names.rs:6:7
|
LL | #[cfg(target_oz = "linux")]
- | ---------^^^^^^^^^^
- | |
- | help: there is a config with a similar name: `target_os`
+ | ^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unexpected_cfgs)]` on by default
+help: there is a config with a similar name and value
+ |
+LL | #[cfg(target_os = "linux")]
+ | ~~~~~~~~~
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `features`
--> $DIR/well-known-names.rs:13:7
|
LL | #[cfg(features = "foo")]
@@ -16,7 +18,7 @@ LL | #[cfg(features = "foo")]
| |
| help: there is a config with a similar name: `feature`
-warning: unexpected `cfg` condition name
+warning: unexpected `cfg` condition name: `uniw`
--> $DIR/well-known-names.rs:20:7
|
LL | #[cfg(uniw)]
diff --git a/tests/ui/check-cfg/well-known-values.rs b/tests/ui/check-cfg/well-known-values.rs
index 96375dc8d..8b56c8729 100644
--- a/tests/ui/check-cfg/well-known-values.rs
+++ b/tests/ui/check-cfg/well-known-values.rs
@@ -2,7 +2,7 @@
// values
//
// check-pass
-// compile-flags: --check-cfg=values() -Z unstable-options
+// compile-flags: --check-cfg=cfg() -Z unstable-options
#[cfg(target_os = "linuz")]
//~^ WARNING unexpected `cfg` condition value
diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr
index b381f5a4a..6877d8f5b 100644
--- a/tests/ui/check-cfg/well-known-values.stderr
+++ b/tests/ui/check-cfg/well-known-values.stderr
@@ -1,4 +1,4 @@
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `linuz`
--> $DIR/well-known-values.rs:7:7
|
LL | #[cfg(target_os = "linuz")]
@@ -9,7 +9,7 @@ LL | #[cfg(target_os = "linuz")]
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
= note: `#[warn(unexpected_cfgs)]` on by default
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `0`
--> $DIR/well-known-values.rs:14:7
|
LL | #[cfg(target_has_atomic = "0")]
@@ -19,7 +19,7 @@ LL | #[cfg(target_has_atomic = "0")]
|
= note: expected values for `target_has_atomic` are: (none), `128`, `16`, `32`, `64`, `8`, `ptr`
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `aa`
--> $DIR/well-known-values.rs:21:7
|
LL | #[cfg(unix = "aa")]
@@ -29,7 +29,7 @@ LL | #[cfg(unix = "aa")]
|
= note: no expected value for `unix`
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `miri`
--> $DIR/well-known-values.rs:28:7
|
LL | #[cfg(miri = "miri")]
@@ -39,7 +39,7 @@ LL | #[cfg(miri = "miri")]
|
= note: no expected value for `miri`
-warning: unexpected `cfg` condition value
+warning: unexpected `cfg` condition value: `linux`
--> $DIR/well-known-values.rs:35:7
|
LL | #[cfg(doc = "linux")]
diff --git a/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs b/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs
index 914ebbe26..106485e04 100644
--- a/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs
+++ b/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.rs
@@ -26,7 +26,8 @@ pub fn edge_case_str(event: String) {
pub fn edge_case_raw_ptr(event: *const i32) {
let _ = || {
match event {
- NUMBER_POINTER => (),
+ NUMBER_POINTER => (), //~WARN behave unpredictably
+ //~| previously accepted
_ => (),
};
};
diff --git a/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.stderr b/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.stderr
new file mode 100644
index 000000000..c83ba4197
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/match/match-edge-cases_1.stderr
@@ -0,0 +1,12 @@
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/match-edge-cases_1.rs:29:13
+ |
+LL | NUMBER_POINTER => (),
+ | ^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+ = note: `#[warn(pointer_structural_match)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
index 0807f4590..85426dd9a 100644
--- a/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
+++ b/tests/ui/closures/2229_closure_analysis/match/non-exhaustive-match.stderr
@@ -5,10 +5,10 @@ LL | let _b = || { match l1 { L1::A => () } };
| ^^ pattern `L1::B` not covered
|
note: `L1` defined here
- --> $DIR/non-exhaustive-match.rs:12:14
+ --> $DIR/non-exhaustive-match.rs:12:6
|
LL | enum L1 { A, B }
- | -- ^ not covered
+ | ^^ - not covered
= note: the matched value is of type `L1`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/closures/add_semicolon_non_block_closure.stderr b/tests/ui/closures/add_semicolon_non_block_closure.stderr
index ed829fc98..6f9c309ed 100644
--- a/tests/ui/closures/add_semicolon_non_block_closure.stderr
+++ b/tests/ui/closures/add_semicolon_non_block_closure.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/add_semicolon_non_block_closure.rs:8:12
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | foo(|| bar())
| ^^^^^ expected `()`, found `i32`
|
diff --git a/tests/ui/closures/binder/implicit-return.stderr b/tests/ui/closures/binder/implicit-return.stderr
index 5bfb97113..35db34ce2 100644
--- a/tests/ui/closures/binder/implicit-return.stderr
+++ b/tests/ui/closures/binder/implicit-return.stderr
@@ -1,8 +1,8 @@
error: implicit types in closure signatures are forbidden when `for<...>` is present
- --> $DIR/implicit-return.rs:4:34
+ --> $DIR/implicit-return.rs:4:33
|
LL | let _f = for<'a> |_: &'a ()| {};
- | ------- ^
+ | ------- ^
| |
| `for<...>` is here
diff --git a/tests/ui/closures/binder/implicit-stuff.stderr b/tests/ui/closures/binder/implicit-stuff.stderr
index 779a08a44..cec2a60ba 100644
--- a/tests/ui/closures/binder/implicit-stuff.stderr
+++ b/tests/ui/closures/binder/implicit-stuff.stderr
@@ -41,10 +41,10 @@ LL | let _ = for<'a> |x: &'a ()| -> &() { x };
| ^ explicit lifetime name needed here
error: implicit types in closure signatures are forbidden when `for<...>` is present
- --> $DIR/implicit-stuff.rs:5:22
+ --> $DIR/implicit-stuff.rs:5:21
|
LL | let _ = for<> || {};
- | ----- ^
+ | ----- ^
| |
| `for<...>` is here
diff --git a/tests/ui/closures/closure-expected.rs b/tests/ui/closures/closure-expected.rs
index 68cac3dd8..d730bcd1f 100644
--- a/tests/ui/closures/closure-expected.rs
+++ b/tests/ui/closures/closure-expected.rs
@@ -1,5 +1,5 @@
fn main() {
let x = Some(1);
let y = x.or_else(4);
- //~^ ERROR expected a `FnOnce<()>` closure, found `{integer}`
+ //~^ ERROR expected a `FnOnce()` closure, found `{integer}`
}
diff --git a/tests/ui/closures/closure-expected.stderr b/tests/ui/closures/closure-expected.stderr
index 87a5d67a4..565038f51 100644
--- a/tests/ui/closures/closure-expected.stderr
+++ b/tests/ui/closures/closure-expected.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
+error[E0277]: expected a `FnOnce()` closure, found `{integer}`
--> $DIR/closure-expected.rs:3:23
|
LL | let y = x.or_else(4);
- | ------- ^ expected an `FnOnce<()>` closure, found `{integer}`
+ | ------- ^ expected an `FnOnce()` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/closures/coerce-unsafe-to-closure.stderr b/tests/ui/closures/coerce-unsafe-to-closure.stderr
index 449cd0b31..bd4ab13a2 100644
--- a/tests/ui/closures/coerce-unsafe-to-closure.stderr
+++ b/tests/ui/closures/coerce-unsafe-to-closure.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
+error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
--> $DIR/coerce-unsafe-to-closure.rs:2:44
|
LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
diff --git a/tests/ui/closures/infer-signature-from-impl.next.stderr b/tests/ui/closures/infer-signature-from-impl.next.stderr
new file mode 100644
index 000000000..973517066
--- /dev/null
+++ b/tests/ui/closures/infer-signature-from-impl.next.stderr
@@ -0,0 +1,16 @@
+error[E0282]: type annotations needed
+ --> $DIR/infer-signature-from-impl.rs:17:16
+ |
+LL | needs_foo(|x| {
+ | ^
+LL | x.to_string();
+ | - type must be known at this point
+ |
+help: consider giving this closure parameter an explicit type
+ |
+LL | needs_foo(|x: /* Type */| {
+ | ++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/closures/infer-signature-from-impl.rs b/tests/ui/closures/infer-signature-from-impl.rs
new file mode 100644
index 000000000..6e8c94177
--- /dev/null
+++ b/tests/ui/closures/infer-signature-from-impl.rs
@@ -0,0 +1,20 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+//[next] known-bug: trait-system-refactor-initiative#71
+//[current] check-pass
+
+trait Foo {}
+fn needs_foo<T>(_: T)
+where
+ Wrap<T>: Foo,
+{
+}
+
+struct Wrap<T>(T);
+impl<T> Foo for Wrap<T> where T: Fn(i32) {}
+
+fn main() {
+ needs_foo(|x| {
+ x.to_string();
+ });
+}
diff --git a/tests/ui/closures/issue-25439.rs b/tests/ui/closures/issue-25439.rs
index 4f73ff3e3..0269270b1 100644
--- a/tests/ui/closures/issue-25439.rs
+++ b/tests/ui/closures/issue-25439.rs
@@ -5,5 +5,5 @@ fn fix<F>(f: F) -> i32 where F: Fn(Helper<F>, i32) -> i32 {
}
fn main() {
- fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644]
+ fix(|_, x| x); //~ ERROR closure/coroutine type that references itself [E0644]
}
diff --git a/tests/ui/closures/issue-25439.stderr b/tests/ui/closures/issue-25439.stderr
index dadae23fd..5e889e6c1 100644
--- a/tests/ui/closures/issue-25439.stderr
+++ b/tests/ui/closures/issue-25439.stderr
@@ -1,4 +1,4 @@
-error[E0644]: closure/generator type that references itself
+error[E0644]: closure/coroutine type that references itself
--> $DIR/issue-25439.rs:8:9
|
LL | fix(|_, x| x);
diff --git a/tests/ui/codegen/issue-79865-llvm-miscompile.rs b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
index b77f09f8e..6f994a5cb 100644
--- a/tests/ui/codegen/issue-79865-llvm-miscompile.rs
+++ b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
@@ -4,7 +4,7 @@
// Regression test for issue #79865.
// The assertion will fail when compiled with Rust 1.56..=1.59
-// due to a LLVM miscompilation.
+// due to an LLVM miscompilation.
use std::arch::x86_64::*;
diff --git a/tests/ui/codemap_tests/tab.stderr b/tests/ui/codemap_tests/tab.stderr
index c3f19d20d..d2de74865 100644
--- a/tests/ui/codemap_tests/tab.stderr
+++ b/tests/ui/codemap_tests/tab.stderr
@@ -8,7 +8,7 @@ error[E0308]: mismatched types
--> $DIR/tab.rs:8:2
|
LL | fn foo() {
- | - help: try adding a return type: `-> &'static str`
+ | - help: try adding a return type: `-> &'static str`
LL | "bar boo"
| ^^^^^^^^^^^^^^^^^^^^ expected `()`, found `&str`
diff --git a/tests/ui/coercion/issue-53475.stderr b/tests/ui/coercion/issue-53475.stderr
index 522c50dca..4778611bf 100644
--- a/tests/ui/coercion/issue-53475.stderr
+++ b/tests/ui/coercion/issue-53475.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-53475.rs:10:1
|
LL | impl<T> CoerceUnsized<Foo<dyn Any>> for Foo<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<T: 'static> CoerceUnsized<Foo<dyn Any>> for Foo<T> {}
| +++++++++
diff --git a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs
index 20ff87549..bce3b0fd7 100644
--- a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs
+++ b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs
@@ -6,5 +6,6 @@
trait NotObjectSafe { fn eq(&self, other: Self); }
impl NotObjectSafe for dyn NotObjectSafe { }
//~^ ERROR E0038
+//~| ERROR E0046
fn main() { }
diff --git a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
index e9090c1b6..1dcc30ee6 100644
--- a/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
+++ b/tests/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
@@ -13,6 +13,15 @@ LL | trait NotObjectSafe { fn eq(&self, other: Self); }
| this trait cannot be made into an object...
= help: consider moving `eq` to another trait
-error: aborting due to previous error
+error[E0046]: not all trait items implemented, missing: `eq`
+ --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:7:1
+ |
+LL | trait NotObjectSafe { fn eq(&self, other: Self); }
+ | -------------------------- `eq` from trait
+LL | impl NotObjectSafe for dyn NotObjectSafe { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `eq` in implementation
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0038`.
+Some errors have detailed explanations: E0038, E0046.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs b/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs
index 3acf0d8d3..0e16d12a1 100644
--- a/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs
+++ b/tests/ui/coherence/coherence-negative-outlives-lifetimes.rs
@@ -1,5 +1,5 @@
// revisions: stock with_negative_coherence
-//[with_negative_coherence] check-pass
+//[with_negative_coherence] known-bug: unknown
#![feature(negative_impls)]
#![cfg_attr(with_negative_coherence, feature(with_negative_coherence))]
diff --git a/tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr b/tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr
new file mode 100644
index 000000000..097cc4e0f
--- /dev/null
+++ b/tests/ui/coherence/coherence-negative-outlives-lifetimes.with_negative_coherence.stderr
@@ -0,0 +1,11 @@
+error[E0119]: conflicting implementations of trait `MyTrait<'_>` for type `&_`
+ --> $DIR/coherence-negative-outlives-lifetimes.rs:14:1
+ |
+LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
+ | ---------------------------------------------- first implementation here
+LL | impl<'a, T> MyTrait<'a> for &'a T {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-overlap-downstream.next.stderr b/tests/ui/coherence/coherence-overlap-downstream.next.stderr
index 9d62efbc3..6c2e9466b 100644
--- a/tests/ui/coherence/coherence-overlap-downstream.next.stderr
+++ b/tests/ui/coherence/coherence-overlap-downstream.next.stderr
@@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
--> $DIR/coherence-overlap-downstream.rs:17:1
|
LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
- | ----------------------- first implementation here
+ | --------------------------------------- first implementation here
LL | impl<X> Foo<X> for i32 {}
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
diff --git a/tests/ui/coherence/coherence-overlap-downstream.old.stderr b/tests/ui/coherence/coherence-overlap-downstream.old.stderr
index 9d62efbc3..6c2e9466b 100644
--- a/tests/ui/coherence/coherence-overlap-downstream.old.stderr
+++ b/tests/ui/coherence/coherence-overlap-downstream.old.stderr
@@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`
--> $DIR/coherence-overlap-downstream.rs:17:1
|
LL | impl<X, T> Foo<X> for T where T: Bar<X> {}
- | ----------------------- first implementation here
+ | --------------------------------------- first implementation here
LL | impl<X> Foo<X> for i32 {}
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
|
diff --git a/tests/ui/coherence/coherence-overlap-trait-alias.rs b/tests/ui/coherence/coherence-overlap-trait-alias.rs
index 9d9c76af9..d42a666c5 100644
--- a/tests/ui/coherence/coherence-overlap-trait-alias.rs
+++ b/tests/ui/coherence/coherence-overlap-trait-alias.rs
@@ -13,8 +13,6 @@ impl B for u32 {}
trait C {}
impl<T: AB> C for T {}
impl C for u32 {}
-//~^ ERROR
-// FIXME it's giving an ungreat error but unsure if we care given that it's using an internal rustc
-// attribute and an artificial code path for testing purposes
+//~^ ERROR conflicting implementations of trait `C` for type `u32`
fn main() {}
diff --git a/tests/ui/coherence/coherence-overlap-trait-alias.stderr b/tests/ui/coherence/coherence-overlap-trait-alias.stderr
index 668b8319b..687f3af00 100644
--- a/tests/ui/coherence/coherence-overlap-trait-alias.stderr
+++ b/tests/ui/coherence/coherence-overlap-trait-alias.stderr
@@ -1,17 +1,11 @@
-error[E0283]: type annotations needed: cannot satisfy `u32: C`
- --> $DIR/coherence-overlap-trait-alias.rs:15:12
- |
-LL | impl C for u32 {}
- | ^^^
- |
-note: multiple `impl`s satisfying `u32: C` found
- --> $DIR/coherence-overlap-trait-alias.rs:14:1
+error[E0119]: conflicting implementations of trait `C` for type `u32`
+ --> $DIR/coherence-overlap-trait-alias.rs:15:1
|
LL | impl<T: AB> C for T {}
- | ^^^^^^^^^^^^^^^^^^^
+ | ------------------- first implementation here
LL | impl C for u32 {}
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ conflicting implementation for `u32`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0283`.
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-overlap-upstream.stderr b/tests/ui/coherence/coherence-overlap-upstream.stderr
index f6145c188..8272c8875 100644
--- a/tests/ui/coherence/coherence-overlap-upstream.stderr
+++ b/tests/ui/coherence/coherence-overlap-upstream.stderr
@@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `i16`
--> $DIR/coherence-overlap-upstream.rs:13:1
|
LL | impl<T> Foo for T where T: Remote {}
- | ----------------- first implementation here
+ | --------------------------------- first implementation here
LL | impl Foo for i16 {}
| ^^^^^^^^^^^^^^^^ conflicting implementation for `i16`
|
diff --git a/tests/ui/coherence/coherence-overlap-with-regions.rs b/tests/ui/coherence/coherence-overlap-with-regions.rs
index 32f01f418..9945c8e6c 100644
--- a/tests/ui/coherence/coherence-overlap-with-regions.rs
+++ b/tests/ui/coherence/coherence-overlap-with-regions.rs
@@ -1,4 +1,10 @@
-// check-pass
+// known-bug: unknown
+
+// This fails because we currently perform negative coherence in coherence mode.
+// This means that when looking for a negative predicate, we also assemble a
+// coherence-unknowable predicate. Since confirming the negative impl has region
+// obligations, we don't prefer the impl over the unknowable predicate
+// unconditionally and instead flounder.
#![feature(negative_impls)]
#![feature(rustc_attrs)]
diff --git a/tests/ui/coherence/coherence-overlap-with-regions.stderr b/tests/ui/coherence/coherence-overlap-with-regions.stderr
new file mode 100644
index 000000000..fd25f0978
--- /dev/null
+++ b/tests/ui/coherence/coherence-overlap-with-regions.stderr
@@ -0,0 +1,11 @@
+error[E0119]: conflicting implementations of trait `Bar` for type `&_`
+ --> $DIR/coherence-overlap-with-regions.rs:20:1
+ |
+LL | impl<T: Foo> Bar for T {}
+ | ---------------------- first implementation here
+LL | impl<T> Bar for &T where T: 'static {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/coherence-wasm-bindgen.stderr b/tests/ui/coherence/coherence-wasm-bindgen.stderr
index 89615f0fb..600cd42d8 100644
--- a/tests/ui/coherence/coherence-wasm-bindgen.stderr
+++ b/tests/ui/coherence/coherence-wasm-bindgen.stderr
@@ -1,11 +1,17 @@
error: conflicting implementations of trait `IntoWasmAbi` for type `&dyn Fn(&_) -> _`
--> $DIR/coherence-wasm-bindgen.rs:28:1
|
-LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b)
- | ------------------------------------------------------------ first implementation here
+LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn Fn(A) -> R + 'b)
+LL | | where
+LL | | A: FromWasmAbi,
+LL | | R: ReturnWasmAbi,
+ | |_____________________- first implementation here
...
-LL | impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&dyn Fn(&_) -> _`
+LL | / impl<'a, 'b, A, R> IntoWasmAbi for &'a (dyn for<'x> Fn(&'x A) -> R + 'b)
+LL | | where
+LL | | A: RefFromWasmAbi,
+LL | | R: ReturnWasmAbi,
+ | |_____________________^ conflicting implementation for `&dyn Fn(&_) -> _`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
diff --git a/tests/ui/coherence/coherence-with-generator.rs b/tests/ui/coherence/coherence-with-coroutine.rs
index 5eb8dc2a4..21857d7fe 100644
--- a/tests/ui/coherence/coherence-with-generator.rs
+++ b/tests/ui/coherence/coherence-with-coroutine.rs
@@ -1,13 +1,13 @@
// Test that encountering closures during coherence does not cause issues.
-#![feature(type_alias_impl_trait, generators)]
+#![feature(type_alias_impl_trait, coroutines)]
#![cfg_attr(specialized, feature(specialization))]
#![allow(incomplete_features)]
// revisions: stock specialized
// [specialized]check-pass
-type OpaqueGenerator = impl Sized;
-fn defining_use() -> OpaqueGenerator {
+type OpaqueCoroutine = impl Sized;
+fn defining_use() -> OpaqueCoroutine {
|| {
for i in 0..10 {
yield i;
@@ -17,8 +17,8 @@ fn defining_use() -> OpaqueGenerator {
struct Wrapper<T>(T);
trait Trait {}
-impl Trait for Wrapper<OpaqueGenerator> {}
+impl Trait for Wrapper<OpaqueCoroutine> {}
impl<T: Sync> Trait for Wrapper<T> {}
-//[stock]~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>`
+//[stock]~^ ERROR conflicting implementations of trait `Trait` for type `Wrapper<OpaqueCoroutine>`
fn main() {}
diff --git a/tests/ui/coherence/coherence-with-generator.stock.stderr b/tests/ui/coherence/coherence-with-coroutine.stock.stderr
index 478ac4912..b2a9135c5 100644
--- a/tests/ui/coherence/coherence-with-generator.stock.stderr
+++ b/tests/ui/coherence/coherence-with-coroutine.stock.stderr
@@ -1,10 +1,10 @@
-error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueGenerator>`
- --> $DIR/coherence-with-generator.rs:21:1
+error[E0119]: conflicting implementations of trait `Trait` for type `Wrapper<OpaqueCoroutine>`
+ --> $DIR/coherence-with-coroutine.rs:21:1
|
-LL | impl Trait for Wrapper<OpaqueGenerator> {}
+LL | impl Trait for Wrapper<OpaqueCoroutine> {}
| --------------------------------------- first implementation here
LL | impl<T: Sync> Trait for Wrapper<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueGenerator>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Wrapper<OpaqueCoroutine>`
error: aborting due to previous error
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
index 0dd28706e..9b2dbc66c 100644
--- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.next.stderr
@@ -1,11 +1,14 @@
error[E0119]: conflicting implementations of trait `From<()>` for type `S`
--> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1
|
-LL | impl From<()> for S {
- | ------------------- first implementation here
+LL | impl From<()> for S {
+ | ------------------- first implementation here
...
-LL | impl<I> From<I> for S
- | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
+LL | / impl<I> From<I> for S
+LL | |
+LL | | where
+LL | | I: Iterator<Item = ()>,
+ | |___________________________^ conflicting implementation for `S`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
diff --git a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
index 0dd28706e..9b2dbc66c 100644
--- a/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
+++ b/tests/ui/coherence/inter-crate-ambiguity-causes-notes.old.stderr
@@ -1,11 +1,14 @@
error[E0119]: conflicting implementations of trait `From<()>` for type `S`
--> $DIR/inter-crate-ambiguity-causes-notes.rs:12:1
|
-LL | impl From<()> for S {
- | ------------------- first implementation here
+LL | impl From<()> for S {
+ | ------------------- first implementation here
...
-LL | impl<I> From<I> for S
- | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S`
+LL | / impl<I> From<I> for S
+LL | |
+LL | | where
+LL | | I: Iterator<Item = ()>,
+ | |___________________________^ conflicting implementation for `S`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
diff --git a/tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr b/tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr
new file mode 100644
index 000000000..4cf50b4f2
--- /dev/null
+++ b/tests/ui/coherence/negative-coherence-considering-regions.any_lt.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `Bar` for type `&_`
+ --> $DIR/negative-coherence-considering-regions.rs:22:1
+ |
+LL | impl<T> Bar for T where T: Foo {}
+ | ------------------------------ first implementation here
+...
+LL | impl<T> Bar for &T {}
+ | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/negative-coherence-considering-regions.rs b/tests/ui/coherence/negative-coherence-considering-regions.rs
new file mode 100644
index 000000000..597a59726
--- /dev/null
+++ b/tests/ui/coherence/negative-coherence-considering-regions.rs
@@ -0,0 +1,29 @@
+// revisions: any_lt static_lt
+//[static_lt] known-bug: unknown
+
+// This fails because we currently perform negative coherence in coherence mode.
+// This means that when looking for a negative predicate, we also assemble a
+// coherence-unknowable predicate. Since confirming the negative impl has region
+// obligations, we don't prefer the impl over the unknowable predicate
+// unconditionally and instead flounder.
+
+#![feature(negative_impls)]
+#![feature(with_negative_coherence)]
+
+trait Foo {}
+
+impl<T> !Foo for &'static T {}
+
+trait Bar {}
+
+impl<T> Bar for T where T: Foo {}
+
+#[cfg(any_lt)]
+impl<T> Bar for &T {}
+//[any_lt]~^ ERROR conflicting implementations of trait `Bar` for type `&_`
+
+#[cfg(static_lt)]
+impl<T> Bar for &'static T {}
+
+
+fn main() {}
diff --git a/tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr b/tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr
new file mode 100644
index 000000000..87e7be2aa
--- /dev/null
+++ b/tests/ui/coherence/negative-coherence-considering-regions.static_lt.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `Bar` for type `&'static _`
+ --> $DIR/negative-coherence-considering-regions.rs:26:1
+ |
+LL | impl<T> Bar for T where T: Foo {}
+ | ------------------------------ first implementation here
+...
+LL | impl<T> Bar for &'static T {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&'static _`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
index 89289767b..4f32639a6 100644
--- a/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
+++ b/tests/ui/coherence/warn-when-cycle-is-error-in-coherence.stderr
@@ -1,11 +1,16 @@
error: implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future
--> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1
|
-LL | #[derive(PartialEq, Default)]
- | --------- the second impl is here
+LL | #[derive(PartialEq, Default)]
+ | --------- the second impl is here
...
-LL | impl<T, Q> PartialEq<Q> for Interval<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the first impl is here
+LL | / impl<T, Q> PartialEq<Q> for Interval<T>
+LL | |
+LL | |
+LL | | where
+LL | | T: Borrow<Q>,
+LL | | Q: ?Sized + PartialOrd,
+ | |___________________________^ the first impl is here
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #114040 <https://github.com/rust-lang/rust/issues/114040>
@@ -19,3 +24,28 @@ LL | #![deny(coinductive_overlap_in_coherence)]
error: aborting due to previous error
+Future incompatibility report: Future breakage diagnostic:
+error: implementations of `PartialEq<Interval<_>>` for `Interval<_>` will conflict in the future
+ --> $DIR/warn-when-cycle-is-error-in-coherence.rs:13:1
+ |
+LL | #[derive(PartialEq, Default)]
+ | --------- the second impl is here
+...
+LL | / impl<T, Q> PartialEq<Q> for Interval<T>
+LL | |
+LL | |
+LL | | where
+LL | | T: Borrow<Q>,
+LL | | Q: ?Sized + PartialOrd,
+ | |___________________________^ the first impl is here
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114040 <https://github.com/rust-lang/rust/issues/114040>
+ = note: impls that are not considered to overlap may be considered to overlap in the future
+ = note: `Interval<_>: PartialOrd` may be considered to hold in future releases, causing the impls to overlap
+note: the lint level is defined here
+ --> $DIR/warn-when-cycle-is-error-in-coherence.rs:1:9
+ |
+LL | #![deny(coinductive_overlap_in_coherence)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr
index f632a53f2..a87b713c2 100644
--- a/tests/ui/compare-method/bad-self-type.stderr
+++ b/tests/ui/compare-method/bad-self-type.stderr
@@ -28,10 +28,10 @@ LL | fn foo(self);
found signature `fn(Box<MyFuture>)`
error[E0053]: method `bar` has an incompatible type for trait
- --> $DIR/bad-self-type.rs:24:18
+ --> $DIR/bad-self-type.rs:24:17
|
LL | fn bar(self) {}
- | ^ expected `Option<()>`, found `()`
+ | ^ expected `Option<()>`, found `()`
|
note: type in trait
--> $DIR/bad-self-type.rs:18:21
diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
index d5b4349c0..12557ff63 100644
--- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
+++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr
@@ -74,6 +74,7 @@ LL | #[cfg(feature = $expr)]
LL | generate_s10!(concat!("nonexistent"));
| ------------------------------------- in this macro invocation
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 11 previous errors
diff --git a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr
index d7e5e50cb..6d5cd4547 100644
--- a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr
+++ b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr
@@ -39,6 +39,7 @@ note: associated constant defined here
|
LL | const MODE: Mode;
| ^^^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/const-generics/const-arg-in-const-arg.rs b/tests/ui/const-generics/const-arg-in-const-arg.rs
index 9eaa54347..c1a4c3dc3 100644
--- a/tests/ui/const-generics/const-arg-in-const-arg.rs
+++ b/tests/ui/const-generics/const-arg-in-const-arg.rs
@@ -1,5 +1,5 @@
// revisions: min
-// we use a single revision because t his shoudl have a `full` revision
+// we use a single revision because this should have a `full` revision
// but right now that ICEs and I(@BoxyUwU) could not get stderr normalization to work
#![cfg_attr(full, feature(generic_const_exprs))]
diff --git a/tests/ui/const-generics/const-argument-if-length.full.stderr b/tests/ui/const-generics/const-argument-if-length.full.stderr
index 7997026df..315b0f0a0 100644
--- a/tests/ui/const-generics/const-argument-if-length.full.stderr
+++ b/tests/ui/const-generics/const-argument-if-length.full.stderr
@@ -1,3 +1,11 @@
+error: unconstrained generic constant
+ --> $DIR/const-argument-if-length.rs:17:10
+ |
+LL | pad: [u8; is_zst::<T>()],
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: try adding a `where` bound using this expression: `where [(); is_zst::<T>()]:`
+
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/const-argument-if-length.rs:15:12
|
@@ -22,14 +30,6 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | value: Box<T>,
| ++++ +
-error: unconstrained generic constant
- --> $DIR/const-argument-if-length.rs:17:10
- |
-LL | pad: [u8; is_zst::<T>()],
- | ^^^^^^^^^^^^^^^^^^^
- |
- = help: try adding a `where` bound using this expression: `where [(); is_zst::<T>()]:`
-
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/const-generics/defaults/default-annotation.rs b/tests/ui/const-generics/defaults/default-annotation.rs
index 7a9f5732f..587ad78e2 100644
--- a/tests/ui/const-generics/defaults/default-annotation.rs
+++ b/tests/ui/const-generics/defaults/default-annotation.rs
@@ -4,12 +4,12 @@
// FIXME(const_generics_defaults): It seems like we aren't testing the right thing here,
// I would assume that we want the attributes to apply to the const parameter defaults
// themselves.
-#![stable(feature = "const_default_test", since="none")]
+#![stable(feature = "const_default_test", since = "3.3.3")]
-#[unstable(feature = "const_default_stable", issue="none")]
+#[unstable(feature = "const_default_stable", issue = "none")]
pub struct ConstDefaultUnstable<const N: usize = 3>;
-#[stable(feature = "const_default_unstable", since="none")]
+#[stable(feature = "const_default_unstable", since = "3.3.3")]
pub struct ConstDefaultStable<const N: usize = {
3
}>;
diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs
index 29aa0f59d..c254b4ee0 100644
--- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs
+++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs
@@ -15,7 +15,7 @@ fn bad_infer_fn<_>() {}
fn main() {
- let a: All<_, _, _>;
+ let a: All<_, _, _>; //~ ERROR struct takes 2 generic arguments but 3
all_fn();
let v: [u8; _];
let v: [u8; 10] = [0; _];
diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr
index e6d0c743d..a6b736261 100644
--- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr
+++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr
@@ -19,6 +19,21 @@ LL | struct BadInfer<_>;
= help: consider removing `_`, referring to it in a field, or using a marker such as `PhantomData`
= help: if you intended `_` to be a const parameter, use `const _: usize` instead
-error: aborting due to 3 previous errors
+error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supplied
+ --> $DIR/infer-arg-test.rs:18:10
+ |
+LL | let a: All<_, _, _>;
+ | ^^^ - help: remove this generic argument
+ | |
+ | expected 2 generic arguments
+ |
+note: struct defined here, with 2 generic parameters: `T`, `N`
+ --> $DIR/infer-arg-test.rs:3:8
+ |
+LL | struct All<'a, T, const N: usize> {
+ | ^^^ - --------------
+
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0392`.
+Some errors have detailed explanations: E0107, E0392.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs
index 6b2a0153f..5f612780f 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs
+++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs
@@ -3,6 +3,7 @@
// failure-status: 101
// normalize-stderr-test "note: .*\n\n" -> ""
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
+// normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: "
// rustc-env:RUST_BACKTRACE=0
// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
index 79ed82e02..9b66fc502 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
@@ -1,9 +1,9 @@
-error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:272:21: SizeOf MIR operator called for unsized type dyn Debug
+error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:LL:CC: SizeOf MIR operator called for unsized type dyn Debug
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
Box<dyn Any>
query stack during panic:
-#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:25:1: 25:18>::{constant#0}`
+#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:26:1: 28:32>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
end of query stack
error: aborting due to previous error
diff --git a/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr b/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr
index 4e1d71f15..b7ec65712 100644
--- a/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr
@@ -5,13 +5,17 @@ LL | fn use_dyn(v: &dyn Foo) {
| ^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety-err-ret.rs:8:23
+ --> $DIR/object-safety-err-ret.rs:8:8
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn test(&self) -> [u8; bar::<Self>()];
- | ^^^^^^^^^^^^^^^^^^^ ...because method `test` references the `Self` type in its return type
+ | ^^^^ ^^^^^^^^^^^^^^^^^^^ ...because method `test` references the `Self` type in its return type
+ | |
+ | ...because method `test` references the `Self` type in its `where` clause
= help: consider moving `test` to another trait
+ = help: consider moving `test` to another trait
+ = help: only type `()` implements the trait, consider using it directly instead
error: aborting due to previous error
diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs
new file mode 100644
index 000000000..5813f0981
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs
@@ -0,0 +1,13 @@
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+trait Q {
+ const ASSOC: usize;
+}
+
+impl<const N: u64> Q for [u8; N] {}
+//~^ ERROR not all trait items implemented
+
+pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {}
+
+pub fn main() {}
diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
new file mode 100644
index 000000000..0314d7ed2
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
@@ -0,0 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `ASSOC`
+ --> $DIR/type_mismatch.rs:8:1
+ |
+LL | const ASSOC: usize;
+ | ------------------ `ASSOC` from trait
+...
+LL | impl<const N: u64> Q for [u8; N] {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ASSOC` in implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/tests/ui/const-generics/issues/issue-100313.stderr b/tests/ui/const-generics/issues/issue-100313.stderr
index 796966b22..5832dbe17 100644
--- a/tests/ui/const-generics/issues/issue-100313.stderr
+++ b/tests/ui/const-generics/issues/issue-100313.stderr
@@ -11,7 +11,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-100313.rs:10:13
|
LL | *(B as *const bool as *mut bool) = false;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to alloc7 which is read-only
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to ALLOC0 which is read-only
|
note: inside `T::<&true>::set_false`
--> $DIR/issue-100313.rs:10:13
diff --git a/tests/ui/const-generics/issues/issue-67945-1.full.stderr b/tests/ui/const-generics/issues/issue-67945-1.full.stderr
index 8879aec35..ee17ec3c6 100644
--- a/tests/ui/const-generics/issues/issue-67945-1.full.stderr
+++ b/tests/ui/const-generics/issues/issue-67945-1.full.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-67945-1.rs:10:20
|
LL | struct Bug<S> {
- | - this type parameter
+ | - expected this type parameter
...
LL | let x: S = MaybeUninit::uninit();
| - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found `MaybeUninit<_>`
diff --git a/tests/ui/const-generics/issues/issue-74950.min.stderr b/tests/ui/const-generics/issues/issue-74950.min.stderr
index a5dbe10b7..54ef1ea1e 100644
--- a/tests/ui/const-generics/issues/issue-74950.min.stderr
+++ b/tests/ui/const-generics/issues/issue-74950.min.stderr
@@ -15,6 +15,7 @@ LL | struct Outer<const I: Inner>;
|
= note: the only supported types are integers, `bool` and `char`
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -24,6 +25,7 @@ LL | struct Outer<const I: Inner>;
|
= note: the only supported types are integers, `bool` and `char`
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -33,6 +35,7 @@ LL | struct Outer<const I: Inner>;
|
= note: the only supported types are integers, `bool` and `char`
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:20:23
@@ -42,6 +45,7 @@ LL | struct Outer<const I: Inner>;
|
= note: the only supported types are integers, `bool` and `char`
= help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 5 previous errors
diff --git a/tests/ui/const-generics/issues/issue-83249.stderr b/tests/ui/const-generics/issues/issue-83249.stderr
index 7491fdc8a..5187434ff 100644
--- a/tests/ui/const-generics/issues/issue-83249.stderr
+++ b/tests/ui/const-generics/issues/issue-83249.stderr
@@ -1,9 +1,18 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/issue-83249.rs:19:9
|
LL | let _ = foo([0; 1]);
- | ^
+ | ^ --- ------ type must be known at this point
+ | |
+ | required by a bound introduced by this call
|
+ = note: cannot satisfy `_: Foo`
+ = help: the trait `Foo` is implemented for `u8`
+note: required by a bound in `foo`
+ --> $DIR/issue-83249.rs:12:11
+ |
+LL | fn foo<T: Foo>(_: [u8; T::N]) -> T {
+ | ^^^ required by this bound in `foo`
help: consider giving this pattern a type
|
LL | let _: /* Type */ = foo([0; 1]);
@@ -11,4 +20,4 @@ LL | let _: /* Type */ = foo([0; 1]);
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr
index 51ef354e3..61d055e80 100644
--- a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr
+++ b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied
LL | let _ = A;
| ^ the trait `Bar<_>` is not implemented for `A<_>`
|
- = help: the trait `Bar<N>` is implemented for `A<7>`
+ = help: the trait `Bar<_>` is implemented for `A<7>`
note: required by a bound in `A`
--> $DIR/unused-substs-1.rs:9:11
|
diff --git a/tests/ui/const-ptr/allowed_slices.rs b/tests/ui/const-ptr/allowed_slices.rs
index 3f19cd4d8..3561338a7 100644
--- a/tests/ui/const-ptr/allowed_slices.rs
+++ b/tests/ui/const-ptr/allowed_slices.rs
@@ -2,8 +2,6 @@
#![feature(
slice_from_ptr_range,
const_slice_from_ptr_range,
- pointer_byte_offsets,
- const_pointer_byte_offsets
)]
use std::{
mem::MaybeUninit,
diff --git a/tests/ui/const-ptr/forbidden_slices.rs b/tests/ui/const-ptr/forbidden_slices.rs
index 192b6a46d..0374ac7f7 100644
--- a/tests/ui/const-ptr/forbidden_slices.rs
+++ b/tests/ui/const-ptr/forbidden_slices.rs
@@ -1,13 +1,10 @@
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
-// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
-// normalize-stderr-test "alloc\d+" -> "allocN"
-// error-pattern: could not evaluate static initializer
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*A(LLOC)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+
#![feature(
slice_from_ptr_range,
const_slice_from_ptr_range,
- pointer_byte_offsets,
- const_pointer_byte_offsets
)]
use std::{
mem::{size_of, MaybeUninit},
@@ -17,10 +14,13 @@ use std::{
// Null is never valid for reads
pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
+//~^ ERROR: it is undefined behavior to use this value
pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
+//~^ ERROR: it is undefined behavior to use this value
// Out of bounds
pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
+//~^ ERROR: it is undefined behavior to use this value
// Reading uninitialized data
pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }; //~ ERROR: it is undefined behavior to use this value
@@ -39,6 +39,7 @@ pub static S7: &[u16] = unsafe {
// Unaligned read
pub static S8: &[u64] = unsafe {
+ //~^ ERROR: it is undefined behavior to use this value
let ptr = (&D4 as *const [u32; 2] as *const u32).byte_add(1).cast::<u64>();
from_raw_parts(ptr, 1)
@@ -66,8 +67,9 @@ pub static R6: &[bool] = unsafe {
from_ptr_range(ptr..ptr.add(4))
};
pub static R7: &[u16] = unsafe {
+ //~^ ERROR: it is undefined behavior to use this value
let ptr = (&D2 as *const Struct as *const u16).byte_add(1);
- from_ptr_range(ptr..ptr.add(4)) //~ inside `R7`
+ from_ptr_range(ptr..ptr.add(4))
};
pub static R8: &[u64] = unsafe {
let ptr = (&D4 as *const [u32; 2] as *const u32).byte_add(1).cast::<u64>();
diff --git a/tests/ui/const-ptr/forbidden_slices.stderr b/tests/ui/const-ptr/forbidden_slices.stderr
index 294bc77aa..105683940 100644
--- a/tests/ui/const-ptr/forbidden_slices.stderr
+++ b/tests/ui/const-ptr/forbidden_slices.stderr
@@ -1,41 +1,35 @@
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
- |
- = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
- |
-note: inside `std::slice::from_raw_parts::<'_, u32>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `S0`
- --> $DIR/forbidden_slices.rs:19:34
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:16:1
|
LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
- |
- = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
|
-note: inside `std::slice::from_raw_parts::<'_, ()>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `S1`
- --> $DIR/forbidden_slices.rs:20:33
- |
-LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:18:1
|
- = note: dereferencing pointer failed: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
+LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
|
-note: inside `std::slice::from_raw_parts::<'_, u32>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `S2`
- --> $DIR/forbidden_slices.rs:23:34
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:22:1
|
LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
- | ^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error[E0080]: it is undefined behavior to use this value
--> $DIR/forbidden_slices.rs:26:1
@@ -83,18 +77,16 @@ LL | pub static S7: &[u16] = unsafe {
HEX_DUMP
}
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
- |
- = note: dereferencing pointer failed: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:41:1
|
-note: inside `std::slice::from_raw_parts::<'_, u64>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `S8`
- --> $DIR/forbidden_slices.rs:44:5
+LL | pub static S8: &[u64] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
|
-LL | from_raw_parts(ptr, 1)
- | ^^^^^^^^^^^^^^^^^^^^^^
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error[E0080]: could not evaluate static initializer
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -106,7 +98,7 @@ note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
note: inside `from_ptr_range::<'_, u32>`
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
note: inside `R0`
- --> $DIR/forbidden_slices.rs:47:34
+ --> $DIR/forbidden_slices.rs:48:34
|
LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -121,7 +113,7 @@ note: inside `ptr::const_ptr::<impl *const ()>::sub_ptr`
note: inside `from_ptr_range::<'_, ()>`
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
note: inside `R1`
- --> $DIR/forbidden_slices.rs:48:33
+ --> $DIR/forbidden_slices.rs:49:33
|
LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -130,18 +122,18 @@ LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
error[E0080]: could not evaluate static initializer
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC10 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u32>::add`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `R2`
- --> $DIR/forbidden_slices.rs:51:25
+ --> $DIR/forbidden_slices.rs:52:25
|
LL | from_ptr_range(ptr..ptr.add(2))
| ^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/forbidden_slices.rs:53:1
+ --> $DIR/forbidden_slices.rs:54:1
|
LL | pub static R4: &[u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -152,7 +144,7 @@ LL | pub static R4: &[u8] = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/forbidden_slices.rs:58:1
+ --> $DIR/forbidden_slices.rs:59:1
|
LL | pub static R5: &[u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -165,7 +157,7 @@ LL | pub static R5: &[u8] = unsafe {
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: it is undefined behavior to use this value
- --> $DIR/forbidden_slices.rs:63:1
+ --> $DIR/forbidden_slices.rs:64:1
|
LL | pub static R6: &[bool] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
@@ -175,30 +167,26 @@ LL | pub static R6: &[bool] = unsafe {
HEX_DUMP
}
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/forbidden_slices.rs:69:1
|
- = note: accessing memory with alignment 1, but alignment 2 is required
+LL | pub static R7: &[u16] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
|
-note: inside `std::slice::from_raw_parts::<'_, u16>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `from_ptr_range::<'_, u16>`
- --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
-note: inside `R7`
- --> $DIR/forbidden_slices.rs:70:5
- |
-LL | from_ptr_range(ptr..ptr.add(4))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error[E0080]: could not evaluate static initializer
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC11 has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u64>::add`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `R8`
- --> $DIR/forbidden_slices.rs:74:25
+ --> $DIR/forbidden_slices.rs:76:25
|
LL | from_ptr_range(ptr..ptr.add(1))
| ^^^^^^^^^^
@@ -213,7 +201,7 @@ note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
note: inside `from_ptr_range::<'_, u32>`
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
note: inside `R9`
- --> $DIR/forbidden_slices.rs:79:34
+ --> $DIR/forbidden_slices.rs:81:34
|
LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -228,7 +216,7 @@ note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
note: inside `from_ptr_range::<'_, u32>`
--> $SRC_DIR/core/src/slice/raw.rs:LL:COL
note: inside `R10`
- --> $DIR/forbidden_slices.rs:80:35
+ --> $DIR/forbidden_slices.rs:82:35
|
LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/const-ptr/out_of_bounds_read.stderr b/tests/ui/const-ptr/out_of_bounds_read.stderr
index c5c0a1cde..be75f76b2 100644
--- a/tests/ui/const-ptr/out_of_bounds_read.stderr
+++ b/tests/ui/const-ptr/out_of_bounds_read.stderr
@@ -1,7 +1,7 @@
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: dereferencing pointer failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
+ = note: memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
|
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
@@ -14,7 +14,7 @@ LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) };
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: dereferencing pointer failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
+ = note: memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
|
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
@@ -29,7 +29,7 @@ LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() };
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: dereferencing pointer failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
+ = note: memory access failed: ALLOC0 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
|
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
diff --git a/tests/ui/const_prop/overwrite_with_const_with_params.rs b/tests/ui/const_prop/overwrite_with_const_with_params.rs
new file mode 100644
index 000000000..6f533919a
--- /dev/null
+++ b/tests/ui/const_prop/overwrite_with_const_with_params.rs
@@ -0,0 +1,21 @@
+// compile-flags: -O
+// run-pass
+
+// Regression test for https://github.com/rust-lang/rust/issues/118328
+
+#![allow(unused_assignments)]
+
+struct SizeOfConst<T>(std::marker::PhantomData<T>);
+impl<T> SizeOfConst<T> {
+ const SIZE: usize = std::mem::size_of::<T>();
+}
+
+fn size_of<T>() -> usize {
+ let mut a = 0;
+ a = SizeOfConst::<T>::SIZE;
+ a
+}
+
+fn main() {
+ assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>());
+}
diff --git a/tests/ui/consts/assert-type-intrinsics.rs b/tests/ui/consts/assert-type-intrinsics.rs
index b4fd423be..32b5f5c92 100644
--- a/tests/ui/consts/assert-type-intrinsics.rs
+++ b/tests/ui/consts/assert-type-intrinsics.rs
@@ -1,5 +1,4 @@
#![feature(never_type)]
-#![feature(const_assert_type2)]
#![feature(core_intrinsics)]
use std::intrinsics;
diff --git a/tests/ui/consts/assert-type-intrinsics.stderr b/tests/ui/consts/assert-type-intrinsics.stderr
index 3c03b03de..66c4f0f9c 100644
--- a/tests/ui/consts/assert-type-intrinsics.stderr
+++ b/tests/ui/consts/assert-type-intrinsics.stderr
@@ -1,20 +1,20 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/assert-type-intrinsics.rs:12:9
+ --> $DIR/assert-type-intrinsics.rs:11:9
|
LL | MaybeUninit::<!>::uninit().assume_init();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to instantiate uninhabited type `!`', $DIR/assert-type-intrinsics.rs:12:36
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to instantiate uninhabited type `!`', $DIR/assert-type-intrinsics.rs:11:36
error[E0080]: evaluation of constant value failed
- --> $DIR/assert-type-intrinsics.rs:16:9
+ --> $DIR/assert-type-intrinsics.rs:15:9
|
LL | intrinsics::assert_mem_uninitialized_valid::<&'static i32>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to leave type `&i32` uninitialized, which is invalid', $DIR/assert-type-intrinsics.rs:16:9
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to leave type `&i32` uninitialized, which is invalid', $DIR/assert-type-intrinsics.rs:15:9
error[E0080]: evaluation of constant value failed
- --> $DIR/assert-type-intrinsics.rs:20:9
+ --> $DIR/assert-type-intrinsics.rs:19:9
|
LL | intrinsics::assert_zero_valid::<&'static i32>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to zero-initialize type `&i32`, which is invalid', $DIR/assert-type-intrinsics.rs:20:9
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'aborted execution: attempted to zero-initialize type `&i32`, which is invalid', $DIR/assert-type-intrinsics.rs:19:9
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/const-adt-align-mismatch.rs b/tests/ui/consts/const-adt-align-mismatch.rs
index bd51bc9f2..89b3a9b74 100644
--- a/tests/ui/consts/const-adt-align-mismatch.rs
+++ b/tests/ui/consts/const-adt-align-mismatch.rs
@@ -12,7 +12,7 @@ enum Foo {
}
// NOTE(eddyb) Don't make this a const, needs to be a static
-// so it is always instantiated as a LLVM constant value.
+// so it is always instantiated as an LLVM constant value.
static FOO: Foo = Foo::C;
fn main() {
diff --git a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
index 174103eeb..eb8b8ac75 100644
--- a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
+++ b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
@@ -6,13 +6,17 @@ LL | let _: [Option<Bar>; 2] = [no_copy(); 2];
|
= note: required for `Option<Bar>` to implement `Copy`
= note: the `Copy` trait is required because this value will be copied for each element of the array
- = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
help: consider annotating `Bar` with `#[derive(Copy)]`
|
LL + #[derive(Copy)]
LL | struct Bar;
|
+help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position
+ |
+LL ~ const ARRAY_REPEAT_VALUE: Option<Bar> = no_copy();
+LL ~ let _: [Option<Bar>; 2] = [ARRAY_REPEAT_VALUE; 2];
+ |
error: aborting due to previous error
diff --git a/tests/ui/consts/const-blocks/trait-error.stderr b/tests/ui/consts/const-blocks/trait-error.stderr
index 06fa4b0b1..858ffa820 100644
--- a/tests/ui/consts/const-blocks/trait-error.stderr
+++ b/tests/ui/consts/const-blocks/trait-error.stderr
@@ -10,9 +10,13 @@ note: required for `Foo<String>` to implement `Copy`
LL | #[derive(Copy, Clone)]
| ^^^^ unsatisfied trait bound introduced in this `derive` macro
= note: the `Copy` trait is required because this value will be copied for each element of the array
- = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position
+ |
+LL ~ const ARRAY_REPEAT_VALUE: Foo<String> = Foo(String::new());
+LL ~ [ARRAY_REPEAT_VALUE; 4];
+ |
error: aborting due to previous error
diff --git a/tests/ui/consts/const-compare-bytes-ub.stderr b/tests/ui/consts/const-compare-bytes-ub.stderr
index 54fafded0..d8971eb99 100644
--- a/tests/ui/consts/const-compare-bytes-ub.stderr
+++ b/tests/ui/consts/const-compare-bytes-ub.stderr
@@ -20,25 +20,25 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:22:9
|
LL | compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc6 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC0 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:26:9
|
LL | compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc13 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC1 has size 3, so pointer to 4 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:30:9
|
LL | compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc17[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC2[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:34:9
|
LL | compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc25[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC3[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory
error[E0080]: evaluation of constant value failed
--> $DIR/const-compare-bytes-ub.rs:38:9
diff --git a/tests/ui/consts/const-deref-ptr.rs b/tests/ui/consts/const-deref-ptr.rs
index 4aca75e3a..2607d4de2 100644
--- a/tests/ui/consts/const-deref-ptr.rs
+++ b/tests/ui/consts/const-deref-ptr.rs
@@ -3,5 +3,6 @@
fn main() {
static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
//~^ ERROR could not evaluate static initializer
+ //~| dangling pointer
println!("{}", C);
}
diff --git a/tests/ui/consts/const-deref-ptr.stderr b/tests/ui/consts/const-deref-ptr.stderr
index 22cb6451e..16eb6b016 100644
--- a/tests/ui/consts/const-deref-ptr.stderr
+++ b/tests/ui/consts/const-deref-ptr.stderr
@@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
--> $DIR/const-deref-ptr.rs:4:29
|
LL | static C: u64 = unsafe {*(0xdeadbeef as *const u64)};
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0xdeadbeef[noalloc] is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0xdeadbeef[noalloc] is a dangling pointer (it has no provenance)
error: aborting due to previous error
diff --git a/tests/ui/consts/const-err-late.stderr b/tests/ui/consts/const-err-late.stderr
index 85bc56bae..35c3d0001 100644
--- a/tests/ui/consts/const-err-late.stderr
+++ b/tests/ui/consts/const-err-late.stderr
@@ -27,6 +27,8 @@ note: erroneous constant encountered
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
| ^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs b/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs
new file mode 100644
index 000000000..c1460fdd9
--- /dev/null
+++ b/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs
@@ -0,0 +1,14 @@
+// only-wasm32
+// compile-flags:-C target-feature=-simd128
+// build-pass
+
+#![crate_type = "lib"]
+
+#[cfg(target_feature = "simd128")]
+compile_error!("simd128 target feature should be disabled");
+
+// Calling functions with `#[target_feature]` is not unsound on WASM, see #84988
+const A: () = simd128_fn();
+
+#[target_feature(enable = "simd128")]
+const fn simd128_fn() {}
diff --git a/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr b/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr
index e41dea873..e6cd25e42 100644
--- a/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr
+++ b/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr
@@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const_raw_ptr_ops2.rs:7:26
|
LL | const Z2: i32 = unsafe { *(42 as *const i32) };
- | ^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^^^^^^^^^^^ memory access failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
error[E0080]: evaluation of constant value failed
--> $DIR/const_raw_ptr_ops2.rs:9:26
|
LL | const Z3: i32 = unsafe { *(44 as *const i32) };
- | ^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2c[noalloc] is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^^^^^^^^^^^ memory access failed: 0x2c[noalloc] is a dangling pointer (it has no provenance)
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-eval/dangling.rs b/tests/ui/consts/const-eval/dangling.rs
deleted file mode 100644
index 4fcf87921..000000000
--- a/tests/ui/consts/const-eval/dangling.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-use std::mem;
-
-// Make sure we error with the right kind of error on a too large slice.
-const TEST: () = { unsafe {
- let slice: *const [u8] = mem::transmute((1usize, usize::MAX));
- let _val = &*slice; //~ ERROR: evaluation of constant value failed
- //~| slice is bigger than largest supported object
-} };
-
-fn main() {}
diff --git a/tests/ui/consts/const-eval/dangling.stderr b/tests/ui/consts/const-eval/dangling.stderr
deleted file mode 100644
index 92d70573d..000000000
--- a/tests/ui/consts/const-eval/dangling.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/dangling.rs:6:16
- |
-LL | let _val = &*slice;
- | ^^^^^^^ invalid metadata in wide pointer: slice is bigger than largest supported object
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
index a0f4519ea..82de91eff 100644
--- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
@@ -6,7 +6,7 @@ LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32)
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc2──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
index d2bffa425..de23aafe0 100644
--- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
@@ -6,7 +6,7 @@ LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32)
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc2────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs
index b6d89a58d..a717a5f82 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs
@@ -5,10 +5,10 @@
use std::intrinsics;
const _X: &'static u8 = unsafe {
+ //~^ error: dangling pointer in final constant
let ptr = intrinsics::const_allocate(4, 4);
intrinsics::const_deallocate(ptr, 4, 4);
&*ptr
- //~^ error: evaluation of constant value failed
};
const _Y: u8 = unsafe {
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
index b50ef0c68..5f4630f6f 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
@@ -1,14 +1,14 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/dealloc_intrinsic_dangling.rs:10:5
+error: encountered dangling pointer in final constant
+ --> $DIR/dealloc_intrinsic_dangling.rs:7:1
|
-LL | &*ptr
- | ^^^^^ dereferencing pointer failed: alloc2 has been freed, so this pointer is dangling
+LL | const _X: &'static u8 = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_dangling.rs:18:5
|
LL | *reference
- | ^^^^^^^^^^ dereferencing pointer failed: alloc4 has been freed, so this pointer is dangling
+ | ^^^^^^^^^^ memory access failed: ALLOC0 has been freed, so this pointer is dangling
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
index 0884ade45..916344a7b 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_duplicate.rs:9:5
|
LL | intrinsics::const_deallocate(ptr, 4, 4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc2 has been freed, so this pointer is dangling
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC0 has been freed, so this pointer is dangling
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr
index 4c23957a1..4b1f0f686 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr
@@ -2,19 +2,19 @@ error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:8:5
|
LL | intrinsics::const_deallocate(ptr, 4, 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: alloc2 has size 4 and alignment 4, but gave size 4 and alignment 2
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC0 has size 4 and alignment 4, but gave size 4 and alignment 2
error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:13:5
|
LL | intrinsics::const_deallocate(ptr, 2, 4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: alloc4 has size 4 and alignment 4, but gave size 2 and alignment 4
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC1 has size 4 and alignment 4, but gave size 2 and alignment 4
error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:19:5
|
LL | intrinsics::const_deallocate(ptr, 3, 4);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: alloc6 has size 4 and alignment 4, but gave size 3 and alignment 4
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect layout on deallocation: ALLOC2 has size 4 and alignment 4, but gave size 3 and alignment 4
error[E0080]: evaluation of constant value failed
--> $DIR/dealloc_intrinsic_incorrect_layout.rs:25:5
diff --git a/tests/ui/consts/const-eval/issue-114994-fail.rs b/tests/ui/consts/const-eval/issue-114994-fail.rs
new file mode 100644
index 000000000..723504640
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-114994-fail.rs
@@ -0,0 +1,14 @@
+// This checks that function pointer signatures that are referenced mutably
+// but contain a &mut T parameter still fail in a constant context: see issue #114994.
+//
+// check-fail
+
+const fn use_mut_const_fn(_f: &mut fn(&mut String)) { //~ ERROR mutable references are not allowed in constant functions
+ ()
+}
+
+const fn use_mut_const_tuple_fn(_f: (fn(), &mut u32)) { //~ ERROR mutable references are not allowed in constant functions
+
+}
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/issue-114994-fail.stderr b/tests/ui/consts/const-eval/issue-114994-fail.stderr
new file mode 100644
index 000000000..4dae8ea9b
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-114994-fail.stderr
@@ -0,0 +1,21 @@
+error[E0658]: mutable references are not allowed in constant functions
+ --> $DIR/issue-114994-fail.rs:6:27
+ |
+LL | const fn use_mut_const_fn(_f: &mut fn(&mut String)) {
+ | ^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0658]: mutable references are not allowed in constant functions
+ --> $DIR/issue-114994-fail.rs:10:33
+ |
+LL | const fn use_mut_const_tuple_fn(_f: (fn(), &mut u32)) {
+ | ^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/consts/const-eval/issue-114994.rs b/tests/ui/consts/const-eval/issue-114994.rs
new file mode 100644
index 000000000..a4cb2e61e
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-114994.rs
@@ -0,0 +1,18 @@
+// This checks that function pointer signatures containing &mut T types
+// work in a constant context: see issue #114994.
+//
+// check-pass
+
+const fn use_const_fn(_f: fn(&mut String)) {
+ ()
+}
+
+const fn get_some_fn() -> fn(&mut String) {
+ String::clear
+}
+
+const fn some_const_fn() {
+ let _f: fn(&mut String) = String::clear;
+}
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr
index c7aaee942..eea42c8ce 100644
--- a/tests/ui/consts/const-eval/issue-44578.stderr
+++ b/tests/ui/consts/const-eval/issue-44578.stderr
@@ -24,6 +24,7 @@ note: erroneous constant encountered
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/issue-49296.stderr b/tests/ui/consts/const-eval/issue-49296.stderr
index 45ba0ea18..2022a16e7 100644
--- a/tests/ui/consts/const-eval/issue-49296.stderr
+++ b/tests/ui/consts/const-eval/issue-49296.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-49296.rs:9:16
|
LL | const X: u64 = *wat(42);
- | ^^^^^^^^ dereferencing pointer failed: alloc3 has been freed, so this pointer is dangling
+ | ^^^^^^^^ memory access failed: ALLOC0 has been freed, so this pointer is dangling
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr
new file mode 100644
index 000000000..6454ce3d1
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr
@@ -0,0 +1,21 @@
+error[E0080]: evaluation of `<A<()> as Foo<()>>::BAR` failed
+ --> $DIR/issue-50814-2.rs:16:24
+ |
+LL | const BAR: usize = [5, 6, 7][T::BOO];
+ | ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42
+
+note: erroneous constant encountered
+ --> $DIR/issue-50814-2.rs:20:6
+ |
+LL | &<A<T> as Foo<T>>::BAR
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+note: erroneous constant encountered
+ --> $DIR/issue-50814-2.rs:20:5
+ |
+LL | &<A<T> as Foo<T>>::BAR
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/issue-50814-2.stderr b/tests/ui/consts/const-eval/issue-50814-2.normal.stderr
index 450fb0023..c6b1df6c8 100644
--- a/tests/ui/consts/const-eval/issue-50814-2.stderr
+++ b/tests/ui/consts/const-eval/issue-50814-2.normal.stderr
@@ -1,17 +1,17 @@
error[E0080]: evaluation of `<A<()> as Foo<()>>::BAR` failed
- --> $DIR/issue-50814-2.rs:14:24
+ --> $DIR/issue-50814-2.rs:16:24
|
LL | const BAR: usize = [5, 6, 7][T::BOO];
| ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42
note: erroneous constant encountered
- --> $DIR/issue-50814-2.rs:18:6
+ --> $DIR/issue-50814-2.rs:20:6
|
LL | &<A<T> as Foo<T>>::BAR
| ^^^^^^^^^^^^^^^^^^^^^
note: the above error was encountered while instantiating `fn foo::<()>`
- --> $DIR/issue-50814-2.rs:30:22
+ --> $DIR/issue-50814-2.rs:32:22
|
LL | println!("{:x}", foo::<()>() as *const usize as usize);
| ^^^^^^^^^^^
diff --git a/tests/ui/consts/const-eval/issue-50814-2.rs b/tests/ui/consts/const-eval/issue-50814-2.rs
index 53eb7b149..2eab93beb 100644
--- a/tests/ui/consts/const-eval/issue-50814-2.rs
+++ b/tests/ui/consts/const-eval/issue-50814-2.rs
@@ -1,4 +1,6 @@
// build-fail
+// revisions: normal mir-opt
+// [mir-opt]compile-flags: -Zmir-opt-level=4
trait C {
const BOO: usize;
diff --git a/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs b/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs
index 3b48e9729..19ab52399 100644
--- a/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs
+++ b/tests/ui/consts/const-eval/nonnull_as_ref_ub.rs
@@ -1,6 +1,6 @@
use std::ptr::NonNull;
const NON_NULL: NonNull<u8> = unsafe { NonNull::dangling() };
-const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() });
+const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() }); //~ERROR: evaluation of constant value failed
fn main() {}
diff --git a/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
index de93cb0c3..e34f3f43c 100644
--- a/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
+++ b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
@@ -1,15 +1,8 @@
error[E0080]: evaluation of constant value failed
- --> $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
- |
- = note: dereferencing pointer failed: 0x1[noalloc] is a dangling pointer (it has no provenance)
- |
-note: inside `NonNull::<u8>::as_ref::<'_>`
- --> $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
-note: inside `_`
- --> $DIR/nonnull_as_ref_ub.rs:4:39
+ --> $DIR/nonnull_as_ref_ub.rs:4:29
|
LL | const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() });
- | ^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x1[noalloc] is a dangling pointer (it has no provenance)
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/nrvo.rs b/tests/ui/consts/const-eval/nrvo.rs
index 1d2c6acc0..22da96a3f 100644
--- a/tests/ui/consts/const-eval/nrvo.rs
+++ b/tests/ui/consts/const-eval/nrvo.rs
@@ -1,7 +1,8 @@
// run-pass
// When the NRVO is applied, the return place (`_0`) gets treated like a normal local. For example,
-// its address may be taken and it may be written to indirectly. Ensure that MIRI can handle this.
+// its address may be taken and it may be written to indirectly. Ensure that the const-eval
+// interpreter can handle this.
#![feature(const_mut_refs)]
diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
index 4706497db..50660664f 100644
--- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
@@ -17,6 +17,8 @@ note: erroneous constant encountered
|
LL | let _ = PrintName::VOID;
| ^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr b/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
index 13ca4379b..b948e07b9 100644
--- a/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
+++ b/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/partial_ptr_overwrite.rs:8:9
|
LL | *(ptr as *mut u8) = 123;
- | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at alloc4
+ | ^^^^^^^^^^^^^^^^^^^^^^^ unable to overwrite parts of a pointer in memory at ALLOC0
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
index 042e7eeb3..689ebf752 100644
--- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
@@ -211,7 +211,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:106:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a function pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
@@ -385,7 +385,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:175:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -396,7 +396,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:179:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -418,7 +418,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:186:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
@@ -451,7 +451,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:196:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
index 8426a9505..3447a8ab4 100644
--- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
@@ -211,7 +211,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:106:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a function pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
@@ -385,7 +385,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:175:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -396,7 +396,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:179:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -418,7 +418,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:186:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
@@ -451,7 +451,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/raw-bytes.rs:196:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
diff --git a/tests/ui/consts/const-eval/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs
index 6c1238c0a..e00592222 100644
--- a/tests/ui/consts/const-eval/raw-bytes.rs
+++ b/tests/ui/consts/const-eval/raw-bytes.rs
@@ -1,8 +1,8 @@
// stderr-per-bitwidth
// ignore-endian-big
// ignore-tidy-linelength
-// normalize-stderr-test "╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼" -> "╾ALLOC_ID$2╼"
-// normalize-stderr-test "alloc\d+" -> "allocN"
+// normalize-stderr-test "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼" -> "╾ALLOC_ID$1╼"
+
#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
#![allow(invalid_value)]
diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.rs b/tests/ui/consts/const-eval/raw-pointer-ub.rs
new file mode 100644
index 000000000..3341f3c78
--- /dev/null
+++ b/tests/ui/consts/const-eval/raw-pointer-ub.rs
@@ -0,0 +1,45 @@
+#![feature(const_mut_refs)]
+
+
+const MISALIGNED_LOAD: () = unsafe {
+ let mem = [0u32; 8];
+ let ptr = mem.as_ptr().byte_add(1);
+ let _val = *ptr; //~ERROR: evaluation of constant value failed
+ //~^NOTE: based on pointer with alignment 1, but alignment 4 is required
+};
+
+const MISALIGNED_STORE: () = unsafe {
+ let mut mem = [0u32; 8];
+ let ptr = mem.as_mut_ptr().byte_add(1);
+ *ptr = 0; //~ERROR: evaluation of constant value failed
+ //~^NOTE: based on pointer with alignment 1, but alignment 4 is required
+};
+
+const MISALIGNED_COPY: () = unsafe {
+ let x = &[0_u8; 4];
+ let y = x.as_ptr().cast::<u32>();
+ let mut z = 123;
+ y.copy_to_nonoverlapping(&mut z, 1);
+ //~^NOTE
+ // The actual error points into the implementation of `copy_to_nonoverlapping`.
+};
+
+const MISALIGNED_FIELD: () = unsafe {
+ #[repr(align(16))]
+ struct Aligned(f32);
+
+ let mem = [0f32; 8];
+ let ptr = mem.as_ptr().cast::<Aligned>();
+ // Accessing an f32 field but we still require the alignment of the pointer type.
+ let _val = (*ptr).0; //~ERROR: evaluation of constant value failed
+ //~^NOTE: based on pointer with alignment 4, but alignment 16 is required
+};
+
+const OOB: () = unsafe {
+ let mem = [0u32; 1];
+ let ptr = mem.as_ptr().cast::<u64>();
+ let _val = *ptr; //~ERROR: evaluation of constant value failed
+ //~^NOTE: size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
+};
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.stderr b/tests/ui/consts/const-eval/raw-pointer-ub.stderr
new file mode 100644
index 000000000..60fcd461c
--- /dev/null
+++ b/tests/ui/consts/const-eval/raw-pointer-ub.stderr
@@ -0,0 +1,42 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/raw-pointer-ub.rs:7:16
+ |
+LL | let _val = *ptr;
+ | ^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/raw-pointer-ub.rs:14:5
+ |
+LL | *ptr = 0;
+ | ^^^^^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required
+
+error[E0080]: evaluation of constant value failed
+ --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ |
+ = note: accessing memory with alignment 1, but alignment 4 is required
+ |
+note: inside `copy_nonoverlapping::<u32>`
+ --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
+note: inside `ptr::const_ptr::<impl *const u32>::copy_to_nonoverlapping`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+note: inside `MISALIGNED_COPY`
+ --> $DIR/raw-pointer-ub.rs:22:5
+ |
+LL | y.copy_to_nonoverlapping(&mut z, 1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/raw-pointer-ub.rs:34:16
+ |
+LL | let _val = (*ptr).0;
+ | ^^^^^^^^ accessing memory based on pointer with alignment 4, but alignment 16 is required
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/raw-pointer-ub.rs:41:16
+ |
+LL | let _val = *ptr;
+ | ^^^^ memory access failed: ALLOC0 has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr b/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr
index 40fc4a876..8eee392d1 100644
--- a/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr
+++ b/tests/ui/consts/const-eval/stable-metric/ctfe-simple-loop.warn.stderr
@@ -40,6 +40,7 @@ help: the constant being evaluated
|
LL | const Y: u32 = simple_loop(35);
| ^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: constant evaluation is taking a long time
--> $DIR/ctfe-simple-loop.rs:9:5
diff --git a/tests/ui/consts/const-eval/ub-enum.rs b/tests/ui/consts/const-eval/ub-enum.rs
index 078283fbd..72a0c9efe 100644
--- a/tests/ui/consts/const-eval/ub-enum.rs
+++ b/tests/ui/consts/const-eval/ub-enum.rs
@@ -2,7 +2,7 @@
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
-#![feature(never_type, const_discriminant)]
+#![feature(never_type)]
#![allow(invalid_value)]
use std::mem;
diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr b/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
index 965256de2..7b30233c0 100644
--- a/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
@@ -1,46 +1,56 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-incorrect-vtable.rs:19:14
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-incorrect-vtable.rs:18:1
+ |
+LL | const INVALID_VTABLE_ALIGNMENT: &dyn Trait =
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC1, but expected a vtable pointer
|
-LL | unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 8, align: 4) {
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──╼╾──╼
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-incorrect-vtable.rs:24:14
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-incorrect-vtable.rs:23:1
+ |
+LL | const INVALID_VTABLE_SIZE: &dyn Trait =
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a vtable pointer
|
-LL | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 8, align: 4) {
+ ╾ALLOC2╼ ╾ALLOC3╼ │ ╾──╼╾──╼
+ }
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:33:1
|
LL | const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC5, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
- ╾─allocN─╼ ╾─allocN─╼ │ ╾──╼╾──╼
+ ╾ALLOC4╼ ╾ALLOC5╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:38:1
|
LL | const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC7, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
- ╾─allocN─╼ ╾─allocN─╼ │ ╾──╼╾──╼
+ ╾ALLOC6╼ ╾ALLOC7╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:44:1
|
LL | const INVALID_VTABLE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC9, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
- ╾─allocN─╼ ╾─allocN─╼ │ ╾──╼╾──╼
+ ╾ALLOC8╼ ╾ALLOC9╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
@@ -51,7 +61,7 @@ LL | const G: Wide = unsafe { Transmute { t: FOO }.u };
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
- ╾─allocN─╼ ╾─allocN─╼ │ ╾──╼╾──╼
+ ╾ALLOC10╼ ╾ALLOC11╼ │ ╾──╼╾──╼
}
error: aborting due to 6 previous errors
diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr b/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
index bd542a7a5..9330ae3c9 100644
--- a/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
@@ -1,46 +1,56 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-incorrect-vtable.rs:19:14
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-incorrect-vtable.rs:18:1
+ |
+LL | const INVALID_VTABLE_ALIGNMENT: &dyn Trait =
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC1, but expected a vtable pointer
|
-LL | unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 16, align: 8) {
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──────╼╾──────╼
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-incorrect-vtable.rs:24:14
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-incorrect-vtable.rs:23:1
+ |
+LL | const INVALID_VTABLE_SIZE: &dyn Trait =
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a vtable pointer
|
-LL | unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 16, align: 8) {
+ ╾ALLOC2╼ ╾ALLOC3╼ │ ╾──────╼╾──────╼
+ }
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:33:1
|
LL | const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC5, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
- ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC4╼ ╾ALLOC5╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:38:1
|
LL | const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC7, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
- ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC6╼ ╾ALLOC7╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:44:1
|
LL | const INVALID_VTABLE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC9, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
- ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC8╼ ╾ALLOC9╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
@@ -51,7 +61,7 @@ LL | const G: Wide = unsafe { Transmute { t: FOO }.u };
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
- ╾───────allocN───────╼ ╾───────allocN───────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC10╼ ╾ALLOC11╼ │ ╾──────╼╾──────╼
}
error: aborting due to 6 previous errors
diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.rs b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs
index 4bb30b75b..7d1927253 100644
--- a/tests/ui/consts/const-eval/ub-incorrect-vtable.rs
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs
@@ -11,19 +11,19 @@
// errors are emitted instead of ICEs.
// stderr-per-bitwidth
-// normalize-stderr-test "alloc\d+" -> "allocN"
+
trait Trait {}
const INVALID_VTABLE_ALIGNMENT: &dyn Trait =
unsafe { std::mem::transmute((&92u8, &[0usize, 1usize, 1000usize])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^^ ERROR it is undefined behavior to use this value
+//~| expected a vtable pointer
const INVALID_VTABLE_SIZE: &dyn Trait =
unsafe { std::mem::transmute((&92u8, &[1usize, usize::MAX, 1usize])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^^ ERROR it is undefined behavior to use this value
+//~| expected a vtable pointer
#[repr(transparent)]
struct W<T>(T);
diff --git a/tests/ui/consts/const-eval/ub-nonnull.rs b/tests/ui/consts/const-eval/ub-nonnull.rs
index a64b3a74c..fe4ec4d23 100644
--- a/tests/ui/consts/const-eval/ub-nonnull.rs
+++ b/tests/ui/consts/const-eval/ub-nonnull.rs
@@ -1,6 +1,6 @@
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
-// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![feature(rustc_attrs, ptr_metadata)]
#![allow(invalid_value)] // make sure we cannot allow away the errors tested here
diff --git a/tests/ui/consts/const-eval/ub-nonnull.stderr b/tests/ui/consts/const-eval/ub-nonnull.stderr
index 961648708..7822306b6 100644
--- a/tests/ui/consts/const-eval/ub-nonnull.stderr
+++ b/tests/ui/consts/const-eval/ub-nonnull.stderr
@@ -10,10 +10,10 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-nonnull.rs:20:30
+ --> $DIR/ub-nonnull.rs:20:29
|
LL | let out_of_bounds_ptr = &ptr[255];
- | ^^^^^^^^ dereferencing pointer failed: alloc11 has size 1, so pointer to 256 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^ out-of-bounds pointer arithmetic: ALLOC1 has size 1, so pointer to 255 bytes starting at offset 0 is out-of-bounds
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-nonnull.rs:24:1
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.rs b/tests/ui/consts/const-eval/ub-ref-ptr.rs
index a5d2ea014..08d4dce4d 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.rs
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.rs
@@ -1,7 +1,7 @@
// ignore-tidy-linelength
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
-// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![allow(invalid_value)]
use std::mem;
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
index 6d5c36cea..c608bad2a 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
@@ -141,7 +141,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:59:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc39, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC2, but expected a function pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -151,7 +151,7 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: accessing memory with alignment 1, but alignment 4 is required
+ = note: accessing memory based on pointer with alignment 1, but alignment 4 is required
|
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
diff --git a/tests/ui/consts/const-eval/ub-upvars.32bit.stderr b/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
index f7898e55e..353a9b782 100644
--- a/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
@@ -6,7 +6,7 @@ LL | const BAD_UPVAR: &dyn FnOnce() = &{
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
- ╾─alloc3──╼ ╾─alloc4──╼ │ ╾──╼╾──╼
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──╼╾──╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/ub-upvars.64bit.stderr b/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
index 60432380e..097f6b049 100644
--- a/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
@@ -6,7 +6,7 @@ LL | const BAD_UPVAR: &dyn FnOnce() = &{
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
- ╾───────alloc3────────╼ ╾───────alloc4────────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──────╼╾──────╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.rs b/tests/ui/consts/const-eval/ub-wide-ptr.rs
index a765dc712..dc8d4c640 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.rs
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.rs
@@ -5,11 +5,11 @@ use std::mem;
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
-// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
// normalize-stderr-test "offset \d+" -> "offset N"
-// normalize-stderr-test "alloc\d+" -> "allocN"
// normalize-stderr-test "size \d+" -> "size N"
+
/// A newtype wrapper to prevent MIR generation from inserting reborrows that would affect the error
/// message.
#[repr(transparent)]
@@ -122,14 +122,14 @@ const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4u
//~^ ERROR it is undefined behavior to use this value
//~| expected a vtable
const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) };
-//~^ ERROR evaluation of constant value failed
-//~| does not point to a vtable
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
//~^ ERROR it is undefined behavior to use this value
//~| expected a vtable
@@ -148,12 +148,12 @@ const RAW_TRAIT_OBJ_CONTENT_INVALID: *const dyn Trait = unsafe { mem::transmute:
// Const eval fails for these, so they need to be statics to error.
static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF: *const dyn Trait = unsafe {
+//~^ ERROR it is undefined behavior to use this value
mem::transmute::<_, &dyn Trait>((&92u8, 0usize))
- //~^ ERROR could not evaluate static initializer
};
static mut RAW_TRAIT_OBJ_VTABLE_INVALID_THROUGH_REF: *const dyn Trait = unsafe {
+//~^ ERROR it is undefined behavior to use this value
mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
- //~^ ERROR could not evaluate static initializer
};
fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
index d8add67fa..b20379485 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
@@ -189,7 +189,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:113:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC12, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -200,7 +200,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:117:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC14, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -218,29 +218,44 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u
HEX_DUMP
}
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-wide-ptr.rs:124:57
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:124:1
|
LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC17, but expected a vtable pointer
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-wide-ptr.rs:127:57
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:127:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC19, but expected a vtable pointer
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-wide-ptr.rs:130:56
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:130:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC21, but expected a vtable pointer
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:133:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC23, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -273,24 +288,34 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:145:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC28, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
HEX_DUMP
}
-error[E0080]: could not evaluate static initializer
- --> $DIR/ub-wide-ptr.rs:151:5
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:150:1
+ |
+LL | static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF: *const dyn Trait = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer
|
-LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
-error[E0080]: could not evaluate static initializer
- --> $DIR/ub-wide-ptr.rs:155:5
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:154:1
+ |
+LL | static mut RAW_TRAIT_OBJ_VTABLE_INVALID_THROUGH_REF: *const dyn Trait = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC31, but expected a vtable pointer
|
-LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
error: aborting due to 29 previous errors
diff --git a/tests/ui/consts/const-eval/union-const-eval-field.rs b/tests/ui/consts/const-eval/union-const-eval-field.rs
index a94fcbbfa..c9799989e 100644
--- a/tests/ui/consts/const-eval/union-const-eval-field.rs
+++ b/tests/ui/consts/const-eval/union-const-eval-field.rs
@@ -1,5 +1,3 @@
-// only-x86_64
-
type Field1 = i32;
type Field2 = f32;
type Field3 = i64;
diff --git a/tests/ui/consts/const-eval/union-const-eval-field.stderr b/tests/ui/consts/const-eval/union-const-eval-field.stderr
index ce260300f..b299208ae 100644
--- a/tests/ui/consts/const-eval/union-const-eval-field.stderr
+++ b/tests/ui/consts/const-eval/union-const-eval-field.stderr
@@ -1,20 +1,22 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/union-const-eval-field.rs:28:37
+ --> $DIR/union-const-eval-field.rs:26:37
|
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
| ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
note: erroneous constant encountered
- --> $DIR/union-const-eval-field.rs:31:5
+ --> $DIR/union-const-eval-field.rs:29:5
|
LL | FIELD3
| ^^^^^^
note: erroneous constant encountered
- --> $DIR/union-const-eval-field.rs:31:5
+ --> $DIR/union-const-eval-field.rs:29:5
|
LL | FIELD3
| ^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/const-eval/unused-broken-const-late.rs b/tests/ui/consts/const-eval/unused-broken-const-late.rs
new file mode 100644
index 000000000..a6528ec5f
--- /dev/null
+++ b/tests/ui/consts/const-eval/unused-broken-const-late.rs
@@ -0,0 +1,20 @@
+// build-fail
+// compile-flags: -O
+//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is
+//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090)
+
+struct PrintName<T>(T);
+impl<T> PrintName<T> {
+ const VOID: () = panic!(); //~ERROR evaluation of `PrintName::<i32>::VOID` failed
+}
+
+fn no_codegen<T>() {
+ // Any function that is called is guaranteed to have all consts that syntactically
+ // appear in its body evaluated, even if they only appear in dead code.
+ if false {
+ let _ = PrintName::<T>::VOID;
+ }
+}
+pub fn main() {
+ no_codegen::<i32>();
+}
diff --git a/tests/ui/consts/const-eval/unused-broken-const-late.stderr b/tests/ui/consts/const-eval/unused-broken-const-late.stderr
new file mode 100644
index 000000000..cdb70a69d
--- /dev/null
+++ b/tests/ui/consts/const-eval/unused-broken-const-late.stderr
@@ -0,0 +1,11 @@
+error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
+ --> $DIR/unused-broken-const-late.rs:8:22
+ |
+LL | const VOID: () = panic!();
+ | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/unused-broken-const-late.rs:8:22
+ |
+ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
index afe645ae8..6c4f0a5ac 100644
--- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
+++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
@@ -11,4 +11,5 @@ fn main() {
//[thir]~^^ call to unsafe function `foo` is unsafe and requires unsafe function or block
foo();
//[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block
+ //[thir]~^^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block
}
diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr
index b313f0653..e6b8173eb 100644
--- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr
+++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr
@@ -1,4 +1,12 @@
error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block
+ --> $DIR/const-extern-fn-requires-unsafe.rs:12:5
+ |
+LL | foo();
+ | ^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block
--> $DIR/const-extern-fn-requires-unsafe.rs:9:17
|
LL | let a: [u8; foo()];
@@ -6,6 +14,6 @@ LL | let a: [u8; foo()];
|
= note: consult the function's documentation for information on how to avoid undefined behavior
-error: aborting due to previous error
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/consts/const-fn-in-vec.rs b/tests/ui/consts/const-fn-in-vec.rs
index a40290eca..0483800ef 100644
--- a/tests/ui/consts/const-fn-in-vec.rs
+++ b/tests/ui/consts/const-fn-in-vec.rs
@@ -1,7 +1,11 @@
+static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5];
+//~^ ERROR the trait bound `String: Copy` is not satisfied
+
fn main() {
// should hint to create an inline `const` block
// or to create a new `const` item
- let strings: [String; 5] = [String::new(); 5];
+ let _strings: [String; 5] = [String::new(); 5];
+ //~^ ERROR the trait bound `String: Copy` is not satisfied
+ let _maybe_strings: [Option<String>; 5] = [None; 5];
//~^ ERROR the trait bound `String: Copy` is not satisfied
- println!("{:?}", strings);
}
diff --git a/tests/ui/consts/const-fn-in-vec.stderr b/tests/ui/consts/const-fn-in-vec.stderr
index 9eb7524b5..4593034bf 100644
--- a/tests/ui/consts/const-fn-in-vec.stderr
+++ b/tests/ui/consts/const-fn-in-vec.stderr
@@ -1,13 +1,47 @@
error[E0277]: the trait bound `String: Copy` is not satisfied
- --> $DIR/const-fn-in-vec.rs:4:33
+ --> $DIR/const-fn-in-vec.rs:1:47
|
-LL | let strings: [String; 5] = [String::new(); 5];
- | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5];
+ | ^^^^ the trait `Copy` is not implemented for `String`
|
+ = note: required for `Option<String>` to implement `Copy`
= note: the `Copy` trait is required because this value will be copied for each element of the array
- = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
+help: consider creating a new `const` item and initializing it with the result of the constructor to be used in the repeat position
+ |
+LL + const ARRAY_REPEAT_VALUE: Option<String> = None;
+LL ~ static _MAYBE_STRINGS: [Option<String>; 5] = [ARRAY_REPEAT_VALUE; 5];
+ |
+
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/const-fn-in-vec.rs:7:34
+ |
+LL | let _strings: [String; 5] = [String::new(); 5];
+ | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+ |
+ = note: the `Copy` trait is required because this value will be copied for each element of the array
+ = help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
+help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position
+ |
+LL ~ const ARRAY_REPEAT_VALUE: String = String::new();
+LL ~ let _strings: [String; 5] = [ARRAY_REPEAT_VALUE; 5];
+ |
+
+error[E0277]: the trait bound `String: Copy` is not satisfied
+ --> $DIR/const-fn-in-vec.rs:9:48
+ |
+LL | let _maybe_strings: [Option<String>; 5] = [None; 5];
+ | ^^^^ the trait `Copy` is not implemented for `String`
+ |
+ = note: required for `Option<String>` to implement `Copy`
+ = note: the `Copy` trait is required because this value will be copied for each element of the array
+ = help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
+help: consider creating a new `const` item and initializing it with the result of the constructor to be used in the repeat position
+ |
+LL ~ const ARRAY_REPEAT_VALUE: Option<String> = None;
+LL ~ let _maybe_strings: [Option<String>; 5] = [ARRAY_REPEAT_VALUE; 5];
+ |
-error: aborting due to previous error
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr
new file mode 100644
index 000000000..33d4fec70
--- /dev/null
+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr
@@ -0,0 +1,20 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:17:1
+ |
+LL | const A: Option<&mut i32> = helper();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const`
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 4, align: 4) {
+ 2a 00 00 00 │ *...
+ }
+
+error: encountered dangling pointer in final constant
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:24:1
+ |
+LL | const B: Option<&mut i32> = helper2();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr
new file mode 100644
index 000000000..9eb267585
--- /dev/null
+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr
@@ -0,0 +1,20 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:17:1
+ |
+LL | const A: Option<&mut i32> = helper();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const`
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 8, align: 8) {
+ 2a 00 00 00 00 00 00 00 │ *.......
+ }
+
+error: encountered dangling pointer in final constant
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:24:1
+ |
+LL | const B: Option<&mut i32> = helper2();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs
index 074beaab2..22e7a74e5 100644
--- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs
+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs
@@ -1,3 +1,4 @@
+// stderr-per-bitwidth
#![feature(const_mut_refs)]
#![feature(raw_ref_op)]
@@ -9,17 +10,15 @@
const fn helper() -> Option<&'static mut i32> { unsafe {
// Undefined behaviour (integer as pointer), who doesn't love tests like this.
- // This code never gets executed, because the static checks fail before that.
- Some(&mut *(42 as *mut i32)) //~ ERROR evaluation of constant value failed
- //~| 0x2a[noalloc] is a dangling pointer
+ Some(&mut *(42 as *mut i32))
} }
// The error is an evaluation error and not a validation error, so the error is reported
// directly at the site where it occurs.
-const A: Option<&mut i32> = helper();
+const A: Option<&mut i32> = helper(); //~ ERROR it is undefined behavior to use this value
+//~^ encountered mutable reference in a `const`
const fn helper2() -> Option<&'static mut i32> { unsafe {
// Undefined behaviour (dangling pointer), who doesn't love tests like this.
- // This code never gets executed, because the static checks fail before that.
Some(&mut *(&mut 42 as *mut i32))
} }
const B: Option<&mut i32> = helper2(); //~ ERROR encountered dangling pointer in final constant
diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
deleted file mode 100644
index 6e110dbdd..000000000
--- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
- |
-LL | Some(&mut *(42 as *mut i32))
- | ^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
- |
-note: inside `helper`
- --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
- |
-LL | Some(&mut *(42 as *mut i32))
- | ^^^^^^^^^^^^^^^^^^^^^^
-note: inside `A`
- --> $DIR/mut_ref_in_final_dynamic_check.rs:18:29
- |
-LL | const A: Option<&mut i32> = helper();
- | ^^^^^^^^
-
-error: encountered dangling pointer in final constant
- --> $DIR/mut_ref_in_final_dynamic_check.rs:25:1
- |
-LL | const B: Option<&mut i32> = helper2();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-points-to-static.32bit.stderr b/tests/ui/consts/const-points-to-static.32bit.stderr
index c7a435a1e..12cc7fbb1 100644
--- a/tests/ui/consts/const-points-to-static.32bit.stderr
+++ b/tests/ui/consts/const-points-to-static.32bit.stderr
@@ -6,7 +6,7 @@ LL | const TEST: &u8 = &MY_STATIC;
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc1──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/const-points-to-static.64bit.stderr b/tests/ui/consts/const-points-to-static.64bit.stderr
index 4d5b8eac5..86506e6ca 100644
--- a/tests/ui/consts/const-points-to-static.64bit.stderr
+++ b/tests/ui/consts/const-points-to-static.64bit.stderr
@@ -6,7 +6,7 @@ LL | const TEST: &u8 = &MY_STATIC;
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc1────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/const-unsized.rs b/tests/ui/consts/const-unsized.rs
index 319b8ef97..e0b06a271 100644
--- a/tests/ui/consts/const-unsized.rs
+++ b/tests/ui/consts/const-unsized.rs
@@ -2,15 +2,19 @@ use std::fmt::Debug;
const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
//~^ ERROR the size for values of type
+//~| ERROR the size for values of type
const CONST_FOO: str = *"foo";
//~^ ERROR the size for values of type
+//~| ERROR the size for values of type
static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
//~^ ERROR the size for values of type
+//~| ERROR the size for values of type
static STATIC_BAR: str = *"bar";
//~^ ERROR the size for values of type
+//~| ERROR the size for values of type
fn main() {
println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR);
diff --git a/tests/ui/consts/const-unsized.stderr b/tests/ui/consts/const-unsized.stderr
index 27b200648..674f0cb99 100644
--- a/tests/ui/consts/const-unsized.stderr
+++ b/tests/ui/consts/const-unsized.stderr
@@ -7,7 +7,7 @@ LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/const-unsized.rs:6:18
+ --> $DIR/const-unsized.rs:7:18
|
LL | const CONST_FOO: str = *"foo";
| ^^^ doesn't have a size known at compile-time
@@ -15,7 +15,7 @@ LL | const CONST_FOO: str = *"foo";
= help: the trait `Sized` is not implemented for `str`
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
- --> $DIR/const-unsized.rs:9:18
+ --> $DIR/const-unsized.rs:11:18
|
LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -23,13 +23,49 @@ LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/const-unsized.rs:12:20
+ --> $DIR/const-unsized.rs:15:20
|
LL | static STATIC_BAR: str = *"bar";
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
-error: aborting due to 4 previous errors
+error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:3:35
+ |
+LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
+ = note: constant expressions must have a statically known size
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:7:24
+ |
+LL | const CONST_FOO: str = *"foo";
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: constant expressions must have a statically known size
+
+error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:11:37
+ |
+LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
+ = note: constant expressions must have a statically known size
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:15:26
+ |
+LL | static STATIC_BAR: str = *"bar";
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: constant expressions must have a statically known size
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/consts/const_discriminant.rs b/tests/ui/consts/const_discriminant.rs
index b1180faa6..80deb0f78 100644
--- a/tests/ui/consts/const_discriminant.rs
+++ b/tests/ui/consts/const_discriminant.rs
@@ -1,5 +1,4 @@
// run-pass
-#![feature(const_discriminant)]
#![allow(dead_code)]
use std::mem::{discriminant, Discriminant};
diff --git a/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs
new file mode 100644
index 000000000..2491071d1
--- /dev/null
+++ b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.rs
@@ -0,0 +1,32 @@
+#![deny(pointer_structural_match)]
+#![allow(dead_code)]
+
+const C: *const u8 = &0;
+// Make sure we also find pointers nested in other types.
+const C_INNER: (*const u8, u8) = (C, 0);
+
+fn foo(x: *const u8) {
+ match x {
+ C => {} //~ERROR: behave unpredictably
+ //~| previously accepted
+ _ => {}
+ }
+}
+
+fn foo2(x: *const u8) {
+ match (x, 1) {
+ C_INNER => {} //~ERROR: behave unpredictably
+ //~| previously accepted
+ _ => {}
+ }
+}
+
+const D: *const [u8; 4] = b"abcd";
+
+fn main() {
+ match D {
+ D => {} //~ERROR: behave unpredictably
+ //~| previously accepted
+ _ => {}
+ }
+}
diff --git a/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr
new file mode 100644
index 000000000..ab53346b5
--- /dev/null
+++ b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr
@@ -0,0 +1,34 @@
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:10:9
+ |
+LL | C => {}
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+note: the lint level is defined here
+ --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:1:9
+ |
+LL | #![deny(pointer_structural_match)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:18:9
+ |
+LL | C_INNER => {}
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:28:9
+ |
+LL | D => {}
+ | ^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/consts/const_in_pattern/issue-44333.rs b/tests/ui/consts/const_in_pattern/issue-44333.rs
index 96e8795e5..aaf1edb6f 100644
--- a/tests/ui/consts/const_in_pattern/issue-44333.rs
+++ b/tests/ui/consts/const_in_pattern/issue-44333.rs
@@ -16,9 +16,9 @@ const BAR: Func = bar;
fn main() {
match test(std::env::consts::ARCH.len()) {
- FOO => println!("foo"), //~ WARN pointers in patterns behave unpredictably
+ FOO => println!("foo"), //~ WARN behave unpredictably
//~^ WARN will become a hard error
- BAR => println!("bar"), //~ WARN pointers in patterns behave unpredictably
+ BAR => println!("bar"), //~ WARN behave unpredictably
//~^ WARN will become a hard error
_ => unreachable!(),
}
diff --git a/tests/ui/consts/const_in_pattern/issue-44333.stderr b/tests/ui/consts/const_in_pattern/issue-44333.stderr
index 731ef509c..441aeecbc 100644
--- a/tests/ui/consts/const_in_pattern/issue-44333.stderr
+++ b/tests/ui/consts/const_in_pattern/issue-44333.stderr
@@ -1,4 +1,4 @@
-warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
--> $DIR/issue-44333.rs:19:9
|
LL | FOO => println!("foo"),
@@ -12,7 +12,7 @@ note: the lint level is defined here
LL | #![warn(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
--> $DIR/issue-44333.rs:21:9
|
LL | BAR => println!("bar"),
diff --git a/tests/ui/consts/const_in_pattern/issue-78057.rs b/tests/ui/consts/const_in_pattern/issue-78057.rs
index 69cf8404d..88b5d68cb 100644
--- a/tests/ui/consts/const_in_pattern/issue-78057.rs
+++ b/tests/ui/consts/const_in_pattern/issue-78057.rs
@@ -12,6 +12,5 @@ fn main() {
FOO => {},
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
_ => {}
- //~^ ERROR unreachable pattern
}
}
diff --git a/tests/ui/consts/const_in_pattern/issue-78057.stderr b/tests/ui/consts/const_in_pattern/issue-78057.stderr
index df155bdb6..5ec68719a 100644
--- a/tests/ui/consts/const_in_pattern/issue-78057.stderr
+++ b/tests/ui/consts/const_in_pattern/issue-78057.stderr
@@ -7,20 +7,5 @@ LL | FOO => {},
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
-error: unreachable pattern
- --> $DIR/issue-78057.rs:14:9
- |
-LL | FOO => {},
- | --- matches any value
-LL |
-LL | _ => {}
- | ^ unreachable pattern
- |
-note: the lint level is defined here
- --> $DIR/issue-78057.rs:1:9
- |
-LL | #![deny(unreachable_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.rs b/tests/ui/consts/const_in_pattern/reject_non_structural.rs
index dc6b9a331..df772740a 100644
--- a/tests/ui/consts/const_in_pattern/reject_non_structural.rs
+++ b/tests/ui/consts/const_in_pattern/reject_non_structural.rs
@@ -1,3 +1,5 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
// This test of structural match checking enumerates the different kinds of
// const definitions, collecting cases where the const pattern is rejected.
//
@@ -78,9 +80,6 @@ fn main() {
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
//~| NOTE the traits must be derived
//~| NOTE StructuralEq.html for details
- //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- //~| NOTE the traits must be derived
- //~| NOTE StructuralEq.html for details
trait Trait: Sized { const ASSOC: Option<Self>; }
impl Trait for NoDerive { const ASSOC: Option<NoDerive> = Some(NoDerive); }
diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr
index b6e439f21..72bb0aeaf 100644
--- a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr
+++ b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr
@@ -1,5 +1,5 @@
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:40:36
+ --> $DIR/reject_non_structural.rs:42:36
|
LL | match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
| ^^^^
@@ -8,7 +8,7 @@ LL | match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:46:28
+ --> $DIR/reject_non_structural.rs:48:28
|
LL | match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
| ^^^^^
@@ -17,7 +17,7 @@ LL | match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:53:27
+ --> $DIR/reject_non_structural.rs:55:27
|
LL | match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
| ^^^^^^^^
@@ -26,7 +26,7 @@ LL | match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops")
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:59:36
+ --> $DIR/reject_non_structural.rs:61:36
|
LL | match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
| ^^^^^
@@ -35,7 +35,7 @@ LL | match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoop
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:65:28
+ --> $DIR/reject_non_structural.rs:67:28
|
LL | match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
| ^^^^^^^^^^^^^^^
@@ -44,7 +44,7 @@ LL | match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => p
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:71:36
+ --> $DIR/reject_non_structural.rs:73:36
|
LL | match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
| ^^^^^
@@ -53,7 +53,7 @@ LL | match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoop
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:77:33
+ --> $DIR/reject_non_structural.rs:79:33
|
LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
| ^^^^^^
@@ -62,16 +62,7 @@ LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:77:33
- |
-LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
- | ^^^^^^
- |
- = note: the traits must be derived, manual `impl`s are not sufficient
- = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:87:28
+ --> $DIR/reject_non_structural.rs:86:28
|
LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
| ^^^^^^^^^^^^^^^
@@ -80,7 +71,7 @@ LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => p
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:93:28
+ --> $DIR/reject_non_structural.rs:92:28
|
LL | match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
| ^^^^^
@@ -89,7 +80,7 @@ LL | match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:99:29
+ --> $DIR/reject_non_structural.rs:98:29
|
LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
| ^^^^^^^
@@ -99,10 +90,10 @@ LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops")
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
note: the lint level is defined here
- --> $DIR/reject_non_structural.rs:12:9
+ --> $DIR/reject_non_structural.rs:14:9
|
LL | #![warn(indirect_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 10 previous errors; 1 warning emitted
+error: aborting due to 9 previous errors; 1 warning emitted
diff --git a/tests/ui/consts/copy-intrinsic.stderr b/tests/ui/consts/copy-intrinsic.stderr
index be41c2db3..0e4e6a6ad 100644
--- a/tests/ui/consts/copy-intrinsic.stderr
+++ b/tests/ui/consts/copy-intrinsic.stderr
@@ -2,13 +2,13 @@ error[E0080]: evaluation of constant value failed
--> $DIR/copy-intrinsic.rs:27:5
|
LL | copy_nonoverlapping(0x100 as *const i32, dangle, 0);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc5 has size 4, so pointer at offset 40 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC0 has size 4, so pointer at offset 40 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/copy-intrinsic.rs:34:5
|
LL | copy_nonoverlapping(dangle, 0x100 as *mut i32, 0);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: alloc7 has size 4, so pointer at offset 40 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC1 has size 4, so pointer at offset 40 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/copy-intrinsic.rs:41:5
diff --git a/tests/ui/consts/enum-discr-type-err.stderr b/tests/ui/consts/enum-discr-type-err.stderr
index 2f97582be..9a09d6a96 100644
--- a/tests/ui/consts/enum-discr-type-err.stderr
+++ b/tests/ui/consts/enum-discr-type-err.stderr
@@ -24,6 +24,7 @@ LL | | B = T,
LL | | }
| |_- in this macro invocation
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs
index 37b37e965..39f918379 100644
--- a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs
+++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs
@@ -1,7 +1,7 @@
// revisions: no_flag with_flag
// [no_flag] check-pass
// [with_flag] compile-flags: -Zextra-const-ub-checks
-#![feature(never_type, pointer_byte_offsets)]
+#![feature(never_type)]
use std::mem::transmute;
use std::ptr::addr_of;
@@ -88,4 +88,15 @@ const PARTIAL_POINTER: () = unsafe {
const VALID_ENUM1: E = { let e = E::A; e };
const VALID_ENUM2: Result<&'static [u8], ()> = { let e = Err(()); e };
+// Htting the (non-integer) array code in validation with an immediate local.
+const VALID_ARRAY: [Option<i32>; 0] = { let e = [None; 0]; e };
+
+// Detecting oversized references.
+const OVERSIZED_REF: () = { unsafe {
+ let slice: *const [u8] = transmute((1usize, usize::MAX));
+ let _val = &*slice;
+ //[with_flag]~^ ERROR: evaluation of constant value failed
+ //[with_flag]~| slice is bigger than largest supported object
+} };
+
fn main() {}
diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
index 4ee12d501..0100aafb6 100644
--- a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
+++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
@@ -52,6 +52,12 @@ LL | let _val = *(&mem as *const Align as *const [*const u8; 2]);
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
-error: aborting due to 7 previous errors
+error[E0080]: evaluation of constant value failed
+ --> $DIR/detect-extra-ub.rs:97:16
+ |
+LL | let _val = &*slice;
+ | ^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr
index 658a0b7b2..3d82837d5 100644
--- a/tests/ui/consts/fn_trait_refs.stderr
+++ b/tests/ui/consts/fn_trait_refs.stderr
@@ -21,6 +21,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:22:15
@@ -33,6 +35,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:29:15
@@ -45,6 +49,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const FnOnce<()>,
| ^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:36:15
@@ -57,6 +63,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:50:15
@@ -69,6 +77,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 12 previous errors
diff --git a/tests/ui/consts/invalid-union.32bit.stderr b/tests/ui/consts/invalid-union.32bit.stderr
index b6cf060e5..32b67a130 100644
--- a/tests/ui/consts/invalid-union.32bit.stderr
+++ b/tests/ui/consts/invalid-union.32bit.stderr
@@ -6,7 +6,7 @@ LL | fn main() {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc7──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
note: erroneous constant encountered
@@ -20,6 +20,8 @@ note: erroneous constant encountered
|
LL | let _: &'static _ = &C;
| ^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/invalid-union.64bit.stderr b/tests/ui/consts/invalid-union.64bit.stderr
index e3a3ef62c..45f999eb2 100644
--- a/tests/ui/consts/invalid-union.64bit.stderr
+++ b/tests/ui/consts/invalid-union.64bit.stderr
@@ -6,7 +6,7 @@ LL | fn main() {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc7────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
note: erroneous constant encountered
@@ -20,6 +20,8 @@ note: erroneous constant encountered
|
LL | let _: &'static _ = &C;
| ^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/issue-102117.stderr b/tests/ui/consts/issue-102117.stderr
index f42bcf90f..da92db87f 100644
--- a/tests/ui/consts/issue-102117.stderr
+++ b/tests/ui/consts/issue-102117.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-102117.rs:19:26
|
LL | type_id: TypeId::of::<T>(),
- | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | pub fn new<T: 'static>() -> &'static Self {
| +++++++++
@@ -13,9 +16,13 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-102117.rs:19:26
|
LL | type_id: TypeId::of::<T>(),
- | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider adding an explicit lifetime bound
|
LL | pub fn new<T: 'static>() -> &'static Self {
| +++++++++
diff --git a/tests/ui/consts/issue-116186.rs b/tests/ui/consts/issue-116186.rs
new file mode 100644
index 000000000..a77c38c64
--- /dev/null
+++ b/tests/ui/consts/issue-116186.rs
@@ -0,0 +1,12 @@
+#![allow(incomplete_features)]
+#![feature(generic_const_exprs)]
+
+fn something(path: [usize; N]) -> impl Clone {
+ //~^ ERROR cannot find value `N` in this scope
+ match path {
+ [] => 0, //~ ERROR cannot pattern-match on an array without a fixed length
+ _ => 1,
+ };
+}
+
+fn main() {}
diff --git a/tests/ui/consts/issue-116186.stderr b/tests/ui/consts/issue-116186.stderr
new file mode 100644
index 000000000..e6eae2d9f
--- /dev/null
+++ b/tests/ui/consts/issue-116186.stderr
@@ -0,0 +1,21 @@
+error[E0425]: cannot find value `N` in this scope
+ --> $DIR/issue-116186.rs:4:28
+ |
+LL | fn something(path: [usize; N]) -> impl Clone {
+ | ^ not found in this scope
+ |
+help: you might be missing a const parameter
+ |
+LL | fn something<const N: /* Type */>(path: [usize; N]) -> impl Clone {
+ | +++++++++++++++++++++
+
+error[E0730]: cannot pattern-match on an array without a fixed length
+ --> $DIR/issue-116186.rs:7:9
+ |
+LL | [] => 0,
+ | ^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0425, E0730.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/tests/ui/consts/issue-17718-const-bad-values.stderr b/tests/ui/consts/issue-17718-const-bad-values.stderr
index ce60aaa07..405c2195d 100644
--- a/tests/ui/consts/issue-17718-const-bad-values.stderr
+++ b/tests/ui/consts/issue-17718-const-bad-values.stderr
@@ -19,6 +19,7 @@ LL | const C2: &'static mut usize = unsafe { &mut S };
| ^
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/issue-34784.rs b/tests/ui/consts/issue-34784.rs
deleted file mode 100644
index 98d943470..000000000
--- a/tests/ui/consts/issue-34784.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// run-pass
-
-#![warn(pointer_structural_match)]
-#![allow(dead_code)]
-const C: *const u8 = &0;
-
-fn foo(x: *const u8) {
- match x {
- C => {}
- _ => {}
- }
-}
-
-const D: *const [u8; 4] = b"abcd";
-
-fn main() {
- match D {
- D => {}
- _ => {}
- }
-}
diff --git a/tests/ui/consts/issue-39974.rs b/tests/ui/consts/issue-39974.rs
index 503647ef4..9cb180014 100644
--- a/tests/ui/consts/issue-39974.rs
+++ b/tests/ui/consts/issue-39974.rs
@@ -1,4 +1,5 @@
const LENGTH: f64 = 2;
+//~^ ERROR mismatched types
struct Thing {
f: [[f64; 2]; LENGTH],
diff --git a/tests/ui/consts/issue-39974.stderr b/tests/ui/consts/issue-39974.stderr
index 56365e51e..4bde59903 100644
--- a/tests/ui/consts/issue-39974.stderr
+++ b/tests/ui/consts/issue-39974.stderr
@@ -1,9 +1,18 @@
error[E0308]: mismatched types
- --> $DIR/issue-39974.rs:4:19
+ --> $DIR/issue-39974.rs:5:19
|
LL | f: [[f64; 2]; LENGTH],
| ^^^^^^ expected `usize`, found `f64`
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/issue-39974.rs:1:21
+ |
+LL | const LENGTH: f64 = 2;
+ | ^
+ | |
+ | expected `f64`, found integer
+ | help: use a float literal: `2.0`
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/consts/issue-63952.32bit.stderr b/tests/ui/consts/issue-63952.32bit.stderr
index 755c7fb7d..5375ec118 100644
--- a/tests/ui/consts/issue-63952.32bit.stderr
+++ b/tests/ui/consts/issue-63952.32bit.stderr
@@ -6,7 +6,7 @@ LL | const SLICE_WAY_TOO_LONG: &[u8] = unsafe {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
- ╾─alloc4──╼ ff ff ff ff │ ╾──╼....
+ ╾ALLOC0╼ ff ff ff ff │ ╾──╼....
}
error: aborting due to previous error
diff --git a/tests/ui/consts/issue-63952.64bit.stderr b/tests/ui/consts/issue-63952.64bit.stderr
index abdb9a4f7..a6edbf932 100644
--- a/tests/ui/consts/issue-63952.64bit.stderr
+++ b/tests/ui/consts/issue-63952.64bit.stderr
@@ -6,7 +6,7 @@ LL | const SLICE_WAY_TOO_LONG: &[u8] = unsafe {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
- ╾───────alloc4────────╼ ff ff ff ff ff ff ff ff │ ╾──────╼........
+ ╾ALLOC0╼ ff ff ff ff ff ff ff ff │ ╾──────╼........
}
error: aborting due to previous error
diff --git a/tests/ui/consts/issue-67696-const-prop-ice.rs b/tests/ui/consts/issue-67696-const-prop-ice.rs
index ad52608b3..858035190 100644
--- a/tests/ui/consts/issue-67696-const-prop-ice.rs
+++ b/tests/ui/consts/issue-67696-const-prop-ice.rs
@@ -1,5 +1,5 @@
// check-pass
-// compile-flags: --emit=mir,link
+// compile-flags: --emit=mir,link -Zmir-opt-level=4
// Checks that we don't ICE due to attempting to run const prop
// on a function with unsatisifable 'where' clauses
diff --git a/tests/ui/consts/issue-79690.64bit.stderr b/tests/ui/consts/issue-79690.64bit.stderr
index b8798a975..af59729d4 100644
--- a/tests/ui/consts/issue-79690.64bit.stderr
+++ b/tests/ui/consts/issue-79690.64bit.stderr
@@ -6,7 +6,7 @@ LL | const G: Fat = unsafe { Transmute { t: FOO }.u };
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
- ╾───────alloc3────────╼ ╾───────alloc4────────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──────╼╾──────╼
}
error: aborting due to previous error
diff --git a/tests/ui/consts/miri_unleashed/assoc_const.stderr b/tests/ui/consts/miri_unleashed/assoc_const.stderr
index 274b1de7e..b129aef34 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const.stderr
@@ -24,6 +24,8 @@ note: erroneous constant encountered
|
LL | let y = <String as Bar<Vec<u32>, String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: skipping const checks
|
diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
index c8e4cab4e..46408f674 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
@@ -15,6 +15,8 @@ note: erroneous constant encountered
|
LL | let y = <String as Bar<String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr
index a6f467b9e..4a3344a5b 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr
@@ -24,7 +24,7 @@ LL | const REF_INTERIOR_MUT: &usize = {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc4──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error[E0080]: it is undefined behavior to use this value
@@ -35,7 +35,7 @@ LL | const READ_IMMUT: &usize = {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc5──╼ │ ╾──╼
+ ╾ALLOC1╼ │ ╾──╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr
index cfaf31a6e..7573bfa39 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr
@@ -24,7 +24,7 @@ LL | const REF_INTERIOR_MUT: &usize = {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc4────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error[E0080]: it is undefined behavior to use this value
@@ -35,7 +35,7 @@ LL | const READ_IMMUT: &usize = {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc5────────╼ │ ╾──────╼
+ ╾ALLOC1╼ │ ╾──────╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
index e3a0d93f0..492d8718a 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
@@ -6,7 +6,7 @@ LL | const SLICE_MUT: &[u8; 1] = {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc1──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error: could not evaluate constant pattern
@@ -23,7 +23,7 @@ LL | const U8_MUT: &u8 = {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc1──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error: could not evaluate constant pattern
@@ -108,6 +108,11 @@ help: skipping check that does not even have a feature gate
|
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+ --> $DIR/const_refers_to_static_cross_crate.rs:27:20
+ |
+LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors; 1 warning emitted
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
index a323e9a05..f6d82d6c0 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
@@ -6,7 +6,7 @@ LL | const SLICE_MUT: &[u8; 1] = {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc1────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error: could not evaluate constant pattern
@@ -23,7 +23,7 @@ LL | const U8_MUT: &u8 = {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc1────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error: could not evaluate constant pattern
@@ -108,6 +108,11 @@ help: skipping check that does not even have a feature gate
|
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+ --> $DIR/const_refers_to_static_cross_crate.rs:27:20
+ |
+LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 8 previous errors; 1 warning emitted
diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr b/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
index 0ea179240..c9da91a95 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
+++ b/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
@@ -6,7 +6,7 @@ LL | const MUH: Meh = Meh {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc3──╼ │ ╾──╼
+ ╾ALLOC0╼ │ ╾──╼
}
error[E0080]: it is undefined behavior to use this value
@@ -17,7 +17,7 @@ LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 4) {
- ╾─alloc7──╼ ╾─alloc8──╼ │ ╾──╼╾──╼
+ ╾ALLOC1╼ ╾ALLOC2╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
@@ -28,7 +28,7 @@ LL | const BLUNT: &mut i32 = &mut 42;
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc10─╼ │ ╾──╼
+ ╾ALLOC3╼ │ ╾──╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr b/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
index 67959d256..71be616b7 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
+++ b/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
@@ -6,7 +6,7 @@ LL | const MUH: Meh = Meh {
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc3────────╼ │ ╾──────╼
+ ╾ALLOC0╼ │ ╾──────╼
}
error[E0080]: it is undefined behavior to use this value
@@ -17,7 +17,7 @@ LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 16, align: 8) {
- ╾───────alloc7────────╼ ╾───────alloc8────────╼ │ ╾──────╼╾──────╼
+ ╾ALLOC1╼ ╾ALLOC2╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
@@ -28,7 +28,7 @@ LL | const BLUNT: &mut i32 = &mut 42;
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc10───────╼ │ ╾──────╼
+ ╾ALLOC3╼ │ ╾──────╼
}
warning: skipping const checks
diff --git a/tests/ui/consts/miri_unleashed/ptr_arith.rs b/tests/ui/consts/miri_unleashed/ptr_arith.rs
index 5cda3c411..e59c67252 100644
--- a/tests/ui/consts/miri_unleashed/ptr_arith.rs
+++ b/tests/ui/consts/miri_unleashed/ptr_arith.rs
@@ -1,5 +1,4 @@
// compile-flags: -Zunleash-the-miri-inside-of-you
-#![feature(core_intrinsics, pointer_byte_offsets)]
// During CTFE, we prevent pointer-to-int casts.
// Pointer comparisons are prevented in the trait system.
diff --git a/tests/ui/consts/miri_unleashed/ptr_arith.stderr b/tests/ui/consts/miri_unleashed/ptr_arith.stderr
index 25ca6bc4e..213966f90 100644
--- a/tests/ui/consts/miri_unleashed/ptr_arith.stderr
+++ b/tests/ui/consts/miri_unleashed/ptr_arith.stderr
@@ -1,11 +1,11 @@
error[E0080]: could not evaluate static initializer
- --> $DIR/ptr_arith.rs:8:13
+ --> $DIR/ptr_arith.rs:7:13
|
LL | let x = &0 as *const _ as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^ exposing pointers is not possible at compile-time
error[E0080]: could not evaluate static initializer
- --> $DIR/ptr_arith.rs:16:14
+ --> $DIR/ptr_arith.rs:15:14
|
LL | let _v = x + 0;
| ^ unable to turn pointer into integer
@@ -16,7 +16,7 @@ LL | let _v = x + 0;
warning: skipping const checks
|
help: skipping check that does not even have a feature gate
- --> $DIR/ptr_arith.rs:8:13
+ --> $DIR/ptr_arith.rs:7:13
|
LL | let x = &0 as *const _ as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs
index dd2b81c5a..1ac3777f5 100644
--- a/tests/ui/consts/missing_span_in_backtrace.rs
+++ b/tests/ui/consts/missing_span_in_backtrace.rs
@@ -1,5 +1,5 @@
// compile-flags: -Z ui-testing=no
-// normalize-stderr-test "alloc[0-9]+" -> "ALLOC_ID"
+
#![feature(const_swap)]
#![feature(const_mut_refs)]
diff --git a/tests/ui/consts/missing_span_in_backtrace.stderr b/tests/ui/consts/missing_span_in_backtrace.stderr
index fcfb9fbb3..6860cee41 100644
--- a/tests/ui/consts/missing_span_in_backtrace.stderr
+++ b/tests/ui/consts/missing_span_in_backtrace.stderr
@@ -1,7 +1,7 @@
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: unable to copy parts of a pointer from memory at ALLOC_ID
+ = note: unable to copy parts of a pointer from memory at ALLOC0
|
note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
diff --git a/tests/ui/consts/offset_from_ub.stderr b/tests/ui/consts/offset_from_ub.stderr
index 97ff6efdd..1ef727e5b 100644
--- a/tests/ui/consts/offset_from_ub.stderr
+++ b/tests/ui/consts/offset_from_ub.stderr
@@ -39,19 +39,19 @@ error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:53:14
|
LL | unsafe { ptr_offset_from(end_ptr, start_ptr) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: alloc17 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: ALLOC0 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:62:14
|
LL | unsafe { ptr_offset_from(start_ptr, end_ptr) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: alloc20 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: ALLOC1 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:70:14
|
LL | unsafe { ptr_offset_from(end_ptr, end_ptr) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: alloc23 has size 4, so pointer at offset 10 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from`: ALLOC2 has size 4, so pointer at offset 10 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:79:14
diff --git a/tests/ui/consts/offset_ub.rs b/tests/ui/consts/offset_ub.rs
index 1b01e4fd1..db28a6c6a 100644
--- a/tests/ui/consts/offset_ub.rs
+++ b/tests/ui/consts/offset_ub.rs
@@ -1,6 +1,6 @@
use std::ptr;
-// normalize-stderr-test "alloc\d+" -> "allocN"
+
// normalize-stderr-test "0x7f+" -> "0x7f..f"
diff --git a/tests/ui/consts/offset_ub.stderr b/tests/ui/consts/offset_ub.stderr
index c0c851df5..8bc59d50e 100644
--- a/tests/ui/consts/offset_ub.stderr
+++ b/tests/ui/consts/offset_ub.stderr
@@ -14,7 +14,7 @@ LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1)
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC0 has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u8>::offset`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -27,7 +27,7 @@ LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) };
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC1 has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u8>::offset`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -92,7 +92,7 @@ LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).of
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC2 has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u8>::offset`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -105,7 +105,7 @@ LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- = note: out-of-bounds pointer arithmetic: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
+ = note: out-of-bounds pointer arithmetic: ALLOC3 has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
|
note: inside `ptr::const_ptr::<impl *const u8>::offset`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
diff --git a/tests/ui/consts/uninhabited-const-issue-61744.stderr b/tests/ui/consts/uninhabited-const-issue-61744.stderr
index f48e6c4ce..c92824a0d 100644
--- a/tests/ui/consts/uninhabited-const-issue-61744.stderr
+++ b/tests/ui/consts/uninhabited-const-issue-61744.stderr
@@ -656,6 +656,8 @@ note: erroneous constant encountered
|
LL | dbg!(i32::CONSTANT);
| ^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to previous error
diff --git a/tests/ui/generator/addassign-yield.rs b/tests/ui/coroutine/addassign-yield.rs
index 66f22bf31..919a559f8 100644
--- a/tests/ui/generator/addassign-yield.rs
+++ b/tests/ui/coroutine/addassign-yield.rs
@@ -5,7 +5,7 @@
// is being used), we were failing to account for all types that might
// possibly be live across a yield point.
-#![feature(generators)]
+#![feature(coroutines)]
fn foo() {
let _x = static || {
diff --git a/tests/ui/coroutine/async-coroutine-issue-67158.rs b/tests/ui/coroutine/async-coroutine-issue-67158.rs
new file mode 100644
index 000000000..420454656
--- /dev/null
+++ b/tests/ui/coroutine/async-coroutine-issue-67158.rs
@@ -0,0 +1,6 @@
+#![feature(coroutines)]
+// edition:2018
+// Regression test for #67158.
+fn main() {
+ async { yield print!(":C") }; //~ ERROR `async` coroutines are not yet supported
+}
diff --git a/tests/ui/generator/async-generator-issue-67158.stderr b/tests/ui/coroutine/async-coroutine-issue-67158.stderr
index 7270d188e..d583d3d5e 100644
--- a/tests/ui/generator/async-generator-issue-67158.stderr
+++ b/tests/ui/coroutine/async-coroutine-issue-67158.stderr
@@ -1,5 +1,5 @@
-error[E0727]: `async` generators are not yet supported
- --> $DIR/async-generator-issue-67158.rs:5:13
+error[E0727]: `async` coroutines are not yet supported
+ --> $DIR/async-coroutine-issue-67158.rs:5:13
|
LL | async { yield print!(":C") };
| ^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/generator/auto-trait-regions.rs b/tests/ui/coroutine/auto-trait-regions.rs
index aa4218e13..5fce70e8e 100644
--- a/tests/ui/generator/auto-trait-regions.rs
+++ b/tests/ui/coroutine/auto-trait-regions.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
#![feature(auto_traits)]
#![feature(negative_impls)]
@@ -21,7 +21,7 @@ impl<'a> Foo for &'a OnlyFooIfRef {}
fn assert_foo<T: Foo>(f: T) {}
fn main() {
- // Make sure 'static is erased for generator interiors so we can't match it in trait selection
+ // Make sure 'static is erased for coroutine interiors so we can't match it in trait selection
let x: &'static _ = &OnlyFooIfStaticRef(No);
let gen = move || {
let x = x;
@@ -40,7 +40,7 @@ fn main() {
};
assert_foo(gen); // ok
- // Disallow impls which relates lifetimes in the generator interior
+ // Disallow impls which relates lifetimes in the coroutine interior
let gen = move || {
let a = A(&mut true, &mut true, No);
//~^ temporary value dropped while borrowed
diff --git a/tests/ui/generator/auto-trait-regions.stderr b/tests/ui/coroutine/auto-trait-regions.stderr
index a9a0bde2b..a9a0bde2b 100644
--- a/tests/ui/generator/auto-trait-regions.stderr
+++ b/tests/ui/coroutine/auto-trait-regions.stderr
diff --git a/tests/ui/coroutine/auxiliary/metadata-sufficient-for-layout.rs b/tests/ui/coroutine/auxiliary/metadata-sufficient-for-layout.rs
new file mode 100644
index 000000000..dc0521853
--- /dev/null
+++ b/tests/ui/coroutine/auxiliary/metadata-sufficient-for-layout.rs
@@ -0,0 +1,11 @@
+// compile-flags: --emit metadata
+#![feature(coroutines, coroutine_trait)]
+
+use std::marker::Unpin;
+use std::ops::Coroutine;
+
+pub fn g() -> impl Coroutine<(), Yield = (), Return = ()> {
+ || {
+ yield;
+ }
+}
diff --git a/tests/ui/coroutine/auxiliary/unwind-aux.rs b/tests/ui/coroutine/auxiliary/unwind-aux.rs
new file mode 100644
index 000000000..215d67691
--- /dev/null
+++ b/tests/ui/coroutine/auxiliary/unwind-aux.rs
@@ -0,0 +1,11 @@
+// compile-flags: -Cpanic=unwind --crate-type=lib
+// no-prefer-dynamic
+// edition:2021
+
+#![feature(coroutines)]
+pub fn run<T>(a: T) {
+ let _ = move || {
+ drop(a);
+ yield;
+ };
+}
diff --git a/tests/ui/coroutine/auxiliary/xcrate-reachable.rs b/tests/ui/coroutine/auxiliary/xcrate-reachable.rs
new file mode 100644
index 000000000..673153f06
--- /dev/null
+++ b/tests/ui/coroutine/auxiliary/xcrate-reachable.rs
@@ -0,0 +1,14 @@
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+
+fn msg() -> u32 {
+ 0
+}
+
+pub fn foo() -> impl Coroutine<(), Yield = (), Return = u32> {
+ || {
+ yield;
+ return msg();
+ }
+}
diff --git a/tests/ui/coroutine/auxiliary/xcrate.rs b/tests/ui/coroutine/auxiliary/xcrate.rs
new file mode 100644
index 000000000..f749a95ad
--- /dev/null
+++ b/tests/ui/coroutine/auxiliary/xcrate.rs
@@ -0,0 +1,18 @@
+#![feature(coroutines, coroutine_trait)]
+
+use std::marker::Unpin;
+use std::ops::Coroutine;
+
+pub fn foo() -> impl Coroutine<(), Yield = (), Return = ()> {
+ || {
+ if false {
+ yield;
+ }
+ }
+}
+
+pub fn bar<T: 'static>(t: T) -> Box<Coroutine<(), Yield = T, Return = ()> + Unpin> {
+ Box::new(|| {
+ yield t;
+ })
+}
diff --git a/tests/ui/generator/borrow-in-tail-expr.rs b/tests/ui/coroutine/borrow-in-tail-expr.rs
index 540f5e3e1..c1497ad29 100644
--- a/tests/ui/generator/borrow-in-tail-expr.rs
+++ b/tests/ui/coroutine/borrow-in-tail-expr.rs
@@ -1,6 +1,6 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let _a = || {
diff --git a/tests/ui/generator/borrowing.rs b/tests/ui/coroutine/borrowing.rs
index d36592583..778eed8bd 100644
--- a/tests/ui/generator/borrowing.rs
+++ b/tests/ui/coroutine/borrowing.rs
@@ -1,6 +1,6 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/generator/borrowing.stderr b/tests/ui/coroutine/borrowing.stderr
index 38e1ace8c..acd4cdafd 100644
--- a/tests/ui/generator/borrowing.stderr
+++ b/tests/ui/coroutine/borrowing.stderr
@@ -7,7 +7,7 @@ LL | let a = 3;
LL | Pin::new(&mut || yield &a).resume(())
| -- ^ borrowed value does not live long enough
| |
- | value captured here by generator
+ | value captured here by coroutine
LL |
LL | };
| - `a` dropped here while still borrowed
@@ -19,7 +19,7 @@ LL | let _b = {
| -- borrow later stored here
LL | let a = 3;
LL | || {
- | -- value captured here by generator
+ | -- value captured here by coroutine
LL | yield &a
| ^ borrowed value does not live long enough
...
diff --git a/tests/ui/generator/clone-impl-async.rs b/tests/ui/coroutine/clone-impl-async.rs
index 9e9b59d36..e8e82f199 100644
--- a/tests/ui/generator/clone-impl-async.rs
+++ b/tests/ui/coroutine/clone-impl-async.rs
@@ -1,8 +1,8 @@
// edition:2021
-// gate-test-generator_clone
-// Verifies that feature(generator_clone) doesn't allow async blocks to be cloned/copied.
+// gate-test-coroutine_clone
+// Verifies that feature(coroutine_clone) doesn't allow async blocks to be cloned/copied.
-#![feature(generators, generator_clone)]
+#![feature(coroutines, coroutine_clone)]
use std::future::ready;
diff --git a/tests/ui/generator/clone-impl-async.stderr b/tests/ui/coroutine/clone-impl-async.stderr
index d172dff3a..d172dff3a 100644
--- a/tests/ui/generator/clone-impl-async.stderr
+++ b/tests/ui/coroutine/clone-impl-async.stderr
diff --git a/tests/ui/generator/clone-impl-static.rs b/tests/ui/coroutine/clone-impl-static.rs
index 55ed0f281..9a165cf46 100644
--- a/tests/ui/generator/clone-impl-static.rs
+++ b/tests/ui/coroutine/clone-impl-static.rs
@@ -1,7 +1,7 @@
-// gate-test-generator_clone
-// Verifies that static generators cannot be cloned/copied.
+// gate-test-coroutine_clone
+// Verifies that static coroutines cannot be cloned/copied.
-#![feature(generators, generator_clone)]
+#![feature(coroutines, coroutine_clone)]
fn main() {
let gen = static move || {
diff --git a/tests/ui/generator/clone-impl-static.stderr b/tests/ui/coroutine/clone-impl-static.stderr
index 8b51824c7..8fa9fb12b 100644
--- a/tests/ui/generator/clone-impl-static.stderr
+++ b/tests/ui/coroutine/clone-impl-static.stderr
@@ -1,8 +1,8 @@
-error[E0277]: the trait bound `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}: Copy` is not satisfied
+error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:7:15: 7:29}: Copy` is not satisfied
--> $DIR/clone-impl-static.rs:10:16
|
LL | check_copy(&gen);
- | ---------- ^^^^ the trait `Copy` is not implemented for `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}`
+ | ---------- ^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:7:15: 7:29}`
| |
| required by a bound introduced by this call
|
@@ -12,11 +12,11 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}: Clone` is not satisfied
+error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:7:15: 7:29}: Clone` is not satisfied
--> $DIR/clone-impl-static.rs:12:17
|
LL | check_clone(&gen);
- | ----------- ^^^^ the trait `Clone` is not implemented for `{static generator@$DIR/clone-impl-static.rs:7:15: 7:29}`
+ | ----------- ^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:7:15: 7:29}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/generator/clone-impl.rs b/tests/ui/coroutine/clone-impl.rs
index cbfd65a53..eed6f851b 100644
--- a/tests/ui/generator/clone-impl.rs
+++ b/tests/ui/coroutine/clone-impl.rs
@@ -1,8 +1,8 @@
-// gate-test-generator_clone
-// Verifies that non-static generators can be cloned/copied if all their upvars and locals held
+// gate-test-coroutine_clone
+// Verifies that non-static coroutines can be cloned/copied if all their upvars and locals held
// across awaits can be cloned/copied.
-#![feature(generators, generator_clone)]
+#![feature(coroutines, coroutine_clone)]
struct NonClone;
diff --git a/tests/ui/generator/clone-impl.stderr b/tests/ui/coroutine/clone-impl.stderr
index 870216398..82a6d0495 100644
--- a/tests/ui/generator/clone-impl.stderr
+++ b/tests/ui/coroutine/clone-impl.stderr
@@ -1,11 +1,11 @@
-error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`
--> $DIR/clone-impl.rs:42:5
|
LL | let gen_clone_0 = move || {
- | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
+ | ------- within this `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`
...
LL | check_copy(&gen_clone_0);
- | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>`
+ | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:40:14
@@ -18,16 +18,16 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`
--> $DIR/clone-impl.rs:42:5
|
LL | let gen_clone_0 = move || {
- | ------- within this `{generator@$DIR/clone-impl.rs:36:23: 36:30}`
+ | ------- within this `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`
...
LL | check_copy(&gen_clone_0);
- | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>`
+ | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:36:23: 36:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
-note: generator does not implement `Copy` as this value is used across a yield
+note: coroutine does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:38:9
|
LL | let v = vec!['a'];
@@ -40,14 +40,14 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
+error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`
--> $DIR/clone-impl.rs:58:5
|
LL | let gen_clone_1 = move || {
- | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
+ | ------- within this `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`
...
LL | check_copy(&gen_clone_1);
- | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>`
+ | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<u32>`
|
note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:56:14
@@ -60,16 +60,16 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
+error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`
--> $DIR/clone-impl.rs:58:5
|
LL | let gen_clone_1 = move || {
- | ------- within this `{generator@$DIR/clone-impl.rs:46:23: 46:30}`
+ | ------- within this `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`
...
LL | check_copy(&gen_clone_1);
- | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>`
+ | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:46:23: 46:30}`, the trait `Copy` is not implemented for `Vec<char>`
|
-note: generator does not implement `Copy` as this value is used across a yield
+note: coroutine does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:52:9
|
LL | let v = vec!['a'];
@@ -83,14 +83,14 @@ note: required by a bound in `check_copy`
LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy`
-error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
+error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`
--> $DIR/clone-impl.rs:66:5
|
LL | let gen_non_clone = move || {
- | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
+ | ------- within this `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`
...
LL | check_copy(&gen_non_clone);
- | ^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone`
+ | ^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Copy` is not implemented for `NonClone`
|
note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:64:14
@@ -108,14 +108,14 @@ LL + #[derive(Copy)]
LL | struct NonClone;
|
-error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
+error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`
--> $DIR/clone-impl.rs:68:5
|
LL | let gen_non_clone = move || {
- | ------- within this `{generator@$DIR/clone-impl.rs:62:25: 62:32}`
+ | ------- within this `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`
...
LL | check_clone(&gen_non_clone);
- | ^^^^^^^^^^^ within `{generator@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone`
+ | ^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:62:25: 62:32}`, the trait `Clone` is not implemented for `NonClone`
|
note: captured value does not implement `Clone`
--> $DIR/clone-impl.rs:64:14
diff --git a/tests/ui/generator/conditional-drop.rs b/tests/ui/coroutine/conditional-drop.rs
index 0927df869..634095c7a 100644
--- a/tests/ui/generator/conditional-drop.rs
+++ b/tests/ui/coroutine/conditional-drop.rs
@@ -3,9 +3,9 @@
// revisions: default nomiropt
//[nomiropt]compile-flags: -Z mir-opt-level=0
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/tests/ui/generator/control-flow.rs b/tests/ui/coroutine/control-flow.rs
index 4f69c7855..709b135b2 100644
--- a/tests/ui/generator/control-flow.rs
+++ b/tests/ui/coroutine/control-flow.rs
@@ -3,19 +3,19 @@
// revisions: default nomiropt
//[nomiropt]compile-flags: -Z mir-opt-level=0
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::marker::Unpin;
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::pin::Pin;
fn finish<T>(mut amt: usize, mut t: T) -> T::Return
- where T: Generator<(), Yield = ()> + Unpin,
+ where T: Coroutine<(), Yield = ()> + Unpin,
{
loop {
match Pin::new(&mut t).resume(()) {
- GeneratorState::Yielded(()) => amt = amt.checked_sub(1).unwrap(),
- GeneratorState::Complete(ret) => {
+ CoroutineState::Yielded(()) => amt = amt.checked_sub(1).unwrap(),
+ CoroutineState::Complete(ret) => {
assert_eq!(amt, 0);
return ret
}
diff --git a/tests/ui/generator/generator-region-requirements.migrate.stderr b/tests/ui/coroutine/coroutine-region-requirements.migrate.stderr
index 8a96d187f..8a96d187f 100644
--- a/tests/ui/generator/generator-region-requirements.migrate.stderr
+++ b/tests/ui/coroutine/coroutine-region-requirements.migrate.stderr
diff --git a/tests/ui/generator/generator-region-requirements.rs b/tests/ui/coroutine/coroutine-region-requirements.rs
index 7269a79ca..8bc34fdd2 100644
--- a/tests/ui/generator/generator-region-requirements.rs
+++ b/tests/ui/coroutine/coroutine-region-requirements.rs
@@ -1,5 +1,5 @@
-#![feature(generators, generator_trait)]
-use std::ops::{Generator, GeneratorState};
+#![feature(coroutines, coroutine_trait)]
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn dangle(x: &mut i32) -> &'static mut i32 {
@@ -9,9 +9,9 @@ fn dangle(x: &mut i32) -> &'static mut i32 {
};
loop {
match Pin::new(&mut g).resume(()) {
- GeneratorState::Complete(c) => return c,
+ CoroutineState::Complete(c) => return c,
//~^ ERROR lifetime may not live long enough
- GeneratorState::Yielded(_) => (),
+ CoroutineState::Yielded(_) => (),
}
}
}
diff --git a/tests/ui/generator/generator-region-requirements.stderr b/tests/ui/coroutine/coroutine-region-requirements.stderr
index 87f604672..ad3183e76 100644
--- a/tests/ui/generator/generator-region-requirements.stderr
+++ b/tests/ui/coroutine/coroutine-region-requirements.stderr
@@ -1,10 +1,10 @@
error: lifetime may not live long enough
- --> $DIR/generator-region-requirements.rs:12:51
+ --> $DIR/coroutine-region-requirements.rs:12:51
|
LL | fn dangle(x: &mut i32) -> &'static mut i32 {
| - let's call the lifetime of this reference `'1`
...
-LL | GeneratorState::Complete(c) => return c,
+LL | CoroutineState::Complete(c) => return c,
| ^ returning this value requires that `'1` must outlive `'static`
error: aborting due to previous error
diff --git a/tests/ui/generator/generator-resume-after-panic.rs b/tests/ui/coroutine/coroutine-resume-after-panic.rs
index f2e67f1f7..5915f5ad9 100644
--- a/tests/ui/generator/generator-resume-after-panic.rs
+++ b/tests/ui/coroutine/coroutine-resume-after-panic.rs
@@ -1,14 +1,14 @@
// run-fail
// needs-unwind
-// error-pattern:generator resumed after panicking
+// error-pattern:coroutine resumed after panicking
// ignore-emscripten no processes
-// Test that we get the correct message for resuming a panicked generator.
+// Test that we get the correct message for resuming a panicked coroutine.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::{
- ops::Generator,
+ ops::Coroutine,
pin::Pin,
panic,
};
diff --git a/tests/ui/generator/generator-with-nll.rs b/tests/ui/coroutine/coroutine-with-nll.rs
index cee3e6d22..28a3643fb 100644
--- a/tests/ui/generator/generator-with-nll.rs
+++ b/tests/ui/coroutine/coroutine-with-nll.rs
@@ -1,11 +1,11 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
|| {
// The reference in `_a` is a Legal with NLL since it ends before the yield
let _a = &mut true;
let b = &mut true;
- //~^ borrow may still be in use when generator yields
+ //~^ borrow may still be in use when coroutine yields
yield ();
println!("{}", b);
};
diff --git a/tests/ui/generator/generator-with-nll.stderr b/tests/ui/coroutine/coroutine-with-nll.stderr
index 14199aeb9..ed58debe2 100644
--- a/tests/ui/generator/generator-with-nll.stderr
+++ b/tests/ui/coroutine/coroutine-with-nll.stderr
@@ -1,5 +1,5 @@
-error[E0626]: borrow may still be in use when generator yields
- --> $DIR/generator-with-nll.rs:7:17
+error[E0626]: borrow may still be in use when coroutine yields
+ --> $DIR/coroutine-with-nll.rs:7:17
|
LL | let b = &mut true;
| ^^^^^^^^^
diff --git a/tests/ui/coroutine/coroutine-yielding-or-returning-itself.rs b/tests/ui/coroutine/coroutine-yielding-or-returning-itself.rs
new file mode 100644
index 000000000..3c91b3c93
--- /dev/null
+++ b/tests/ui/coroutine/coroutine-yielding-or-returning-itself.rs
@@ -0,0 +1,35 @@
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
+
+// Test that we cannot create a coroutine that returns a value of its
+// own type.
+
+use std::ops::Coroutine;
+
+pub fn want_cyclic_coroutine_return<T>(_: T)
+ where T: Coroutine<Yield = (), Return = T>
+{
+}
+
+fn supply_cyclic_coroutine_return() {
+ want_cyclic_coroutine_return(|| {
+ //~^ ERROR type mismatch
+ if false { yield None.unwrap(); }
+ None.unwrap()
+ })
+}
+
+pub fn want_cyclic_coroutine_yield<T>(_: T)
+ where T: Coroutine<Yield = T, Return = ()>
+{
+}
+
+fn supply_cyclic_coroutine_yield() {
+ want_cyclic_coroutine_yield(|| {
+ //~^ ERROR type mismatch
+ if false { yield None.unwrap(); }
+ None.unwrap()
+ })
+}
+
+fn main() { }
diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.stderr b/tests/ui/coroutine/coroutine-yielding-or-returning-itself.stderr
index 7841a0854..325030524 100644
--- a/tests/ui/generator/generator-yielding-or-returning-itself.stderr
+++ b/tests/ui/coroutine/coroutine-yielding-or-returning-itself.stderr
@@ -1,7 +1,7 @@
-error[E0271]: type mismatch resolving `<{generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36} as Generator>::Return == {generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36}`
- --> $DIR/generator-yielding-or-returning-itself.rs:15:34
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine-yielding-or-returning-itself.rs:15:34: 15:36} as Coroutine>::Return == {coroutine@$DIR/coroutine-yielding-or-returning-itself.rs:15:34: 15:36}`
+ --> $DIR/coroutine-yielding-or-returning-itself.rs:15:34
|
-LL | want_cyclic_generator_return(|| {
+LL | want_cyclic_coroutine_return(|| {
| _____----------------------------_^
| | |
| | required by a bound introduced by this call
@@ -15,18 +15,18 @@ LL | | })
this error may be the result of a recent compiler bug-fix,
see issue #46062 <https://github.com/rust-lang/rust/issues/46062>
for more information
-note: required by a bound in `want_cyclic_generator_return`
- --> $DIR/generator-yielding-or-returning-itself.rs:10:36
+note: required by a bound in `want_cyclic_coroutine_return`
+ --> $DIR/coroutine-yielding-or-returning-itself.rs:10:36
|
-LL | pub fn want_cyclic_generator_return<T>(_: T)
+LL | pub fn want_cyclic_coroutine_return<T>(_: T)
| ---------------------------- required by a bound in this function
-LL | where T: Generator<Yield = (), Return = T>
- | ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return`
+LL | where T: Coroutine<Yield = (), Return = T>
+ | ^^^^^^^^^^ required by this bound in `want_cyclic_coroutine_return`
-error[E0271]: type mismatch resolving `<{generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35} as Generator>::Yield == {generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35}`
- --> $DIR/generator-yielding-or-returning-itself.rs:28:33
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine-yielding-or-returning-itself.rs:28:33: 28:35} as Coroutine>::Yield == {coroutine@$DIR/coroutine-yielding-or-returning-itself.rs:28:33: 28:35}`
+ --> $DIR/coroutine-yielding-or-returning-itself.rs:28:33
|
-LL | want_cyclic_generator_yield(|| {
+LL | want_cyclic_coroutine_yield(|| {
| _____---------------------------_^
| | |
| | required by a bound introduced by this call
@@ -40,13 +40,13 @@ LL | | })
this error may be the result of a recent compiler bug-fix,
see issue #46062 <https://github.com/rust-lang/rust/issues/46062>
for more information
-note: required by a bound in `want_cyclic_generator_yield`
- --> $DIR/generator-yielding-or-returning-itself.rs:23:24
+note: required by a bound in `want_cyclic_coroutine_yield`
+ --> $DIR/coroutine-yielding-or-returning-itself.rs:23:24
|
-LL | pub fn want_cyclic_generator_yield<T>(_: T)
+LL | pub fn want_cyclic_coroutine_yield<T>(_: T)
| --------------------------- required by a bound in this function
-LL | where T: Generator<Yield = T, Return = ()>
- | ^^^^^^^^^ required by this bound in `want_cyclic_generator_yield`
+LL | where T: Coroutine<Yield = T, Return = ()>
+ | ^^^^^^^^^ required by this bound in `want_cyclic_coroutine_yield`
error: aborting due to 2 previous errors
diff --git a/tests/ui/generator/derived-drop-parent-expr.rs b/tests/ui/coroutine/derived-drop-parent-expr.rs
index e38192451..59a3e8478 100644
--- a/tests/ui/generator/derived-drop-parent-expr.rs
+++ b/tests/ui/coroutine/derived-drop-parent-expr.rs
@@ -1,7 +1,7 @@
// build-pass
//! Like drop-tracking-parent-expression, but also tests that this doesn't ICE when building MIR
-#![feature(generators)]
+#![feature(coroutines)]
fn assert_send<T: Send>(_thing: T) {}
diff --git a/tests/ui/generator/discriminant.rs b/tests/ui/coroutine/discriminant.rs
index 195e77022..73bdd9c86 100644
--- a/tests/ui/generator/discriminant.rs
+++ b/tests/ui/coroutine/discriminant.rs
@@ -1,12 +1,12 @@
-//! Tests that generator discriminant sizes and ranges are chosen optimally and that they are
+//! Tests that coroutine discriminant sizes and ranges are chosen optimally and that they are
//! reflected in the output of `mem::discriminant`.
// run-pass
-#![feature(generators, generator_trait, core_intrinsics, discriminant_kind)]
+#![feature(coroutines, coroutine_trait, core_intrinsics, discriminant_kind)]
use std::intrinsics::discriminant_value;
-use std::marker::{Unpin, DiscriminantKind};
+use std::marker::{DiscriminantKind, Unpin};
use std::mem::size_of_val;
use std::{cmp, ops::*};
@@ -66,16 +66,16 @@ macro_rules! yield250 {
}
fn cycle(
- gen: impl Generator<()> + Unpin + DiscriminantKind<Discriminant = u32>,
- expected_max_discr: u32
+ gen: impl Coroutine<()> + Unpin + DiscriminantKind<Discriminant = u32>,
+ expected_max_discr: u32,
) {
let mut gen = Box::pin(gen);
let mut max_discr = 0;
loop {
max_discr = cmp::max(max_discr, discriminant_value(gen.as_mut().get_mut()));
match gen.as_mut().resume(()) {
- GeneratorState::Yielded(_) => {}
- GeneratorState::Complete(_) => {
+ CoroutineState::Yielded(_) => {}
+ CoroutineState::Complete(_) => {
assert_eq!(max_discr, expected_max_discr);
return;
}
diff --git a/tests/ui/generator/drop-and-replace.rs b/tests/ui/coroutine/drop-and-replace.rs
index a9a50a122..38b757fac 100644
--- a/tests/ui/generator/drop-and-replace.rs
+++ b/tests/ui/coroutine/drop-and-replace.rs
@@ -1,19 +1,19 @@
// run-pass
// Regression test for incorrect DropAndReplace behavior introduced in #60840
// and fixed in #61373. When combined with the optimization implemented in
-// #60187, this produced incorrect code for generators when a saved local was
+// #60187, this produced incorrect code for coroutines when a saved local was
// re-assigned.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
#[derive(Debug, PartialEq)]
struct Foo(i32);
impl Drop for Foo {
- fn drop(&mut self) { }
+ fn drop(&mut self) {}
}
fn main() {
@@ -38,7 +38,7 @@ fn main() {
loop {
match Pin::new(&mut a).resume(()) {
- GeneratorState::Complete(()) => break,
+ CoroutineState::Complete(()) => break,
_ => (),
}
}
diff --git a/tests/ui/generator/drop-control-flow.rs b/tests/ui/coroutine/drop-control-flow.rs
index 1c25c06ba..55d08b8d5 100644
--- a/tests/ui/generator/drop-control-flow.rs
+++ b/tests/ui/coroutine/drop-control-flow.rs
@@ -1,10 +1,10 @@
// build-pass
-// A test to ensure generators capture values that were conditionally dropped,
+// A test to ensure coroutines capture values that were conditionally dropped,
// and also that values that are dropped along all paths to a yield do not get
-// included in the generator type.
+// included in the coroutine type.
-#![feature(generators, negative_impls)]
+#![feature(coroutines, negative_impls)]
#![allow(unused_assignments, dead_code)]
struct Ptr;
diff --git a/tests/ui/generator/drop-env.rs b/tests/ui/coroutine/drop-env.rs
index 137a40793..404c04343 100644
--- a/tests/ui/generator/drop-env.rs
+++ b/tests/ui/coroutine/drop-env.rs
@@ -3,10 +3,10 @@
// revisions: default nomiropt
//[nomiropt]compile-flags: -Z mir-opt-level=0
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
#![allow(dropping_copy_types)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/tests/ui/generator/drop-track-addassign-yield.rs b/tests/ui/coroutine/drop-track-addassign-yield.rs
index 1e64f1d2e..6c5897458 100644
--- a/tests/ui/generator/drop-track-addassign-yield.rs
+++ b/tests/ui/coroutine/drop-track-addassign-yield.rs
@@ -3,7 +3,7 @@
// Based on addassign-yield.rs, but with drop tracking enabled. Originally we did not implement
// the fake_read callback on ExprUseVisitor which caused this case to break.
-#![feature(generators)]
+#![feature(coroutines)]
fn foo() {
let _y = static || {
diff --git a/tests/ui/generator/drop-tracking-parent-expression.rs b/tests/ui/coroutine/drop-tracking-parent-expression.rs
index 198b14528..4d40192c0 100644
--- a/tests/ui/generator/drop-tracking-parent-expression.rs
+++ b/tests/ui/coroutine/drop-tracking-parent-expression.rs
@@ -1,4 +1,4 @@
-#![feature(generators, negative_impls, rustc_attrs)]
+#![feature(coroutines, negative_impls, rustc_attrs)]
macro_rules! type_combinations {
(
diff --git a/tests/ui/generator/drop-tracking-parent-expression.stderr b/tests/ui/coroutine/drop-tracking-parent-expression.stderr
index e85bb1347..6cd4ec833 100644
--- a/tests/ui/generator/drop-tracking-parent-expression.stderr
+++ b/tests/ui/coroutine/drop-tracking-parent-expression.stderr
@@ -1,8 +1,8 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -13,8 +13,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
+ = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
@@ -38,11 +38,11 @@ LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -53,8 +53,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
+ = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
@@ -78,11 +78,11 @@ LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/drop-tracking-parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -93,8 +93,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `{generator@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
+ = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-tracking-parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
diff --git a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs b/tests/ui/coroutine/drop-tracking-yielding-in-match-guards.rs
index 92e0136d5..622765d82 100644
--- a/tests/ui/generator/drop-tracking-yielding-in-match-guards.rs
+++ b/tests/ui/coroutine/drop-tracking-yielding-in-match-guards.rs
@@ -1,7 +1,7 @@
// build-pass
// edition:2018
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let _ = static |x: u8| match x {
diff --git a/tests/ui/generator/drop-yield-twice.rs b/tests/ui/coroutine/drop-yield-twice.rs
index f484cbb8d..015343a27 100644
--- a/tests/ui/generator/drop-yield-twice.rs
+++ b/tests/ui/coroutine/drop-yield-twice.rs
@@ -1,10 +1,10 @@
-#![feature(negative_impls, generators)]
+#![feature(negative_impls, coroutines)]
struct Foo(i32);
impl !Send for Foo {}
fn main() {
- assert_send(|| { //~ ERROR generator cannot be sent between threads safely
+ assert_send(|| { //~ ERROR coroutine cannot be sent between threads safely
let guard = Foo(42);
yield;
drop(guard);
diff --git a/tests/ui/generator/drop-yield-twice.stderr b/tests/ui/coroutine/drop-yield-twice.stderr
index 39a906f0b..fbbedac57 100644
--- a/tests/ui/generator/drop-yield-twice.stderr
+++ b/tests/ui/coroutine/drop-yield-twice.stderr
@@ -1,11 +1,11 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/drop-yield-twice.rs:7:5
|
LL | assert_send(|| {
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
|
- = help: within `{generator@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo`
-note: generator is not `Send` as this value is used across a yield
+ = help: within `{coroutine@$DIR/drop-yield-twice.rs:7:17: 7:19}`, the trait `Send` is not implemented for `Foo`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/drop-yield-twice.rs:9:9
|
LL | let guard = Foo(42);
diff --git a/tests/ui/generator/dropck-resume.rs b/tests/ui/coroutine/dropck-resume.rs
index 4c18077f3..07ca4d37a 100644
--- a/tests/ui/generator/dropck-resume.rs
+++ b/tests/ui/coroutine/dropck-resume.rs
@@ -1,6 +1,6 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
struct SetToNone<'a: 'b, 'b>(&'b mut Option<&'a i32>);
@@ -11,7 +11,7 @@ impl<'a, 'b> Drop for SetToNone<'a, 'b> {
}
}
-fn drop_using_generator() -> i32 {
+fn drop_using_coroutine() -> i32 {
let mut y = Some(&0);
let z = &mut y;
let r;
@@ -29,5 +29,5 @@ fn drop_using_generator() -> i32 {
}
fn main() {
- println!("{}", drop_using_generator());
+ println!("{}", drop_using_coroutine());
}
diff --git a/tests/ui/generator/dropck-resume.stderr b/tests/ui/coroutine/dropck-resume.stderr
index ecf92e7e3..028523978 100644
--- a/tests/ui/generator/dropck-resume.stderr
+++ b/tests/ui/coroutine/dropck-resume.stderr
@@ -8,7 +8,7 @@ LL | r = y.as_ref().unwrap();
| ^ immutable borrow occurs here
LL |
LL | }
- | - mutable borrow might be used here, when `g` is dropped and runs the destructor for generator
+ | - mutable borrow might be used here, when `g` is dropped and runs the destructor for coroutine
error: aborting due to previous error
diff --git a/tests/ui/generator/dropck.rs b/tests/ui/coroutine/dropck.rs
index f82111a76..450361c8d 100644
--- a/tests/ui/generator/dropck.rs
+++ b/tests/ui/coroutine/dropck.rs
@@ -1,7 +1,7 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::cell::RefCell;
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
@@ -11,7 +11,7 @@ fn main() {
//~^ ERROR `*cell` does not live long enough [E0597]
// the upvar is the non-dropck `&mut Option<Ref<'a, i32>>`.
gen = || {
- // but the generator can use it to drop a `Ref<'a, i32>`.
+ // but the coroutine can use it to drop a `Ref<'a, i32>`.
let _d = ref_.take(); //~ ERROR `ref_` does not live long enough
yield;
};
diff --git a/tests/ui/generator/dropck.stderr b/tests/ui/coroutine/dropck.stderr
index 246ac99f8..241d6dfe0 100644
--- a/tests/ui/generator/dropck.stderr
+++ b/tests/ui/coroutine/dropck.stderr
@@ -11,7 +11,7 @@ LL | }
| -
| |
| `*cell` dropped here while still borrowed
- | borrow might be used here, when `gen` is dropped and runs the destructor for generator
+ | borrow might be used here, when `gen` is dropped and runs the destructor for coroutine
|
= note: values in a scope are dropped in the opposite order they are defined
@@ -19,8 +19,8 @@ error[E0597]: `ref_` does not live long enough
--> $DIR/dropck.rs:15:18
|
LL | gen = || {
- | -- value captured here by generator
-LL | // but the generator can use it to drop a `Ref<'a, i32>`.
+ | -- value captured here by coroutine
+LL | // but the coroutine can use it to drop a `Ref<'a, i32>`.
LL | let _d = ref_.take();
| ^^^^ borrowed value does not live long enough
...
@@ -28,7 +28,7 @@ LL | }
| -
| |
| `ref_` dropped here while still borrowed
- | borrow might be used here, when `gen` is dropped and runs the destructor for generator
+ | borrow might be used here, when `gen` is dropped and runs the destructor for coroutine
|
= note: values in a scope are dropped in the opposite order they are defined
diff --git a/tests/ui/coroutine/gen_block.e2024.stderr b/tests/ui/coroutine/gen_block.e2024.stderr
new file mode 100644
index 000000000..f250e2f79
--- /dev/null
+++ b/tests/ui/coroutine/gen_block.e2024.stderr
@@ -0,0 +1,19 @@
+error[E0658]: yield syntax is experimental
+ --> $DIR/gen_block.rs:15:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0282]: type annotations needed
+ --> $DIR/gen_block.rs:6:17
+ |
+LL | let x = gen {};
+ | ^^ cannot infer type
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0282, E0658.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/coroutine/gen_block.none.stderr b/tests/ui/coroutine/gen_block.none.stderr
new file mode 100644
index 000000000..012a8308c
--- /dev/null
+++ b/tests/ui/coroutine/gen_block.none.stderr
@@ -0,0 +1,49 @@
+error: expected identifier, found reserved keyword `yield`
+ --> $DIR/gen_block.rs:9:19
+ |
+LL | let y = gen { yield 42 };
+ | --- ^^^^^ expected identifier, found reserved keyword
+ | |
+ | while parsing this struct
+
+error[E0422]: cannot find struct, variant or union type `gen` in this scope
+ --> $DIR/gen_block.rs:6:13
+ |
+LL | let x = gen {};
+ | ^^^ not found in this scope
+
+error[E0422]: cannot find struct, variant or union type `gen` in this scope
+ --> $DIR/gen_block.rs:9:13
+ |
+LL | let y = gen { yield 42 };
+ | ^^^ not found in this scope
+
+error[E0422]: cannot find struct, variant or union type `gen` in this scope
+ --> $DIR/gen_block.rs:12:5
+ |
+LL | gen {};
+ | ^^^ not found in this scope
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/gen_block.rs:15:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/gen_block.rs:15:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0422, E0658.
+For more information about an error, try `rustc --explain E0422`.
diff --git a/tests/ui/coroutine/gen_block.rs b/tests/ui/coroutine/gen_block.rs
new file mode 100644
index 000000000..852c7c455
--- /dev/null
+++ b/tests/ui/coroutine/gen_block.rs
@@ -0,0 +1,17 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+#![cfg_attr(e2024, feature(gen_blocks))]
+
+fn main() {
+ let x = gen {};
+ //[none]~^ ERROR: cannot find
+ //[e2024]~^^ ERROR: type annotations needed
+ let y = gen { yield 42 };
+ //[none]~^ ERROR: found reserved keyword `yield`
+ //[none]~| ERROR: cannot find
+ gen {};
+ //[none]~^ ERROR: cannot find
+
+ let _ = || yield true; //[none]~ ERROR yield syntax is experimental
+ //~^ ERROR yield syntax is experimental
+}
diff --git a/tests/ui/coroutine/gen_block_is_coro.rs b/tests/ui/coroutine/gen_block_is_coro.rs
new file mode 100644
index 000000000..c66ccefba
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_coro.rs
@@ -0,0 +1,18 @@
+//compile-flags: --edition 2024 -Zunstable-options
+#![feature(coroutines, coroutine_trait, gen_blocks)]
+
+use std::ops::Coroutine;
+
+fn foo() -> impl Coroutine<Yield = u32, Return = ()> { //~ ERROR: Coroutine` is not satisfied
+ gen { yield 42 }
+}
+
+fn bar() -> impl Coroutine<Yield = i64, Return = ()> { //~ ERROR: Coroutine` is not satisfied
+ gen { yield 42 }
+}
+
+fn baz() -> impl Coroutine<Yield = i32, Return = ()> { //~ ERROR: Coroutine` is not satisfied
+ gen { yield 42 }
+}
+
+fn main() {}
diff --git a/tests/ui/coroutine/gen_block_is_coro.stderr b/tests/ui/coroutine/gen_block_is_coro.stderr
new file mode 100644
index 000000000..83a674fa5
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_coro.stderr
@@ -0,0 +1,21 @@
+error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:21}: Coroutine` is not satisfied
+ --> $DIR/gen_block_is_coro.rs:6:13
+ |
+LL | fn foo() -> impl Coroutine<Yield = u32, Return = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:21}`
+
+error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:21}: Coroutine` is not satisfied
+ --> $DIR/gen_block_is_coro.rs:10:13
+ |
+LL | fn bar() -> impl Coroutine<Yield = i64, Return = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:21}`
+
+error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:21}: Coroutine` is not satisfied
+ --> $DIR/gen_block_is_coro.rs:14:13
+ |
+LL | fn baz() -> impl Coroutine<Yield = i32, Return = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:21}`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/coroutine/gen_block_is_iter.rs b/tests/ui/coroutine/gen_block_is_iter.rs
new file mode 100644
index 000000000..92625cf7c
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_iter.rs
@@ -0,0 +1,19 @@
+// revisions: next old
+//compile-flags: --edition 2024 -Zunstable-options
+//[next] compile-flags: -Ztrait-solver=next
+// check-pass
+#![feature(gen_blocks)]
+
+fn foo() -> impl Iterator<Item = u32> {
+ gen { yield 42 }
+}
+
+fn bar() -> impl Iterator<Item = i64> {
+ gen { yield 42 }
+}
+
+fn baz() -> impl Iterator<Item = i32> {
+ gen { yield 42 }
+}
+
+fn main() {}
diff --git a/tests/ui/coroutine/gen_block_is_no_future.rs b/tests/ui/coroutine/gen_block_is_no_future.rs
new file mode 100644
index 000000000..947665197
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_no_future.rs
@@ -0,0 +1,8 @@
+//compile-flags: --edition 2024 -Zunstable-options
+#![feature(gen_blocks)]
+
+fn foo() -> impl std::future::Future { //~ ERROR is not a future
+ gen { yield 42 }
+}
+
+fn main() {}
diff --git a/tests/ui/coroutine/gen_block_is_no_future.stderr b/tests/ui/coroutine/gen_block_is_no_future.stderr
new file mode 100644
index 000000000..db0c3c19b
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_no_future.stderr
@@ -0,0 +1,12 @@
+error[E0277]: `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21}` is not a future
+ --> $DIR/gen_block_is_no_future.rs:4:13
+ |
+LL | fn foo() -> impl std::future::Future {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21}` is not a future
+ |
+ = help: the trait `Future` is not implemented for `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21}`
+ = note: {gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:21} must be a future or must implement `IntoFuture` to be awaited
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/coroutine/gen_block_iterate.rs b/tests/ui/coroutine/gen_block_iterate.rs
new file mode 100644
index 000000000..18e1bb887
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_iterate.rs
@@ -0,0 +1,35 @@
+// revisions: next old
+//compile-flags: --edition 2024 -Zunstable-options
+//[next] compile-flags: -Ztrait-solver=next
+// run-pass
+#![feature(gen_blocks)]
+
+fn foo() -> impl Iterator<Item = u32> {
+ gen { yield 42; for x in 3..6 { yield x } }
+}
+
+fn moved() -> impl Iterator<Item = u32> {
+ let mut x = "foo".to_string();
+ gen move {
+ yield 42;
+ if x == "foo" { return }
+ x.clear();
+ for x in 3..6 { yield x }
+ }
+}
+
+fn main() {
+ let mut iter = foo();
+ assert_eq!(iter.next(), Some(42));
+ assert_eq!(iter.next(), Some(3));
+ assert_eq!(iter.next(), Some(4));
+ assert_eq!(iter.next(), Some(5));
+ assert_eq!(iter.next(), None);
+ // `gen` blocks are fused
+ assert_eq!(iter.next(), None);
+
+ let mut iter = moved();
+ assert_eq!(iter.next(), Some(42));
+ assert_eq!(iter.next(), None);
+
+}
diff --git a/tests/ui/coroutine/gen_block_move.fixed b/tests/ui/coroutine/gen_block_move.fixed
new file mode 100644
index 000000000..5c6c80623
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_move.fixed
@@ -0,0 +1,17 @@
+// compile-flags: --edition 2024 -Zunstable-options
+// run-rustfix
+#![feature(gen_blocks)]
+
+fn moved() -> impl Iterator<Item = u32> {
+ let mut x = "foo".to_string();
+ gen move { //~ ERROR: gen block may outlive the current function
+ yield 42;
+ if x == "foo" { return }
+ x.clear();
+ for x in 3..6 { yield x }
+ }
+}
+
+fn main() {
+ for _ in moved() {}
+}
diff --git a/tests/ui/coroutine/gen_block_move.rs b/tests/ui/coroutine/gen_block_move.rs
new file mode 100644
index 000000000..abbf81324
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_move.rs
@@ -0,0 +1,17 @@
+// compile-flags: --edition 2024 -Zunstable-options
+// run-rustfix
+#![feature(gen_blocks)]
+
+fn moved() -> impl Iterator<Item = u32> {
+ let mut x = "foo".to_string();
+ gen { //~ ERROR: gen block may outlive the current function
+ yield 42;
+ if x == "foo" { return }
+ x.clear();
+ for x in 3..6 { yield x }
+ }
+}
+
+fn main() {
+ for _ in moved() {}
+}
diff --git a/tests/ui/coroutine/gen_block_move.stderr b/tests/ui/coroutine/gen_block_move.stderr
new file mode 100644
index 000000000..b93ac65f5
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_move.stderr
@@ -0,0 +1,30 @@
+error[E0373]: gen block may outlive the current function, but it borrows `x`, which is owned by the current function
+ --> $DIR/gen_block_move.rs:7:5
+ |
+LL | / gen {
+LL | | yield 42;
+LL | | if x == "foo" { return }
+LL | | x.clear();
+ | | - `x` is borrowed here
+LL | | for x in 3..6 { yield x }
+LL | | }
+ | |_____^ may outlive borrowed value `x`
+ |
+note: gen block is returned here
+ --> $DIR/gen_block_move.rs:7:5
+ |
+LL | / gen {
+LL | | yield 42;
+LL | | if x == "foo" { return }
+LL | | x.clear();
+LL | | for x in 3..6 { yield x }
+LL | | }
+ | |_____^
+help: to force the gen block to take ownership of `x` (and any other referenced variables), use the `move` keyword
+ |
+LL | gen move {
+ | ++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0373`.
diff --git a/tests/ui/coroutine/gen_block_panic.rs b/tests/ui/coroutine/gen_block_panic.rs
new file mode 100644
index 000000000..2da0eb512
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_panic.rs
@@ -0,0 +1,26 @@
+//compile-flags: --edition 2024 -Zunstable-options
+// run-pass
+// needs-unwind
+#![feature(gen_blocks)]
+
+fn main() {
+ let mut iter = gen {
+ yield 42;
+ panic!("foo");
+ yield 69; //~ WARN: unreachable statement
+ };
+ assert_eq!(iter.next(), Some(42));
+ let mut tmp = std::panic::AssertUnwindSafe(&mut iter);
+ match std::panic::catch_unwind(move || tmp.next()) {
+ Ok(_) => unreachable!(),
+ Err(err) => assert_eq!(*err.downcast::<&'static str>().unwrap(), "foo"),
+ }
+
+ match std::panic::catch_unwind(move || iter.next()) {
+ Ok(_) => unreachable!(),
+ Err(err) => assert_eq!(
+ *err.downcast::<&'static str>().unwrap(),
+ "`gen fn` should just keep returning `None` after panicking",
+ ),
+ }
+}
diff --git a/tests/ui/coroutine/gen_block_panic.stderr b/tests/ui/coroutine/gen_block_panic.stderr
new file mode 100644
index 000000000..a0a6d1063
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_panic.stderr
@@ -0,0 +1,12 @@
+warning: unreachable statement
+ --> $DIR/gen_block_panic.rs:10:9
+ |
+LL | panic!("foo");
+ | ------------- any code following this expression is unreachable
+LL | yield 69;
+ | ^^^^^^^^^ unreachable statement
+ |
+ = note: `#[warn(unreachable_code)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/coroutine/gen_fn.e2024.stderr b/tests/ui/coroutine/gen_fn.e2024.stderr
new file mode 100644
index 000000000..388e10fd6
--- /dev/null
+++ b/tests/ui/coroutine/gen_fn.e2024.stderr
@@ -0,0 +1,10 @@
+error: `gen` functions are not yet implemented
+ --> $DIR/gen_fn.rs:4:1
+ |
+LL | gen fn foo() {}
+ | ^^^
+ |
+ = help: for now you can use `gen {}` blocks and return `impl Iterator` instead
+
+error: aborting due to previous error
+
diff --git a/tests/ui/coroutine/gen_fn.none.stderr b/tests/ui/coroutine/gen_fn.none.stderr
new file mode 100644
index 000000000..5e7bd9d8b
--- /dev/null
+++ b/tests/ui/coroutine/gen_fn.none.stderr
@@ -0,0 +1,8 @@
+error: expected one of `#`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found `gen`
+ --> $DIR/gen_fn.rs:4:1
+ |
+LL | gen fn foo() {}
+ | ^^^ expected one of 9 possible tokens
+
+error: aborting due to previous error
+
diff --git a/tests/ui/coroutine/gen_fn.rs b/tests/ui/coroutine/gen_fn.rs
new file mode 100644
index 000000000..da515f263
--- /dev/null
+++ b/tests/ui/coroutine/gen_fn.rs
@@ -0,0 +1,8 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+
+gen fn foo() {}
+//[none]~^ ERROR: expected one of `#`, `async`, `const`, `default`, `extern`, `fn`, `pub`, `unsafe`, or `use`, found `gen`
+//[e2024]~^^ ERROR: `gen` functions are not yet implemented
+
+fn main() {}
diff --git a/tests/ui/generator/issue-102645.rs b/tests/ui/coroutine/issue-102645.rs
index 677cc69d3..a0263510e 100644
--- a/tests/ui/generator/issue-102645.rs
+++ b/tests/ui/coroutine/issue-102645.rs
@@ -1,6 +1,6 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/generator/issue-102645.stderr b/tests/ui/coroutine/issue-102645.stderr
index 5d28dfc45..3db090346 100644
--- a/tests/ui/generator/issue-102645.stderr
+++ b/tests/ui/coroutine/issue-102645.stderr
@@ -5,7 +5,7 @@ LL | Pin::new(&mut b).resume();
| ^^^^^^-- an argument of type `()` is missing
|
note: method defined here
- --> $SRC_DIR/core/src/ops/generator.rs:LL:COL
+ --> $SRC_DIR/core/src/ops/coroutine.rs:LL:COL
help: provide the argument
|
LL | Pin::new(&mut b).resume(());
diff --git a/tests/ui/generator/issue-105084.rs b/tests/ui/coroutine/issue-105084.rs
index 50b5da6e6..7801f1bce 100644
--- a/tests/ui/generator/issue-105084.rs
+++ b/tests/ui/coroutine/issue-105084.rs
@@ -1,9 +1,9 @@
-#![feature(generators)]
-#![feature(generator_clone)]
-#![feature(generator_trait)]
+#![feature(coroutines)]
+#![feature(coroutine_clone)]
+#![feature(coroutine_trait)]
#![feature(rustc_attrs, stmt_expr_attributes)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn copy<T: Copy>(x: T) -> T {
@@ -25,9 +25,9 @@ fn main() {
// Allocate the temporary box.
Pin::new(&mut g).resume(());
- // The temporary box is in generator locals.
+ // The temporary box is in coroutine locals.
// As it is not taken into account for trait computation,
- // the generator is `Copy`.
+ // the coroutine is `Copy`.
let mut h = copy(g);
//~^ ERROR the trait bound `Box<(i32, ())>: Copy` is not satisfied in
diff --git a/tests/ui/generator/issue-105084.stderr b/tests/ui/coroutine/issue-105084.stderr
index 573c31f11..38f114ff7 100644
--- a/tests/ui/generator/issue-105084.stderr
+++ b/tests/ui/coroutine/issue-105084.stderr
@@ -2,7 +2,7 @@ error[E0382]: borrow of moved value: `g`
--> $DIR/issue-105084.rs:37:14
|
LL | let mut g = || {
- | ----- move occurs because `g` has type `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait
+ | ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`, which does not implement the `Copy` trait
...
LL | let mut h = copy(g);
| - value moved here
@@ -22,16 +22,16 @@ help: consider cloning the value if the performance cost is acceptable
LL | let mut h = copy(g.clone());
| ++++++++
-error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{generator@$DIR/issue-105084.rs:14:17: 14:19}`
+error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`
--> $DIR/issue-105084.rs:31:17
|
LL | let mut g = || {
- | -- within this `{generator@$DIR/issue-105084.rs:14:17: 14:19}`
+ | -- within this `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`
...
LL | let mut h = copy(g);
- | ^^^^ within `{generator@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
+ | ^^^^ within `{coroutine@$DIR/issue-105084.rs:14:17: 14:19}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
|
-note: generator does not implement `Copy` as this value is used across a yield
+note: coroutine does not implement `Copy` as this value is used across a yield
--> $DIR/issue-105084.rs:21:22
|
LL | Box::new((5, yield));
diff --git a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs b/tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs
index 845102464..ad39b71b0 100644
--- a/tests/ui/generator/issue-110929-generator-conflict-error-ice.rs
+++ b/tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs
@@ -1,6 +1,6 @@
// edition:2021
// check-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let x = &mut ();
diff --git a/tests/ui/generator/issue-113279.rs b/tests/ui/coroutine/issue-113279.rs
index f69f804b7..f251c924c 100644
--- a/tests/ui/generator/issue-113279.rs
+++ b/tests/ui/coroutine/issue-113279.rs
@@ -1,10 +1,10 @@
-#![feature(generators)]
+#![feature(coroutines)]
// `foo` attempts to dereference `""`, which results in an error being reported. Later, the
-// generator transform for `foo` then produces a union which contains a `str` type - unions should
+// coroutine transform for `foo` then produces a union which contains a `str` type - unions should
// not contain unsized types, but this is okay because an error has been reported already.
// When const propagation happens later in compilation, it attempts to compute the layout of the
-// generator (as part of checking whether something can be const propagated) and in turn attempts
+// coroutine (as part of checking whether something can be const propagated) and in turn attempts
// to compute the layout of `str` in the context of a union - where this caused an ICE. This test
// makes sure that doesn't happen again.
diff --git a/tests/ui/generator/issue-113279.stderr b/tests/ui/coroutine/issue-113279.stderr
index cc9b64ef9..cc9b64ef9 100644
--- a/tests/ui/generator/issue-113279.stderr
+++ b/tests/ui/coroutine/issue-113279.stderr
diff --git a/tests/ui/generator/issue-44197.rs b/tests/ui/coroutine/issue-44197.rs
index 389b9d139..c0326bdae 100644
--- a/tests/ui/generator/issue-44197.rs
+++ b/tests/ui/coroutine/issue-44197.rs
@@ -1,15 +1,15 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn foo(_: &str) -> String {
String::new()
}
-fn bar(baz: String) -> impl Generator<(), Yield = String, Return = ()> {
+fn bar(baz: String) -> impl Coroutine<(), Yield = String, Return = ()> {
move || {
yield foo(&baz);
}
@@ -19,7 +19,7 @@ fn foo2(_: &str) -> Result<String, ()> {
Err(())
}
-fn bar2(baz: String) -> impl Generator<(), Yield = String, Return = ()> {
+fn bar2(baz: String) -> impl Coroutine<(), Yield = String, Return = ()> {
move || {
if let Ok(quux) = foo2(&baz) {
yield quux;
@@ -30,7 +30,7 @@ fn bar2(baz: String) -> impl Generator<(), Yield = String, Return = ()> {
fn main() {
assert_eq!(
Pin::new(&mut bar(String::new())).resume(()),
- GeneratorState::Yielded(String::new())
+ CoroutineState::Yielded(String::new())
);
- assert_eq!(Pin::new(&mut bar2(String::new())).resume(()), GeneratorState::Complete(()));
+ assert_eq!(Pin::new(&mut bar2(String::new())).resume(()), CoroutineState::Complete(()));
}
diff --git a/tests/ui/generator/issue-45729-unsafe-in-generator.mir.stderr b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr
index 3afbea079..a9a0d6296 100644
--- a/tests/ui/generator/issue-45729-unsafe-in-generator.mir.stderr
+++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.mir.stderr
@@ -1,5 +1,5 @@
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
- --> $DIR/issue-45729-unsafe-in-generator.rs:8:9
+ --> $DIR/issue-45729-unsafe-in-coroutine.rs:8:9
|
LL | *(1 as *mut u32) = 42;
| ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
diff --git a/tests/ui/generator/issue-45729-unsafe-in-generator.rs b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs
index 379c36d2c..7961b5859 100644
--- a/tests/ui/generator/issue-45729-unsafe-in-generator.rs
+++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.rs
@@ -1,7 +1,7 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let _ = || {
diff --git a/tests/ui/generator/issue-45729-unsafe-in-generator.thir.stderr b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr
index 10d768f19..22c83e9a3 100644
--- a/tests/ui/generator/issue-45729-unsafe-in-generator.thir.stderr
+++ b/tests/ui/coroutine/issue-45729-unsafe-in-coroutine.thir.stderr
@@ -1,5 +1,5 @@
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
- --> $DIR/issue-45729-unsafe-in-generator.rs:8:9
+ --> $DIR/issue-45729-unsafe-in-coroutine.rs:8:9
|
LL | *(1 as *mut u32) = 42;
| ^^^^^^^^^^^^^^^^ dereference of raw pointer
diff --git a/tests/ui/generator/issue-48048.rs b/tests/ui/coroutine/issue-48048.rs
index 992bbc97a..b61b7c770 100644
--- a/tests/ui/generator/issue-48048.rs
+++ b/tests/ui/coroutine/issue-48048.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let x = (|_| {},);
@@ -6,7 +6,7 @@ fn main() {
|| {
let x = x;
- x.0({ //~ ERROR borrow may still be in use when generator yields
+ x.0({ //~ ERROR borrow may still be in use when coroutine yields
yield;
});
};
diff --git a/tests/ui/generator/issue-48048.stderr b/tests/ui/coroutine/issue-48048.stderr
index 234235839..bb9f189fa 100644
--- a/tests/ui/generator/issue-48048.stderr
+++ b/tests/ui/coroutine/issue-48048.stderr
@@ -1,4 +1,4 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/issue-48048.rs:9:9
|
LL | x.0({
diff --git a/tests/ui/coroutine/issue-52304.rs b/tests/ui/coroutine/issue-52304.rs
new file mode 100644
index 000000000..fed3a5f19
--- /dev/null
+++ b/tests/ui/coroutine/issue-52304.rs
@@ -0,0 +1,11 @@
+// check-pass
+
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+
+pub fn example() -> impl Coroutine {
+ || yield &1
+}
+
+fn main() {}
diff --git a/tests/ui/generator/issue-52398.rs b/tests/ui/coroutine/issue-52398.rs
index ada380d11..8d651d0e2 100644
--- a/tests/ui/generator/issue-52398.rs
+++ b/tests/ui/coroutine/issue-52398.rs
@@ -1,7 +1,7 @@
// run-pass
#![allow(unused_variables)]
-#![feature(generators)]
+#![feature(coroutines)]
use std::cell::RefCell;
@@ -14,14 +14,14 @@ impl A {
fn main() {
// Test that the MIR local with type &A created for the auto-borrow adjustment
// is caught by typeck
- move || { //~ WARN unused generator that must be used
+ move || { //~ WARN unused coroutine that must be used
A.test(yield);
};
// Test that the std::cell::Ref temporary returned from the `borrow` call
// is caught by typeck
let y = RefCell::new(true);
- static move || { //~ WARN unused generator that must be used
+ static move || { //~ WARN unused coroutine that must be used
yield *y.borrow();
return "Done";
};
diff --git a/tests/ui/generator/issue-52398.stderr b/tests/ui/coroutine/issue-52398.stderr
index 539343275..18d816da4 100644
--- a/tests/ui/generator/issue-52398.stderr
+++ b/tests/ui/coroutine/issue-52398.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/issue-52398.rs:17:5
|
LL | / move || {
@@ -6,10 +6,10 @@ LL | | A.test(yield);
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/issue-52398.rs:24:5
|
LL | / static move || {
@@ -18,7 +18,7 @@ LL | | return "Done";
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
warning: 2 warnings emitted
diff --git a/tests/ui/generator/issue-53548-1.rs b/tests/ui/coroutine/issue-53548-1.rs
index 173ae3c6f..4be8e95f3 100644
--- a/tests/ui/generator/issue-53548-1.rs
+++ b/tests/ui/coroutine/issue-53548-1.rs
@@ -1,4 +1,4 @@
-// A variant of #53548 that does not actually require generators,
+// A variant of #53548 that does not actually require coroutines,
// but which encountered the same ICE/error. See `issue-53548.rs`
// for details.
//
diff --git a/tests/ui/generator/issue-53548.rs b/tests/ui/coroutine/issue-53548.rs
index 3ebabb914..bb267f74a 100644
--- a/tests/ui/generator/issue-53548.rs
+++ b/tests/ui/coroutine/issue-53548.rs
@@ -1,5 +1,5 @@
// Regression test for #53548. The `Box<dyn Trait>` type below is
-// expanded to `Box<dyn Trait + 'static>`, but the generator "witness"
+// expanded to `Box<dyn Trait + 'static>`, but the coroutine "witness"
// that results is `for<'r> { Box<dyn Trait + 'r> }`. The WF code was
// encountering an ICE (when debug-assertions were enabled) and an
// unexpected compilation error (without debug-asserions) when trying
@@ -17,7 +17,7 @@
//
// check-pass
-#![feature(generators)]
+#![feature(coroutines)]
use std::cell::RefCell;
use std::rc::Rc;
diff --git a/tests/ui/generator/issue-57017.rs b/tests/ui/coroutine/issue-57017.rs
index bb2d6679b..4f63abbdb 100644
--- a/tests/ui/generator/issue-57017.rs
+++ b/tests/ui/coroutine/issue-57017.rs
@@ -1,5 +1,5 @@
// build-pass
-#![feature(generators, negative_impls)]
+#![feature(coroutines, negative_impls)]
#![allow(dropping_references, dropping_copy_types)]
macro_rules! type_combinations {
diff --git a/tests/ui/generator/issue-57084.rs b/tests/ui/coroutine/issue-57084.rs
index fbed78ff2..95bed5b15 100644
--- a/tests/ui/generator/issue-57084.rs
+++ b/tests/ui/coroutine/issue-57084.rs
@@ -2,10 +2,10 @@
// "cannot relate bound region: ReLateBound(DebruijnIndex(1), BrAnon(1)) <= '?1"
// run-pass
// edition:2018
-#![feature(generators,generator_trait)]
-use std::ops::Generator;
+#![feature(coroutines,coroutine_trait)]
+use std::ops::Coroutine;
-fn with<F>(f: F) -> impl Generator<Yield=(), Return=()>
+fn with<F>(f: F) -> impl Coroutine<Yield=(), Return=()>
where F: Fn() -> ()
{
move || {
@@ -19,7 +19,7 @@ where F: Fn() -> ()
fn main() {
let data = &vec![1];
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
let _to_pin = with(move || println!("{:p}", data));
loop {
yield
diff --git a/tests/ui/generator/issue-57084.stderr b/tests/ui/coroutine/issue-57084.stderr
index 8f1fc5e80..9f5b79a6a 100644
--- a/tests/ui/generator/issue-57084.stderr
+++ b/tests/ui/coroutine/issue-57084.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/issue-57084.rs:22:5
|
LL | / || {
@@ -9,7 +9,7 @@ LL | | }
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/issue-57478.rs b/tests/ui/coroutine/issue-57478.rs
index 39710febd..716e4c67b 100644
--- a/tests/ui/generator/issue-57478.rs
+++ b/tests/ui/coroutine/issue-57478.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(negative_impls, generators)]
+#![feature(negative_impls, coroutines)]
struct Foo;
impl !Send for Foo {}
diff --git a/tests/ui/generator/issue-58888.rs b/tests/ui/coroutine/issue-58888.rs
index d42d09d40..af8e60ce4 100644
--- a/tests/ui/generator/issue-58888.rs
+++ b/tests/ui/coroutine/issue-58888.rs
@@ -2,9 +2,9 @@
// compile-flags: -g
// ignore-asmjs wasm2js does not support source maps yet
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
struct Database;
@@ -13,7 +13,7 @@ impl Database {
Some(()).into_iter()
}
- fn check_connection(&self) -> impl Generator<Yield = (), Return = ()> + '_ {
+ fn check_connection(&self) -> impl Coroutine<Yield = (), Return = ()> + '_ {
move || {
let iter = self.get_connection();
for i in iter {
diff --git a/tests/ui/generator/issue-61442-stmt-expr-with-drop.rs b/tests/ui/coroutine/issue-61442-stmt-expr-with-drop.rs
index 187c37402..cff6c24a8 100644
--- a/tests/ui/generator/issue-61442-stmt-expr-with-drop.rs
+++ b/tests/ui/coroutine/issue-61442-stmt-expr-with-drop.rs
@@ -4,9 +4,9 @@
// check-pass
// edition:2018
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
async fn drop_and_await() {
async {};
diff --git a/tests/ui/generator/issue-62506-two_awaits.rs b/tests/ui/coroutine/issue-62506-two_awaits.rs
index 672e16b78..b50e2a45c 100644
--- a/tests/ui/generator/issue-62506-two_awaits.rs
+++ b/tests/ui/coroutine/issue-62506-two_awaits.rs
@@ -1,5 +1,5 @@
// Output = String caused an ICE whereas Output = &'static str compiled successfully.
-// Broken MIR: generator contains type std::string::String in MIR,
+// Broken MIR: coroutine contains type std::string::String in MIR,
// but typeck only knows about {<S as T>::Future, ()}
// check-pass
// edition:2018
diff --git a/tests/ui/coroutine/issue-64620-yield-array-element.rs b/tests/ui/coroutine/issue-64620-yield-array-element.rs
new file mode 100644
index 000000000..a9307d306
--- /dev/null
+++ b/tests/ui/coroutine/issue-64620-yield-array-element.rs
@@ -0,0 +1,9 @@
+// Regression test for #64620
+
+#![feature(coroutines)]
+
+pub fn crash(arr: [usize; 1]) {
+ yield arr[0]; //~ ERROR: yield expression outside of coroutine literal
+}
+
+fn main() {}
diff --git a/tests/ui/generator/issue-64620-yield-array-element.stderr b/tests/ui/coroutine/issue-64620-yield-array-element.stderr
index 48383c2ed..47632d083 100644
--- a/tests/ui/generator/issue-64620-yield-array-element.stderr
+++ b/tests/ui/coroutine/issue-64620-yield-array-element.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/issue-64620-yield-array-element.rs:6:5
|
LL | yield arr[0];
diff --git a/tests/ui/generator/issue-68112.rs b/tests/ui/coroutine/issue-68112.rs
index 9dd68726f..e2be704da 100644
--- a/tests/ui/generator/issue-68112.rs
+++ b/tests/ui/coroutine/issue-68112.rs
@@ -1,18 +1,18 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::{
cell::RefCell,
sync::Arc,
pin::Pin,
- ops::{Generator, GeneratorState},
+ ops::{Coroutine, CoroutineState},
};
pub struct Ready<T>(Option<T>);
-impl<T: Unpin> Generator<()> for Ready<T> {
+impl<T: Unpin> Coroutine<()> for Ready<T> {
type Return = T;
type Yield = ();
- fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
- GeneratorState::Complete(self.0.take().unwrap())
+ fn resume(mut self: Pin<&mut Self>, _args: ()) -> CoroutineState<(), T> {
+ CoroutineState::Complete(self.0.take().unwrap())
}
}
pub fn make_gen1<T>(t: T) -> Ready<T> {
@@ -25,40 +25,40 @@ fn require_send(_: impl Send) {}
//~| NOTE required by this bound
//~| NOTE required by this bound
-fn make_non_send_generator() -> impl Generator<Return = Arc<RefCell<i32>>> {
+fn make_non_send_coroutine() -> impl Coroutine<Return = Arc<RefCell<i32>>> {
make_gen1(Arc::new(RefCell::new(0)))
}
fn test1() {
let send_gen = || {
- let _non_send_gen = make_non_send_generator();
+ let _non_send_gen = make_non_send_coroutine();
//~^ NOTE not `Send`
yield;
//~^ NOTE yield occurs here
//~| NOTE value is used across a yield
};
require_send(send_gen);
- //~^ ERROR generator cannot be sent between threads
+ //~^ ERROR coroutine cannot be sent between threads
//~| NOTE not `Send`
//~| NOTE use `std::sync::RwLock` instead
}
-pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> {
//~^ NOTE appears within the type
//~| NOTE expansion of desugaring
- || { //~ NOTE used within this generator
+ || { //~ NOTE used within this coroutine
yield;
t
}
}
-fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> { //~ NOTE appears within the type
+fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { //~ NOTE appears within the type
//~^ NOTE expansion of desugaring
make_gen2(Arc::new(RefCell::new(0)))
}
fn test2() {
- let send_gen = || { //~ NOTE used within this generator
- let _non_send_gen = make_non_send_generator2();
+ let send_gen = || { //~ NOTE used within this coroutine
+ let _non_send_gen = make_non_send_coroutine2();
yield;
};
require_send(send_gen);
diff --git a/tests/ui/generator/issue-68112.stderr b/tests/ui/coroutine/issue-68112.stderr
index 808004822..5efa72ad5 100644
--- a/tests/ui/generator/issue-68112.stderr
+++ b/tests/ui/coroutine/issue-68112.stderr
@@ -1,16 +1,16 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/issue-68112.rs:40:5
|
LL | require_send(send_gen);
- | ^^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^^ coroutine is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: generator is not `Send` as this value is used across a yield
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/issue-68112.rs:36:9
|
-LL | let _non_send_gen = make_non_send_generator();
- | ------------- has type `impl Generator<Return = Arc<RefCell<i32>>>` which is not `Send`
+LL | let _non_send_gen = make_non_send_coroutine();
+ | ------------- has type `impl Coroutine<Return = Arc<RefCell<i32>>>` which is not `Send`
LL |
LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
@@ -29,23 +29,23 @@ LL | require_send(send_gen);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
+note: required because it's used within this coroutine
--> $DIR/issue-68112.rs:49:5
|
LL | || {
| ^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
+note: required because it appears within the type `impl Coroutine<Return = Arc<RefCell<i32>>>`
--> $DIR/issue-68112.rs:46:30
|
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+LL | pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
+note: required because it appears within the type `impl Coroutine<Return = Arc<RefCell<i32>>>`
--> $DIR/issue-68112.rs:54:34
|
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
+LL | fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `impl Generator<Return = Arc<RefCell<i32>>>`
-note: required because it's used within this generator
+ = note: required because it captures the following types: `impl Coroutine<Return = Arc<RefCell<i32>>>`
+note: required because it's used within this coroutine
--> $DIR/issue-68112.rs:60:20
|
LL | let send_gen = || {
diff --git a/tests/ui/generator/issue-69017.rs b/tests/ui/coroutine/issue-69017.rs
index 511deb60e..7aaa1ee03 100644
--- a/tests/ui/generator/issue-69017.rs
+++ b/tests/ui/coroutine/issue-69017.rs
@@ -4,12 +4,12 @@
//
// check-pass
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn gen() -> impl Generator<usize> {
+fn gen() -> impl Coroutine<usize> {
|_: usize| {
println!("-> {}", yield);
}
diff --git a/tests/ui/generator/issue-69039.rs b/tests/ui/coroutine/issue-69039.rs
index ccc141860..041985e15 100644
--- a/tests/ui/generator/issue-69039.rs
+++ b/tests/ui/coroutine/issue-69039.rs
@@ -1,14 +1,14 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
fn mkstr(my_name: String, my_mood: String) -> String {
format!("{} is {}", my_name.trim(), my_mood.trim())
}
-fn my_scenario() -> impl Generator<String, Yield = &'static str, Return = String> {
+fn my_scenario() -> impl Coroutine<String, Yield = &'static str, Return = String> {
|_arg: String| {
let my_name = yield "What is your name?";
let my_mood = yield "How are you feeling?";
@@ -21,14 +21,14 @@ fn main() {
assert_eq!(
my_session.as_mut().resume("_arg".to_string()),
- GeneratorState::Yielded("What is your name?")
+ CoroutineState::Yielded("What is your name?")
);
assert_eq!(
my_session.as_mut().resume("Your Name".to_string()),
- GeneratorState::Yielded("How are you feeling?")
+ CoroutineState::Yielded("How are you feeling?")
);
assert_eq!(
my_session.as_mut().resume("Sensory Organs".to_string()),
- GeneratorState::Complete("Your Name is Sensory Organs".to_string())
+ CoroutineState::Complete("Your Name is Sensory Organs".to_string())
);
}
diff --git a/tests/ui/coroutine/issue-87142.rs b/tests/ui/coroutine/issue-87142.rs
new file mode 100644
index 000000000..b5708c4b3
--- /dev/null
+++ b/tests/ui/coroutine/issue-87142.rs
@@ -0,0 +1,32 @@
+// compile-flags: -Cdebuginfo=2
+// build-pass
+
+// Regression test for #87142
+// This test needs the above flags and the "lib" crate type.
+
+#![feature(impl_trait_in_assoc_type, coroutine_trait, coroutines)]
+#![crate_type = "lib"]
+
+use std::ops::Coroutine;
+
+pub trait CoroutineProviderAlt: Sized {
+ type Coro: Coroutine<(), Return = (), Yield = ()>;
+
+ fn start(ctx: Context<Self>) -> Self::Coro;
+}
+
+pub struct Context<G: 'static + CoroutineProviderAlt> {
+ pub link: Box<G::Coro>,
+}
+
+impl CoroutineProviderAlt for () {
+ type Coro = impl Coroutine<(), Return = (), Yield = ()>;
+ fn start(ctx: Context<Self>) -> Self::Coro {
+ move || {
+ match ctx {
+ _ => (),
+ }
+ yield ();
+ }
+ }
+}
diff --git a/tests/ui/generator/issue-88653.rs b/tests/ui/coroutine/issue-88653.rs
index 1d9377bce..ec4c20547 100644
--- a/tests/ui/generator/issue-88653.rs
+++ b/tests/ui/coroutine/issue-88653.rs
@@ -1,14 +1,14 @@
// Regression test for #88653, where a confusing warning about a
-// type mismatch in generator arguments was issued.
+// type mismatch in coroutine arguments was issued.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn foo(bar: bool) -> impl Generator<(bool,)> {
- //~^ ERROR: type mismatch in generator arguments [E0631]
+fn foo(bar: bool) -> impl Coroutine<(bool,)> {
+ //~^ ERROR: type mismatch in coroutine arguments [E0631]
//~| NOTE: expected due to this
- //~| NOTE: expected generator signature `fn((bool,)) -> _`
+ //~| NOTE: expected coroutine signature `fn((bool,)) -> _`
//~| NOTE: in this expansion of desugaring of `impl Trait`
//~| NOTE: in this expansion of desugaring of `impl Trait`
|bar| {
diff --git a/tests/ui/generator/issue-88653.stderr b/tests/ui/coroutine/issue-88653.stderr
index b742c6e2f..3ae50b5af 100644
--- a/tests/ui/generator/issue-88653.stderr
+++ b/tests/ui/coroutine/issue-88653.stderr
@@ -1,14 +1,14 @@
-error[E0631]: type mismatch in generator arguments
+error[E0631]: type mismatch in coroutine arguments
--> $DIR/issue-88653.rs:8:22
|
-LL | fn foo(bar: bool) -> impl Generator<(bool,)> {
+LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> {
| ^^^^^^^^^^^^^^^^^^^^^^^ expected due to this
...
LL | |bar| {
| ----- found signature defined here
|
- = note: expected generator signature `fn((bool,)) -> _`
- found generator signature `fn(bool) -> _`
+ = note: expected coroutine signature `fn((bool,)) -> _`
+ found coroutine signature `fn(bool) -> _`
error: aborting due to previous error
diff --git a/tests/ui/generator/issue-91477.rs b/tests/ui/coroutine/issue-91477.rs
index 6c027feb4..c98546f79 100644
--- a/tests/ui/generator/issue-91477.rs
+++ b/tests/ui/coroutine/issue-91477.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn foo() -> impl Sized {
yield 1; //~ ERROR E0627
diff --git a/tests/ui/generator/issue-91477.stderr b/tests/ui/coroutine/issue-91477.stderr
index 4597dc1bc..0ab3c1fba 100644
--- a/tests/ui/generator/issue-91477.stderr
+++ b/tests/ui/coroutine/issue-91477.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/issue-91477.rs:4:5
|
LL | yield 1;
diff --git a/tests/ui/generator/issue-93161.rs b/tests/ui/coroutine/issue-93161.rs
index ae8603b7c..ae8603b7c 100644
--- a/tests/ui/generator/issue-93161.rs
+++ b/tests/ui/coroutine/issue-93161.rs
diff --git a/tests/ui/generator/iterator-count.rs b/tests/ui/coroutine/iterator-count.rs
index 90eefe02f..322e56f8a 100644
--- a/tests/ui/generator/iterator-count.rs
+++ b/tests/ui/coroutine/iterator-count.rs
@@ -1,27 +1,27 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::marker::Unpin;
-use std::ops::{GeneratorState, Generator};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
struct W<T>(T);
-// This impl isn't safe in general, but the generator used in this test is movable
+// This impl isn't safe in general, but the coroutine used in this test is movable
// so it won't cause problems.
-impl<T: Generator<(), Return = ()> + Unpin> Iterator for W<T> {
+impl<T: Coroutine<(), Return = ()> + Unpin> Iterator for W<T> {
type Item = T::Yield;
fn next(&mut self) -> Option<Self::Item> {
match Pin::new(&mut self.0).resume(()) {
- GeneratorState::Complete(..) => None,
- GeneratorState::Yielded(v) => Some(v),
+ CoroutineState::Complete(..) => None,
+ CoroutineState::Yielded(v) => Some(v),
}
}
}
-fn test() -> impl Generator<(), Return=(), Yield=u8> + Unpin {
+fn test() -> impl Coroutine<(), Return = (), Yield = u8> + Unpin {
|| {
for i in 1..6 {
yield i
diff --git a/tests/ui/generator/layout-error.rs b/tests/ui/coroutine/layout-error.rs
index 7c3d18740..87da60700 100644
--- a/tests/ui/generator/layout-error.rs
+++ b/tests/ui/coroutine/layout-error.rs
@@ -1,4 +1,4 @@
-// Verifies that computing a layout of a generator tainted by type errors
+// Verifies that computing a layout of a coroutine tainted by type errors
// doesn't ICE. Regression test for #80998.
//
// edition:2018
diff --git a/tests/ui/generator/layout-error.stderr b/tests/ui/coroutine/layout-error.stderr
index b1a258f4f..b1a258f4f 100644
--- a/tests/ui/generator/layout-error.stderr
+++ b/tests/ui/coroutine/layout-error.stderr
diff --git a/tests/ui/generator/live-upvar-across-yield.rs b/tests/ui/coroutine/live-upvar-across-yield.rs
index 6a2e42a55..740a446e7 100644
--- a/tests/ui/generator/live-upvar-across-yield.rs
+++ b/tests/ui/coroutine/live-upvar-across-yield.rs
@@ -1,8 +1,8 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/generator/match-bindings.rs b/tests/ui/coroutine/match-bindings.rs
index 865904a57..1a5b3cdb0 100644
--- a/tests/ui/generator/match-bindings.rs
+++ b/tests/ui/coroutine/match-bindings.rs
@@ -1,7 +1,7 @@
// run-pass
#![allow(dead_code)]
-#![feature(generators)]
+#![feature(coroutines)]
enum Enum {
A(String),
@@ -9,7 +9,7 @@ enum Enum {
}
fn main() {
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
loop {
if let true = true {
match Enum::A(String::new()) {
diff --git a/tests/ui/generator/match-bindings.stderr b/tests/ui/coroutine/match-bindings.stderr
index 3dd2d5954..a7aa6eadb 100644
--- a/tests/ui/generator/match-bindings.stderr
+++ b/tests/ui/coroutine/match-bindings.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/match-bindings.rs:12:5
|
LL | / || {
@@ -10,7 +10,7 @@ LL | | }
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/metadata-sufficient-for-layout.rs b/tests/ui/coroutine/metadata-sufficient-for-layout.rs
index d0e648ee7..434a28015 100644
--- a/tests/ui/generator/metadata-sufficient-for-layout.rs
+++ b/tests/ui/coroutine/metadata-sufficient-for-layout.rs
@@ -1,4 +1,4 @@
-// Check that the layout of a generator is available when auxiliary crate
+// Check that the layout of a coroutine is available when auxiliary crate
// is compiled with --emit metadata.
//
// Regression test for #80998.
@@ -6,15 +6,15 @@
// aux-build:metadata-sufficient-for-layout.rs
#![feature(type_alias_impl_trait, rustc_attrs)]
-#![feature(generator_trait)]
+#![feature(coroutine_trait)]
extern crate metadata_sufficient_for_layout;
-use std::ops::Generator;
+use std::ops::Coroutine;
-type F = impl Generator<(), Yield = (), Return = ()>;
+type F = impl Coroutine<(), Yield = (), Return = ()>;
-// Static queries the layout of the generator.
+// Static queries the layout of the coroutine.
static A: Option<F> = None;
fn f() -> F {
diff --git a/tests/ui/generator/metadata-sufficient-for-layout.stderr b/tests/ui/coroutine/metadata-sufficient-for-layout.stderr
index 3488b04f2..3488b04f2 100644
--- a/tests/ui/generator/metadata-sufficient-for-layout.stderr
+++ b/tests/ui/coroutine/metadata-sufficient-for-layout.stderr
diff --git a/tests/ui/coroutine/nested_coroutine.rs b/tests/ui/coroutine/nested_coroutine.rs
new file mode 100644
index 000000000..04f4aa771
--- /dev/null
+++ b/tests/ui/coroutine/nested_coroutine.rs
@@ -0,0 +1,21 @@
+// run-pass
+
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::{Coroutine, CoroutineState};
+use std::pin::Pin;
+
+fn main() {
+ let _coroutine = || {
+ let mut sub_coroutine = || {
+ yield 2;
+ };
+
+ match Pin::new(&mut sub_coroutine).resume(()) {
+ CoroutineState::Yielded(x) => {
+ yield x;
+ }
+ _ => panic!(),
+ };
+ };
+}
diff --git a/tests/ui/generator/niche-in-generator.rs b/tests/ui/coroutine/niche-in-coroutine.rs
index 42bee81f5..7ad4c6bc9 100644
--- a/tests/ui/generator/niche-in-generator.rs
+++ b/tests/ui/coroutine/niche-in-coroutine.rs
@@ -1,8 +1,8 @@
-// Test that niche finding works with captured generator upvars.
+// Test that niche finding works with captured coroutine upvars.
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
use std::mem::size_of_val;
diff --git a/tests/ui/generator/non-static-is-unpin.rs b/tests/ui/coroutine/non-static-is-unpin.rs
index a5dde3912..d6ded53ae 100644
--- a/tests/ui/generator/non-static-is-unpin.rs
+++ b/tests/ui/coroutine/non-static-is-unpin.rs
@@ -2,7 +2,7 @@
//[next] compile-flags: -Ztrait-solver=next
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
#![allow(dropping_copy_types)]
use std::marker::{PhantomPinned, Unpin};
@@ -11,7 +11,7 @@ fn assert_unpin<G: Unpin>(_: G) {
}
fn main() {
- // Even though this generator holds a `PhantomPinned` in its environment, it
+ // Even though this coroutine holds a `PhantomPinned` in its environment, it
// remains `Unpin`.
assert_unpin(|| {
let pinned = PhantomPinned;
diff --git a/tests/ui/generator/not-send-sync.rs b/tests/ui/coroutine/not-send-sync.rs
index 16c8cd476..dd6182c10 100644
--- a/tests/ui/generator/not-send-sync.rs
+++ b/tests/ui/coroutine/not-send-sync.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
#![feature(negative_impls)]
struct NotSend;
@@ -12,14 +12,14 @@ fn main() {
fn assert_send<T: Send>(_: T) {}
assert_sync(|| {
- //~^ ERROR: generator cannot be shared between threads safely
+ //~^ ERROR: coroutine cannot be shared between threads safely
let a = NotSync;
yield;
drop(a);
});
assert_send(|| {
- //~^ ERROR: generator cannot be sent between threads safely
+ //~^ ERROR: coroutine cannot be sent between threads safely
let a = NotSend;
yield;
drop(a);
diff --git a/tests/ui/generator/not-send-sync.stderr b/tests/ui/coroutine/not-send-sync.stderr
index 13ce687e0..b33a1e63a 100644
--- a/tests/ui/generator/not-send-sync.stderr
+++ b/tests/ui/coroutine/not-send-sync.stderr
@@ -1,11 +1,11 @@
-error: generator cannot be shared between threads safely
+error: coroutine cannot be shared between threads safely
--> $DIR/not-send-sync.rs:14:5
|
LL | assert_sync(|| {
- | ^^^^^^^^^^^ generator is not `Sync`
+ | ^^^^^^^^^^^ coroutine is not `Sync`
|
- = help: within `{generator@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
+ = help: within `{coroutine@$DIR/not-send-sync.rs:14:17: 14:19}`, the trait `Sync` is not implemented for `NotSync`
+note: coroutine is not `Sync` as this value is used across a yield
--> $DIR/not-send-sync.rs:17:9
|
LL | let a = NotSync;
@@ -18,14 +18,14 @@ note: required by a bound in `assert_sync`
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/not-send-sync.rs:21:5
|
LL | assert_send(|| {
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
|
- = help: within `{generator@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
+ = help: within `{coroutine@$DIR/not-send-sync.rs:21:17: 21:19}`, the trait `Send` is not implemented for `NotSend`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/not-send-sync.rs:24:9
|
LL | let a = NotSend;
diff --git a/tests/ui/generator/overlap-locals.rs b/tests/ui/coroutine/overlap-locals.rs
index 101c8714f..7c151270b 100644
--- a/tests/ui/generator/overlap-locals.rs
+++ b/tests/ui/coroutine/overlap-locals.rs
@@ -1,6 +1,6 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let a = || {
diff --git a/tests/ui/generator/panic-drops-resume.rs b/tests/ui/coroutine/panic-drops-resume.rs
index 4c3caeb14..e866f216a 100644
--- a/tests/ui/generator/panic-drops-resume.rs
+++ b/tests/ui/coroutine/panic-drops-resume.rs
@@ -1,11 +1,11 @@
-//! Tests that panics inside a generator will correctly drop the initial resume argument.
+//! Tests that panics inside a coroutine will correctly drop the initial resume argument.
// run-pass
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::panic::{catch_unwind, AssertUnwindSafe};
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/tests/ui/generator/panic-drops.rs b/tests/ui/coroutine/panic-drops.rs
index 65001fd87..7e37279b9 100644
--- a/tests/ui/generator/panic-drops.rs
+++ b/tests/ui/coroutine/panic-drops.rs
@@ -2,9 +2,9 @@
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::panic;
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/tests/ui/generator/panic-safe.rs b/tests/ui/coroutine/panic-safe.rs
index 3db80bb58..9aa427565 100644
--- a/tests/ui/generator/panic-safe.rs
+++ b/tests/ui/coroutine/panic-safe.rs
@@ -2,9 +2,9 @@
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
use std::panic;
diff --git a/tests/ui/generator/parent-expression.rs b/tests/ui/coroutine/parent-expression.rs
index 198b14528..4d40192c0 100644
--- a/tests/ui/generator/parent-expression.rs
+++ b/tests/ui/coroutine/parent-expression.rs
@@ -1,4 +1,4 @@
-#![feature(generators, negative_impls, rustc_attrs)]
+#![feature(coroutines, negative_impls, rustc_attrs)]
macro_rules! type_combinations {
(
diff --git a/tests/ui/generator/parent-expression.stderr b/tests/ui/coroutine/parent-expression.stderr
index 25a3b051b..6b611bc3f 100644
--- a/tests/ui/generator/parent-expression.stderr
+++ b/tests/ui/coroutine/parent-expression.stderr
@@ -1,8 +1,8 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -13,8 +13,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
-note: generator is not `Send` as this value is used across a yield
+ = help: within `{coroutine@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `derived_drop::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
@@ -38,11 +38,11 @@ LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -53,8 +53,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
-note: generator is not `Send` as this value is used across a yield
+ = help: within `{coroutine@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `significant_drop::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
@@ -78,11 +78,11 @@ LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/parent-expression.rs:23:13
|
LL | assert_send(g);
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
...
LL | / type_combinations!(
LL | | // OK
@@ -93,8 +93,8 @@ LL | | };
LL | | );
| |_____- in this macro invocation
|
- = help: within `{generator@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
-note: generator is not `Send` as this value is used across a yield
+ = help: within `{coroutine@$DIR/parent-expression.rs:17:21: 17:28}`, the trait `Send` is not implemented for `insignificant_dtor::Client`
+note: coroutine is not `Send` as this value is used across a yield
--> $DIR/parent-expression.rs:21:22
|
LL | let g = move || match drop($name::Client { ..$name::Client::default() }) {
diff --git a/tests/ui/generator/partial-drop.rs b/tests/ui/coroutine/partial-drop.rs
index 868f36adc..a4347f52a 100644
--- a/tests/ui/generator/partial-drop.rs
+++ b/tests/ui/coroutine/partial-drop.rs
@@ -1,5 +1,5 @@
// check-pass
-#![feature(negative_impls, generators)]
+#![feature(negative_impls, coroutines)]
struct Foo;
impl !Send for Foo {}
diff --git a/tests/ui/generator/partial-initialization-across-yield.rs b/tests/ui/coroutine/partial-initialization-across-yield.rs
index 65d9e6d39..75ad5a228 100644
--- a/tests/ui/generator/partial-initialization-across-yield.rs
+++ b/tests/ui/coroutine/partial-initialization-across-yield.rs
@@ -1,7 +1,7 @@
-// Test that we don't allow yielding from a generator while a local is partially
+// Test that we don't allow yielding from a coroutine while a local is partially
// initialized.
-#![feature(generators)]
+#![feature(coroutines)]
struct S { x: i32, y: i32 }
struct T(i32, i32);
diff --git a/tests/ui/generator/partial-initialization-across-yield.stderr b/tests/ui/coroutine/partial-initialization-across-yield.stderr
index 3f9f1c046..3f9f1c046 100644
--- a/tests/ui/generator/partial-initialization-across-yield.stderr
+++ b/tests/ui/coroutine/partial-initialization-across-yield.stderr
diff --git a/tests/ui/generator/pattern-borrow.rs b/tests/ui/coroutine/pattern-borrow.rs
index d19363708..76084433d 100644
--- a/tests/ui/generator/pattern-borrow.rs
+++ b/tests/ui/coroutine/pattern-borrow.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
enum Test { A(i32), B, }
@@ -6,7 +6,7 @@ fn main() { }
fn fun(test: Test) {
move || {
- if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when generator yields
+ if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when coroutine yields
yield ();
_a.use_ref();
}
diff --git a/tests/ui/generator/pattern-borrow.stderr b/tests/ui/coroutine/pattern-borrow.stderr
index d78da5104..ddb3bf662 100644
--- a/tests/ui/generator/pattern-borrow.stderr
+++ b/tests/ui/coroutine/pattern-borrow.stderr
@@ -1,4 +1,4 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/pattern-borrow.rs:9:24
|
LL | if let Test::A(ref _a) = test {
diff --git a/tests/ui/coroutine/pin-box-coroutine.rs b/tests/ui/coroutine/pin-box-coroutine.rs
new file mode 100644
index 000000000..e348551a6
--- /dev/null
+++ b/tests/ui/coroutine/pin-box-coroutine.rs
@@ -0,0 +1,13 @@
+// run-pass
+
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+
+fn assert_coroutine<G: Coroutine>(_: G) {
+}
+
+fn main() {
+ assert_coroutine(static || yield);
+ assert_coroutine(Box::pin(static || yield));
+}
diff --git a/tests/ui/generator/print/generator-print-verbose-1.rs b/tests/ui/coroutine/print/coroutine-print-verbose-1.rs
index e52234c08..c47d7572c 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.rs
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-1.rs
@@ -1,22 +1,22 @@
// compile-flags: -Zverbose
-// Same as: tests/ui/generator/issue-68112.stderr
+// Same as: tests/ui/coroutine/issue-68112.stderr
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::{
cell::RefCell,
sync::Arc,
pin::Pin,
- ops::{Generator, GeneratorState},
+ ops::{Coroutine, CoroutineState},
};
pub struct Ready<T>(Option<T>);
-impl<T: Unpin> Generator<()> for Ready<T> {
+impl<T: Unpin> Coroutine<()> for Ready<T> {
type Return = T;
type Yield = ();
- fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
- GeneratorState::Complete(self.0.take().unwrap())
+ fn resume(mut self: Pin<&mut Self>, _args: ()) -> CoroutineState<(), T> {
+ CoroutineState::Complete(self.0.take().unwrap())
}
}
pub fn make_gen1<T>(t: T) -> Ready<T> {
@@ -25,32 +25,32 @@ pub fn make_gen1<T>(t: T) -> Ready<T> {
fn require_send(_: impl Send) {}
-fn make_non_send_generator() -> impl Generator<Return = Arc<RefCell<i32>>> {
+fn make_non_send_coroutine() -> impl Coroutine<Return = Arc<RefCell<i32>>> {
make_gen1(Arc::new(RefCell::new(0)))
}
fn test1() {
let send_gen = || {
- let _non_send_gen = make_non_send_generator();
+ let _non_send_gen = make_non_send_coroutine();
yield;
};
require_send(send_gen);
- //~^ ERROR generator cannot be sent between threads
+ //~^ ERROR coroutine cannot be sent between threads
}
-pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> {
|| {
yield;
t
}
}
-fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
+fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> {
make_gen2(Arc::new(RefCell::new(0)))
}
fn test2() {
let send_gen = || {
- let _non_send_gen = make_non_send_generator2();
+ let _non_send_gen = make_non_send_coroutine2();
yield;
};
require_send(send_gen);
diff --git a/tests/ui/generator/print/generator-print-verbose-1.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr
index d949543de..bcdcbc154 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.stderr
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr
@@ -1,26 +1,26 @@
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-1.rs:37:5
+error: coroutine cannot be sent between threads safely
+ --> $DIR/coroutine-print-verbose-1.rs:37:5
|
LL | require_send(send_gen);
- | ^^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^^ coroutine is not `Send`
|
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-1.rs:35:9
+note: coroutine is not `Send` as this value is used across a yield
+ --> $DIR/coroutine-print-verbose-1.rs:35:9
|
-LL | let _non_send_gen = make_non_send_generator();
- | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[7d1d]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
+LL | let _non_send_gen = make_non_send_coroutine();
+ | ------------- has type `Opaque(DefId(0:34 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine::{opaque#0}), [])` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:26:25
+ --> $DIR/coroutine-print-verbose-1.rs:26:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
- --> $DIR/generator-print-verbose-1.rs:56:5
+ --> $DIR/coroutine-print-verbose-1.rs:56:5
|
LL | require_send(send_gen);
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
@@ -28,29 +28,29 @@ LL | require_send(send_gen);
= help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead
= note: required for `Arc<RefCell<i32>>` to implement `Send`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:42:5
+note: required because it's used within this coroutine
+ --> $DIR/coroutine-print-verbose-1.rs:42:5
|
LL | || {
| ^^
-note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[7d1d]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
- --> $DIR/generator-print-verbose-1.rs:41:30
+note: required because it appears within the type `Opaque(DefId(0:35 ~ coroutine_print_verbose_1[75fb]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])`
+ --> $DIR/coroutine-print-verbose-1.rs:41:30
|
-LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
+LL | pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`
- --> $DIR/generator-print-verbose-1.rs:47:34
+note: required because it appears within the type `Opaque(DefId(0:36 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine2::{opaque#0}), [])`
+ --> $DIR/coroutine-print-verbose-1.rs:47:34
|
-LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
+LL | fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[7d1d]::make_non_send_generator2::{opaque#0}), [])`
-note: required because it's used within this generator
- --> $DIR/generator-print-verbose-1.rs:52:20
+ = note: required because it captures the following types: `Opaque(DefId(0:36 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine2::{opaque#0}), [])`
+note: required because it's used within this coroutine
+ --> $DIR/coroutine-print-verbose-1.rs:52:20
|
LL | let send_gen = || {
| ^^
note: required by a bound in `require_send`
- --> $DIR/generator-print-verbose-1.rs:26:25
+ --> $DIR/coroutine-print-verbose-1.rs:26:25
|
LL | fn require_send(_: impl Send) {}
| ^^^^ required by this bound in `require_send`
diff --git a/tests/ui/generator/print/generator-print-verbose-2.rs b/tests/ui/coroutine/print/coroutine-print-verbose-2.rs
index e53a7ef8c..c65c33cb4 100644
--- a/tests/ui/generator/print/generator-print-verbose-2.rs
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-2.rs
@@ -1,7 +1,7 @@
// compile-flags: -Zverbose
-// Same as test/ui/generator/not-send-sync.rs
-#![feature(generators)]
+// Same as test/ui/coroutine/not-send-sync.rs
+#![feature(coroutines)]
#![feature(negative_impls)]
struct NotSend;
@@ -15,14 +15,14 @@ fn main() {
fn assert_send<T: Send>(_: T) {}
assert_sync(|| {
- //~^ ERROR: generator cannot be shared between threads safely
+ //~^ ERROR: coroutine cannot be shared between threads safely
let a = NotSync;
yield;
drop(a);
});
assert_send(|| {
- //~^ ERROR: generator cannot be sent between threads safely
+ //~^ ERROR: coroutine cannot be sent between threads safely
let a = NotSend;
yield;
drop(a);
diff --git a/tests/ui/generator/print/generator-print-verbose-2.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr
index 8ff755761..e9c7a8ffc 100644
--- a/tests/ui/generator/print/generator-print-verbose-2.stderr
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr
@@ -1,39 +1,39 @@
-error: generator cannot be shared between threads safely
- --> $DIR/generator-print-verbose-2.rs:17:5
+error: coroutine cannot be shared between threads safely
+ --> $DIR/coroutine-print-verbose-2.rs:17:5
|
LL | assert_sync(|| {
- | ^^^^^^^^^^^ generator is not `Sync`
+ | ^^^^^^^^^^^ coroutine is not `Sync`
|
= help: within `{main::{closure#0} upvar_tys=() {main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync`
-note: generator is not `Sync` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:20:9
+note: coroutine is not `Sync` as this value is used across a yield
+ --> $DIR/coroutine-print-verbose-2.rs:20:9
|
LL | let a = NotSync;
| - has type `NotSync` which is not `Sync`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_sync`
- --> $DIR/generator-print-verbose-2.rs:14:23
+ --> $DIR/coroutine-print-verbose-2.rs:14:23
|
LL | fn assert_sync<T: Sync>(_: T) {}
| ^^^^ required by this bound in `assert_sync`
-error: generator cannot be sent between threads safely
- --> $DIR/generator-print-verbose-2.rs:24:5
+error: coroutine cannot be sent between threads safely
+ --> $DIR/coroutine-print-verbose-2.rs:24:5
|
LL | assert_send(|| {
- | ^^^^^^^^^^^ generator is not `Send`
+ | ^^^^^^^^^^^ coroutine is not `Send`
|
= help: within `{main::{closure#1} upvar_tys=() {main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend`
-note: generator is not `Send` as this value is used across a yield
- --> $DIR/generator-print-verbose-2.rs:27:9
+note: coroutine is not `Send` as this value is used across a yield
+ --> $DIR/coroutine-print-verbose-2.rs:27:9
|
LL | let a = NotSend;
| - has type `NotSend` which is not `Send`
LL | yield;
| ^^^^^ yield occurs here, with `a` maybe used later
note: required by a bound in `assert_send`
- --> $DIR/generator-print-verbose-2.rs:15:23
+ --> $DIR/coroutine-print-verbose-2.rs:15:23
|
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
diff --git a/tests/ui/generator/print/generator-print-verbose-3.rs b/tests/ui/coroutine/print/coroutine-print-verbose-3.rs
index 8689539ec..3e4bb6281 100644
--- a/tests/ui/generator/print/generator-print-verbose-3.rs
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-3.rs
@@ -1,10 +1,10 @@
// compile-flags: -Zverbose
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
fn main() {
let x = "Type mismatch test";
- let generator :() = || {
+ let coroutine :() = || {
//~^ ERROR mismatched types
yield 1i32;
return x
diff --git a/tests/ui/generator/print/generator-print-verbose-3.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-3.stderr
index 69358ed0a..fb80f29d1 100644
--- a/tests/ui/generator/print/generator-print-verbose-3.stderr
+++ b/tests/ui/coroutine/print/coroutine-print-verbose-3.stderr
@@ -1,7 +1,7 @@
error[E0308]: mismatched types
- --> $DIR/generator-print-verbose-3.rs:7:25
+ --> $DIR/coroutine-print-verbose-3.rs:7:25
|
-LL | let generator :() = || {
+LL | let coroutine :() = || {
| ____________________--___^
| | |
| | expected due to this
@@ -9,10 +9,10 @@ LL | |
LL | | yield 1i32;
LL | | return x
LL | | };
- | |_____^ expected `()`, found generator
+ | |_____^ expected `()`, found coroutine
|
= note: expected unit type `()`
- found generator `{main::{closure#0} upvar_tys=(unavailable)}`
+ found coroutine `{main::{closure#0} upvar_tys=(unavailable)}`
error: aborting due to previous error
diff --git a/tests/ui/generator/reborrow-mut-upvar.rs b/tests/ui/coroutine/reborrow-mut-upvar.rs
index dbd9e24e2..e4f717be8 100644
--- a/tests/ui/generator/reborrow-mut-upvar.rs
+++ b/tests/ui/coroutine/reborrow-mut-upvar.rs
@@ -1,9 +1,9 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn _run(bar: &mut i32) {
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
{
let _baz = &*bar;
yield;
diff --git a/tests/ui/generator/reborrow-mut-upvar.stderr b/tests/ui/coroutine/reborrow-mut-upvar.stderr
index 2e1fec35e..5b614ac4b 100644
--- a/tests/ui/generator/reborrow-mut-upvar.stderr
+++ b/tests/ui/coroutine/reborrow-mut-upvar.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/reborrow-mut-upvar.rs:6:5
|
LL | / || {
@@ -10,7 +10,7 @@ LL | | *bar = 2;
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/ref-escapes-but-not-over-yield.rs b/tests/ui/coroutine/ref-escapes-but-not-over-yield.rs
index 3856d8233..a9c13188f 100644
--- a/tests/ui/generator/ref-escapes-but-not-over-yield.rs
+++ b/tests/ui/coroutine/ref-escapes-but-not-over-yield.rs
@@ -1,7 +1,7 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn foo(x: &i32) {
- // In this case, a reference to `b` escapes the generator, but not
+ // In this case, a reference to `b` escapes the coroutine, but not
// because of a yield. We see that there is no yield in the scope of
// `b` and give the more generic error message.
let mut a = &3;
@@ -9,7 +9,7 @@ fn foo(x: &i32) {
yield();
let b = 5;
a = &b;
- //~^ ERROR borrowed data escapes outside of generator
+ //~^ ERROR borrowed data escapes outside of coroutine
};
}
diff --git a/tests/ui/generator/ref-escapes-but-not-over-yield.stderr b/tests/ui/coroutine/ref-escapes-but-not-over-yield.stderr
index 5fc810040..4c8694e67 100644
--- a/tests/ui/generator/ref-escapes-but-not-over-yield.stderr
+++ b/tests/ui/coroutine/ref-escapes-but-not-over-yield.stderr
@@ -1,14 +1,14 @@
-error[E0521]: borrowed data escapes outside of generator
+error[E0521]: borrowed data escapes outside of coroutine
--> $DIR/ref-escapes-but-not-over-yield.rs:11:9
|
LL | let mut a = &3;
- | ----- `a` declared here, outside of the generator body
+ | ----- `a` declared here, outside of the coroutine body
...
LL | a = &b;
| ^^^^--
| | |
- | | borrow is only valid in the generator body
- | reference to `b` escapes the generator body here
+ | | borrow is only valid in the coroutine body
+ | reference to `b` escapes the coroutine body here
error: aborting due to previous error
diff --git a/tests/ui/generator/ref-upvar-not-send.rs b/tests/ui/coroutine/ref-upvar-not-send.rs
index eb9ef63ec..487fdeea2 100644
--- a/tests/ui/generator/ref-upvar-not-send.rs
+++ b/tests/ui/coroutine/ref-upvar-not-send.rs
@@ -1,7 +1,7 @@
-// For `Send` generators, suggest a `T: Sync` requirement for `&T` upvars,
+// For `Send` coroutines, suggest a `T: Sync` requirement for `&T` upvars,
// and suggest a `T: Send` requirement for `&mut T` upvars.
-#![feature(generators)]
+#![feature(coroutines)]
fn assert_send<T: Send>(_: T) {}
//~^ NOTE required by a bound in `assert_send`
@@ -13,16 +13,16 @@ fn main() {
let x: &*mut () = &std::ptr::null_mut();
let y: &mut *mut () = &mut std::ptr::null_mut();
assert_send(move || {
- //~^ ERROR generator cannot be sent between threads safely
- //~| NOTE generator is not `Send`
+ //~^ ERROR coroutine cannot be sent between threads safely
+ //~| NOTE coroutine is not `Send`
yield;
let _x = x;
});
//~^^ NOTE captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
//~| NOTE has type `&*mut ()` which is not `Send`, because `*mut ()` is not `Sync`
assert_send(move || {
- //~^ ERROR generator cannot be sent between threads safely
- //~| NOTE generator is not `Send`
+ //~^ ERROR coroutine cannot be sent between threads safely
+ //~| NOTE coroutine is not `Send`
yield;
let _y = y;
});
diff --git a/tests/ui/generator/ref-upvar-not-send.stderr b/tests/ui/coroutine/ref-upvar-not-send.stderr
index d6a2be977..7f18c6fba 100644
--- a/tests/ui/generator/ref-upvar-not-send.stderr
+++ b/tests/ui/coroutine/ref-upvar-not-send.stderr
@@ -1,4 +1,4 @@
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/ref-upvar-not-send.rs:15:17
|
LL | assert_send(move || {
@@ -8,7 +8,7 @@ LL | |
LL | | yield;
LL | | let _x = x;
LL | | });
- | |_____^ generator is not `Send`
+ | |_____^ coroutine is not `Send`
|
= help: the trait `Sync` is not implemented for `*mut ()`
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
@@ -22,7 +22,7 @@ note: required by a bound in `assert_send`
LL | fn assert_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `assert_send`
-error: generator cannot be sent between threads safely
+error: coroutine cannot be sent between threads safely
--> $DIR/ref-upvar-not-send.rs:23:17
|
LL | assert_send(move || {
@@ -32,9 +32,9 @@ LL | |
LL | | yield;
LL | | let _y = y;
LL | | });
- | |_____^ generator is not `Send`
+ | |_____^ coroutine is not `Send`
|
- = help: within `{generator@$DIR/ref-upvar-not-send.rs:23:17: 23:24}`, the trait `Send` is not implemented for `*mut ()`
+ = help: within `{coroutine@$DIR/ref-upvar-not-send.rs:23:17: 23:24}`, the trait `Send` is not implemented for `*mut ()`
note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send`
--> $DIR/ref-upvar-not-send.rs:27:18
|
diff --git a/tests/ui/generator/reinit-in-match-guard.rs b/tests/ui/coroutine/reinit-in-match-guard.rs
index 260b341a5..1895de1f1 100644
--- a/tests/ui/generator/reinit-in-match-guard.rs
+++ b/tests/ui/coroutine/reinit-in-match-guard.rs
@@ -1,6 +1,6 @@
// build-pass
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(unused_assignments, dead_code)]
diff --git a/tests/ui/generator/resume-after-return.rs b/tests/ui/coroutine/resume-after-return.rs
index 01a059a16..acbd8740a 100644
--- a/tests/ui/generator/resume-after-return.rs
+++ b/tests/ui/coroutine/resume-after-return.rs
@@ -2,9 +2,9 @@
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::pin::Pin;
use std::panic;
@@ -17,12 +17,12 @@ fn main() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
match panic::catch_unwind(move || Pin::new(&mut foo).resume(())) {
- Ok(_) => panic!("generator successfully resumed"),
+ Ok(_) => panic!("coroutine successfully resumed"),
Err(_) => {}
}
}
diff --git a/tests/ui/generator/resume-arg-late-bound.rs b/tests/ui/coroutine/resume-arg-late-bound.rs
index 1c35ba80d..dd6d318af 100644
--- a/tests/ui/generator/resume-arg-late-bound.rs
+++ b/tests/ui/coroutine/resume-arg-late-bound.rs
@@ -1,11 +1,11 @@
-//! Tests that we cannot produce a generator that accepts a resume argument
+//! Tests that we cannot produce a coroutine that accepts a resume argument
//! with any lifetime and then stores it across a `yield`.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn test(a: impl for<'a> Generator<&'a mut bool>) {}
+fn test(a: impl for<'a> Coroutine<&'a mut bool>) {}
fn main() {
let gen = |arg: &mut bool| {
diff --git a/tests/ui/generator/resume-arg-late-bound.stderr b/tests/ui/coroutine/resume-arg-late-bound.stderr
index 34ee4036c..f1a8a8ed7 100644
--- a/tests/ui/generator/resume-arg-late-bound.stderr
+++ b/tests/ui/coroutine/resume-arg-late-bound.stderr
@@ -4,12 +4,12 @@ error[E0308]: mismatched types
LL | test(gen);
| ^^^^^^^^^ one type is more general than the other
|
- = note: expected trait `for<'a> Generator<&'a mut bool>`
- found trait `Generator<&mut bool>`
+ = note: expected trait `for<'a> Coroutine<&'a mut bool>`
+ found trait `Coroutine<&mut bool>`
note: the lifetime requirement is introduced here
--> $DIR/resume-arg-late-bound.rs:8:17
|
-LL | fn test(a: impl for<'a> Generator<&'a mut bool>) {}
+LL | fn test(a: impl for<'a> Coroutine<&'a mut bool>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/generator/resume-arg-size.rs b/tests/ui/coroutine/resume-arg-size.rs
index 195166f97..22bb469f9 100644
--- a/tests/ui/generator/resume-arg-size.rs
+++ b/tests/ui/coroutine/resume-arg-size.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(dropping_copy_types)]
// run-pass
@@ -6,7 +6,7 @@
use std::mem::size_of_val;
fn main() {
- // Generator taking a `Copy`able resume arg.
+ // Coroutine taking a `Copy`able resume arg.
let gen_copy = |mut x: usize| {
loop {
drop(x);
@@ -14,7 +14,7 @@ fn main() {
}
};
- // Generator taking a non-`Copy` resume arg.
+ // Coroutine taking a non-`Copy` resume arg.
let gen_move = |mut x: Box<usize>| {
loop {
drop(x);
@@ -22,7 +22,7 @@ fn main() {
}
};
- // Neither of these generators have the resume arg live across the `yield`, so they should be
+ // Neither of these coroutines have the resume arg live across the `yield`, so they should be
// 1 Byte in size (only storing the discriminant)
assert_eq!(size_of_val(&gen_copy), 1);
assert_eq!(size_of_val(&gen_move), 1);
diff --git a/tests/ui/generator/resume-live-across-yield.rs b/tests/ui/coroutine/resume-live-across-yield.rs
index 4c4cf117a..935e7d326 100644
--- a/tests/ui/generator/resume-live-across-yield.rs
+++ b/tests/ui/coroutine/resume-live-across-yield.rs
@@ -1,8 +1,8 @@
// run-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -27,11 +27,11 @@ fn main() {
assert_eq!(
g.as_mut().resume(Dropper(String::from("Hello world!"))),
- GeneratorState::Yielded(())
+ CoroutineState::Yielded(())
);
assert_eq!(DROP.load(Ordering::Acquire), 0);
match g.as_mut().resume(Dropper(String::from("Number Two"))) {
- GeneratorState::Complete(dropper) => {
+ CoroutineState::Complete(dropper) => {
assert_eq!(DROP.load(Ordering::Acquire), 1);
assert_eq!(dropper.0, "Number Two");
drop(dropper);
diff --git a/tests/ui/generator/retain-resume-ref.rs b/tests/ui/coroutine/retain-resume-ref.rs
index 0606ea71c..c9f995ab0 100644
--- a/tests/ui/generator/retain-resume-ref.rs
+++ b/tests/ui/coroutine/retain-resume-ref.rs
@@ -1,11 +1,11 @@
//! This test ensures that a mutable reference cannot be passed as a resume argument twice.
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::marker::Unpin;
use std::ops::{
- Generator,
- GeneratorState::{self, *},
+ Coroutine,
+ CoroutineState::{self, *},
};
use std::pin::Pin;
diff --git a/tests/ui/generator/retain-resume-ref.stderr b/tests/ui/coroutine/retain-resume-ref.stderr
index e33310d12..e33310d12 100644
--- a/tests/ui/generator/retain-resume-ref.stderr
+++ b/tests/ui/coroutine/retain-resume-ref.stderr
diff --git a/tests/ui/coroutine/self_referential_gen_block.rs b/tests/ui/coroutine/self_referential_gen_block.rs
new file mode 100644
index 000000000..14daa2e9c
--- /dev/null
+++ b/tests/ui/coroutine/self_referential_gen_block.rs
@@ -0,0 +1,17 @@
+// compile-flags: --edition 2024 -Zunstable-options
+#![feature(gen_blocks)]
+//! This test checks that we don't allow self-referential generators
+
+fn main() {
+ let mut x = {
+ let mut x = gen {
+ let y = 42;
+ let z = &y; //~ ERROR: borrow may still be in use when `gen` block yields
+ yield 43;
+ panic!("{z}");
+ };
+ x.next();
+ Box::new(x)
+ };
+ x.next();
+}
diff --git a/tests/ui/coroutine/self_referential_gen_block.stderr b/tests/ui/coroutine/self_referential_gen_block.stderr
new file mode 100644
index 000000000..586f53df8
--- /dev/null
+++ b/tests/ui/coroutine/self_referential_gen_block.stderr
@@ -0,0 +1,11 @@
+error[E0626]: borrow may still be in use when `gen` block yields
+ --> $DIR/self_referential_gen_block.rs:9:21
+ |
+LL | let z = &y;
+ | ^^
+LL | yield 43;
+ | -------- possible yield occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0626`.
diff --git a/tests/ui/generator/size-moved-locals.rs b/tests/ui/coroutine/size-moved-locals.rs
index 601a31418..cfbbb9c1b 100644
--- a/tests/ui/generator/size-moved-locals.rs
+++ b/tests/ui/coroutine/size-moved-locals.rs
@@ -4,7 +4,7 @@
// `complex` below.)
//
// The exact sizes here can change (we'd like to know when they do). What we
-// don't want to see is the `complex` generator size being upwards of 2048 bytes
+// don't want to see is the `complex` coroutine size being upwards of 2048 bytes
// (which would indicate it is reserving space for two copies of Foo.)
//
// See issue #59123 for a full explanation.
@@ -14,9 +14,9 @@
// ignore-asmjs issue #62807
// needs-unwind Size of Closures change on panic=abort
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
const FOO_SIZE: usize = 1024;
struct Foo(#[allow(unused_tuple_struct_fields)] [u8; FOO_SIZE]);
@@ -25,7 +25,7 @@ impl Drop for Foo {
fn drop(&mut self) {}
}
-fn move_before_yield() -> impl Generator<Yield = (), Return = ()> {
+fn move_before_yield() -> impl Coroutine<Yield = (), Return = ()> {
static || {
let first = Foo([0; FOO_SIZE]);
let _second = first;
@@ -36,7 +36,7 @@ fn move_before_yield() -> impl Generator<Yield = (), Return = ()> {
fn noop() {}
-fn move_before_yield_with_noop() -> impl Generator<Yield = (), Return = ()> {
+fn move_before_yield_with_noop() -> impl Coroutine<Yield = (), Return = ()> {
static || {
let first = Foo([0; FOO_SIZE]);
noop();
@@ -48,7 +48,7 @@ fn move_before_yield_with_noop() -> impl Generator<Yield = (), Return = ()> {
// Today we don't have NRVO (we allocate space for both `first` and `second`,)
// but we can overlap `first` with `_third`.
-fn overlap_move_points() -> impl Generator<Yield = (), Return = ()> {
+fn overlap_move_points() -> impl Coroutine<Yield = (), Return = ()> {
static || {
let first = Foo([0; FOO_SIZE]);
yield;
@@ -59,7 +59,7 @@ fn overlap_move_points() -> impl Generator<Yield = (), Return = ()> {
}
}
-fn overlap_x_and_y() -> impl Generator<Yield = (), Return = ()> {
+fn overlap_x_and_y() -> impl Coroutine<Yield = (), Return = ()> {
static || {
let x = Foo([0; FOO_SIZE]);
yield;
diff --git a/tests/ui/coroutine/sized-yield.rs b/tests/ui/coroutine/sized-yield.rs
new file mode 100644
index 000000000..1368c88b5
--- /dev/null
+++ b/tests/ui/coroutine/sized-yield.rs
@@ -0,0 +1,14 @@
+#![feature(coroutines, coroutine_trait)]
+
+use std::ops::Coroutine;
+use std::pin::Pin;
+
+fn main() {
+ let s = String::from("foo");
+ let mut gen = move || {
+ //~^ ERROR the size for values of type
+ yield s[..];
+ };
+ Pin::new(&mut gen).resume(());
+ //~^ ERROR the size for values of type
+}
diff --git a/tests/ui/coroutine/sized-yield.stderr b/tests/ui/coroutine/sized-yield.stderr
new file mode 100644
index 000000000..40663ac12
--- /dev/null
+++ b/tests/ui/coroutine/sized-yield.stderr
@@ -0,0 +1,26 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/sized-yield.rs:8:27
+ |
+LL | let mut gen = move || {
+ | ___________________________^
+LL | |
+LL | | yield s[..];
+LL | | };
+ | |_____^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: the yield type of a coroutine must have a statically known size
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/sized-yield.rs:12:24
+ |
+LL | Pin::new(&mut gen).resume(());
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+note: required by a bound in `CoroutineState`
+ --> $SRC_DIR/core/src/ops/coroutine.rs:LL:COL
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/smoke-resume-args.rs b/tests/ui/coroutine/smoke-resume-args.rs
index fa9271c53..a80198985 100644
--- a/tests/ui/generator/smoke-resume-args.rs
+++ b/tests/ui/coroutine/smoke-resume-args.rs
@@ -3,20 +3,20 @@
// revisions: default nomiropt
//[nomiropt]compile-flags: -Z mir-opt-level=0
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::fmt::Debug;
use std::marker::Unpin;
use std::ops::{
- Generator,
- GeneratorState::{self, *},
+ Coroutine,
+ CoroutineState::{self, *},
};
use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
-fn drain<G: Generator<R, Yield = Y> + Unpin, R, Y>(
+fn drain<G: Coroutine<R, Yield = Y> + Unpin, R, Y>(
gen: &mut G,
- inout: Vec<(R, GeneratorState<Y, G::Return>)>,
+ inout: Vec<(R, CoroutineState<Y, G::Return>)>,
) where
Y: Debug + PartialEq,
G::Return: Debug + PartialEq,
diff --git a/tests/ui/generator/smoke.rs b/tests/ui/coroutine/smoke.rs
index 7a917a05d..b74ed2686 100644
--- a/tests/ui/generator/smoke.rs
+++ b/tests/ui/coroutine/smoke.rs
@@ -6,9 +6,9 @@
// ignore-emscripten no threads support
// compile-flags: --test
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::pin::Pin;
use std::thread;
@@ -21,7 +21,7 @@ fn simple() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -37,7 +37,7 @@ fn return_capture() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(ref s) if *s == "foo" => {}
+ CoroutineState::Complete(ref s) if *s == "foo" => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -49,11 +49,11 @@ fn simple_yield() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(()) => {}
+ CoroutineState::Yielded(()) => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -66,11 +66,11 @@ fn yield_capture() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(ref s) if *s == "foo" => {}
+ CoroutineState::Yielded(ref s) if *s == "foo" => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -83,11 +83,11 @@ fn simple_yield_value() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(ref s) if *s == "bar" => {}
+ CoroutineState::Yielded(ref s) if *s == "bar" => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(ref s) if *s == "foo" => {}
+ CoroutineState::Complete(ref s) if *s == "foo" => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -101,11 +101,11 @@ fn return_after_yield() {
};
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(()) => {}
+ CoroutineState::Yielded(()) => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(ref s) if *s == "foo" => {}
+ CoroutineState::Complete(ref s) if *s == "foo" => {}
s => panic!("bad state: {:?}", s),
}
}
@@ -153,11 +153,11 @@ fn send_over_threads() {
let mut foo = || { yield };
thread::spawn(move || {
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(()) => {}
+ CoroutineState::Yielded(()) => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}).join().unwrap();
@@ -166,11 +166,11 @@ fn send_over_threads() {
let mut foo = || { yield a };
thread::spawn(move || {
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(ref s) if *s == "a" => {}
+ CoroutineState::Yielded(ref s) if *s == "a" => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}).join().unwrap();
diff --git a/tests/ui/coroutine/static-coroutine.rs b/tests/ui/coroutine/static-coroutine.rs
new file mode 100644
index 000000000..f9fd65b97
--- /dev/null
+++ b/tests/ui/coroutine/static-coroutine.rs
@@ -0,0 +1,20 @@
+// run-pass
+
+#![feature(coroutines, coroutine_trait)]
+
+use std::pin::Pin;
+use std::ops::{Coroutine, CoroutineState};
+
+fn main() {
+ let mut coroutine = static || {
+ let a = true;
+ let b = &a;
+ yield;
+ assert_eq!(b as *const _, &a as *const _);
+ };
+ // SAFETY: We shadow the original coroutine variable so have no safe API to
+ // move it after this point.
+ let mut coroutine = unsafe { Pin::new_unchecked(&mut coroutine) };
+ assert_eq!(coroutine.as_mut().resume(()), CoroutineState::Yielded(()));
+ assert_eq!(coroutine.as_mut().resume(()), CoroutineState::Complete(()));
+}
diff --git a/tests/ui/generator/static-mut-reference-across-yield.rs b/tests/ui/coroutine/static-mut-reference-across-yield.rs
index 0fa6d9cdc..07f810856 100644
--- a/tests/ui/generator/static-mut-reference-across-yield.rs
+++ b/tests/ui/coroutine/static-mut-reference-across-yield.rs
@@ -2,7 +2,7 @@
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
-#![feature(generators)]
+#![feature(coroutines)]
static mut A: [i32; 5] = [1, 2, 3, 4, 5];
diff --git a/tests/ui/generator/static-not-unpin.current.stderr b/tests/ui/coroutine/static-not-unpin.current.stderr
index 242489841..cd607904f 100644
--- a/tests/ui/generator/static-not-unpin.current.stderr
+++ b/tests/ui/coroutine/static-not-unpin.current.stderr
@@ -1,8 +1,8 @@
-error[E0277]: `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned
+error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned
--> $DIR/static-not-unpin.rs:17:18
|
-LL | assert_unpin(generator);
- | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}`
+LL | assert_unpin(coroutine);
+ | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:14:25: 14:34}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/generator/static-not-unpin.next.stderr b/tests/ui/coroutine/static-not-unpin.next.stderr
index 242489841..cd607904f 100644
--- a/tests/ui/generator/static-not-unpin.next.stderr
+++ b/tests/ui/coroutine/static-not-unpin.next.stderr
@@ -1,8 +1,8 @@
-error[E0277]: `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned
+error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:14:25: 14:34}` cannot be unpinned
--> $DIR/static-not-unpin.rs:17:18
|
-LL | assert_unpin(generator);
- | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/static-not-unpin.rs:14:25: 14:34}`
+LL | assert_unpin(coroutine);
+ | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:14:25: 14:34}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/generator/static-not-unpin.rs b/tests/ui/coroutine/static-not-unpin.rs
index 30d3f2918..6ce78046d 100644
--- a/tests/ui/generator/static-not-unpin.rs
+++ b/tests/ui/coroutine/static-not-unpin.rs
@@ -1,7 +1,7 @@
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
-#![feature(generators)]
+#![feature(coroutines)]
// normalize-stderr-test "std::pin::Unpin" -> "std::marker::Unpin"
@@ -11,8 +11,8 @@ fn assert_unpin<T: Unpin>(_: T) {
}
fn main() {
- let mut generator = static || {
+ let mut coroutine = static || {
yield;
};
- assert_unpin(generator); //~ ERROR E0277
+ assert_unpin(coroutine); //~ ERROR E0277
}
diff --git a/tests/ui/generator/static-reference-across-yield.rs b/tests/ui/coroutine/static-reference-across-yield.rs
index 23b11593b..6496d8b86 100644
--- a/tests/ui/generator/static-reference-across-yield.rs
+++ b/tests/ui/coroutine/static-reference-across-yield.rs
@@ -1,5 +1,5 @@
// build-pass
-#![feature(generators)]
+#![feature(coroutines)]
static A: [i32; 5] = [1, 2, 3, 4, 5];
diff --git a/tests/ui/generator/too-live-local-in-immovable-gen.rs b/tests/ui/coroutine/too-live-local-in-immovable-gen.rs
index e0b856db7..7eaa15522 100644
--- a/tests/ui/generator/too-live-local-in-immovable-gen.rs
+++ b/tests/ui/coroutine/too-live-local-in-immovable-gen.rs
@@ -1,15 +1,15 @@
// run-pass
#![allow(unused_unsafe)]
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
unsafe {
- static move || { //~ WARN unused generator that must be used
- // Tests that the generator transformation finds out that `a` is not live
+ static move || { //~ WARN unused coroutine that must be used
+ // Tests that the coroutine transformation finds out that `a` is not live
// during the yield expression. Type checking will also compute liveness
// and it should also find out that `a` is not live.
- // The compiler will panic if the generator transformation finds that
+ // The compiler will panic if the coroutine transformation finds that
// `a` is live and type checking finds it dead.
let a = {
yield ();
diff --git a/tests/ui/generator/too-live-local-in-immovable-gen.stderr b/tests/ui/coroutine/too-live-local-in-immovable-gen.stderr
index e262f213f..4a67dbe71 100644
--- a/tests/ui/generator/too-live-local-in-immovable-gen.stderr
+++ b/tests/ui/coroutine/too-live-local-in-immovable-gen.stderr
@@ -1,8 +1,8 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/too-live-local-in-immovable-gen.rs:8:9
|
LL | / static move || {
-LL | | // Tests that the generator transformation finds out that `a` is not live
+LL | | // Tests that the coroutine transformation finds out that `a` is not live
LL | | // during the yield expression. Type checking will also compute liveness
LL | | // and it should also find out that `a` is not live.
... |
@@ -10,7 +10,7 @@ LL | | let _ = &a;
LL | | };
| |_________^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/coroutine/too-many-parameters.rs b/tests/ui/coroutine/too-many-parameters.rs
new file mode 100644
index 000000000..377d80c7b
--- /dev/null
+++ b/tests/ui/coroutine/too-many-parameters.rs
@@ -0,0 +1,8 @@
+#![feature(coroutines)]
+
+fn main() {
+ |(), ()| {
+ //~^ error: too many parameters for a coroutine
+ yield;
+ };
+}
diff --git a/tests/ui/generator/too-many-parameters.stderr b/tests/ui/coroutine/too-many-parameters.stderr
index 22d40db3f..54cf42e78 100644
--- a/tests/ui/generator/too-many-parameters.stderr
+++ b/tests/ui/coroutine/too-many-parameters.stderr
@@ -1,4 +1,4 @@
-error[E0628]: too many parameters for a generator (expected 0 or 1 parameters)
+error[E0628]: too many parameters for a coroutine (expected 0 or 1 parameters)
--> $DIR/too-many-parameters.rs:4:5
|
LL | |(), ()| {
diff --git a/tests/ui/generator/type-mismatch-error.rs b/tests/ui/coroutine/type-mismatch-error.rs
index d39c788a8..0d04c2148 100644
--- a/tests/ui/generator/type-mismatch-error.rs
+++ b/tests/ui/coroutine/type-mismatch-error.rs
@@ -1,11 +1,11 @@
//! Test that we get the expected type mismatch error instead of "closure is expected to take 0
//! arguments" (which got introduced after implementing resume arguments).
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn f<G: Generator>(_: G, _: G::Return) {}
+fn f<G: Coroutine>(_: G, _: G::Return) {}
fn main() {
f(
diff --git a/tests/ui/generator/type-mismatch-error.stderr b/tests/ui/coroutine/type-mismatch-error.stderr
index 8f5949533..8f5949533 100644
--- a/tests/ui/generator/type-mismatch-error.stderr
+++ b/tests/ui/coroutine/type-mismatch-error.stderr
diff --git a/tests/ui/generator/type-mismatch-signature-deduction.rs b/tests/ui/coroutine/type-mismatch-signature-deduction.rs
index 8d1ce6c7a..d4ca622e8 100644
--- a/tests/ui/generator/type-mismatch-signature-deduction.rs
+++ b/tests/ui/coroutine/type-mismatch-signature-deduction.rs
@@ -1,8 +1,8 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn foo() -> impl Generator<Return = i32> {
+fn foo() -> impl Coroutine<Return = i32> {
//~^ ERROR type mismatch
|| {
if false {
diff --git a/tests/ui/generator/type-mismatch-signature-deduction.stderr b/tests/ui/coroutine/type-mismatch-signature-deduction.stderr
index fe1bade55..f26e30a8e 100644
--- a/tests/ui/generator/type-mismatch-signature-deduction.stderr
+++ b/tests/ui/coroutine/type-mismatch-signature-deduction.stderr
@@ -18,10 +18,10 @@ LL | Ok(5)
LL | Err(5)
| ++++ +
-error[E0271]: type mismatch resolving `<{generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7} as Generator>::Return == i32`
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7} as Coroutine>::Return == i32`
--> $DIR/type-mismatch-signature-deduction.rs:5:13
|
-LL | fn foo() -> impl Generator<Return = i32> {
+LL | fn foo() -> impl Coroutine<Return = i32> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result<{integer}, _>`, found `i32`
|
= note: expected enum `Result<{integer}, _>`
diff --git a/tests/ui/generator/unresolved-ct-var.rs b/tests/ui/coroutine/unresolved-ct-var.rs
index 0316385fb..0316385fb 100644
--- a/tests/ui/generator/unresolved-ct-var.rs
+++ b/tests/ui/coroutine/unresolved-ct-var.rs
diff --git a/tests/ui/generator/unresolved-ct-var.stderr b/tests/ui/coroutine/unresolved-ct-var.stderr
index 9badc1dc2..9badc1dc2 100644
--- a/tests/ui/generator/unresolved-ct-var.stderr
+++ b/tests/ui/coroutine/unresolved-ct-var.stderr
diff --git a/tests/ui/generator/unsized-capture-across-yield.rs b/tests/ui/coroutine/unsized-capture-across-yield.rs
index 7bcb0800c..ef9cbc1d6 100644
--- a/tests/ui/generator/unsized-capture-across-yield.rs
+++ b/tests/ui/coroutine/unsized-capture-across-yield.rs
@@ -1,11 +1,11 @@
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
#![feature(unsized_locals)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn capture() -> impl Generator {
+fn capture() -> impl Coroutine {
let b: [u8] = *(Box::new([]) as Box<[u8]>);
move || {
println!("{:?}", &b);
diff --git a/tests/ui/generator/unsized-capture-across-yield.stderr b/tests/ui/coroutine/unsized-capture-across-yield.stderr
index 8a5b968a5..8a5b968a5 100644
--- a/tests/ui/generator/unsized-capture-across-yield.stderr
+++ b/tests/ui/coroutine/unsized-capture-across-yield.stderr
diff --git a/tests/ui/generator/unsized-local-across-yield.rs b/tests/ui/coroutine/unsized-local-across-yield.rs
index f761f45c2..7a8ed60e4 100644
--- a/tests/ui/generator/unsized-local-across-yield.rs
+++ b/tests/ui/coroutine/unsized-local-across-yield.rs
@@ -1,11 +1,11 @@
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
#![feature(unsized_locals)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn across() -> impl Generator {
+fn across() -> impl Coroutine {
move || {
let b: [u8] = *(Box::new([]) as Box<[u8]>);
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
diff --git a/tests/ui/generator/unsized-local-across-yield.stderr b/tests/ui/coroutine/unsized-local-across-yield.stderr
index 1942f266e..1942f266e 100644
--- a/tests/ui/generator/unsized-local-across-yield.stderr
+++ b/tests/ui/coroutine/unsized-local-across-yield.stderr
diff --git a/tests/ui/coroutine/unwind-abort-mix.rs b/tests/ui/coroutine/unwind-abort-mix.rs
new file mode 100644
index 000000000..869b3e4f4
--- /dev/null
+++ b/tests/ui/coroutine/unwind-abort-mix.rs
@@ -0,0 +1,13 @@
+// Ensure that coroutine drop glue is valid when mixing different panic
+// strategies. Regression test for #116953.
+//
+// no-prefer-dynamic
+// build-pass
+// aux-build:unwind-aux.rs
+// compile-flags: -Cpanic=abort
+// needs-unwind
+extern crate unwind_aux;
+
+pub fn main() {
+ unwind_aux::run(String::new());
+}
diff --git a/tests/ui/generator/witness-ignore-fake-reads.rs b/tests/ui/coroutine/witness-ignore-fake-reads.rs
index ccf9ce8b4..ccf9ce8b4 100644
--- a/tests/ui/generator/witness-ignore-fake-reads.rs
+++ b/tests/ui/coroutine/witness-ignore-fake-reads.rs
diff --git a/tests/ui/generator/xcrate-reachable.rs b/tests/ui/coroutine/xcrate-reachable.rs
index 1b1cff338..c63284488 100644
--- a/tests/ui/generator/xcrate-reachable.rs
+++ b/tests/ui/coroutine/xcrate-reachable.rs
@@ -2,11 +2,11 @@
// aux-build:xcrate-reachable.rs
-#![feature(generator_trait)]
+#![feature(coroutine_trait)]
extern crate xcrate_reachable as foo;
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/generator/xcrate.rs b/tests/ui/coroutine/xcrate.rs
index 40986bbeb..4572d1cfd 100644
--- a/tests/ui/generator/xcrate.rs
+++ b/tests/ui/coroutine/xcrate.rs
@@ -2,29 +2,29 @@
// aux-build:xcrate.rs
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
extern crate xcrate;
-use std::ops::{GeneratorState, Generator};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn main() {
let mut foo = xcrate::foo();
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
let mut foo = xcrate::bar(3);
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Yielded(3) => {}
+ CoroutineState::Yielded(3) => {}
s => panic!("bad state: {:?}", s),
}
match Pin::new(&mut foo).resume(()) {
- GeneratorState::Complete(()) => {}
+ CoroutineState::Complete(()) => {}
s => panic!("bad state: {:?}", s),
}
}
diff --git a/tests/ui/generator/yield-in-args-rev.rs b/tests/ui/coroutine/yield-in-args-rev.rs
index 4c99bb3ef..b22c32ccd 100644
--- a/tests/ui/generator/yield-in-args-rev.rs
+++ b/tests/ui/coroutine/yield-in-args-rev.rs
@@ -5,12 +5,12 @@
// argument list is not treated as live across the yield by
// type-checking.
-#![feature(generators)]
+#![feature(coroutines)]
fn foo(_a: (), _b: &bool) {}
fn bar() {
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
let b = true;
foo(yield, &b);
};
diff --git a/tests/ui/generator/yield-in-args-rev.stderr b/tests/ui/coroutine/yield-in-args-rev.stderr
index a87248f66..dbf46739e 100644
--- a/tests/ui/generator/yield-in-args-rev.stderr
+++ b/tests/ui/coroutine/yield-in-args-rev.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/yield-in-args-rev.rs:13:5
|
LL | / || {
@@ -7,7 +7,7 @@ LL | | foo(yield, &b);
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/yield-in-args.rs b/tests/ui/coroutine/yield-in-args.rs
index 80110af55..b2827148d 100644
--- a/tests/ui/generator/yield-in-args.rs
+++ b/tests/ui/coroutine/yield-in-args.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn foo(_b: &bool, _a: ()) {}
diff --git a/tests/ui/generator/yield-in-args.stderr b/tests/ui/coroutine/yield-in-args.stderr
index ee6d22c27..4ff97281d 100644
--- a/tests/ui/generator/yield-in-args.stderr
+++ b/tests/ui/coroutine/yield-in-args.stderr
@@ -1,4 +1,4 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/yield-in-args.rs:8:13
|
LL | foo(&b, yield);
diff --git a/tests/ui/generator/yield-in-const.rs b/tests/ui/coroutine/yield-in-const.rs
index fe5ca822c..22651f32c 100644
--- a/tests/ui/generator/yield-in-const.rs
+++ b/tests/ui/coroutine/yield-in-const.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
const A: u8 = { yield 3u8; 3u8};
//~^ ERROR yield expression outside
diff --git a/tests/ui/generator/yield-in-const.stderr b/tests/ui/coroutine/yield-in-const.stderr
index dcf4fe63e..7afcd8340 100644
--- a/tests/ui/generator/yield-in-const.stderr
+++ b/tests/ui/coroutine/yield-in-const.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/yield-in-const.rs:3:17
|
LL | const A: u8 = { yield 3u8; 3u8};
diff --git a/tests/ui/generator/yield-in-function.rs b/tests/ui/coroutine/yield-in-function.rs
index 29b811621..a99312043 100644
--- a/tests/ui/generator/yield-in-function.rs
+++ b/tests/ui/coroutine/yield-in-function.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() { yield; }
//~^ ERROR yield expression outside
diff --git a/tests/ui/generator/yield-in-function.stderr b/tests/ui/coroutine/yield-in-function.stderr
index 51cce198c..b2f839a65 100644
--- a/tests/ui/generator/yield-in-function.stderr
+++ b/tests/ui/coroutine/yield-in-function.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/yield-in-function.rs:3:13
|
LL | fn main() { yield; }
diff --git a/tests/ui/generator/yield-in-initializer.rs b/tests/ui/coroutine/yield-in-initializer.rs
index 0cab36e5f..5a7b3a4fe 100644
--- a/tests/ui/generator/yield-in-initializer.rs
+++ b/tests/ui/coroutine/yield-in-initializer.rs
@@ -1,9 +1,9 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
- static || { //~ WARN unused generator that must be used
+ static || { //~ WARN unused coroutine that must be used
loop {
// Test that `opt` is not live across the yield, even when borrowed in a loop
// See https://github.com/rust-lang/rust/issues/52792
diff --git a/tests/ui/generator/yield-in-initializer.stderr b/tests/ui/coroutine/yield-in-initializer.stderr
index ed14a2e32..614df43f2 100644
--- a/tests/ui/generator/yield-in-initializer.stderr
+++ b/tests/ui/coroutine/yield-in-initializer.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/yield-in-initializer.rs:6:5
|
LL | / static || {
@@ -10,7 +10,7 @@ LL | | }
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/yield-in-static.rs b/tests/ui/coroutine/yield-in-static.rs
index d27fbb33b..45e0380d4 100644
--- a/tests/ui/generator/yield-in-static.rs
+++ b/tests/ui/coroutine/yield-in-static.rs
@@ -1,4 +1,4 @@
-#![feature(generators)]
+#![feature(coroutines)]
static B: u8 = { yield 3u8; 3u8};
//~^ ERROR yield expression outside
diff --git a/tests/ui/generator/yield-in-static.stderr b/tests/ui/coroutine/yield-in-static.stderr
index d867f3ad3..17d58325e 100644
--- a/tests/ui/generator/yield-in-static.stderr
+++ b/tests/ui/coroutine/yield-in-static.stderr
@@ -1,4 +1,4 @@
-error[E0627]: yield expression outside of generator literal
+error[E0627]: yield expression outside of coroutine literal
--> $DIR/yield-in-static.rs:3:18
|
LL | static B: u8 = { yield 3u8; 3u8};
diff --git a/tests/ui/generator/yield-outside-generator-issue-78653.rs b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.rs
index 4e8050c81..31025c33b 100644
--- a/tests/ui/generator/yield-outside-generator-issue-78653.rs
+++ b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.rs
@@ -1,7 +1,7 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
yield || for i in 0 { }
- //~^ ERROR yield expression outside of generator literal
+ //~^ ERROR yield expression outside of coroutine literal
//~| ERROR `{integer}` is not an iterator
}
diff --git a/tests/ui/generator/yield-outside-generator-issue-78653.stderr b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr
index dcfb21174..f28f89135 100644
--- a/tests/ui/generator/yield-outside-generator-issue-78653.stderr
+++ b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr
@@ -1,11 +1,11 @@
-error[E0627]: yield expression outside of generator literal
- --> $DIR/yield-outside-generator-issue-78653.rs:4:5
+error[E0627]: yield expression outside of coroutine literal
+ --> $DIR/yield-outside-coroutine-issue-78653.rs:4:5
|
LL | yield || for i in 0 { }
| ^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: `{integer}` is not an iterator
- --> $DIR/yield-outside-generator-issue-78653.rs:4:23
+ --> $DIR/yield-outside-coroutine-issue-78653.rs:4:23
|
LL | yield || for i in 0 { }
| ^ `{integer}` is not an iterator
diff --git a/tests/ui/generator/yield-subtype.rs b/tests/ui/coroutine/yield-subtype.rs
index cb3fc9091..3595d4498 100644
--- a/tests/ui/generator/yield-subtype.rs
+++ b/tests/ui/coroutine/yield-subtype.rs
@@ -2,13 +2,13 @@
#![allow(dead_code)]
#![allow(dead_code)]
-#![feature(generators)]
+#![feature(coroutines)]
fn bar<'a>() {
let a: &'static str = "hi";
let b: &'a str = a;
- || { //~ WARN unused generator that must be used
+ || { //~ WARN unused coroutine that must be used
yield a;
yield b;
};
diff --git a/tests/ui/generator/yield-subtype.stderr b/tests/ui/coroutine/yield-subtype.stderr
index 97862e91c..5e7ae9f58 100644
--- a/tests/ui/generator/yield-subtype.stderr
+++ b/tests/ui/coroutine/yield-subtype.stderr
@@ -1,4 +1,4 @@
-warning: unused generator that must be used
+warning: unused coroutine that must be used
--> $DIR/yield-subtype.rs:11:5
|
LL | / || {
@@ -7,7 +7,7 @@ LL | | yield b;
LL | | };
| |_____^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/generator/yield-while-iterating.rs b/tests/ui/coroutine/yield-while-iterating.rs
index 985e5d8bd..66ac6d392 100644
--- a/tests/ui/generator/yield-while-iterating.rs
+++ b/tests/ui/coroutine/yield-while-iterating.rs
@@ -1,11 +1,11 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::cell::Cell;
use std::pin::Pin;
fn yield_during_iter_owned_data(x: Vec<i32>) {
- // The generator owns `x`, so we error out when yielding with a
+ // The coroutine owns `x`, so we error out when yielding with a
// reference to it. This winds up becoming a rather confusing
// regionck error -- in particular, we would freeze with the
// reference in scope, and it doesn't live long enough.
diff --git a/tests/ui/generator/yield-while-iterating.stderr b/tests/ui/coroutine/yield-while-iterating.stderr
index b65634752..5330121f3 100644
--- a/tests/ui/generator/yield-while-iterating.stderr
+++ b/tests/ui/coroutine/yield-while-iterating.stderr
@@ -1,4 +1,4 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/yield-while-iterating.rs:13:18
|
LL | for p in &x {
@@ -12,7 +12,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta
LL | let mut b = || {
| -- mutable borrow occurs here
LL | for p in &mut x {
- | - first borrow occurs due to use of `x` in generator
+ | - first borrow occurs due to use of `x` in coroutine
...
LL | println!("{}", x[0]);
| ^ immutable borrow occurs here
diff --git a/tests/ui/generator/yield-while-local-borrowed.rs b/tests/ui/coroutine/yield-while-local-borrowed.rs
index 061a64dbc..7f8d1d454 100644
--- a/tests/ui/generator/yield-while-local-borrowed.rs
+++ b/tests/ui/coroutine/yield-while-local-borrowed.rs
@@ -1,7 +1,7 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
use std::cell::Cell;
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn borrow_local_inline() {
@@ -11,8 +11,8 @@ fn borrow_local_inline() {
// `b` and gets extended by region inference.)
let mut b = move || {
let a = &mut 3;
- //~^ ERROR borrow may still be in use when generator yields
- yield();
+ //~^ ERROR borrow may still be in use when coroutine yields
+ yield ();
println!("{}", a);
};
Pin::new(&mut b).resume(());
@@ -24,7 +24,7 @@ fn borrow_local_inline_done() {
{
let a = &mut 3;
}
- yield();
+ yield ();
};
Pin::new(&mut b).resume(());
}
@@ -38,12 +38,12 @@ fn borrow_local() {
let a = 3;
{
let b = &a;
- //~^ ERROR borrow may still be in use when generator yields
- yield();
+ //~^ ERROR borrow may still be in use when coroutine yields
+ yield ();
println!("{}", b);
}
};
Pin::new(&mut b).resume(());
}
-fn main() { }
+fn main() {}
diff --git a/tests/ui/generator/yield-while-local-borrowed.stderr b/tests/ui/coroutine/yield-while-local-borrowed.stderr
index c1513ef9b..8fe981de9 100644
--- a/tests/ui/generator/yield-while-local-borrowed.stderr
+++ b/tests/ui/coroutine/yield-while-local-borrowed.stderr
@@ -1,20 +1,20 @@
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/yield-while-local-borrowed.rs:13:17
|
LL | let a = &mut 3;
| ^^^^^^
LL |
-LL | yield();
- | ------- possible yield occurs here
+LL | yield ();
+ | -------- possible yield occurs here
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/yield-while-local-borrowed.rs:40:21
|
LL | let b = &a;
| ^^
LL |
-LL | yield();
- | ------- possible yield occurs here
+LL | yield ();
+ | -------- possible yield occurs here
error: aborting due to 2 previous errors
diff --git a/tests/ui/generator/yield-while-ref-reborrowed.rs b/tests/ui/coroutine/yield-while-ref-reborrowed.rs
index a03ef945d..07c591758 100644
--- a/tests/ui/generator/yield-while-ref-reborrowed.rs
+++ b/tests/ui/coroutine/yield-while-ref-reborrowed.rs
@@ -1,12 +1,12 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{GeneratorState, Generator};
+use std::ops::{CoroutineState, Coroutine};
use std::cell::Cell;
use std::pin::Pin;
fn reborrow_shared_ref(x: &i32) {
// This is OK -- we have a borrow live over the yield, but it's of
- // data that outlives the generator.
+ // data that outlives the coroutine.
let mut b = move || {
let a = &*x;
yield();
@@ -17,7 +17,7 @@ fn reborrow_shared_ref(x: &i32) {
fn reborrow_mutable_ref(x: &mut i32) {
// This is OK -- we have a borrow live over the yield, but it's of
- // data that outlives the generator.
+ // data that outlives the coroutine.
let mut b = move || {
let a = &mut *x;
yield();
diff --git a/tests/ui/generator/yield-while-ref-reborrowed.stderr b/tests/ui/coroutine/yield-while-ref-reborrowed.stderr
index 47147f9c0..e60a95316 100644
--- a/tests/ui/generator/yield-while-ref-reborrowed.stderr
+++ b/tests/ui/coroutine/yield-while-ref-reborrowed.stderr
@@ -2,9 +2,9 @@ error[E0501]: cannot borrow `x` as immutable because previous closure requires u
--> $DIR/yield-while-ref-reborrowed.rs:36:20
|
LL | let mut b = || {
- | -- generator construction occurs here
+ | -- coroutine construction occurs here
LL | let a = &mut *x;
- | -- first borrow occurs due to use of `x` in generator
+ | -- first borrow occurs due to use of `x` in coroutine
...
LL | println!("{}", x);
| ^ second borrow occurs here
diff --git a/tests/ui/generator/yielding-in-match-guards.rs b/tests/ui/coroutine/yielding-in-match-guards.rs
index 4e89fc975..a9575a9e7 100644
--- a/tests/ui/generator/yielding-in-match-guards.rs
+++ b/tests/ui/coroutine/yielding-in-match-guards.rs
@@ -8,7 +8,7 @@
// indeed a temporary borrow `y` from `x` is live
// while `f().await` is being evaluated.
// Thus, `&'_ u8` should be included in type signature
-// of the underlying generator.
+// of the underlying coroutine.
#![feature(if_let_guard)]
diff --git a/tests/ui/crate-loading/invalid-rlib.rs b/tests/ui/crate-loading/invalid-rlib.rs
index aea861e32..0997bee19 100644
--- a/tests/ui/crate-loading/invalid-rlib.rs
+++ b/tests/ui/crate-loading/invalid-rlib.rs
@@ -8,3 +8,4 @@ use ::foo; //~ ERROR invalid metadata files for crate `foo`
//~| NOTE failed to mmap file
//~^^ ERROR invalid metadata files for crate `foo`
//~| NOTE failed to mmap file
+//~| NOTE duplicate diagnostic
diff --git a/tests/ui/crate-loading/invalid-rlib.stderr b/tests/ui/crate-loading/invalid-rlib.stderr
index 3c0d23bf7..63bb1b95c 100644
--- a/tests/ui/crate-loading/invalid-rlib.stderr
+++ b/tests/ui/crate-loading/invalid-rlib.stderr
@@ -13,6 +13,7 @@ LL | use ::foo;
| ^^^
|
= note: failed to mmap file 'auxiliary/libfoo.rlib'
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/debuginfo/sroa-fragment-debuginfo.rs b/tests/ui/debuginfo/sroa-fragment-debuginfo.rs
index 9c3c359e3..fc3bbb88e 100644
--- a/tests/ui/debuginfo/sroa-fragment-debuginfo.rs
+++ b/tests/ui/debuginfo/sroa-fragment-debuginfo.rs
@@ -1,4 +1,4 @@
-// Verify that we do not trigger a LLVM assertion by creating zero-sized DWARF fragments.
+// Verify that we do not trigger an LLVM assertion by creating zero-sized DWARF fragments.
//
// build-pass
// compile-flags: -g -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates
diff --git a/tests/ui/deduplicate-diagnostics.duplicate.stderr b/tests/ui/deduplicate-diagnostics.duplicate.stderr
index cd4700c7a..0544b9932 100644
--- a/tests/ui/deduplicate-diagnostics.duplicate.stderr
+++ b/tests/ui/deduplicate-diagnostics.duplicate.stderr
@@ -15,12 +15,16 @@ error: cannot find derive macro `Unresolved` in this scope
|
LL | #[derive(Unresolved)]
| ^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/deduplicate-diagnostics.rs:8:8
|
LL | #[deny("literal")]
| ^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/deprecation/deprecation-sanity.stderr b/tests/ui/deprecation/deprecation-sanity.stderr
index 8b2b480d1..383212ad9 100644
--- a/tests/ui/deprecation/deprecation-sanity.stderr
+++ b/tests/ui/deprecation/deprecation-sanity.stderr
@@ -16,25 +16,25 @@ error[E0541]: unknown meta item 'reason'
LL | #[deprecated(since = "a", note = "a", reason)]
| ^^^^^^ expected one of `since`, `note`
-error[E0551]: incorrect meta item
+error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:7:31
|
LL | #[deprecated(since = "a", note)]
| ^^^^
-error[E0551]: incorrect meta item
+error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:10:18
|
LL | #[deprecated(since, note = "a")]
| ^^^^^
-error[E0551]: incorrect meta item
+error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:13:31
|
LL | #[deprecated(since = "a", note(b))]
| ^^^^^^^
-error[E0551]: incorrect meta item
+error[E0539]: incorrect meta item
--> $DIR/deprecation-sanity.rs:16:18
|
LL | #[deprecated(since(b), note = "a")]
@@ -70,5 +70,5 @@ LL | #[deprecated = "hello"]
error: aborting due to 10 previous errors
-Some errors have detailed explanations: E0538, E0541, E0551, E0565.
+Some errors have detailed explanations: E0538, E0539, E0541, E0565.
For more information about an error, try `rustc --explain E0538`.
diff --git a/tests/ui/deprecation/staged-deprecation-in-future.rs b/tests/ui/deprecation/staged-deprecation-in-future.rs
index 87b15ec30..49ee60b9b 100644
--- a/tests/ui/deprecation/staged-deprecation-in-future.rs
+++ b/tests/ui/deprecation/staged-deprecation-in-future.rs
@@ -2,14 +2,14 @@
#![feature(staged_api)]
-#![stable(feature = "rustc_deprecation-in-future-test", since = "1.0.0")]
+#![stable(feature = "rustc_deprecation_in_future_test", since = "1.0.0")]
#[deprecated(since = "99.99.99", note = "effectively never")]
-#[stable(feature = "rustc_deprecation-in-future-test", since = "1.0.0")]
+#[stable(feature = "rustc_deprecation_in_future_test", since = "1.0.0")]
pub struct S1;
#[deprecated(since = "TBD", note = "literally never")]
-#[stable(feature = "rustc_deprecation-in-future-test", since = "1.0.0")]
+#[stable(feature = "rustc_deprecation_in_future_test", since = "1.0.0")]
pub struct S2;
fn main() {
diff --git a/tests/ui/derives/deriving-bounds.stderr b/tests/ui/derives/deriving-bounds.stderr
index 74ca37287..4461652eb 100644
--- a/tests/ui/derives/deriving-bounds.stderr
+++ b/tests/ui/derives/deriving-bounds.stderr
@@ -21,6 +21,7 @@ note: unsafe traits like `Sync` should be implemented explicitly
|
LL | #[derive(Sync)]
| ^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `Send` in this scope
--> $DIR/deriving-bounds.rs:1:10
@@ -45,6 +46,7 @@ note: unsafe traits like `Send` should be implemented explicitly
|
LL | #[derive(Send)]
| ^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/derives/deriving-meta-unknown-trait.stderr b/tests/ui/derives/deriving-meta-unknown-trait.stderr
index 053d34f68..28753b8f9 100644
--- a/tests/ui/derives/deriving-meta-unknown-trait.stderr
+++ b/tests/ui/derives/deriving-meta-unknown-trait.stderr
@@ -15,6 +15,8 @@ LL | #[derive(Eqr)]
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
= note: similarly named derive macro `Eq` defined here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/derives/deriving-primitive.stderr b/tests/ui/derives/deriving-primitive.stderr
index ca64c9ee7..b39637825 100644
--- a/tests/ui/derives/deriving-primitive.stderr
+++ b/tests/ui/derives/deriving-primitive.stderr
@@ -9,6 +9,8 @@ error: cannot find derive macro `FromPrimitive` in this scope
|
LL | #[derive(FromPrimitive)]
| ^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/derives/deriving-with-repr-packed-move-errors.rs b/tests/ui/derives/deriving-with-repr-packed-move-errors.rs
new file mode 100644
index 000000000..ffeb02d78
--- /dev/null
+++ b/tests/ui/derives/deriving-with-repr-packed-move-errors.rs
@@ -0,0 +1,96 @@
+// Check that deriving builtin traits for a packed struct with
+// non-Copy fields emits move errors along with an additional
+// diagnostic note explaining the reason
+// See issue #117406
+
+use std::fmt::{Debug, Formatter, Result};
+use std::cmp::Ordering;
+
+// Packed + derives: additional diagnostic should be emitted
+// for each of Debug, PartialEq and PartialOrd
+#[repr(packed)]
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+struct StructA(String);
+//~^ ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `other` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `other` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `other` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+//~| ERROR: cannot move out of `self` which is behind a shared reference
+
+
+// Unrelated impl: additinal diagnostic should NOT be emitted
+impl StructA {
+ fn fmt(&self) -> String {
+ self.0 //~ ERROR: cannot move out of `self` which is behind a shared reference
+ }
+}
+
+// Packed + manual impls: additional diagnostic should NOT be emitted
+#[repr(packed)]
+struct StructB(String);
+
+impl Debug for StructB {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ let x = &{ self.0 }; //~ ERROR: cannot move out of `self` which is behind a shared reference
+ write!(f, "{}", x)
+ }
+}
+
+impl PartialEq for StructB {
+ fn eq(&self, other: &StructB) -> bool {
+ ({ self.0 }) == ({ other.0 })
+ //~^ ERROR: cannot move out of `self` which is behind a shared reference
+ //~| ERROR: cannot move out of `other` which is behind a shared reference
+ }
+}
+
+impl PartialOrd for StructB {
+ fn partial_cmp(&self, other: &StructB) -> Option<Ordering> {
+ PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ //~^ ERROR: cannot move out of `self` which is behind a shared reference
+ //~| ERROR: cannot move out of `other` which is behind a shared reference
+ }
+}
+
+// NOT packed + derives: additinal diagnostic should NOT be emitted
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+struct StructC(String);
+
+// NOT packed + manual impls: additinal dignostic should NOT be emitted
+struct StructD(String);
+
+impl Debug for StructD {
+ fn fmt(&self, f: &mut Formatter) -> Result {
+ let x = &{ self.0 }; //~ ERROR: cannot move out of `self` which is behind a shared reference
+ write!(f, "{}", x)
+ }
+}
+
+impl PartialEq for StructD {
+ fn eq(&self, other: &StructD) -> bool {
+ ({ self.0 }) == ({ other.0 })
+ //~^ ERROR: cannot move out of `self` which is behind a shared reference
+ //~| ERROR: cannot move out of `other` which is behind a shared reference
+ }
+}
+
+impl PartialOrd for StructD {
+ fn partial_cmp(&self, other: &StructD) -> Option<Ordering> {
+ PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ //~^ ERROR: cannot move out of `self` which is behind a shared reference
+ //~| ERROR: cannot move out of `other` which is behind a shared reference
+ }
+}
+
+// Packed + derives but the move is outside of a derive
+// expansion: additinal diagnostic should NOT be emitted
+fn func(arg: &StructA) -> String {
+ arg.0 //~ ERROR: cannot move out of `arg` which is behind a shared reference
+}
+
+fn main(){
+}
diff --git a/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr b/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr
new file mode 100644
index 000000000..c538061b3
--- /dev/null
+++ b/tests/ui/derives/deriving-with-repr-packed-move-errors.stderr
@@ -0,0 +1,174 @@
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ----- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | --------- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | --------- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ---------- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ---------- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | --- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | --- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ---- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Hash)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
+ |
+LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
+ | ----- in this derive macro expansion
+LL | struct StructA(String);
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+ |
+ = note: `#[derive(Clone)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
+ = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:28:9
+ |
+LL | self.0
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:38:20
+ |
+LL | let x = &{ self.0 };
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:45:12
+ |
+LL | ({ self.0 }) == ({ other.0 })
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:45:28
+ |
+LL | ({ self.0 }) == ({ other.0 })
+ | ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:53:36
+ |
+LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:53:49
+ |
+LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ | ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:68:20
+ |
+LL | let x = &{ self.0 };
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:75:12
+ |
+LL | ({ self.0 }) == ({ other.0 })
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:75:28
+ |
+LL | ({ self.0 }) == ({ other.0 })
+ | ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `self` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:83:36
+ |
+LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ | ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `other` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:83:49
+ |
+LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
+ | ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of `arg` which is behind a shared reference
+ --> $DIR/deriving-with-repr-packed-move-errors.rs:92:5
+ |
+LL | arg.0
+ | ^^^^^ move occurs because `arg.0` has type `String`, which does not implement the `Copy` trait
+
+error: aborting due to 21 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/derives/deriving-with-repr-packed.stderr b/tests/ui/derives/deriving-with-repr-packed.stderr
index 0cfe03869..bb1fab343 100644
--- a/tests/ui/derives/deriving-with-repr-packed.stderr
+++ b/tests/ui/derives/deriving-with-repr-packed.stderr
@@ -36,6 +36,7 @@ LL | #[repr(packed)]
LL | struct X(Y);
| ^ move occurs because `self.0` has type `Y`, which does not implement the `Copy` trait
|
+ = note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error; 2 warnings emitted
diff --git a/tests/ui/derives/issue-36617.stderr b/tests/ui/derives/issue-36617.stderr
index 9cc0a29b0..98be7963e 100644
--- a/tests/ui/derives/issue-36617.stderr
+++ b/tests/ui/derives/issue-36617.stderr
@@ -43,55 +43,75 @@ error: `derive` attribute cannot be used at crate level
|
LL | #![derive(Copy)]
| ^^^^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[derive(Copy)]
- | ~~~~~~~~~~~~~~~
+LL - #![derive(Copy)]
+LL + #[derive(Copy)]
+ |
error: `test` attribute cannot be used at crate level
--> $DIR/issue-36617.rs:4:1
|
LL | #![test]
| ^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[test]
- | ~~~~~~~
+LL - #![test]
+LL + #[test]
+ |
error: `test_case` attribute cannot be used at crate level
--> $DIR/issue-36617.rs:7:1
|
LL | #![test_case]
| ^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[test_case]
- | ~~~~~~~~~~~~
+LL - #![test_case]
+LL + #[test_case]
+ |
error: `bench` attribute cannot be used at crate level
--> $DIR/issue-36617.rs:10:1
|
LL | #![bench]
| ^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[bench]
- | ~~~~~~~~
+LL - #![bench]
+LL + #[bench]
+ |
error: `global_allocator` attribute cannot be used at crate level
--> $DIR/issue-36617.rs:13:1
|
LL | #![global_allocator]
| ^^^^^^^^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[global_allocator]
- | ~~~~~~~~~~~~~~~~~~~
+LL - #![global_allocator]
+LL + #[global_allocator]
+ |
error: aborting due to 10 previous errors
diff --git a/tests/ui/deriving/deriving-all-codegen.stdout b/tests/ui/deriving/deriving-all-codegen.stdout
index 3d9f8129d..42154c3c3 100644
--- a/tests/ui/deriving/deriving-all-codegen.stdout
+++ b/tests/ui/deriving/deriving-all-codegen.stdout
@@ -33,6 +33,7 @@ impl ::core::clone::Clone for Empty {
impl ::core::marker::Copy for Empty { }
#[automatically_derived]
impl ::core::fmt::Debug for Empty {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "Empty")
}
@@ -97,6 +98,7 @@ impl ::core::clone::Clone for Point {
impl ::core::marker::Copy for Point { }
#[automatically_derived]
impl ::core::fmt::Debug for Point {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "Point", "x",
&self.x, "y", &&self.y)
@@ -183,6 +185,7 @@ impl ::core::clone::Clone for PackedPoint {
impl ::core::marker::Copy for PackedPoint { }
#[automatically_derived]
impl ::core::fmt::Debug for PackedPoint {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "PackedPoint",
"x", &{ self.x }, "y", &&{ self.y })
@@ -276,6 +279,7 @@ impl ::core::clone::Clone for Big {
impl ::core::marker::Copy for Big { }
#[automatically_derived]
impl ::core::fmt::Debug for Big {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
let names: &'static _ =
&["b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"];
@@ -475,6 +479,7 @@ impl Copy for PackedManualCopy {}
struct Unsized([u32]);
#[automatically_derived]
impl ::core::fmt::Debug for Unsized {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Unsized",
&&self.0)
@@ -527,6 +532,7 @@ impl ::core::cmp::Ord for Unsized {
struct PackedUnsizedU8([u8]);
#[automatically_derived]
impl ::core::fmt::Debug for PackedUnsizedU8 {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"PackedUnsizedU8", &&self.0)
@@ -569,6 +575,7 @@ impl<T: ::core::marker::Copy + Trait, U: ::core::marker::Copy>
#[automatically_derived]
impl<T: ::core::fmt::Debug + Trait, U: ::core::fmt::Debug> ::core::fmt::Debug
for Generic<T, U> where T::A: ::core::fmt::Debug {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "Generic", "t",
&self.t, "ta", &self.ta, "u", &&self.u)
@@ -687,6 +694,7 @@ impl<T: ::core::fmt::Debug + ::core::marker::Copy + Trait,
U: ::core::fmt::Debug + ::core::marker::Copy> ::core::fmt::Debug for
PackedGeneric<T, U> where T::A: ::core::fmt::Debug + ::core::marker::Copy
{
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field3_finish(f, "PackedGeneric",
&{ self.0 }, &{ self.1 }, &&{ self.2 })
@@ -797,6 +805,7 @@ impl ::core::clone::Clone for Enum0 {
impl ::core::marker::Copy for Enum0 { }
#[automatically_derived]
impl ::core::fmt::Debug for Enum0 {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match *self {}
}
@@ -856,6 +865,7 @@ impl ::core::clone::Clone for Enum1 {
}
#[automatically_derived]
impl ::core::fmt::Debug for Enum1 {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Enum1::Single { x: __self_0 } =>
@@ -932,6 +942,7 @@ impl ::core::clone::Clone for Fieldless1 {
}
#[automatically_derived]
impl ::core::fmt::Debug for Fieldless1 {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "A")
}
@@ -995,6 +1006,7 @@ impl ::core::clone::Clone for Fieldless {
impl ::core::marker::Copy for Fieldless { }
#[automatically_derived]
impl ::core::fmt::Debug for Fieldless {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
@@ -1083,6 +1095,7 @@ impl ::core::clone::Clone for Mixed {
impl ::core::marker::Copy for Mixed { }
#[automatically_derived]
impl ::core::fmt::Debug for Mixed {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Mixed::P => ::core::fmt::Formatter::write_str(f, "P"),
@@ -1217,6 +1230,7 @@ impl ::core::clone::Clone for Fielded {
}
#[automatically_derived]
impl ::core::fmt::Debug for Fielded {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Fielded::X(__self_0) =>
@@ -1341,6 +1355,7 @@ impl<T: ::core::marker::Copy, U: ::core::marker::Copy> ::core::marker::Copy
#[automatically_derived]
impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug> ::core::fmt::Debug for
EnumGeneric<T, U> {
+ #[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
EnumGeneric::One(__self_0) =>
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
index 00fb59d14..346d8373f 100644
--- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
@@ -23,9 +23,15 @@ trait Boom {}
//~^WARN malformed `on_unimplemented` attribute
trait Doom {}
+#[diagnostic::on_unimplemented]
+//~^WARN missing options for `on_unimplemented` attribute
+//~|WARN missing options for `on_unimplemented` attribute
+trait Whatever {}
+
fn take_foo(_: impl Foo) {}
fn take_baz(_: impl Baz) {}
fn take_boom(_: impl Boom) {}
+fn take_whatever(_: impl Whatever) {}
fn main() {
take_foo(1_i32);
@@ -34,4 +40,6 @@ fn main() {
//~^ERROR Boom
take_boom(1_i32);
//~^ERROR Boom
+ take_whatever(1_i32);
+ //~^ERROR the trait bound `i32: Whatever` is not satisfied
}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
index bb1b29ef2..162ddd79f 100644
--- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
@@ -10,34 +10,53 @@ warning: malformed `on_unimplemented` attribute
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
|
LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
warning: malformed `on_unimplemented` attribute
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
|
LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
warning: malformed `on_unimplemented` attribute
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
|
LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
warning: malformed `on_unimplemented` attribute
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:1
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:32
|
LL | #[diagnostic::on_unimplemented = "boom"]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+
+warning: missing options for `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
+ |
+LL | #[diagnostic::on_unimplemented]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: at least one of the `message`, `note` and `label` options are expected
warning: malformed `on_unimplemented` attribute
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:3:32
|
LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:14
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:37:14
|
LL | take_foo(1_i32);
| -------- ^^^^^ the trait `Foo` is not implemented for `i32`
@@ -50,7 +69,7 @@ help: this trait has no implementations, consider adding one
LL | trait Foo {}
| ^^^^^^^^^
note: required by a bound in `take_foo`
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:21
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:21
|
LL | fn take_foo(_: impl Foo) {}
| ^^^ required by this bound in `take_foo`
@@ -59,10 +78,13 @@ warning: malformed `on_unimplemented` attribute
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:12:50
|
LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: Boom
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:33:14
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:39:14
|
LL | take_baz(1_i32);
| -------- ^^^^^ the trait `Baz` is not implemented for `i32`
@@ -75,7 +97,7 @@ help: this trait has no implementations, consider adding one
LL | trait Baz {}
| ^^^^^^^^^
note: required by a bound in `take_baz`
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:27:21
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:32:21
|
LL | fn take_baz(_: impl Baz) {}
| ^^^ required by this bound in `take_baz`
@@ -84,10 +106,13 @@ warning: malformed `on_unimplemented` attribute
--> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
|
LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: Boom
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:35:15
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:41:15
|
LL | take_boom(1_i32);
| --------- ^^^^^ the trait `Boom` is not implemented for `i32`
@@ -100,11 +125,39 @@ help: this trait has no implementations, consider adding one
LL | trait Boom {}
| ^^^^^^^^^^
note: required by a bound in `take_boom`
- --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:28:22
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:33:22
|
LL | fn take_boom(_: impl Boom) {}
| ^^^^ required by this bound in `take_boom`
-error: aborting due to 3 previous errors; 8 warnings emitted
+warning: missing options for `on_unimplemented` attribute
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
+ |
+LL | #[diagnostic::on_unimplemented]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: at least one of the `message`, `note` and `label` options are expected
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: the trait bound `i32: Whatever` is not satisfied
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:43:19
+ |
+LL | take_whatever(1_i32);
+ | ------------- ^^^^^ the trait `Whatever` is not implemented for `i32`
+ | |
+ | required by a bound introduced by this call
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:29:1
+ |
+LL | trait Whatever {}
+ | ^^^^^^^^^^^^^^
+note: required by a bound in `take_whatever`
+ --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:34:26
+ |
+LL | fn take_whatever(_: impl Whatever) {}
+ | ^^^^^^^^ required by this bound in `take_whatever`
+
+error: aborting due to 4 previous errors; 10 warnings emitted
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs
new file mode 100644
index 000000000..8410b3eb1
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs
@@ -0,0 +1,20 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(
+ if(Self = "()"),
+ //~^WARN malformed `on_unimplemented` attribute
+ //~|WARN malformed `on_unimplemented` attribute
+ message = "custom message",
+ note = "custom note"
+)]
+#[diagnostic::on_unimplemented(message = "fallback!!")]
+#[diagnostic::on_unimplemented(label = "fallback label")]
+#[diagnostic::on_unimplemented(note = "fallback note")]
+trait Foo {}
+
+fn takes_foo(_: impl Foo) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR custom message
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr
new file mode 100644
index 000000000..906472beb
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr
@@ -0,0 +1,43 @@
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:4:5
+ |
+LL | if(Self = "()"),
+ | ^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: malformed `on_unimplemented` attribute
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:4:5
+ |
+LL | if(Self = "()"),
+ | ^^^^^^^^^^^^^^^ invalid option found here
+ |
+ = help: only `message`, `note` and `label` are allowed as options
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: custom message
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:18:15
+ |
+LL | takes_foo(());
+ | --------- ^^ fallback label
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: custom note
+ = note: fallback note
+help: this trait has no implementations, consider adding one
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:13:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/ignore_unsupported_options_and_continue_to_use_fallback.rs:15:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error: aborting due to previous error; 2 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs
new file mode 100644
index 000000000..34cdb99c7
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.rs
@@ -0,0 +1,18 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic::on_unimplemented(message = "Foo", label = "Bar", note = "Baz", note = "Boom")]
+trait Foo {}
+
+#[diagnostic::on_unimplemented(message = "Bar", label = "Foo", note = "Baz")]
+#[diagnostic::on_unimplemented(note = "Baz2")]
+trait Bar {}
+
+fn takes_foo(_: impl Foo) {}
+fn takes_bar(_: impl Bar) {}
+
+fn main() {
+ takes_foo(());
+ //~^ERROR Foo
+ takes_bar(());
+ //~^ERROR Bar
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr
new file mode 100644
index 000000000..c72321d46
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/multiple_notes.stderr
@@ -0,0 +1,47 @@
+error[E0277]: Foo
+ --> $DIR/multiple_notes.rs:14:15
+ |
+LL | takes_foo(());
+ | --------- ^^ Bar
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Foo` is not implemented for `()`
+ = note: Baz
+ = note: Boom
+help: this trait has no implementations, consider adding one
+ --> $DIR/multiple_notes.rs:4:1
+ |
+LL | trait Foo {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_foo`
+ --> $DIR/multiple_notes.rs:10:22
+ |
+LL | fn takes_foo(_: impl Foo) {}
+ | ^^^ required by this bound in `takes_foo`
+
+error[E0277]: Bar
+ --> $DIR/multiple_notes.rs:16:15
+ |
+LL | takes_bar(());
+ | --------- ^^ Foo
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Bar` is not implemented for `()`
+ = note: Baz
+ = note: Baz2
+help: this trait has no implementations, consider adding one
+ --> $DIR/multiple_notes.rs:8:1
+ |
+LL | trait Bar {}
+ | ^^^^^^^^^
+note: required by a bound in `takes_bar`
+ --> $DIR/multiple_notes.rs:11:22
+ |
+LL | fn takes_bar(_: impl Bar) {}
+ | ^^^ required by this bound in `takes_bar`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/did_you_mean/auxiliary/doc-hidden-fields.rs b/tests/ui/did_you_mean/auxiliary/doc-hidden-fields.rs
new file mode 100644
index 000000000..4e2ee9740
--- /dev/null
+++ b/tests/ui/did_you_mean/auxiliary/doc-hidden-fields.rs
@@ -0,0 +1,6 @@
+#[derive(Default)]
+pub struct B {
+ #[doc(hidden)]
+ pub hello: i32,
+ pub bye: i32,
+}
diff --git a/tests/ui/did_you_mean/bad-assoc-ty.stderr b/tests/ui/did_you_mean/bad-assoc-ty.stderr
index efa6bb668..5c0c7a0b9 100644
--- a/tests/ui/did_you_mean/bad-assoc-ty.stderr
+++ b/tests/ui/did_you_mean/bad-assoc-ty.stderr
@@ -191,7 +191,7 @@ error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:33:10
|
LL | type H = Fn(u8) -> (u8)::Output;
- | ^^^^^^^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output`
+ | ^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output`
error[E0223]: ambiguous associated type
--> $DIR/bad-assoc-ty.rs:39:19
diff --git a/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs
new file mode 100644
index 000000000..6040f3f30
--- /dev/null
+++ b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs
@@ -0,0 +1,38 @@
+// Regression test for issue #93210.
+
+// aux-crate:doc_hidden_fields=doc-hidden-fields.rs
+// edition: 2021
+
+#[derive(Default)]
+pub struct A {
+ #[doc(hidden)]
+ pub hello: i32,
+ pub bye: i32,
+}
+
+#[derive(Default)]
+pub struct C {
+ pub hello: i32,
+ pub bye: i32,
+}
+
+fn main() {
+ // We want to list the field `hello` despite being marked
+ // `doc(hidden)` because it's defined in this crate.
+ A::default().hey;
+ //~^ ERROR no field `hey` on type `A`
+ //~| NOTE unknown field
+ //~| NOTE available fields are: `hello`, `bye`
+
+ // Here we want to hide the field `hello` since it's marked
+ // `doc(hidden)` and comes from an external crate.
+ doc_hidden_fields::B::default().hey;
+ //~^ ERROR no field `hey` on type `B`
+ //~| NOTE unknown field
+ //~| NOTE available fields are: `bye`
+
+ C::default().hey;
+ //~^ ERROR no field `hey` on type `C`
+ //~| NOTE unknown field
+ //~| NOTE available fields are: `hello`, `bye`
+}
diff --git a/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.stderr b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.stderr
new file mode 100644
index 000000000..b7fe3b79b
--- /dev/null
+++ b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.stderr
@@ -0,0 +1,27 @@
+error[E0609]: no field `hey` on type `A`
+ --> $DIR/dont-suggest-doc-hidden-fields.rs:22:18
+ |
+LL | A::default().hey;
+ | ^^^ unknown field
+ |
+ = note: available fields are: `hello`, `bye`
+
+error[E0609]: no field `hey` on type `B`
+ --> $DIR/dont-suggest-doc-hidden-fields.rs:29:37
+ |
+LL | doc_hidden_fields::B::default().hey;
+ | ^^^ unknown field
+ |
+ = note: available fields are: `bye`
+
+error[E0609]: no field `hey` on type `C`
+ --> $DIR/dont-suggest-doc-hidden-fields.rs:34:18
+ |
+LL | C::default().hey;
+ | ^^^ unknown field
+ |
+ = note: available fields are: `hello`, `bye`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.rs b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.rs
new file mode 100644
index 000000000..fb7040b2d
--- /dev/null
+++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.rs
@@ -0,0 +1,47 @@
+// Regression test for issue #116334.
+// Don't include hygienic fields from different syntax contexts in
+// the list of available or similarly named fields.
+
+#![feature(decl_macro)]
+
+macro compound($Ty:ident) {
+ #[derive(Default)]
+ struct $Ty {
+ field: u32, // field `field` is hygienic
+ }
+}
+
+macro component($Ty:ident) {
+ struct $Ty(u64); // field `0` is hygienic (but still accessible via the constructor)
+}
+
+compound! { Compound }
+component! { Component }
+
+fn main() {
+ let ty = Compound::default();
+
+ let _ = ty.field; //~ ERROR no field `field` on type `Compound`
+ let _ = ty.fieeld; //~ ERROR no field `fieeld` on type `Compound`
+
+ let Compound { field } = ty;
+ //~^ ERROR struct `Compound` does not have a field named `field`
+ //~| ERROR pattern requires `..` due to inaccessible fields
+ //~| HELP ignore the inaccessible and unused fields
+
+ let ty = Component(90);
+
+ let _ = ty.0; //~ ERROR no field `0` on type `Component`
+}
+
+environment!();
+
+macro environment() {
+ struct Crate { field: () }
+
+ // Here, we do want to suggest `field` even though it's hygienic
+ // precisely because they come from the same syntax context.
+ const CRATE: Crate = Crate { fiel: () };
+ //~^ ERROR struct `Crate` has no field named `fiel`
+ //~| HELP a field with a similar name exists
+}
diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
new file mode 100644
index 000000000..7066d2976
--- /dev/null
+++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
@@ -0,0 +1,50 @@
+error[E0560]: struct `Crate` has no field named `fiel`
+ --> $DIR/dont-suggest-hygienic-fields.rs:44:34
+ |
+LL | environment!();
+ | -------------- in this macro invocation
+...
+LL | const CRATE: Crate = Crate { fiel: () };
+ | ^^^^ help: a field with a similar name exists: `field`
+ |
+ = note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0609]: no field `field` on type `Compound`
+ --> $DIR/dont-suggest-hygienic-fields.rs:24:16
+ |
+LL | let _ = ty.field;
+ | ^^^^^ unknown field
+
+error[E0609]: no field `fieeld` on type `Compound`
+ --> $DIR/dont-suggest-hygienic-fields.rs:25:16
+ |
+LL | let _ = ty.fieeld;
+ | ^^^^^^ unknown field
+
+error[E0026]: struct `Compound` does not have a field named `field`
+ --> $DIR/dont-suggest-hygienic-fields.rs:27:20
+ |
+LL | let Compound { field } = ty;
+ | ^^^^^ struct `Compound` does not have this field
+
+error: pattern requires `..` due to inaccessible fields
+ --> $DIR/dont-suggest-hygienic-fields.rs:27:9
+ |
+LL | let Compound { field } = ty;
+ | ^^^^^^^^^^^^^^^^^^
+ |
+help: ignore the inaccessible and unused fields
+ |
+LL | let Compound { field, .. } = ty;
+ | ++++
+
+error[E0609]: no field `0` on type `Component`
+ --> $DIR/dont-suggest-hygienic-fields.rs:34:16
+ |
+LL | let _ = ty.0;
+ | ^ unknown field
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0026, E0560, E0609.
+For more information about an error, try `rustc --explain E0026`.
diff --git a/tests/ui/did_you_mean/issue-105225-named-args.rs b/tests/ui/did_you_mean/issue-105225-named-args.rs
new file mode 100644
index 000000000..38e817765
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225-named-args.rs
@@ -0,0 +1,10 @@
+fn main() {
+ let x = "x";
+ let y = "y";
+
+ println!("{x}", x, x = y);
+ //~^ ERROR: redundant argument
+
+ println!("{x}", x = y, x = y);
+ //~^ ERROR: duplicate argument named `x`
+}
diff --git a/tests/ui/did_you_mean/issue-105225-named-args.stderr b/tests/ui/did_you_mean/issue-105225-named-args.stderr
new file mode 100644
index 000000000..72204102e
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225-named-args.stderr
@@ -0,0 +1,22 @@
+error: redundant argument
+ --> $DIR/issue-105225-named-args.rs:5:21
+ |
+LL | println!("{x}", x, x = y);
+ | ^
+ |
+note: the formatting specifier is referencing the binding already
+ --> $DIR/issue-105225-named-args.rs:5:16
+ |
+LL | println!("{x}", x, x = y);
+ | ^
+
+error: duplicate argument named `x`
+ --> $DIR/issue-105225-named-args.rs:8:28
+ |
+LL | println!("{x}", x = y, x = y);
+ | - ^ duplicate argument
+ | |
+ | previously here
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/did_you_mean/issue-105225.fixed b/tests/ui/did_you_mean/issue-105225.fixed
new file mode 100644
index 000000000..f756be615
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225.fixed
@@ -0,0 +1,21 @@
+// run-rustfix
+
+fn main() {
+ let x = "x";
+ let y = "y";
+
+ println!("{x}", );
+ //~^ ERROR: redundant argument
+
+ println!("{x} {}", x, );
+ //~^ ERROR: redundant argument
+
+ println!("{} {x}", x, );
+ //~^ ERROR: redundant argument
+
+ println!("{x} {y}", );
+ //~^ ERROR: redundant arguments
+
+ println!("{} {} {x} {y} {}", x, x, x, );
+ //~^ ERROR: redundant arguments
+}
diff --git a/tests/ui/did_you_mean/issue-105225.rs b/tests/ui/did_you_mean/issue-105225.rs
new file mode 100644
index 000000000..91cdf0eb2
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225.rs
@@ -0,0 +1,21 @@
+// run-rustfix
+
+fn main() {
+ let x = "x";
+ let y = "y";
+
+ println!("{x}", x);
+ //~^ ERROR: redundant argument
+
+ println!("{x} {}", x, x);
+ //~^ ERROR: redundant argument
+
+ println!("{} {x}", x, x);
+ //~^ ERROR: redundant argument
+
+ println!("{x} {y}", x, y);
+ //~^ ERROR: redundant arguments
+
+ println!("{} {} {x} {y} {}", x, x, x, y, y);
+ //~^ ERROR: redundant arguments
+}
diff --git a/tests/ui/did_you_mean/issue-105225.stderr b/tests/ui/did_you_mean/issue-105225.stderr
new file mode 100644
index 000000000..5fb46222b
--- /dev/null
+++ b/tests/ui/did_you_mean/issue-105225.stderr
@@ -0,0 +1,72 @@
+error: redundant argument
+ --> $DIR/issue-105225.rs:7:21
+ |
+LL | println!("{x}", x);
+ | ^ help: this can be removed
+ |
+note: the formatting specifier is referencing the binding already
+ --> $DIR/issue-105225.rs:7:16
+ |
+LL | println!("{x}", x);
+ | ^
+
+error: redundant argument
+ --> $DIR/issue-105225.rs:10:27
+ |
+LL | println!("{x} {}", x, x);
+ | ^ help: this can be removed
+ |
+note: the formatting specifier is referencing the binding already
+ --> $DIR/issue-105225.rs:10:16
+ |
+LL | println!("{x} {}", x, x);
+ | ^
+
+error: redundant argument
+ --> $DIR/issue-105225.rs:13:27
+ |
+LL | println!("{} {x}", x, x);
+ | ^ help: this can be removed
+ |
+note: the formatting specifier is referencing the binding already
+ --> $DIR/issue-105225.rs:13:19
+ |
+LL | println!("{} {x}", x, x);
+ | ^
+
+error: redundant arguments
+ --> $DIR/issue-105225.rs:16:25
+ |
+LL | println!("{x} {y}", x, y);
+ | ^ ^
+ |
+note: the formatting specifiers are referencing the bindings already
+ --> $DIR/issue-105225.rs:16:16
+ |
+LL | println!("{x} {y}", x, y);
+ | ^ ^
+help: this can be removed
+ |
+LL - println!("{x} {y}", x, y);
+LL + println!("{x} {y}", );
+ |
+
+error: redundant arguments
+ --> $DIR/issue-105225.rs:19:43
+ |
+LL | println!("{} {} {x} {y} {}", x, x, x, y, y);
+ | ^ ^
+ |
+note: the formatting specifiers are referencing the bindings already
+ --> $DIR/issue-105225.rs:19:26
+ |
+LL | println!("{} {} {x} {y} {}", x, x, x, y, y);
+ | ^
+help: this can be removed
+ |
+LL - println!("{} {} {x} {y} {}", x, x, x, y, y);
+LL + println!("{} {} {x} {y} {}", x, x, x, );
+ |
+
+error: aborting due to 5 previous errors
+
diff --git a/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs b/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs
deleted file mode 100644
index 0efc7daa3..000000000
--- a/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#[derive(Default)]
-pub struct A {
- #[doc(hidden)]
- pub hello: i32,
- pub bye: i32,
-}
-
-#[derive(Default)]
-pub struct B {
- pub hello: i32,
- pub bye: i32,
-}
-
-fn main() {
- A::default().hey;
- //~^ ERROR no field `hey` on type `A`
- //~| NOTE unknown field
- //~| NOTE available fields are: `bye`
-
- B::default().hey;
- //~^ ERROR no field `hey` on type `B`
- //~| NOTE unknown field
- //~| NOTE available fields are: `hello`, `bye`
-}
diff --git a/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr b/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr
deleted file mode 100644
index 784986d3b..000000000
--- a/tests/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0609]: no field `hey` on type `A`
- --> $DIR/issue-93210-ignore-doc-hidden.rs:15:18
- |
-LL | A::default().hey;
- | ^^^ unknown field
- |
- = note: available fields are: `bye`
-
-error[E0609]: no field `hey` on type `B`
- --> $DIR/issue-93210-ignore-doc-hidden.rs:20:18
- |
-LL | B::default().hey;
- | ^^^ unknown field
- |
- = note: available fields are: `hello`, `bye`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0609`.
diff --git a/tests/ui/drop/dynamic-drop.rs b/tests/ui/drop/dynamic-drop.rs
index caef6358e..5bf2cc30e 100644
--- a/tests/ui/drop/dynamic-drop.rs
+++ b/tests/ui/drop/dynamic-drop.rs
@@ -1,7 +1,7 @@
// run-pass
// needs-unwind
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
#![feature(if_let_guard)]
#![allow(unused_assignments)]
@@ -9,7 +9,7 @@
use std::cell::{Cell, RefCell};
use std::mem::ManuallyDrop;
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::panic;
use std::pin::Pin;
@@ -173,7 +173,7 @@ fn vec_simple(a: &Allocator) {
let _x = vec![a.alloc(), a.alloc(), a.alloc(), a.alloc()];
}
-fn generator(a: &Allocator, run_count: usize) {
+fn coroutine(a: &Allocator, run_count: usize) {
assert!(run_count < 4);
let mut gen = || {
@@ -471,10 +471,10 @@ fn main() {
run_test(|a| field_assignment(a, false));
run_test(|a| field_assignment(a, true));
- run_test(|a| generator(a, 0));
- run_test(|a| generator(a, 1));
- run_test(|a| generator(a, 2));
- run_test(|a| generator(a, 3));
+ run_test(|a| coroutine(a, 0));
+ run_test(|a| coroutine(a, 1));
+ run_test(|a| coroutine(a, 2));
+ run_test(|a| coroutine(a, 3));
run_test(|a| mixed_drop_and_nondrop(a));
diff --git a/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr b/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr
index 6bafff919..931786672 100644
--- a/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr
+++ b/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr
@@ -50,6 +50,7 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) {
@@ -63,6 +64,7 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn function(x: &dyn SomeTrait, y: Box<SomeTrait>) {
@@ -76,6 +78,7 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
@@ -89,6 +92,7 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) {
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn function(x: &SomeTrait, y: Box<dyn SomeTrait>) {
diff --git a/tests/ui/error-codes/E0004.stderr b/tests/ui/error-codes/E0004.stderr
index 603bc5237..ced478d65 100644
--- a/tests/ui/error-codes/E0004.stderr
+++ b/tests/ui/error-codes/E0004.stderr
@@ -5,12 +5,12 @@ LL | match x {
| ^ pattern `Terminator::HastaLaVistaBaby` not covered
|
note: `Terminator` defined here
- --> $DIR/E0004.rs:2:5
+ --> $DIR/E0004.rs:1:6
|
LL | enum Terminator {
- | ----------
+ | ^^^^^^^^^^
LL | HastaLaVistaBaby,
- | ^^^^^^^^^^^^^^^^ not covered
+ | ---------------- not covered
= note: the matched value is of type `Terminator`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/error-codes/E0030-teach.stderr b/tests/ui/error-codes/E0030-teach.stderr
index 3f1ad4af3..9435cb204 100644
--- a/tests/ui/error-codes/E0030-teach.stderr
+++ b/tests/ui/error-codes/E0030-teach.stderr
@@ -2,7 +2,7 @@ error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/E0030-teach.rs:5:9
|
LL | 1000 ..= 5 => {}
- | ^^^^ lower bound larger than upper bound
+ | ^^^^^^^^^^ lower bound larger than upper bound
|
= note: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
diff --git a/tests/ui/error-codes/E0030.stderr b/tests/ui/error-codes/E0030.stderr
index db8161d8f..1aeca2916 100644
--- a/tests/ui/error-codes/E0030.stderr
+++ b/tests/ui/error-codes/E0030.stderr
@@ -2,7 +2,7 @@ error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/E0030.rs:3:9
|
LL | 1000 ..= 5 => {}
- | ^^^^ lower bound larger than upper bound
+ | ^^^^^^^^^^ lower bound larger than upper bound
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0034.stderr b/tests/ui/error-codes/E0034.stderr
index e29621702..da6f22188 100644
--- a/tests/ui/error-codes/E0034.stderr
+++ b/tests/ui/error-codes/E0034.stderr
@@ -14,12 +14,10 @@ note: candidate #2 is defined in an impl of the trait `Trait2` for the type `Tes
|
LL | fn foo() {}
| ^^^^^^^^
-help: disambiguate the associated function for candidate #1
+help: use fully-qualified syntax to disambiguate
|
LL | <Test as Trait1>::foo()
| ~~~~~~~~~~~~~~~~~~
-help: disambiguate the associated function for candidate #2
- |
LL | <Test as Trait2>::foo()
| ~~~~~~~~~~~~~~~~~~
diff --git a/tests/ui/error-codes/E0191.stderr b/tests/ui/error-codes/E0191.stderr
index cf80c9c46..57eda4785 100644
--- a/tests/ui/error-codes/E0191.stderr
+++ b/tests/ui/error-codes/E0191.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Trait` must be specified
--> $DIR/E0191.rs:5:16
|
LL | type Bar;
diff --git a/tests/ui/error-codes/E0220.stderr b/tests/ui/error-codes/E0220.stderr
index e03eadaca..0e0b5c708 100644
--- a/tests/ui/error-codes/E0220.stderr
+++ b/tests/ui/error-codes/E0220.stderr
@@ -4,7 +4,7 @@ error[E0220]: associated type `F` not found for `Trait`
LL | type Foo = dyn Trait<F=i32>;
| ^ help: `Trait` has the following associated type: `Bar`
-error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Trait` must be specified
--> $DIR/E0220.rs:5:16
|
LL | type Bar;
diff --git a/tests/ui/error-codes/E0221.stderr b/tests/ui/error-codes/E0221.stderr
index 5414d77ad..e600acf78 100644
--- a/tests/ui/error-codes/E0221.stderr
+++ b/tests/ui/error-codes/E0221.stderr
@@ -10,11 +10,11 @@ LL | fn do_something() {
LL | let _: Self::A;
| ^^^^^^^ ambiguous associated type `A`
|
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | let _: <Self as Foo>::A;
| ~~~~~~~~~~~~~~~
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | let _: <Self as Bar>::A;
| ~~~~~~~~~~~~~~~
@@ -29,7 +29,7 @@ LL | let _: Self::Err;
| ^^^^^^^^^ ambiguous associated type `Err`
|
= note: associated type `Self` could derive from `FromStr`
-help: use fully qualified syntax to disambiguate
+help: use fully-qualified syntax to disambiguate
|
LL | let _: <Self as My>::Err;
| ~~~~~~~~~~~~~~
diff --git a/tests/ui/error-codes/E0223.stderr b/tests/ui/error-codes/E0223.stderr
index 42945e42f..1299ba5f5 100644
--- a/tests/ui/error-codes/E0223.stderr
+++ b/tests/ui/error-codes/E0223.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/E0223.rs:8:14
|
LL | let foo: MyTrait::X;
- | ^^^^^^^^^^ help: use the fully-qualified path: `<MyStruct as MyTrait>::X`
+ | ^^^^^^^^^^ help: use fully-qualified syntax: `<MyStruct as MyTrait>::X`
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0282.rs b/tests/ui/error-codes/E0282.rs
index f1f93b3ae..5bc29cda9 100644
--- a/tests/ui/error-codes/E0282.rs
+++ b/tests/ui/error-codes/E0282.rs
@@ -1,4 +1,4 @@
fn main() {
- let x = "hello".chars().rev().collect();
+ let x;
//~^ ERROR E0282
}
diff --git a/tests/ui/error-codes/E0282.stderr b/tests/ui/error-codes/E0282.stderr
index 892d3a81f..58332454a 100644
--- a/tests/ui/error-codes/E0282.stderr
+++ b/tests/ui/error-codes/E0282.stderr
@@ -1,13 +1,13 @@
error[E0282]: type annotations needed
--> $DIR/E0282.rs:2:9
|
-LL | let x = "hello".chars().rev().collect();
+LL | let x;
| ^
|
help: consider giving `x` an explicit type
|
-LL | let x: Vec<_> = "hello".chars().rev().collect();
- | ++++++++
+LL | let x: /* Type */;
+ | ++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0283.rs b/tests/ui/error-codes/E0283.rs
index 0643af4b7..5134660e3 100644
--- a/tests/ui/error-codes/E0283.rs
+++ b/tests/ui/error-codes/E0283.rs
@@ -1,10 +1,10 @@
-trait Generator {
+trait Coroutine {
fn create() -> u32;
}
struct Impl;
-impl Generator for Impl {
+impl Coroutine for Impl {
fn create() -> u32 { 1 }
}
@@ -22,12 +22,12 @@ fn foo(bar: u32) {}
struct AnotherImpl;
-impl Generator for AnotherImpl {
+impl Coroutine for AnotherImpl {
fn create() -> u32 { 2 }
}
fn main() {
- let cont: u32 = Generator::create(); //~ ERROR E0790
+ let cont: u32 = Coroutine::create(); //~ ERROR E0790
}
fn buzz() {
diff --git a/tests/ui/error-codes/E0283.stderr b/tests/ui/error-codes/E0283.stderr
index fa8d4b6e0..6008809f0 100644
--- a/tests/ui/error-codes/E0283.stderr
+++ b/tests/ui/error-codes/E0283.stderr
@@ -2,14 +2,14 @@ error[E0790]: cannot call associated function on trait without specifying the co
--> $DIR/E0283.rs:30:21
|
LL | fn create() -> u32;
- | ------------------- `Generator::create` defined here
+ | ------------------- `Coroutine::create` defined here
...
-LL | let cont: u32 = Generator::create();
+LL | let cont: u32 = Coroutine::create();
| ^^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
help: use a fully-qualified path to a specific available implementation
|
-LL | let cont: u32 = </* self type */ as Generator>::create();
+LL | let cont: u32 = </* self type */ as Coroutine>::create();
| +++++++++++++++++++ +
error[E0283]: type annotations needed
diff --git a/tests/ui/error-codes/E0311.fixed b/tests/ui/error-codes/E0311.fixed
index 4410a4d70..09ceecd06 100644
--- a/tests/ui/error-codes/E0311.fixed
+++ b/tests/ui/error-codes/E0311.fixed
@@ -2,7 +2,7 @@
#![allow(warnings)]
-fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
+fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
with_restriction::<T>(x) //~ ERROR E0311
}
diff --git a/tests/ui/error-codes/E0311.stderr b/tests/ui/error-codes/E0311.stderr
index b0e6dd1e2..96546b83f 100644
--- a/tests/ui/error-codes/E0311.stderr
+++ b/tests/ui/error-codes/E0311.stderr
@@ -1,23 +1,15 @@
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/E0311.rs:6:5
|
-LL | with_restriction::<T>(x)
- | ^^^^^^^^^^^^^^^^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/E0311.rs:5:25
- |
LL | fn no_restriction<T>(x: &()) -> &() {
- | ^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/E0311.rs:6:5
- |
+ | --- the parameter type `T` must be valid for the anonymous lifetime defined here...
LL | with_restriction::<T>(x)
- | ^^^^^^^^^^^^^^^^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
- | +++ ++++ ++
+LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
+ | +++ ++++ ++ ++
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0374.stderr b/tests/ui/error-codes/E0374.stderr
index a77920430..49ec0bce4 100644
--- a/tests/ui/error-codes/E0374.stderr
+++ b/tests/ui/error-codes/E0374.stderr
@@ -1,8 +1,9 @@
error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures
--> $DIR/E0374.rs:8:1
|
-LL | impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T, U> CoerceUnsized<Foo<U>> for Foo<T>
+LL | | where T: CoerceUnsized<U> {}
+ | |_____________________________^
|
= note: expected a single field to be coerced, none found
diff --git a/tests/ui/error-codes/E0377.stderr b/tests/ui/error-codes/E0377.stderr
index 664e499ec..9cb11e5a3 100644
--- a/tests/ui/error-codes/E0377.stderr
+++ b/tests/ui/error-codes/E0377.stderr
@@ -2,7 +2,7 @@ error[E0377]: the trait `CoerceUnsized` may only be implemented for a coercion b
--> $DIR/E0377.rs:12:1
|
LL | impl<T, U> CoerceUnsized<Bar<U>> for Foo<T> where T: CoerceUnsized<U> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected coercion between the same definition; expected `Foo`, found `Bar`
diff --git a/tests/ui/error-codes/E0396-fixed.stderr b/tests/ui/error-codes/E0396-fixed.stderr
index 2efbd6989..e77b2ce9a 100644
--- a/tests/ui/error-codes/E0396-fixed.stderr
+++ b/tests/ui/error-codes/E0396-fixed.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/E0396-fixed.rs:5:28
|
LL | const VALUE: u8 = unsafe { *REG_ADDR };
- | ^^^^^^^^^ dereferencing pointer failed: 0x5f3759df[noalloc] is a dangling pointer (it has no provenance)
+ | ^^^^^^^^^ memory access failed: 0x5f3759df[noalloc] is a dangling pointer (it has no provenance)
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0396.rs b/tests/ui/error-codes/E0396.rs
index 4415b70e7..383eda3d6 100644
--- a/tests/ui/error-codes/E0396.rs
+++ b/tests/ui/error-codes/E0396.rs
@@ -9,9 +9,11 @@ const unsafe fn unreachable() -> ! {
const INFALLIBLE: *mut Infallible = &[] as *const [Infallible] as *const _ as _;
match *INFALLIBLE {}
//~^ ERROR dereferencing raw mutable pointers in constant functions is unstable
+ //~| ERROR dereferencing raw mutable pointers in constant functions is unstable
const BAD: () = unsafe { match *INFALLIBLE {} };
//~^ ERROR dereferencing raw mutable pointers in constants is unstable
+ //~| ERROR dereferencing raw mutable pointers in constants is unstable
}
fn main() {
diff --git a/tests/ui/error-codes/E0396.stderr b/tests/ui/error-codes/E0396.stderr
index 8c87f4067..a84a1216e 100644
--- a/tests/ui/error-codes/E0396.stderr
+++ b/tests/ui/error-codes/E0396.stderr
@@ -16,15 +16,35 @@ LL | match *INFALLIBLE {}
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
+ --> $DIR/E0396.rs:10:11
+ |
+LL | match *INFALLIBLE {}
+ | ^^^^^^^^^^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0658]: dereferencing raw mutable pointers in constants is unstable
+ --> $DIR/E0396.rs:14:36
+ |
+LL | const BAD: () = unsafe { match *INFALLIBLE {} };
+ | ^^^^^^^^^^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
error[E0658]: dereferencing raw mutable pointers in constants is unstable
- --> $DIR/E0396.rs:13:36
+ --> $DIR/E0396.rs:14:36
|
LL | const BAD: () = unsafe { match *INFALLIBLE {} };
| ^^^^^^^^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error: aborting due to 3 previous errors
+error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/error-codes/E0401.stderr b/tests/ui/error-codes/E0401.stderr
index 928c8d11d..0a069e8d3 100644
--- a/tests/ui/error-codes/E0401.stderr
+++ b/tests/ui/error-codes/E0401.stderr
@@ -32,12 +32,18 @@ LL | fn helper(sel: &Self) -> u8 {
| use of generic parameter from outer item
| refer to the type directly here instead
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/E0401.rs:11:5
|
LL | bfnr(x);
- | ^^^^ cannot infer type of the type parameter `U` declared on the function `bfnr`
+ | ^^^^ cannot infer type of the type parameter `V` declared on the function `bfnr`
+ |
+ = note: cannot satisfy `_: Baz<_>`
+note: required by a bound in `bfnr`
+ --> $DIR/E0401.rs:4:19
|
+LL | fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) {
+ | ^^^^^^ required by this bound in `bfnr`
help: consider specifying the generic arguments
|
LL | bfnr::<U, V, W>(x);
@@ -66,5 +72,5 @@ LL | bfnr::<U, V, W>(x);
error: aborting due to 5 previous errors
-Some errors have detailed explanations: E0282, E0283, E0401.
-For more information about an error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0283, E0401.
+For more information about an error, try `rustc --explain E0283`.
diff --git a/tests/ui/error-codes/E0452.stderr b/tests/ui/error-codes/E0452.stderr
index f67b740ff..986c135ed 100644
--- a/tests/ui/error-codes/E0452.stderr
+++ b/tests/ui/error-codes/E0452.stderr
@@ -9,18 +9,24 @@ error[E0452]: malformed lint attribute input
|
LL | #![allow(foo = "")]
| ^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/E0452.rs:1:10
|
LL | #![allow(foo = "")]
| ^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/E0452.rs:1:10
|
LL | #![allow(foo = "")]
| ^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/error-codes/E0453.stderr b/tests/ui/error-codes/E0453.stderr
index f982ed26f..bb2c39298 100644
--- a/tests/ui/error-codes/E0453.stderr
+++ b/tests/ui/error-codes/E0453.stderr
@@ -15,6 +15,8 @@ LL | #![forbid(non_snake_case)]
LL |
LL | #[allow(non_snake_case)]
| ^^^^^^^^^^^^^^ overruled by previous forbid
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/error-codes/E0463.rs b/tests/ui/error-codes/E0463.rs
deleted file mode 100644
index 683565281..000000000
--- a/tests/ui/error-codes/E0463.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-#![feature(plugin)]
-#![plugin(cookie_monster)]
-//~^ ERROR E0463
-extern crate cake_is_a_lie;
-
-fn main() {
-}
diff --git a/tests/ui/error-codes/E0463.stderr b/tests/ui/error-codes/E0463.stderr
deleted file mode 100644
index 1aa66e1ec..000000000
--- a/tests/ui/error-codes/E0463.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0463]: can't find crate for `cookie_monster`
- --> $DIR/E0463.rs:2:11
- |
-LL | #![plugin(cookie_monster)]
- | ^^^^^^^^^^^^^^ can't find crate
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0463`.
diff --git a/tests/ui/error-codes/E0476.stderr b/tests/ui/error-codes/E0476.stderr
index a4bb26532..0378ac6e8 100644
--- a/tests/ui/error-codes/E0476.stderr
+++ b/tests/ui/error-codes/E0476.stderr
@@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `CoerceUnsized<&Wrapper<_>>`
--> $DIR/E0476.rs:9:1
|
LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<'a, 'b, T, U> CoerceUnsized<&'a U> for &'b T
@@ -12,7 +12,7 @@ error[E0476]: lifetime of the source pointer does not outlive lifetime bound of
--> $DIR/E0476.rs:9:1
|
LL | impl<'a, 'b, T, S> CoerceUnsized<&'a Wrapper<T>> for &'b Wrapper<S> where S: Unsize<T> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: object type is valid for the lifetime `'a` as defined here
--> $DIR/E0476.rs:9:6
diff --git a/tests/ui/error-codes/E0583.stderr b/tests/ui/error-codes/E0583.stderr
index c7bbbf114..6707f2864 100644
--- a/tests/ui/error-codes/E0583.stderr
+++ b/tests/ui/error-codes/E0583.stderr
@@ -5,6 +5,7 @@ LL | mod module_that_doesnt_exist;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `module_that_doesnt_exist`, create file "$DIR/module_that_doesnt_exist.rs" or "$DIR/module_that_doesnt_exist/mod.rs"
+ = note: if there is a `mod module_that_doesnt_exist` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/ui/error-codes/E0602.stderr b/tests/ui/error-codes/E0602.stderr
index 60ecec7cd..b6b5cd5c3 100644
--- a/tests/ui/error-codes/E0602.stderr
+++ b/tests/ui/error-codes/E0602.stderr
@@ -6,10 +6,12 @@ warning[E0602]: unknown lint: `bogus`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/error-codes/E0719.stderr b/tests/ui/error-codes/E0719.stderr
index e302f406d..00aea9713 100644
--- a/tests/ui/error-codes/E0719.stderr
+++ b/tests/ui/error-codes/E0719.stderr
@@ -1,4 +1,4 @@
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:1:33
|
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
@@ -6,15 +6,17 @@ LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| |
| `Item` bound here first
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:1:33
|
LL | trait Foo: Iterator<Item = i32, Item = i32> {}
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified
+error[E0719]: the value of the associated type `Item` in trait `Iterator` is already specified
--> $DIR/E0719.rs:7:42
|
LL | fn test() -> Box<dyn Iterator<Item = (), Item = Unit>> {
diff --git a/tests/ui/error-codes/E0789.stderr b/tests/ui/error-codes/E0789.stderr
index faab92bae..6df9daafe 100644
--- a/tests/ui/error-codes/E0789.stderr
+++ b/tests/ui/error-codes/E0789.stderr
@@ -9,6 +9,8 @@ error[E0789]: `rustc_allowed_through_unstable_modules` attribute must be paired
|
LL | struct Foo;
| ^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/errors/remap-path-prefix-macro.normal.run.stdout b/tests/ui/errors/remap-path-prefix-macro.normal.run.stdout
new file mode 100644
index 000000000..3bbdcbb86
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix-macro.normal.run.stdout
@@ -0,0 +1 @@
+remapped/errors/remap-path-prefix-macro.rs
diff --git a/tests/ui/errors/remap-path-prefix-macro.rs b/tests/ui/errors/remap-path-prefix-macro.rs
new file mode 100644
index 000000000..0ba706b0a
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix-macro.rs
@@ -0,0 +1,12 @@
+// run-pass
+// check-run-results
+
+// revisions: normal with-macro-scope without-macro-scope
+// compile-flags: --remap-path-prefix={{src-base}}=remapped
+// [with-macro-scope]compile-flags: -Zremap-path-scope=macro,diagnostics
+// [without-macro-scope]compile-flags: -Zremap-path-scope=diagnostics
+// no-remap-src-base: Manually remap, so the remapped path remains in .stderr file.
+
+fn main() {
+ println!("{}", file!());
+}
diff --git a/tests/ui/errors/remap-path-prefix-macro.with-macro-scope.run.stdout b/tests/ui/errors/remap-path-prefix-macro.with-macro-scope.run.stdout
new file mode 100644
index 000000000..3bbdcbb86
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix-macro.with-macro-scope.run.stdout
@@ -0,0 +1 @@
+remapped/errors/remap-path-prefix-macro.rs
diff --git a/tests/ui/errors/remap-path-prefix-macro.without-macro-scope.run.stdout b/tests/ui/errors/remap-path-prefix-macro.without-macro-scope.run.stdout
new file mode 100644
index 000000000..642823fec
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix-macro.without-macro-scope.run.stdout
@@ -0,0 +1 @@
+$DIR/remap-path-prefix-macro.rs
diff --git a/tests/ui/errors/remap-path-prefix.stderr b/tests/ui/errors/remap-path-prefix.normal.stderr
index 62dbd4b88..004f10b4e 100644
--- a/tests/ui/errors/remap-path-prefix.stderr
+++ b/tests/ui/errors/remap-path-prefix.normal.stderr
@@ -1,5 +1,5 @@
error[E0425]: cannot find value `ferris` in this scope
- --> remapped/errors/remap-path-prefix.rs:16:5
+ --> remapped/errors/remap-path-prefix.rs:19:5
|
LL | ferris
| ^^^^^^ not found in this scope
diff --git a/tests/ui/errors/remap-path-prefix.rs b/tests/ui/errors/remap-path-prefix.rs
index 393b8e22f..e3338c10f 100644
--- a/tests/ui/errors/remap-path-prefix.rs
+++ b/tests/ui/errors/remap-path-prefix.rs
@@ -1,4 +1,7 @@
+// revisions: normal with-diagnostic-scope without-diagnostic-scope
// compile-flags: --remap-path-prefix={{src-base}}=remapped
+// [with-diagnostic-scope]compile-flags: -Zremap-path-scope=diagnostics
+// [without-diagnostic-scope]compile-flags: -Zremap-path-scope=object
// no-remap-src-base: Manually remap, so the remapped path remains in .stderr file.
// The remapped paths are not normalized by compiletest.
diff --git a/tests/ui/errors/remap-path-prefix.with-diagnostic-scope.stderr b/tests/ui/errors/remap-path-prefix.with-diagnostic-scope.stderr
new file mode 100644
index 000000000..004f10b4e
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix.with-diagnostic-scope.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `ferris` in this scope
+ --> remapped/errors/remap-path-prefix.rs:19:5
+ |
+LL | ferris
+ | ^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/errors/remap-path-prefix.without-diagnostic-scope.stderr b/tests/ui/errors/remap-path-prefix.without-diagnostic-scope.stderr
new file mode 100644
index 000000000..98fe32819
--- /dev/null
+++ b/tests/ui/errors/remap-path-prefix.without-diagnostic-scope.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `ferris` in this scope
+ --> $DIR/remap-path-prefix.rs:19:5
+ |
+LL | ferris
+ | ^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.rs b/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.rs
new file mode 100644
index 000000000..5e64fd5d2
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.rs
@@ -0,0 +1,10 @@
+fn main() {
+ let number = 2;
+ Some(true).filter({ //~ ERROR expected a `FnOnce(&bool)` closure, found `bool`
+ if number % 2 == 0 {
+ number == 0
+ } else {
+ number != 0
+ }
+ });
+}
diff --git a/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr b/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr
new file mode 100644
index 000000000..f70b32117
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr
@@ -0,0 +1,27 @@
+error[E0277]: expected a `FnOnce(&bool)` closure, found `bool`
+ --> $DIR/block_instead_of_closure_in_arg.rs:3:23
+ |
+LL | Some(true).filter({
+ | _________________------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |/ if number % 2 == 0 {
+LL | || number == 0
+LL | || } else {
+LL | || number != 0
+LL | || }
+ | ||_________- this tail expression is of type `bool`
+LL | | });
+ | |______^ expected an `FnOnce(&bool)` closure, found `bool`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a bool,)>` is not implemented for `bool`
+note: required by a bound in `Option::<T>::filter`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+help: you might have meant to create the closure instead of a block
+ |
+LL | Some(true).filter(|_| {
+ | +++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_fn_call.fixed b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.fixed
new file mode 100644
index 000000000..b81515cda
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.fixed
@@ -0,0 +1,10 @@
+// run-rustfix
+fn main() {
+ let _ = vec![1, 2, 3].into_iter().map(|x| {
+ let y = x; //~ ERROR expected expression, found `let` statement
+ y
+ });
+ let _: () = foo(); //~ ERROR mismatched types
+}
+
+fn foo() {}
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_fn_call.rs b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.rs
new file mode 100644
index 000000000..e47ad562f
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.rs
@@ -0,0 +1,10 @@
+// run-rustfix
+fn main() {
+ let _ = vec![1, 2, 3].into_iter().map(|x|
+ let y = x; //~ ERROR expected expression, found `let` statement
+ y
+ );
+ let _: () = foo; //~ ERROR mismatched types
+}
+
+fn foo() {}
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_fn_call.stderr b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.stderr
new file mode 100644
index 000000000..fbb7e0e4d
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_fn_call.stderr
@@ -0,0 +1,38 @@
+error: expected expression, found `let` statement
+ --> $DIR/missing_block_in_fn_call.rs:4:9
+ |
+LL | let _ = vec![1, 2, 3].into_iter().map(|x|
+ | --- while parsing the body of this closure
+LL | let y = x;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+help: you might have meant to open the body of the closure
+ |
+LL ~ let _ = vec![1, 2, 3].into_iter().map(|x| {
+LL | let y = x;
+LL | y
+LL ~ });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/missing_block_in_fn_call.rs:7:17
+ |
+LL | let _: () = foo;
+ | -- ^^^ expected `()`, found fn item
+ | |
+ | expected due to this
+...
+LL | fn foo() {}
+ | -------- function `foo` defined here
+ |
+ = note: expected unit type `()`
+ found fn item `fn() {foo}`
+help: use parentheses to call this function
+ |
+LL | let _: () = foo();
+ | ++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_let_binding.rs b/tests/ui/expr/malformed_closure/missing_block_in_let_binding.rs
new file mode 100644
index 000000000..1ee215d15
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_let_binding.rs
@@ -0,0 +1,6 @@
+fn main() {
+ let x = |x|
+ let y = x; //~ ERROR expected expression, found `let` statement
+ let _ = () + ();
+ y
+}
diff --git a/tests/ui/expr/malformed_closure/missing_block_in_let_binding.stderr b/tests/ui/expr/malformed_closure/missing_block_in_let_binding.stderr
new file mode 100644
index 000000000..d4640fba9
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/missing_block_in_let_binding.stderr
@@ -0,0 +1,16 @@
+error: expected expression, found `let` statement
+ --> $DIR/missing_block_in_let_binding.rs:3:9
+ |
+LL | let x = |x|
+ | --- while parsing the body of this closure
+LL | let y = x;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+help: you might have meant to open the body of the closure
+ |
+LL | let x = |x| {
+ | +
+
+error: aborting due to previous error
+
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.fixed b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.fixed
new file mode 100644
index 000000000..8014dc87c
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.fixed
@@ -0,0 +1,9 @@
+// run-rustfix
+fn main() {
+ let _ = vec![1, 2, 3].into_iter().map(|x| {
+ let y = x; //~ ERROR expected expression, found `let` statement
+ y
+ });
+ let _: () = foo(); //~ ERROR mismatched types
+}
+fn foo() {}
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.rs b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.rs
new file mode 100644
index 000000000..9e4aca888
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.rs
@@ -0,0 +1,9 @@
+// run-rustfix
+fn main() {
+ let _ = vec![1, 2, 3].into_iter().map({|x|
+ let y = x; //~ ERROR expected expression, found `let` statement
+ y
+ });
+ let _: () = foo; //~ ERROR mismatched types
+}
+fn foo() {}
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.stderr b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.stderr
new file mode 100644
index 000000000..5fc48d73b
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_parse_error.stderr
@@ -0,0 +1,36 @@
+error: expected expression, found `let` statement
+ --> $DIR/ruby_style_closure_parse_error.rs:4:9
+ |
+LL | let _ = vec![1, 2, 3].into_iter().map({|x|
+ | --- while parsing the body of this closure
+LL | let y = x;
+ | ^^^
+ |
+ = note: only supported directly in conditions of `if` and `while` expressions
+help: you might have meant to open the body of the closure, instead of enclosing the closure in a block
+ |
+LL - let _ = vec![1, 2, 3].into_iter().map({|x|
+LL + let _ = vec![1, 2, 3].into_iter().map(|x| {
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/ruby_style_closure_parse_error.rs:7:17
+ |
+LL | let _: () = foo;
+ | -- ^^^ expected `()`, found fn item
+ | |
+ | expected due to this
+LL | }
+LL | fn foo() {}
+ | -------- function `foo` defined here
+ |
+ = note: expected unit type `()`
+ found fn item `fn() {foo}`
+help: use parentheses to call this function
+ |
+LL | let _: () = foo();
+ | ++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.rs b/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.rs
new file mode 100644
index 000000000..bb2e9c0a6
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.rs
@@ -0,0 +1,7 @@
+const x: usize =42;
+fn main() {
+ let p = Some(45).and_then({|x| //~ ERROR expected a `FnOnce({integer})` closure, found `Option<usize>`
+ 1 + 1;
+ Some(x * 2)
+ });
+}
diff --git a/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr b/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr
new file mode 100644
index 000000000..e44ec5ca9
--- /dev/null
+++ b/tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr
@@ -0,0 +1,25 @@
+error[E0277]: expected a `FnOnce({integer})` closure, found `Option<usize>`
+ --> $DIR/ruby_style_closure_successful_parse.rs:3:31
+ |
+LL | let p = Some(45).and_then({|x|
+ | ______________________--------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | | 1 + 1;
+LL | | Some(x * 2)
+ | | ----------- this tail expression is of type `Option<usize>`
+LL | | });
+ | |_____^ expected an `FnOnce({integer})` closure, found `Option<usize>`
+ |
+ = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<usize>`
+note: required by a bound in `Option::<T>::and_then`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+help: you might have meant to open the closure body instead of placing a closure within a block
+ |
+LL - let p = Some(45).and_then({|x|
+LL + let p = Some(45).and_then(|x| {
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/extern/extern-wrong-value-type.rs b/tests/ui/extern/extern-wrong-value-type.rs
index 337865ec1..56c6cf1df 100644
--- a/tests/ui/extern/extern-wrong-value-type.rs
+++ b/tests/ui/extern/extern-wrong-value-type.rs
@@ -7,5 +7,5 @@ fn main() {
// extern functions are extern "C" fn
let _x: extern "C" fn() = f; // OK
is_fn(f);
- //~^ ERROR expected a `Fn<()>` closure, found `extern "C" fn() {f}`
+ //~^ ERROR expected a `Fn()` closure, found `extern "C" fn() {f}`
}
diff --git a/tests/ui/extern/extern-wrong-value-type.stderr b/tests/ui/extern/extern-wrong-value-type.stderr
index ff2934a2b..463cee831 100644
--- a/tests/ui/extern/extern-wrong-value-type.stderr
+++ b/tests/ui/extern/extern-wrong-value-type.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() {f}`
+error[E0277]: expected a `Fn()` closure, found `extern "C" fn() {f}`
--> $DIR/extern-wrong-value-type.rs:9:11
|
LL | is_fn(f);
- | ----- ^ expected an `Fn<()>` closure, found `extern "C" fn() {f}`
+ | ----- ^ expected an `Fn()` closure, found `extern "C" fn() {f}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/feature-gates/doc-rust-logo.rs b/tests/ui/feature-gates/doc-rust-logo.rs
new file mode 100644
index 000000000..e6a585129
--- /dev/null
+++ b/tests/ui/feature-gates/doc-rust-logo.rs
@@ -0,0 +1,5 @@
+#![doc(rust_logo)]
+//~^ ERROR the `#[doc(rust_logo)]` attribute is used for Rust branding
+//! This is not an official rust crate
+
+fn main() {}
diff --git a/tests/ui/feature-gates/doc-rust-logo.stderr b/tests/ui/feature-gates/doc-rust-logo.stderr
new file mode 100644
index 000000000..ff5855290
--- /dev/null
+++ b/tests/ui/feature-gates/doc-rust-logo.stderr
@@ -0,0 +1,12 @@
+error[E0658]: the `#[doc(rust_logo)]` attribute is used for Rust branding
+ --> $DIR/doc-rust-logo.rs:1:8
+ |
+LL | #![doc(rust_logo)]
+ | ^^^^^^^^^
+ |
+ = note: see issue #90418 <https://github.com/rust-lang/rust/issues/90418> for more information
+ = help: add `#![feature(rustdoc_internals)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-associated_type_bounds.rs b/tests/ui/feature-gates/feature-gate-associated_type_bounds.rs
index 49fb10e60..152c7a8de 100644
--- a/tests/ui/feature-gates/feature-gate-associated_type_bounds.rs
+++ b/tests/ui/feature-gates/feature-gate-associated_type_bounds.rs
@@ -54,20 +54,20 @@ fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
const _cdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// const _cdef_dyn: &dyn Tr1<As1: Copy> = &S1;
static _sdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// static _sdef_dyn: &dyn Tr1<As1: Copy> = &S1;
fn main() {
let _: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
- //~| ERROR `impl Trait` only allowed in function and inherent method return types
+ //~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// let _: &dyn Tr1<As1: Copy> = &S1;
}
diff --git a/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr b/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr
index 4233a8af9..f2bceda9b 100644
--- a/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr
+++ b/tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr
@@ -115,19 +115,19 @@ LL | let _: impl Tr1<As1: Copy> = S1;
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/feature-gate-associated_type_bounds.rs:55:14
|
LL | const _cdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/feature-gate-associated_type_bounds.rs:61:15
|
LL | static _sdef: impl Tr1<As1: Copy> = S1;
| ^^^^^^^^^^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/feature-gate-associated_type_bounds.rs:68:12
|
LL | let _: impl Tr1<As1: Copy> = S1;
diff --git a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs
index a4c91f3bc..58a9c84be 100644
--- a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs
+++ b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs
@@ -1,9 +1,9 @@
// edition:2021
#![feature(stmt_expr_attributes)]
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
let _closure = #[track_caller] || {}; //~ `#[track_caller]` on closures
- let _generator = #[track_caller] || { yield; }; //~ `#[track_caller]` on closures
+ let _coroutine = #[track_caller] || { yield; }; //~ `#[track_caller]` on closures
let _future = #[track_caller] async {}; //~ `#[track_caller]` on closures
}
diff --git a/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr b/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr
index cf2ea5fe1..d5ef5d09e 100644
--- a/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr
+++ b/tests/ui/feature-gates/feature-gate-closure_track_caller.stderr
@@ -10,7 +10,7 @@ LL | let _closure = #[track_caller] || {};
error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/feature-gate-closure_track_caller.rs:7:22
|
-LL | let _generator = #[track_caller] || { yield; };
+LL | let _coroutine = #[track_caller] || { yield; };
| ^^^^^^^^^^^^^^^
|
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
diff --git a/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr b/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr
new file mode 100644
index 000000000..2e529236a
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coroutines.e2024.stderr
@@ -0,0 +1,28 @@
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:9:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0627]: yield expression outside of coroutine literal
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0627, E0658.
+For more information about an error, try `rustc --explain E0627`.
diff --git a/tests/ui/feature-gates/feature-gate-coroutines.none.stderr b/tests/ui/feature-gates/feature-gate-coroutines.none.stderr
new file mode 100644
index 000000000..ab24805e4
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coroutines.none.stderr
@@ -0,0 +1,66 @@
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:9:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:16:5
+ |
+LL | yield;
+ | ^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:17:5
+ |
+LL | yield 0;
+ | ^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0658]: yield syntax is experimental
+ --> $DIR/feature-gate-coroutines.rs:9:16
+ |
+LL | let _ = || yield true;
+ | ^^^^^^^^^^
+ |
+ = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
+ = help: add `#![feature(coroutines)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0627]: yield expression outside of coroutine literal
+ --> $DIR/feature-gate-coroutines.rs:5:5
+ |
+LL | yield true;
+ | ^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0627, E0658.
+For more information about an error, try `rustc --explain E0627`.
diff --git a/tests/ui/feature-gates/feature-gate-coroutines.rs b/tests/ui/feature-gates/feature-gate-coroutines.rs
new file mode 100644
index 000000000..53b58d486
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-coroutines.rs
@@ -0,0 +1,18 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+
+fn main() {
+ yield true; //~ ERROR yield syntax is experimental
+ //~^ ERROR yield expression outside of coroutine literal
+ //[none]~^^ ERROR yield syntax is experimental
+
+ let _ = || yield true; //~ ERROR yield syntax is experimental
+ //[none]~^ ERROR yield syntax is experimental
+}
+
+#[cfg(FALSE)]
+fn foo() {
+ // Ok in 2024 edition
+ yield; //[none]~ ERROR yield syntax is experimental
+ yield 0; //[none]~ ERROR yield syntax is experimental
+}
diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr
index 303700c7a..00b8c0eef 100644
--- a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr
+++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr
@@ -14,6 +14,7 @@ LL | trait Trait {
| ----- this trait cannot be made into an object...
LL | fn ptr(self: Ptr<Self>);
| ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on
+ = help: only type `i32` implements the trait, consider using it directly instead
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:32:5
@@ -31,6 +32,7 @@ LL | trait Trait {
| ----- this trait cannot be made into an object...
LL | fn ptr(self: Ptr<Self>);
| ^^^^^^^^^ ...because method `ptr`'s `self` parameter cannot be dispatched on
+ = help: only type `i32` implements the trait, consider using it directly instead
= note: required for the cast from `Ptr<{integer}>` to `Ptr<dyn Trait>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr b/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr
new file mode 100644
index 000000000..1462c41e9
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-gen_blocks.e2024.stderr
@@ -0,0 +1,28 @@
+error[E0658]: gen blocks are experimental
+ --> $DIR/feature-gate-gen_blocks.rs:5:5
+ |
+LL | gen {};
+ | ^^^^^
+ |
+ = note: see issue #117078 <https://github.com/rust-lang/rust/issues/117078> for more information
+ = help: add `#![feature(gen_blocks)]` to the crate attributes to enable
+
+error[E0658]: gen blocks are experimental
+ --> $DIR/feature-gate-gen_blocks.rs:13:5
+ |
+LL | gen {};
+ | ^^^^^
+ |
+ = note: see issue #117078 <https://github.com/rust-lang/rust/issues/117078> for more information
+ = help: add `#![feature(gen_blocks)]` to the crate attributes to enable
+
+error[E0282]: type annotations needed
+ --> $DIR/feature-gate-gen_blocks.rs:5:9
+ |
+LL | gen {};
+ | ^^ cannot infer type
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0282, E0658.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr b/tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr
new file mode 100644
index 000000000..b448c35e8
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-gen_blocks.none.stderr
@@ -0,0 +1,9 @@
+error[E0422]: cannot find struct, variant or union type `gen` in this scope
+ --> $DIR/feature-gate-gen_blocks.rs:5:5
+ |
+LL | gen {};
+ | ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0422`.
diff --git a/tests/ui/feature-gates/feature-gate-gen_blocks.rs b/tests/ui/feature-gates/feature-gate-gen_blocks.rs
new file mode 100644
index 000000000..e2e1574a3
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-gen_blocks.rs
@@ -0,0 +1,15 @@
+// revisions: e2024 none
+//[e2024] compile-flags: --edition 2024 -Zunstable-options
+
+fn main() {
+ gen {};
+ //[none]~^ ERROR: cannot find struct, variant or union type `gen`
+ //[e2024]~^^ ERROR: gen blocks are experimental
+ //[e2024]~| ERROR: type annotations needed
+}
+
+#[cfg(FALSE)]
+fn foo() {
+ gen {};
+ //[e2024]~^ ERROR: gen blocks are experimental
+}
diff --git a/tests/ui/feature-gates/feature-gate-generators.rs b/tests/ui/feature-gates/feature-gate-generators.rs
deleted file mode 100644
index 931fee134..000000000
--- a/tests/ui/feature-gates/feature-gate-generators.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-fn main() {
- yield true; //~ ERROR yield syntax is experimental
- //~^ ERROR yield expression outside of generator literal
-}
-
-#[cfg(FALSE)]
-fn foo() {
- yield; //~ ERROR yield syntax is experimental
- yield 0; //~ ERROR yield syntax is experimental
-}
diff --git a/tests/ui/feature-gates/feature-gate-generators.stderr b/tests/ui/feature-gates/feature-gate-generators.stderr
deleted file mode 100644
index dfea178a6..000000000
--- a/tests/ui/feature-gates/feature-gate-generators.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0658]: yield syntax is experimental
- --> $DIR/feature-gate-generators.rs:2:5
- |
-LL | yield true;
- | ^^^^^^^^^^
- |
- = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
- = help: add `#![feature(generators)]` to the crate attributes to enable
-
-error[E0658]: yield syntax is experimental
- --> $DIR/feature-gate-generators.rs:8:5
- |
-LL | yield;
- | ^^^^^
- |
- = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
- = help: add `#![feature(generators)]` to the crate attributes to enable
-
-error[E0658]: yield syntax is experimental
- --> $DIR/feature-gate-generators.rs:9:5
- |
-LL | yield 0;
- | ^^^^^^^
- |
- = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
- = help: add `#![feature(generators)]` to the crate attributes to enable
-
-error[E0627]: yield expression outside of generator literal
- --> $DIR/feature-gate-generators.rs:2:5
- |
-LL | yield true;
- | ^^^^^^^^^^
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0627, E0658.
-For more information about an error, try `rustc --explain E0627`.
diff --git a/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs b/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs
index 0db8088f7..1b9530fa8 100644
--- a/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs
+++ b/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.rs
@@ -1,6 +1,6 @@
fn f() -> impl Fn() -> impl Sized { || () }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return
fn g() -> &'static dyn Fn() -> impl Sized { &|| () }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return
fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr b/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr
index c8c3e13d7..f0c0cd040 100644
--- a/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr
+++ b/tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:1:24
|
LL | fn f() -> impl Fn() -> impl Sized { || () }
@@ -7,7 +7,7 @@ LL | fn f() -> impl Fn() -> impl Sized { || () }
= note: see issue #99697 <https://github.com/rust-lang/rust/issues/99697> for more information
= help: add `#![feature(impl_trait_in_fn_trait_return)]` to the crate attributes to enable
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:3:32
|
LL | fn g() -> &'static dyn Fn() -> impl Sized { &|| () }
diff --git a/tests/ui/feature-gates/feature-gate-lint-reasons.stderr b/tests/ui/feature-gates/feature-gate-lint-reasons.stderr
index 12793c7a2..6d49b7ed2 100644
--- a/tests/ui/feature-gates/feature-gate-lint-reasons.stderr
+++ b/tests/ui/feature-gates/feature-gate-lint-reasons.stderr
@@ -15,6 +15,7 @@ LL | #![warn(nonstandard_style, reason = "the standard should be respected")]
|
= note: see issue #54503 <https://github.com/rust-lang/rust/issues/54503> for more information
= help: add `#![feature(lint_reasons)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr
index 1f725f354..5e14bf639 100644
--- a/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr
+++ b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr
@@ -25,6 +25,7 @@ LL | #![deny(multiple_supertrait_upcastable)]
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
@@ -34,6 +35,7 @@ LL | #![warn(multiple_supertrait_upcastable)]
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1
@@ -43,6 +45,7 @@ LL | #![deny(multiple_supertrait_upcastable)]
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
@@ -52,6 +55,7 @@ LL | #![warn(multiple_supertrait_upcastable)]
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 6 warnings emitted
diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs
index 9b646060a..1922bfb49 100644
--- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs
+++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.rs
@@ -3,13 +3,17 @@
#![deny(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
#![allow(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
fn main() {
enum Foo {
- A, B, C,
+ A,
+ B,
+ C,
}
#[allow(non_exhaustive_omitted_patterns)]
@@ -17,18 +21,22 @@ fn main() {
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
match Foo::A {
+ //~^ ERROR non-exhaustive patterns: `Foo::C` not covered
Foo::A => {}
Foo::B => {}
}
- //~^^^^ ERROR non-exhaustive patterns: `Foo::C` not covered
+ #[warn(non_exhaustive_omitted_patterns)]
+ //~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
+ //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
match Foo::A {
Foo::A => {}
Foo::B => {}
- #[warn(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
- //~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
}
diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr
index fb39c404c..8af0eedc8 100644
--- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr
+++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr
@@ -10,7 +10,7 @@ LL | #![deny(non_exhaustive_omitted_patterns)]
= note: `#[warn(unknown_lints)]` on by default
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:6:1
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:7:1
|
LL | #![allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -20,7 +20,7 @@ LL | #![allow(non_exhaustive_omitted_patterns)]
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -30,7 +30,7 @@ LL | #[allow(non_exhaustive_omitted_patterns)]
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -38,18 +38,30 @@ LL | #[allow(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:29:9
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
|
-LL | #[warn(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
+ |
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
--> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:1
|
LL | #![deny(non_exhaustive_omitted_patterns)]
@@ -58,9 +70,10 @@ LL | #![deny(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:6:1
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:7:1
|
LL | #![allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -68,9 +81,10 @@ LL | #![allow(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -78,9 +92,10 @@ LL | #[allow(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
|
LL | #[allow(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -88,30 +103,44 @@ LL | #[allow(non_exhaustive_omitted_patterns)]
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `non_exhaustive_omitted_patterns`
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:29:9
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
|
-LL | #[warn(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `non_exhaustive_omitted_patterns` lint is unstable
= note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
= help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
+ |
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0004]: non-exhaustive patterns: `Foo::C` not covered
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:20:11
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:25:11
|
LL | match Foo::A {
| ^^^^^^ pattern `Foo::C` not covered
|
note: `Foo` defined here
- --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:12:15
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:13:10
|
LL | enum Foo {
- | ---
-LL | A, B, C,
- | ^ not covered
+ | ^^^
+...
+LL | C,
+ | - not covered
= note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
@@ -119,6 +148,50 @@ LL ~ Foo::B => {},
LL + Foo::C => todo!()
|
-error: aborting due to previous error; 10 warnings emitted
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:1
+ |
+LL | #![deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:7:1
+ |
+LL | #![allow(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:19:5
+ |
+LL | #[allow(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unknown lint: `non_exhaustive_omitted_patterns`
+ --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:31:5
+ |
+LL | #[warn(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the `non_exhaustive_omitted_patterns` lint is unstable
+ = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information
+ = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to previous error; 16 warnings emitted
For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/feature-gates/feature-gate-offset-of-enum.rs b/tests/ui/feature-gates/feature-gate-offset-of-enum.rs
new file mode 100644
index 000000000..e19dcf9f6
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-offset-of-enum.rs
@@ -0,0 +1,15 @@
+#![feature(offset_of)]
+
+use std::mem::offset_of;
+
+enum Alpha {
+ One(u8),
+ Two(u8),
+}
+
+fn main() {
+ offset_of!(Alpha::One, 0); //~ ERROR expected type, found variant `Alpha::One`
+ offset_of!(Alpha, One); //~ ERROR `One` is an enum variant; expected field at end of `offset_of`
+ //~| ERROR using enums in offset_of is experimental
+ offset_of!(Alpha, Two.0); //~ ERROR using enums in offset_of is experimental
+}
diff --git a/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr b/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr
new file mode 100644
index 000000000..893f78702
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-offset-of-enum.stderr
@@ -0,0 +1,37 @@
+error[E0573]: expected type, found variant `Alpha::One`
+ --> $DIR/feature-gate-offset-of-enum.rs:11:16
+ |
+LL | offset_of!(Alpha::One, 0);
+ | ^^^^^^^^^^
+ | |
+ | not a type
+ | help: try using the variant's enum: `Alpha`
+
+error[E0658]: using enums in offset_of is experimental
+ --> $DIR/feature-gate-offset-of-enum.rs:12:23
+ |
+LL | offset_of!(Alpha, One);
+ | ^^^
+ |
+ = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
+ = help: add `#![feature(offset_of_enum)]` to the crate attributes to enable
+
+error[E0795]: `One` is an enum variant; expected field at end of `offset_of`
+ --> $DIR/feature-gate-offset-of-enum.rs:12:23
+ |
+LL | offset_of!(Alpha, One);
+ | ^^^ enum variant
+
+error[E0658]: using enums in offset_of is experimental
+ --> $DIR/feature-gate-offset-of-enum.rs:14:23
+ |
+LL | offset_of!(Alpha, Two.0);
+ | ^^^
+ |
+ = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
+ = help: add `#![feature(offset_of_enum)]` to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0573, E0658, E0795.
+For more information about an error, try `rustc --explain E0573`.
diff --git a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
index 4c77180b7..b4dc1fd45 100644
--- a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
+++ b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs
@@ -1,17 +1,17 @@
fn main() {
match 0usize {
- //~^ ERROR non-exhaustive patterns: `_` not covered
- //~| NOTE pattern `_` not covered
+ //~^ ERROR non-exhaustive patterns: `usize::MAX..` not covered
+ //~| NOTE pattern `usize::MAX..` not covered
//~| NOTE the matched value is of type `usize`
//~| NOTE `usize` does not have a fixed maximum value
0..=usize::MAX => {}
}
match 0isize {
- //~^ ERROR non-exhaustive patterns: `_` not covered
- //~| NOTE pattern `_` not covered
+ //~^ ERROR non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ //~| NOTE patterns `..isize::MIN` and `isize::MAX..` not covered
//~| NOTE the matched value is of type `isize`
- //~| NOTE `isize` does not have a fixed maximum value
+ //~| NOTE `isize` does not have fixed minimum and maximum values
isize::MIN..=isize::MAX => {}
}
}
diff --git a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
index 853b57052..8694924e5 100644
--- a/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
+++ b/tests/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr
@@ -1,31 +1,31 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
--> $DIR/feature-gate-precise_pointer_size_matching.rs:2:11
|
LL | match 0usize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` not covered
|
= note: the matched value is of type `usize`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 0..=usize::MAX => {},
-LL + _ => todo!()
+LL + usize::MAX.. => todo!()
|
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
--> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11
|
LL | match 0isize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ isize::MIN..=isize::MAX => {},
-LL + _ => todo!()
+LL + ..isize::MIN | isize::MAX.. => todo!()
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs b/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs
deleted file mode 100644
index 637765fff..000000000
--- a/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// edition:2021
-
-// async_fn_in_trait is not enough to allow use of RPITIT
-#![allow(incomplete_features)]
-#![feature(async_fn_in_trait)]
-
-trait Foo {
- fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
- fn baz() -> Box<impl std::fmt::Display>; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
-}
-
-// Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
-// feature-gate-async_fn_in_trait.rs)
-trait AsyncFoo {
- async fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
-}
-
-fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr b/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr
deleted file mode 100644
index 0082b6faf..000000000
--- a/tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
- --> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:8:17
- |
-LL | fn bar() -> impl Sized;
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
- --> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:9:21
- |
-LL | fn baz() -> Box<impl std::fmt::Display>;
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
- --> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:15:23
- |
-LL | async fn bar() -> impl Sized;
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0562`.
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.rs b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
index ae12495b5..86e2c48e1 100644
--- a/tests/ui/feature-gates/feature-gate-return_type_notation.rs
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
@@ -4,9 +4,9 @@
// [no] check-pass
// Since we're not adding new syntax, `cfg`'d out RTN must pass.
-#![feature(async_fn_in_trait)]
trait Trait {
+ #[allow(async_fn_in_trait)]
async fn m();
}
diff --git a/tests/ui/feature-gates/feature-gate-staged_api.rs b/tests/ui/feature-gates/feature-gate-staged_api.rs
index 2571ab5d1..ce6b218dd 100644
--- a/tests/ui/feature-gates/feature-gate-staged_api.rs
+++ b/tests/ui/feature-gates/feature-gate-staged_api.rs
@@ -1,11 +1,11 @@
-#![stable(feature = "a", since = "b")]
+#![stable(feature = "a", since = "3.3.3")]
//~^ ERROR stability attributes may not be used outside of the standard library
mod inner_private_module {
// UnnameableTypeAlias isn't marked as reachable, so no stability annotation is required here
pub type UnnameableTypeAlias = u8;
}
-#[stable(feature = "a", since = "b")]
+#[stable(feature = "a", since = "3.3.3")]
//~^ ERROR stability attributes may not be used outside of the standard library
pub fn f() -> inner_private_module::UnnameableTypeAlias {
0
diff --git a/tests/ui/feature-gates/feature-gate-staged_api.stderr b/tests/ui/feature-gates/feature-gate-staged_api.stderr
index 951bb5a17..1a9fcb02b 100644
--- a/tests/ui/feature-gates/feature-gate-staged_api.stderr
+++ b/tests/ui/feature-gates/feature-gate-staged_api.stderr
@@ -1,14 +1,14 @@
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/feature-gate-staged_api.rs:8:1
|
-LL | #[stable(feature = "a", since = "b")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[stable(feature = "a", since = "3.3.3")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0734]: stability attributes may not be used outside of the standard library
--> $DIR/feature-gate-staged_api.rs:1:1
|
-LL | #![stable(feature = "a", since = "b")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #![stable(feature = "a", since = "3.3.3")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/feature-gate-strict_provenance.stderr b/tests/ui/feature-gates/feature-gate-strict_provenance.stderr
index 751da87cc..1e6d762a5 100644
--- a/tests/ui/feature-gates/feature-gate-strict_provenance.stderr
+++ b/tests/ui/feature-gates/feature-gate-strict_provenance.stderr
@@ -28,6 +28,7 @@ LL | #![deny(fuzzy_provenance_casts)]
= note: the `fuzzy_provenance_casts` lint is unstable
= note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information
= help: add `#![feature(strict_provenance)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `lossy_provenance_casts`
--> $DIR/feature-gate-strict_provenance.rs:7:1
@@ -38,6 +39,7 @@ LL | #![deny(lossy_provenance_casts)]
= note: the `lossy_provenance_casts` lint is unstable
= note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information
= help: add `#![feature(strict_provenance)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `fuzzy_provenance_casts`
--> $DIR/feature-gate-strict_provenance.rs:3:1
@@ -48,6 +50,7 @@ LL | #![deny(fuzzy_provenance_casts)]
= note: the `fuzzy_provenance_casts` lint is unstable
= note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information
= help: add `#![feature(strict_provenance)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `lossy_provenance_casts`
--> $DIR/feature-gate-strict_provenance.rs:7:1
@@ -58,6 +61,7 @@ LL | #![deny(lossy_provenance_casts)]
= note: the `lossy_provenance_casts` lint is unstable
= note: see issue #95228 <https://github.com/rust-lang/rust/issues/95228> for more information
= help: add `#![feature(strict_provenance)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 6 warnings emitted
diff --git a/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr b/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr
index b4d6aa658..562aa478a 100644
--- a/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr
+++ b/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr
@@ -16,6 +16,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `test_unstable_lint`
--> $DIR/feature-gate-test_unstable_lint.rs:4:1
@@ -25,6 +26,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
index 4349fea6f..2614f2b3c 100644
--- a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
+++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr
@@ -18,6 +18,7 @@ LL | #![warn(unnameable_types)]
= note: the `unnameable_types` lint is unstable
= note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
= help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `unnameable_types`
--> $DIR/feature-gate-type_privacy_lints.rs:3:1
@@ -28,6 +29,7 @@ LL | #![warn(unnameable_types)]
= note: the `unnameable_types` lint is unstable
= note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information
= help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-bench.stderr b/tests/ui/feature-gates/issue-43106-gating-of-bench.stderr
index 6b3322119..8270d46d4 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-bench.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-bench.stderr
@@ -11,10 +11,14 @@ error: `bench` attribute cannot be used at crate level
|
LL | #![bench = "4100"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[bench = "4100"]
+LL - #![bench = "4100"]
+LL + #[bench = "4100"]
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
index 1fe133ac2..0f833f793 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
+++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
@@ -32,6 +32,12 @@
//~^ ERROR attribute should be applied to function or closure
mod inline {
//~^ NOTE not a function or closure
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
+ //~| NOTE the inner attribute doesn't annotate this module
mod inner { #![inline] }
//~^ ERROR attribute should be applied to function or closure
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
index 787670404..f01153dcb 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
@@ -7,7 +7,7 @@ LL | #![rustc_main]
= help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
error: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:40:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:5
|
LL | #[inline = "2100"] fn f() { }
| ^^^^^^^^^^^^^^^^^^
@@ -17,31 +17,31 @@ LL | #[inline = "2100"] fn f() { }
= note: `#[deny(ill_formed_attribute_input)]` on by default
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:119:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:125:1
|
LL | #[start]
| ^^^^^^^^
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:122:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:128:17
|
LL | mod inner { #![start] }
| ^^^^^^^^^
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:127:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:133:5
|
LL | #[start] struct S;
| ^^^^^^^^
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:130:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:136:5
|
LL | #[start] type T = S;
| ^^^^^^^^
error: `start` attribute can only be used on functions
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:133:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:139:5
|
LL | #[start] impl S { }
| ^^^^^^^^
@@ -55,14 +55,14 @@ LL |
LL | / mod inline {
LL | |
LL | |
-LL | | mod inner { #![inline] }
+LL | |
... |
LL | |
LL | | }
| |_- not a function or closure
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:59:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:65:1
|
LL | #[no_link]
| ^^^^^^^^^^
@@ -77,7 +77,7 @@ LL | | }
| |_- not an `extern crate` item
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:85:1
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:91:1
|
LL | #[export_name = "2200"]
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -92,7 +92,7 @@ LL | | }
| |_- not a free function, impl method or static
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:137:8
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:143:8
|
LL | #[repr(C)]
| ^
@@ -129,10 +129,14 @@ error: `macro_export` attribute cannot be used at crate level
|
LL | #![macro_export]
| ^^^^^^^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[macro_export]
+LL - #![macro_export]
+LL + #[macro_export]
|
error: `rustc_main` attribute cannot be used at crate level
@@ -140,21 +144,29 @@ error: `rustc_main` attribute cannot be used at crate level
|
LL | #![rustc_main]
| ^^^^^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[rustc_main]
- | ~~~~~~~~~~~~~
+LL - #![rustc_main]
+LL + #[rustc_main]
+ |
error: `start` attribute cannot be used at crate level
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:16:1
|
LL | #![start]
| ^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[start]
+LL - #![start]
+LL + #[start]
|
error: `repr` attribute cannot be used at crate level
@@ -162,10 +174,14 @@ error: `repr` attribute cannot be used at crate level
|
LL | #![repr()]
| ^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[repr()]
+LL - #![repr()]
+LL + #[repr()]
|
error: `path` attribute cannot be used at crate level
@@ -173,10 +189,14 @@ error: `path` attribute cannot be used at crate level
|
LL | #![path = "3800"]
| ^^^^^^^^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[path = "3800"]
+LL - #![path = "3800"]
+LL + #[path = "3800"]
|
error: `automatically_derived` attribute cannot be used at crate level
@@ -184,122 +204,126 @@ error: `automatically_derived` attribute cannot be used at crate level
|
LL | #![automatically_derived]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | mod inline {
+ | ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
-LL | #[automatically_derived]
+LL - #![automatically_derived]
+LL + #[automatically_derived]
|
error[E0518]: attribute should be applied to function or closure
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:36:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:42:17
|
LL | mod inner { #![inline] }
| ------------^^^^^^^^^^-- not a function or closure
error[E0518]: attribute should be applied to function or closure
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:52:5
|
LL | #[inline] struct S;
| ^^^^^^^^^ --------- not a function or closure
error[E0518]: attribute should be applied to function or closure
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:50:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:56:5
|
LL | #[inline] type T = S;
| ^^^^^^^^^ ----------- not a function or closure
error[E0518]: attribute should be applied to function or closure
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:54:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:60:5
|
LL | #[inline] impl S { }
| ^^^^^^^^^ ---------- not a function or closure
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:64:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:70:17
|
LL | mod inner { #![no_link] }
| ------------^^^^^^^^^^^-- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:68:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:74:5
|
LL | #[no_link] fn f() { }
| ^^^^^^^^^^ ---------- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:72:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:78:5
|
LL | #[no_link] struct S;
| ^^^^^^^^^^ --------- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:76:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:82:5
|
LL | #[no_link]type T = S;
| ^^^^^^^^^^----------- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:80:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:86:5
|
LL | #[no_link] impl S { }
| ^^^^^^^^^^ ---------- not an `extern crate` item
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:90:17
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:17
|
LL | mod inner { #![export_name="2200"] }
| ------------^^^^^^^^^^^^^^^^^^^^^^-- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:102:5
|
LL | #[export_name = "2200"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^ --------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:100:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:106:5
|
LL | #[export_name = "2200"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:104:5
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:110:5
|
LL | #[export_name = "2200"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:109:9
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:115:9
|
LL | #[export_name = "2200"] fn foo();
| ^^^^^^^^^^^^^^^^^^^^^^^ --------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:113:9
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:119:9
|
LL | #[export_name = "2200"] fn bar() {}
| ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:141:25
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:147:25
|
LL | mod inner { #![repr(C)] }
| --------------------^---- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:145:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:12
|
LL | #[repr(C)] fn f() { }
| ^ ---------- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:157:12
|
LL | #[repr(C)] type T = S;
| ^ ----------- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
- --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:155:12
+ --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:161:12
|
LL | #[repr(C)] impl S { }
| ^ ---------- not a struct, enum, or union
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr b/tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr
index ab1659173..1e47259cb 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-derive-2.stderr
@@ -9,6 +9,8 @@ error: cannot find derive macro `x3300` in this scope
|
LL | #[derive(x3300)]
| ^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `x3300` in this scope
--> $DIR/issue-43106-gating-of-derive-2.rs:9:14
@@ -21,6 +23,8 @@ error: cannot find derive macro `x3300` in this scope
|
LL | #[derive(x3300)]
| ^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `x3300` in this scope
--> $DIR/issue-43106-gating-of-derive-2.rs:4:14
@@ -33,6 +37,8 @@ error: cannot find derive macro `x3300` in this scope
|
LL | #[derive(x3300)]
| ^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-test.stderr b/tests/ui/feature-gates/issue-43106-gating-of-test.stderr
index 300a9966d..922c9861a 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-test.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-test.stderr
@@ -11,10 +11,14 @@ error: `test` attribute cannot be used at crate level
|
LL | #![test = "4200"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | fn main() {}
+ | ---- the inner attribute doesn't annotate this function
|
help: perhaps you meant to use an outer attribute
|
-LL | #[test = "4200"]
+LL - #![test = "4200"]
+LL + #[test = "4200"]
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/fn/fn-trait-formatting.rs b/tests/ui/fn/fn-trait-formatting.rs
index 636ac7107..61a8791ab 100644
--- a/tests/ui/fn/fn-trait-formatting.rs
+++ b/tests/ui/fn/fn-trait-formatting.rs
@@ -17,5 +17,5 @@ fn main() {
//~| found struct `Box<dyn FnMut() -> isize>`
needs_fn(1);
- //~^ ERROR expected a `Fn<(isize,)>` closure, found `{integer}`
+ //~^ ERROR expected a `Fn(isize)` closure, found `{integer}`
}
diff --git a/tests/ui/fn/fn-trait-formatting.stderr b/tests/ui/fn/fn-trait-formatting.stderr
index 45d543bda..c5e2f4169 100644
--- a/tests/ui/fn/fn-trait-formatting.stderr
+++ b/tests/ui/fn/fn-trait-formatting.stderr
@@ -39,11 +39,11 @@ LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut
= note: expected unit type `()`
found struct `Box<dyn FnMut() -> isize>`
-error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
+error[E0277]: expected a `Fn(isize)` closure, found `{integer}`
--> $DIR/fn-trait-formatting.rs:19:14
|
LL | needs_fn(1);
- | -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
+ | -------- ^ expected an `Fn(isize)` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
index 458756a3d..3f6401b9f 100644
--- a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
+++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr
@@ -2,14 +2,16 @@ error[E0309]: the parameter type `T` may not live long enough
--> $DIR/implied-bounds-unnorm-associated-type-5.rs:6:13
|
LL | impl<'a, T> Trait<'a> for T {
- | ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | -- ^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | |
+ | the parameter type `T` must be valid for the lifetime `'a` as defined here...
|
note: ...that is required by this bound
--> $DIR/implied-bounds-unnorm-associated-type-5.rs:1:18
|
LL | trait Trait<'a>: 'a {
| ^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a> for T {
| ++++
diff --git a/tests/ui/for/issue-20605.next.stderr b/tests/ui/for/issue-20605.next.stderr
index 0955efdbb..28dbdf4c3 100644
--- a/tests/ui/for/issue-20605.next.stderr
+++ b/tests/ui/for/issue-20605.next.stderr
@@ -44,12 +44,6 @@ LL | for item in *things { *item = 0 }
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
-error: the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
- --> $DIR/issue-20605.rs:5:17
- |
-LL | for item in *things { *item = 0 }
- | ^^^^^^^
-
error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time
--> $DIR/issue-20605.rs:5:5
|
@@ -60,6 +54,12 @@ LL | for item in *things { *item = 0 }
note: required by a bound in `None`
--> $SRC_DIR/core/src/option.rs:LL:COL
+error: the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed
+ --> $DIR/issue-20605.rs:5:17
+ |
+LL | for item in *things { *item = 0 }
+ | ^^^^^^^
+
error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced
--> $DIR/issue-20605.rs:5:27
|
diff --git a/tests/ui/generator/async-generator-issue-67158.rs b/tests/ui/generator/async-generator-issue-67158.rs
deleted file mode 100644
index 8125a7a9b..000000000
--- a/tests/ui/generator/async-generator-issue-67158.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-#![feature(generators)]
-// edition:2018
-// Regression test for #67158.
-fn main() {
- async { yield print!(":C") }; //~ ERROR `async` generators are not yet supported
-}
diff --git a/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs b/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs
deleted file mode 100644
index 207c2735f..000000000
--- a/tests/ui/generator/auxiliary/metadata-sufficient-for-layout.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// compile-flags: --emit metadata
-#![feature(generators, generator_trait)]
-
-use std::marker::Unpin;
-use std::ops::Generator;
-
-pub fn g() -> impl Generator<(), Yield = (), Return = ()> {
- || {
- yield;
- }
-}
diff --git a/tests/ui/generator/auxiliary/xcrate-reachable.rs b/tests/ui/generator/auxiliary/xcrate-reachable.rs
deleted file mode 100644
index 2dd5ea675..000000000
--- a/tests/ui/generator/auxiliary/xcrate-reachable.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-
-fn msg() -> u32 {
- 0
-}
-
-pub fn foo() -> impl Generator<(), Yield=(), Return=u32> {
- || {
- yield;
- return msg();
- }
-}
diff --git a/tests/ui/generator/auxiliary/xcrate.rs b/tests/ui/generator/auxiliary/xcrate.rs
deleted file mode 100644
index d07abd091..000000000
--- a/tests/ui/generator/auxiliary/xcrate.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#![feature(generators, generator_trait)]
-
-use std::marker::Unpin;
-use std::ops::Generator;
-
-pub fn foo() -> impl Generator<(), Yield = (), Return = ()> {
- || {
- if false {
- yield;
- }
- }
-}
-
-pub fn bar<T: 'static>(t: T) -> Box<Generator<(), Yield = T, Return = ()> + Unpin> {
- Box::new(|| {
- yield t;
- })
-}
diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.rs b/tests/ui/generator/generator-yielding-or-returning-itself.rs
deleted file mode 100644
index 30788e3c1..000000000
--- a/tests/ui/generator/generator-yielding-or-returning-itself.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-#![feature(generator_trait)]
-#![feature(generators)]
-
-// Test that we cannot create a generator that returns a value of its
-// own type.
-
-use std::ops::Generator;
-
-pub fn want_cyclic_generator_return<T>(_: T)
- where T: Generator<Yield = (), Return = T>
-{
-}
-
-fn supply_cyclic_generator_return() {
- want_cyclic_generator_return(|| {
- //~^ ERROR type mismatch
- if false { yield None.unwrap(); }
- None.unwrap()
- })
-}
-
-pub fn want_cyclic_generator_yield<T>(_: T)
- where T: Generator<Yield = T, Return = ()>
-{
-}
-
-fn supply_cyclic_generator_yield() {
- want_cyclic_generator_yield(|| {
- //~^ ERROR type mismatch
- if false { yield None.unwrap(); }
- None.unwrap()
- })
-}
-
-fn main() { }
diff --git a/tests/ui/generator/issue-52304.rs b/tests/ui/generator/issue-52304.rs
deleted file mode 100644
index 3e9de765b..000000000
--- a/tests/ui/generator/issue-52304.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// check-pass
-
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-
-pub fn example() -> impl Generator {
- || yield &1
-}
-
-fn main() {}
diff --git a/tests/ui/generator/issue-64620-yield-array-element.rs b/tests/ui/generator/issue-64620-yield-array-element.rs
deleted file mode 100644
index 2cbe8f516..000000000
--- a/tests/ui/generator/issue-64620-yield-array-element.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Regression test for #64620
-
-#![feature(generators)]
-
-pub fn crash(arr: [usize; 1]) {
- yield arr[0]; //~ ERROR: yield expression outside of generator literal
-}
-
-fn main() {}
diff --git a/tests/ui/generator/issue-87142.rs b/tests/ui/generator/issue-87142.rs
deleted file mode 100644
index 7f670919e..000000000
--- a/tests/ui/generator/issue-87142.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// compile-flags: -Cdebuginfo=2
-// build-pass
-
-// Regression test for #87142
-// This test needs the above flags and the "lib" crate type.
-
-#![feature(impl_trait_in_assoc_type, generator_trait, generators)]
-#![crate_type = "lib"]
-
-use std::ops::Generator;
-
-pub trait GeneratorProviderAlt: Sized {
- type Gen: Generator<(), Return = (), Yield = ()>;
-
- fn start(ctx: Context<Self>) -> Self::Gen;
-}
-
-pub struct Context<G: 'static + GeneratorProviderAlt> {
- pub link: Box<G::Gen>,
-}
-
-impl GeneratorProviderAlt for () {
- type Gen = impl Generator<(), Return = (), Yield = ()>;
- fn start(ctx: Context<Self>) -> Self::Gen {
- move || {
- match ctx {
- _ => (),
- }
- yield ();
- }
- }
-}
diff --git a/tests/ui/generator/nested_generators.rs b/tests/ui/generator/nested_generators.rs
deleted file mode 100644
index 45519150e..000000000
--- a/tests/ui/generator/nested_generators.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// run-pass
-
-#![feature(generators, generator_trait)]
-
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
-
-fn main() {
- let _generator = || {
- let mut sub_generator = || {
- yield 2;
- };
-
- match Pin::new(&mut sub_generator).resume(()) {
- GeneratorState::Yielded(x) => {
- yield x;
- }
- _ => panic!(),
- };
- };
-}
diff --git a/tests/ui/generator/pin-box-generator.rs b/tests/ui/generator/pin-box-generator.rs
deleted file mode 100644
index c3136f5c0..000000000
--- a/tests/ui/generator/pin-box-generator.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-
-fn assert_generator<G: Generator>(_: G) {
-}
-
-fn main() {
- assert_generator(static || yield);
- assert_generator(Box::pin(static || yield));
-}
diff --git a/tests/ui/generator/sized-yield.rs b/tests/ui/generator/sized-yield.rs
deleted file mode 100644
index c6dd738d6..000000000
--- a/tests/ui/generator/sized-yield.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![feature(generators, generator_trait)]
-
-use std::ops::Generator;
-use std::pin::Pin;
-
-fn main() {
- let s = String::from("foo");
- let mut gen = move || {
- //~^ ERROR the size for values of type
- yield s[..];
- };
- Pin::new(&mut gen).resume(());
- //~^ ERROR the size for values of type
-}
diff --git a/tests/ui/generator/sized-yield.stderr b/tests/ui/generator/sized-yield.stderr
deleted file mode 100644
index fb34540d9..000000000
--- a/tests/ui/generator/sized-yield.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/sized-yield.rs:8:26
- |
-LL | let mut gen = move || {
- | __________________________^
-LL | |
-LL | | yield s[..];
-LL | | };
- | |____^ doesn't have a size known at compile-time
- |
- = help: the trait `Sized` is not implemented for `str`
- = note: the yield type of a generator must have a statically known size
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/sized-yield.rs:12:23
- |
-LL | Pin::new(&mut gen).resume(());
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `Sized` is not implemented for `str`
-note: required by a bound in `GeneratorState`
- --> $SRC_DIR/core/src/ops/generator.rs:LL:COL
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generator/static-generators.rs b/tests/ui/generator/static-generators.rs
deleted file mode 100644
index d098bf1e6..000000000
--- a/tests/ui/generator/static-generators.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// run-pass
-
-#![feature(generators, generator_trait)]
-
-use std::pin::Pin;
-use std::ops::{Generator, GeneratorState};
-
-fn main() {
- let mut generator = static || {
- let a = true;
- let b = &a;
- yield;
- assert_eq!(b as *const _, &a as *const _);
- };
- // SAFETY: We shadow the original generator variable so have no safe API to
- // move it after this point.
- let mut generator = unsafe { Pin::new_unchecked(&mut generator) };
- assert_eq!(generator.as_mut().resume(()), GeneratorState::Yielded(()));
- assert_eq!(generator.as_mut().resume(()), GeneratorState::Complete(()));
-}
diff --git a/tests/ui/generator/too-many-parameters.rs b/tests/ui/generator/too-many-parameters.rs
deleted file mode 100644
index 7a353ea29..000000000
--- a/tests/ui/generator/too-many-parameters.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#![feature(generators)]
-
-fn main() {
- |(), ()| {
- //~^ error: too many parameters for a generator
- yield;
- };
-}
diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs
new file mode 100644
index 000000000..e2d51c664
--- /dev/null
+++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.rs
@@ -0,0 +1,18 @@
+// known-bug: #117606
+
+#![feature(associated_type_defaults)]
+
+trait Foo {
+ type Bar<T>: Baz<Self> = i32;
+ // We should be able to prove that `i32: Baz<Self>` because of
+ // the impl below, which requires that `Self::Bar<()>: Eq<i32>`
+ // which is true, because we assume `for<T> Self::Bar<T> = i32`.
+}
+
+trait Baz<T: ?Sized> {}
+impl<T: Foo + ?Sized> Baz<T> for i32 where T::Bar<()>: Eq<i32> {}
+
+trait Eq<T> {}
+impl<T> Eq<T> for T {}
+
+fn main() {}
diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr
new file mode 100644
index 000000000..abad0f25c
--- /dev/null
+++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.stderr
@@ -0,0 +1,24 @@
+error[E0277]: the trait bound `<Self as Foo>::Bar<()>: Eq<i32>` is not satisfied
+ --> $DIR/assume-gat-normalization-for-nested-goals.rs:6:30
+ |
+LL | type Bar<T>: Baz<Self> = i32;
+ | ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>`
+ |
+note: required for `i32` to implement `Baz<Self>`
+ --> $DIR/assume-gat-normalization-for-nested-goals.rs:13:23
+ |
+LL | impl<T: Foo + ?Sized> Baz<T> for i32 where T::Bar<()>: Eq<i32> {}
+ | ^^^^^^ ^^^ ------- unsatisfied trait bound introduced here
+note: required by a bound in `Foo::Bar`
+ --> $DIR/assume-gat-normalization-for-nested-goals.rs:6:18
+ |
+LL | type Bar<T>: Baz<Self> = i32;
+ | ^^^^^^^^^ required by this bound in `Foo::Bar`
+help: consider further restricting the associated type
+ |
+LL | trait Foo where <Self as Foo>::Bar<()>: Eq<i32> {
+ | +++++++++++++++++++++++++++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.rs b/tests/ui/generic-associated-types/bugs/issue-100013.rs
index 973c548d7..b13b730d5 100644
--- a/tests/ui/generic-associated-types/bugs/issue-100013.rs
+++ b/tests/ui/generic-associated-types/bugs/issue-100013.rs
@@ -3,7 +3,7 @@
// edition: 2021
// We really should accept this, but we need implied bounds between the regions
-// in a generator interior.
+// in a coroutine interior.
pub trait FutureIterator {
type Future<'s, 'cx>: Send
@@ -12,21 +12,21 @@ pub trait FutureIterator {
}
fn call<I: FutureIterator>() -> impl Send {
- async { // a generator checked for autotrait impl `Send`
+ async { // a coroutine checked for autotrait impl `Send`
let x = None::<I::Future<'_, '_>>; // a type referencing GAT
async {}.await; // a yield point
}
}
fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
- async { // a generator checked for autotrait impl `Send`
+ async { // a coroutine checked for autotrait impl `Send`
let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
async {}.await; // a yield point
}
}
fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
- async { // a generator checked for autotrait impl `Send`
+ async { // a coroutine checked for autotrait impl `Send`
let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
async {}.await; // a yield point
}
diff --git a/tests/ui/generic-associated-types/bugs/issue-100013.stderr b/tests/ui/generic-associated-types/bugs/issue-100013.stderr
index 93c69422f..ff82aebfe 100644
--- a/tests/ui/generic-associated-types/bugs/issue-100013.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-100013.stderr
@@ -1,7 +1,7 @@
error: lifetime bound not satisfied
--> $DIR/issue-100013.rs:15:5
|
-LL | / async { // a generator checked for autotrait impl `Send`
+LL | / async { // a coroutine checked for autotrait impl `Send`
LL | | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
LL | | async {}.await; // a yield point
LL | | }
@@ -12,7 +12,7 @@ LL | | }
error: lifetime bound not satisfied
--> $DIR/issue-100013.rs:22:5
|
-LL | / async { // a generator checked for autotrait impl `Send`
+LL | / async { // a coroutine checked for autotrait impl `Send`
LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
LL | | async {}.await; // a yield point
LL | | }
@@ -27,7 +27,7 @@ LL | fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
-LL | async { // a generator checked for autotrait impl `Send`
+LL | async { // a coroutine checked for autotrait impl `Send`
LL | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
| ^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'b`
|
@@ -36,7 +36,7 @@ LL | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
error: lifetime bound not satisfied
--> $DIR/issue-100013.rs:29:5
|
-LL | / async { // a generator checked for autotrait impl `Send`
+LL | / async { // a coroutine checked for autotrait impl `Send`
LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
LL | | async {}.await; // a yield point
LL | | }
diff --git a/tests/ui/generic-associated-types/bugs/issue-91762.stderr b/tests/ui/generic-associated-types/bugs/issue-91762.stderr
index 1272c8b8a..1045e80f0 100644
--- a/tests/ui/generic-associated-types/bugs/issue-91762.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-91762.stderr
@@ -1,9 +1,10 @@
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed
--> $DIR/issue-91762.rs:24:15
|
LL | ret = <Self::Base as Functor>::fmap(arg);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the associated function `fmap`
|
+ = note: cannot satisfy `<<Self as FunctorExt<T>>::Base as Functor>::With<_> == Self`
help: consider specifying the generic arguments
|
LL | ret = <Self::Base as Functor>::fmap::<T, U>(arg);
@@ -11,4 +12,4 @@ LL | ret = <Self::Base as Functor>::fmap::<T, U>(arg);
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr b/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr
index fd54faaf3..9013d4295 100644
--- a/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr
+++ b/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr
@@ -12,6 +12,9 @@ LL | trait Foo {
LL | type A<'a> where Self: 'a;
| ^ ...because it contains the generic associated type `A`
= help: consider moving `A` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Foo` for this new enum and using it instead:
+ Fooy
+ Fooer<T>
error: aborting due to previous error
diff --git a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr
index 499221637..7f535ec43 100644
--- a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr
+++ b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr
@@ -25,6 +25,7 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
|
LL | type Y<'a>;
| ^ --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
diff --git a/tests/ui/generic-associated-types/higher-ranked-self-impl-requirement.rs b/tests/ui/generic-associated-types/higher-ranked-self-impl-requirement.rs
new file mode 100644
index 000000000..5ef9437c9
--- /dev/null
+++ b/tests/ui/generic-associated-types/higher-ranked-self-impl-requirement.rs
@@ -0,0 +1,20 @@
+// check-pass
+
+trait Database: for<'r> HasValueRef<'r, Database = Self> {}
+
+trait HasValueRef<'r> {
+ type Database: Database;
+}
+
+struct Any;
+
+impl Database for Any {}
+
+impl<'r> HasValueRef<'r> for Any {
+ // Make sure we don't have issues when the GAT assumption
+ // `<Any as HasValue<'r>>::Database = Any` isn't universally
+ // parameterized over `'r`.
+ type Database = Any;
+}
+
+fn main() {}
diff --git a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs
index f5502adee..c444ee9e1 100644
--- a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs
+++ b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs
@@ -10,7 +10,7 @@ trait Fun {
impl<T> Fun for T {
type F<'a> = Self;
- //~^ ERROR expected a `Fn<()>` closure, found `T`
+ //~^ ERROR expected a `Fn()` closure, found `T`
}
fn main() {
diff --git a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr
index 07452137b..2376bda81 100644
--- a/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr
+++ b/tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `T`
+error[E0277]: expected a `Fn()` closure, found `T`
--> $DIR/issue-68642-broken-llvm-ir.rs:12:18
|
LL | type F<'a> = Self;
- | ^^^^ expected an `Fn<()>` closure, found `T`
+ | ^^^^ expected an `Fn()` closure, found `T`
|
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `Fun::F`
diff --git a/tests/ui/generic-associated-types/issue-68643-broken-mir.rs b/tests/ui/generic-associated-types/issue-68643-broken-mir.rs
index 6050a8bf5..39db51c0e 100644
--- a/tests/ui/generic-associated-types/issue-68643-broken-mir.rs
+++ b/tests/ui/generic-associated-types/issue-68643-broken-mir.rs
@@ -10,7 +10,7 @@ trait Fun {
impl<T> Fun for T {
type F<'a> = Self;
- //~^ ERROR expected a `Fn<()>` closure, found `T`
+ //~^ ERROR expected a `Fn()` closure, found `T`
}
pub fn main() {
diff --git a/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr b/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr
index 31ded5dab..2429531e4 100644
--- a/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr
+++ b/tests/ui/generic-associated-types/issue-68643-broken-mir.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `T`
+error[E0277]: expected a `Fn()` closure, found `T`
--> $DIR/issue-68643-broken-mir.rs:12:18
|
LL | type F<'a> = Self;
- | ^^^^ expected an `Fn<()>` closure, found `T`
+ | ^^^^ expected an `Fn()` closure, found `T`
|
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `Fun::F`
diff --git a/tests/ui/generic-associated-types/issue-68644-codegen-selection.rs b/tests/ui/generic-associated-types/issue-68644-codegen-selection.rs
index 898cfa1e7..e379bce07 100644
--- a/tests/ui/generic-associated-types/issue-68644-codegen-selection.rs
+++ b/tests/ui/generic-associated-types/issue-68644-codegen-selection.rs
@@ -10,7 +10,7 @@ trait Fun {
impl<T> Fun for T {
type F<'a> = Self;
- //~^ ERROR expected a `Fn<()>` closure, found `T`
+ //~^ ERROR expected a `Fn()` closure, found `T`
}
fn main() {
diff --git a/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr b/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr
index e2f9930cc..11221353a 100644
--- a/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr
+++ b/tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `T`
+error[E0277]: expected a `Fn()` closure, found `T`
--> $DIR/issue-68644-codegen-selection.rs:12:18
|
LL | type F<'a> = Self;
- | ^^^^ expected an `Fn<()>` closure, found `T`
+ | ^^^^ expected an `Fn()` closure, found `T`
|
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `Fun::F`
diff --git a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs
index 60b065bfc..e69a08b0a 100644
--- a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs
+++ b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs
@@ -10,7 +10,7 @@ trait Fun {
impl<T> Fun for T {
type F<'a> = Self;
- //~^ ERROR expected a `Fn<()>` closure, found `T`
+ //~^ ERROR expected a `Fn()` closure, found `T`
}
fn main() {
diff --git a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr
index 0065368ad..52300efc2 100644
--- a/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr
+++ b/tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `T`
+error[E0277]: expected a `Fn()` closure, found `T`
--> $DIR/issue-68645-codegen-fulfillment.rs:12:18
|
LL | type F<'a> = Self;
- | ^^^^ expected an `Fn<()>` closure, found `T`
+ | ^^^^ expected an `Fn()` closure, found `T`
|
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `Fun::F`
diff --git a/tests/ui/generic-associated-types/issue-68648-2.stderr b/tests/ui/generic-associated-types/issue-68648-2.stderr
index b2bef19eb..0514e7bd6 100644
--- a/tests/ui/generic-associated-types/issue-68648-2.stderr
+++ b/tests/ui/generic-associated-types/issue-68648-2.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-68648-2.rs:12:17
|
LL | fn bug<'a, T: Fun<F<'a> = T>>(t: T) -> T::F<'a> {
- | - this type parameter
+ | - expected this type parameter
LL | T::identity(())
| ----------- ^^ expected type parameter `T`, found `()`
| |
diff --git a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr
index f0212e985..20c07db4c 100644
--- a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr
+++ b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr
@@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
--> $DIR/issue-68656-unsized-values.rs:13:21
|
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<T> for T {
- | - this type parameter
+ | - expected this type parameter
LL | type Item<'a> = T;
| ^ expected type parameter `T`, found associated type
|
diff --git a/tests/ui/generic-associated-types/issue-76535.base.stderr b/tests/ui/generic-associated-types/issue-76535.base.stderr
index 370329b9f..bb14e2971 100644
--- a/tests/ui/generic-associated-types/issue-76535.base.stderr
+++ b/tests/ui/generic-associated-types/issue-76535.base.stderr
@@ -28,6 +28,8 @@ LL | pub trait SuperTrait {
LL | type SubType<'a>: SubTrait where Self: 'a;
| ^^^^^^^ ...because it contains the generic associated type `SubType`
= help: consider moving `SubType` to another trait
+ = help: only type `SuperStruct` is seen to implement the trait in this crate, consider using it directly instead
+ = note: `SuperTrait` can be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type
error[E0038]: the trait `SuperTrait` cannot be made into an object
--> $DIR/issue-76535.rs:39:57
@@ -43,6 +45,8 @@ LL | pub trait SuperTrait {
LL | type SubType<'a>: SubTrait where Self: 'a;
| ^^^^^^^ ...because it contains the generic associated type `SubType`
= help: consider moving `SubType` to another trait
+ = help: only type `SuperStruct` is seen to implement the trait in this crate, consider using it directly instead
+ = note: `SuperTrait` can be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type
= note: required for the cast from `Box<SuperStruct>` to `Box<dyn SuperTrait<SubType = SubStruct<'_>>>`
error: aborting due to 3 previous errors
diff --git a/tests/ui/generic-associated-types/issue-79422.base.stderr b/tests/ui/generic-associated-types/issue-79422.base.stderr
index ad704f5e9..bcc6382cf 100644
--- a/tests/ui/generic-associated-types/issue-79422.base.stderr
+++ b/tests/ui/generic-associated-types/issue-79422.base.stderr
@@ -28,6 +28,9 @@ LL | trait MapLike<K, V> {
LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
= help: consider moving `VRefCont` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `MapLike` for this new enum and using it instead:
+ std::collections::BTreeMap<K, V>
+ Source
error[E0038]: the trait `MapLike` cannot be made into an object
--> $DIR/issue-79422.rs:44:13
@@ -43,6 +46,9 @@ LL | trait MapLike<K, V> {
LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
= help: consider moving `VRefCont` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `MapLike` for this new enum and using it instead:
+ std::collections::BTreeMap<K, V>
+ Source
= note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>`
error: aborting due to 3 previous errors
diff --git a/tests/ui/generic-associated-types/issue-84931.rs b/tests/ui/generic-associated-types/issue-84931.rs
index 4123ce9d4..2ef990a7a 100644
--- a/tests/ui/generic-associated-types/issue-84931.rs
+++ b/tests/ui/generic-associated-types/issue-84931.rs
@@ -12,7 +12,8 @@ struct StreamingSliceIter<'a, T> {
impl<'b, T: 'b> StreamingIter for StreamingSliceIter<'b, T> {
type Item<'a> = &'a mut T;
- //~^ the parameter type
+ //~^ ERROR: the parameter type
+ //~| ERROR: does not fulfill the required lifetime
fn next(&mut self) -> Option<&mut T> {
loop {}
}
diff --git a/tests/ui/generic-associated-types/issue-84931.stderr b/tests/ui/generic-associated-types/issue-84931.stderr
index fffea98a4..04e14b9c7 100644
--- a/tests/ui/generic-associated-types/issue-84931.stderr
+++ b/tests/ui/generic-associated-types/issue-84931.stderr
@@ -2,10 +2,35 @@ error[E0309]: the parameter type `T` may not live long enough
--> $DIR/issue-84931.rs:14:21
|
LL | type Item<'a> = &'a mut T;
- | ^^^^^^^^^- help: consider adding a where clause: `where T: 'a`
- | |
- | ...so that the reference type `&'a mut T` does not outlive the data it points at
+ | -- ^^^^^^^^^ ...so that the reference type `&'a mut T` does not outlive the data it points at
+ | |
+ | the parameter type `T` must be valid for the lifetime `'a` as defined here...
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | type Item<'a> = &'a mut T where T: 'a;
+ | +++++++++++
+
+error[E0477]: the type `StreamingSliceIter<'b, T>` does not fulfill the required lifetime
+ --> $DIR/issue-84931.rs:14:21
+ |
+LL | type Item<'a> where Self: 'a;
+ | ------------- definition of `Item` from trait
+...
+LL | type Item<'a> = &'a mut T;
+ | ^^^^^^^^^
+ |
+note: type must outlive the lifetime `'a` as defined here
+ --> $DIR/issue-84931.rs:14:15
+ |
+LL | type Item<'a> = &'a mut T;
+ | ^^
+help: copy the `where` clause predicates from the trait
+ |
+LL | type Item<'a> = &'a mut T where Self: 'a;
+ | ++++++++++++++
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0309`.
+Some errors have detailed explanations: E0309, E0477.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/tests/ui/generic-associated-types/issue-86787.rs b/tests/ui/generic-associated-types/issue-86787.rs
index 96075ca50..5edd0a9f0 100644
--- a/tests/ui/generic-associated-types/issue-86787.rs
+++ b/tests/ui/generic-associated-types/issue-86787.rs
@@ -22,8 +22,8 @@ where
type T = Either<Left::T, Right::T>;
type TRef<'a> = Either<&'a Left::T, &'a Right::T>
where
- <Left as HasChildrenOf>::T: 'a,
- <Right as HasChildrenOf>::T: 'a;
+ <Left as HasChildrenOf>::T: 'a, //~ ERROR impl has stricter requirements than trait
+ <Right as HasChildrenOf>::T: 'a; //~ ERROR impl has stricter requirements than trait
fn ref_children<'a>(&'a self) -> Vec<Self::TRef<'a>> {
todo!()
diff --git a/tests/ui/generic-associated-types/issue-86787.stderr b/tests/ui/generic-associated-types/issue-86787.stderr
index f34c63cf7..00795abbd 100644
--- a/tests/ui/generic-associated-types/issue-86787.stderr
+++ b/tests/ui/generic-associated-types/issue-86787.stderr
@@ -9,5 +9,24 @@ LL | type TRef<'a>;
= note: this bound is currently required to ensure that impls have maximum flexibility
= note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
-error: aborting due to previous error
+error[E0276]: impl has stricter requirements than trait
+ --> $DIR/issue-86787.rs:25:37
+ |
+LL | type TRef<'a>;
+ | ------------- definition of `TRef` from trait
+...
+LL | <Left as HasChildrenOf>::T: 'a,
+ | ^^ impl has extra requirement `<Left as HasChildrenOf>::T: 'a`
+
+error[E0276]: impl has stricter requirements than trait
+ --> $DIR/issue-86787.rs:26:38
+ |
+LL | type TRef<'a>;
+ | ------------- definition of `TRef` from trait
+...
+LL | <Right as HasChildrenOf>::T: 'a;
+ | ^^ impl has extra requirement `<Right as HasChildrenOf>::T: 'a`
+
+error: aborting due to 3 previous errors
+For more information about this error, try `rustc --explain E0276`.
diff --git a/tests/ui/generic-associated-types/issue-88360.stderr b/tests/ui/generic-associated-types/issue-88360.stderr
index 520aeff18..ad40ee180 100644
--- a/tests/ui/generic-associated-types/issue-88360.stderr
+++ b/tests/ui/generic-associated-types/issue-88360.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-88360.rs:15:9
|
LL | trait SuperTrait<T>
- | - this type parameter
+ | - found this type parameter
...
LL | fn copy(&self) -> Self::Gat<'_> where T: Copy {
| ------------- expected `&T` because of return type
diff --git a/tests/ui/generic-associated-types/issue-91139.stderr b/tests/ui/generic-associated-types/issue-91139.stderr
index d9d76adfb..89a4ba77e 100644
--- a/tests/ui/generic-associated-types/issue-91139.stderr
+++ b/tests/ui/generic-associated-types/issue-91139.stderr
@@ -9,6 +9,8 @@ error: `T` does not live long enough
|
LL | let _: for<'a> fn(<() as Foo<T>>::Type<'a>, &'a T) = |_, _| ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr
index 535edec57..1d7d80d1b 100644
--- a/tests/ui/generic-associated-types/missing-bounds.stderr
+++ b/tests/ui/generic-associated-types/missing-bounds.stderr
@@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/missing-bounds.rs:11:11
|
LL | impl<B> Add for A<B> where B: Add {
- | - this type parameter
+ | - expected this type parameter
...
LL | A(self.0 + rhs.0)
| - ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
@@ -44,7 +44,7 @@ error[E0308]: mismatched types
--> $DIR/missing-bounds.rs:21:14
|
LL | impl<B: Add> Add for C<B> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self(self.0 + rhs.0)
| ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
@@ -80,7 +80,7 @@ error[E0308]: mismatched types
--> $DIR/missing-bounds.rs:42:14
|
LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self(self.0 + rhs.0)
| ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
diff --git a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs
index 060ee8821..a3f3b1a6d 100644
--- a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs
+++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs
@@ -7,6 +7,7 @@ pub trait X {
impl X for () {
type Y<'a> = &'a ();
+ //~^ ERROR lifetime bound not satisfied
}
struct B<'a, T: for<'r> X<Y<'r> = &'r ()>> {
diff --git a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr
index a69cd0028..f73ed5956 100644
--- a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr
+++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr
@@ -12,44 +12,64 @@ LL | #![warn(unused_lifetimes)]
| ^^^^^^^^^^^^^^^^
error[E0478]: lifetime bound not satisfied
- --> $DIR/unsatisfied-item-lifetime-bound.rs:13:8
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:14:8
|
LL | f: <T as X>::Y<'a>,
| ^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'a` as defined here
- --> $DIR/unsatisfied-item-lifetime-bound.rs:12:10
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:13:10
|
LL | struct B<'a, T: for<'r> X<Y<'r> = &'r ()>> {
| ^^
= note: but lifetime parameter must outlive the static lifetime
error[E0478]: lifetime bound not satisfied
- --> $DIR/unsatisfied-item-lifetime-bound.rs:18:8
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:19:8
|
LL | f: <T as X>::Y<'a>,
| ^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'a` as defined here
- --> $DIR/unsatisfied-item-lifetime-bound.rs:17:10
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:18:10
|
LL | struct C<'a, T: X> {
| ^^
= note: but lifetime parameter must outlive the static lifetime
error[E0478]: lifetime bound not satisfied
- --> $DIR/unsatisfied-item-lifetime-bound.rs:23:8
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:24:8
|
LL | f: <() as X>::Y<'a>,
| ^^^^^^^^^^^^^^^^
|
note: lifetime parameter instantiated with the lifetime `'a` as defined here
- --> $DIR/unsatisfied-item-lifetime-bound.rs:22:10
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:23:10
|
LL | struct D<'a> {
| ^^
= note: but lifetime parameter must outlive the static lifetime
-error: aborting due to 3 previous errors; 1 warning emitted
+error[E0478]: lifetime bound not satisfied
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:9:18
+ |
+LL | type Y<'a: 'static>;
+ | ------------------- definition of `Y` from trait
+...
+LL | type Y<'a> = &'a ();
+ | ^^^^^^
+ |
+note: lifetime parameter instantiated with the lifetime `'a` as defined here
+ --> $DIR/unsatisfied-item-lifetime-bound.rs:9:12
+ |
+LL | type Y<'a> = &'a ();
+ | ^^
+ = note: but lifetime parameter must outlive the static lifetime
+help: copy the `where` clause predicates from the trait
+ |
+LL | type Y<'a> = &'a () where 'a: 'static;
+ | +++++++++++++++++
+
+error: aborting due to 4 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0478`.
diff --git a/tests/ui/generic-const-items/inference-failure.stderr b/tests/ui/generic-const-items/inference-failure.stderr
index 22ff1b9ba..10ecd83ec 100644
--- a/tests/ui/generic-const-items/inference-failure.stderr
+++ b/tests/ui/generic-const-items/inference-failure.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Option<T>`
--> $DIR/inference-failure.rs:8:9
|
LL | let _ = NONE;
- | ^
+ | ^ ---- type must be known at this point
|
help: consider giving this pattern a type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
index 2cee53431..14894cef7 100644
--- a/tests/ui/generic-const-items/unsatisfied-bounds.stderr
+++ b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
@@ -17,6 +17,7 @@ LL | let () = K::<()>;
| ^^ the trait `From<()>` is not implemented for `Infallible`
|
= help: the trait `From<!>` is implemented for `Infallible`
+ = help: for that trait implementation, expected `!`, found `()`
note: required by a bound in `K`
--> $DIR/unsatisfied-bounds.rs:12:17
|
@@ -48,6 +49,7 @@ LL | let _ = <() as Trait<&'static str>>::B::<()>;
| ^^ the trait `From<()>` is not implemented for `Infallible`
|
= help: the trait `From<!>` is implemented for `Infallible`
+ = help: for that trait implementation, expected `!`, found `()`
note: required by a bound in `Trait::B`
--> $DIR/unsatisfied-bounds.rs:21:21
|
diff --git a/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr b/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
index a73c03feb..48703186c 100644
--- a/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
+++ b/tests/ui/higher-ranked/subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
@@ -24,6 +24,7 @@ LL | | for<'a> fn(Inv<'a>, Inv<'a>)) }
|
= note: expected enum `Option<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>`
found enum `Option<for<'a> fn(Inv<'a>, Inv<'a>)>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
diff --git a/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr b/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr
index 9af6bc45c..8ab88c580 100644
--- a/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(&'w (),)>` closure, found `fn(&'w ())`
+error[E0277]: expected a `Fn(&'w ())` closure, found `fn(&'w ())`
--> $DIR/fn-ptr.rs:12:5
|
LL | ice();
- | ^^^ expected an `Fn<(&'w (),)>` closure, found `fn(&'w ())`
+ | ^^^ expected an `Fn(&'w ())` closure, found `fn(&'w ())`
|
= help: the trait `for<'w> Fn<(&'w (),)>` is not implemented for `fn(&'w ())`
note: required by a bound in `ice`
diff --git a/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs b/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs
index 853160f96..adb19c035 100644
--- a/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs
+++ b/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs
@@ -10,5 +10,5 @@ where
fn main() {
ice();
- //[classic]~^ ERROR expected a `Fn<(&'w (),)>` closure, found `fn(&'w ())`
+ //[classic]~^ ERROR expected a `Fn(&'w ())` closure, found `fn(&'w ())`
}
diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr
index 46f5308dd..69c58c591 100644
--- a/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/hrtb-conflate-regions.stderr
@@ -15,6 +15,7 @@ LL | fn b() { want_foo2::<SomeStruct>(); }
|
= note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
= note: ...but it actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr
index 2cc2bb2bb..7b0743cc7 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F`
+error[E0277]: expected a `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
--> $DIR/issue-62529-3.rs:25:14
|
LL | call(f, ());
- | ---- ^ expected an `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F`
+ | ---- ^ expected an `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr
index 5ed0d9fcf..e0dc13c0c 100644
--- a/tests/ui/hygiene/panic-location.run.stderr
+++ b/tests/ui/hygiene/panic-location.run.stderr
@@ -1,3 +1,3 @@
-thread 'main' panicked at library/alloc/src/raw_vec.rs:534:5:
+thread 'main' panicked at library/alloc/src/raw_vec.rs:545:5:
capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs
new file mode 100644
index 000000000..6863a3c73
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.rs
@@ -0,0 +1,25 @@
+// This test should never pass!
+
+#![feature(type_alias_impl_trait)]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+struct MyTy<'a, 'b>(Option<*mut &'a &'b ()>);
+unsafe impl Send for MyTy<'_, 'static> {}
+
+fn step1<'a, 'b: 'a>() -> impl Sized + Captures<'b> + 'a {
+ MyTy::<'a, 'b>(None)
+}
+
+fn step2<'a, 'b: 'a>() -> impl Sized + 'a {
+ step1::<'a, 'b>()
+ //~^ ERROR hidden type for `impl Sized + 'a` captures lifetime that does not appear in bounds
+}
+
+fn step3<'a, 'b: 'a>() -> impl Send + 'a {
+ step2::<'a, 'b>()
+ // This should not be Send unless `'b: 'static`
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr
new file mode 100644
index 000000000..168a5aa18
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr
@@ -0,0 +1,18 @@
+error[E0700]: hidden type for `impl Sized + 'a` captures lifetime that does not appear in bounds
+ --> $DIR/rpit-hidden-erased-unsoundness.rs:16:5
+ |
+LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a {
+ | -- --------------- opaque type defined here
+ | |
+ | hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here
+LL | step1::<'a, 'b>()
+ | ^^^^^^^^^^^^^^^^^
+ |
+help: to declare that `impl Sized + 'a` captures `'b`, you can add an explicit `'b` lifetime bound
+ |
+LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a + 'b {
+ | ++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs
new file mode 100644
index 000000000..4de2ffbb8
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.rs
@@ -0,0 +1,32 @@
+// This test should never pass!
+
+use std::cell::RefCell;
+use std::rc::Rc;
+
+trait Swap: Sized {
+ fn swap(self, other: Self);
+}
+
+impl<T> Swap for Rc<RefCell<T>> {
+ fn swap(self, other: Self) {
+ <RefCell<T>>::swap(&self, &other);
+ }
+}
+
+fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a {
+ x
+ //~^ ERROR hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds
+}
+
+fn dangle() -> &'static [i32; 3] {
+ let long = Rc::new(RefCell::new(&[4, 5, 6]));
+ let x = [1, 2, 3];
+ let short = Rc::new(RefCell::new(&x));
+ hide(long.clone()).swap(hide(short));
+ let res: &'static [i32; 3] = *long.borrow();
+ res
+}
+
+fn main() {
+ println!("{:?}", dangle());
+}
diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr
new file mode 100644
index 000000000..cabba4baf
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr
@@ -0,0 +1,18 @@
+error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds
+ --> $DIR/rpit-hide-lifetime-for-swap.rs:17:5
+ |
+LL | fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a {
+ | -- -------------- opaque type defined here
+ | |
+ | hidden type `Rc<RefCell<&'b T>>` captures the lifetime `'b` as defined here
+LL | x
+ | ^
+ |
+help: to declare that `impl Swap + 'a` captures `'b`, you can add an explicit `'b` lifetime bound
+ |
+LL | fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + 'b {
+ | ++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs
new file mode 100644
index 000000000..40efd941e
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.rs
@@ -0,0 +1,28 @@
+// This test should never pass!
+
+#![feature(type_alias_impl_trait)]
+
+trait Captures<'a> {}
+impl<T> Captures<'_> for T {}
+
+struct MyTy<'a, 'b>(Option<*mut &'a &'b ()>);
+unsafe impl Send for MyTy<'_, 'static> {}
+
+fn step1<'a, 'b: 'a>() -> impl Sized + Captures<'b> + 'a {
+ MyTy::<'a, 'b>(None)
+}
+
+mod tait {
+ type Tait<'a> = impl Sized + 'a;
+ pub(super) fn step2<'a, 'b: 'a>() -> Tait<'a> {
+ super::step1::<'a, 'b>()
+ //~^ ERROR hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
+ }
+}
+
+fn step3<'a, 'b: 'a>() -> impl Send + 'a {
+ tait::step2::<'a, 'b>()
+ // This should not be Send unless `'b: 'static`
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr
new file mode 100644
index 000000000..baeec6d58
--- /dev/null
+++ b/tests/ui/impl-trait/alias-liveness/tait-hidden-erased-unsoundness.stderr
@@ -0,0 +1,13 @@
+error[E0700]: hidden type for `Tait<'a>` captures lifetime that does not appear in bounds
+ --> $DIR/tait-hidden-erased-unsoundness.rs:18:9
+ |
+LL | type Tait<'a> = impl Sized + 'a;
+ | --------------- opaque type defined here
+LL | pub(super) fn step2<'a, 'b: 'a>() -> Tait<'a> {
+ | -- hidden type `impl Captures<'b> + 'a` captures the lifetime `'b` as defined here
+LL | super::step1::<'a, 'b>()
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr b/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr
index 40446a3d3..d5086c7bc 100644
--- a/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr
+++ b/tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr
@@ -7,7 +7,7 @@ LL | | &mut Header,
LL | | &mut [EntryMetadata],
LL | | &mut [Entry<C::EncodedKey, C::EncodedValue>]
LL | | ) -> R,
- | |__________- this type parameter
+ | |__________- expected this type parameter
LL | ) {
LL | let () = y;
| ^^ - this expression has type `impl FnOnce(&mut Header, &mut [EntryMetadata], &mut [Entry<C::EncodedKey, C::EncodedValue>]) -> R`
diff --git a/tests/ui/impl-trait/async_scope_creep.rs b/tests/ui/impl-trait/async_scope_creep.rs
index 7a9d64d33..60975439a 100644
--- a/tests/ui/impl-trait/async_scope_creep.rs
+++ b/tests/ui/impl-trait/async_scope_creep.rs
@@ -1,6 +1,7 @@
#![feature(type_alias_impl_trait)]
// edition:2021
// check-pass
+// revisions: tait rpit
struct Pending {}
@@ -12,17 +13,25 @@ impl AsyncRead for i32 {}
type PendingReader<'a> = impl AsyncRead + 'a;
-type OpeningReadFuture<'a> =
- impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
+#[cfg(tait)]
+type OpeningReadFuture<'a> = impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
impl Pending {
async fn read(&mut self) -> Result<impl AsyncRead + '_, CantOpen> {
Ok(42)
}
+ #[cfg(tait)]
fn read_fut(&mut self) -> OpeningReadFuture<'_> {
self.read()
}
+
+ #[cfg(rpit)]
+ fn read_fut(
+ &mut self,
+ ) -> impl std::future::Future<Output = Result<PendingReader<'_>, CantOpen>> {
+ self.read()
+ }
}
fn main() {}
diff --git a/tests/ui/impl-trait/auto-trait.stderr b/tests/ui/impl-trait/auto-trait-coherence.next.stderr
index 81009413c..7833ac688 100644
--- a/tests/ui/impl-trait/auto-trait.stderr
+++ b/tests/ui/impl-trait/auto-trait-coherence.next.stderr
@@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
- --> $DIR/auto-trait.rs:21:1
+ --> $DIR/auto-trait-coherence.rs:24:1
|
LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here
diff --git a/tests/ui/impl-trait/auto-trait-coherence.old.stderr b/tests/ui/impl-trait/auto-trait-coherence.old.stderr
new file mode 100644
index 000000000..7833ac688
--- /dev/null
+++ b/tests/ui/impl-trait/auto-trait-coherence.old.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
+ --> $DIR/auto-trait-coherence.rs:24:1
+ |
+LL | impl<T: Send> AnotherTrait for T {}
+ | -------------------------------- first implementation here
+...
+LL | impl AnotherTrait for D<OpaqueType> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/impl-trait/auto-trait.rs b/tests/ui/impl-trait/auto-trait-coherence.rs
index 35994e4a5..a5cd01a87 100644
--- a/tests/ui/impl-trait/auto-trait.rs
+++ b/tests/ui/impl-trait/auto-trait-coherence.rs
@@ -1,3 +1,6 @@
+// revisions: old next
+//[next] compile-flags: -Ztrait-solver=next
+
// Tests that type alias impls traits do not leak auto-traits for
// the purposes of coherence checking
#![feature(type_alias_impl_trait)]
diff --git a/tests/ui/impl-trait/auto-trait-leak.rs b/tests/ui/impl-trait/auto-trait-leak.rs
index 1f90292f4..de4f523c2 100644
--- a/tests/ui/impl-trait/auto-trait-leak.rs
+++ b/tests/ui/impl-trait/auto-trait-leak.rs
@@ -9,8 +9,6 @@ fn main() {}
// independently resolved and only require the concrete
// return type, which can't depend on the obligation.
fn cycle1() -> impl Clone {
- //~^ ERROR cycle detected
- //~| ERROR cycle detected
send(cycle2().clone());
Rc::new(Cell::new(5))
diff --git a/tests/ui/impl-trait/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leak.stderr
index 62341f6de..28643ec03 100644
--- a/tests/ui/impl-trait/auto-trait-leak.stderr
+++ b/tests/ui/impl-trait/auto-trait-leak.stderr
@@ -1,66 +1,5 @@
-error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `cycle1`...
- --> $DIR/auto-trait-leak.rs:14:5
- |
-LL | send(cycle2().clone());
- | ^^^^
- = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-note: ...which requires computing type of opaque `cycle2::{opaque#0}`...
- --> $DIR/auto-trait-leak.rs:19:16
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^
-note: ...which requires type-checking `cycle2`...
- --> $DIR/auto-trait-leak.rs:20:5
- |
-LL | send(cycle1().clone());
- | ^^^^
- = note: ...which requires evaluating trait selection obligation `cycle1::{opaque#0}: core::marker::Send`...
- = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error[E0391]: cycle detected when computing type of opaque `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `cycle1`...
- --> $DIR/auto-trait-leak.rs:14:5
- |
-LL | send(cycle2().clone());
- | ^^^^
- = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`...
-note: ...which requires computing type of opaque `cycle2::{opaque#0}`...
- --> $DIR/auto-trait-leak.rs:19:16
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^
-note: ...which requires type-checking `cycle2`...
- --> $DIR/auto-trait-leak.rs:19:1
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which again requires computing type of opaque `cycle1::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `cycle1::{opaque#0}`
- --> $DIR/auto-trait-leak.rs:11:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
error: cannot check whether the hidden type of opaque type satisfies auto traits
- --> $DIR/auto-trait-leak.rs:20:10
+ --> $DIR/auto-trait-leak.rs:18:10
|
LL | send(cycle1().clone());
| ---- ^^^^^^^^^^^^^^^^
@@ -73,7 +12,7 @@ note: opaque type is declared here
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/auto-trait-leak.rs:19:4
+ --> $DIR/auto-trait-leak.rs:17:4
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^
@@ -83,6 +22,5 @@ note: required by a bound in `send`
LL | fn send<T: Send>(_: T) {}
| ^^^^ required by this bound in `send`
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/impl-trait/bivariant-lifetime-liveness.rs b/tests/ui/impl-trait/bivariant-lifetime-liveness.rs
new file mode 100644
index 000000000..fe99fe3f3
--- /dev/null
+++ b/tests/ui/impl-trait/bivariant-lifetime-liveness.rs
@@ -0,0 +1,15 @@
+// check-pass
+// issue: 116794
+
+// Uncaptured lifetimes should not be required to be live.
+
+struct Invariant<T>(*mut T);
+
+fn opaque<'a: 'a>(_: &'a str) -> Invariant<impl Sized> {
+ Invariant(&mut ())
+}
+
+fn main() {
+ let x = opaque(&String::new());
+ drop(x);
+}
diff --git a/tests/ui/impl-trait/bounds_regression.rs b/tests/ui/impl-trait/bounds_regression.rs
index 31fc46203..f32d83c0c 100644
--- a/tests/ui/impl-trait/bounds_regression.rs
+++ b/tests/ui/impl-trait/bounds_regression.rs
@@ -1,6 +1,6 @@
// run-pass
-pub trait FakeGenerator {
+pub trait FakeCoroutine {
type Yield;
type Return;
}
@@ -9,15 +9,15 @@ pub trait FakeFuture {
type Output;
}
-pub fn future_from_generator<
- T: FakeGenerator<Yield = ()>
+pub fn future_from_coroutine<
+ T: FakeCoroutine<Yield = ()>
>(x: T) -> impl FakeFuture<Output = T::Return> {
GenFuture(x)
}
-struct GenFuture<T: FakeGenerator<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
+struct GenFuture<T: FakeCoroutine<Yield = ()>>(#[allow(unused_tuple_struct_fields)] T);
-impl<T: FakeGenerator<Yield = ()>> FakeFuture for GenFuture<T> {
+impl<T: FakeCoroutine<Yield = ()>> FakeFuture for GenFuture<T> {
type Output = T::Return;
}
diff --git a/tests/ui/impl-trait/cross-return-site-inference.rs b/tests/ui/impl-trait/cross-return-site-inference.rs
index 00aed2ad9..e1071b08c 100644
--- a/tests/ui/impl-trait/cross-return-site-inference.rs
+++ b/tests/ui/impl-trait/cross-return-site-inference.rs
@@ -36,13 +36,13 @@ fn muh() -> Result<(), impl std::fmt::Debug> {
fn muh2() -> Result<(), impl std::fmt::Debug> {
return Err(From::from("foo"));
- //~^ ERROR type annotations needed
+ //~^ ERROR cannot call associated function on trait
Ok(())
}
fn muh3() -> Result<(), impl std::fmt::Debug> {
Err(From::from("foo"))
- //~^ ERROR type annotations needed
+ //~^ ERROR cannot call associated function on trait
}
fn main() {}
diff --git a/tests/ui/impl-trait/cross-return-site-inference.stderr b/tests/ui/impl-trait/cross-return-site-inference.stderr
index 766614e9e..8ee3e9abf 100644
--- a/tests/ui/impl-trait/cross-return-site-inference.stderr
+++ b/tests/ui/impl-trait/cross-return-site-inference.stderr
@@ -9,28 +9,29 @@ help: consider specifying the generic arguments
LL | Ok::<(), E>(())
| +++++++++
-error[E0282]: type annotations needed
- --> $DIR/cross-return-site-inference.rs:38:12
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+ --> $DIR/cross-return-site-inference.rs:38:16
|
LL | return Err(From::from("foo"));
- | ^^^ cannot infer type of the type parameter `E` declared on the enum `Result`
+ | ^^^^^^^^^^ cannot call associated function of trait
|
-help: consider specifying the generic arguments
+help: use a fully-qualified path to a specific available implementation
|
-LL | return Err::<(), E>(From::from("foo"));
- | +++++++++
+LL | return Err(</* self type */ as From>::from("foo"));
+ | +++++++++++++++++++ +
-error[E0282]: type annotations needed
- --> $DIR/cross-return-site-inference.rs:44:5
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+ --> $DIR/cross-return-site-inference.rs:44:9
|
LL | Err(From::from("foo"))
- | ^^^ cannot infer type of the type parameter `E` declared on the enum `Result`
+ | ^^^^^^^^^^ cannot call associated function of trait
|
-help: consider specifying the generic arguments
+help: use a fully-qualified path to a specific available implementation
|
-LL | Err::<(), E>(From::from("foo"))
- | +++++++++
+LL | Err(</* self type */ as From>::from("foo"))
+ | +++++++++++++++++++ +
error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0282, E0790.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr b/tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr
new file mode 100644
index 000000000..84b61dc50
--- /dev/null
+++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.current.stderr
@@ -0,0 +1,14 @@
+error: {foo<ReEarlyBound(DefId(..), 0, 'a)>::{closure#0} closure_kind_ty=i8 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=()}
+ --> $DIR/erased-regions-in-hidden-ty.rs:11:36
+ |
+LL | fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: Opaque(DefId(..), [ReErased])
+ --> $DIR/erased-regions-in-hidden-ty.rs:17:13
+ |
+LL | fn bar() -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr b/tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr
new file mode 100644
index 000000000..84b61dc50
--- /dev/null
+++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.next.stderr
@@ -0,0 +1,14 @@
+error: {foo<ReEarlyBound(DefId(..), 0, 'a)>::{closure#0} closure_kind_ty=i8 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=()}
+ --> $DIR/erased-regions-in-hidden-ty.rs:11:36
+ |
+LL | fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: Opaque(DefId(..), [ReErased])
+ --> $DIR/erased-regions-in-hidden-ty.rs:17:13
+ |
+LL | fn bar() -> impl Fn() + 'static {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs
new file mode 100644
index 000000000..698123a93
--- /dev/null
+++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs
@@ -0,0 +1,23 @@
+// revisions: current next
+// compile-flags: -Zverbose
+//[next] compile-flags: -Ztrait-solver=next
+// normalize-stderr-test "DefId\([^\)]+\)" -> "DefId(..)"
+
+#![feature(rustc_attrs)]
+#![rustc_hidden_type_of_opaques]
+
+// Make sure that the compiler can handle `ReErased` in the hidden type of an opaque.
+
+fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Fn() + 'static {
+//~^ ERROR 0, 'a)>::{closure#0} closure_kind_ty=i8 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=()}
+// Can't write whole type because of lack of path sanitization
+ || ()
+}
+
+fn bar() -> impl Fn() + 'static {
+//~^ ERROR , [ReErased])
+// Can't write whole type because of lack of path sanitization
+ foo(&vec![])
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
index fad0b812d..d3c2d5d5b 100644
--- a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
+++ b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr
@@ -20,6 +20,7 @@ LL | fn ice() -> impl AsRef<Fn(&())> {
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn ice() -> impl AsRef<dyn Fn(&())> {
@@ -33,6 +34,7 @@ LL | fn ice() -> impl AsRef<Fn(&())> {
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | fn ice() -> impl AsRef<dyn Fn(&())> {
diff --git a/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
index e62662f2f..09fbef2ec 100644
--- a/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
+++ b/tests/ui/impl-trait/in-trait/anonymize-binders-for-refine.rs
@@ -1,7 +1,6 @@
// compile-flags: --crate-type=lib
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
#![deny(refining_impl_trait)]
pub trait Tr<T> {
diff --git a/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
index 2a61c5cc8..afb9992de 100644
--- a/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
+++ b/tests/ui/impl-trait/in-trait/assumed-wf-bounds-in-impl.rs
@@ -2,13 +2,13 @@
// edition: 2021
// issue: 113796
-#![feature(async_fn_in_trait)]
trait AsyncLendingIterator {
type Item<'a>
where
Self: 'a;
+ #[allow(async_fn_in_trait)]
async fn next(&mut self) -> Option<Self::Item<'_>>;
}
diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs
new file mode 100644
index 000000000..af6ffe833
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.rs
@@ -0,0 +1,11 @@
+// edition:2021
+// https://github.com/rust-lang/rust/issues/117547
+
+trait T {}
+
+trait MyTrait {
+ async fn foo() -> &'static impl T;
+ //~^ ERROR the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr
new file mode 100644
index 000000000..7c9028a8c
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/async-and-ret-ref.stderr
@@ -0,0 +1,14 @@
+error[E0310]: the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough
+ --> $DIR/async-and-ret-ref.rs:7:5
+ |
+LL | async fn foo() -> &'static impl T;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the associated type `<Self as MyTrait>::{opaque#0}` must be valid for the static lifetime...
+ | ...so that the reference type `&'static impl T` does not outlive the data it points at
+ |
+ = help: consider adding an explicit lifetime bound `<Self as MyTrait>::{opaque#0}: 'static`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
index 6e9940211..a213994ff 100644
--- a/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
@@ -1,4 +1,4 @@
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
use std::ops::Deref;
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
index 3a93dfee5..41d5f0f64 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
@@ -1,6 +1,5 @@
// issue: 114146
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn bar<'other: 'a>() -> impl Sized + 'a {}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
index 3a1f8f908..b0832eb33 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
@@ -1,5 +1,5 @@
error[E0261]: use of undeclared lifetime name `'a`
- --> $DIR/bad-item-bound-within-rpitit-2.rs:6:20
+ --> $DIR/bad-item-bound-within-rpitit-2.rs:5:20
|
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
| ^^ undeclared lifetime
@@ -14,7 +14,7 @@ LL | trait Foo<'a> {
| ++++
error[E0261]: use of undeclared lifetime name `'a`
- --> $DIR/bad-item-bound-within-rpitit-2.rs:6:42
+ --> $DIR/bad-item-bound-within-rpitit-2.rs:5:42
|
LL | fn bar<'other: 'a>() -> impl Sized + 'a {}
| ^^ undeclared lifetime
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
index fbbbb8585..5ddc97f1a 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
@@ -1,6 +1,5 @@
// issue: 114145
-#![feature(return_position_impl_trait_in_trait)]
pub trait Iterable {
type Item<'a>
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
index a5fb338ea..324eaa37a 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
@@ -1,5 +1,5 @@
error[E0276]: impl has stricter requirements than trait
- --> $DIR/bad-item-bound-within-rpitit.rs:16:13
+ --> $DIR/bad-item-bound-within-rpitit.rs:15:13
|
LL | type Item<'a>
| ------------- definition of `Item` from trait
@@ -13,7 +13,7 @@ LL | where Self: 'b;
| ~~~~~~~~~~~~~~
warning: impl trait in impl method signature does not match trait method signature
- --> $DIR/bad-item-bound-within-rpitit.rs:19:28
+ --> $DIR/bad-item-bound-within-rpitit.rs:18:28
|
LL | fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
| ----------------------------------------- return type from trait method defined here
diff --git a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
index f5ee4690f..87eb7beb1 100644
--- a/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
+++ b/tests/ui/impl-trait/in-trait/box-coerce-span-in-default.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
struct TestA {}
struct TestB {}
diff --git a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
index 742537ffc..2845b401b 100644
--- a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
struct Wrapper<G: Send>(G);
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
index dee87d082..1570b2ecd 100644
--- a/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
+++ b/tests/ui/impl-trait/in-trait/check-wf-on-non-defaulted-rpitit.stderr
@@ -1,12 +1,12 @@
error[E0277]: `impl Sized` cannot be sent between threads safely
- --> $DIR/check-wf-on-non-defaulted-rpitit.rs:6:17
+ --> $DIR/check-wf-on-non-defaulted-rpitit.rs:4:17
|
LL | fn bar() -> Wrapper<impl Sized>;
| ^^^^^^^^^^^^^^^^^^^ `impl Sized` cannot be sent between threads safely
|
= help: the trait `Send` is not implemented for `impl Sized`
note: required by a bound in `Wrapper`
- --> $DIR/check-wf-on-non-defaulted-rpitit.rs:3:19
+ --> $DIR/check-wf-on-non-defaulted-rpitit.rs:1:19
|
LL | struct Wrapper<G: Send>(G);
| ^^^^ required by this bound in `Wrapper`
diff --git a/tests/ui/impl-trait/in-trait/deep-match-works.rs b/tests/ui/impl-trait/in-trait/deep-match-works.rs
index fc290f11f..8c9927438 100644
--- a/tests/ui/impl-trait/in-trait/deep-match-works.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match-works.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
pub struct Wrapper<T>(T);
diff --git a/tests/ui/impl-trait/in-trait/deep-match.rs b/tests/ui/impl-trait/in-trait/deep-match.rs
index 0cae88f34..82eac7760 100644
--- a/tests/ui/impl-trait/in-trait/deep-match.rs
+++ b/tests/ui/impl-trait/in-trait/deep-match.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
struct Wrapper<T>(T);
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/deep-match.stderr b/tests/ui/impl-trait/in-trait/deep-match.stderr
index f0ad3c16e..a658d8fa0 100644
--- a/tests/ui/impl-trait/in-trait/deep-match.stderr
+++ b/tests/ui/impl-trait/in-trait/deep-match.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `bar` has an incompatible return type for trait
- --> $DIR/deep-match.rs:11:17
+ --> $DIR/deep-match.rs:8:17
|
LL | fn bar() -> i32 {
| ^^^
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
index 45ae2b8ad..29bcbe16d 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.rs
@@ -1,7 +1,6 @@
// edition:2021
#![allow(incomplete_features)]
-#![feature(async_fn_in_trait)]
pub trait Foo {
async fn woopsie_async(&self) -> String {
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
index cc3bdf0e5..fcace10cd 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/default-body-type-err-2.rs:8:9
+ --> $DIR/default-body-type-err-2.rs:7:9
|
LL | 42
| ^^- help: try using a conversion method: `.to_string()`
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.rs b/tests/ui/impl-trait/in-trait/default-body-type-err.rs
index ac9baf91c..ac7a50a36 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err.rs
@@ -1,6 +1,3 @@
-#![allow(incomplete_features)]
-#![feature(return_position_impl_trait_in_trait)]
-
use std::ops::Deref;
pub trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
index 4742eb37d..596ff1011 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err.stderr
@@ -1,5 +1,5 @@
error[E0271]: type mismatch resolving `<&i32 as Deref>::Target == String`
- --> $DIR/default-body-type-err.rs:7:22
+ --> $DIR/default-body-type-err.rs:4:22
|
LL | fn lol(&self) -> impl Deref<Target = String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `String`
diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
index 25133214d..1d1f55508 100644
--- a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
+++ b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
@@ -1,12 +1,12 @@
// edition:2021
// check-pass
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
trait Foo {
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> impl Debug {
""
}
diff --git a/tests/ui/impl-trait/in-trait/default-body.rs b/tests/ui/impl-trait/in-trait/default-body.rs
index b0baf5bb1..ff70f1e23 100644
--- a/tests/ui/impl-trait/in-trait/default-body.rs
+++ b/tests/ui/impl-trait/in-trait/default-body.rs
@@ -1,12 +1,12 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
trait Foo {
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> &str {
""
}
diff --git a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
index 817a4d7db..ca41eb8bc 100644
--- a/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
+++ b/tests/ui/impl-trait/in-trait/default-method-binder-shifting.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
trait Trait {
type Type;
diff --git a/tests/ui/impl-trait/in-trait/default-method-constraint.rs b/tests/ui/impl-trait/in-trait/default-method-constraint.rs
index 28d76241f..8ab2e2797 100644
--- a/tests/ui/impl-trait/in-trait/default-method-constraint.rs
+++ b/tests/ui/impl-trait/in-trait/default-method-constraint.rs
@@ -2,7 +2,6 @@
// This didn't work in the previous default RPITIT method hack attempt
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn bar(x: bool) -> impl Sized {
diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
index bb4e0d44f..0ac60918b 100644
--- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
+++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
trait Foo {
fn bar() -> impl std::fmt::Display;
}
diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
index 7c56ffa10..cd45c6a9c 100644
--- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
+++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr
@@ -1,5 +1,5 @@
error[E0277]: `()` doesn't implement `std::fmt::Display`
- --> $DIR/doesnt-satisfy.rs:9:17
+ --> $DIR/doesnt-satisfy.rs:6:17
|
LL | fn bar() -> () {}
| ^^ `()` cannot be formatted with the default formatter
@@ -7,7 +7,7 @@ LL | fn bar() -> () {}
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `Foo::{opaque#0}`
- --> $DIR/doesnt-satisfy.rs:5:22
+ --> $DIR/doesnt-satisfy.rs:2:22
|
LL | fn bar() -> impl std::fmt::Display;
| ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{opaque#0}`
diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
index 4719d5d3c..fe0f011b6 100644
--- a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
+++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait MyTrait {
fn foo(&self) -> impl Sized;
fn bar(&self) -> impl Sized;
diff --git a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
index 66ee142cc..830e663da 100644
--- a/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
+++ b/tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr
@@ -1,5 +1,5 @@
error[E0046]: not all trait items implemented, missing: `foo`
- --> $DIR/dont-project-to-rpitit-with-no-value.rs:8:1
+ --> $DIR/dont-project-to-rpitit-with-no-value.rs:6:1
|
LL | fn foo(&self) -> impl Sized;
| ---------------------------- `foo` from trait
diff --git a/tests/ui/impl-trait/in-trait/early.rs b/tests/ui/impl-trait/in-trait/early.rs
index 9c1c2b503..c4996674d 100644
--- a/tests/ui/impl-trait/in-trait/early.rs
+++ b/tests/ui/impl-trait/in-trait/early.rs
@@ -1,10 +1,10 @@
// check-pass
// edition:2021
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
pub trait Foo {
+ #[allow(async_fn_in_trait)]
async fn bar<'a: 'a>(&'a mut self);
}
diff --git a/tests/ui/impl-trait/in-trait/encode.rs b/tests/ui/impl-trait/in-trait/encode.rs
index efb9f6498..4df26b0f2 100644
--- a/tests/ui/impl-trait/in-trait/encode.rs
+++ b/tests/ui/impl-trait/in-trait/encode.rs
@@ -1,7 +1,6 @@
// build-pass
// compile-flags: --crate-type=lib
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
index bfb2be8cb..f29ec95d5 100644
--- a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
+++ b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr
@@ -9,6 +9,7 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all
|
LL | fn bar(self) -> impl Deref<Target = impl Sized>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait cannot be made into an object because method `bar` references an `impl Trait` type in its return type
+ = help: only type `rpitit::Foreign` implements the trait, consider using it directly instead
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/in-trait/gat-outlives.rs b/tests/ui/impl-trait/in-trait/gat-outlives.rs
new file mode 100644
index 000000000..83dd6cfce
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/gat-outlives.rs
@@ -0,0 +1,17 @@
+// edition: 2021
+
+use std::future::Future;
+
+trait Trait {
+ type Gat<'a>;
+ //~^ ERROR missing required bound on `Gat`
+ async fn foo(&self) -> Self::Gat<'_>;
+}
+
+trait Trait2 {
+ type Gat<'a>;
+ //~^ ERROR missing required bound on `Gat`
+ async fn foo(&self) -> impl Future<Output = Self::Gat<'_>>;
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/gat-outlives.stderr b/tests/ui/impl-trait/in-trait/gat-outlives.stderr
new file mode 100644
index 000000000..8ec4b0ab2
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/gat-outlives.stderr
@@ -0,0 +1,24 @@
+error: missing required bound on `Gat`
+ --> $DIR/gat-outlives.rs:6:5
+ |
+LL | type Gat<'a>;
+ | ^^^^^^^^^^^^-
+ | |
+ | help: add the required where clause: `where Self: 'a`
+ |
+ = note: this bound is currently required to ensure that impls have maximum flexibility
+ = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
+
+error: missing required bound on `Gat`
+ --> $DIR/gat-outlives.rs:12:5
+ |
+LL | type Gat<'a>;
+ | ^^^^^^^^^^^^-
+ | |
+ | help: add the required where clause: `where Self: 'a`
+ |
+ = note: this bound is currently required to ensure that impls have maximum flexibility
+ = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.rs b/tests/ui/impl-trait/in-trait/generics-mismatch.rs
index cc0fc720e..3ea31cc93 100644
--- a/tests/ui/impl-trait/in-trait/generics-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/generics-mismatch.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
struct U;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/generics-mismatch.stderr b/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
index cd42683e0..043dbc8db 100644
--- a/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
+++ b/tests/ui/impl-trait/in-trait/generics-mismatch.stderr
@@ -1,5 +1,5 @@
error[E0049]: method `bar` has 1 type parameter but its trait declaration has 0 type parameters
- --> $DIR/generics-mismatch.rs:11:12
+ --> $DIR/generics-mismatch.rs:8:12
|
LL | fn bar(&self) -> impl Sized;
| - expected 0 type parameters
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.rs b/tests/ui/impl-trait/in-trait/issue-102140.rs
index be1e012ac..796001848 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102140.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
trait Marker {}
impl Marker for u32 {}
diff --git a/tests/ui/impl-trait/in-trait/issue-102140.stderr b/tests/ui/impl-trait/in-trait/issue-102140.stderr
index 18bb63745..9cd2cdfd1 100644
--- a/tests/ui/impl-trait/in-trait/issue-102140.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102140.stderr
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:23:22
+ --> $DIR/issue-102140.rs:20:22
|
LL | MyTrait::foo(&self)
| ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
@@ -13,7 +13,7 @@ LL + MyTrait::foo(self)
|
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:23:9
+ --> $DIR/issue-102140.rs:20:9
|
LL | MyTrait::foo(&self)
| ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
@@ -21,7 +21,7 @@ LL | MyTrait::foo(&self)
= help: the trait `MyTrait` is implemented for `Outer`
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
- --> $DIR/issue-102140.rs:23:9
+ --> $DIR/issue-102140.rs:20:9
|
LL | MyTrait::foo(&self)
| ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
diff --git a/tests/ui/impl-trait/in-trait/issue-102301.rs b/tests/ui/impl-trait/in-trait/issue-102301.rs
index a93714a65..600a21b07 100644
--- a/tests/ui/impl-trait/in-trait/issue-102301.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102301.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo<T> {
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.rs b/tests/ui/impl-trait/in-trait/issue-102571.rs
index ccb53031c..4fa3fdd31 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.rs
+++ b/tests/ui/impl-trait/in-trait/issue-102571.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Display;
use std::ops::Deref;
diff --git a/tests/ui/impl-trait/in-trait/issue-102571.stderr b/tests/ui/impl-trait/in-trait/issue-102571.stderr
index 594b9ae9c..872988faf 100644
--- a/tests/ui/impl-trait/in-trait/issue-102571.stderr
+++ b/tests/ui/impl-trait/in-trait/issue-102571.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/issue-102571.rs:12:9
+ --> $DIR/issue-102571.rs:9:9
|
LL | let () = t.bar();
| ^^ ------- this expression has type `impl Deref<Target = impl std::fmt::Display + ?Sized>`
diff --git a/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
index 49d36d6c9..4073ef8ac 100644
--- a/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
+++ b/tests/ui/impl-trait/in-trait/lifetime-in-associated-trait-bound.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(associated_type_bounds, return_position_impl_trait_in_trait)]
+#![feature(associated_type_bounds)]
trait Trait {
type Type;
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
index 239c4b35c..874a1b95a 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
@@ -1,15 +1,15 @@
error[E0053]: method `early` has an incompatible type for trait
- --> $DIR/method-signature-matches.rs:58:27
+ --> $DIR/method-signature-matches.rs:57:27
|
LL | fn early<'late, T>(_: &'late ()) {}
| - ^^^^^^^^^
| | |
| | expected type parameter `T`, found `()`
| | help: change the parameter type to match the trait: `&T`
- | this type parameter
+ | expected this type parameter
|
note: type in trait
- --> $DIR/method-signature-matches.rs:53:28
+ --> $DIR/method-signature-matches.rs:52:28
|
LL | fn early<'early, T>(x: &'early T) -> impl Sized;
| ^^^^^^^^^
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
index d3183b92e..e0bd1cc4f 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `owo` has an incompatible type for trait
- --> $DIR/method-signature-matches.rs:14:15
+ --> $DIR/method-signature-matches.rs:13:15
|
LL | fn owo(_: u8) {}
| ^^
@@ -8,7 +8,7 @@ LL | fn owo(_: u8) {}
| help: change the parameter type to match the trait: `()`
|
note: type in trait
- --> $DIR/method-signature-matches.rs:9:15
+ --> $DIR/method-signature-matches.rs:8:15
|
LL | fn owo(x: ()) -> impl Sized;
| ^^
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
index 80fda1c9f..096e96c85 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
@@ -1,5 +1,5 @@
error[E0053]: method `owo` has an incompatible type for trait
- --> $DIR/method-signature-matches.rs:25:21
+ --> $DIR/method-signature-matches.rs:24:21
|
LL | async fn owo(_: u8) {}
| ^^
@@ -8,7 +8,7 @@ LL | async fn owo(_: u8) {}
| help: change the parameter type to match the trait: `()`
|
note: type in trait
- --> $DIR/method-signature-matches.rs:20:21
+ --> $DIR/method-signature-matches.rs:19:21
|
LL | async fn owo(x: ()) {}
| ^^
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.rs b/tests/ui/impl-trait/in-trait/method-signature-matches.rs
index 294f93b30..99ace66fa 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.rs
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.rs
@@ -1,7 +1,6 @@
// edition: 2021
// revisions: mismatch mismatch_async too_many too_few lt
-#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
#![allow(incomplete_features)]
#[cfg(mismatch)]
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
index 24bcfeb74..96eff1a58 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.too_few.stderr
@@ -1,5 +1,5 @@
error[E0050]: method `come_on_a_little_more_effort` has 0 parameters but the declaration in trait `TooLittle::come_on_a_little_more_effort` has 3
- --> $DIR/method-signature-matches.rs:47:5
+ --> $DIR/method-signature-matches.rs:46:5
|
LL | fn come_on_a_little_more_effort(_: (), _: (), _: ()) -> impl Sized;
| ---------------- trait requires 3 parameters
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
index 616cbd290..0fc847051 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.too_many.stderr
@@ -1,5 +1,5 @@
error[E0050]: method `calm_down_please` has 3 parameters but the declaration in trait `TooMuch::calm_down_please` has 0
- --> $DIR/method-signature-matches.rs:36:28
+ --> $DIR/method-signature-matches.rs:35:28
|
LL | fn calm_down_please() -> impl Sized;
| ------------------------------------ trait requires 0 parameters
diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
index abc845d3a..6088dcc61 100644
--- a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
+++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Iterable {
type Item<'a>
where
diff --git a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
index 0d74c0b69..1fd678a1f 100644
--- a/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
+++ b/tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
@@ -1,5 +1,5 @@
error[E0261]: use of undeclared lifetime name `'missing`
- --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:55
+ --> $DIR/missing-lt-outlives-in-rpitit-114274.rs:6:55
|
LL | fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>;
| ^^^^^^^^ undeclared lifetime
diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs
new file mode 100644
index 000000000..b97fd7d1f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs
@@ -0,0 +1,11 @@
+// check-pass
+
+use std::ops::Deref;
+
+trait Foo {
+ fn foo() -> impl Deref<Target = impl Deref<Target = impl Sized>> {
+ &&()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit.rs b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
index 58ba1acaf..58b79c991 100644
--- a/tests/ui/impl-trait/in-trait/nested-rpitit.rs
+++ b/tests/ui/impl-trait/in-trait/nested-rpitit.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
diff --git a/tests/ui/impl-trait/in-trait/object-safety-sized.rs b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
index f221cfbb1..35afe80c9 100644
--- a/tests/ui/impl-trait/in-trait/object-safety-sized.rs
+++ b/tests/ui/impl-trait/in-trait/object-safety-sized.rs
@@ -2,7 +2,6 @@
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
-#![feature(return_position_impl_trait_in_trait)]
fn main() {
let vec: Vec<Box<dyn Trait>> = Vec::new();
diff --git a/tests/ui/impl-trait/in-trait/object-safety.rs b/tests/ui/impl-trait/in-trait/object-safety.rs
index d1c9fba4e..5cca4ad83 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.rs
+++ b/tests/ui/impl-trait/in-trait/object-safety.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Debug;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/object-safety.stderr b/tests/ui/impl-trait/in-trait/object-safety.stderr
index 0170dc5d0..a7be0516c 100644
--- a/tests/ui/impl-trait/in-trait/object-safety.stderr
+++ b/tests/ui/impl-trait/in-trait/object-safety.stderr
@@ -1,62 +1,66 @@
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:17:33
+ --> $DIR/object-safety.rs:14:33
|
LL | let i = Box::new(42_u32) as Box<dyn Foo>;
| ^^^^^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:7:22
+ --> $DIR/object-safety.rs:4:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn baz(&self) -> impl Debug;
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
= help: consider moving `baz` to another trait
+ = help: only type `u32` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:15
+ --> $DIR/object-safety.rs:17:15
|
LL | let s = i.baz();
| ^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:7:22
+ --> $DIR/object-safety.rs:4:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn baz(&self) -> impl Debug;
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
= help: consider moving `baz` to another trait
+ = help: only type `u32` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:20:13
+ --> $DIR/object-safety.rs:17:13
|
LL | let s = i.baz();
| ^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:7:22
+ --> $DIR/object-safety.rs:4:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn baz(&self) -> impl Debug;
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
= help: consider moving `baz` to another trait
+ = help: only type `u32` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
- --> $DIR/object-safety.rs:17:13
+ --> $DIR/object-safety.rs:14:13
|
LL | let i = Box::new(42_u32) as Box<dyn Foo>;
| ^^^^^^^^^^^^^^^^ `Foo` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
- --> $DIR/object-safety.rs:7:22
+ --> $DIR/object-safety.rs:4:22
|
LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn baz(&self) -> impl Debug;
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
= help: consider moving `baz` to another trait
+ = help: only type `u32` implements the trait, consider using it directly instead
= note: required for the cast from `Box<u32>` to `Box<dyn Foo>`
error: aborting due to 4 previous errors
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
index 3ac264e8e..1f18bb3b7 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
use std::fmt::Display;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
index 15edda483..e260762d8 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl-is-opaque.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/opaque-in-impl-is-opaque.rs:17:19
+ --> $DIR/opaque-in-impl-is-opaque.rs:14:19
|
LL | fn bar(&self) -> impl Display {
| ------------ the found opaque type
diff --git a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
index 2e0662969..3edd588a1 100644
--- a/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
+++ b/tests/ui/impl-trait/in-trait/opaque-in-impl.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
diff --git a/tests/ui/impl-trait/in-trait/opaque-variances.rs b/tests/ui/impl-trait/in-trait/opaque-variances.rs
new file mode 100644
index 000000000..60bfab0de
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/opaque-variances.rs
@@ -0,0 +1,14 @@
+// check-pass
+// compile-flags: -Ztrait-solver=next
+
+fn foo<'a: 'a>(x: &'a Vec<i32>) -> impl Sized {
+ ()
+}
+
+fn main() {
+ // in NLL, we want to make sure that the `'a` subst of `foo` does not get
+ // related between `x` and the RHS of the assignment. That would require
+ // that the temp is live for the lifetime of the variable `x`, which of
+ // course is not necessary since `'a` is not captured by the RPIT.
+ let x = foo(&Vec::new());
+}
diff --git a/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs b/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
index 6330242ce..317ff7fe8 100644
--- a/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
+++ b/tests/ui/impl-trait/in-trait/outlives-in-nested-rpit.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn early<'a, T: 'a>(x: &'a T) -> impl Iterator<Item = impl Into<&'a T>>;
diff --git a/tests/ui/impl-trait/in-trait/refine.rs b/tests/ui/impl-trait/in-trait/refine.rs
index a91f9b3e7..100e6da06 100644
--- a/tests/ui/impl-trait/in-trait/refine.rs
+++ b/tests/ui/impl-trait/in-trait/refine.rs
@@ -1,4 +1,3 @@
-#![feature(return_position_impl_trait_in_trait, async_fn_in_trait)]
#![deny(refining_impl_trait)]
pub trait Foo {
@@ -45,4 +44,15 @@ impl Late for D {
//~^ ERROR impl method signature does not match trait method signature
}
+mod unreachable {
+ pub trait UnreachablePub {
+ fn bar() -> impl Sized;
+ }
+
+ struct E;
+ impl UnreachablePub for E {
+ fn bar() {}
+ }
+}
+
fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr
index 29aa08e25..96a9bc059 100644
--- a/tests/ui/impl-trait/in-trait/refine.stderr
+++ b/tests/ui/impl-trait/in-trait/refine.stderr
@@ -1,5 +1,5 @@
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:10:22
+ --> $DIR/refine.rs:9:22
|
LL | fn bar() -> impl Sized;
| ---------- return type from trait method defined here
@@ -9,7 +9,7 @@ LL | fn bar() -> impl Copy {}
|
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
note: the lint level is defined here
- --> $DIR/refine.rs:2:9
+ --> $DIR/refine.rs:1:9
|
LL | #![deny(refining_impl_trait)]
| ^^^^^^^^^^^^^^^^^^^
@@ -19,7 +19,7 @@ LL | fn bar() -> impl Sized {}
| ~~~~~~~~~~
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:16:5
+ --> $DIR/refine.rs:15:5
|
LL | fn bar() -> impl Sized;
| ---------- return type from trait method defined here
@@ -30,11 +30,11 @@ LL | fn bar() {}
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
help: replace the return type so that it matches the trait
|
-LL | fn bar() -> impl Sized {}
- | +++++++++++++
+LL | fn bar()-> impl Sized {}
+ | +++++++++++++
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:22:17
+ --> $DIR/refine.rs:21:17
|
LL | fn bar() -> impl Sized;
| ---------- return type from trait method defined here
@@ -49,7 +49,7 @@ LL | fn bar() -> impl Sized {}
| ~~~~~~~~~~
error: impl trait in impl method signature does not match trait method signature
- --> $DIR/refine.rs:44:27
+ --> $DIR/refine.rs:43:27
|
LL | fn bar<'a>(&'a self) -> impl Sized + 'a;
| --------------- return type from trait method defined here
diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
index 5d9a224cc..ad73b12fe 100644
--- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
+++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Foo<T> {
fn foo<F2>(self) -> impl Foo<T>;
}
diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
index 668fc6cbe..181d6a284 100644
--- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
+++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr
@@ -1,12 +1,12 @@
error[E0277]: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied
- --> $DIR/return-dont-satisfy-bounds.rs:10:34
+ --> $DIR/return-dont-satisfy-bounds.rs:8:34
|
LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> {
| ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>`
|
= help: the trait `Foo<char>` is implemented for `Bar`
note: required by a bound in `Foo::{opaque#0}`
- --> $DIR/return-dont-satisfy-bounds.rs:4:30
+ --> $DIR/return-dont-satisfy-bounds.rs:2:30
|
LL | fn foo<F2>(self) -> impl Foo<T>;
| ^^^^^^ required by this bound in `Foo::{opaque#0}`
diff --git a/tests/ui/impl-trait/in-trait/reveal.rs b/tests/ui/impl-trait/in-trait/reveal.rs
index b1b46d75b..cc78ce8fe 100644
--- a/tests/ui/impl-trait/in-trait/reveal.rs
+++ b/tests/ui/impl-trait/in-trait/reveal.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
pub trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
index 5e14a7f8e..37b0b2297 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Extend {
fn extend<'a: 'a>(_: &'a str) -> (impl Sized + 'a, &'static str);
}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
index 1d947310e..afc59cc5b 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
@@ -1,12 +1,12 @@
error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references
- --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:38
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:6:38
|
LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the pointer is valid for the static lifetime
note: but the referenced data is only valid for the lifetime `'a` as defined here
- --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:8:15
+ --> $DIR/rpitit-hidden-types-self-implied-wf-via-param.rs:6:15
|
LL | fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str)
| ^^
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
index c1885af4e..bacd50077 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Extend {
fn extend(_: &str) -> (impl Sized + '_, &'static str);
}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
index 7b63e72ac..7e1a8f083 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf.stderr
@@ -1,12 +1,12 @@
error[E0491]: in type `&'static &()`, reference has a longer lifetime than the data it references
- --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:27
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:6:27
|
LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the pointer is valid for the static lifetime
note: but the referenced data is only valid for the anonymous lifetime defined here
- --> $DIR/rpitit-hidden-types-self-implied-wf.rs:8:18
+ --> $DIR/rpitit-hidden-types-self-implied-wf.rs:6:18
|
LL | fn extend(s: &str) -> (Option<&'static &'_ ()>, &'static str) {
| ^^^^
diff --git a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
index 44a2b4303..b9fe8d8bf 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
@@ -1,6 +1,6 @@
// issue: 113903
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
use std::ops::Deref;
diff --git a/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs b/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
new file mode 100644
index 000000000..fe162e6cf
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
@@ -0,0 +1,21 @@
+// Checks that a sibling function (i.e. `foo`) cannot constrain
+// an RPITIT from another function (`bar`).
+
+trait Trait {
+ fn foo();
+
+ fn bar() -> impl Sized;
+}
+
+impl Trait for () {
+ fn foo() {
+ let _: String = Self::bar();
+ //~^ ERROR mismatched types
+ }
+
+ fn bar() -> impl Sized {
+ loop {}
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr b/tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr
new file mode 100644
index 000000000..729963a81
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/sibling-function-constraint.stderr
@@ -0,0 +1,17 @@
+error[E0308]: mismatched types
+ --> $DIR/sibling-function-constraint.rs:12:25
+ |
+LL | let _: String = Self::bar();
+ | ------ ^^^^^^^^^^^ expected `String`, found opaque type
+ | |
+ | expected due to this
+...
+LL | fn bar() -> impl Sized {
+ | ---------- the found opaque type
+ |
+ = note: expected struct `String`
+ found opaque type `impl Sized`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
index 685c0f06e..d85ee5fc7 100644
--- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs
+++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs
@@ -2,7 +2,7 @@
// revisions: success failure
//[success] check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
use std::future::Future;
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.rs b/tests/ui/impl-trait/in-trait/specialization-broken.rs
index 2fcffdf3f..a06cd814f 100644
--- a/tests/ui/impl-trait/in-trait/specialization-broken.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-broken.rs
@@ -2,7 +2,6 @@
// But we fixed an ICE anyways.
#![feature(specialization)]
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
index dc621d6b8..25c0adedd 100644
--- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr
+++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
@@ -1,8 +1,8 @@
error[E0053]: method `bar` has an incompatible type for trait
- --> $DIR/specialization-broken.rs:16:22
+ --> $DIR/specialization-broken.rs:15:22
|
LL | default impl<U> Foo for U
- | - this type parameter
+ | - found this type parameter
...
LL | fn bar(&self) -> U {
| ^
@@ -11,7 +11,7 @@ LL | fn bar(&self) -> U {
| help: change the output type to match the trait: `impl Sized`
|
note: type in trait
- --> $DIR/specialization-broken.rs:9:22
+ --> $DIR/specialization-broken.rs:8:22
|
LL | fn bar(&self) -> impl Sized;
| ^^^^^^^^^^
@@ -19,12 +19,12 @@ LL | fn bar(&self) -> impl Sized;
found signature `fn(&U) -> U`
error: method with return-position `impl Trait` in trait cannot be specialized
- --> $DIR/specialization-broken.rs:16:5
+ --> $DIR/specialization-broken.rs:15:5
|
LL | fn bar(&self) -> U {
| ^^^^^^^^^^^^^^^^^^
|
- = note: specialization behaves in inconsistent and surprising ways with `#![feature(return_position_impl_trait_in_trait)]`, and for now is disallowed
+ = note: specialization behaves in inconsistent and surprising ways with return position `impl Trait` in traits, and for now is disallowed
error: aborting due to 2 previous errors
diff --git a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
index 41fc28588..053866327 100644
--- a/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
+++ b/tests/ui/impl-trait/in-trait/specialization-substs-remap.rs
@@ -1,7 +1,7 @@
// check-pass
#![feature(specialization)]
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
pub trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/success.rs b/tests/ui/impl-trait/in-trait/success.rs
index 7d415ea17..eb2349feb 100644
--- a/tests/ui/impl-trait/in-trait/success.rs
+++ b/tests/ui/impl-trait/in-trait/success.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait, lint_reasons)]
+#![feature(lint_reasons)]
#![allow(incomplete_features)]
use std::fmt::Display;
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
index d9f775a6c..8dc8e045d 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed
@@ -1,15 +1,16 @@
// edition:2021
// run-rustfix
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
-
trait Trait {
+ #[allow(async_fn_in_trait)]
async fn foo();
+ #[allow(async_fn_in_trait)]
async fn bar() -> i32;
fn test(&self) -> impl Sized + '_;
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> &i32;
}
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.rs b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
index 26979b514..30b04d87b 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs
@@ -1,15 +1,16 @@
// edition:2021
// run-rustfix
-#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
-
trait Trait {
+ #[allow(async_fn_in_trait)]
async fn foo();
+ #[allow(async_fn_in_trait)]
async fn bar() -> i32;
fn test(&self) -> impl Sized + '_;
+ #[allow(async_fn_in_trait)]
async fn baz(&self) -> &i32;
}
diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
index 44f98896e..cec94e39a 100644
--- a/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
+++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr
@@ -1,15 +1,15 @@
error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `test`, `baz`
- --> $DIR/suggest-missing-item.rs:18:1
+ --> $DIR/suggest-missing-item.rs:19:1
|
LL | async fn foo();
| --------------- `foo` from trait
-LL |
+...
LL | async fn bar() -> i32;
| ---------------------- `bar` from trait
LL |
LL | fn test(&self) -> impl Sized + '_;
| ---------------------------------- `test` from trait
-LL |
+...
LL | async fn baz(&self) -> &i32;
| ---------------------------- `baz` from trait
...
diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
index 0bbe50ea6..d9fac0238 100644
--- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
+++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.rs
@@ -1,6 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-#![allow(incomplete_features)]
-
struct S;
trait Foo {
diff --git a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
index 8ff54cad9..2836e9c78 100644
--- a/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
+++ b/tests/ui/impl-trait/in-trait/trait-more-generics-than-impl.stderr
@@ -1,5 +1,5 @@
error[E0049]: method `bar` has 0 type parameters but its trait declaration has 1 type parameter
- --> $DIR/trait-more-generics-than-impl.rs:11:11
+ --> $DIR/trait-more-generics-than-impl.rs:8:11
|
LL | fn bar<T>() -> impl Sized;
| - expected 1 type parameter
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
index 07c8606f9..ff3753de5 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.rs
@@ -1,5 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
-
trait Foo {
fn test() -> impl Sized;
}
diff --git a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
index cfce35567..61a0f8454 100644
--- a/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
+++ b/tests/ui/impl-trait/in-trait/unconstrained-lt.stderr
@@ -1,5 +1,5 @@
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
- --> $DIR/unconstrained-lt.rs:7:6
+ --> $DIR/unconstrained-lt.rs:5:6
|
LL | impl<'a, T> Foo for T {
| ^^ unconstrained lifetime parameter
diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs
index f8e4ab88c..65565dcc2 100644
--- a/tests/ui/impl-trait/in-trait/variance.rs
+++ b/tests/ui/impl-trait/in-trait/variance.rs
@@ -1,4 +1,4 @@
-#![feature(rustc_attrs, return_position_impl_trait_in_trait)]
+#![feature(rustc_attrs)]
#![allow(internal_features)]
#![rustc_variance_of_opaques]
diff --git a/tests/ui/impl-trait/in-trait/variances-of-gat.rs b/tests/ui/impl-trait/in-trait/variances-of-gat.rs
index 0d19e1ff4..aabb6f830 100644
--- a/tests/ui/impl-trait/in-trait/variances-of-gat.rs
+++ b/tests/ui/impl-trait/in-trait/variances-of-gat.rs
@@ -1,6 +1,5 @@
// check-pass
-#![feature(return_position_impl_trait_in_trait)]
trait Foo {}
diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.rs b/tests/ui/impl-trait/in-trait/wf-bounds.rs
index ee873f94b..f1e372b19 100644
--- a/tests/ui/impl-trait/in-trait/wf-bounds.rs
+++ b/tests/ui/impl-trait/in-trait/wf-bounds.rs
@@ -1,6 +1,5 @@
// issue #101663
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Display;
diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.stderr
index 4d60b1330..c20df9b40 100644
--- a/tests/ui/impl-trait/in-trait/wf-bounds.stderr
+++ b/tests/ui/impl-trait/in-trait/wf-bounds.stderr
@@ -1,5 +1,5 @@
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:15:22
+ --> $DIR/wf-bounds.rs:14:22
|
LL | fn nya() -> impl Wf<Vec<[u8]>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -9,14 +9,14 @@ note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:18:23
+ --> $DIR/wf-bounds.rs:17:23
|
LL | fn nya2() -> impl Wf<[u8]>;
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `Wf`
- --> $DIR/wf-bounds.rs:8:10
+ --> $DIR/wf-bounds.rs:7:10
|
LL | trait Wf<T> {
| ^ required by this bound in `Wf`
@@ -26,7 +26,7 @@ LL | trait Wf<T: ?Sized> {
| ++++++++
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/wf-bounds.rs:21:44
+ --> $DIR/wf-bounds.rs:20:44
|
LL | fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[u8]>>>;
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -36,14 +36,14 @@ note: required by a bound in `Vec`
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
error[E0277]: `T` doesn't implement `std::fmt::Display`
- --> $DIR/wf-bounds.rs:24:26
+ --> $DIR/wf-bounds.rs:23:26
|
LL | fn nya4<T>() -> impl Wf<NeedsDisplay<T>>;
| ^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
|
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `NeedsDisplay`
- --> $DIR/wf-bounds.rs:12:24
+ --> $DIR/wf-bounds.rs:11:24
|
LL | struct NeedsDisplay<T: Display>(T);
| ^^^^^^^ required by this bound in `NeedsDisplay`
diff --git a/tests/ui/impl-trait/in-trait/where-clause.rs b/tests/ui/impl-trait/in-trait/where-clause.rs
index 87bac519c..f7f4980b7 100644
--- a/tests/ui/impl-trait/in-trait/where-clause.rs
+++ b/tests/ui/impl-trait/in-trait/where-clause.rs
@@ -1,7 +1,6 @@
// check-pass
// edition: 2021
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use std::fmt::Debug;
diff --git a/tests/ui/impl-trait/issue-55872-2.stderr b/tests/ui/impl-trait/issue-55872-2.stderr
index 3e70f1cf8..b5b7f293a 100644
--- a/tests/ui/impl-trait/issue-55872-2.stderr
+++ b/tests/ui/impl-trait/issue-55872-2.stderr
@@ -9,6 +9,8 @@ error: type parameter `T` is part of concrete type but not used in parameter lis
|
LL | async {}
| ^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/impl-trait/issues/issue-54600.rs b/tests/ui/impl-trait/issues/issue-54600.rs
index 3024fedf7..ccf276701 100644
--- a/tests/ui/impl-trait/issues/issue-54600.rs
+++ b/tests/ui/impl-trait/issues/issue-54600.rs
@@ -2,6 +2,6 @@ use std::fmt::Debug;
fn main() {
let x: Option<impl Debug> = Some(44_u32);
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
println!("{:?}", x);
}
diff --git a/tests/ui/impl-trait/issues/issue-54600.stderr b/tests/ui/impl-trait/issues/issue-54600.stderr
index 7ef063af9..9a8e3675b 100644
--- a/tests/ui/impl-trait/issues/issue-54600.stderr
+++ b/tests/ui/impl-trait/issues/issue-54600.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-54600.rs:4:19
|
LL | let x: Option<impl Debug> = Some(44_u32);
diff --git a/tests/ui/impl-trait/issues/issue-54840.rs b/tests/ui/impl-trait/issues/issue-54840.rs
index 8f1e0ece0..910d23f1d 100644
--- a/tests/ui/impl-trait/issues/issue-54840.rs
+++ b/tests/ui/impl-trait/issues/issue-54840.rs
@@ -3,5 +3,5 @@ use std::ops::Add;
fn main() {
let i: i32 = 0;
let j: &impl Add = &i;
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-54840.stderr b/tests/ui/impl-trait/issues/issue-54840.stderr
index 1d1316f0e..67cabf449 100644
--- a/tests/ui/impl-trait/issues/issue-54840.stderr
+++ b/tests/ui/impl-trait/issues/issue-54840.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-54840.rs:5:13
|
LL | let j: &impl Add = &i;
diff --git a/tests/ui/impl-trait/issues/issue-58504.rs b/tests/ui/impl-trait/issues/issue-58504.rs
index e5865d0df..03b51ae92 100644
--- a/tests/ui/impl-trait/issues/issue-58504.rs
+++ b/tests/ui/impl-trait/issues/issue-58504.rs
@@ -1,12 +1,12 @@
-#![feature(generators, generator_trait, never_type)]
+#![feature(coroutines, coroutine_trait, never_type)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn mk_gen() -> impl Generator<Return=!, Yield=()> {
+fn mk_gen() -> impl Coroutine<Return=!, Yield=()> {
|| { loop { yield; } }
}
fn main() {
- let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
- //~^ `impl Trait` only allowed in function and inherent method return types
+ let gens: [impl Coroutine<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-58504.stderr b/tests/ui/impl-trait/issues/issue-58504.stderr
index 26ec2a4f9..49376f559 100644
--- a/tests/ui/impl-trait/issues/issue-58504.stderr
+++ b/tests/ui/impl-trait/issues/issue-58504.stderr
@@ -1,7 +1,7 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-58504.rs:10:16
|
-LL | let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
+LL | let gens: [impl Coroutine<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/issues/issue-58956.rs b/tests/ui/impl-trait/issues/issue-58956.rs
index 68cfcd9ba..5d5566860 100644
--- a/tests/ui/impl-trait/issues/issue-58956.rs
+++ b/tests/ui/impl-trait/issues/issue-58956.rs
@@ -5,9 +5,9 @@ impl Lam for B {}
pub struct Wrap<T>(T);
const _A: impl Lam = {
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
let x: Wrap<impl Lam> = Wrap(B);
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
x.0
};
diff --git a/tests/ui/impl-trait/issues/issue-58956.stderr b/tests/ui/impl-trait/issues/issue-58956.stderr
index 2b4d0abdf..5ee33352a 100644
--- a/tests/ui/impl-trait/issues/issue-58956.stderr
+++ b/tests/ui/impl-trait/issues/issue-58956.stderr
@@ -1,10 +1,10 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/issue-58956.rs:7:11
|
LL | const _A: impl Lam = {
| ^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-58956.rs:9:17
|
LL | let x: Wrap<impl Lam> = Wrap(B);
diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr
index d872291c8..8d969e8e0 100644
--- a/tests/ui/impl-trait/issues/issue-62742.stderr
+++ b/tests/ui/impl-trait/issues/issue-62742.stderr
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
LL | WrongImpl::foo(0i32);
| ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>`
|
- = help: the trait `Raw<[T]>` is implemented for `RawImpl<T>`
+ = help: the trait `Raw<[_]>` is implemented for `RawImpl<_>`
note: required by a bound in `SafeImpl`
--> $DIR/issue-62742.rs:26:35
|
@@ -42,7 +42,8 @@ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied
LL | WrongImpl::<()>::foo(0i32);
| ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>`
|
- = help: the trait `Raw<[T]>` is implemented for `RawImpl<T>`
+ = help: the trait `Raw<[()]>` is implemented for `RawImpl<()>`
+ = help: for that trait implementation, expected `[()]`, found `()`
note: required by a bound in `SafeImpl`
--> $DIR/issue-62742.rs:26:35
|
diff --git a/tests/ui/impl-trait/issues/issue-70971.rs b/tests/ui/impl-trait/issues/issue-70971.rs
index f8ae18bac..c24259a71 100644
--- a/tests/ui/impl-trait/issues/issue-70971.rs
+++ b/tests/ui/impl-trait/issues/issue-70971.rs
@@ -1,4 +1,4 @@
fn main() {
let x : (impl Copy,) = (true,);
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-70971.stderr b/tests/ui/impl-trait/issues/issue-70971.stderr
index d066256bf..5609f8b9b 100644
--- a/tests/ui/impl-trait/issues/issue-70971.stderr
+++ b/tests/ui/impl-trait/issues/issue-70971.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-70971.rs:2:14
|
LL | let x : (impl Copy,) = (true,);
diff --git a/tests/ui/impl-trait/issues/issue-79099.rs b/tests/ui/impl-trait/issues/issue-79099.rs
index da53594f3..22c66491c 100644
--- a/tests/ui/impl-trait/issues/issue-79099.rs
+++ b/tests/ui/impl-trait/issues/issue-79099.rs
@@ -1,7 +1,7 @@
struct Bug {
V1: [(); {
let f: impl core::future::Future<Output = u8> = async { 1 };
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
//~| expected identifier
1
}],
diff --git a/tests/ui/impl-trait/issues/issue-79099.stderr b/tests/ui/impl-trait/issues/issue-79099.stderr
index 580250a62..82fc03c61 100644
--- a/tests/ui/impl-trait/issues/issue-79099.stderr
+++ b/tests/ui/impl-trait/issues/issue-79099.stderr
@@ -9,7 +9,7 @@ LL | let f: impl core::future::Future<Output = u8> = async { 1 };
= help: pass `--edition 2021` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-79099.rs:3:16
|
LL | let f: impl core::future::Future<Output = u8> = async { 1 };
diff --git a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs
index 344f35952..3224145bf 100644
--- a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs
+++ b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.rs
@@ -1,8 +1,8 @@
struct Foo<T = impl Copy>(T);
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
type Result<T, E = impl std::error::Error> = std::result::Result<T, E>;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// should not cause ICE
fn x() -> Foo {
diff --git a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr
index 656bd0470..56be4577d 100644
--- a/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr
+++ b/tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr
@@ -1,10 +1,10 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:1:16
|
LL | struct Foo<T = impl Copy>(T);
| ^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:4:20
|
LL | type Result<T, E = impl std::error::Error> = std::result::Result<T, E>;
diff --git a/tests/ui/impl-trait/issues/issue-84073.stderr b/tests/ui/impl-trait/issues/issue-84073.stderr
index 3c39aa6ce..b4be16ff0 100644
--- a/tests/ui/impl-trait/issues/issue-84073.stderr
+++ b/tests/ui/impl-trait/issues/issue-84073.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `RaceBuilder<T, Never<T>>`
--> $DIR/issue-84073.rs:32:16
|
LL | Race::new(|race| race.when());
- | ^^^^
+ | ^^^^ ---- type must be known at this point
|
help: consider giving this closure parameter an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/impl-trait/issues/issue-84919.rs b/tests/ui/impl-trait/issues/issue-84919.rs
index a0b73743a..77d27d7c0 100644
--- a/tests/ui/impl-trait/issues/issue-84919.rs
+++ b/tests/ui/impl-trait/issues/issue-84919.rs
@@ -3,7 +3,7 @@ impl Trait for () {}
fn foo<'a: 'a>() {
let _x: impl Trait = ();
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
fn main() {}
diff --git a/tests/ui/impl-trait/issues/issue-84919.stderr b/tests/ui/impl-trait/issues/issue-84919.stderr
index 36010fdef..20b131b8b 100644
--- a/tests/ui/impl-trait/issues/issue-84919.stderr
+++ b/tests/ui/impl-trait/issues/issue-84919.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-84919.rs:5:13
|
LL | let _x: impl Trait = ();
diff --git a/tests/ui/impl-trait/issues/issue-86642.rs b/tests/ui/impl-trait/issues/issue-86642.rs
index e6e957714..49f8944ac 100644
--- a/tests/ui/impl-trait/issues/issue-86642.rs
+++ b/tests/ui/impl-trait/issues/issue-86642.rs
@@ -1,5 +1,5 @@
static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
let res = (move |source| Ok(source))(source);
let res = res.or((move |source| Ok(source))(source));
res
diff --git a/tests/ui/impl-trait/issues/issue-86642.stderr b/tests/ui/impl-trait/issues/issue-86642.stderr
index b6f8a54f3..6d3be3fff 100644
--- a/tests/ui/impl-trait/issues/issue-86642.stderr
+++ b/tests/ui/impl-trait/issues/issue-86642.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in const types
--> $DIR/issue-86642.rs:1:11
|
LL | static x: impl Fn(&str) -> Result<&str, ()> = move |source| {
diff --git a/tests/ui/impl-trait/issues/issue-87295.rs b/tests/ui/impl-trait/issues/issue-87295.rs
index aeb8f8332..eb44020ac 100644
--- a/tests/ui/impl-trait/issues/issue-87295.rs
+++ b/tests/ui/impl-trait/issues/issue-87295.rs
@@ -14,5 +14,5 @@ impl<F> Struct<F> {
fn main() {
let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
- //~^ `impl Trait` only allowed in function and inherent method return types
+ //~^ `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/issues/issue-87295.stderr b/tests/ui/impl-trait/issues/issue-87295.stderr
index ec59b719c..3fe4ee73c 100644
--- a/tests/ui/impl-trait/issues/issue-87295.stderr
+++ b/tests/ui/impl-trait/issues/issue-87295.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-87295.rs:16:31
|
LL | let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());
diff --git a/tests/ui/impl-trait/lifetimes.rs b/tests/ui/impl-trait/lifetimes.rs
index 9a9843375..f853117a9 100644
--- a/tests/ui/impl-trait/lifetimes.rs
+++ b/tests/ui/impl-trait/lifetimes.rs
@@ -1,7 +1,7 @@
// run-pass
#![allow(warnings)]
-#![feature(generators)]
+#![feature(coroutines)]
use std::fmt::Debug;
@@ -114,7 +114,7 @@ impl<'unnecessary_lifetime> MyVec {
self.0.iter().flat_map(|inner_vec| inner_vec.iter())
}
- fn generator_doesnt_capture_unnecessary_lifetime<'s: 's>() -> impl Sized {
+ fn coroutine_doesnt_capture_unnecessary_lifetime<'s: 's>() -> impl Sized {
|| yield
}
}
diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
index 33b48b1e9..c60fe08c5 100644
--- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
+++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr
@@ -117,9 +117,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/must_outlive_least_region_or_bound.rs:43:5
|
LL | x
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn ty_param_wont_outlive_static<T:Debug + 'static>(x: T) -> impl Debug + 'static {
| +++++++++
diff --git a/tests/ui/impl-trait/negative-reasoning.stderr b/tests/ui/impl-trait/negative-reasoning.stderr
index 6b8cc9e73..ddce5e7ec 100644
--- a/tests/ui/impl-trait/negative-reasoning.stderr
+++ b/tests/ui/impl-trait/negative-reasoning.stderr
@@ -7,7 +7,7 @@ LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
|
- = note: upstream crates may add a new impl of trait `std::fmt::Debug` for type `OpaqueType` in future versions
+ = note: upstream crates may add a new impl of trait `std::marker::FnPtr` for type `OpaqueType` in future versions
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.rs b/tests/ui/impl-trait/nested-return-type2-tait2.rs
index af8e06630..b7fee1d91 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.rs
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.rs
@@ -1,3 +1,5 @@
+// check-pass
+
#![feature(type_alias_impl_trait)]
trait Duh {}
@@ -17,6 +19,7 @@ impl<R: Duh, F: FnMut() -> R> Trait for F {
type Sendable = impl Send;
type Traitable = impl Trait<Assoc = Sendable>;
+//~^ WARN opaque type `Traitable` does not satisfy its associated type bounds
// The `impl Send` here is then later compared against the inference var
// created, causing the inference var to be set to `impl Send` instead of
@@ -25,7 +28,6 @@ type Traitable = impl Trait<Assoc = Sendable>;
// type does not implement `Duh`, even if its hidden type does. So we error out.
fn foo() -> Traitable {
|| 42
- //~^ ERROR `Sendable: Duh` is not satisfied
}
fn main() {
diff --git a/tests/ui/impl-trait/nested-return-type2-tait2.stderr b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
index 125262b96..790e339c8 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait2.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait2.stderr
@@ -1,18 +1,13 @@
-error[E0277]: the trait bound `Sendable: Duh` is not satisfied
- --> $DIR/nested-return-type2-tait2.rs:27:5
+warning: opaque type `Traitable` does not satisfy its associated type bounds
+ --> $DIR/nested-return-type2-tait2.rs:21:29
|
-LL | || 42
- | ^^^^^ the trait `Duh` is not implemented for `Sendable`
+LL | type Assoc: Duh;
+ | --- this associated type bound is unsatisfied for `Sendable`
+...
+LL | type Traitable = impl Trait<Assoc = Sendable>;
+ | ^^^^^^^^^^^^^^^^
|
- = help: the trait `Duh` is implemented for `i32`
-note: required for `{closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:7}` to implement `Trait`
- --> $DIR/nested-return-type2-tait2.rs:14:31
- |
-LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
- | --- ^^^^^ ^
- | |
- | unsatisfied trait bound introduced here
+ = note: `#[warn(opaque_hidden_inferred_bound)]` on by default
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.rs b/tests/ui/impl-trait/nested-return-type2-tait3.rs
index 74fd8a9dd..eed5c271f 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.rs
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.rs
@@ -1,3 +1,5 @@
+// check-pass
+
#![feature(type_alias_impl_trait)]
trait Duh {}
@@ -16,6 +18,7 @@ impl<R: Duh, F: FnMut() -> R> Trait for F {
}
type Traitable = impl Trait<Assoc = impl Send>;
+//~^ WARN opaque type `Traitable` does not satisfy its associated type bounds
// The `impl Send` here is then later compared against the inference var
// created, causing the inference var to be set to `impl Send` instead of
@@ -24,7 +27,6 @@ type Traitable = impl Trait<Assoc = impl Send>;
// type does not implement `Duh`, even if its hidden type does. So we error out.
fn foo() -> Traitable {
|| 42
- //~^ ERROR `impl Send: Duh` is not satisfied
}
fn main() {
diff --git a/tests/ui/impl-trait/nested-return-type2-tait3.stderr b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
index c2332b6e4..72aa51a23 100644
--- a/tests/ui/impl-trait/nested-return-type2-tait3.stderr
+++ b/tests/ui/impl-trait/nested-return-type2-tait3.stderr
@@ -1,18 +1,17 @@
-error[E0277]: the trait bound `impl Send: Duh` is not satisfied
- --> $DIR/nested-return-type2-tait3.rs:26:5
+warning: opaque type `Traitable` does not satisfy its associated type bounds
+ --> $DIR/nested-return-type2-tait3.rs:20:29
|
-LL | || 42
- | ^^^^^ the trait `Duh` is not implemented for `impl Send`
+LL | type Assoc: Duh;
+ | --- this associated type bound is unsatisfied for `impl Send`
+...
+LL | type Traitable = impl Trait<Assoc = impl Send>;
+ | ^^^^^^^^^^^^^^^^^
|
- = help: the trait `Duh` is implemented for `i32`
-note: required for `{closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:7}` to implement `Trait`
- --> $DIR/nested-return-type2-tait3.rs:14:31
+ = note: `#[warn(opaque_hidden_inferred_bound)]` on by default
+help: add this bound
|
-LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
- | --- ^^^^^ ^
- | |
- | unsatisfied trait bound introduced here
+LL | type Traitable = impl Trait<Assoc = impl Send + Duh>;
+ | +++++
-error: aborting due to previous error
+warning: 1 warning emitted
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/nested_impl_trait.rs b/tests/ui/impl-trait/nested_impl_trait.rs
index e95fab3b6..c036b9e36 100644
--- a/tests/ui/impl-trait/nested_impl_trait.rs
+++ b/tests/ui/impl-trait/nested_impl_trait.rs
@@ -9,7 +9,7 @@ fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
//~^ ERROR nested `impl Trait` is not allowed
-//~| `impl Trait` only allowed in function and inherent method return types
+//~| `impl Trait` only allowed in function and inherent method argument and return types
fn bad_in_arg_position(_: impl Into<impl Debug>) { }
//~^ ERROR nested `impl Trait` is not allowed
diff --git a/tests/ui/impl-trait/nested_impl_trait.stderr b/tests/ui/impl-trait/nested_impl_trait.stderr
index ffe84b8e8..f1cafd958 100644
--- a/tests/ui/impl-trait/nested_impl_trait.stderr
+++ b/tests/ui/impl-trait/nested_impl_trait.stderr
@@ -34,7 +34,7 @@ LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| | nested `impl Trait` here
| outer `impl Trait`
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/nested_impl_trait.rs:10:32
|
LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}
diff --git a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
index 687dbe65e..37c96d9bc 100644
--- a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
+++ b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
@@ -11,6 +11,9 @@ LL | trait NotObjectSafe {
| ------------- this trait cannot be made into an object...
LL | fn foo() -> Self;
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead:
+ A
+ B
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self) -> Self;
@@ -33,6 +36,9 @@ LL | trait NotObjectSafe {
| ------------- this trait cannot be made into an object...
LL | fn foo() -> Self;
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead:
+ A
+ B
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self) -> Self;
diff --git a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
index ee4343b11..234780534 100644
--- a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
+++ b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
@@ -1,9 +1,11 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/opaque-cast-field-access-in-future.rs:22:17
|
LL | fn run() -> Foo<impl Future<Output = ()>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+ |
+ = note: cannot satisfy `_: Future`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/impl-trait/recursive-generator.rs b/tests/ui/impl-trait/recursive-coroutine.rs
index 000af70c4..6351cef95 100644
--- a/tests/ui/impl-trait/recursive-generator.rs
+++ b/tests/ui/impl-trait/recursive-coroutine.rs
@@ -1,16 +1,16 @@
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
-fn foo() -> impl Generator<Yield = (), Return = ()> {
+fn foo() -> impl Coroutine<Yield = (), Return = ()> {
//~^ ERROR cannot resolve opaque type
//~| NOTE recursive opaque type
//~| NOTE in this expansion of desugaring of
|| {
let mut gen = Box::pin(foo());
- //~^ NOTE generator captures itself here
+ //~^ NOTE coroutine captures itself here
let mut r = gen.as_mut().resume(());
- while let GeneratorState::Yielded(v) = r {
+ while let CoroutineState::Yielded(v) = r {
yield v;
r = gen.as_mut().resume(());
}
diff --git a/tests/ui/impl-trait/recursive-generator.stderr b/tests/ui/impl-trait/recursive-coroutine.stderr
index 86e193d95..d36a58a86 100644
--- a/tests/ui/impl-trait/recursive-generator.stderr
+++ b/tests/ui/impl-trait/recursive-coroutine.stderr
@@ -1,11 +1,11 @@
error[E0720]: cannot resolve opaque type
- --> $DIR/recursive-generator.rs:5:13
+ --> $DIR/recursive-coroutine.rs:5:13
|
-LL | fn foo() -> impl Generator<Yield = (), Return = ()> {
+LL | fn foo() -> impl Coroutine<Yield = (), Return = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive opaque type
...
LL | let mut gen = Box::pin(foo());
- | ------- generator captures itself here
+ | ------- coroutine captures itself here
error: aborting due to previous error
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
index ffc0cd9d1..8331eec90 100644
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
+++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.rs
@@ -1,7 +1,7 @@
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden.
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(unconditional_recursion)]
fn option(i: i32) -> impl Sized {
@@ -50,14 +50,14 @@ fn closure_sig() -> impl Sized {
|| closure_sig()
}
-fn generator_sig() -> impl Sized {
+fn coroutine_sig() -> impl Sized {
//~^ ERROR
- || generator_sig()
+ || coroutine_sig()
}
-fn generator_capture() -> impl Sized {
+fn coroutine_capture() -> impl Sized {
//~^ ERROR
- let x = generator_capture();
+ let x = coroutine_capture();
move || {
yield;
x;
@@ -69,10 +69,10 @@ fn substs_change<T: 'static>() -> impl Sized {
(substs_change::<&T>(),)
}
-fn generator_hold() -> impl Sized {
+fn coroutine_hold() -> impl Sized {
//~^ ERROR
move || {
- let x = generator_hold();
+ let x = coroutine_hold();
yield;
x;
}
diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
index 1d919fb52..8e9aa8ad0 100644
--- a/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
+++ b/tests/ui/impl-trait/recursive-impl-trait-type-indirect.stderr
@@ -81,24 +81,24 @@ LL | || closure_sig()
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:53:23
|
-LL | fn generator_sig() -> impl Sized {
+LL | fn coroutine_sig() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
LL |
-LL | || generator_sig()
+LL | || coroutine_sig()
| ------------------ returning here with type `{closure@$DIR/recursive-impl-trait-type-indirect.rs:55:5: 55:7}`
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:58:27
|
-LL | fn generator_capture() -> impl Sized {
+LL | fn coroutine_capture() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
...
LL | / move || {
LL | | yield;
LL | | x;
- | | - generator captures itself here
+ | | - coroutine captures itself here
LL | | }
- | |_____- returning here with type `{generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}`
+ | |_____- returning here with type `{coroutine@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12}`
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:67:35
@@ -112,11 +112,11 @@ LL | (substs_change::<&T>(),)
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:72:24
|
-LL | fn generator_hold() -> impl Sized {
+LL | fn coroutine_hold() -> impl Sized {
| ^^^^^^^^^^ recursive opaque type
...
-LL | let x = generator_hold();
- | - generator captures itself here
+LL | let x = coroutine_hold();
+ | - coroutine captures itself here
error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:86:26
diff --git a/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs b/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs
index 98dbaf036..91a0e0d48 100644
--- a/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs
+++ b/tests/ui/impl-trait/static-lifetime-return-position-impl-trait.rs
@@ -1,7 +1,7 @@
// check-pass
#![allow(incomplete_features)]
-#![feature(adt_const_params, return_position_impl_trait_in_trait)]
+#![feature(adt_const_params)]
pub struct Element;
diff --git a/tests/ui/impl-trait/type_parameters_captured.stderr b/tests/ui/impl-trait/type_parameters_captured.stderr
index fb502cfdd..46859296f 100644
--- a/tests/ui/impl-trait/type_parameters_captured.stderr
+++ b/tests/ui/impl-trait/type_parameters_captured.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/type_parameters_captured.rs:8:5
|
LL | x
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn foo<T: 'static>(x: T) -> impl Any + 'static {
| +++++++++
diff --git a/tests/ui/impl-trait/unactionable_diagnostic.fixed b/tests/ui/impl-trait/unactionable_diagnostic.fixed
index 6c2505177..d446512ff 100644
--- a/tests/ui/impl-trait/unactionable_diagnostic.fixed
+++ b/tests/ui/impl-trait/unactionable_diagnostic.fixed
@@ -14,7 +14,7 @@ fn foo<'x, P>(
}
pub fn bar<'t, T: 't>(
- //~^ HELP: consider adding an explicit lifetime bound...
+ //~^ HELP: consider adding an explicit lifetime bound
post: T,
x: &'t Foo,
) -> &'t impl Trait {
diff --git a/tests/ui/impl-trait/unactionable_diagnostic.rs b/tests/ui/impl-trait/unactionable_diagnostic.rs
index bce35cbdd..76b9a62ca 100644
--- a/tests/ui/impl-trait/unactionable_diagnostic.rs
+++ b/tests/ui/impl-trait/unactionable_diagnostic.rs
@@ -14,7 +14,7 @@ fn foo<'x, P>(
}
pub fn bar<'t, T>(
- //~^ HELP: consider adding an explicit lifetime bound...
+ //~^ HELP: consider adding an explicit lifetime bound
post: T,
x: &'t Foo,
) -> &'t impl Trait {
diff --git a/tests/ui/impl-trait/unactionable_diagnostic.stderr b/tests/ui/impl-trait/unactionable_diagnostic.stderr
index a32004cda..4df7f45c3 100644
--- a/tests/ui/impl-trait/unactionable_diagnostic.stderr
+++ b/tests/ui/impl-trait/unactionable_diagnostic.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/unactionable_diagnostic.rs:21:5
|
+LL | pub fn bar<'t, T>(
+ | -- the parameter type `T` must be valid for the lifetime `'t` as defined here...
+...
LL | foo(post, x)
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | pub fn bar<'t, T: 't>(
| ++++
diff --git a/tests/ui/impl-trait/universal-mismatched-type.stderr b/tests/ui/impl-trait/universal-mismatched-type.stderr
index a56e542d8..82e0f2396 100644
--- a/tests/ui/impl-trait/universal-mismatched-type.stderr
+++ b/tests/ui/impl-trait/universal-mismatched-type.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn foo(x: impl Debug) -> String {
| ---------- ------ expected `String` because of return type
| |
- | this type parameter
+ | found this type parameter
LL | x
| ^ expected `String`, found type parameter `impl Debug`
|
diff --git a/tests/ui/impl-trait/where-allowed-2.stderr b/tests/ui/impl-trait/where-allowed-2.stderr
index 2b328c01c..b3765ac1a 100644
--- a/tests/ui/impl-trait/where-allowed-2.stderr
+++ b/tests/ui/impl-trait/where-allowed-2.stderr
@@ -1,9 +1,11 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/where-allowed-2.rs:3:30
|
LL | fn in_adt_in_return() -> Vec<impl Debug> { panic!() }
| ^^^^^^^^^^ cannot infer type
+ |
+ = note: cannot satisfy `_: Debug`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/impl-trait/where-allowed.rs b/tests/ui/impl-trait/where-allowed.rs
index 509d27166..158dc5ab9 100644
--- a/tests/ui/impl-trait/where-allowed.rs
+++ b/tests/ui/impl-trait/where-allowed.rs
@@ -16,47 +16,47 @@ fn in_adt_in_parameters(_: Vec<impl Debug>) { panic!() }
// Disallowed
fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Allowed
fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
// Disallowed
fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~^^ ERROR nested `impl Trait` is not allowed
// Disallowed
fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~| ERROR nested `impl Trait` is not allowed
// Allowed
@@ -64,11 +64,11 @@ fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!()
// Disallowed
fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Allowed
@@ -81,22 +81,22 @@ fn in_impl_Trait_in_return() -> impl IntoIterator<Item = impl IntoIterator> {
// Disallowed
struct InBraceStructField { x: impl Debug }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
struct InAdtInBraceStructField { x: Vec<impl Debug> }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
struct InTupleStructField(impl Debug);
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
enum InEnum {
InBraceVariant { x: impl Debug },
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
InTupleVariant(impl Debug),
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Allowed
@@ -104,10 +104,9 @@ trait InTraitDefnParameters {
fn in_parameters(_: impl Debug);
}
-// Disallowed
+// Allowed
trait InTraitDefnReturn {
fn in_return() -> impl Debug;
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
}
// Allowed and disallowed in trait impls
@@ -124,7 +123,7 @@ impl DummyTrait for () {
// Allowed
fn in_trait_impl_return() -> impl Debug { () }
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ // Allowed
}
// Allowed
@@ -137,10 +136,10 @@ impl DummyType {
// Disallowed
extern "C" {
fn in_foreign_parameters(_: impl Debug);
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
fn in_foreign_return() -> impl Debug;
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Allowed
@@ -156,97 +155,97 @@ type InTypeAlias<R> = impl Debug;
//~^ ERROR `impl Trait` in type aliases is unstable
type InReturnInTypeAlias<R> = fn() -> impl Debug;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~| ERROR `impl Trait` in type aliases is unstable
// Disallowed in impl headers
impl PartialEq<impl Debug> for () {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in impl headers
impl PartialEq<()> for impl Debug {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in inherent impls
impl impl Debug {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in inherent impls
struct InInherentImplAdt<T> { t: T }
impl InInherentImplAdt<impl Debug> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
// Disallowed in where clauses
fn in_fn_where_clause()
where impl Debug: Debug
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed in where clauses
fn in_adt_in_fn_where_clause()
where Vec<impl Debug>: Debug
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
fn in_trait_parameter_in_fn_where_clause<T>()
where T: PartialEq<impl Debug>
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
fn in_Fn_parameter_in_fn_where_clause<T>()
where T: Fn(impl Debug)
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
fn in_Fn_return_in_fn_where_clause<T>()
where T: Fn() -> impl Debug
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
{
}
// Disallowed
struct InStructGenericParamDefault<T = impl Debug>(T);
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
trait InTraitGenericParamDefault<T = impl Debug> {}
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
type InTypeAliasGenericParamDefault<T = impl Debug> = T;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
// Disallowed
impl <T = impl Debug> T {}
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~| WARNING this was previously accepted by the compiler but is being phased out
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
//~| ERROR no nominal type found
// Disallowed
fn in_method_generic_param_default<T = impl Debug>(_: T) {}
//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~| WARNING this was previously accepted by the compiler but is being phased out
-//~| ERROR `impl Trait` only allowed in function and inherent method return types
+//~| ERROR `impl Trait` only allowed in function and inherent method argument and return types
fn main() {
let _in_local_variable: impl Fn() = || {};
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
let _in_return_in_local_variable = || -> impl Fn() { || {} };
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr
index 3e2934379..2d8895030 100644
--- a/tests/ui/impl-trait/where-allowed.stderr
+++ b/tests/ui/impl-trait/where-allowed.stderr
@@ -17,7 +17,7 @@ LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic
| outer `impl Trait`
error[E0658]: `impl Trait` in associated types is unstable
- --> $DIR/where-allowed.rs:120:16
+ --> $DIR/where-allowed.rs:119:16
|
LL | type Out = impl Debug;
| ^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | type Out = impl Debug;
= help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
- --> $DIR/where-allowed.rs:155:23
+ --> $DIR/where-allowed.rs:154:23
|
LL | type InTypeAlias<R> = impl Debug;
| ^^^^^^^^^^
@@ -35,7 +35,7 @@ LL | type InTypeAlias<R> = impl Debug;
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0658]: `impl Trait` in type aliases is unstable
- --> $DIR/where-allowed.rs:158:39
+ --> $DIR/where-allowed.rs:157:39
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^
@@ -43,248 +43,230 @@ LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
--> $DIR/where-allowed.rs:18:40
|
LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/where-allowed.rs:22:42
|
LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer params
--> $DIR/where-allowed.rs:26:38
|
LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/where-allowed.rs:30:40
|
LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:34:49
|
LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/where-allowed.rs:38:51
|
LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:42:55
|
LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:49:51
|
LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/where-allowed.rs:54:53
|
LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:58:57
|
LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
--> $DIR/where-allowed.rs:66:38
|
LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
--> $DIR/where-allowed.rs:70:40
|
LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:83:32
|
LL | struct InBraceStructField { x: impl Debug }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:87:41
|
LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:91:27
|
LL | struct InTupleStructField(impl Debug);
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:96:25
|
LL | InBraceVariant { x: impl Debug },
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in field types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in field types
--> $DIR/where-allowed.rs:98:20
|
LL | InTupleVariant(impl Debug),
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
- --> $DIR/where-allowed.rs:109:23
- |
-LL | fn in_return() -> impl Debug;
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
- --> $DIR/where-allowed.rs:126:34
- |
-LL | fn in_trait_impl_return() -> impl Debug { () }
- | ^^^^^^^^^^
- |
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
-
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` params
- --> $DIR/where-allowed.rs:139:33
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` params
+ --> $DIR/where-allowed.rs:138:33
|
LL | fn in_foreign_parameters(_: impl Debug);
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `extern fn` return types
- --> $DIR/where-allowed.rs:142:31
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `extern fn` return types
+ --> $DIR/where-allowed.rs:141:31
|
LL | fn in_foreign_return() -> impl Debug;
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
- --> $DIR/where-allowed.rs:158:39
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
+ --> $DIR/where-allowed.rs:157:39
|
LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in traits
- --> $DIR/where-allowed.rs:163:16
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in traits
+ --> $DIR/where-allowed.rs:162:16
|
LL | impl PartialEq<impl Debug> for () {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
- --> $DIR/where-allowed.rs:168:24
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
+ --> $DIR/where-allowed.rs:167:24
|
LL | impl PartialEq<()> for impl Debug {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
- --> $DIR/where-allowed.rs:173:6
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
+ --> $DIR/where-allowed.rs:172:6
|
LL | impl impl Debug {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
- --> $DIR/where-allowed.rs:179:24
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in impl headers
+ --> $DIR/where-allowed.rs:178:24
|
LL | impl InInherentImplAdt<impl Debug> {
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
- --> $DIR/where-allowed.rs:185:11
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
+ --> $DIR/where-allowed.rs:184:11
|
LL | where impl Debug: Debug
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
- --> $DIR/where-allowed.rs:192:15
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
+ --> $DIR/where-allowed.rs:191:15
|
LL | where Vec<impl Debug>: Debug
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in bounds
- --> $DIR/where-allowed.rs:199:24
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in bounds
+ --> $DIR/where-allowed.rs:198:24
|
LL | where T: PartialEq<impl Debug>
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait params
- --> $DIR/where-allowed.rs:206:17
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait params
+ --> $DIR/where-allowed.rs:205:17
|
LL | where T: Fn(impl Debug)
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
- --> $DIR/where-allowed.rs:213:22
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `Fn` trait return types
+ --> $DIR/where-allowed.rs:212:22
|
LL | where T: Fn() -> impl Debug
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:219:40
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:218:40
|
LL | struct InStructGenericParamDefault<T = impl Debug>(T);
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:223:36
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:222:36
|
LL | enum InEnumGenericParamDefault<T = impl Debug> { Variant(T) }
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:227:38
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:226:38
|
LL | trait InTraitGenericParamDefault<T = impl Debug> {}
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:231:41
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:230:41
|
LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:235:11
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:234:11
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
- --> $DIR/where-allowed.rs:242:40
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generic parameter defaults
+ --> $DIR/where-allowed.rs:241:40
|
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
| ^^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
- --> $DIR/where-allowed.rs:248:29
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
+ --> $DIR/where-allowed.rs:247:29
|
LL | let _in_local_variable: impl Fn() = || {};
| ^^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in closure return types
- --> $DIR/where-allowed.rs:250:46
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in closure return types
+ --> $DIR/where-allowed.rs:249:46
|
LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
| ^^^^^^^^^
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
- --> $DIR/where-allowed.rs:235:7
+ --> $DIR/where-allowed.rs:234:7
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^^^^^
@@ -294,7 +276,7 @@ LL | impl <T = impl Debug> T {}
= note: `#[deny(invalid_type_param_default)]` on by default
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
- --> $DIR/where-allowed.rs:242:36
+ --> $DIR/where-allowed.rs:241:36
|
LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
| ^^^^^^^^^^^^^^
@@ -303,14 +285,14 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
error[E0118]: no nominal type found for inherent implementation
- --> $DIR/where-allowed.rs:235:1
+ --> $DIR/where-allowed.rs:234:1
|
LL | impl <T = impl Debug> T {}
| ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
|
= note: either implement a trait on it or create a newtype to wrap it instead
-error: aborting due to 47 previous errors
+error: aborting due to 45 previous errors
Some errors have detailed explanations: E0118, E0562, E0658, E0666.
For more information about an error, try `rustc --explain E0118`.
diff --git a/tests/ui/impl-unused-tps.rs b/tests/ui/impl-unused-tps.rs
index 7cc1ae613..3eb9daedf 100644
--- a/tests/ui/impl-unused-tps.rs
+++ b/tests/ui/impl-unused-tps.rs
@@ -1,3 +1,5 @@
+//~ ERROR overflow evaluating the requirement `([isize; 0], _): Sized
+
trait Foo<A> {
fn get(&self, A: &A) { }
}
@@ -23,8 +25,7 @@ impl<T:Bar<Out=U>,U> Foo<T> for [isize;3] {
}
impl<T,U> Foo<T> for U {
- // OK, T, U are used everywhere. Note that the coherence check
- // hasn't executed yet, so no errors about overlap.
+ //~^ ERROR conflicting implementations of trait `Foo<_>` for type `[isize; 0]`
}
impl<T,U> Bar for T {
diff --git a/tests/ui/impl-unused-tps.stderr b/tests/ui/impl-unused-tps.stderr
index 053ab91c8..93215326c 100644
--- a/tests/ui/impl-unused-tps.stderr
+++ b/tests/ui/impl-unused-tps.stderr
@@ -1,33 +1,56 @@
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:13:8
+ --> $DIR/impl-unused-tps.rs:15:8
|
LL | impl<T,U> Foo<T> for [isize;1] {
| ^ unconstrained type parameter
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:30:8
+ --> $DIR/impl-unused-tps.rs:31:8
|
LL | impl<T,U> Bar for T {
| ^ unconstrained type parameter
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:38:8
+ --> $DIR/impl-unused-tps.rs:39:8
|
LL | impl<T,U> Bar for T
| ^ unconstrained type parameter
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:46:8
+ --> $DIR/impl-unused-tps.rs:47:8
|
LL | impl<T,U,V> Foo<T> for T
| ^ unconstrained type parameter
error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates
- --> $DIR/impl-unused-tps.rs:46:10
+ --> $DIR/impl-unused-tps.rs:47:10
|
LL | impl<T,U,V> Foo<T> for T
| ^ unconstrained type parameter
-error: aborting due to 5 previous errors
+error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]`
+ --> $DIR/impl-unused-tps.rs:27:1
+ |
+LL | impl<T> Foo<T> for [isize;0] {
+ | ---------------------------- first implementation here
+...
+LL | impl<T,U> Foo<T> for U {
+ | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]`
+
+error[E0275]: overflow evaluating the requirement `([isize; 0], _): Sized`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_unused_tps`)
+note: required for `([isize; 0], _)` to implement `Bar`
+ --> $DIR/impl-unused-tps.rs:31:11
+ |
+LL | impl<T,U> Bar for T {
+ | - ^^^ ^
+ | |
+ | unsatisfied trait bound introduced here
+ = note: 126 redundant requirements hidden
+ = note: required for `([isize; 0], _)` to implement `Bar`
+
+error: aborting due to 7 previous errors
-For more information about this error, try `rustc --explain E0207`.
+Some errors have detailed explanations: E0119, E0207, E0275.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/implied-bounds/issue-100690.rs b/tests/ui/implied-bounds/issue-100690.rs
index 5599cd410..ea33c9f42 100644
--- a/tests/ui/implied-bounds/issue-100690.rs
+++ b/tests/ui/implied-bounds/issue-100690.rs
@@ -35,8 +35,8 @@ impl<'a, T: 'a> Handle<'a, T, UIView<'a, T>, Result<(), io::Error>> for TUIHandl
F: FnOnce(&mut UIView<'a, T>) -> Result<(), io::Error> + Send + 'static,
{
real_dispatch(f)
- //~^ ERROR expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
- //~| NOTE expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
+ //~^ ERROR expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
+ //~| NOTE expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
//~| NOTE expected a closure with arguments
//~| NOTE required by a bound introduced by this call
}
diff --git a/tests/ui/implied-bounds/issue-100690.stderr b/tests/ui/implied-bounds/issue-100690.stderr
index dba035337..ac9f7ab25 100644
--- a/tests/ui/implied-bounds/issue-100690.stderr
+++ b/tests/ui/implied-bounds/issue-100690.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
+error[E0277]: expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
--> $DIR/issue-100690.rs:37:23
|
LL | real_dispatch(f)
- | ------------- ^ expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
+ | ------------- ^ expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/imports/ambiguous-9.stderr b/tests/ui/imports/ambiguous-9.stderr
index 6c7d79174..2731ed2ba 100644
--- a/tests/ui/imports/ambiguous-9.stderr
+++ b/tests/ui/imports/ambiguous-9.stderr
@@ -60,6 +60,7 @@ note: `date_range` could also refer to the function imported here
LL | use prelude::*;
| ^^^^^^^^^^
= help: consider adding an explicit import of `date_range` to disambiguate
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 4 warnings emitted
diff --git a/tests/ui/imports/issue-28134.stderr b/tests/ui/imports/issue-28134.stderr
index 33cb53f20..5315c2e9f 100644
--- a/tests/ui/imports/issue-28134.stderr
+++ b/tests/ui/imports/issue-28134.stderr
@@ -14,8 +14,9 @@ LL | #![test]
|
help: perhaps you meant to use an outer attribute
|
-LL | #[test]
- | ~~~~~~~
+LL - #![test]
+LL + #[test]
+ |
error: aborting due to 2 previous errors
diff --git a/tests/ui/imports/issue-55457.stderr b/tests/ui/imports/issue-55457.stderr
index 788fcc830..30d237365 100644
--- a/tests/ui/imports/issue-55457.stderr
+++ b/tests/ui/imports/issue-55457.stderr
@@ -38,6 +38,7 @@ LL | #[derive(NonExistent)]
| ^^^^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot determine resolution for the derive macro `NonExistent`
--> $DIR/issue-55457.rs:5:10
@@ -46,6 +47,7 @@ LL | #[derive(NonExistent)]
| ^^^^^^^^^^^
|
= note: import resolution is stuck, try simplifying macro imports
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/imports/issue-56125.stderr b/tests/ui/imports/issue-56125.stderr
index 15477fb6f..d2a0f436c 100644
--- a/tests/ui/imports/issue-56125.stderr
+++ b/tests/ui/imports/issue-56125.stderr
@@ -6,14 +6,14 @@ LL | use empty::issue_56125;
|
help: consider importing one of these items instead
|
+LL | use ::issue_56125::issue_56125;
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL | use ::issue_56125::last_segment::issue_56125;
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL | use ::issue_56125::non_last_segment::non_last_segment::issue_56125;
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | use crate::m3::last_segment::issue_56125;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | use crate::m3::non_last_segment::non_last_segment::issue_56125;
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | use issue_56125::issue_56125;
- | ~~~~~~~~~~~~~~~~~~~~~~~~
-LL | use issue_56125::last_segment::issue_56125;
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and 1 other candidate
error[E0659]: `issue_56125` is ambiguous
diff --git a/tests/ui/imports/pub-reexport-empty.rs b/tests/ui/imports/pub-reexport-empty.rs
new file mode 100644
index 000000000..2a46f4c8d
--- /dev/null
+++ b/tests/ui/imports/pub-reexport-empty.rs
@@ -0,0 +1,25 @@
+#![deny(unused_imports)]
+
+mod a {}
+
+pub use a::*;
+//~^ ERROR: unused import: `a::*`
+
+mod b {
+ mod c {
+ #[derive(Clone)]
+ pub struct D;
+ }
+ pub use self::c::*; // don't show unused import lint
+}
+
+pub use b::*; // don't show unused import lint
+
+mod d {
+ const D: i32 = 1;
+}
+
+pub use d::*;
+//~^ ERROR: unused import: `d::*`
+
+fn main() {}
diff --git a/tests/ui/imports/pub-reexport-empty.stderr b/tests/ui/imports/pub-reexport-empty.stderr
new file mode 100644
index 000000000..813b2ef71
--- /dev/null
+++ b/tests/ui/imports/pub-reexport-empty.stderr
@@ -0,0 +1,20 @@
+error: unused import: `a::*`
+ --> $DIR/pub-reexport-empty.rs:5:9
+ |
+LL | pub use a::*;
+ | ^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/pub-reexport-empty.rs:1:9
+ |
+LL | #![deny(unused_imports)]
+ | ^^^^^^^^^^^^^^
+
+error: unused import: `d::*`
+ --> $DIR/pub-reexport-empty.rs:22:9
+ |
+LL | pub use d::*;
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/imports/reexports.rs b/tests/ui/imports/reexports.rs
index d76cc41be..cb1a3ebe1 100644
--- a/tests/ui/imports/reexports.rs
+++ b/tests/ui/imports/reexports.rs
@@ -5,9 +5,12 @@ mod a {
mod foo {}
mod a {
- pub use super::foo; //~ ERROR cannot be re-exported
+ pub use super::foo;
+ //~^ ERROR cannot be re-exported
+ //~| WARNING unused import: `super::foo`
pub use super::*;
//~^ WARNING glob import doesn't reexport anything because no candidate is public enough
+ //~| WARNING unused import: `super::*`
}
}
diff --git a/tests/ui/imports/reexports.stderr b/tests/ui/imports/reexports.stderr
index 8cbff0ac7..401e422af 100644
--- a/tests/ui/imports/reexports.stderr
+++ b/tests/ui/imports/reexports.stderr
@@ -11,44 +11,44 @@ LL | pub use super::foo;
| ^^^^^^^^^^
error[E0603]: module import `foo` is private
- --> $DIR/reexports.rs:33:15
+ --> $DIR/reexports.rs:36:15
|
LL | use b::a::foo::S;
| ^^^ private module import
|
note: the module import `foo` is defined here...
- --> $DIR/reexports.rs:21:17
+ --> $DIR/reexports.rs:24:17
|
LL | pub use super::foo; // This is OK since the value `foo` is visible enough.
| ^^^^^^^^^^
note: ...and refers to the module `foo` which is defined here
- --> $DIR/reexports.rs:16:5
+ --> $DIR/reexports.rs:19:5
|
LL | mod foo {
| ^^^^^^^
error[E0603]: module import `foo` is private
- --> $DIR/reexports.rs:34:15
+ --> $DIR/reexports.rs:37:15
|
LL | use b::b::foo::S as T;
| ^^^ private module import
|
note: the module import `foo` is defined here...
- --> $DIR/reexports.rs:26:17
+ --> $DIR/reexports.rs:29:17
|
LL | pub use super::*; // This is also OK since the value `foo` is visible enough.
| ^^^^^^^^
note: ...and refers to the module `foo` which is defined here
- --> $DIR/reexports.rs:16:5
+ --> $DIR/reexports.rs:19:5
|
LL | mod foo {
| ^^^^^^^
-warning: glob import doesn't reexport anything because no candidate is public enough
- --> $DIR/reexports.rs:9:17
+warning: unused import: `super::foo`
+ --> $DIR/reexports.rs:8:17
|
-LL | pub use super::*;
- | ^^^^^^^^
+LL | pub use super::foo;
+ | ^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/reexports.rs:1:9
@@ -56,7 +56,19 @@ note: the lint level is defined here
LL | #![warn(unused_imports)]
| ^^^^^^^^^^^^^^
-error: aborting due to 3 previous errors; 1 warning emitted
+warning: glob import doesn't reexport anything because no candidate is public enough
+ --> $DIR/reexports.rs:11:17
+ |
+LL | pub use super::*;
+ | ^^^^^^^^
+
+warning: unused import: `super::*`
+ --> $DIR/reexports.rs:11:17
+ |
+LL | pub use super::*;
+ | ^^^^^^^^
+
+error: aborting due to 3 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0364, E0603.
For more information about an error, try `rustc --explain E0364`.
diff --git a/tests/ui/indexing/index-help.stderr b/tests/ui/indexing/index-help.stderr
index e020d0298..2cb212a01 100644
--- a/tests/ui/indexing/index-help.stderr
+++ b/tests/ui/indexing/index-help.stderr
@@ -5,7 +5,8 @@ LL | x[0i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i32`
= note: required for `Vec<{integer}>` to implement `Index<i32>`
error: aborting due to previous error
diff --git a/tests/ui/indexing/indexing-requires-a-uint.stderr b/tests/ui/indexing/indexing-requires-a-uint.stderr
index 7a741cfc7..6ea6bb600 100644
--- a/tests/ui/indexing/indexing-requires-a-uint.stderr
+++ b/tests/ui/indexing/indexing-requires-a-uint.stderr
@@ -5,7 +5,8 @@ LL | [0][0u8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u8`
= note: required for `[{integer}]` to implement `Index<u8>`
error[E0308]: mismatched types
diff --git a/tests/ui/inference/cannot-infer-closure-circular.stderr b/tests/ui/inference/cannot-infer-closure-circular.stderr
index b706cd2bc..98639f307 100644
--- a/tests/ui/inference/cannot-infer-closure-circular.stderr
+++ b/tests/ui/inference/cannot-infer-closure-circular.stderr
@@ -3,6 +3,9 @@ error[E0282]: type annotations needed for `Result<(), E>`
|
LL | let x = |r| {
| ^
+LL | let v = r?;
+LL | Ok(v)
+ | ----- type must be known at this point
|
help: consider giving this closure parameter an explicit type, where the type for type parameter `E` is specified
|
diff --git a/tests/ui/inference/issue-104649.stderr b/tests/ui/inference/issue-104649.stderr
index 4962b21f9..281932927 100644
--- a/tests/ui/inference/issue-104649.stderr
+++ b/tests/ui/inference/issue-104649.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `A<std::result::Result<std::result::Re
--> $DIR/issue-104649.rs:24:9
|
LL | let a = A(Result::Ok(Result::Ok(())));
- | ^
+ | ^ -------------- type must be known at this point
|
help: consider giving `a` an explicit type, where the type for type parameter `E` is specified
|
diff --git a/tests/ui/inference/issue-107090.rs b/tests/ui/inference/issue-107090.rs
index a22e12c6d..799c36418 100644
--- a/tests/ui/inference/issue-107090.rs
+++ b/tests/ui/inference/issue-107090.rs
@@ -2,8 +2,8 @@ use std::marker::PhantomData;
struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>)
where
Foo<'short, 'out, T>: Convert<'a, 'b>;
- //~^ ERROR use of undeclared lifetime name
- //~| ERROR use of undeclared lifetime name `'out`
+//~^ ERROR use of undeclared lifetime name
+//~| ERROR use of undeclared lifetime name `'out`
trait Convert<'a, 'b>: Sized {
fn cast(&'a self) -> &'b Self;
@@ -19,7 +19,7 @@ impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> {
fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
//~^ ERROR use of undeclared lifetime name
- sadness.cast() //~ ERROR mismatched types
+ sadness.cast()
}
fn main() {}
diff --git a/tests/ui/inference/issue-107090.stderr b/tests/ui/inference/issue-107090.stderr
index 6233b629a..e509e262f 100644
--- a/tests/ui/inference/issue-107090.stderr
+++ b/tests/ui/inference/issue-107090.stderr
@@ -66,19 +66,6 @@ LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short,
| |
| help: consider introducing lifetime `'short` here: `'short,`
-error[E0308]: mismatched types
- --> $DIR/issue-107090.rs:22:5
- |
-LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
- | - this type parameter ------- expected `&'out T` because of return type
-LL |
-LL | sadness.cast()
- | ^^^^^^^^^^^^^^ expected `&T`, found `&Foo<'_, '_, T>`
- |
- = note: expected reference `&'out T`
- found reference `&Foo<'_, '_, T>`
-
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0261, E0308.
-For more information about an error, try `rustc --explain E0261`.
+For more information about this error, try `rustc --explain E0261`.
diff --git a/tests/ui/inference/issue-71584.rs b/tests/ui/inference/issue-71584.rs
index 7bf3ed60e..c96c32d5c 100644
--- a/tests/ui/inference/issue-71584.rs
+++ b/tests/ui/inference/issue-71584.rs
@@ -1,3 +1,4 @@
+// ignore-windows different list of satisfying impls
fn main() {
let n: u32 = 1;
let mut d: u64 = 2;
diff --git a/tests/ui/inference/issue-71584.stderr b/tests/ui/inference/issue-71584.stderr
index 6ddb76573..22c0f113d 100644
--- a/tests/ui/inference/issue-71584.stderr
+++ b/tests/ui/inference/issue-71584.stderr
@@ -1,5 +1,5 @@
error[E0284]: type annotations needed
- --> $DIR/issue-71584.rs:4:15
+ --> $DIR/issue-71584.rs:5:15
|
LL | d = d % n.into();
| - ^^^^
diff --git a/tests/ui/inference/issue-72690.stderr b/tests/ui/inference/issue-72690.stderr
index 225558805..6c93241ea 100644
--- a/tests/ui/inference/issue-72690.stderr
+++ b/tests/ui/inference/issue-72690.stderr
@@ -24,16 +24,15 @@ help: try using a fully qualified path to specify the expected types
LL | String::from(<str as AsRef<T>>::as_ref("x"));
| ++++++++++++++++++++++++++ ~
-error[E0282]: type annotations needed
- --> $DIR/issue-72690.rs:12:6
+error[E0283]: type annotations needed
+ --> $DIR/issue-72690.rs:12:9
|
LL | |x| String::from("x".as_ref());
- | ^
- |
-help: consider giving this closure parameter an explicit type
+ | ^^^^^^ cannot infer type for reference `&_`
|
-LL | |x: /* Type */| String::from("x".as_ref());
- | ++++++++++++
+ = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate:
+ - impl From<&String> for String;
+ - impl From<&str> for String;
error[E0283]: type annotations needed
--> $DIR/issue-72690.rs:12:26
@@ -225,5 +224,4 @@ LL | String::from(<str as AsRef<T>>::as_ref("x"));
error: aborting due to 17 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.rs b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.rs
new file mode 100644
index 000000000..4544c898a
--- /dev/null
+++ b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.rs
@@ -0,0 +1,61 @@
+struct MyError;
+
+fn foo(x: bool) -> Result<(), MyError> {
+ if x {
+ Err(MyError);
+ //~^ ERROR type annotations needed
+ }
+
+ Ok(())
+}
+
+fn bar(x: bool) -> Result<(), MyError> {
+ if x {
+ Ok(());
+ //~^ ERROR type annotations needed
+ }
+
+ Ok(())
+}
+
+fn baz(x: bool) -> Result<(), MyError> {
+ //~^ ERROR mismatched types
+ if x {
+ 1;
+ }
+
+ Err(MyError);
+}
+
+fn error() -> Result<(), MyError> {
+ Err(MyError)
+}
+
+fn bak(x: bool) -> Result<(), MyError> {
+ if x {
+ //~^ ERROR mismatched types
+ error();
+ } else {
+ //~^ ERROR mismatched types
+ error();
+ }
+}
+
+fn bad(x: bool) -> Result<(), MyError> {
+ Err(MyError); //~ ERROR type annotations needed
+ Ok(())
+}
+
+fn with_closure<F, A, B>(_: F) -> i32
+where
+ F: FnOnce(A, B),
+{
+ 0
+}
+
+fn a() -> i32 {
+ with_closure(|x: u32, y| {}); //~ ERROR type annotations needed
+ 0
+}
+
+fn main() {}
diff --git a/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr
new file mode 100644
index 000000000..1fea73529
--- /dev/null
+++ b/tests/ui/inference/issue-86094-suggest-add-return-to-coerce-ret-ty.stderr
@@ -0,0 +1,98 @@
+error[E0282]: type annotations needed
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:5:9
+ |
+LL | Err(MyError);
+ | ^^^ cannot infer type of the type parameter `T` declared on the enum `Result`
+ |
+help: consider specifying the generic arguments
+ |
+LL | Err::<T, MyError>(MyError);
+ | ++++++++++++++
+help: you might have meant to return this to infer its type parameters
+ |
+LL | return Err(MyError);
+ | ++++++
+
+error[E0282]: type annotations needed
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:14:9
+ |
+LL | Ok(());
+ | ^^ cannot infer type of the type parameter `E` declared on the enum `Result`
+ |
+help: consider specifying the generic arguments
+ |
+LL | Ok::<(), E>(());
+ | +++++++++
+help: you might have meant to return this to infer its type parameters
+ |
+LL | return Ok(());
+ | ++++++
+
+error[E0308]: mismatched types
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:21:20
+ |
+LL | fn baz(x: bool) -> Result<(), MyError> {
+ | --- ^^^^^^^^^^^^^^^^^^^ expected `Result<(), MyError>`, found `()`
+ | |
+ | implicitly returns `()` as its body has no tail or `return` expression
+...
+LL | Err(MyError);
+ | - help: remove this semicolon to return this value
+ |
+ = note: expected enum `Result<(), MyError>`
+ found unit type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:35:10
+ |
+LL | if x {
+ | __________^
+LL | |
+LL | | error();
+ | | - help: remove this semicolon to return this value
+LL | | } else {
+ | |_____^ expected `Result<(), MyError>`, found `()`
+ |
+ = note: expected enum `Result<(), MyError>`
+ found unit type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:38:12
+ |
+LL | } else {
+ | ____________^
+LL | |
+LL | | error();
+ | | - help: remove this semicolon to return this value
+LL | | }
+ | |_____^ expected `Result<(), MyError>`, found `()`
+ |
+ = note: expected enum `Result<(), MyError>`
+ found unit type `()`
+
+error[E0282]: type annotations needed
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:45:5
+ |
+LL | Err(MyError);
+ | ^^^ cannot infer type of the type parameter `T` declared on the enum `Result`
+ |
+help: consider specifying the generic arguments
+ |
+LL | Err::<T, MyError>(MyError);
+ | ++++++++++++++
+
+error[E0282]: type annotations needed
+ --> $DIR/issue-86094-suggest-add-return-to-coerce-ret-ty.rs:57:27
+ |
+LL | with_closure(|x: u32, y| {});
+ | ^
+ |
+help: consider giving this closure parameter an explicit type
+ |
+LL | with_closure(|x: u32, y: /* Type */| {});
+ | ++++++++++++
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0282, E0308.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/inference/multiple-impl-apply.rs b/tests/ui/inference/multiple-impl-apply.rs
new file mode 100644
index 000000000..314fe0f2a
--- /dev/null
+++ b/tests/ui/inference/multiple-impl-apply.rs
@@ -0,0 +1,48 @@
+struct Foo {
+ inner: u32,
+}
+
+struct Bar {
+ inner: u32,
+}
+
+#[derive(Clone, Copy)]
+struct Baz {
+ inner: u32,
+}
+
+impl From<Baz> for Bar {
+ fn from(other: Baz) -> Self {
+ Self {
+ inner: other.inner,
+ }
+ }
+}
+
+impl From<Baz> for Foo {
+ fn from(other: Baz) -> Self {
+ Self {
+ inner: other.inner,
+ }
+ }
+}
+
+fn main() {
+ let x: Baz = Baz { inner: 42 };
+
+ // DOESN'T Compile: Multiple options!
+ let y = x.into(); //~ ERROR E0283
+
+ let y_1: Foo = x.into();
+ let y_2: Bar = x.into();
+
+ let z_1 = Foo::from(y_1);
+ let z_2 = Bar::from(y_2);
+
+ // No type annotations needed, the compiler KNOWS the type must be `Foo`!
+ let m = magic_foo(x);
+}
+
+fn magic_foo(arg: Baz) -> Foo {
+ arg.into()
+}
diff --git a/tests/ui/inference/multiple-impl-apply.stderr b/tests/ui/inference/multiple-impl-apply.stderr
new file mode 100644
index 000000000..ec49e1520
--- /dev/null
+++ b/tests/ui/inference/multiple-impl-apply.stderr
@@ -0,0 +1,23 @@
+error[E0283]: type annotations needed
+ --> $DIR/multiple-impl-apply.rs:34:9
+ |
+LL | let y = x.into();
+ | ^ ---- type must be known at this point
+ |
+note: multiple `impl`s satisfying `_: From<Baz>` found
+ --> $DIR/multiple-impl-apply.rs:14:1
+ |
+LL | impl From<Baz> for Bar {
+ | ^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | impl From<Baz> for Foo {
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ = note: required for `Baz` to implement `Into<_>`
+help: consider giving `y` an explicit type
+ |
+LL | let y: /* Type */ = x.into();
+ | ++++++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/need_type_info/concrete-impl.rs b/tests/ui/inference/need_type_info/concrete-impl.rs
index fc79e6201..8960f870c 100644
--- a/tests/ui/inference/need_type_info/concrete-impl.rs
+++ b/tests/ui/inference/need_type_info/concrete-impl.rs
@@ -14,6 +14,4 @@ fn main() {
<Struct as Ambiguous<_>>::method();
//~^ ERROR type annotations needed
//~| NOTE cannot infer type of the type parameter `A`
- //~| ERROR type annotations needed
- //~| NOTE infer type of the type parameter `A`
}
diff --git a/tests/ui/inference/need_type_info/concrete-impl.stderr b/tests/ui/inference/need_type_info/concrete-impl.stderr
index 74c3f6cd5..6b86753ca 100644
--- a/tests/ui/inference/need_type_info/concrete-impl.stderr
+++ b/tests/ui/inference/need_type_info/concrete-impl.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/concrete-impl.rs:14:5
- |
-LL | <Struct as Ambiguous<_>>::method();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the trait `Ambiguous`
-
error[E0283]: type annotations needed
--> $DIR/concrete-impl.rs:14:5
|
@@ -19,7 +13,6 @@ LL |
LL | impl Ambiguous<Two> for Struct {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
index 0ec219415..9ca94cd58 100644
--- a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
+++ b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr
@@ -1,9 +1,17 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/issue-113264-incorrect-impl-trait-in-path-suggestion.rs:10:16
|
LL | (S {}).owo(None)
- | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
+ | --- ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
+ | |
+ | required by a bound introduced by this call
|
+ = note: cannot satisfy `_: T`
+note: required by a bound in `S::owo`
+ --> $DIR/issue-113264-incorrect-impl-trait-in-path-suggestion.rs:6:35
+ |
+LL | fn owo(&self, _: Option<&impl T>) {}
+ | ^ required by this bound in `S::owo`
help: consider specifying the generic argument
|
LL | (S {}).owo(None::<&_>)
@@ -11,4 +19,4 @@ LL | (S {}).owo(None::<&_>)
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/inference/question-mark-type-infer.stderr b/tests/ui/inference/question-mark-type-infer.stderr
index 7a1e850d1..52baa2133 100644
--- a/tests/ui/inference/question-mark-type-infer.stderr
+++ b/tests/ui/inference/question-mark-type-infer.stderr
@@ -1,9 +1,12 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/question-mark-type-infer.rs:10:21
|
LL | l.iter().map(f).collect()?
| ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect`
|
+ = note: cannot satisfy `_: FromIterator<Result<i32, ()>>`
+note: required by a bound in `collect`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
help: consider specifying the generic argument
|
LL | l.iter().map(f).collect::<Vec<_>>()?
@@ -11,4 +14,4 @@ LL | l.iter().map(f).collect::<Vec<_>>()?
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/infinite/infinite-struct.stderr b/tests/ui/infinite/infinite-struct.stderr
index b6c72b1de..82d147b63 100644
--- a/tests/ui/infinite/infinite-struct.stderr
+++ b/tests/ui/infinite/infinite-struct.stderr
@@ -22,6 +22,10 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
LL | x: Bar<Box<Foo>>,
| ++++ +
-error: aborting due to 2 previous errors
+error: reached the recursion limit finding the struct tail for `Take`
+ |
+ = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]`
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/inline-const/expr-unsafe.thir.stderr b/tests/ui/inline-const/expr-unsafe.thir.stderr
index 4737444fb..1ab6e42fb 100644
--- a/tests/ui/inline-const/expr-unsafe.thir.stderr
+++ b/tests/ui/inline-const/expr-unsafe.thir.stderr
@@ -1,9 +1,6 @@
warning: unnecessary `unsafe` block
--> $DIR/expr-unsafe.rs:12:13
|
-LL | unsafe {
- | ------ because it's nested under this `unsafe` block
-...
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
|
diff --git a/tests/ui/inline-const/pat-unsafe-err.rs b/tests/ui/inline-const/pat-unsafe-err.rs
index e290b438c..6df281c6d 100644
--- a/tests/ui/inline-const/pat-unsafe-err.rs
+++ b/tests/ui/inline-const/pat-unsafe-err.rs
@@ -1,11 +1,13 @@
-// ignore-test This is currently broken
// revisions: mir thir
+// [mir]ignore-test This is currently broken
// [thir]compile-flags: -Z thir-unsafeck
#![allow(incomplete_features)]
#![feature(inline_const_pat)]
-const unsafe fn require_unsafe() -> usize { 1 }
+const unsafe fn require_unsafe() -> usize {
+ 1
+}
fn main() {
match () {
@@ -14,4 +16,12 @@ fn main() {
//~^ ERROR [E0133]
} => (),
}
+
+ match 1 {
+ const {
+ require_unsafe()
+ //~^ ERROR [E0133]
+ }..=4 => (),
+ _ => (),
+ }
}
diff --git a/tests/ui/inline-const/pat-unsafe-err.thir.stderr b/tests/ui/inline-const/pat-unsafe-err.thir.stderr
new file mode 100644
index 000000000..48a2cb4c7
--- /dev/null
+++ b/tests/ui/inline-const/pat-unsafe-err.thir.stderr
@@ -0,0 +1,19 @@
+error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
+ --> $DIR/pat-unsafe-err.rs:15:13
+ |
+LL | require_unsafe();
+ | ^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
+ --> $DIR/pat-unsafe-err.rs:22:13
+ |
+LL | require_unsafe()
+ | ^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/inline-const/pat-unsafe.rs b/tests/ui/inline-const/pat-unsafe.rs
index bcf7f6e01..36f8632af 100644
--- a/tests/ui/inline-const/pat-unsafe.rs
+++ b/tests/ui/inline-const/pat-unsafe.rs
@@ -1,13 +1,15 @@
-// ignore-test This is currently broken
// check-pass
// revisions: mir thir
+// [mir]ignore-test This is currently broken
// [thir]compile-flags: -Z thir-unsafeck
#![allow(incomplete_features)]
#![warn(unused_unsafe)]
#![feature(inline_const_pat)]
-const unsafe fn require_unsafe() -> usize { 1 }
+const unsafe fn require_unsafe() -> usize {
+ 1
+}
fn main() {
unsafe {
@@ -18,5 +20,14 @@ fn main() {
//~^ WARNING unnecessary `unsafe` block
} => (),
}
+
+ match 1 {
+ const {
+ unsafe {}
+ //~^ WARNING unnecessary `unsafe` block
+ require_unsafe()
+ }..=4 => (),
+ _ => (),
+ }
}
}
diff --git a/tests/ui/inline-const/pat-unsafe.thir.stderr b/tests/ui/inline-const/pat-unsafe.thir.stderr
new file mode 100644
index 000000000..0318b3ff2
--- /dev/null
+++ b/tests/ui/inline-const/pat-unsafe.thir.stderr
@@ -0,0 +1,20 @@
+warning: unnecessary `unsafe` block
+ --> $DIR/pat-unsafe.rs:19:17
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/pat-unsafe.rs:7:9
+ |
+LL | #![warn(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+warning: unnecessary `unsafe` block
+ --> $DIR/pat-unsafe.rs:26:17
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/instrument-coverage/bad-value.bad.stderr b/tests/ui/instrument-coverage/bad-value.bad.stderr
new file mode 100644
index 000000000..b867d169d
--- /dev/null
+++ b/tests/ui/instrument-coverage/bad-value.bad.stderr
@@ -0,0 +1,2 @@
+error: incorrect value `bad-value` for codegen option `instrument-coverage` - `all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off` was expected
+
diff --git a/tests/ui/instrument-coverage/bad-value.blank.stderr b/tests/ui/instrument-coverage/bad-value.blank.stderr
new file mode 100644
index 000000000..e7122fb61
--- /dev/null
+++ b/tests/ui/instrument-coverage/bad-value.blank.stderr
@@ -0,0 +1,2 @@
+error: incorrect value `` for codegen option `instrument-coverage` - `all` (default), `branch`, `except-unused-generics`, `except-unused-functions`, or `off` was expected
+
diff --git a/tests/ui/instrument-coverage/bad-value.rs b/tests/ui/instrument-coverage/bad-value.rs
new file mode 100644
index 000000000..1925c36aa
--- /dev/null
+++ b/tests/ui/instrument-coverage/bad-value.rs
@@ -0,0 +1,5 @@
+// revisions: blank bad
+// [blank] compile-flags: -Cinstrument-coverage=
+// [bad] compile-flags: -Cinstrument-coverage=bad-value
+
+fn main() {}
diff --git a/tests/ui/instrument-coverage/off-values.rs b/tests/ui/instrument-coverage/off-values.rs
new file mode 100644
index 000000000..0f9a0c474
--- /dev/null
+++ b/tests/ui/instrument-coverage/off-values.rs
@@ -0,0 +1,9 @@
+// check-pass
+// revisions: n no off false zero
+// [n] compile-flags: -Cinstrument-coverage=n
+// [no] compile-flags: -Cinstrument-coverage=no
+// [off] compile-flags: -Cinstrument-coverage=off
+// [false] compile-flags: -Cinstrument-coverage=false
+// [zero] compile-flags: -Cinstrument-coverage=0
+
+fn main() {}
diff --git a/tests/ui/instrument-coverage/on-values.rs b/tests/ui/instrument-coverage/on-values.rs
new file mode 100644
index 000000000..cc54c71c6
--- /dev/null
+++ b/tests/ui/instrument-coverage/on-values.rs
@@ -0,0 +1,11 @@
+// check-pass
+// needs-profiler-support
+// revisions: default y yes on true all
+// [default] compile-flags: -Cinstrument-coverage
+// [y] compile-flags: -Cinstrument-coverage=y
+// [yes] compile-flags: -Cinstrument-coverage=yes
+// [on] compile-flags: -Cinstrument-coverage=on
+// [true] compile-flags: -Cinstrument-coverage=true
+// [all] compile-flags: -Cinstrument-coverage=all
+
+fn main() {}
diff --git a/tests/ui/instrument-coverage/unstable.branch.stderr b/tests/ui/instrument-coverage/unstable.branch.stderr
new file mode 100644
index 000000000..acc633a2a
--- /dev/null
+++ b/tests/ui/instrument-coverage/unstable.branch.stderr
@@ -0,0 +1,2 @@
+error: `-C instrument-coverage=branch` and `-C instrument-coverage=except-*` require `-Z unstable-options`
+
diff --git a/tests/ui/instrument-coverage/unstable.except-unused-functions.stderr b/tests/ui/instrument-coverage/unstable.except-unused-functions.stderr
new file mode 100644
index 000000000..acc633a2a
--- /dev/null
+++ b/tests/ui/instrument-coverage/unstable.except-unused-functions.stderr
@@ -0,0 +1,2 @@
+error: `-C instrument-coverage=branch` and `-C instrument-coverage=except-*` require `-Z unstable-options`
+
diff --git a/tests/ui/instrument-coverage/unstable.except-unused-generics.stderr b/tests/ui/instrument-coverage/unstable.except-unused-generics.stderr
new file mode 100644
index 000000000..acc633a2a
--- /dev/null
+++ b/tests/ui/instrument-coverage/unstable.except-unused-generics.stderr
@@ -0,0 +1,2 @@
+error: `-C instrument-coverage=branch` and `-C instrument-coverage=except-*` require `-Z unstable-options`
+
diff --git a/tests/ui/instrument-coverage/unstable.rs b/tests/ui/instrument-coverage/unstable.rs
new file mode 100644
index 000000000..c16bcd0bf
--- /dev/null
+++ b/tests/ui/instrument-coverage/unstable.rs
@@ -0,0 +1,6 @@
+// revisions: branch except-unused-functions except-unused-generics
+// [branch] compile-flags: -Cinstrument-coverage=branch
+// [except-unused-functions] compile-flags: -Cinstrument-coverage=except-unused-functions
+// [except-unused-generics] compile-flags: -Cinstrument-coverage=except-unused-generics
+
+fn main() {}
diff --git a/tests/ui/integral-indexing.stderr b/tests/ui/integral-indexing.stderr
index bbbb2a86a..97e658617 100644
--- a/tests/ui/integral-indexing.stderr
+++ b/tests/ui/integral-indexing.stderr
@@ -5,7 +5,8 @@ LL | v[3u8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `u8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[isize]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u8`
= note: required for `Vec<isize>` to implement `Index<u8>`
error[E0277]: the type `[isize]` cannot be indexed by `i8`
@@ -15,7 +16,8 @@ LL | v[3i8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `i8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[isize]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i8`
= note: required for `Vec<isize>` to implement `Index<i8>`
error[E0277]: the type `[isize]` cannot be indexed by `u32`
@@ -25,7 +27,8 @@ LL | v[3u32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `u32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[isize]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u32`
= note: required for `Vec<isize>` to implement `Index<u32>`
error[E0277]: the type `[isize]` cannot be indexed by `i32`
@@ -35,7 +38,8 @@ LL | v[3i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `i32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[isize]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i32`
= note: required for `Vec<isize>` to implement `Index<i32>`
error[E0277]: the type `[u8]` cannot be indexed by `u8`
@@ -45,7 +49,8 @@ LL | s.as_bytes()[3u8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `u8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[u8]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u8`
= note: required for `[u8]` to implement `Index<u8>`
error[E0277]: the type `[u8]` cannot be indexed by `i8`
@@ -55,7 +60,8 @@ LL | s.as_bytes()[3i8];
| ^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `i8`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[u8]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i8`
= note: required for `[u8]` to implement `Index<i8>`
error[E0277]: the type `[u8]` cannot be indexed by `u32`
@@ -65,7 +71,8 @@ LL | s.as_bytes()[3u32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `u32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[u8]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `u32`
= note: required for `[u8]` to implement `Index<u32>`
error[E0277]: the type `[u8]` cannot be indexed by `i32`
@@ -75,7 +82,8 @@ LL | s.as_bytes()[3i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `i32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[u8]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i32`
= note: required for `[u8]` to implement `Index<i32>`
error: aborting due to 8 previous errors
diff --git a/tests/ui/intrinsics/const-eval-select-bad.rs b/tests/ui/intrinsics/const-eval-select-bad.rs
index 991d1450a..7e75de88d 100644
--- a/tests/ui/intrinsics/const-eval-select-bad.rs
+++ b/tests/ui/intrinsics/const-eval-select-bad.rs
@@ -8,8 +8,8 @@ const fn not_fn_items() {
//~^ ERROR this argument must be a function item
//~| ERROR this argument must be a function item
const_eval_select((), 42, 0xDEADBEEF);
- //~^ ERROR expected a `FnOnce<()>` closure
- //~| ERROR expected a `FnOnce<()>` closure
+ //~^ ERROR expected a `FnOnce()` closure
+ //~| ERROR expected a `FnOnce()` closure
//~| ERROR this argument must be a function item
//~| ERROR this argument must be a function item
}
diff --git a/tests/ui/intrinsics/const-eval-select-bad.stderr b/tests/ui/intrinsics/const-eval-select-bad.stderr
index ecd08e3cd..e6ff9d5a0 100644
--- a/tests/ui/intrinsics/const-eval-select-bad.stderr
+++ b/tests/ui/intrinsics/const-eval-select-bad.stderr
@@ -25,11 +25,11 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
= note: expected a function item, found {integer}
= help: consult the documentation on `const_eval_select` for more information
-error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
+error[E0277]: expected a `FnOnce()` closure, found `{integer}`
--> $DIR/const-eval-select-bad.rs:10:27
|
LL | const_eval_select((), 42, 0xDEADBEEF);
- | ----------------- ^^ expected an `FnOnce<()>` closure, found `{integer}`
+ | ----------------- ^^ expected an `FnOnce()` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
@@ -47,11 +47,11 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
= note: expected a function item, found {integer}
= help: consult the documentation on `const_eval_select` for more information
-error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
+error[E0277]: expected a `FnOnce()` closure, found `{integer}`
--> $DIR/const-eval-select-bad.rs:10:31
|
LL | const_eval_select((), 42, 0xDEADBEEF);
- | ----------------- ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `{integer}`
+ | ----------------- ^^^^^^^^^^ expected an `FnOnce()` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
index 4fc304cda..317466eb3 100644
--- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
+++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr
@@ -2,7 +2,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/intrinsic-raw_eq-const-bad.rs:5:5
|
LL | std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16))
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at alloc3[0x0..0x4], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC0[0x0..0x4], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory
error[E0080]: evaluation of constant value failed
--> $DIR/intrinsic-raw_eq-const-bad.rs:11:5
diff --git a/tests/ui/invalid/invalid-llvm-passes.rs b/tests/ui/invalid-compile-flags/invalid-llvm-passes.rs
index ee28f5eb6..ee28f5eb6 100644
--- a/tests/ui/invalid/invalid-llvm-passes.rs
+++ b/tests/ui/invalid-compile-flags/invalid-llvm-passes.rs
diff --git a/tests/ui/invalid/invalid-llvm-passes.stderr b/tests/ui/invalid-compile-flags/invalid-llvm-passes.stderr
index ae1f85e41..ae1f85e41 100644
--- a/tests/ui/invalid/invalid-llvm-passes.stderr
+++ b/tests/ui/invalid-compile-flags/invalid-llvm-passes.stderr
diff --git a/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr b/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr
index 7bc8efd7e..08aec2592 100644
--- a/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr
+++ b/tests/ui/invalid-module-declaration/invalid-module-declaration.stderr
@@ -5,6 +5,7 @@ LL | pub mod baz;
| ^^^^^^^^^^^^
|
= help: to create the module `baz`, create file "$DIR/auxiliary/foo/bar/baz.rs" or "$DIR/auxiliary/foo/bar/baz/mod.rs"
+ = note: if there is a `mod baz` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/ui/invalid/invalid-plugin-attr.rs b/tests/ui/invalid/invalid-plugin-attr.rs
deleted file mode 100644
index 3080af245..000000000
--- a/tests/ui/invalid/invalid-plugin-attr.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-#![deny(unused_attributes)]
-#![feature(plugin)]
-
-#[plugin(bla)] //~ ERROR should be an inner attribute
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui/invalid/invalid-plugin-attr.stderr b/tests/ui/invalid/invalid-plugin-attr.stderr
deleted file mode 100644
index d3882d33f..000000000
--- a/tests/ui/invalid/invalid-plugin-attr.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/invalid-plugin-attr.rs:4:1
- |
-LL | #[plugin(bla)]
- | ^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
- --> $DIR/invalid-plugin-attr.rs:4:1
- |
-LL | #[plugin(bla)]
- | ^^^^^^^^^^^^^^
- |
-note: the lint level is defined here
- --> $DIR/invalid-plugin-attr.rs:1:9
- |
-LL | #![deny(unused_attributes)]
- | ^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/tests/ui/invalid_dispatch_from_dyn_impls.stderr b/tests/ui/invalid_dispatch_from_dyn_impls.stderr
index 172ee7ade..168ed37d0 100644
--- a/tests/ui/invalid_dispatch_from_dyn_impls.stderr
+++ b/tests/ui/invalid_dispatch_from_dyn_impls.stderr
@@ -1,16 +1,20 @@
error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else
--> $DIR/invalid_dispatch_from_dyn_impls.rs:10:1
|
-LL | impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
+LL | | where
+LL | | T: DispatchFromDyn<U>,
+ | |__________________________^
|
= note: extra field `1` of type `i32` is not allowed
error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions
--> $DIR/invalid_dispatch_from_dyn_impls.rs:21:1
|
-LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T>
+LL | | where
+LL | | T: Unsize<U>,
+ | |_________________^
|
= note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced
= note: currently, 2 fields need coercions: `ptr1` (`*const T` to `*const U`), `ptr2` (`*const T` to `*const U`)
@@ -26,14 +30,18 @@ LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingT
error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]`
--> $DIR/invalid_dispatch_from_dyn_impls.rs:37:1
|
-LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
+LL | | where
+LL | | T: Unsize<U>,
+ | |_________________^
error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, ZST fields with 1 byte alignment, and nothing else
--> $DIR/invalid_dispatch_from_dyn_impls.rs:46:1
|
-LL | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
+LL | | where
+LL | | T: Unsize<U>,
+ | |_____________________^
|
= note: extra field `1` of type `OverAlignedZst` is not allowed
diff --git a/tests/ui/issues/issue-12187-1.stderr b/tests/ui/issues/issue-12187-1.stderr
index 806b7f0ac..d2a6a9608 100644
--- a/tests/ui/issues/issue-12187-1.stderr
+++ b/tests/ui/issues/issue-12187-1.stderr
@@ -2,9 +2,9 @@ error[E0282]: type annotations needed for `&T`
--> $DIR/issue-12187-1.rs:6:9
|
LL | let &v = new();
- | ^^
+ | ^^ ----- type must be known at this point
|
-help: consider giving this pattern a type, where the placeholders `_` are specified
+help: consider giving this pattern a type, where the type for type parameter `T` is specified
|
LL | let &v: &T = new();
| ++++
diff --git a/tests/ui/issues/issue-12187-2.stderr b/tests/ui/issues/issue-12187-2.stderr
index a1fa0a2b0..ac75ebb42 100644
--- a/tests/ui/issues/issue-12187-2.stderr
+++ b/tests/ui/issues/issue-12187-2.stderr
@@ -2,9 +2,9 @@ error[E0282]: type annotations needed for `&T`
--> $DIR/issue-12187-2.rs:6:9
|
LL | let &v = new();
- | ^^
+ | ^^ ----- type must be known at this point
|
-help: consider giving this pattern a type, where the placeholders `_` are specified
+help: consider giving this pattern a type, where the type for type parameter `T` is specified
|
LL | let &v: &T = new();
| ++++
diff --git a/tests/ui/issues/issue-12567.stderr b/tests/ui/issues/issue-12567.stderr
index 7fa06825f..3f95f18a9 100644
--- a/tests/ui/issues/issue-12567.stderr
+++ b/tests/ui/issues/issue-12567.stderr
@@ -8,7 +8,7 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
| -- data moved here
LL | => println!("one empty"),
LL | (&[hd1, ..], &[hd2, ..])
- | --- ...and here
+ | --- ...and here
|
= note: move occurs because these variables have types that don't implement the `Copy` trait
help: consider borrowing the pattern binding
@@ -17,8 +17,8 @@ LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[])
| +++
help: consider borrowing the pattern binding
|
-LL | (&[ref hd1, ..], &[hd2, ..])
- | +++
+LL | (&[hd1, ..], &[ref hd2, ..])
+ | +++
error[E0508]: cannot move out of type `[T]`, a non-copy slice
--> $DIR/issue-12567.rs:2:11
@@ -30,7 +30,7 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
| -- data moved here
LL | => println!("one empty"),
LL | (&[hd1, ..], &[hd2, ..])
- | --- ...and here
+ | --- ...and here
|
= note: move occurs because these variables have types that don't implement the `Copy` trait
help: consider borrowing the pattern binding
@@ -39,8 +39,8 @@ LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[])
| +++
help: consider borrowing the pattern binding
|
-LL | (&[hd1, ..], &[ref hd2, ..])
- | +++
+LL | (&[ref hd1, ..], &[hd2, ..])
+ | +++
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-16966.stderr b/tests/ui/issues/issue-16966.stderr
index 8c92505b5..c53707c5d 100644
--- a/tests/ui/issues/issue-16966.stderr
+++ b/tests/ui/issues/issue-16966.stderr
@@ -1,9 +1,16 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/issue-16966.rs:2:12
|
LL | panic!(std::default::Default::default());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
+ | -------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
+ | | |
+ | | cannot infer type
+ | required by a bound introduced by this call
+ |
+ = note: cannot satisfy `_: Any`
+note: required by a bound in `begin_panic`
+ --> $SRC_DIR/std/src/panicking.rs:LL:COL
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/issues/issue-17551.stderr b/tests/ui/issues/issue-17551.stderr
index 5f45a2f84..3a8f569a3 100644
--- a/tests/ui/issues/issue-17551.stderr
+++ b/tests/ui/issues/issue-17551.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `B<T>`
--> $DIR/issue-17551.rs:6:9
|
LL | let foo = B(marker::PhantomData);
- | ^^^
+ | ^^^ ------------------- type must be known at this point
|
help: consider giving `foo` an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/issues/issue-19380.rs b/tests/ui/issues/issue-19380.rs
index 5c10e2067..fce737cba 100644
--- a/tests/ui/issues/issue-19380.rs
+++ b/tests/ui/issues/issue-19380.rs
@@ -14,5 +14,6 @@ struct Bar {
const FOO : Foo = Foo;
const BAR : Bar = Bar { foos: &[&FOO]};
+//~^ ERROR E0038
fn main() { }
diff --git a/tests/ui/issues/issue-19380.stderr b/tests/ui/issues/issue-19380.stderr
index b2aeb5edf..f6244d9d4 100644
--- a/tests/ui/issues/issue-19380.stderr
+++ b/tests/ui/issues/issue-19380.stderr
@@ -11,6 +11,7 @@ LL | trait Qiz {
| --- this trait cannot be made into an object...
LL | fn qiz();
| ^^^ ...because associated function `qiz` has no `self` parameter
+ = help: only type `Foo` implements the trait, consider using it directly instead
help: consider turning `qiz` into a method by giving it a `&self` argument
|
LL | fn qiz(&self);
@@ -20,6 +21,30 @@ help: alternatively, consider constraining `qiz` so it does not apply to trait o
LL | fn qiz() where Self: Sized;
| +++++++++++++++++
-error: aborting due to previous error
+error[E0038]: the trait `Qiz` cannot be made into an object
+ --> $DIR/issue-19380.rs:16:33
+ |
+LL | const BAR : Bar = Bar { foos: &[&FOO]};
+ | ^^^^ `Qiz` cannot be made into an object
+ |
+note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+ --> $DIR/issue-19380.rs:2:6
+ |
+LL | trait Qiz {
+ | --- this trait cannot be made into an object...
+LL | fn qiz();
+ | ^^^ ...because associated function `qiz` has no `self` parameter
+ = help: only type `Foo` implements the trait, consider using it directly instead
+ = note: required for the cast from `&Foo` to `&'static (dyn Qiz + 'static)`
+help: consider turning `qiz` into a method by giving it a `&self` argument
+ |
+LL | fn qiz(&self);
+ | +++++
+help: alternatively, consider constraining `qiz` so it does not apply to trait objects
+ |
+LL | fn qiz() where Self: Sized;
+ | +++++++++++++++++
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/issues/issue-19482.rs b/tests/ui/issues/issue-19482.rs
index 3f3c5de9b..9d0c8d96d 100644
--- a/tests/ui/issues/issue-19482.rs
+++ b/tests/ui/issues/issue-19482.rs
@@ -8,6 +8,6 @@ trait Foo {
}
fn bar(x: &dyn Foo) {}
-//~^ ERROR the associated type `A` (from trait `Foo`) must be specified
+//~^ ERROR the associated type `A` in `Foo` must be specified
pub fn main() {}
diff --git a/tests/ui/issues/issue-19482.stderr b/tests/ui/issues/issue-19482.stderr
index d51cc1f08..90e6f7995 100644
--- a/tests/ui/issues/issue-19482.stderr
+++ b/tests/ui/issues/issue-19482.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `A` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `A` in `Foo` must be specified
--> $DIR/issue-19482.rs:10:16
|
LL | type A;
diff --git a/tests/ui/issues/issue-20225.stderr b/tests/ui/issues/issue-20225.stderr
index b1c156720..b34aa8e1f 100644
--- a/tests/ui/issues/issue-20225.stderr
+++ b/tests/ui/issues/issue-20225.stderr
@@ -2,7 +2,7 @@ error[E0053]: method `call` has an incompatible type for trait
--> $DIR/issue-20225.rs:6:43
|
LL | impl<'a, T> Fn<(&'a T,)> for Foo {
- | - this type parameter
+ | - found this type parameter
LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
| ^^^^
| |
@@ -16,7 +16,7 @@ error[E0053]: method `call_mut` has an incompatible type for trait
--> $DIR/issue-20225.rs:11:51
|
LL | impl<'a, T> FnMut<(&'a T,)> for Foo {
- | - this type parameter
+ | - found this type parameter
LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
| ^^^^
| |
@@ -30,7 +30,7 @@ error[E0053]: method `call_once` has an incompatible type for trait
--> $DIR/issue-20225.rs:18:47
|
LL | impl<'a, T> FnOnce<(&'a T,)> for Foo {
- | - this type parameter
+ | - found this type parameter
...
LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
| ^^^^
diff --git a/tests/ui/issues/issue-21950.stderr b/tests/ui/issues/issue-21950.stderr
index 731615a6b..e498565d4 100644
--- a/tests/ui/issues/issue-21950.stderr
+++ b/tests/ui/issues/issue-21950.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Output` (from trait `Add`) must be specified
+error[E0191]: the value of the associated type `Output` in `Add` must be specified
--> $DIR/issue-21950.rs:10:25
|
LL | type Output;
diff --git a/tests/ui/issues/issue-22034.rs b/tests/ui/issues/issue-22034.rs
index 405ffd089..ed741779f 100644
--- a/tests/ui/issues/issue-22034.rs
+++ b/tests/ui/issues/issue-22034.rs
@@ -6,6 +6,6 @@ fn main() {
let ptr: *mut () = core::ptr::null_mut();
let _: &mut dyn Fn() = unsafe {
&mut *(ptr as *mut dyn Fn())
- //~^ ERROR expected a `Fn<()>` closure, found `()`
+ //~^ ERROR expected a `Fn()` closure, found `()`
};
}
diff --git a/tests/ui/issues/issue-22034.stderr b/tests/ui/issues/issue-22034.stderr
index 9833e559c..d64b02409 100644
--- a/tests/ui/issues/issue-22034.stderr
+++ b/tests/ui/issues/issue-22034.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `()`
+error[E0277]: expected a `Fn()` closure, found `()`
--> $DIR/issue-22034.rs:8:16
|
LL | &mut *(ptr as *mut dyn Fn())
- | ^^^ expected an `Fn<()>` closure, found `()`
+ | ^^^ expected an `Fn()` closure, found `()`
|
= help: the trait `Fn<()>` is not implemented for `()`
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
diff --git a/tests/ui/issues/issue-22434.rs b/tests/ui/issues/issue-22434.rs
index 34057b46e..d9f7b987c 100644
--- a/tests/ui/issues/issue-22434.rs
+++ b/tests/ui/issues/issue-22434.rs
@@ -3,6 +3,6 @@ pub trait Foo {
}
type I<'a> = &'a (dyn Foo + 'a);
-//~^ ERROR the value of the associated type `A` (from trait `Foo`) must be specified
+//~^ ERROR the value of the associated type `A` in `Foo` must be specified
fn main() {}
diff --git a/tests/ui/issues/issue-22434.stderr b/tests/ui/issues/issue-22434.stderr
index b97fa2503..dab62bcbb 100644
--- a/tests/ui/issues/issue-22434.stderr
+++ b/tests/ui/issues/issue-22434.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `A` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `A` in `Foo` must be specified
--> $DIR/issue-22434.rs:5:23
|
LL | type A;
diff --git a/tests/ui/issues/issue-23024.rs b/tests/ui/issues/issue-23024.rs
index 010281ee3..25220dc3e 100644
--- a/tests/ui/issues/issue-23024.rs
+++ b/tests/ui/issues/issue-23024.rs
@@ -8,5 +8,5 @@ fn main()
println!("{:?}",(vfnfer[0] as dyn Fn)(3));
//~^ ERROR the precise format of `Fn`-family traits'
//~| ERROR missing generics for trait `Fn`
- //~| ERROR the value of the associated type `Output` (from trait `FnOnce`)
+ //~| ERROR the value of the associated type `Output` in `FnOnce`
}
diff --git a/tests/ui/issues/issue-23024.stderr b/tests/ui/issues/issue-23024.stderr
index 2c325ffcc..7d187de1b 100644
--- a/tests/ui/issues/issue-23024.stderr
+++ b/tests/ui/issues/issue-23024.stderr
@@ -18,7 +18,7 @@ help: add missing generic argument
LL | println!("{:?}",(vfnfer[0] as dyn Fn<Args>)(3));
| ++++++
-error[E0191]: the value of the associated type `Output` (from trait `FnOnce`) must be specified
+error[E0191]: the value of the associated type `Output` in `FnOnce` must be specified
--> $DIR/issue-23024.rs:8:39
|
LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3));
diff --git a/tests/ui/issues/issue-23966.stderr b/tests/ui/issues/issue-23966.stderr
index 8f934481d..542aed0eb 100644
--- a/tests/ui/issues/issue-23966.stderr
+++ b/tests/ui/issues/issue-23966.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnMut<(_, char)>` closure, found `()`
+error[E0277]: expected a `FnMut(_, char)` closure, found `()`
--> $DIR/issue-23966.rs:2:32
|
LL | "".chars().fold(|_, _| (), ());
- | ---- ^^ expected an `FnMut<(_, char)>` closure, found `()`
+ | ---- ^^ expected an `FnMut(_, char)` closure, found `()`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/issues/issue-24036.stderr b/tests/ui/issues/issue-24036.stderr
index a425816cd..184383b73 100644
--- a/tests/ui/issues/issue-24036.stderr
+++ b/tests/ui/issues/issue-24036.stderr
@@ -11,12 +11,13 @@ LL | x = |c| c + 1;
= note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed
--> $DIR/issue-24036.rs:9:15
|
LL | 1 => |c| c + 1,
- | ^
+ | ^ - type must be known at this point
|
+ = note: cannot satisfy `<_ as Add<i32>>::Output == _`
help: consider giving this closure parameter an explicit type
|
LL | 1 => |c: /* Type */| c + 1,
@@ -24,5 +25,5 @@ LL | 1 => |c: /* Type */| c + 1,
error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0282, E0308.
-For more information about an error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0284, E0308.
+For more information about an error, try `rustc --explain E0284`.
diff --git a/tests/ui/issues/issue-24446.rs b/tests/ui/issues/issue-24446.rs
index 9ab952ade..6cf884650 100644
--- a/tests/ui/issues/issue-24446.rs
+++ b/tests/ui/issues/issue-24446.rs
@@ -2,6 +2,8 @@ fn main() {
static foo: dyn Fn() -> u32 = || -> u32 {
//~^ ERROR the size for values of type
//~| ERROR cannot be shared between threads safely
+ //~| ERROR the size for values of type
+ //~| ERROR mismatched types
0
};
}
diff --git a/tests/ui/issues/issue-24446.stderr b/tests/ui/issues/issue-24446.stderr
index 4afb87c48..9c206e5ef 100644
--- a/tests/ui/issues/issue-24446.stderr
+++ b/tests/ui/issues/issue-24446.stderr
@@ -1,3 +1,12 @@
+error[E0277]: `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
+ --> $DIR/issue-24446.rs:2:17
+ |
+LL | static foo: dyn Fn() -> u32 = || -> u32 {
+ | ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
+ |
+ = help: the trait `Sync` is not implemented for `(dyn Fn() -> u32 + 'static)`
+ = note: shared static variables must have a type that implements `Sync`
+
error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time
--> $DIR/issue-24446.rs:2:17
|
@@ -6,15 +15,39 @@ LL | static foo: dyn Fn() -> u32 = || -> u32 {
|
= help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)`
-error[E0277]: `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
- --> $DIR/issue-24446.rs:2:17
+error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time
+ --> $DIR/issue-24446.rs:2:35
|
-LL | static foo: dyn Fn() -> u32 = || -> u32 {
- | ^^^^^^^^^^^^^^^ `(dyn Fn() -> u32 + 'static)` cannot be shared between threads safely
+LL | static foo: dyn Fn() -> u32 = || -> u32 {
+ | ___________________________________^
+LL | |
+LL | |
+LL | |
+LL | |
+LL | | 0
+LL | | };
+ | |_____^ doesn't have a size known at compile-time
|
- = help: the trait `Sync` is not implemented for `(dyn Fn() -> u32 + 'static)`
- = note: shared static variables must have a type that implements `Sync`
+ = help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)`
+ = note: constant expressions must have a statically known size
+
+error[E0308]: mismatched types
+ --> $DIR/issue-24446.rs:2:35
+ |
+LL | static foo: dyn Fn() -> u32 = || -> u32 {
+ | ___________________________________^
+LL | |
+LL | |
+LL | |
+LL | |
+LL | | 0
+LL | | };
+ | |_____^ expected `dyn Fn`, found closure
+ |
+ = note: expected trait object `(dyn Fn() -> u32 + 'static)`
+ found closure `{closure@$DIR/issue-24446.rs:2:35: 2:44}`
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/issues/issue-28344.stderr b/tests/ui/issues/issue-28344.stderr
index f398a5da3..71d642109 100644
--- a/tests/ui/issues/issue-28344.stderr
+++ b/tests/ui/issues/issue-28344.stderr
@@ -12,7 +12,7 @@ help: use `dyn`
LL | let x: u8 = <dyn BitXor>::bitor(0 as u8, 0 as u8);
| ++++ +
-error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified
+error[E0191]: the value of the associated type `Output` in `BitXor` must be specified
--> $DIR/issue-28344.rs:4:17
|
LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
@@ -40,7 +40,7 @@ help: use `dyn`
LL | let g = <dyn BitXor>::bitor;
| ++++ +
-error[E0191]: the value of the associated type `Output` (from trait `BitXor`) must be specified
+error[E0191]: the value of the associated type `Output` in `BitXor` must be specified
--> $DIR/issue-28344.rs:10:13
|
LL | let g = BitXor::bitor;
diff --git a/tests/ui/issues/issue-33571.stderr b/tests/ui/issues/issue-33571.stderr
index 2a9ba5ba7..819a533dd 100644
--- a/tests/ui/issues/issue-33571.stderr
+++ b/tests/ui/issues/issue-33571.stderr
@@ -21,6 +21,7 @@ note: unsafe traits like `Sync` should be implemented explicitly
|
LL | Sync,
| ^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-34334.stderr b/tests/ui/issues/issue-34334.stderr
index 9d2c315e4..753942dd1 100644
--- a/tests/ui/issues/issue-34334.stderr
+++ b/tests/ui/issues/issue-34334.stderr
@@ -19,7 +19,8 @@ LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_rece
| ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>`
|
= help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>`
- = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
+ = help: the trait `FromIterator<(u32, _, _)>` is implemented for `Vec<(u32, _, _)>`
+ = help: for that trait implementation, expected `(u32, _, _)`, found `()`
note: the method call chain might not have had the expected associated types
--> $DIR/issue-34334.rs:5:43
|
diff --git a/tests/ui/issues/issue-37534.rs b/tests/ui/issues/issue-37534.rs
index 1e67e9a81..40f7186db 100644
--- a/tests/ui/issues/issue-37534.rs
+++ b/tests/ui/issues/issue-37534.rs
@@ -1,6 +1,6 @@
-struct Foo<T: ?Hash> { }
+struct Foo<T: ?Hash> {}
//~^ ERROR expected trait, found derive macro `Hash`
//~^^ ERROR parameter `T` is never used
-//~^^^ WARN default bound relaxed for a type parameter, but this does nothing
+//~^^^ WARN relaxing a default bound only does something for `?Sized`
-fn main() { }
+fn main() {}
diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/issues/issue-37534.stderr
index 7d3dd8800..03fea2c16 100644
--- a/tests/ui/issues/issue-37534.stderr
+++ b/tests/ui/issues/issue-37534.stderr
@@ -1,7 +1,7 @@
error[E0404]: expected trait, found derive macro `Hash`
--> $DIR/issue-37534.rs:1:16
|
-LL | struct Foo<T: ?Hash> { }
+LL | struct Foo<T: ?Hash> {}
| ^^^^ not a trait
|
help: consider importing this trait instead
@@ -9,16 +9,16 @@ help: consider importing this trait instead
LL + use std::hash::Hash;
|
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/issue-37534.rs:1:12
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/issue-37534.rs:1:15
|
-LL | struct Foo<T: ?Hash> { }
- | ^
+LL | struct Foo<T: ?Hash> {}
+ | ^^^^^
error[E0392]: parameter `T` is never used
--> $DIR/issue-37534.rs:1:12
|
-LL | struct Foo<T: ?Hash> { }
+LL | struct Foo<T: ?Hash> {}
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
diff --git a/tests/ui/issues/issue-40000.stderr b/tests/ui/issues/issue-40000.stderr
index c41fbb9d2..0737a9610 100644
--- a/tests/ui/issues/issue-40000.stderr
+++ b/tests/ui/issues/issue-40000.stderr
@@ -15,6 +15,7 @@ LL | foo(bar);
|
= note: expected trait object `dyn for<'a> Fn(&'a i32)`
found trait object `dyn Fn(&i32)`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-43355.stderr b/tests/ui/issues/issue-43355.stderr
index 57adc8ad5..9aeca8efe 100644
--- a/tests/ui/issues/issue-43355.stderr
+++ b/tests/ui/issues/issue-43355.stderr
@@ -2,7 +2,7 @@ error[E0119]: conflicting implementations of trait `Trait1<Box<_>>` for type `A`
--> $DIR/issue-43355.rs:13:1
|
LL | impl<X, T> Trait1<X> for T where T: Trait2<X> {
- | -------------------------- first implementation here
+ | --------------------------------------------- first implementation here
...
LL | impl<X> Trait1<Box<X>> for A {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
diff --git a/tests/ui/issues/issue-45801.stderr b/tests/ui/issues/issue-45801.stderr
index 8967f49df..e651e2a68 100644
--- a/tests/ui/issues/issue-45801.stderr
+++ b/tests/ui/issues/issue-45801.stderr
@@ -5,6 +5,7 @@ LL | req.get_ref::<Params>();
| ^^^^^^^ the trait `Plugin<i32>` is not implemented for `Params`
|
= help: the trait `Plugin<Foo>` is implemented for `Params`
+ = help: for that trait implementation, expected `Foo`, found `i32`
error: aborting due to previous error
diff --git a/tests/ui/issues/issue-46101.stderr b/tests/ui/issues/issue-46101.stderr
index 40295b8a1..a0cdd5d5f 100644
--- a/tests/ui/issues/issue-46101.stderr
+++ b/tests/ui/issues/issue-46101.stderr
@@ -9,6 +9,8 @@ error[E0433]: failed to resolve: partially resolved path in a derive macro
|
LL | #[derive(Foo::Anything)]
| ^^^^^^^^^^^^^ partially resolved path in a derive macro
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-47715.rs b/tests/ui/issues/issue-47715.rs
index b8088c18d..0a770593b 100644
--- a/tests/ui/issues/issue-47715.rs
+++ b/tests/ui/issues/issue-47715.rs
@@ -7,22 +7,22 @@ trait Iterable {
}
struct Container<T: Iterable<Item = impl Foo>> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
field: T
}
enum Enum<T: Iterable<Item = impl Foo>> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
A(T),
}
union Union<T: Iterable<Item = impl Foo> + Copy> {
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
x: T,
}
type Type<T: Iterable<Item = impl Foo>> = T;
-//~^ ERROR `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
fn main() {
}
diff --git a/tests/ui/issues/issue-47715.stderr b/tests/ui/issues/issue-47715.stderr
index dadea34b6..2ded98781 100644
--- a/tests/ui/issues/issue-47715.stderr
+++ b/tests/ui/issues/issue-47715.stderr
@@ -1,22 +1,22 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
--> $DIR/issue-47715.rs:9:37
|
LL | struct Container<T: Iterable<Item = impl Foo>> {
| ^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
--> $DIR/issue-47715.rs:14:30
|
LL | enum Enum<T: Iterable<Item = impl Foo>> {
| ^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
--> $DIR/issue-47715.rs:19:32
|
LL | union Union<T: Iterable<Item = impl Foo> + Copy> {
| ^^^^^^^^
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generics
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in generics
--> $DIR/issue-47715.rs:24:30
|
LL | type Type<T: Iterable<Item = impl Foo>> = T;
diff --git a/tests/ui/issues/issue-51154.stderr b/tests/ui/issues/issue-51154.stderr
index 002d5ccdc..5ae8e0678 100644
--- a/tests/ui/issues/issue-51154.stderr
+++ b/tests/ui/issues/issue-51154.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-51154.rs:2:30
|
LL | fn foo<F: FnMut()>() {
- | - this type parameter
+ | - expected this type parameter
LL | let _: Box<F> = Box::new(|| ());
| -------- ^^^^^ expected type parameter `F`, found closure
| |
diff --git a/tests/ui/issues/issue-53251.stderr b/tests/ui/issues/issue-53251.stderr
index d5f14e8de..05ea63115 100644
--- a/tests/ui/issues/issue-53251.stderr
+++ b/tests/ui/issues/issue-53251.stderr
@@ -32,6 +32,7 @@ note: associated function defined here, with 0 generic parameters
|
LL | fn f() {}
| ^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-59494.rs b/tests/ui/issues/issue-59494.rs
index a53e28f72..8dcdd88c6 100644
--- a/tests/ui/issues/issue-59494.rs
+++ b/tests/ui/issues/issue-59494.rs
@@ -19,5 +19,5 @@ fn main() {
let g = |(a, _)| a;
let t7 = |env| |a| |b| t7p(f, g)(((env, a), b));
let t8 = t8n(t7, t7p(f, g));
- //~^ ERROR: expected a `Fn<(_,)>` closure, found `impl Fn(((_, _), _))` [E0277]
+ //~^ ERROR: expected a `Fn(_)` closure, found `impl Fn(((_, _), _))` [E0277]
}
diff --git a/tests/ui/issues/issue-59494.stderr b/tests/ui/issues/issue-59494.stderr
index a9284535e..e9a4bf967 100644
--- a/tests/ui/issues/issue-59494.stderr
+++ b/tests/ui/issues/issue-59494.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(_,)>` closure, found `impl Fn(((_, _), _))`
+error[E0277]: expected a `Fn(_)` closure, found `impl Fn(((_, _), _))`
--> $DIR/issue-59494.rs:21:22
|
LL | let t8 = t8n(t7, t7p(f, g));
- | --- ^^^^^^^^^ expected an `Fn<(_,)>` closure, found `impl Fn(((_, _), _))`
+ | --- ^^^^^^^^^ expected an `Fn(_)` closure, found `impl Fn(((_, _), _))`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/issues/issue-66667-function-cmp-cycle.stderr b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr
index d9a960ce1..cec811770 100644
--- a/tests/ui/issues/issue-66667-function-cmp-cycle.stderr
+++ b/tests/ui/issues/issue-66667-function-cmp-cycle.stderr
@@ -19,7 +19,7 @@ error[E0308]: mismatched types
--> $DIR/issue-66667-function-cmp-cycle.rs:2:5
|
LL | fn first() {
- | - help: try adding a return type: `-> bool`
+ | - help: try adding a return type: `-> bool`
LL | second == 1
| ^^^^^^^^^^^ expected `()`, found `bool`
@@ -44,7 +44,7 @@ error[E0308]: mismatched types
--> $DIR/issue-66667-function-cmp-cycle.rs:8:5
|
LL | fn second() {
- | - help: try adding a return type: `-> bool`
+ | - help: try adding a return type: `-> bool`
LL | first == 1
| ^^^^^^^^^^ expected `()`, found `bool`
@@ -69,7 +69,7 @@ error[E0308]: mismatched types
--> $DIR/issue-66667-function-cmp-cycle.rs:14:5
|
LL | fn bar() {
- | - help: try adding a return type: `-> bool`
+ | - help: try adding a return type: `-> bool`
LL | bar == 1
| ^^^^^^^^ expected `()`, found `bool`
diff --git a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr
index 22b1da64c..128288e28 100644
--- a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr
+++ b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr
@@ -5,7 +5,8 @@ LL | let x2: Vec<f64> = x1.into_iter().collect();
| ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
- = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
+ = help: the trait `FromIterator<f64>` is implemented for `Vec<f64>`
+ = help: for that trait implementation, expected `f64`, found `&f64`
note: the method call chain might not have had the expected associated types
--> $DIR/issue-66923-show-error-for-correct-call.rs:8:27
|
@@ -25,7 +26,8 @@ LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
| required by a bound introduced by this call
|
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
- = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
+ = help: the trait `FromIterator<f64>` is implemented for `Vec<f64>`
+ = help: for that trait implementation, expected `f64`, found `&f64`
note: the method call chain might not have had the expected associated types
--> $DIR/issue-66923-show-error-for-correct-call.rs:12:17
|
diff --git a/tests/ui/issues/issue-69306.stderr b/tests/ui/issues/issue-69306.stderr
index 570677298..6fc5c33af 100644
--- a/tests/ui/issues/issue-69306.stderr
+++ b/tests/ui/issues/issue-69306.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:5:28
|
LL | impl<T> S0<T> {
- | - this type parameter
+ | - expected this type parameter
LL | const C: S0<u8> = Self(0);
| ---- ^ expected type parameter `T`, found integer
| |
@@ -20,7 +20,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:5:23
|
LL | impl<T> S0<T> {
- | - this type parameter
+ | - found this type parameter
LL | const C: S0<u8> = Self(0);
| ^^^^^^^ expected `S0<u8>`, found `S0<T>`
|
@@ -31,7 +31,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:10:14
|
LL | impl<T> S0<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self(0);
| ---- ^ expected type parameter `T`, found integer
@@ -50,7 +50,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:27:14
|
LL | impl<T> Foo<T> for <S0<T> as Fun>::Out {
- | - this type parameter
+ | - expected this type parameter
LL | fn foo() {
LL | Self(0);
| ---- ^ expected type parameter `T`, found integer
@@ -69,7 +69,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:33:32
|
LL | impl<T> S1<T, u8> {
- | - this type parameter
+ | - expected this type parameter
LL | const C: S1<u8, u8> = Self(0, 1);
| ---- ^ expected type parameter `T`, found integer
| |
@@ -87,7 +87,7 @@ error[E0308]: mismatched types
--> $DIR/issue-69306.rs:33:27
|
LL | impl<T> S1<T, u8> {
- | - this type parameter
+ | - found this type parameter
LL | const C: S1<u8, u8> = Self(0, 1);
| ^^^^^^^^^^ expected `S1<u8, u8>`, found `S1<T, u8>`
|
diff --git a/tests/ui/issues/issue-77919.rs b/tests/ui/issues/issue-77919.rs
index 966d76d14..bf6033149 100644
--- a/tests/ui/issues/issue-77919.rs
+++ b/tests/ui/issues/issue-77919.rs
@@ -10,4 +10,4 @@ struct Multiply<N, M> {
}
impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
//~^ ERROR cannot find type `VAL` in this scope
-//~| ERROR not all trait items implemented, missing: `VAL`
+//~| ERROR not all trait items implemented
diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/issues/issue-77919.stderr
index d6dcc8997..dbbe70ff0 100644
--- a/tests/ui/issues/issue-77919.stderr
+++ b/tests/ui/issues/issue-77919.stderr
@@ -27,7 +27,7 @@ LL | const VAL: T;
| ------------ `VAL` from trait
...
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
error: aborting due to 3 previous errors
diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/issues/issue-87199.rs
index a80a64a2f..d16d40676 100644
--- a/tests/ui/issues/issue-87199.rs
+++ b/tests/ui/issues/issue-87199.rs
@@ -6,11 +6,11 @@
// Check that these function definitions only emit warnings, not errors
fn arg<T: ?Send>(_: T) {}
-//~^ warning: default bound relaxed for a type parameter, but this does nothing
+//~^ warning: relaxing a default bound only does something for `?Sized`
fn ref_arg<T: ?Send>(_: &T) {}
-//~^ warning: default bound relaxed for a type parameter, but this does nothing
+//~^ warning: relaxing a default bound only does something for `?Sized`
fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() }
-//~^ warning: default bound relaxed for a type parameter, but this does nothing
+//~^ warning: relaxing a default bound only does something for `?Sized`
// Check that there's no `?Sized` relaxation!
fn main() {
diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr
index 67949b37d..e02cd7fcf 100644
--- a/tests/ui/issues/issue-87199.stderr
+++ b/tests/ui/issues/issue-87199.stderr
@@ -1,20 +1,20 @@
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/issue-87199.rs:8:8
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/issue-87199.rs:8:11
|
LL | fn arg<T: ?Send>(_: T) {}
- | ^
+ | ^^^^^
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/issue-87199.rs:10:12
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/issue-87199.rs:10:15
|
LL | fn ref_arg<T: ?Send>(_: &T) {}
- | ^
+ | ^^^^^
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/issue-87199.rs:12:13
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/issue-87199.rs:12:40
|
LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/issue-87199.rs:18:15
diff --git a/tests/ui/iterators/collect-into-slice.stderr b/tests/ui/iterators/collect-into-slice.stderr
index 07dc561f0..45685ef0c 100644
--- a/tests/ui/iterators/collect-into-slice.stderr
+++ b/tests/ui/iterators/collect-into-slice.stderr
@@ -1,3 +1,13 @@
+error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
+ --> $DIR/collect-into-slice.rs:6:38
+ |
+LL | let some_generated_vec = (0..10).collect();
+ | ^^^^^^^ try explicitly collecting into a `Vec<{integer}>`
+ |
+ = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
+note: required by a bound in `collect`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/collect-into-slice.rs:6:9
|
@@ -18,16 +28,6 @@ LL | let some_generated_vec = (0..10).collect();
note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
- --> $DIR/collect-into-slice.rs:6:38
- |
-LL | let some_generated_vec = (0..10).collect();
- | ^^^^^^^ try explicitly collecting into a `Vec<{integer}>`
- |
- = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
-note: required by a bound in `collect`
- --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-
error[E0277]: a slice of type `&[i32]` cannot be built since we need to store the elements somewhere
--> $DIR/collect-into-slice.rs:18:38
|
diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.fixed b/tests/ui/iterators/invalid-iterator-chain-fixable.fixed
new file mode 100644
index 000000000..513b5bd13
--- /dev/null
+++ b/tests/ui/iterators/invalid-iterator-chain-fixable.fixed
@@ -0,0 +1,42 @@
+// run-rustfix
+use std::collections::hash_set::Iter;
+use std::collections::HashSet;
+
+fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> where X: Clone {
+ let i = i.map(|x| x.clone());
+ i.collect() //~ ERROR E0277
+}
+
+fn main() {
+ let v = vec![(0, 0)];
+ let scores = v
+ .iter()
+ .map(|(a, b)| {
+ a + b
+ });
+ println!("{}", scores.sum::<i32>()); //~ ERROR E0277
+ println!(
+ "{}",
+ vec![0, 1]
+ .iter()
+ .map(|x| x * 2)
+ .map(|x| { x })
+ .map(|x| { x })
+ .sum::<i32>(), //~ ERROR E0277
+ );
+ println!("{}", vec![0, 1].iter().map(|x| { x }).sum::<i32>()); //~ ERROR E0277
+ let a = vec![0];
+ let b = a.into_iter();
+ let c = b.map(|x| x + 1);
+ let d = c.filter(|x| *x > 10 );
+ let e = d.map(|x| {
+ x + 1
+ });
+ let f = e.filter(|_| false);
+ let g: Vec<i32> = f.collect(); //~ ERROR E0277
+ println!("{g:?}");
+
+ let mut s = HashSet::new();
+ s.insert(1u8);
+ println!("{:?}", iter_to_vec(s.iter()));
+}
diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.rs b/tests/ui/iterators/invalid-iterator-chain-fixable.rs
new file mode 100644
index 000000000..79b861702
--- /dev/null
+++ b/tests/ui/iterators/invalid-iterator-chain-fixable.rs
@@ -0,0 +1,42 @@
+// run-rustfix
+use std::collections::hash_set::Iter;
+use std::collections::HashSet;
+
+fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> {
+ let i = i.map(|x| x.clone());
+ i.collect() //~ ERROR E0277
+}
+
+fn main() {
+ let v = vec![(0, 0)];
+ let scores = v
+ .iter()
+ .map(|(a, b)| {
+ a + b;
+ });
+ println!("{}", scores.sum::<i32>()); //~ ERROR E0277
+ println!(
+ "{}",
+ vec![0, 1]
+ .iter()
+ .map(|x| x * 2)
+ .map(|x| { x; })
+ .map(|x| { x })
+ .sum::<i32>(), //~ ERROR E0277
+ );
+ println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>()); //~ ERROR E0277
+ let a = vec![0];
+ let b = a.into_iter();
+ let c = b.map(|x| x + 1);
+ let d = c.filter(|x| *x > 10 );
+ let e = d.map(|x| {
+ x + 1;
+ });
+ let f = e.filter(|_| false);
+ let g: Vec<i32> = f.collect(); //~ ERROR E0277
+ println!("{g:?}");
+
+ let mut s = HashSet::new();
+ s.insert(1u8);
+ println!("{:?}", iter_to_vec(s.iter()));
+}
diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr
new file mode 100644
index 000000000..1bfe765e7
--- /dev/null
+++ b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr
@@ -0,0 +1,157 @@
+error[E0277]: a value of type `Vec<X>` cannot be built from an iterator over elements of type `&X`
+ --> $DIR/invalid-iterator-chain-fixable.rs:7:7
+ |
+LL | let i = i.map(|x| x.clone());
+ | ------- this method call is cloning the reference `&X`, not `X` which doesn't implement `Clone`
+LL | i.collect()
+ | ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>`
+ |
+ = help: the trait `FromIterator<&X>` is not implemented for `Vec<X>`
+ = help: the trait `FromIterator<X>` is implemented for `Vec<X>`
+ = help: for that trait implementation, expected `X`, found `&X`
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:5:26
+ |
+LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> {
+ | ^^^^^^^^^^^ `Iterator::Item` is `&X` here
+LL | let i = i.map(|x| x.clone());
+ | ------------------ `Iterator::Item` remains `&X` here
+note: required by a bound in `collect`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider further restricting type parameter `X`
+ |
+LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> where X: Clone {
+ | ++++++++++++++
+
+error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
+ --> $DIR/invalid-iterator-chain-fixable.rs:17:33
+ |
+LL | println!("{}", scores.sum::<i32>());
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Sum<()>` is not implemented for `i32`
+ = help: the following other types implement trait `Sum<A>`:
+ <i32 as Sum>
+ <i32 as Sum<&'a i32>>
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:14:10
+ |
+LL | let v = vec![(0, 0)];
+ | ------------ this expression has type `Vec<({integer}, {integer})>`
+LL | let scores = v
+LL | .iter()
+ | ------ `Iterator::Item` is `&({integer}, {integer})` here
+LL | .map(|(a, b)| {
+ | __________^
+LL | | a + b;
+LL | | });
+ | |__________^ `Iterator::Item` changed to `()` here
+note: required by a bound in `std::iter::Iterator::sum`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - a + b;
+LL + a + b
+ |
+
+error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
+ --> $DIR/invalid-iterator-chain-fixable.rs:25:20
+ |
+LL | .sum::<i32>(),
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Sum<()>` is not implemented for `i32`
+ = help: the following other types implement trait `Sum<A>`:
+ <i32 as Sum>
+ <i32 as Sum<&'a i32>>
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:23:14
+ |
+LL | vec![0, 1]
+ | ---------- this expression has type `Vec<{integer}>`
+LL | .iter()
+ | ------ `Iterator::Item` is `&{integer}` here
+LL | .map(|x| x * 2)
+ | -------------- `Iterator::Item` changed to `{integer}` here
+LL | .map(|x| { x; })
+ | ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here
+LL | .map(|x| { x })
+ | -------------- `Iterator::Item` remains `()` here
+note: required by a bound in `std::iter::Iterator::sum`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - .map(|x| { x; })
+LL + .map(|x| { x })
+ |
+
+error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
+ --> $DIR/invalid-iterator-chain-fixable.rs:27:60
+ |
+LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
+ | --- ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>`
+ | |
+ | required by a bound introduced by this call
+ |
+ = help: the trait `Sum<()>` is not implemented for `i32`
+ = help: the following other types implement trait `Sum<A>`:
+ <i32 as Sum>
+ <i32 as Sum<&'a i32>>
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:27:38
+ |
+LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
+ | ---------- ------ ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here
+ | | |
+ | | `Iterator::Item` is `&{integer}` here
+ | this expression has type `Vec<{integer}>`
+note: required by a bound in `std::iter::Iterator::sum`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
+LL + println!("{}", vec![0, 1].iter().map(|x| { x }).sum::<i32>());
+ |
+
+error[E0277]: a value of type `Vec<i32>` cannot be built from an iterator over elements of type `()`
+ --> $DIR/invalid-iterator-chain-fixable.rs:36:25
+ |
+LL | let g: Vec<i32> = f.collect();
+ | ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
+ |
+ = help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
+ = help: the trait `FromIterator<i32>` is implemented for `Vec<i32>`
+ = help: for that trait implementation, expected `i32`, found `()`
+note: the method call chain might not have had the expected associated types
+ --> $DIR/invalid-iterator-chain-fixable.rs:32:15
+ |
+LL | let a = vec![0];
+ | ------- this expression has type `Vec<{integer}>`
+LL | let b = a.into_iter();
+ | ----------- `Iterator::Item` is `{integer}` here
+LL | let c = b.map(|x| x + 1);
+ | -------------- `Iterator::Item` remains `{integer}` here
+LL | let d = c.filter(|x| *x > 10 );
+ | -------------------- `Iterator::Item` remains `{integer}` here
+LL | let e = d.map(|x| {
+ | _______________^
+LL | | x + 1;
+LL | | });
+ | |______^ `Iterator::Item` changed to `()` here
+LL | let f = e.filter(|_| false);
+ | ----------------- `Iterator::Item` remains `()` here
+note: required by a bound in `collect`
+ --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - x + 1;
+LL + x + 1
+ |
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/iterators/invalid-iterator-chain.stderr b/tests/ui/iterators/invalid-iterator-chain.stderr
index b355da5cb..4dc130869 100644
--- a/tests/ui/iterators/invalid-iterator-chain.stderr
+++ b/tests/ui/iterators/invalid-iterator-chain.stderr
@@ -1,11 +1,14 @@
error[E0277]: a value of type `Vec<X>` cannot be built from an iterator over elements of type `&X`
--> $DIR/invalid-iterator-chain.rs:6:7
|
+LL | let i = i.map(|x| x.clone());
+ | ------- this method call is cloning the reference `&X`, not `X` which doesn't implement `Clone`
LL | i.collect()
| ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>`
|
= help: the trait `FromIterator<&X>` is not implemented for `Vec<X>`
- = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
+ = help: the trait `FromIterator<X>` is implemented for `Vec<X>`
+ = help: for that trait implementation, expected `X`, found `&X`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain.rs:4:26
|
@@ -15,6 +18,10 @@ LL | let i = i.map(|x| x.clone());
| ------------------ `Iterator::Item` remains `&X` here
note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider further restricting type parameter `X`
+ |
+LL | fn iter_to_vec<'b, X>(i: Iter<'b, X>) -> Vec<X> where X: Clone {
+ | ++++++++++++++
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
--> $DIR/invalid-iterator-chain.rs:15:33
@@ -42,6 +49,11 @@ LL | | });
| |__________^ `Iterator::Item` changed to `()` here
note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - a + b;
+LL + a + b
+ |
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
--> $DIR/invalid-iterator-chain.rs:26:20
@@ -76,6 +88,11 @@ LL | .map(|x| { x; })
| ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here
note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - .map(|x| { x; })
+LL + .map(|x| { x })
+ |
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64`
--> $DIR/invalid-iterator-chain.rs:36:20
@@ -129,6 +146,11 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
| this expression has type `Vec<{integer}>`
note: required by a bound in `std::iter::Iterator::sum`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
+LL + println!("{}", vec![0, 1].iter().map(|x| { x }).sum::<i32>());
+ |
error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
--> $DIR/invalid-iterator-chain.rs:39:46
@@ -159,7 +181,8 @@ LL | let g: Vec<i32> = f.collect();
| ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>`
|
= help: the trait `FromIterator<()>` is not implemented for `Vec<i32>`
- = help: the trait `FromIterator<T>` is implemented for `Vec<T>`
+ = help: the trait `FromIterator<i32>` is implemented for `Vec<i32>`
+ = help: for that trait implementation, expected `i32`, found `()`
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain.rs:44:15
|
@@ -180,6 +203,11 @@ LL | let f = e.filter(|_| false);
| ----------------- `Iterator::Item` remains `()` here
note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider removing this semicolon
+ |
+LL - x + 1;
+LL + x + 1
+ |
error: aborting due to 7 previous errors
diff --git a/tests/ui/lang-items/start_lang_item_args.main_ret.stderr b/tests/ui/lang-items/start_lang_item_args.main_ret.stderr
index 4582b6985..25570f960 100644
--- a/tests/ui/lang-items/start_lang_item_args.main_ret.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.main_ret.stderr
@@ -4,7 +4,7 @@ error[E0308]: lang item `start` function has wrong type
LL | fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
| - ^^^^^^^^^^^ expected type parameter `T`, found `u16`
| |
- | this type parameter
+ | expected this type parameter
|
= note: expected signature `fn(fn() -> T, _, _, _) -> _`
found signature `fn(fn() -> u16, _, _, _) -> _`
diff --git a/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr b/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr
index 2bb29f911..14bfcc3d0 100644
--- a/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr
+++ b/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr
@@ -1,8 +1,8 @@
error[E0308]: lang item `start` function has wrong type
- --> $DIR/start_lang_item_args.rs:29:84
+ --> $DIR/start_lang_item_args.rs:29:83
|
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
- | ^ expected `isize`, found `()`
+ | ^ expected `isize`, found `()`
|
= note: expected signature `fn(fn() -> _, _, _, _) -> isize`
found signature `fn(fn() -> _, _, _, _)`
diff --git a/tests/ui/layout/cannot-transmute-unnormalizable-type.rs b/tests/ui/layout/cannot-transmute-unnormalizable-type.rs
index d2b6e1d8e..1a2ff8c47 100644
--- a/tests/ui/layout/cannot-transmute-unnormalizable-type.rs
+++ b/tests/ui/layout/cannot-transmute-unnormalizable-type.rs
@@ -16,7 +16,8 @@ struct Other {
fn main() {
unsafe {
+ // FIXME(oli-obk): make this report a transmute error again.
std::mem::transmute::<Option<()>, Option<&Other>>(None);
- //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types
+ //^ ERROR cannot transmute between types of different sizes, or dependently-sized types
}
}
diff --git a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr
index dd5119318..ee2c5ab7e 100644
--- a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr
+++ b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr
@@ -4,16 +4,6 @@ error[E0412]: cannot find type `Missing` in this scope
LL | Missing: Trait,
| ^^^^^^^ not found in this scope
-error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
- --> $DIR/cannot-transmute-unnormalizable-type.rs:19:9
- |
-LL | std::mem::transmute::<Option<()>, Option<&Other>>(None);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: source type: `Option<()>` (8 bits)
- = note: target type: `Option<&Other>` (unable to determine layout for `Other` because `<() as Trait>::RefTarget` cannot be normalized)
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0412, E0512.
-For more information about an error, try `rustc --explain E0412`.
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/layout/issue-84108.rs b/tests/ui/layout/issue-84108.rs
index dd025c9b4..af21d1d62 100644
--- a/tests/ui/layout/issue-84108.rs
+++ b/tests/ui/layout/issue-84108.rs
@@ -9,6 +9,8 @@ static FOO: (dyn AsRef<OsStr>, u8) = ("hello", 42);
const BAR: (&Path, [u8], usize) = ("hello", [], 42);
//~^ ERROR cannot find type `Path` in this scope
//~| ERROR the size for values of type `[u8]` cannot be known at compilation time
+//~| ERROR mismatched types
static BAZ: ([u8], usize) = ([], 0);
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
+//~| ERROR mismatched types
diff --git a/tests/ui/layout/issue-84108.stderr b/tests/ui/layout/issue-84108.stderr
index 5ad450bed..3a02e73f9 100644
--- a/tests/ui/layout/issue-84108.stderr
+++ b/tests/ui/layout/issue-84108.stderr
@@ -30,7 +30,7 @@ LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
= note: only the last element of a tuple may have a dynamically sized type
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/issue-84108.rs:13:13
+ --> $DIR/issue-84108.rs:14:13
|
LL | static BAZ: ([u8], usize) = ([], 0);
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
@@ -38,7 +38,25 @@ LL | static BAZ: ([u8], usize) = ([], 0);
= help: the trait `Sized` is not implemented for `[u8]`
= note: only the last element of a tuple may have a dynamically sized type
-error: aborting due to 4 previous errors
+error[E0308]: mismatched types
+ --> $DIR/issue-84108.rs:9:45
+ |
+LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
+ | ^^ expected `[u8]`, found `[_; 0]`
+ |
+ = note: expected slice `[u8]`
+ found array `[_; 0]`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-84108.rs:14:30
+ |
+LL | static BAZ: ([u8], usize) = ([], 0);
+ | ^^ expected `[u8]`, found `[_; 0]`
+ |
+ = note: expected slice `[u8]`
+ found array `[_; 0]`
+
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0277, E0412.
+Some errors have detailed explanations: E0277, E0308, E0412.
For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/layout/too-big-with-padding.rs b/tests/ui/layout/too-big-with-padding.rs
new file mode 100644
index 000000000..cf41ac872
--- /dev/null
+++ b/tests/ui/layout/too-big-with-padding.rs
@@ -0,0 +1,18 @@
+// build-fail
+// compile-flags: --target i686-unknown-linux-gnu --crate-type lib
+// needs-llvm-components: x86
+#![feature(no_core, lang_items)]
+#![allow(internal_features)]
+#![no_std]
+#![no_core]
+
+// 0x7fffffff is fine, but after rounding up it becomes too big
+#[repr(C, align(2))]
+pub struct Example([u8; 0x7fffffff]);
+
+pub fn lib(_x: Example) {} //~ERROR: too big for the current architecture
+
+#[lang = "sized"]
+pub trait Sized {}
+#[lang = "copy"]
+pub trait Copy: Sized {}
diff --git a/tests/ui/layout/too-big-with-padding.stderr b/tests/ui/layout/too-big-with-padding.stderr
new file mode 100644
index 000000000..5cc854adc
--- /dev/null
+++ b/tests/ui/layout/too-big-with-padding.stderr
@@ -0,0 +1,8 @@
+error: values of the type `Example` are too big for the current architecture
+ --> $DIR/too-big-with-padding.rs:13:1
+ |
+LL | pub fn lib(_x: Example) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs b/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs
index f02a93ed4..80aba0ba0 100644
--- a/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs
+++ b/tests/ui/lazy-type-alias-impl-trait/freeze_cycle.rs
@@ -1,8 +1,8 @@
// check-pass
-#![feature(generator_trait, negative_impls)]
+#![feature(coroutine_trait, negative_impls)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::task::{Poll, Context};
use std::future::{Future};
use std::ptr::NonNull;
@@ -17,27 +17,27 @@ unsafe impl Send for ResumeTy {}
unsafe impl Sync for ResumeTy {}
-pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
+pub const fn from_coroutine<T>(gen: T) -> impl Future<Output = T::Return>
where
- T: Generator<ResumeTy, Yield = ()>,
+ T: Coroutine<ResumeTy, Yield = ()>,
{
- struct GenFuture<T: Generator<ResumeTy, Yield = ()>>(T);
+ struct GenFuture<T: Coroutine<ResumeTy, Yield = ()>>(T);
// We rely on the fact that async/await futures are immovable in order to create
- // self-referential borrows in the underlying generator.
- impl<T: Generator<ResumeTy, Yield = ()>> !Unpin for GenFuture<T> {}
+ // self-referential borrows in the underlying coroutine.
+ impl<T: Coroutine<ResumeTy, Yield = ()>> !Unpin for GenFuture<T> {}
- impl<T: Generator<ResumeTy, Yield = ()>> Future for GenFuture<T> {
+ impl<T: Coroutine<ResumeTy, Yield = ()>> Future for GenFuture<T> {
type Output = T::Return;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// SAFETY: Safe because we're !Unpin + !Drop, and this is just a field projection.
let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) };
- // Resume the generator, turning the `&mut Context` into a `NonNull` raw pointer. The
+ // Resume the coroutine, turning the `&mut Context` into a `NonNull` raw pointer. The
// `.await` lowering will safely cast that back to a `&mut Context`.
match gen.resume(ResumeTy(NonNull::from(cx).cast::<Context<'static>>())) {
- GeneratorState::Yielded(()) => Poll::Pending,
- GeneratorState::Complete(x) => Poll::Ready(x),
+ CoroutineState::Yielded(()) => Poll::Pending,
+ CoroutineState::Complete(x) => Poll::Ready(x),
}
}
}
diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr
index da0078698..621196647 100644
--- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr
+++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr
@@ -10,6 +10,10 @@ LL | x.use_mut();
| - borrow later used here
|
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider consuming the `Vec<i32>` when turning it into an `Iterator`
+ |
+LL | let mut x = vec![1].into_iter();
+ | ~~~~~~~~~
help: consider using a `let` binding to create a longer lived value
|
LL ~ let binding = vec![1];
diff --git a/tests/ui/lifetimes/issue-105675.stderr b/tests/ui/lifetimes/issue-105675.stderr
index 66415f72b..54ecd35ed 100644
--- a/tests/ui/lifetimes/issue-105675.stderr
+++ b/tests/ui/lifetimes/issue-105675.stderr
@@ -81,6 +81,7 @@ note: the lifetime requirement is introduced here
|
LL | fn thing(x: impl FnOnce(&u32, &u32, u32)) {}
| ^^^^^^^^^^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider specifying the type of the closure parameters
|
LL | let f = |x: &_, y: &_, z: u32| ();
diff --git a/tests/ui/lifetimes/issue-26638.stderr b/tests/ui/lifetimes/issue-26638.stderr
index 30afcecf8..e61158a5d 100644
--- a/tests/ui/lifetimes/issue-26638.stderr
+++ b/tests/ui/lifetimes/issue-26638.stderr
@@ -44,6 +44,10 @@ LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.ne
|
= note: expected reference `&str`
found enum `Option<&str>`
+help: consider using `Option::expect` to unwrap the `Option<&str>` value, panicking if the value is an `Option::None`
+ |
+LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.next().expect("REASON") }
+ | +++++++++++++++++
error[E0061]: this function takes 1 argument but 0 arguments were supplied
--> $DIR/issue-26638.rs:5:47
diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs
new file mode 100644
index 000000000..b0b6b318d
--- /dev/null
+++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.rs
@@ -0,0 +1,19 @@
+// edition:2018
+
+#![feature(unboxed_closures)]
+use std::future::Future;
+
+async fn wrapper<F>(f: F)
+//~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+where
+ F:,
+ for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+{
+ //~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ let mut i = 41;
+ &mut i;
+}
+
+fn main() {}
diff --git a/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr
new file mode 100644
index 000000000..5b77051dc
--- /dev/null
+++ b/tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr
@@ -0,0 +1,51 @@
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ --> $DIR/issue-76168-hr-outlives-3.rs:6:1
+ |
+LL | / async fn wrapper<F>(f: F)
+LL | |
+LL | |
+LL | |
+LL | | where
+LL | | F:,
+LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+ | |______________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
+
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ --> $DIR/issue-76168-hr-outlives-3.rs:6:10
+ |
+LL | async fn wrapper<F>(f: F)
+ | ^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
+
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ --> $DIR/issue-76168-hr-outlives-3.rs:13:1
+ |
+LL | / {
+LL | |
+LL | | let mut i = 41;
+LL | | &mut i;
+LL | | }
+ | |_^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
+
+error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
+ --> $DIR/issue-76168-hr-outlives-3.rs:6:1
+ |
+LL | / async fn wrapper<F>(f: F)
+LL | |
+LL | |
+LL | |
+LL | | where
+LL | | F:,
+LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
+ | |______________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
+ |
+ = help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/lifetimes/issue-77175.rs b/tests/ui/lifetimes/issue-77175.rs
index 2282752b6..8072691ae 100644
--- a/tests/ui/lifetimes/issue-77175.rs
+++ b/tests/ui/lifetimes/issue-77175.rs
@@ -5,7 +5,7 @@
// Prior to the fix, the compiler complained that the 'a lifetime was only used
// once. This was obviously wrong since the lifetime is used twice: For the s3
// parameter and the return type. The issue was caused by the compiler
-// desugaring the async function into a generator that uses only a single
+// desugaring the async function into a coroutine that uses only a single
// lifetime, which then the validator complained about becauase of the
// single_use_lifetimes constraints.
async fn bar<'a>(s1: String, s2: &'_ str, s3: &'a str) -> &'a str {
diff --git a/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr
index affb4e8d0..235092e24 100644
--- a/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr
+++ b/tests/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:19:10
|
LL | foo: &'static T
- | ^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+ | ^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the reference type `&'static T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Foo<T: 'static> {
| +++++++++
@@ -13,20 +16,24 @@ error[E0309]: the parameter type `K` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:41:33
|
LL | fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
- | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
+ | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
+ | |
+ | the parameter type `K` must be valid for the lifetime `'a` as defined here...
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL | impl<K: 'a> Nested<K> {
- | ++++
+LL | fn generic_in_parent<'a, L: X<&'a Nested<K>>>() where K: 'a {
+ | +++++++++++
error[E0309]: the parameter type `M` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:44:36
|
LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
- | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<M>` does not outlive the data it points at
+ | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<M>` does not outlive the data it points at
+ | |
+ | the parameter type `M` must be valid for the lifetime `'a` as defined here...
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b + 'a>() {
| ++++
@@ -35,29 +42,37 @@ error[E0309]: the parameter type `K` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:24:19
|
LL | fn foo<'a, L: X<&'a Nested<K>>>();
- | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
+ | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
+ | |
+ | the parameter type `K` must be valid for the lifetime `'a` as defined here...
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL | trait X<K: 'a>: Sized {
- | ++++
+LL | fn foo<'a, L: X<&'a Nested<K>>>() where K: 'a;
+ | +++++++++++
error[E0309]: the parameter type `Self` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:19
|
LL | fn bar<'a, L: X<&'a Nested<Self>>>();
- | ^^^^^^^^^^^^^^^^^^^
+ | -- ^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<Self>` does not outlive the data it points at
+ | |
+ | the parameter type `Self` must be valid for the lifetime `'a` as defined here...
|
- = help: consider adding an explicit lifetime bound `Self: 'a`...
- = note: ...so that the reference type `&'a Nested<Self>` does not outlive the data it points at
+help: consider adding an explicit lifetime bound
+ |
+LL | fn bar<'a, L: X<&'a Nested<Self>>>() where Self: 'a;
+ | ++++++++++++++
error[E0309]: the parameter type `L` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:32:22
|
LL | fn baz<'a, L, M: X<&'a Nested<L>>>() {
- | ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<L>` does not outlive the data it points at
+ | -- ^^^^^^^^^^^^^^^^ ...so that the reference type `&'a Nested<L>` does not outlive the data it points at
+ | |
+ | the parameter type `L` must be valid for the lifetime `'a` as defined here...
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn baz<'a, L: 'a, M: X<&'a Nested<L>>>() {
| ++++
diff --git a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr
index 7049f28e2..dbc587dd0 100644
--- a/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr
+++ b/tests/ui/lifetimes/lifetime-errors/issue_74400.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue_74400.rs:12:5
|
LL | f(data, identity)
- | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn g<T: 'static>(data: &[T]) {
| +++++++++
diff --git a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed
index f977f0bd3..7c4154904 100644
--- a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed
+++ b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed
@@ -2,7 +2,7 @@
#![allow(warnings)]
-fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
+fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
with_restriction::<T>(x) //~ ERROR the parameter type `T` may not live long enough
}
diff --git a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr
index 2d58d3a02..79df2c8df 100644
--- a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr
+++ b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr
@@ -1,23 +1,15 @@
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:6:5
|
-LL | with_restriction::<T>(x)
- | ^^^^^^^^^^^^^^^^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:5:25
- |
LL | fn no_restriction<T>(x: &()) -> &() {
- | ^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:6:5
- |
+ | --- the parameter type `T` must be valid for the anonymous lifetime defined here...
LL | with_restriction::<T>(x)
- | ^^^^^^^^^^^^^^^^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
- | +++ ++++ ++
+LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
+ | +++ ++++ ++ ++
error: aborting due to previous error
diff --git a/tests/ui/limits/issue-55878.stderr b/tests/ui/limits/issue-55878.stderr
index 93716c0b3..6b463930b 100644
--- a/tests/ui/limits/issue-55878.stderr
+++ b/tests/ui/limits/issue-55878.stderr
@@ -25,6 +25,7 @@ note: erroneous constant encountered
LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/linkage-attr/link-self-contained-consistency.many.stderr b/tests/ui/linkage-attr/link-self-contained-consistency.many.stderr
new file mode 100644
index 000000000..a5fc96b4e
--- /dev/null
+++ b/tests/ui/linkage-attr/link-self-contained-consistency.many.stderr
@@ -0,0 +1,2 @@
+error: some `-C link-self-contained` components were both enabled and disabled: crto, linker
+
diff --git a/tests/ui/linkage-attr/link-self-contained-consistency.one.stderr b/tests/ui/linkage-attr/link-self-contained-consistency.one.stderr
new file mode 100644
index 000000000..5982b7a61
--- /dev/null
+++ b/tests/ui/linkage-attr/link-self-contained-consistency.one.stderr
@@ -0,0 +1,2 @@
+error: some `-C link-self-contained` components were both enabled and disabled: linker
+
diff --git a/tests/ui/linkage-attr/link-self-contained-consistency.rs b/tests/ui/linkage-attr/link-self-contained-consistency.rs
new file mode 100644
index 000000000..9be72f559
--- /dev/null
+++ b/tests/ui/linkage-attr/link-self-contained-consistency.rs
@@ -0,0 +1,10 @@
+// Checks that self-contained linking components cannot be both enabled and disabled at the same
+// time on the CLI.
+
+// check-fail
+// revisions: one many
+// [one] compile-flags: -Clink-self-contained=-linker -Clink-self-contained=+linker -Zunstable-options
+// [many] compile-flags: -Clink-self-contained=+linker,+crto -Clink-self-contained=-linker,-crto -Zunstable-options
+// ignore-tidy-linelength
+
+fn main() {}
diff --git a/tests/ui/linkage-attr/unstable-flavor.bpf.stderr b/tests/ui/linkage-attr/unstable-flavor.bpf.stderr
index 594a46176..819da2fb0 100644
--- a/tests/ui/linkage-attr/unstable-flavor.bpf.stderr
+++ b/tests/ui/linkage-attr/unstable-flavor.bpf.stderr
@@ -1,2 +1,2 @@
-error: the linker flavor `bpf-linker` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values
+error: the linker flavor `bpf` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values
diff --git a/tests/ui/linkage-attr/unstable-flavor.ptx.stderr b/tests/ui/linkage-attr/unstable-flavor.ptx.stderr
index 714c09df5..2ebdc1a90 100644
--- a/tests/ui/linkage-attr/unstable-flavor.ptx.stderr
+++ b/tests/ui/linkage-attr/unstable-flavor.ptx.stderr
@@ -1,2 +1,2 @@
-error: the linker flavor `ptx-linker` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values
+error: the linker flavor `ptx` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values
diff --git a/tests/ui/linkage-attr/unstable-flavor.rs b/tests/ui/linkage-attr/unstable-flavor.rs
index b58fd055f..c2c16b28b 100644
--- a/tests/ui/linkage-attr/unstable-flavor.rs
+++ b/tests/ui/linkage-attr/unstable-flavor.rs
@@ -3,11 +3,11 @@
// caller). If it passes, all the other unstable options are rejected as well.
//
// revisions: bpf ptx
-// [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf-linker --crate-type=rlib
-// [bpf] error-pattern: linker flavor `bpf-linker` is unstable, the `-Z unstable-options` flag
+// [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf --crate-type=rlib
+// [bpf] error-pattern: linker flavor `bpf` is unstable, the `-Z unstable-options` flag
// [bpf] needs-llvm-components:
-// [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx-linker --crate-type=rlib
-// [ptx] error-pattern: linker flavor `ptx-linker` is unstable, the `-Z unstable-options` flag
+// [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx --crate-type=rlib
+// [ptx] error-pattern: linker flavor `ptx` is unstable, the `-Z unstable-options` flag
// [ptx] needs-llvm-components:
#![feature(no_core)]
diff --git a/tests/ui/lint/bare-trait-objects-path.stderr b/tests/ui/lint/bare-trait-objects-path.stderr
index a19f4963c..01ca08a6f 100644
--- a/tests/ui/lint/bare-trait-objects-path.stderr
+++ b/tests/ui/lint/bare-trait-objects-path.stderr
@@ -16,7 +16,7 @@ error[E0223]: ambiguous associated type
--> $DIR/bare-trait-objects-path.rs:23:12
|
LL | let _: Dyn::Ty;
- | ^^^^^^^ help: use the fully-qualified path: `<dyn Dyn as Assoc>::Ty`
+ | ^^^^^^^ help: use fully-qualified syntax: `<dyn Dyn as Assoc>::Ty`
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bare-trait-objects-path.rs:14:5
diff --git a/tests/ui/lint/cli-unknown-force-warn.stderr b/tests/ui/lint/cli-unknown-force-warn.stderr
index 2ee718a8c..5084b4a40 100644
--- a/tests/ui/lint/cli-unknown-force-warn.stderr
+++ b/tests/ui/lint/cli-unknown-force-warn.stderr
@@ -6,10 +6,12 @@ warning[E0602]: unknown lint: `foo_qux`
warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/command-line-register-unknown-lint-tool.stderr b/tests/ui/lint/command-line-register-unknown-lint-tool.stderr
index c9a2aff21..65aa19628 100644
--- a/tests/ui/lint/command-line-register-unknown-lint-tool.stderr
+++ b/tests/ui/lint/command-line-register-unknown-lint-tool.stderr
@@ -5,6 +5,7 @@ error[E0602]: unknown lint tool: `unknown_tool`
error[E0602]: unknown lint tool: `unknown_tool`
|
= note: requested on the command line with `-A unknown_tool::foo`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/crate_level_only_lint.stderr b/tests/ui/lint/crate_level_only_lint.stderr
index 8fb06df2a..fbb1ec381 100644
--- a/tests/ui/lint/crate_level_only_lint.stderr
+++ b/tests/ui/lint/crate_level_only_lint.stderr
@@ -27,36 +27,48 @@ error: allow(uncommon_codepoints) is ignored unless specified at crate level
|
LL | #![allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:9:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:17:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:4:10
|
LL | #![allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:9:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(uncommon_codepoints) is ignored unless specified at crate level
--> $DIR/crate_level_only_lint.rs:17:9
|
LL | #[allow(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 9 previous errors
diff --git a/tests/ui/lint/forbid-group-group-2.stderr b/tests/ui/lint/forbid-group-group-2.stderr
index b2e2bcea1..4a2c8fbd6 100644
--- a/tests/ui/lint/forbid-group-group-2.stderr
+++ b/tests/ui/lint/forbid-group-group-2.stderr
@@ -26,6 +26,7 @@ LL | #[allow(nonstandard_style)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -38,6 +39,7 @@ LL | #[allow(nonstandard_style)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -50,6 +52,7 @@ LL | #[allow(nonstandard_style)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -62,6 +65,7 @@ LL | #[allow(nonstandard_style)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -74,6 +78,7 @@ LL | #[allow(nonstandard_style)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -86,6 +91,7 @@ LL | #[allow(nonstandard_style)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -98,6 +104,7 @@ LL | #[allow(nonstandard_style)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: allow(nonstandard_style) incompatible with previous forbid
--> $DIR/forbid-group-group-2.rs:7:9
@@ -110,6 +117,7 @@ LL | #[allow(nonstandard_style)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 9 previous errors
diff --git a/tests/ui/lint/forbid-group-member.stderr b/tests/ui/lint/forbid-group-member.stderr
index 47336d4d8..ddaaafa12 100644
--- a/tests/ui/lint/forbid-group-member.stderr
+++ b/tests/ui/lint/forbid-group-member.stderr
@@ -22,6 +22,7 @@ LL | #[allow(unused_variables)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: allow(unused_variables) incompatible with previous forbid
--> $DIR/forbid-group-member.rs:8:9
@@ -34,6 +35,7 @@ LL | #[allow(unused_variables)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/forbid-member-group.stderr b/tests/ui/lint/forbid-member-group.stderr
index e65301778..612dccd8d 100644
--- a/tests/ui/lint/forbid-member-group.stderr
+++ b/tests/ui/lint/forbid-member-group.stderr
@@ -15,6 +15,8 @@ LL | #![forbid(unused_variables)]
LL |
LL | #[allow(unused)]
| ^^^^^^ overruled by previous forbid
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
index 0f58953a5..ecdc62501 100644
--- a/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr
@@ -20,6 +20,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -33,6 +34,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/cap-lints-allow.stderr b/tests/ui/lint/force-warn/cap-lints-allow.stderr
index 03a32fa6f..5f5f2ff52 100644
--- a/tests/ui/lint/force-warn/cap-lints-allow.stderr
+++ b/tests/ui/lint/force-warn/cap-lints-allow.stderr
@@ -20,6 +20,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -33,6 +34,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
index b0cd3ddd2..3a0b1201b 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
@@ -21,6 +21,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -34,6 +35,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
index 8c841916c..92555eda2 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr
@@ -21,6 +21,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -34,6 +35,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
index c0144205d..c14c7957a 100644
--- a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
+++ b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr
@@ -21,6 +21,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
@@ -34,6 +35,7 @@ LL | pub fn function(_x: Box<SomeTrait>) {}
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | pub fn function(_x: Box<dyn SomeTrait>) {}
diff --git a/tests/ui/lint/force-warn/warnings-lint-group.stderr b/tests/ui/lint/force-warn/warnings-lint-group.stderr
index 1faeed337..3e73269a2 100644
--- a/tests/ui/lint/force-warn/warnings-lint-group.stderr
+++ b/tests/ui/lint/force-warn/warnings-lint-group.stderr
@@ -1,6 +1,8 @@
error[E0602]: `warnings` lint group is not supported with ´--force-warn´
error[E0602]: `warnings` lint group is not supported with ´--force-warn´
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/issue-80988.stderr b/tests/ui/lint/issue-80988.stderr
index 73e27ffda..7a65881b5 100644
--- a/tests/ui/lint/issue-80988.stderr
+++ b/tests/ui/lint/issue-80988.stderr
@@ -22,6 +22,7 @@ LL | #[deny(warnings)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: deny(warnings) incompatible with previous forbid
--> $DIR/issue-80988.rs:7:8
@@ -34,6 +35,7 @@ LL | #[deny(warnings)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/lint-forbid-attr.stderr b/tests/ui/lint/lint-forbid-attr.stderr
index 5977b9c94..bd476a0e3 100644
--- a/tests/ui/lint/lint-forbid-attr.stderr
+++ b/tests/ui/lint/lint-forbid-attr.stderr
@@ -15,6 +15,8 @@ LL | #![forbid(deprecated)]
LL |
LL | #[allow(deprecated)]
| ^^^^^^^^^^ overruled by previous forbid
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/lint-forbid-cmdline.stderr b/tests/ui/lint/lint-forbid-cmdline.stderr
index 0a92e58c0..ed49a2cb4 100644
--- a/tests/ui/lint/lint-forbid-cmdline.stderr
+++ b/tests/ui/lint/lint-forbid-cmdline.stderr
@@ -13,6 +13,7 @@ LL | #[allow(deprecated)]
| ^^^^^^^^^^ overruled by previous forbid
|
= note: `forbid` lint level was set on command line
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/lint-malformed.stderr b/tests/ui/lint/lint-malformed.stderr
index 91b4e509b..2c9f045de 100644
--- a/tests/ui/lint/lint-malformed.stderr
+++ b/tests/ui/lint/lint-malformed.stderr
@@ -9,6 +9,8 @@ error[E0452]: malformed lint attribute input
|
LL | #![allow(bar = "baz")]
| ^^^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: malformed `deny` attribute input
--> $DIR/lint-malformed.rs:1:1
@@ -21,12 +23,16 @@ error[E0452]: malformed lint attribute input
|
LL | #![allow(bar = "baz")]
| ^^^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0452]: malformed lint attribute input
--> $DIR/lint-malformed.rs:2:10
|
LL | #![allow(bar = "baz")]
| ^^^^^^^^^^^ bad attribute argument
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 5 previous errors
diff --git a/tests/ui/lint/lint-removed-cmdline-deny.stderr b/tests/ui/lint/lint-removed-cmdline-deny.stderr
index 80c85d01e..3321afa7f 100644
--- a/tests/ui/lint/lint-removed-cmdline-deny.stderr
+++ b/tests/ui/lint/lint-removed-cmdline-deny.stderr
@@ -6,10 +6,12 @@ error: lint `raw_pointer_derive` has been removed: using derive with raw pointer
error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-removed-cmdline-deny.rs:13:17
diff --git a/tests/ui/lint/lint-removed-cmdline.stderr b/tests/ui/lint/lint-removed-cmdline.stderr
index ebfae34ad..6b76ad3b5 100644
--- a/tests/ui/lint/lint-removed-cmdline.stderr
+++ b/tests/ui/lint/lint-removed-cmdline.stderr
@@ -6,10 +6,12 @@ warning: lint `raw_pointer_derive` has been removed: using derive with raw point
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-removed-cmdline.rs:13:17
diff --git a/tests/ui/lint/lint-renamed-cmdline-deny.stderr b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
index df22ef60d..0e182a4e5 100644
--- a/tests/ui/lint/lint-renamed-cmdline-deny.stderr
+++ b/tests/ui/lint/lint-renamed-cmdline-deny.stderr
@@ -8,11 +8,13 @@ error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
= help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
= help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline-deny.rs:10:17
diff --git a/tests/ui/lint/lint-renamed-cmdline.stderr b/tests/ui/lint/lint-renamed-cmdline.stderr
index a41284003..675443dde 100644
--- a/tests/ui/lint/lint-renamed-cmdline.stderr
+++ b/tests/ui/lint/lint-renamed-cmdline.stderr
@@ -8,11 +8,13 @@ warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
= help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
= help: use the new name `bare_trait_objects`
= note: requested on the command line with `-D bare_trait_object`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline.rs:9:17
diff --git a/tests/ui/lint/lint-stability-deprecated.stderr b/tests/ui/lint/lint-stability-deprecated.stderr
index 19a4649e1..609fc56a8 100644
--- a/tests/ui/lint/lint-stability-deprecated.stderr
+++ b/tests/ui/lint/lint-stability-deprecated.stderr
@@ -639,18 +639,24 @@ warning: use of deprecated associated type `lint_stability::TraitWithAssociatedT
|
LL | struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: use of deprecated associated type `lint_stability::TraitWithAssociatedTypes::TypeDeprecated`: text
--> $DIR/lint-stability-deprecated.rs:102:13
|
LL | TypeDeprecated = u16,
| ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: use of deprecated associated type `lint_stability::TraitWithAssociatedTypes::TypeDeprecated`: text
--> $DIR/lint-stability-deprecated.rs:102:13
|
LL | TypeDeprecated = u16,
| ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 108 warnings emitted
diff --git a/tests/ui/lint/lint-type-overflow.stderr b/tests/ui/lint/lint-type-overflow.stderr
index 48d8228b8..971c3eb9b 100644
--- a/tests/ui/lint/lint-type-overflow.stderr
+++ b/tests/ui/lint/lint-type-overflow.stderr
@@ -29,21 +29,21 @@ LL | let x1: i8 = 128;
= help: consider using the type `u8` instead
error: literal out of range for `i8`
- --> $DIR/lint-type-overflow.rs:18:19
+ --> $DIR/lint-type-overflow.rs:18:18
|
LL | let x3: i8 = -129;
- | ^^^
+ | ^^^^
|
- = note: the literal `129` does not fit into the type `i8` whose range is `-128..=127`
+ = note: the literal `-129` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `i16` instead
error: literal out of range for `i8`
- --> $DIR/lint-type-overflow.rs:19:19
+ --> $DIR/lint-type-overflow.rs:19:18
|
LL | let x3: i8 = -(129);
- | ^^^^^
+ | ^^^^^^
|
- = note: the literal `129` does not fit into the type `i8` whose range is `-128..=127`
+ = note: the literal `-(129)` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `i16` instead
error: literal out of range for `i8`
@@ -74,12 +74,12 @@ LL | let x = 128_i8;
= help: consider using the type `u8` instead
error: literal out of range for `i8`
- --> $DIR/lint-type-overflow.rs:28:14
+ --> $DIR/lint-type-overflow.rs:28:13
|
LL | let x = -129_i8;
- | ^^^^^^
+ | ^^^^^^^
|
- = note: the literal `129_i8` does not fit into the type `i8` whose range is `-128..=127`
+ = note: the literal `-129_i8` does not fit into the type `i8` whose range is `-128..=127`
= help: consider using the type `i16` instead
error: literal out of range for `i32`
@@ -101,21 +101,21 @@ LL | let x = 2147483648_i32;
= help: consider using the type `u32` instead
error: literal out of range for `i32`
- --> $DIR/lint-type-overflow.rs:36:19
+ --> $DIR/lint-type-overflow.rs:36:18
|
LL | let x: i32 = -2147483649;
- | ^^^^^^^^^^
+ | ^^^^^^^^^^^
|
- = note: the literal `2147483649` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
+ = note: the literal `-2147483649` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `i64` instead
error: literal out of range for `i32`
- --> $DIR/lint-type-overflow.rs:37:14
+ --> $DIR/lint-type-overflow.rs:37:13
|
LL | let x = -2147483649_i32;
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^
|
- = note: the literal `2147483649_i32` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
+ = note: the literal `-2147483649_i32` does not fit into the type `i32` whose range is `-2147483648..=2147483647`
= help: consider using the type `i64` instead
error: literal out of range for `i32`
@@ -146,21 +146,21 @@ LL | let x = 18446744073709551615_i64;
= help: consider using the type `u64` instead
error: literal out of range for `i64`
- --> $DIR/lint-type-overflow.rs:43:19
+ --> $DIR/lint-type-overflow.rs:43:18
|
LL | let x: i64 = -9223372036854775809;
- | ^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^
|
- = note: the literal `9223372036854775809` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
+ = note: the literal `-9223372036854775809` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
= help: consider using the type `i128` instead
error: literal out of range for `i64`
- --> $DIR/lint-type-overflow.rs:44:14
+ --> $DIR/lint-type-overflow.rs:44:13
|
LL | let x = -9223372036854775809_i64;
- | ^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: the literal `9223372036854775809_i64` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
+ = note: the literal `-9223372036854775809_i64` does not fit into the type `i64` whose range is `-9223372036854775808..=9223372036854775807`
= help: consider using the type `i128` instead
error: aborting due to 18 previous errors
diff --git a/tests/ui/lint/lint-unexported-no-mangle.stderr b/tests/ui/lint/lint-unexported-no-mangle.stderr
index 858527822..0efec51ab 100644
--- a/tests/ui/lint/lint-unexported-no-mangle.stderr
+++ b/tests/ui/lint/lint-unexported-no-mangle.stderr
@@ -10,18 +10,22 @@ warning: lint `private_no_mangle_statics` has been removed: no longer a warning,
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: const items should never be `#[no_mangle]`
--> $DIR/lint-unexported-no-mangle.rs:9:1
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
index 677b5edc8..f12ce03dd 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
+++ b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
@@ -11,20 +11,24 @@ error[E0602]: unknown lint: `dead_cod`
error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/lint/lint-unknown-lint-cmdline.stderr b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
index 10db76ac4..f452fc9eb 100644
--- a/tests/ui/lint/lint-unknown-lint-cmdline.stderr
+++ b/tests/ui/lint/lint-unknown-lint-cmdline.stderr
@@ -11,20 +11,24 @@ warning[E0602]: unknown lint: `dead_cod`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 6 warnings emitted
diff --git a/tests/ui/lint/lint-unnecessary-parens.fixed b/tests/ui/lint/lint-unnecessary-parens.fixed
index bafac05d8..b17914da6 100644
--- a/tests/ui/lint/lint-unnecessary-parens.fixed
+++ b/tests/ui/lint/lint-unnecessary-parens.fixed
@@ -84,6 +84,14 @@ fn main() {
_a = 0; //~ ERROR unnecessary parentheses around assigned value
_a += 1; //~ ERROR unnecessary parentheses around assigned value
+ let mut _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let mut _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let mut _a = 3; //~ ERROR unnecessary parentheses around pattern
+
+ let _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let _a = 3; //~ ERROR unnecessary parentheses around pattern
+ let _a = 3; //~ ERROR unnecessary parentheses around pattern
+
let _a = baz!(3, 4);
let _b = baz!(3);
}
diff --git a/tests/ui/lint/lint-unnecessary-parens.rs b/tests/ui/lint/lint-unnecessary-parens.rs
index ce537a4dc..4cbd6562c 100644
--- a/tests/ui/lint/lint-unnecessary-parens.rs
+++ b/tests/ui/lint/lint-unnecessary-parens.rs
@@ -84,6 +84,14 @@ fn main() {
_a = (0); //~ ERROR unnecessary parentheses around assigned value
_a += (1); //~ ERROR unnecessary parentheses around assigned value
+ let(mut _a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let (mut _a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let( mut _a) = 3; //~ ERROR unnecessary parentheses around pattern
+
+ let(_a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let (_a) = 3; //~ ERROR unnecessary parentheses around pattern
+ let( _a) = 3; //~ ERROR unnecessary parentheses around pattern
+
let _a = baz!(3, 4);
let _b = baz!(3);
}
diff --git a/tests/ui/lint/lint-unnecessary-parens.stderr b/tests/ui/lint/lint-unnecessary-parens.stderr
index 2ad07530f..ba7a78b8d 100644
--- a/tests/ui/lint/lint-unnecessary-parens.stderr
+++ b/tests/ui/lint/lint-unnecessary-parens.stderr
@@ -267,5 +267,77 @@ LL - _a += (1);
LL + _a += 1;
|
-error: aborting due to 22 previous errors
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:87:8
+ |
+LL | let(mut _a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let(mut _a) = 3;
+LL + let mut _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:88:9
+ |
+LL | let (mut _a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let (mut _a) = 3;
+LL + let mut _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:89:8
+ |
+LL | let( mut _a) = 3;
+ | ^^ ^
+ |
+help: remove these parentheses
+ |
+LL - let( mut _a) = 3;
+LL + let mut _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:91:8
+ |
+LL | let(_a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let(_a) = 3;
+LL + let _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:92:9
+ |
+LL | let (_a) = 3;
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let (_a) = 3;
+LL + let _a = 3;
+ |
+
+error: unnecessary parentheses around pattern
+ --> $DIR/lint-unnecessary-parens.rs:93:8
+ |
+LL | let( _a) = 3;
+ | ^^ ^
+ |
+help: remove these parentheses
+ |
+LL - let( _a) = 3;
+LL + let _a = 3;
+ |
+
+error: aborting due to 28 previous errors
diff --git a/tests/ui/lint/missing-copy-implementations-non-exhaustive.rs b/tests/ui/lint/missing-copy-implementations-non-exhaustive.rs
new file mode 100644
index 000000000..2d5e90720
--- /dev/null
+++ b/tests/ui/lint/missing-copy-implementations-non-exhaustive.rs
@@ -0,0 +1,25 @@
+// Test for issue #116766.
+// Ensure that we don't suggest impl'ing `Copy` for a type if it or at least one
+// of it's variants are marked as `non_exhaustive`.
+
+// check-pass
+
+#![deny(missing_copy_implementations)]
+
+#[non_exhaustive]
+pub enum MyEnum {
+ A,
+}
+
+#[non_exhaustive]
+pub struct MyStruct {
+ foo: usize,
+}
+
+pub enum MyEnum2 {
+ #[non_exhaustive]
+ A,
+ B,
+}
+
+fn main() {}
diff --git a/tests/ui/lint/must_not_suspend/gated.stderr b/tests/ui/lint/must_not_suspend/gated.stderr
index 64de1ebea..f0d2117d4 100644
--- a/tests/ui/lint/must_not_suspend/gated.stderr
+++ b/tests/ui/lint/must_not_suspend/gated.stderr
@@ -18,6 +18,7 @@ LL | #![deny(must_not_suspend)]
= note: the `must_not_suspend` lint is unstable
= note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information
= help: add `#![feature(must_not_suspend)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `must_not_suspend`
--> $DIR/gated.rs:4:1
@@ -28,6 +29,7 @@ LL | #![deny(must_not_suspend)]
= note: the `must_not_suspend` lint is unstable
= note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information
= help: add `#![feature(must_not_suspend)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/lint/must_not_suspend/tuple-mismatch.rs b/tests/ui/lint/must_not_suspend/tuple-mismatch.rs
index c7e14e425..2f3c5d9ea 100644
--- a/tests/ui/lint/must_not_suspend/tuple-mismatch.rs
+++ b/tests/ui/lint/must_not_suspend/tuple-mismatch.rs
@@ -1,7 +1,7 @@
-#![feature(generators)]
+#![feature(coroutines)]
fn main() {
- let _generator = || {
+ let _coroutine = || {
yield ((), ((), ()));
yield ((), ());
//~^ ERROR mismatched types
diff --git a/tests/ui/lint/reasons-erroneous.rs b/tests/ui/lint/reasons-erroneous.rs
index cd693ae16..7b286eb1d 100644
--- a/tests/ui/lint/reasons-erroneous.rs
+++ b/tests/ui/lint/reasons-erroneous.rs
@@ -1,51 +1,27 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(lint_reasons)]
#![warn(absolute_paths_not_starting_with_crate, reason = 0)]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason must be a string literal
//~| NOTE reason must be a string literal
#![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason must be a string literal
//~| NOTE reason must be a string literal
#![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
//~| NOTE bad attribute argument
#![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
//~| NOTE bad attribute argument
#![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
-//~| NOTE bad attribute argument
//~| NOTE bad attribute argument
#![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason in lint attribute must come last
//~| NOTE reason in lint attribute must come last
#![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)]
//~^ ERROR malformed lint attribute
-//~| ERROR malformed lint attribute
-//~| NOTE reason in lint attribute must come last
//~| NOTE reason in lint attribute must come last
#![warn(missing_copy_implementations, reason)]
//~^ WARN unknown lint
diff --git a/tests/ui/lint/reasons-erroneous.stderr b/tests/ui/lint/reasons-erroneous.stderr
index 5521af17c..003da5673 100644
--- a/tests/ui/lint/reasons-erroneous.stderr
+++ b/tests/ui/lint/reasons-erroneous.stderr
@@ -1,5 +1,5 @@
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:3:58
+ --> $DIR/reasons-erroneous.rs:5:58
|
LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)]
| ^ reason must be a string literal
@@ -11,121 +11,43 @@ LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condem
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
+ --> $DIR/reasons-erroneous.rs:11:29
|
LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
- |
-LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
- |
-LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
- |
-LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
- |
-LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
- |
-LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:40:44
- |
-LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")]
- | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:45:25
- |
-LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:3:58
- |
-LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)]
- | ^ reason must be a string literal
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:8:40
- |
-LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
- |
-LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:13:29
- |
-LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
- |
-LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:22:23
+ --> $DIR/reasons-erroneous.rs:14:23
|
LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
- |
-LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
-
-error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:31:36
+ --> $DIR/reasons-erroneous.rs:17:36
|
LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:40:44
+ --> $DIR/reasons-erroneous.rs:20:44
|
LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")]
| ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
error[E0452]: malformed lint attribute input
- --> $DIR/reasons-erroneous.rs:45:25
+ --> $DIR/reasons-erroneous.rs:23:25
|
LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last
warning: unknown lint: `reason`
- --> $DIR/reasons-erroneous.rs:50:39
+ --> $DIR/reasons-erroneous.rs:26:39
|
LL | #![warn(missing_copy_implementations, reason)]
| ^^^^^^
|
= note: `#[warn(unknown_lints)]` on by default
-error: aborting due to 20 previous errors; 1 warning emitted
+error: aborting due to 7 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0452`.
diff --git a/tests/ui/lint/reference_casting.rs b/tests/ui/lint/reference_casting.rs
index fba8789e9..25e0c75f7 100644
--- a/tests/ui/lint/reference_casting.rs
+++ b/tests/ui/lint/reference_casting.rs
@@ -64,6 +64,10 @@ unsafe fn ref_to_mut() {
let _num = &mut *num;
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
+ let cell = &std::cell::UnsafeCell::new(0);
+ let _num = &mut *(cell as *const _ as *mut i32);
+ //~^ ERROR casting `&T` to `&mut T` is undefined behavior
+
unsafe fn generic_ref_cast_mut<T>(this: &T) -> &mut T {
&mut *((this as *const _) as *mut _)
//~^ ERROR casting `&T` to `&mut T` is undefined behavior
@@ -106,6 +110,8 @@ unsafe fn assign_to_ref() {
std::mem::transmute::<*const i32, *mut i32>(num),
-1i32,
);
+ *((&std::cell::UnsafeCell::new(0)) as *const _ as *mut i32) = 5;
+ //~^ ERROR assigning to `&T` is undefined behavior
let value = num as *const i32 as *mut i32;
*value = 1;
@@ -148,6 +154,8 @@ unsafe fn no_warn() {
*RAW_PTR = 42; // RAW_PTR is defined outside the function body,
// make sure we don't ICE on it when trying to
// determine if we should lint on it or not.
+ let cell = &std::cell::UnsafeCell::new(0);
+ let _num = &mut *(cell.get() as *mut i32);
fn safe_as_mut<T>(x: &std::cell::UnsafeCell<T>) -> &mut T {
unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
diff --git a/tests/ui/lint/reference_casting.stderr b/tests/ui/lint/reference_casting.stderr
index 8f89cf980..8d5f8da68 100644
--- a/tests/ui/lint/reference_casting.stderr
+++ b/tests/ui/lint/reference_casting.stderr
@@ -158,7 +158,16 @@ LL | let _num = &mut *num;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:68:9
+ --> $DIR/reference_casting.rs:68:16
+ |
+LL | let _num = &mut *(cell as *const _ as *mut i32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+ = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`
+
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:72:9
|
LL | &mut *((this as *const _) as *mut _)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -166,7 +175,7 @@ LL | &mut *((this as *const _) as *mut _)
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:73:18
+ --> $DIR/reference_casting.rs:77:18
|
LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -174,7 +183,7 @@ LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *con
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
- --> $DIR/reference_casting.rs:78:18
+ --> $DIR/reference_casting.rs:82:18
|
LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *const _) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -182,7 +191,7 @@ LL | unsafe { &mut *std::cell::UnsafeCell::raw_get(x as *const _ as *con
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:88:5
+ --> $DIR/reference_casting.rs:92:5
|
LL | *(a as *const _ as *mut _) = String::from("Replaced");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -190,7 +199,7 @@ LL | *(a as *const _ as *mut _) = String::from("Replaced");
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:90:5
+ --> $DIR/reference_casting.rs:94:5
|
LL | *(a as *const _ as *mut String) += " world";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -198,7 +207,7 @@ LL | *(a as *const _ as *mut String) += " world";
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:92:5
+ --> $DIR/reference_casting.rs:96:5
|
LL | *std::ptr::from_ref(num).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -206,7 +215,7 @@ LL | *std::ptr::from_ref(num).cast_mut() += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:94:5
+ --> $DIR/reference_casting.rs:98:5
|
LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -214,7 +223,7 @@ LL | *std::ptr::from_ref({ num }).cast_mut() += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:96:5
+ --> $DIR/reference_casting.rs:100:5
|
LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -222,7 +231,7 @@ LL | *{ std::ptr::from_ref(num) }.cast_mut() += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:98:5
+ --> $DIR/reference_casting.rs:102:5
|
LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -230,7 +239,7 @@ LL | *(std::ptr::from_ref({ num }) as *mut i32) += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:100:5
+ --> $DIR/reference_casting.rs:104:5
|
LL | *std::mem::transmute::<_, *mut i32>(num) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -238,7 +247,7 @@ LL | *std::mem::transmute::<_, *mut i32>(num) += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:102:5
+ --> $DIR/reference_casting.rs:106:5
|
LL | *(std::mem::transmute::<_, *mut i32>(num) as *mut i32) += 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -246,7 +255,7 @@ LL | *(std::mem::transmute::<_, *mut i32>(num) as *mut i32) += 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:104:5
+ --> $DIR/reference_casting.rs:108:5
|
LL | / std::ptr::write(
LL | |
@@ -258,7 +267,16 @@ LL | | );
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:111:5
+ --> $DIR/reference_casting.rs:113:5
+ |
+LL | *((&std::cell::UnsafeCell::new(0)) as *const _ as *mut i32) = 5;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+ = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`
+
+error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
+ --> $DIR/reference_casting.rs:117:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -268,7 +286,7 @@ LL | *value = 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:114:5
+ --> $DIR/reference_casting.rs:120:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -279,7 +297,7 @@ LL | *value_rebind = 1;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:116:5
+ --> $DIR/reference_casting.rs:122:5
|
LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -287,7 +305,7 @@ LL | *(num as *const i32).cast::<i32>().cast_mut() = 2;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:118:5
+ --> $DIR/reference_casting.rs:124:5
|
LL | *(num as *const _ as usize as *mut i32) = 2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -295,7 +313,7 @@ LL | *(num as *const _ as usize as *mut i32) = 2;
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:120:5
+ --> $DIR/reference_casting.rs:126:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -306,7 +324,7 @@ LL | std::ptr::write(value, 2);
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:122:5
+ --> $DIR/reference_casting.rs:128:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -317,7 +335,7 @@ LL | std::ptr::write_unaligned(value, 2);
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:124:5
+ --> $DIR/reference_casting.rs:130:5
|
LL | let value = num as *const i32 as *mut i32;
| ----------------------------- casting happend here
@@ -328,12 +346,12 @@ LL | std::ptr::write_volatile(value, 2);
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
error: assigning to `&T` is undefined behavior, consider using an `UnsafeCell`
- --> $DIR/reference_casting.rs:128:9
+ --> $DIR/reference_casting.rs:134:9
|
LL | *(this as *const _ as *mut _) = a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
-error: aborting due to 38 previous errors
+error: aborting due to 40 previous errors
diff --git a/tests/ui/lint/register-tool-lint.stderr b/tests/ui/lint/register-tool-lint.stderr
index 842d845ff..7ebdbdec9 100644
--- a/tests/ui/lint/register-tool-lint.stderr
+++ b/tests/ui/lint/register-tool-lint.stderr
@@ -13,6 +13,7 @@ LL | #![warn(abc::my_lint)]
| ^^^
|
= help: add `#![register_tool(abc)]` to the crate root
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs
new file mode 100644
index 000000000..1e2ff12a2
--- /dev/null
+++ b/tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.rs
@@ -0,0 +1,30 @@
+// check-pass
+// incremental
+
+#![feature(lint_reasons)]
+#![warn(unused)]
+
+struct OneUnused;
+struct TwoUnused;
+
+impl OneUnused {
+ #[expect(unused)]
+ fn unused() {}
+}
+
+impl TwoUnused {
+ #[expect(unused)]
+ fn unused1(){}
+
+ // This unused method has `#[expect(unused)]`, so the compiler should not emit a warning.
+ // This ui test was added after a regression in the compiler where it did not recognize multiple
+ // `#[expect(unused)]` annotations inside of impl blocks.
+ // issue 114416
+ #[expect(unused)]
+ fn unused2(){}
+}
+
+fn main() {
+ let _ = OneUnused;
+ let _ = TwoUnused;
+}
diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
index 479ee198e..77cb5e88b 100644
--- a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
+++ b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.rs
@@ -1,24 +1,20 @@
+// compile-flags: -Zdeduplicate-diagnostics=yes
+
#![feature(lint_reasons)]
#[forbid(unused_variables)]
//~^ NOTE `forbid` level set here
-//~| NOTE `forbid` level set here
#[expect(unused_variables)]
//~^ ERROR incompatible with previous forbid [E0453]
//~| NOTE overruled by previous forbid
-//~| ERROR incompatible with previous forbid [E0453]
-//~| NOTE overruled by previous forbid
fn expect_forbidden_lint_1() {}
#[forbid(while_true)]
//~^ NOTE `forbid` level set here
-//~| NOTE `forbid` level set here
//~| NOTE the lint level is defined here
#[expect(while_true)]
//~^ ERROR incompatible with previous forbid [E0453]
//~| NOTE overruled by previous forbid
-//~| ERROR incompatible with previous forbid [E0453]
-//~| NOTE overruled by previous forbid
fn expect_forbidden_lint_2() {
// This while loop will produce a `while_true` lint as the lint level
// at this node is still `forbid` and the `while_true` check happens
diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr
index a8116e934..0f42ffbde 100644
--- a/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr
+++ b/tests/ui/lint/rfc-2383-lint-reason/expect_with_forbid.stderr
@@ -1,32 +1,14 @@
error[E0453]: expect(unused_variables) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:6:10
+ --> $DIR/expect_with_forbid.rs:7:10
|
LL | #[forbid(unused_variables)]
| ---------------- `forbid` level set here
-...
-LL | #[expect(unused_variables)]
- | ^^^^^^^^^^^^^^^^ overruled by previous forbid
-
-error[E0453]: expect(while_true) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:17:10
- |
-LL | #[forbid(while_true)]
- | ---------- `forbid` level set here
-...
-LL | #[expect(while_true)]
- | ^^^^^^^^^^ overruled by previous forbid
-
-error[E0453]: expect(unused_variables) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:6:10
- |
-LL | #[forbid(unused_variables)]
- | ---------------- `forbid` level set here
-...
+LL |
LL | #[expect(unused_variables)]
| ^^^^^^^^^^^^^^^^ overruled by previous forbid
error[E0453]: expect(while_true) incompatible with previous forbid
- --> $DIR/expect_with_forbid.rs:17:10
+ --> $DIR/expect_with_forbid.rs:15:10
|
LL | #[forbid(while_true)]
| ---------- `forbid` level set here
@@ -35,17 +17,17 @@ LL | #[expect(while_true)]
| ^^^^^^^^^^ overruled by previous forbid
error: denote infinite loops with `loop { ... }`
- --> $DIR/expect_with_forbid.rs:26:5
+ --> $DIR/expect_with_forbid.rs:22:5
|
LL | while true {}
| ^^^^^^^^^^ help: use `loop`
|
note: the lint level is defined here
- --> $DIR/expect_with_forbid.rs:13:10
+ --> $DIR/expect_with_forbid.rs:12:10
|
LL | #[forbid(while_true)]
| ^^^^^^^^^^
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0453`.
diff --git a/tests/ui/lint/unaligned_references.rs b/tests/ui/lint/unaligned_references.rs
index 0c9c79c08..3f6dab354 100644
--- a/tests/ui/lint/unaligned_references.rs
+++ b/tests/ui/lint/unaligned_references.rs
@@ -1,3 +1,6 @@
+use std::mem::ManuallyDrop;
+use std::fmt::Debug;
+
#[repr(packed)]
pub struct Good {
data: u64,
@@ -27,6 +30,26 @@ impl Foo for Packed2 {
}
}
+// Test for #115396
+fn packed_dyn() {
+ #[repr(packed)]
+ struct Unaligned<T: ?Sized>(ManuallyDrop<T>);
+
+ let ref local = Unaligned(ManuallyDrop::new([3, 5, 8u64]));
+ let foo: &Unaligned<dyn Debug> = &*local;
+ println!("{:?}", &*foo.0); //~ ERROR reference to packed field
+ let foo: &Unaligned<[u64]> = &*local;
+ println!("{:?}", &*foo.0); //~ ERROR reference to packed field
+
+ // Even if the actual alignment is 1, we cannot know that when looking at `dyn Debug.`
+ let ref local = Unaligned(ManuallyDrop::new([3, 5, 8u8]));
+ let foo: &Unaligned<dyn Debug> = &*local;
+ println!("{:?}", &*foo.0); //~ ERROR reference to packed field
+ // However, we *can* know the alignment when looking at a slice.
+ let foo: &Unaligned<[u8]> = &*local;
+ println!("{:?}", &*foo.0); // no error!
+}
+
fn main() {
unsafe {
let good = Good { data: 0, ptr: &0, data2: [0, 0], aligned: [0; 32] };
diff --git a/tests/ui/lint/unaligned_references.stderr b/tests/ui/lint/unaligned_references.stderr
index d3abc3766..328cafbd9 100644
--- a/tests/ui/lint/unaligned_references.stderr
+++ b/tests/ui/lint/unaligned_references.stderr
@@ -1,5 +1,5 @@
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:25:13
+ --> $DIR/unaligned_references.rs:28:13
|
LL | &self.x;
| ^^^^^^^
@@ -9,7 +9,37 @@ LL | &self.x;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:34:17
+ --> $DIR/unaligned_references.rs:40:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:42:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:47:24
+ |
+LL | println!("{:?}", &*foo.0);
+ | ^^^^^
+ |
+ = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+ = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+error[E0793]: reference to packed field is unaligned
+ --> $DIR/unaligned_references.rs:57:17
|
LL | let _ = &good.ptr;
| ^^^^^^^^^
@@ -19,7 +49,7 @@ LL | let _ = &good.ptr;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:35:17
+ --> $DIR/unaligned_references.rs:58:17
|
LL | let _ = &good.data;
| ^^^^^^^^^^
@@ -29,7 +59,7 @@ LL | let _ = &good.data;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:37:17
+ --> $DIR/unaligned_references.rs:60:17
|
LL | let _ = &good.data as *const _;
| ^^^^^^^^^^
@@ -39,7 +69,7 @@ LL | let _ = &good.data as *const _;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:38:27
+ --> $DIR/unaligned_references.rs:61:27
|
LL | let _: *const _ = &good.data;
| ^^^^^^^^^^
@@ -49,7 +79,7 @@ LL | let _: *const _ = &good.data;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:40:17
+ --> $DIR/unaligned_references.rs:63:17
|
LL | let _ = good.data.clone();
| ^^^^^^^^^
@@ -59,7 +89,7 @@ LL | let _ = good.data.clone();
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:42:17
+ --> $DIR/unaligned_references.rs:65:17
|
LL | let _ = &good.data2[0];
| ^^^^^^^^^^^^^^
@@ -69,7 +99,7 @@ LL | let _ = &good.data2[0];
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:51:17
+ --> $DIR/unaligned_references.rs:74:17
|
LL | let _ = &packed2.x;
| ^^^^^^^^^^
@@ -79,7 +109,7 @@ LL | let _ = &packed2.x;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:90:20
+ --> $DIR/unaligned_references.rs:113:20
|
LL | let _ref = &m1.1.a;
| ^^^^^^^
@@ -89,7 +119,7 @@ LL | let _ref = &m1.1.a;
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
error[E0793]: reference to packed field is unaligned
- --> $DIR/unaligned_references.rs:93:20
+ --> $DIR/unaligned_references.rs:116:20
|
LL | let _ref = &m2.1.a;
| ^^^^^^^
@@ -98,6 +128,6 @@ LL | let _ref = &m2.1.a;
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
-error: aborting due to 10 previous errors
+error: aborting due to 13 previous errors
For more information about this error, try `rustc --explain E0793`.
diff --git a/tests/ui/lint/unused/issue-117284-arg-in-macro.rs b/tests/ui/lint/unused/issue-117284-arg-in-macro.rs
new file mode 100644
index 000000000..eea0f4c59
--- /dev/null
+++ b/tests/ui/lint/unused/issue-117284-arg-in-macro.rs
@@ -0,0 +1,17 @@
+#![deny(unused_variables)]
+macro_rules! make_var {
+ ($struct:ident, $var:ident) => {
+ let $var = $struct.$var;
+ };
+}
+
+#[allow(unused)]
+struct MyStruct {
+ var: i32,
+}
+
+fn main() {
+ let s = MyStruct { var: 42 };
+ make_var!(s, var); //~ ERROR unused variable: `var`
+ let a = 1; //~ ERROR unused variable: `a`
+}
diff --git a/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr
new file mode 100644
index 000000000..84efaa4f3
--- /dev/null
+++ b/tests/ui/lint/unused/issue-117284-arg-in-macro.stderr
@@ -0,0 +1,29 @@
+error: unused variable: `var`
+ --> $DIR/issue-117284-arg-in-macro.rs:15:18
+ |
+LL | make_var!(s, var);
+ | ^^^
+ |
+help: `var` is captured in macro and introduced a unused variable
+ --> $DIR/issue-117284-arg-in-macro.rs:4:13
+ |
+LL | let $var = $struct.$var;
+ | ^^^^
+...
+LL | make_var!(s, var);
+ | ----------------- in this macro invocation
+note: the lint level is defined here
+ --> $DIR/issue-117284-arg-in-macro.rs:1:9
+ |
+LL | #![deny(unused_variables)]
+ | ^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `make_var` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: unused variable: `a`
+ --> $DIR/issue-117284-arg-in-macro.rs:16:9
+ |
+LL | let a = 1;
+ | ^ help: if this is intentional, prefix it with an underscore: `_a`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs b/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs
index 8064c3a88..c5dd281cb 100644
--- a/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs
+++ b/tests/ui/lint/unused/issue-74883-unused-paren-baren-yield.rs
@@ -1,8 +1,8 @@
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
#![deny(unused_braces, unused_parens)]
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
diff --git a/tests/ui/lint/unused/lint-unused-imports.rs b/tests/ui/lint/unused/lint-unused-imports.rs
index 953992ecf..4fa6511c9 100644
--- a/tests/ui/lint/unused/lint-unused-imports.rs
+++ b/tests/ui/lint/unused/lint-unused-imports.rs
@@ -42,7 +42,7 @@ mod foo {
pub struct Square{pub p: Point, pub h: usize, pub w: usize}
}
-mod bar {
+pub mod bar {
// Don't ignore on 'pub use' because we're not sure if it's used or not
pub use std::cmp::PartialEq;
pub struct Square;
diff --git a/tests/ui/lint/unused/unused-closure.rs b/tests/ui/lint/unused/unused-closure.rs
index c96c90731..12ee8b3a9 100644
--- a/tests/ui/lint/unused/unused-closure.rs
+++ b/tests/ui/lint/unused/unused-closure.rs
@@ -1,8 +1,8 @@
-// Test that closures and generators are "must use" types.
+// Test that closures and coroutines are "must use" types.
// edition:2018
#![feature(async_closure)]
-#![feature(generators)]
+#![feature(coroutines)]
#![deny(unused_must_use)]
fn unused() {
diff --git a/tests/ui/liveness/liveness-upvars.rs b/tests/ui/liveness/liveness-upvars.rs
index d446d57d3..17158dfbc 100644
--- a/tests/ui/liveness/liveness-upvars.rs
+++ b/tests/ui/liveness/liveness-upvars.rs
@@ -1,6 +1,6 @@
// edition:2018
// check-pass
-#![feature(generators)]
+#![feature(coroutines)]
#![warn(unused)]
#![allow(unreachable_code)]
@@ -60,7 +60,7 @@ pub fn f() {
};
let _ = async move {
println!("{}", c);
- // Never read because this is a generator.
+ // Never read because this is a coroutine.
c += 1; //~ WARN value assigned to `c` is never read
};
}
@@ -110,7 +110,7 @@ async fn yield_now() {
todo!();
}
-pub fn async_generator() {
+pub fn async_coroutine() {
let mut state: u32 = 0;
let _ = async {
@@ -129,7 +129,7 @@ pub fn async_generator() {
};
}
-pub fn generator() {
+pub fn coroutine() {
let mut s: u32 = 0;
let _ = |_| {
s = 0;
diff --git a/tests/ui/loops/loop-break-value.stderr b/tests/ui/loops/loop-break-value.stderr
index 6c83bc757..a691960f9 100644
--- a/tests/ui/loops/loop-break-value.stderr
+++ b/tests/ui/loops/loop-break-value.stderr
@@ -319,7 +319,7 @@ error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:159:15
|
LL | fn main() {
- | - expected `()` because of this return type
+ | - expected `()` because of this return type
...
LL | loop { // point at the return type
| ---- this loop is expected to be of type `()`
diff --git a/tests/ui/lub-glb/old-lub-glb-object.stderr b/tests/ui/lub-glb/old-lub-glb-object.stderr
index 3d0c171e0..c476d6f69 100644
--- a/tests/ui/lub-glb/old-lub-glb-object.stderr
+++ b/tests/ui/lub-glb/old-lub-glb-object.stderr
@@ -15,6 +15,7 @@ LL | _ => y,
|
= note: expected trait object `dyn for<'a, 'b> Foo<&'a u8, &'b u8>`
found trait object `dyn for<'a> Foo<&'a u8, &'a u8>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/macros/assert-long-condition.rs b/tests/ui/macros/assert-long-condition.rs
new file mode 100644
index 000000000..1974ec9d6
--- /dev/null
+++ b/tests/ui/macros/assert-long-condition.rs
@@ -0,0 +1,9 @@
+// run-fail
+// check-run-results
+// exec-env:RUST_BACKTRACE=0
+// ignore-emscripten no processes
+// ignore-tidy-linelength
+
+fn main() {
+ assert!(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0);
+}
diff --git a/tests/ui/macros/assert-long-condition.run.stderr b/tests/ui/macros/assert-long-condition.run.stderr
new file mode 100644
index 000000000..16e56c927
--- /dev/null
+++ b/tests/ui/macros/assert-long-condition.run.stderr
@@ -0,0 +1,4 @@
+thread 'main' panicked at $DIR/assert-long-condition.rs:8:5:
+assertion failed: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18
+ + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/macros/builtin-std-paths-fail.stderr b/tests/ui/macros/builtin-std-paths-fail.stderr
index 004a39043..331943843 100644
--- a/tests/ui/macros/builtin-std-paths-fail.stderr
+++ b/tests/ui/macros/builtin-std-paths-fail.stderr
@@ -15,12 +15,16 @@ error[E0433]: failed to resolve: could not find `RustcDecodable` in `core`
|
LL | core::RustcDecodable,
| ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `core`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: could not find `RustcDecodable` in `core`
--> $DIR/builtin-std-paths-fail.rs:4:11
|
LL | core::RustcDecodable,
| ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `core`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: could not find `bench` in `core`
--> $DIR/builtin-std-paths-fail.rs:7:9
@@ -63,12 +67,16 @@ error[E0433]: failed to resolve: could not find `RustcDecodable` in `std`
|
LL | std::RustcDecodable,
| ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `std`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: could not find `RustcDecodable` in `std`
--> $DIR/builtin-std-paths-fail.rs:16:10
|
LL | std::RustcDecodable,
| ^^^^^^^^^^^^^^ could not find `RustcDecodable` in `std`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: could not find `bench` in `std`
--> $DIR/builtin-std-paths-fail.rs:19:8
diff --git a/tests/ui/macros/meta-item-absolute-path.stderr b/tests/ui/macros/meta-item-absolute-path.stderr
index c53971e24..f0d763d7a 100644
--- a/tests/ui/macros/meta-item-absolute-path.stderr
+++ b/tests/ui/macros/meta-item-absolute-path.stderr
@@ -9,6 +9,8 @@ error[E0433]: failed to resolve: maybe a missing crate `Absolute`?
|
LL | #[derive(::Absolute)]
| ^^^^^^^^ maybe a missing crate `Absolute`?
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs
index 816f99baa..70ca00285 100644
--- a/tests/ui/macros/stringify.rs
+++ b/tests/ui/macros/stringify.rs
@@ -2,495 +2,443 @@
// edition:2021
// compile-flags: --test
+#![allow(incomplete_features)]
#![feature(async_closure)]
+#![feature(auto_traits)]
#![feature(box_patterns)]
#![feature(const_trait_impl)]
+#![feature(coroutines)]
#![feature(decl_macro)]
-#![feature(generators)]
+#![feature(explicit_tail_calls)]
#![feature(more_qualified_paths)]
#![feature(raw_ref_op)]
#![feature(trait_alias)]
#![feature(try_blocks)]
#![feature(type_ascription)]
+#![feature(yeet_expr)]
#![deny(unused_macros)]
-macro_rules! stringify_block {
- ($block:block) => {
- stringify!($block)
+// These macros force the use of AST pretty-printing by converting the input to
+// a particular fragment specifier.
+macro_rules! block { ($block:block) => { stringify!($block) }; }
+macro_rules! expr { ($expr:expr) => { stringify!($expr) }; }
+macro_rules! item { ($item:item) => { stringify!($item) }; }
+macro_rules! meta { ($meta:meta) => { stringify!($meta) }; }
+macro_rules! pat { ($pat:pat) => { stringify!($pat) }; }
+macro_rules! path { ($path:path) => { stringify!($path) }; }
+macro_rules! stmt { ($stmt:stmt) => { stringify!($stmt) }; }
+macro_rules! ty { ($ty:ty) => { stringify!($ty) }; }
+macro_rules! vis { ($vis:vis) => { stringify!($vis) }; }
+
+// Use this when AST pretty-printing and TokenStream pretty-printing give
+// the same result (which is preferable.)
+macro_rules! c1 {
+ ($frag:ident, [$($tt:tt)*], $s:literal) => {
+ assert_eq!($frag!($($tt)*), $s);
+ assert_eq!(stringify!($($tt)*), $s);
};
}
-macro_rules! stringify_expr {
- ($expr:expr) => {
- stringify!($expr)
- };
-}
-
-macro_rules! stringify_item {
- ($item:item) => {
- stringify!($item)
- };
-}
-
-macro_rules! stringify_meta {
- ($meta:meta) => {
- stringify!($meta)
- };
-}
-
-macro_rules! stringify_pat {
- ($pat:pat) => {
- stringify!($pat)
- };
-}
-
-macro_rules! stringify_path {
- ($path:path) => {
- stringify!($path)
- };
-}
-
-macro_rules! stringify_stmt {
- ($stmt:stmt) => {
- stringify!($stmt)
- };
-}
-
-macro_rules! stringify_ty {
- ($ty:ty) => {
- stringify!($ty)
- };
-}
-
-macro_rules! stringify_vis {
- ($vis:vis) => {
- stringify!($vis)
+// Use this when AST pretty-printing and TokenStream pretty-printing give
+// different results.
+//
+// `c1` and `c2` could be in a single macro, but having them separate makes it
+// easy to find the cases where the two pretty-printing approaches give
+// different results.
+macro_rules! c2 {
+ ($frag:ident, [$($tt:tt)*], $s1:literal, $s2:literal) => {
+ assert_ne!($s1, $s2, "should use `c1!` instead");
+ assert_eq!($frag!($($tt)*), $s1);
+ assert_eq!(stringify!($($tt)*), $s2);
};
}
#[test]
fn test_block() {
- assert_eq!(stringify_block!({}), "{}");
- assert_eq!(stringify_block!({ true }), "{ true }");
- assert_eq!(stringify_block!({ return }), "{ return }");
- assert_eq!(
- stringify_block!({
+ c1!(block, [ {} ], "{}");
+ c1!(block, [ { true } ], "{ true }");
+ c1!(block, [ { return } ], "{ return }");
+ c2!(block, [ {
return;
- }),
+ } ],
"{ return; }",
+ "{ return ; }"
);
- assert_eq!(
- stringify_block!({
+ c2!(block,
+ [ {
let _;
true
- }),
+ } ],
"{ let _; true }",
+ "{ let _ ; true }"
);
}
#[test]
fn test_expr() {
// ExprKind::Array
- assert_eq!(stringify_expr!([]), "[]");
- assert_eq!(stringify_expr!([true]), "[true]");
- assert_eq!(stringify_expr!([true,]), "[true]");
- assert_eq!(stringify_expr!([true, true]), "[true, true]");
+ c1!(expr, [ [] ], "[]");
+ c1!(expr, [ [true] ], "[true]");
+ c2!(expr, [ [true,] ], "[true]", "[true,]");
+ c1!(expr, [ [true, true] ], "[true, true]");
+
+ // ExprKind::ConstBlock
+ // FIXME: todo
// ExprKind::Call
- assert_eq!(stringify_expr!(f()), "f()");
- assert_eq!(stringify_expr!(f::<u8>()), "f::<u8>()");
- assert_eq!(stringify_expr!(f::<1>()), "f::<1>()");
- assert_eq!(stringify_expr!(f::<'a, u8, 1>()), "f::<'a, u8, 1>()");
- assert_eq!(stringify_expr!(f(true)), "f(true)");
- assert_eq!(stringify_expr!(f(true,)), "f(true)");
- assert_eq!(stringify_expr!(()()), "()()");
+ c1!(expr, [ f() ], "f()");
+ c2!(expr, [ f::<u8>() ], "f::<u8>()", "f :: < u8 > ()");
+ c2!(expr, [ f::<1>() ], "f::<1>()", "f :: < 1 > ()");
+ c2!(expr, [ f::<'a, u8, 1>() ], "f::<'a, u8, 1>()", "f :: < 'a, u8, 1 > ()");
+ c1!(expr, [ f(true) ], "f(true)");
+ c2!(expr, [ f(true,) ], "f(true)", "f(true,)");
+ c2!(expr, [ ()() ], "()()", "() ()");
// ExprKind::MethodCall
- assert_eq!(stringify_expr!(x.f()), "x.f()");
- assert_eq!(stringify_expr!(x.f::<u8>()), "x.f::<u8>()");
+ c1!(expr, [ x.f() ], "x.f()");
+ c2!(expr, [ x.f::<u8>() ], "x.f::<u8>()", "x.f :: < u8 > ()");
+ c2!(expr, [ x.collect::<Vec<_>>() ], "x.collect::<Vec<_>>()", "x.collect :: < Vec < _ >> ()");
// ExprKind::Tup
- assert_eq!(stringify_expr!(()), "()");
- assert_eq!(stringify_expr!((true,)), "(true,)");
- assert_eq!(stringify_expr!((true, false)), "(true, false)");
- assert_eq!(stringify_expr!((true, false,)), "(true, false)");
+ c1!(expr, [ () ], "()");
+ c1!(expr, [ (true,) ], "(true,)");
+ c1!(expr, [ (true, false) ], "(true, false)");
+ c2!(expr, [ (true, false,) ], "(true, false)", "(true, false,)");
// ExprKind::Binary
- assert_eq!(stringify_expr!(true || false), "true || false");
- assert_eq!(stringify_expr!(true || false && false), "true || false && false");
+ c1!(expr, [ true || false ], "true || false");
+ c1!(expr, [ true || false && false ], "true || false && false");
+ c1!(expr, [ a < 1 && 2 < b && c > 3 && 4 > d ], "a < 1 && 2 < b && c > 3 && 4 > d");
+ c2!(expr, [ a & b & !c ], "a & b & !c", "a & b &! c"); // FIXME
+ c2!(expr,
+ [ a + b * c - d + -1 * -2 - -3],
+ "a + b * c - d + -1 * -2 - -3",
+ "a + b * c - d + - 1 * - 2 - - 3"
+ );
+ c2!(expr, [ x = !y ], "x = !y", "x =! y"); // FIXME
// ExprKind::Unary
- assert_eq!(stringify_expr!(*expr), "*expr");
- assert_eq!(stringify_expr!(!expr), "!expr");
- assert_eq!(stringify_expr!(-expr), "-expr");
+ c2!(expr, [ *expr ], "*expr", "* expr");
+ c2!(expr, [ !expr ], "!expr", "! expr");
+ c2!(expr, [ -expr ], "-expr", "- expr");
// ExprKind::Lit
- assert_eq!(stringify_expr!('x'), "'x'");
- assert_eq!(stringify_expr!(1_000_i8), "1_000_i8");
- assert_eq!(stringify_expr!(1.00000000000000001), "1.00000000000000001");
+ c1!(expr, [ 'x' ], "'x'");
+ c1!(expr, [ 1_000_i8 ], "1_000_i8");
+ c1!(expr, [ 1.00000000000000001 ], "1.00000000000000001");
// ExprKind::Cast
- assert_eq!(stringify_expr!(expr as T), "expr as T");
- assert_eq!(stringify_expr!(expr as T<u8>), "expr as T<u8>");
+ c1!(expr, [ expr as T ], "expr as T");
+ c2!(expr, [ expr as T<u8> ], "expr as T<u8>", "expr as T < u8 >");
+
+ // ExprKind::Type: there is no syntax for type ascription.
- // ExprKind::Type
- // There is no syntax for type ascription.
+ // ExprKind::Let
+ c1!(expr, [ if let Some(a) = b { c } else { d } ], "if let Some(a) = b { c } else { d }");
// ExprKind::If
- assert_eq!(stringify_expr!(if true {}), "if true {}");
- assert_eq!(
- stringify_expr!(if true {
- } else {
- }),
- "if true {} else {}",
- );
- assert_eq!(
- stringify_expr!(if let true = true {
- } else {
- }),
- "if let true = true {} else {}",
- );
- assert_eq!(
- stringify_expr!(if true {
+ c1!(expr, [ if true {} ], "if true {}");
+ c2!(expr, [ if !true {} ], "if !true {}", "if! true {}"); // FIXME
+ c2!(expr,
+ [ if ::std::blah() { } else { } ],
+ "if ::std::blah() {} else {}",
+ "if :: std :: blah() {} else {}"
+ );
+ c1!(expr, [ if let true = true {} else {} ], "if let true = true {} else {}");
+ c1!(expr,
+ [ if true {
} else if false {
- }),
- "if true {} else if false {}",
+ } ],
+ "if true {} else if false {}"
);
- assert_eq!(
- stringify_expr!(if true {
+ c1!(expr,
+ [ if true {
} else if false {
} else {
- }),
- "if true {} else if false {} else {}",
+ } ],
+ "if true {} else if false {} else {}"
);
- assert_eq!(
- stringify_expr!(if true {
+ c2!(expr,
+ [ if true {
return;
} else if false {
0
} else {
0
- }),
+ } ],
"if true { return; } else if false { 0 } else { 0 }",
+ "if true { return ; } else if false { 0 } else { 0 }"
);
// ExprKind::While
- assert_eq!(stringify_expr!(while true {}), "while true {}");
- assert_eq!(stringify_expr!('a: while true {}), "'a: while true {}");
- assert_eq!(stringify_expr!(while let true = true {}), "while let true = true {}");
+ c1!(expr, [ while true {} ], "while true {}");
+ c2!(expr, [ 'a: while true {} ], "'a: while true {}", "'a : while true {}");
+ c1!(expr, [ while let true = true {} ], "while let true = true {}");
// ExprKind::ForLoop
- assert_eq!(stringify_expr!(for _ in x {}), "for _ in x {}");
- assert_eq!(stringify_expr!('a: for _ in x {}), "'a: for _ in x {}");
+ c1!(expr, [ for _ in x {} ], "for _ in x {}");
+ c2!(expr, [ 'a: for _ in x {} ], "'a: for _ in x {}", "'a : for _ in x {}");
// ExprKind::Loop
- assert_eq!(stringify_expr!(loop {}), "loop {}");
- assert_eq!(stringify_expr!('a: loop {}), "'a: loop {}");
+ c1!(expr, [ loop {} ], "loop {}");
+ c2!(expr, [ 'a: loop {} ], "'a: loop {}", "'a : loop {}");
// ExprKind::Match
- assert_eq!(stringify_expr!(match self {}), "match self {}");
- assert_eq!(
- stringify_expr!(match self {
+ c1!(expr, [ match self {} ], "match self {}");
+ c1!(expr,
+ [ match self {
Ok => 1,
- }),
- "match self { Ok => 1, }",
+ } ],
+ "match self { Ok => 1, }"
);
- assert_eq!(
- stringify_expr!(match self {
+ c1!(expr,
+ [ match self {
Ok => 1,
Err => 0,
- }),
- "match self { Ok => 1, Err => 0, }",
+ } ],
+ "match self { Ok => 1, Err => 0, }"
);
// ExprKind::Closure
- assert_eq!(stringify_expr!(|| {}), "|| {}");
- assert_eq!(stringify_expr!(|x| {}), "|x| {}");
- assert_eq!(stringify_expr!(|x: u8| {}), "|x: u8| {}");
- assert_eq!(stringify_expr!(|| ()), "|| ()");
- assert_eq!(stringify_expr!(move || self), "move || self");
- assert_eq!(stringify_expr!(async || self), "async || self");
- assert_eq!(stringify_expr!(async move || self), "async move || self");
- assert_eq!(stringify_expr!(static || self), "static || self");
- assert_eq!(stringify_expr!(static move || self), "static move || self");
- #[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/5149
- assert_eq!(
- stringify_expr!(static async || self),
- "static async || self",
- );
- #[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/5149
- assert_eq!(
- stringify_expr!(static async move || self),
- "static async move || self",
- );
- assert_eq!(stringify_expr!(|| -> u8 { self }), "|| -> u8 { self }");
- assert_eq!(stringify_expr!(1 + || {}), "1 + (|| {})"); // ??
+ c1!(expr, [ || {} ], "|| {}");
+ c2!(expr, [ |x| {} ], "|x| {}", "| x | {}");
+ c2!(expr, [ |x: u8| {} ], "|x: u8| {}", "| x : u8 | {}");
+ c1!(expr, [ || () ], "|| ()");
+ c1!(expr, [ move || self ], "move || self");
+ c1!(expr, [ async || self ], "async || self");
+ c1!(expr, [ async move || self ], "async move || self");
+ c1!(expr, [ static || self ], "static || self");
+ c1!(expr, [ static move || self ], "static move || self");
+ c1!(expr, [ static async || self ], "static async || self");
+ c1!(expr, [ static async move || self ], "static async move || self");
+ c1!(expr, [ || -> u8 { self } ], "|| -> u8 { self }");
+ c2!(expr, [ 1 + || {} ], "1 + (|| {})", "1 + || {}"); // AST??
// ExprKind::Block
- assert_eq!(stringify_expr!({}), "{}");
- assert_eq!(stringify_expr!(unsafe {}), "unsafe {}");
- assert_eq!(stringify_expr!('a: {}), "'a: {}");
- assert_eq!(
- stringify_expr!(
- #[attr]
- {}
- ),
- "#[attr] {}",
- );
- assert_eq!(
- stringify_expr!(
+ c1!(expr, [ {} ], "{}");
+ c1!(expr, [ unsafe {} ], "unsafe {}");
+ c2!(expr, [ 'a: {} ], "'a: {}", "'a : {}");
+ c1!(expr, [ #[attr] {} ], "#[attr] {}");
+ c2!(expr,
+ [
{
#![attr]
}
- ),
+ ],
"{\n\
\x20 #![attr]\n\
}",
+ "{ #! [attr] }"
);
// ExprKind::Async
- assert_eq!(stringify_expr!(async {}), "async {}");
- assert_eq!(stringify_expr!(async move {}), "async move {}");
+ c1!(expr, [ async {} ], "async {}");
+ c1!(expr, [ async move {} ], "async move {}");
// ExprKind::Await
- assert_eq!(stringify_expr!(expr.await), "expr.await");
+ c1!(expr, [ expr.await ], "expr.await");
// ExprKind::TryBlock
- assert_eq!(stringify_expr!(try {}), "try {}");
+ c1!(expr, [ try {} ], "try {}");
// ExprKind::Assign
- assert_eq!(stringify_expr!(expr = true), "expr = true");
+ c1!(expr, [ expr = true ], "expr = true");
// ExprKind::AssignOp
- assert_eq!(stringify_expr!(expr += true), "expr += true");
+ c1!(expr, [ expr += true ], "expr += true");
// ExprKind::Field
- assert_eq!(stringify_expr!(expr.field), "expr.field");
- assert_eq!(stringify_expr!(expr.0), "expr.0");
+ c1!(expr, [ expr.field ], "expr.field");
+ c1!(expr, [ expr.0 ], "expr.0");
// ExprKind::Index
- assert_eq!(stringify_expr!(expr[true]), "expr[true]");
+ c2!(expr, [ expr[true] ], "expr[true]", "expr [true]");
// ExprKind::Range
- assert_eq!(stringify_expr!(..), "..");
- assert_eq!(stringify_expr!(..hi), "..hi");
- assert_eq!(stringify_expr!(lo..), "lo..");
- assert_eq!(stringify_expr!(lo..hi), "lo..hi");
- assert_eq!(stringify_expr!(..=hi), "..=hi");
- assert_eq!(stringify_expr!(lo..=hi), "lo..=hi");
- assert_eq!(stringify_expr!(-2..=-1), "-2..=-1");
+ c1!(expr, [ .. ], "..");
+ c2!(expr, [ ..hi ], "..hi", ".. hi");
+ c2!(expr, [ lo.. ], "lo..", "lo ..");
+ c2!(expr, [ lo..hi ], "lo..hi", "lo .. hi");
+ c2!(expr, [ ..=hi ], "..=hi", "..= hi");
+ c2!(expr, [ lo..=hi ], "lo..=hi", "lo ..= hi");
+ c2!(expr, [ -2..=-1 ], "-2..=-1", "- 2 ..= - 1");
+
+ // ExprKind::Underscore
+ // FIXME: todo
// ExprKind::Path
- assert_eq!(stringify_expr!(thing), "thing");
- assert_eq!(stringify_expr!(m::thing), "m::thing");
- assert_eq!(stringify_expr!(self::thing), "self::thing");
- assert_eq!(stringify_expr!(crate::thing), "crate::thing");
- assert_eq!(stringify_expr!(Self::thing), "Self::thing");
- assert_eq!(stringify_expr!(<Self as T>::thing), "<Self as T>::thing");
- assert_eq!(stringify_expr!(Self::<'static>), "Self::<'static>");
+ c1!(expr, [ thing ], "thing");
+ c2!(expr, [ m::thing ], "m::thing", "m :: thing");
+ c2!(expr, [ self::thing ], "self::thing", "self :: thing");
+ c2!(expr, [ crate::thing ], "crate::thing", "crate :: thing");
+ c2!(expr, [ Self::thing ], "Self::thing", "Self :: thing");
+ c2!(expr, [ <Self as T>::thing ], "<Self as T>::thing", "< Self as T > :: thing");
+ c2!(expr, [ Self::<'static> ], "Self::<'static>", "Self :: < 'static >");
// ExprKind::AddrOf
- assert_eq!(stringify_expr!(&expr), "&expr");
- assert_eq!(stringify_expr!(&mut expr), "&mut expr");
- assert_eq!(stringify_expr!(&raw const expr), "&raw const expr");
- assert_eq!(stringify_expr!(&raw mut expr), "&raw mut expr");
+ c2!(expr, [ &expr ], "&expr", "& expr");
+ c2!(expr, [ &mut expr ], "&mut expr", "& mut expr");
+ c2!(expr, [ &raw const expr ], "&raw const expr", "& raw const expr");
+ c2!(expr, [ &raw mut expr ], "&raw mut expr", "& raw mut expr");
// ExprKind::Break
- assert_eq!(stringify_expr!(break), "break");
- assert_eq!(stringify_expr!(break 'a), "break 'a");
- assert_eq!(stringify_expr!(break true), "break true");
- assert_eq!(stringify_expr!(break 'a true), "break 'a true");
+ c1!(expr, [ break ], "break");
+ c1!(expr, [ break 'a ], "break 'a");
+ c1!(expr, [ break true ], "break true");
+ c1!(expr, [ break 'a true ], "break 'a true");
// ExprKind::Continue
- assert_eq!(stringify_expr!(continue), "continue");
- assert_eq!(stringify_expr!(continue 'a), "continue 'a");
+ c1!(expr, [ continue ], "continue");
+ c1!(expr, [ continue 'a ], "continue 'a");
// ExprKind::Ret
- assert_eq!(stringify_expr!(return), "return");
- assert_eq!(stringify_expr!(return true), "return true");
+ c1!(expr, [ return ], "return");
+ c1!(expr, [ return true ], "return true");
+
+ // ExprKind::InlineAsm: untestable because this test works pre-expansion.
+
+ // ExprKind::OffsetOf: untestable because this test works pre-expansion.
// ExprKind::MacCall
- assert_eq!(stringify_expr!(mac!(...)), "mac!(...)");
- assert_eq!(stringify_expr!(mac![...]), "mac![...]");
- assert_eq!(stringify_expr!(mac! { ... }), "mac! { ... }");
+ c2!(expr, [ mac!(...) ], "mac!(...)", "mac! (...)");
+ c2!(expr, [ mac![...] ], "mac![...]", "mac! [...]");
+ c1!(expr, [ mac! { ... } ], "mac! { ... }");
// ExprKind::Struct
- assert_eq!(stringify_expr!(Struct {}), "Struct {}");
- #[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/5151
- assert_eq!(stringify_expr!(<Struct as Trait>::Type {}), "<Struct as Trait>::Type {}");
- assert_eq!(stringify_expr!(Struct { .. }), "Struct { .. }");
- assert_eq!(stringify_expr!(Struct { ..base }), "Struct { ..base }");
- assert_eq!(stringify_expr!(Struct { x }), "Struct { x }");
- assert_eq!(stringify_expr!(Struct { x, .. }), "Struct { x, .. }");
- assert_eq!(stringify_expr!(Struct { x, ..base }), "Struct { x, ..base }");
- assert_eq!(stringify_expr!(Struct { x: true }), "Struct { x: true }");
- assert_eq!(stringify_expr!(Struct { x: true, .. }), "Struct { x: true, .. }");
- assert_eq!(stringify_expr!(Struct { x: true, ..base }), "Struct { x: true, ..base }");
+ c1!(expr, [ Struct {} ], "Struct {}");
+ c2!(expr,
+ [ <Struct as Trait>::Type {} ],
+ "<Struct as Trait>::Type {}",
+ "< Struct as Trait > :: Type {}"
+ );
+ c1!(expr, [ Struct { .. } ], "Struct { .. }");
+ c2!(expr, [ Struct { ..base } ], "Struct { ..base }", "Struct { .. base }");
+ c1!(expr, [ Struct { x } ], "Struct { x }");
+ c1!(expr, [ Struct { x, .. } ], "Struct { x, .. }");
+ c2!(expr, [ Struct { x, ..base } ], "Struct { x, ..base }", "Struct { x, .. base }");
+ c2!(expr, [ Struct { x: true } ], "Struct { x: true }", "Struct { x : true }");
+ c2!(expr, [ Struct { x: true, .. } ], "Struct { x: true, .. }", "Struct { x : true, .. }");
+ c2!(expr,
+ [ Struct { x: true, ..base } ],
+ "Struct { x: true, ..base }",
+ "Struct { x : true, .. base }"
+ );
// ExprKind::Repeat
- assert_eq!(stringify_expr!([(); 0]), "[(); 0]");
+ c2!(expr, [ [(); 0] ], "[(); 0]", "[() ; 0]");
// ExprKind::Paren
- assert_eq!(stringify_expr!((expr)), "(expr)");
+ c1!(expr, [ (expr) ], "(expr)");
// ExprKind::Try
- assert_eq!(stringify_expr!(expr?), "expr?");
+ c2!(expr, [ expr? ], "expr?", "expr ?");
// ExprKind::Yield
- assert_eq!(stringify_expr!(yield), "yield");
- assert_eq!(stringify_expr!(yield true), "yield true");
+ c1!(expr, [ yield ], "yield");
+ c1!(expr, [ yield true ], "yield true");
+
+ // ExprKind::Yeet
+ c1!(expr, [ do yeet ], "do yeet");
+ c1!(expr, [ do yeet 0 ], "do yeet 0");
+
+ // ExprKind::Become
+ // FIXME: todo
+
+ // ExprKind::IncludedBytes
+ // FIXME: todo
+
+ // ExprKind::FormatArgs: untestable because this test works pre-expansion.
+
+ // ExprKind::Err: untestable.
}
#[test]
fn test_item() {
// ItemKind::ExternCrate
- assert_eq!(
- stringify_item!(
- extern crate std;
- ),
- "extern crate std;",
- );
- assert_eq!(
- stringify_item!(
- pub extern crate self as std;
- ),
+ c2!(item, [ extern crate std; ], "extern crate std;", "extern crate std ;");
+ c2!(item,
+ [ pub extern crate self as std; ],
"pub extern crate self as std;",
+ "pub extern crate self as std ;"
);
// ItemKind::Use
- assert_eq!(
- stringify_item!(
- pub use crate::{a, b::c};
- ),
+ c2!(item,
+ [ pub use crate::{a, b::c}; ],
"pub use crate::{a, b::c};",
+ "pub use crate :: { a, b :: c } ;"
);
+ c2!(item, [ pub use A::*; ], "pub use A::*;", "pub use A :: * ;");
// ItemKind::Static
- assert_eq!(
- stringify_item!(
- pub static S: () = {};
- ),
- "pub static S: () = {};",
- );
- assert_eq!(
- stringify_item!(
- static mut S: () = {};
- ),
- "static mut S: () = {};",
- );
- assert_eq!(
- stringify_item!(
- static S: ();
- ),
- "static S: ();",
- );
- assert_eq!(
- stringify_item!(
- static mut S: ();
- ),
- "static mut S: ();",
- );
+ c2!(item, [ pub static S: () = {}; ], "pub static S: () = {};", "pub static S : () = {} ;");
+ c2!(item, [ static mut S: () = {}; ], "static mut S: () = {};", "static mut S : () = {} ;");
+ c2!(item, [ static S: (); ], "static S: ();", "static S : () ;");
+ c2!(item, [ static mut S: (); ], "static mut S: ();", "static mut S : () ;");
// ItemKind::Const
- assert_eq!(
- stringify_item!(
- pub const S: () = {};
- ),
- "pub const S: () = {};",
- );
- assert_eq!(
- stringify_item!(
- const S: ();
- ),
- "const S: ();",
- );
+ c2!(item, [ pub const S: () = {}; ], "pub const S: () = {};", "pub const S : () = {} ;");
+ c2!(item, [ const S: (); ], "const S: ();", "const S : () ;");
// ItemKind::Fn
- assert_eq!(
- stringify_item!(
- pub default const async unsafe extern "C" fn f() {}
- ),
- "pub default const async unsafe extern \"C\" fn f() {}",
+ c1!(item,
+ [ pub default const async unsafe extern "C" fn f() {} ],
+ "pub default const async unsafe extern \"C\" fn f() {}"
+ );
+ c2!(item,
+ [ fn g<T>(t: Vec<Vec<Vec<T>>>) {} ],
+ "fn g<T>(t: Vec<Vec<Vec<T>>>) {}",
+ "fn g < T > (t : Vec < Vec < Vec < T >> >) {}"
+ );
+ c2!(item,
+ [ fn h<'a>(t: &'a Vec<Cell<dyn D>>) {} ],
+ "fn h<'a>(t: &'a Vec<Cell<dyn D>>) {}",
+ "fn h < 'a > (t : & 'a Vec < Cell < dyn D >>) {}"
);
// ItemKind::Mod
- assert_eq!(
- stringify_item!(
- pub mod m;
- ),
- "pub mod m;",
- );
- assert_eq!(
- stringify_item!(
- mod m {}
- ),
- "mod m {}",
- );
- assert_eq!(
- stringify_item!(
- unsafe mod m;
- ),
- "unsafe mod m;",
- );
- assert_eq!(
- stringify_item!(
- unsafe mod m {}
- ),
- "unsafe mod m {}",
- );
+ c2!(item, [ pub mod m; ], "pub mod m;", "pub mod m ;");
+ c1!(item, [ mod m {} ], "mod m {}");
+ c2!(item, [ unsafe mod m; ], "unsafe mod m;", "unsafe mod m ;");
+ c1!(item, [ unsafe mod m {} ], "unsafe mod m {}");
// ItemKind::ForeignMod
- assert_eq!(
- stringify_item!(
- extern "C" {}
- ),
- "extern \"C\" {}",
- );
- #[rustfmt::skip]
- assert_eq!(
- stringify_item!(
- pub extern "C" {}
- ),
- "extern \"C\" {}",
- );
- assert_eq!(
- stringify_item!(
- unsafe extern "C++" {}
- ),
- "unsafe extern \"C++\" {}",
+ c1!(item, [ extern "C" {} ], "extern \"C\" {}");
+ c2!(item,
+ [ pub extern "C" {} ],
+ "extern \"C\" {}", // ??
+ "pub extern \"C\" {}"
);
+ c1!(item, [ unsafe extern "C++" {} ], "unsafe extern \"C++\" {}");
+
+ // ItemKind::GlobalAsm: untestable because this test works pre-expansion.
// ItemKind::TyAlias
- #[rustfmt::skip]
- assert_eq!(
- stringify_item!(
+ c2!(item,
+ [
pub default type Type<'a>: Bound
where
Self: 'a,
= T;
- ),
+ ],
"pub default type Type<'a>: Bound where Self: 'a = T;",
+ "pub default type Type < 'a > : Bound where Self : 'a, = T ;"
);
// ItemKind::Enum
- assert_eq!(
- stringify_item!(
- pub enum Void {}
- ),
- "pub enum Void {}",
- );
- assert_eq!(
- stringify_item!(
+ c1!(item, [ pub enum Void {} ], "pub enum Void {}");
+ c1!(item,
+ [
enum Empty {
Unit,
Tuple(),
Struct {},
}
- ),
- "enum Empty { Unit, Tuple(), Struct {}, }",
+ ],
+ "enum Empty { Unit, Tuple(), Struct {}, }"
);
- assert_eq!(
- stringify_item!(
+ c2!(item,
+ [
enum Enum<T>
where
T: 'a,
@@ -499,7 +447,7 @@ fn test_item() {
Tuple(T),
Struct { t: T },
}
- ),
+ ],
"enum Enum<T> where T: 'a {\n\
\x20 Unit,\n\
\x20 Tuple(T),\n\
@@ -507,378 +455,378 @@ fn test_item() {
\x20 t: T,\n\
\x20 },\n\
}",
+ "enum Enum < T > where T : 'a, { Unit, Tuple(T), Struct { t : T }, }"
);
// ItemKind::Struct
- assert_eq!(
- stringify_item!(
- pub struct Unit;
- ),
- "pub struct Unit;",
- );
- assert_eq!(
- stringify_item!(
- struct Tuple();
- ),
- "struct Tuple();",
- );
- assert_eq!(
- stringify_item!(
- struct Tuple(T);
- ),
- "struct Tuple(T);",
- );
- assert_eq!(
- stringify_item!(
- struct Struct {}
- ),
- "struct Struct {}",
- );
- assert_eq!(
- stringify_item!(
+ c2!(item, [ pub struct Unit; ], "pub struct Unit;", "pub struct Unit ;");
+ c2!(item, [ struct Tuple(); ], "struct Tuple();", "struct Tuple() ;");
+ c2!(item, [ struct Tuple(T); ], "struct Tuple(T);", "struct Tuple(T) ;");
+ c1!(item, [ struct Struct {} ], "struct Struct {}");
+ c2!(item,
+ [
struct Struct<T>
where
T: 'a,
{
t: T,
}
- ),
+ ],
"struct Struct<T> where T: 'a {\n\
\x20 t: T,\n\
}",
+ "struct Struct < T > where T : 'a, { t : T, }"
);
// ItemKind::Union
- assert_eq!(
- stringify_item!(
- pub union Union {}
- ),
- "pub union Union {}",
- );
- assert_eq!(
- stringify_item!(
+ c1!(item, [ pub union Union {} ], "pub union Union {}");
+ c2!(item,
+ [
union Union<T> where T: 'a {
t: T,
}
- ),
+ ],
"union Union<T> where T: 'a {\n\
\x20 t: T,\n\
}",
+ "union Union < T > where T : 'a { t : T, }"
);
// ItemKind::Trait
- assert_eq!(
- stringify_item!(
- pub unsafe auto trait Send {}
- ),
- "pub unsafe auto trait Send {}",
- );
- assert_eq!(
- stringify_item!(
+ c1!(item, [ pub unsafe auto trait Send {} ], "pub unsafe auto trait Send {}");
+ c2!(item,
+ [
trait Trait<'a>: Sized
where
Self: 'a,
{
}
- ),
+ ],
"trait Trait<'a>: Sized where Self: 'a {}",
+ "trait Trait < 'a > : Sized where Self : 'a, {}"
);
// ItemKind::TraitAlias
- assert_eq!(
- stringify_item!(
- pub trait Trait<T> = Sized where T: 'a;
- ),
+ c2!(item,
+ [ pub trait Trait<T> = Sized where T: 'a; ],
"pub trait Trait<T> = Sized where T: 'a;",
+ "pub trait Trait < T > = Sized where T : 'a ;"
);
// ItemKind::Impl
- assert_eq!(
- stringify_item!(
- pub impl Struct {}
- ),
- "pub impl Struct {}",
- );
- assert_eq!(
- stringify_item!(
- impl<T> Struct<T> {}
- ),
- "impl<T> Struct<T> {}",
- );
- assert_eq!(
- stringify_item!(
- pub impl Trait for Struct {}
- ),
- "pub impl Trait for Struct {}",
- );
- assert_eq!(
- stringify_item!(
- impl<T> const Trait for T {}
- ),
+ c1!(item, [ pub impl Struct {} ], "pub impl Struct {}");
+ c2!(item, [ impl<T> Struct<T> {} ], "impl<T> Struct<T> {}", "impl < T > Struct < T > {}");
+ c1!(item, [ pub impl Trait for Struct {} ], "pub impl Trait for Struct {}");
+ c2!(item,
+ [ impl<T> const Trait for T {} ],
"impl<T> const Trait for T {}",
+ "impl < T > const Trait for T {}"
);
- assert_eq!(
- stringify_item!(
- impl ~const Struct {}
- ),
- "impl ~const Struct {}",
- );
+ c2!(item, [ impl ~const Struct {} ], "impl ~const Struct {}", "impl ~ const Struct {}");
// ItemKind::MacCall
- assert_eq!(stringify_item!(mac!(...);), "mac!(...);");
- assert_eq!(stringify_item!(mac![...];), "mac![...];");
- assert_eq!(stringify_item!(mac! { ... }), "mac! { ... }");
+ c2!(item, [ mac!(...); ], "mac!(...);", "mac! (...) ;");
+ c2!(item, [ mac![...]; ], "mac![...];", "mac! [...] ;");
+ c1!(item, [ mac! { ... } ], "mac! { ... }");
// ItemKind::MacroDef
- assert_eq!(
- stringify_item!(
+ c1!(item,
+ [
macro_rules! stringify {
() => {};
}
- ),
- "macro_rules! stringify { () => {} ; }", // FIXME
+ ],
+ "macro_rules! stringify { () => {} ; }"
);
- assert_eq!(
- stringify_item!(
- pub macro stringify() {}
- ),
- "pub macro stringify { () => {} }",
+ c2!(item,
+ [ pub macro stringify() {} ],
+ "pub macro stringify { () => {} }", // ??
+ "pub macro stringify() {}"
);
}
#[test]
fn test_meta() {
- assert_eq!(stringify_meta!(k), "k");
- assert_eq!(stringify_meta!(k = "v"), "k = \"v\"");
- assert_eq!(stringify_meta!(list(k1, k2 = "v")), "list(k1, k2 = \"v\")");
- assert_eq!(stringify_meta!(serde::k), "serde::k");
+ c1!(meta, [ k ], "k");
+ c1!(meta, [ k = "v" ], "k = \"v\"");
+ c1!(meta, [ list(k1, k2 = "v") ], "list(k1, k2 = \"v\")");
+ c2!(meta, [ serde::k ], "serde::k", "serde :: k");
}
#[test]
fn test_pat() {
// PatKind::Wild
- assert_eq!(stringify_pat!(_), "_");
+ c1!(pat, [ _ ], "_");
// PatKind::Ident
- assert_eq!(stringify_pat!(_x), "_x");
- assert_eq!(stringify_pat!(ref _x), "ref _x");
- assert_eq!(stringify_pat!(mut _x), "mut _x");
- assert_eq!(stringify_pat!(ref mut _x), "ref mut _x");
- assert_eq!(stringify_pat!(ref mut _x @ _), "ref mut _x @ _");
+ c1!(pat, [ _x ], "_x");
+ c1!(pat, [ ref _x ], "ref _x");
+ c1!(pat, [ mut _x ], "mut _x");
+ c1!(pat, [ ref mut _x ], "ref mut _x");
+ c1!(pat, [ ref mut _x @ _ ], "ref mut _x @ _");
// PatKind::Struct
- assert_eq!(stringify_pat!(Struct {}), "Struct {}");
- assert_eq!(stringify_pat!(Struct::<u8> {}), "Struct::<u8> {}");
- assert_eq!(stringify_pat!(Struct::<'static> {}), "Struct::<'static> {}");
- assert_eq!(stringify_pat!(Struct { x }), "Struct { x }");
- assert_eq!(stringify_pat!(Struct { x: _x }), "Struct { x: _x }");
- assert_eq!(stringify_pat!(Struct { .. }), "Struct { .. }");
- assert_eq!(stringify_pat!(Struct { x, .. }), "Struct { x, .. }");
- assert_eq!(stringify_pat!(Struct { x: _x, .. }), "Struct { x: _x, .. }");
- #[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/5151
- assert_eq!(
- stringify_pat!(<Struct as Trait>::Type {}),
+ c1!(pat, [ Struct {} ], "Struct {}");
+ c2!(pat, [ Struct::<u8> {} ], "Struct::<u8> {}", "Struct :: < u8 > {}");
+ c2!(pat, [ Struct::<'static> {} ], "Struct::<'static> {}", "Struct :: < 'static > {}");
+ c1!(pat, [ Struct { x } ], "Struct { x }");
+ c2!(pat, [ Struct { x: _x } ], "Struct { x: _x }", "Struct { x : _x }");
+ c1!(pat, [ Struct { .. } ], "Struct { .. }");
+ c1!(pat, [ Struct { x, .. } ], "Struct { x, .. }");
+ c2!(pat, [ Struct { x: _x, .. } ], "Struct { x: _x, .. }", "Struct { x : _x, .. }");
+ c2!(pat,
+ [ <Struct as Trait>::Type {} ],
"<Struct as Trait>::Type {}",
+ "< Struct as Trait > :: Type {}"
);
// PatKind::TupleStruct
- assert_eq!(stringify_pat!(Tuple()), "Tuple()");
- assert_eq!(stringify_pat!(Tuple::<u8>()), "Tuple::<u8>()");
- assert_eq!(stringify_pat!(Tuple::<'static>()), "Tuple::<'static>()");
- assert_eq!(stringify_pat!(Tuple(x)), "Tuple(x)");
- assert_eq!(stringify_pat!(Tuple(..)), "Tuple(..)");
- assert_eq!(stringify_pat!(Tuple(x, ..)), "Tuple(x, ..)");
- assert_eq!(stringify_pat!(<Struct as Trait>::Type()), "<Struct as Trait>::Type()");
+ c1!(pat, [ Tuple() ], "Tuple()");
+ c2!(pat, [ Tuple::<u8>() ], "Tuple::<u8>()", "Tuple :: < u8 > ()");
+ c2!(pat, [ Tuple::<'static>() ], "Tuple::<'static>()", "Tuple :: < 'static > ()");
+ c1!(pat, [ Tuple(x) ], "Tuple(x)");
+ c1!(pat, [ Tuple(..) ], "Tuple(..)");
+ c1!(pat, [ Tuple(x, ..) ], "Tuple(x, ..)");
+ c2!(pat,
+ [ <Struct as Trait>::Type() ],
+ "<Struct as Trait>::Type()",
+ "< Struct as Trait > :: Type()"
+ );
// PatKind::Or
- assert_eq!(stringify_pat!(true | false), "true | false");
- assert_eq!(stringify_pat!(| true), "true");
- assert_eq!(stringify_pat!(|true| false), "true | false");
+ c1!(pat, [ true | false ], "true | false");
+ c2!(pat, [ | true ], "true", "| true");
+ c2!(pat, [ |true| false ], "true | false", "| true | false");
// PatKind::Path
- assert_eq!(stringify_pat!(crate::Path), "crate::Path");
- assert_eq!(stringify_pat!(Path::<u8>), "Path::<u8>");
- assert_eq!(stringify_pat!(Path::<'static>), "Path::<'static>");
- assert_eq!(stringify_pat!(<Struct as Trait>::Type), "<Struct as Trait>::Type");
+ c2!(pat, [ crate::Path ], "crate::Path", "crate :: Path");
+ c2!(pat, [ Path::<u8> ], "Path::<u8>", "Path :: < u8 >");
+ c2!(pat, [ Path::<'static> ], "Path::<'static>", "Path :: < 'static >");
+ c2!(pat, [ <Struct as Trait>::Type ], "<Struct as Trait>::Type", "< Struct as Trait > :: Type");
// PatKind::Tuple
- assert_eq!(stringify_pat!(()), "()");
- assert_eq!(stringify_pat!((true,)), "(true,)");
- assert_eq!(stringify_pat!((true, false)), "(true, false)");
+ c1!(pat, [ () ], "()");
+ c1!(pat, [ (true,) ], "(true,)");
+ c1!(pat, [ (true, false) ], "(true, false)");
// PatKind::Box
- assert_eq!(stringify_pat!(box pat), "box pat");
+ c1!(pat, [ box pat ], "box pat");
// PatKind::Ref
- assert_eq!(stringify_pat!(&pat), "&pat");
- assert_eq!(stringify_pat!(&mut pat), "&mut pat");
+ c2!(pat, [ &pat ], "&pat", "& pat");
+ c2!(pat, [ &mut pat ], "&mut pat", "& mut pat");
// PatKind::Lit
- assert_eq!(stringify_pat!(1_000_i8), "1_000_i8");
+ c1!(pat, [ 1_000_i8 ], "1_000_i8");
// PatKind::Range
- assert_eq!(stringify_pat!(..1), "..1");
- assert_eq!(stringify_pat!(0..), "0..");
- assert_eq!(stringify_pat!(0..1), "0..1");
- assert_eq!(stringify_pat!(0..=1), "0..=1");
- assert_eq!(stringify_pat!(-2..=-1), "-2..=-1");
+ c2!(pat, [ ..1 ], "..1", ".. 1");
+ c2!(pat, [ 0.. ], "0..", "0 ..");
+ c2!(pat, [ 0..1 ], "0..1", "0 .. 1");
+ c2!(pat, [ 0..=1 ], "0..=1", "0 ..= 1");
+ c2!(pat, [ -2..=-1 ], "-2..=-1", "- 2 ..= - 1");
// PatKind::Slice
- assert_eq!(stringify_pat!([]), "[]");
- assert_eq!(stringify_pat!([true]), "[true]");
- assert_eq!(stringify_pat!([true,]), "[true]");
- assert_eq!(stringify_pat!([true, false]), "[true, false]");
+ c1!(pat, [ [] ], "[]");
+ c1!(pat, [ [true] ], "[true]");
+ c2!(pat, [ [true,] ], "[true]", "[true,]");
+ c1!(pat, [ [true, false] ], "[true, false]");
// PatKind::Rest
- assert_eq!(stringify_pat!(..), "..");
+ c1!(pat, [ .. ], "..");
// PatKind::Paren
- assert_eq!(stringify_pat!((pat)), "(pat)");
+ c1!(pat, [ (pat) ], "(pat)");
// PatKind::MacCall
- assert_eq!(stringify_pat!(mac!(...)), "mac!(...)");
- assert_eq!(stringify_pat!(mac![...]), "mac![...]");
- assert_eq!(stringify_pat!(mac! { ... }), "mac! { ... }");
+ c2!(pat, [ mac!(...) ], "mac!(...)", "mac! (...)");
+ c2!(pat, [ mac![...] ], "mac![...]", "mac! [...]");
+ c1!(pat, [ mac! { ... } ], "mac! { ... }");
}
#[test]
fn test_path() {
- assert_eq!(stringify_path!(thing), "thing");
- assert_eq!(stringify_path!(m::thing), "m::thing");
- assert_eq!(stringify_path!(self::thing), "self::thing");
- assert_eq!(stringify_path!(crate::thing), "crate::thing");
- assert_eq!(stringify_path!(Self::thing), "Self::thing");
- assert_eq!(stringify_path!(Self<'static>), "Self<'static>");
- assert_eq!(stringify_path!(Self::<'static>), "Self<'static>");
- assert_eq!(stringify_path!(Self()), "Self()");
- assert_eq!(stringify_path!(Self() -> ()), "Self() -> ()");
+ c1!(path, [ thing ], "thing");
+ c2!(path, [ m::thing ], "m::thing", "m :: thing");
+ c2!(path, [ self::thing ], "self::thing", "self :: thing");
+ c2!(path, [ crate::thing ], "crate::thing", "crate :: thing");
+ c2!(path, [ Self::thing ], "Self::thing", "Self :: thing");
+ c2!(path, [ Self<'static> ], "Self<'static>", "Self < 'static >");
+ c2!(path, [ Self::<'static> ], "Self<'static>", "Self :: < 'static >");
+ c1!(path, [ Self() ], "Self()");
+ c1!(path, [ Self() -> () ], "Self() -> ()");
}
#[test]
fn test_stmt() {
// StmtKind::Local
- assert_eq!(stringify_stmt!(let _), "let _;");
- assert_eq!(stringify_stmt!(let x = true), "let x = true;");
- assert_eq!(stringify_stmt!(let x: bool = true), "let x: bool = true;");
+ c2!(stmt, [ let _ ], "let _;", "let _");
+ c2!(stmt, [ let x = true ], "let x = true;", "let x = true");
+ c2!(stmt, [ let x: bool = true ], "let x: bool = true;", "let x : bool = true");
+ c2!(stmt, [ let (a, b) = (1, 2) ], "let (a, b) = (1, 2);", "let(a, b) = (1, 2)"); // FIXME
+ c2!(stmt,
+ [ let (a, b): (u32, u32) = (1, 2) ],
+ "let (a, b): (u32, u32) = (1, 2);",
+ "let(a, b) : (u32, u32) = (1, 2)"
+ );
// StmtKind::Item
- assert_eq!(
- stringify_stmt!(
- struct S;
- ),
- "struct S;",
- );
+ c2!(stmt, [ struct S; ], "struct S;", "struct S ;");
+ c1!(stmt, [ struct S {} ], "struct S {}");
// StmtKind::Expr
- assert_eq!(stringify_stmt!(loop {}), "loop {}");
+ c1!(stmt, [ loop {} ], "loop {}");
// StmtKind::Semi
- assert_eq!(stringify_stmt!(1 + 1), "1 + 1;");
+ c2!(stmt, [ 1 + 1 ], "1 + 1;", "1 + 1");
// StmtKind::Empty
- assert_eq!(stringify_stmt!(;), ";");
+ c1!(stmt, [ ; ], ";");
// StmtKind::MacCall
- assert_eq!(stringify_stmt!(mac!(...)), "mac!(...)");
- assert_eq!(stringify_stmt!(mac![...]), "mac![...]");
- assert_eq!(stringify_stmt!(mac! { ... }), "mac! { ... }");
+ c2!(stmt, [ mac!(...) ], "mac!(...)", "mac! (...)");
+ c2!(stmt, [ mac![...] ], "mac![...]", "mac! [...]");
+ c1!(stmt, [ mac! { ... } ], "mac! { ... }");
}
#[test]
fn test_ty() {
// TyKind::Slice
- assert_eq!(stringify_ty!([T]), "[T]");
+ c1!(ty, [ [T] ], "[T]");
// TyKind::Array
- assert_eq!(stringify_ty!([T; 0]), "[T; 0]");
+ c2!(ty, [ [T; 0] ], "[T; 0]", "[T ; 0]");
// TyKind::Ptr
- assert_eq!(stringify_ty!(*const T), "*const T");
- assert_eq!(stringify_ty!(*mut T), "*mut T");
+ c2!(ty, [ *const T ], "*const T", "* const T");
+ c2!(ty, [ *mut T ], "*mut T", "* mut T");
// TyKind::Ref
- assert_eq!(stringify_ty!(&T), "&T");
- assert_eq!(stringify_ty!(&mut T), "&mut T");
- assert_eq!(stringify_ty!(&'a T), "&'a T");
- assert_eq!(stringify_ty!(&'a mut T), "&'a mut T");
+ c2!(ty, [ &T ], "&T", "& T");
+ c2!(ty, [ &mut T ], "&mut T", "& mut T");
+ c2!(ty, [ &'a T ], "&'a T", "& 'a T");
+ c2!(ty, [ &'a mut [T] ], "&'a mut [T]", "& 'a mut [T]");
+ c2!(ty, [ &A<B<C<D<E>>>> ], "&A<B<C<D<E>>>>", "& A < B < C < D < E >> >>");
// TyKind::BareFn
- assert_eq!(stringify_ty!(fn()), "fn()");
- assert_eq!(stringify_ty!(fn() -> ()), "fn() -> ()");
- assert_eq!(stringify_ty!(fn(u8)), "fn(u8)");
- assert_eq!(stringify_ty!(fn(x: u8)), "fn(x: u8)");
- #[rustfmt::skip]
- assert_eq!(stringify_ty!(for<> fn()), "fn()");
- assert_eq!(stringify_ty!(for<'a> fn()), "for<'a> fn()");
+ c1!(ty, [ fn() ], "fn()");
+ c1!(ty, [ fn() -> () ], "fn() -> ()");
+ c1!(ty, [ fn(u8) ], "fn(u8)");
+ c2!(ty, [ fn(x: u8) ], "fn(x: u8)", "fn(x : u8)");
+ c2!(ty, [ for<> fn() ], "fn()", "for < > fn()");
+ c2!(ty, [ for<'a> fn() ], "for<'a> fn()", "for < 'a > fn()");
// TyKind::Never
- assert_eq!(stringify_ty!(!), "!");
+ c1!(ty, [ ! ], "!");
// TyKind::Tup
- assert_eq!(stringify_ty!(()), "()");
- assert_eq!(stringify_ty!((T,)), "(T,)");
- assert_eq!(stringify_ty!((T, U)), "(T, U)");
+ c1!(ty, [ () ], "()");
+ c1!(ty, [ (T,) ], "(T,)");
+ c1!(ty, [ (T, U) ], "(T, U)");
+
+ // TyKind::AnonStruct: untestable in isolation.
+
+ // TyKind::AnonUnion: untestable in isolation.
// TyKind::Path
- assert_eq!(stringify_ty!(T), "T");
- assert_eq!(stringify_ty!(Ref<'a>), "Ref<'a>");
- assert_eq!(stringify_ty!(PhantomData<T>), "PhantomData<T>");
- assert_eq!(stringify_ty!(PhantomData::<T>), "PhantomData<T>");
- assert_eq!(stringify_ty!(Fn() -> !), "Fn() -> !");
- assert_eq!(stringify_ty!(Fn(u8) -> !), "Fn(u8) -> !");
- assert_eq!(stringify_ty!(<Struct as Trait>::Type), "<Struct as Trait>::Type");
+ c1!(ty, [ T ], "T");
+ c2!(ty, [ Ref<'a> ], "Ref<'a>", "Ref < 'a >");
+ c2!(ty, [ PhantomData<T> ], "PhantomData<T>", "PhantomData < T >");
+ c2!(ty, [ PhantomData::<T> ], "PhantomData<T>", "PhantomData :: < T >");
+ c2!(ty, [ Fn() -> ! ], "Fn() -> !", "Fn() ->!");
+ c2!(ty, [ Fn(u8) -> ! ], "Fn(u8) -> !", "Fn(u8) ->!"); // FIXME
+ c2!(ty, [ <Struct as Trait>::Type ], "<Struct as Trait>::Type", "< Struct as Trait > :: Type");
// TyKind::TraitObject
- assert_eq!(stringify_ty!(dyn Send), "dyn Send");
- assert_eq!(stringify_ty!(dyn Send + 'a), "dyn Send + 'a");
- assert_eq!(stringify_ty!(dyn 'a + Send), "dyn 'a + Send");
- assert_eq!(stringify_ty!(dyn ?Sized), "dyn ?Sized");
- assert_eq!(stringify_ty!(dyn ~const Clone), "dyn ~const Clone");
- assert_eq!(stringify_ty!(dyn for<'a> Send), "dyn for<'a> Send");
+ c1!(ty, [ dyn Send ], "dyn Send");
+ c1!(ty, [ dyn Send + 'a ], "dyn Send + 'a");
+ c1!(ty, [ dyn 'a + Send ], "dyn 'a + Send");
+ c2!(ty, [ dyn ?Sized ], "dyn ?Sized", "dyn ? Sized");
+ c2!(ty, [ dyn ~const Clone ], "dyn ~const Clone", "dyn ~ const Clone");
+ c2!(ty, [ dyn for<'a> Send ], "dyn for<'a> Send", "dyn for < 'a > Send");
// TyKind::ImplTrait
- assert_eq!(stringify_ty!(impl Send), "impl Send");
- assert_eq!(stringify_ty!(impl Send + 'a), "impl Send + 'a");
- assert_eq!(stringify_ty!(impl 'a + Send), "impl 'a + Send");
- assert_eq!(stringify_ty!(impl ?Sized), "impl ?Sized");
- assert_eq!(stringify_ty!(impl ~const Clone), "impl ~const Clone");
- assert_eq!(stringify_ty!(impl for<'a> Send), "impl for<'a> Send");
+ c1!(ty, [ impl Send ], "impl Send");
+ c1!(ty, [ impl Send + 'a ], "impl Send + 'a");
+ c1!(ty, [ impl 'a + Send ], "impl 'a + Send");
+ c2!(ty, [ impl ?Sized ], "impl ?Sized", "impl ? Sized");
+ c2!(ty, [ impl ~const Clone ], "impl ~const Clone", "impl ~ const Clone");
+ c2!(ty, [ impl for<'a> Send ], "impl for<'a> Send", "impl for < 'a > Send");
// TyKind::Paren
- assert_eq!(stringify_ty!((T)), "(T)");
+ c1!(ty, [ (T) ], "(T)");
+
+ // TyKind::Typeof: unused for now.
// TyKind::Infer
- assert_eq!(stringify_ty!(_), "_");
+ c1!(ty, [ _ ], "_");
+
+ // TyKind::ImplicitSelf: there is no syntax for this.
// TyKind::MacCall
- assert_eq!(stringify_ty!(mac!(...)), "mac!(...)");
- assert_eq!(stringify_ty!(mac![...]), "mac![...]");
- assert_eq!(stringify_ty!(mac! { ... }), "mac! { ... }");
+ c2!(ty, [ mac!(...) ], "mac!(...)", "mac! (...)");
+ c2!(ty, [ mac![...] ], "mac![...]", "mac! [...]");
+ c1!(ty, [ mac! { ... } ], "mac! { ... }");
+
+ // TyKind::Err: untestable.
+
+ // TyKind::CVarArgs
+ // FIXME: todo
}
#[test]
fn test_vis() {
// VisibilityKind::Public
- assert_eq!(stringify_vis!(pub), "pub ");
+ c2!(vis, [ pub ], "pub ", "pub");
// VisibilityKind::Restricted
- assert_eq!(stringify_vis!(pub(crate)), "pub(crate) ");
- assert_eq!(stringify_vis!(pub(self)), "pub(self) ");
- assert_eq!(stringify_vis!(pub(super)), "pub(super) ");
- assert_eq!(stringify_vis!(pub(in crate)), "pub(in crate) ");
- assert_eq!(stringify_vis!(pub(in self)), "pub(in self) ");
- assert_eq!(stringify_vis!(pub(in super)), "pub(in super) ");
- assert_eq!(stringify_vis!(pub(in path::to)), "pub(in path::to) ");
- assert_eq!(stringify_vis!(pub(in ::path::to)), "pub(in ::path::to) ");
- assert_eq!(stringify_vis!(pub(in self::path::to)), "pub(in self::path::to) ");
- assert_eq!(stringify_vis!(pub(in super::path::to)), "pub(in super::path::to) ");
+ c2!(vis, [ pub(crate) ], "pub(crate) ", "pub(crate)");
+ c2!(vis, [ pub(self) ], "pub(self) ", "pub(self)");
+ c2!(vis, [ pub(super) ], "pub(super) ", "pub(super)");
+ c2!(vis, [ pub(in crate) ], "pub(in crate) ", "pub(in crate)");
+ c2!(vis, [ pub(in self) ], "pub(in self) ", "pub(in self)");
+ c2!(vis, [ pub(in super) ], "pub(in super) ", "pub(in super)");
+ c2!(vis, [ pub(in path::to) ], "pub(in path::to) ", "pub(in path :: to)");
+ c2!(vis, [ pub(in ::path::to) ], "pub(in ::path::to) ", "pub(in :: path :: to)");
+ c2!(vis, [ pub(in self::path::to) ], "pub(in self::path::to) ", "pub(in self :: path :: to)");
+ c2!(vis,
+ [ pub(in super::path::to) ],
+ "pub(in super::path::to) ",
+ "pub(in super :: path :: to)"
+ );
// VisibilityKind::Inherited
- // Directly calling `stringify_vis!()` does not work.
- macro_rules! stringify_inherited_vis {
- ($vis:vis struct) => {
- stringify_vis!($vis)
- };
- }
- assert_eq!(stringify_inherited_vis!(struct), "");
+ // This one is different because directly calling `vis!` does not work.
+ macro_rules! inherited_vis { ($vis:vis struct) => { vis!($vis) }; }
+ assert_eq!(inherited_vis!(struct), "");
+ assert_eq!(stringify!(), "");
+}
+
+macro_rules! p {
+ ([$($tt:tt)*], $s:literal) => {
+ assert_eq!(stringify!($($tt)*), $s);
+ };
+}
+
+#[test]
+fn test_punct() {
+ // For all these cases, we must preserve spaces between the tokens.
+ // Otherwise, any old proc macro that parses pretty-printed code might glue
+ // together tokens that shouldn't be glued.
+ p!([ = = < < <= <= == == != != >= >= > > ], "= = < < <= <= == == != != >= >= > >");
+ p!([ && && & & || || | | ! ! ], "&& && & & || || | |!!"); // FIXME
+ p!([ ~ ~ @ @ # # ], "~ ~ @ @ # #");
+ p!([ . . .. .. ... ... ..= ..=], ".... .. ... ... ..= ..="); // FIXME
+ p!([ , , ; ; : : :: :: ], ",, ; ; : : :: ::"); // FIXME
+ p!([ -> -> <- <- => =>], "-> -> <- <- => =>");
+ p!([ $ $ ? ? ' ' ], "$$? ? ' '"); // FIXME
+ p!([ + + += += - - -= -= * * *= *= / / /= /= ], "+ + += += - - -= -= * * *= *= / / /= /=");
+ p!([ % % %= %= ^ ^ ^= ^= << << <<= <<= >> >> >>= >>= ],
+ "% % %= %= ^ ^ ^= ^= << << <<= <<= >> >> >>= >>=");
+
+ // For these one we must insert spaces between adjacent tokens, again due
+ // to proc macros.
+ p!([ +! ?= |> >>@ --> <-- $$ =====> ], "+! ? = | > >> @ - -> <- - $$== == =>"); // FIXME
+ p!([ ,; ;, ** @@ $+$ >< <> ?? +== ], ", ; ;, * * @ @ $+ $> < < > ? ? += ="); // FIXME
+ p!([ :#!@|$=&*,+;*~? ], ": #! @ | $= & *, + ; * ~ ?"); // FIXME
}
diff --git a/tests/ui/malformed/do-not-ice-on-note_and_explain.rs b/tests/ui/malformed/do-not-ice-on-note_and_explain.rs
new file mode 100644
index 000000000..e65276fb7
--- /dev/null
+++ b/tests/ui/malformed/do-not-ice-on-note_and_explain.rs
@@ -0,0 +1,7 @@
+struct A<B>(B);
+impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+//~^ ERROR the size for values of type `B` cannot be known at compilation time
+//~| ERROR the size for values of type `B` cannot be known at compilation time
+//~| ERROR mismatched types
+//~| ERROR mismatched types
+//~| ERROR `main` function not found in crate
diff --git a/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr b/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr
new file mode 100644
index 000000000..27b86145e
--- /dev/null
+++ b/tests/ui/malformed/do-not-ice-on-note_and_explain.stderr
@@ -0,0 +1,79 @@
+error[E0601]: `main` function not found in crate `do_not_ice_on_note_and_explain`
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:37
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | ^ consider adding a `main` function to `$DIR/do-not-ice-on-note_and_explain.rs`
+
+error[E0277]: the size for values of type `B` cannot be known at compilation time
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:32
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | - ---- ^ doesn't have a size known at compile-time
+ | | |
+ | | required by a bound introduced by this call
+ | this type parameter needs to be `Sized`
+ |
+note: required by a bound in `A`
+ --> $DIR/do-not-ice-on-note_and_explain.rs:1:10
+ |
+LL | struct A<B>(B);
+ | ^ required by this bound in `A`
+
+error[E0308]: mismatched types
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:32
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | ---- ^ expected type parameter `B`, found integer
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected type parameter `B`
+ found type `{integer}`
+note: tuple struct defined here
+ --> $DIR/do-not-ice-on-note_and_explain.rs:1:8
+ |
+LL | struct A<B>(B);
+ | ^
+
+error[E0308]: mismatched types
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:27
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | ^^^^^^^ expected `()`, found `A<B>`
+ |
+ = note: expected unit type `()`
+ found struct `A<B>`
+help: consider using a semicolon here
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1);}}}
+ | +
+help: try adding a return type
+ |
+LL | impl<B>A<B>{fn d(){fn d() -> A<B>{Self(1)}}}
+ | +++++++
+
+error[E0277]: the size for values of type `B` cannot be known at compilation time
+ --> $DIR/do-not-ice-on-note_and_explain.rs:2:27
+ |
+LL | impl<B>A<B>{fn d(){fn d(){Self(1)}}}
+ | - ^^^^^^^ doesn't have a size known at compile-time
+ | |
+ | this type parameter needs to be `Sized`
+ |
+note: required by a bound in `A`
+ --> $DIR/do-not-ice-on-note_and_explain.rs:1:10
+ |
+LL | struct A<B>(B);
+ | ^ required by this bound in `A`
+help: you could relax the implicit `Sized` bound on `B` if it were used through indirection like `&B` or `Box<B>`
+ --> $DIR/do-not-ice-on-note_and_explain.rs:1:10
+ |
+LL | struct A<B>(B);
+ | ^ - ...if indirection were used here: `Box<B>`
+ | |
+ | this could be changed to `B: ?Sized`...
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0277, E0308, E0601.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/malformed/malformed-plugin-1.rs b/tests/ui/malformed/malformed-plugin-1.rs
deleted file mode 100644
index d4c1a2a16..000000000
--- a/tests/ui/malformed/malformed-plugin-1.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#![feature(plugin)]
-#![plugin] //~ ERROR malformed `plugin` attribute
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui/malformed/malformed-plugin-1.stderr b/tests/ui/malformed/malformed-plugin-1.stderr
deleted file mode 100644
index 505f6b6f1..000000000
--- a/tests/ui/malformed/malformed-plugin-1.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error: malformed `plugin` attribute input
- --> $DIR/malformed-plugin-1.rs:2:1
- |
-LL | #![plugin]
- | ^^^^^^^^^^ help: must be of the form: `#![plugin(name)]`
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/malformed-plugin-1.rs:2:1
- |
-LL | #![plugin]
- | ^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/tests/ui/malformed/malformed-plugin-2.rs b/tests/ui/malformed/malformed-plugin-2.rs
deleted file mode 100644
index ba80d97a3..000000000
--- a/tests/ui/malformed/malformed-plugin-2.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#![feature(plugin)]
-#![plugin="bleh"] //~ ERROR malformed `plugin` attribute
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui/malformed/malformed-plugin-2.stderr b/tests/ui/malformed/malformed-plugin-2.stderr
deleted file mode 100644
index 52bbd82a3..000000000
--- a/tests/ui/malformed/malformed-plugin-2.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error: malformed `plugin` attribute input
- --> $DIR/malformed-plugin-2.rs:2:1
- |
-LL | #![plugin="bleh"]
- | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#![plugin(name)]`
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/malformed-plugin-2.rs:2:1
- |
-LL | #![plugin="bleh"]
- | ^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/tests/ui/malformed/malformed-plugin-3.rs b/tests/ui/malformed/malformed-plugin-3.rs
deleted file mode 100644
index d2bd8f9f8..000000000
--- a/tests/ui/malformed/malformed-plugin-3.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#![feature(plugin)]
-#![plugin(foo="bleh")] //~ ERROR malformed `plugin` attribute
-//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
-
-fn main() {}
diff --git a/tests/ui/malformed/malformed-plugin-3.stderr b/tests/ui/malformed/malformed-plugin-3.stderr
deleted file mode 100644
index 64cb429ea..000000000
--- a/tests/ui/malformed/malformed-plugin-3.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0498]: malformed `plugin` attribute
- --> $DIR/malformed-plugin-3.rs:2:11
- |
-LL | #![plugin(foo="bleh")]
- | ^^^^^^^^^^ malformed attribute
-
-warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
- --> $DIR/malformed-plugin-3.rs:2:1
- |
-LL | #![plugin(foo="bleh")]
- | ^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
- |
- = note: `#[warn(deprecated)]` on by default
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0498`.
diff --git a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr
index e713d1451..64bccda56 100644
--- a/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr
+++ b/tests/ui/marker_trait_attr/overlapping-impl-1-modulo-regions.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/overlapping-impl-1-modulo-regions.rs:14:21
|
LL | impl<T: Copy> F for T {}
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<T: Copy + 'static> F for T {}
| +++++++++
diff --git a/tests/ui/match/match-range-fail-2.stderr b/tests/ui/match/match-range-fail-2.stderr
index 52a2bf2b3..089fa851f 100644
--- a/tests/ui/match/match-range-fail-2.stderr
+++ b/tests/ui/match/match-range-fail-2.stderr
@@ -2,19 +2,19 @@ error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/match-range-fail-2.rs:5:9
|
LL | 6 ..= 1 => { }
- | ^ lower bound larger than upper bound
+ | ^^^^^^^ lower bound larger than upper bound
error[E0579]: lower range bound must be less than upper
--> $DIR/match-range-fail-2.rs:11:9
|
LL | 0 .. 0 => { }
- | ^
+ | ^^^^^^
error[E0030]: lower range bound must be less than or equal to upper
--> $DIR/match-range-fail-2.rs:17:9
|
LL | 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { }
- | ^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound
error: aborting due to 3 previous errors
diff --git a/tests/ui/match/match_non_exhaustive.stderr b/tests/ui/match/match_non_exhaustive.stderr
index 7b8bdfe00..40be39ec0 100644
--- a/tests/ui/match/match_non_exhaustive.stderr
+++ b/tests/ui/match/match_non_exhaustive.stderr
@@ -5,10 +5,10 @@ LL | match l { L::A => () };
| ^ pattern `L::B` not covered
|
note: `L` defined here
- --> $DIR/match_non_exhaustive.rs:10:13
+ --> $DIR/match_non_exhaustive.rs:10:6
|
LL | enum L { A, B }
- | - ^ not covered
+ | ^ - not covered
= note: the matched value is of type `L`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/match/validate-range-endpoints.rs b/tests/ui/match/validate-range-endpoints.rs
new file mode 100644
index 000000000..1d1737f8b
--- /dev/null
+++ b/tests/ui/match/validate-range-endpoints.rs
@@ -0,0 +1,59 @@
+#![feature(exclusive_range_pattern)]
+#![feature(inline_const_pat)]
+#![allow(incomplete_features)]
+#![allow(overlapping_range_endpoints)]
+
+fn main() {
+ const TOO_BIG: u8 = 256;
+ match 0u8 {
+ 1..257 => {}
+ //~^ ERROR literal out of range
+ 1..=256 => {}
+ //~^ ERROR literal out of range
+
+ // overflow is detected in a later pass for these
+ 0..257 => {}
+ 0..=256 => {}
+ 256..=100 => {}
+
+ // There isn't really a way to detect these
+ 1..=TOO_BIG => {}
+ //~^ ERROR lower range bound must be less than or equal to upper
+ 1..=const { 256 } => {}
+ //~^ ERROR lower range bound must be less than or equal to upper
+ _ => {}
+ }
+
+ match 0u64 {
+ 10000000000000000000..=99999999999999999999 => {}
+ //~^ ERROR literal out of range
+ _ => {}
+ }
+
+ match 0i8 {
+ 0..129 => {}
+ //~^ ERROR literal out of range
+ 0..=128 => {}
+ //~^ ERROR literal out of range
+ -129..0 => {}
+ //~^ ERROR literal out of range
+ -10000..=-20 => {}
+ //~^ ERROR literal out of range
+
+ // overflow is detected in a later pass for these
+ 128..=0 => {}
+ 0..-129 => {}
+ -10000..=0 => {}
+ _ => {}
+ }
+
+ // FIXME: error message is confusing
+ match 0i8 {
+ //~^ ERROR `i8::MIN..=-17_i8` and `1_i8..=i8::MAX` not covered
+ -10000..=0 => {}
+ }
+ match 0i8 {
+ //~^ ERROR `i8::MIN..=-17_i8` not covered
+ -10000.. => {}
+ }
+}
diff --git a/tests/ui/match/validate-range-endpoints.stderr b/tests/ui/match/validate-range-endpoints.stderr
new file mode 100644
index 000000000..0813fccff
--- /dev/null
+++ b/tests/ui/match/validate-range-endpoints.stderr
@@ -0,0 +1,84 @@
+error: literal out of range for `u8`
+ --> $DIR/validate-range-endpoints.rs:9:12
+ |
+LL | 1..257 => {}
+ | ^^^ this value does not fit into the type `u8` whose range is `0..=255`
+
+error: literal out of range for `u8`
+ --> $DIR/validate-range-endpoints.rs:11:13
+ |
+LL | 1..=256 => {}
+ | ^^^ this value does not fit into the type `u8` whose range is `0..=255`
+
+error[E0030]: lower range bound must be less than or equal to upper
+ --> $DIR/validate-range-endpoints.rs:20:9
+ |
+LL | 1..=TOO_BIG => {}
+ | ^^^^^^^^^^^ lower bound larger than upper bound
+
+error[E0030]: lower range bound must be less than or equal to upper
+ --> $DIR/validate-range-endpoints.rs:22:9
+ |
+LL | 1..=const { 256 } => {}
+ | ^^^^^^^^^^^^^^^^^ lower bound larger than upper bound
+
+error: literal out of range for `u64`
+ --> $DIR/validate-range-endpoints.rs:28:32
+ |
+LL | 10000000000000000000..=99999999999999999999 => {}
+ | ^^^^^^^^^^^^^^^^^^^^ this value does not fit into the type `u64` whose range is `0..=18446744073709551615`
+
+error: literal out of range for `i8`
+ --> $DIR/validate-range-endpoints.rs:34:12
+ |
+LL | 0..129 => {}
+ | ^^^ this value does not fit into the type `i8` whose range is `-128..=127`
+
+error: literal out of range for `i8`
+ --> $DIR/validate-range-endpoints.rs:36:13
+ |
+LL | 0..=128 => {}
+ | ^^^ this value does not fit into the type `i8` whose range is `-128..=127`
+
+error: literal out of range for `i8`
+ --> $DIR/validate-range-endpoints.rs:38:9
+ |
+LL | -129..0 => {}
+ | ^^^^ this value does not fit into the type `i8` whose range is `-128..=127`
+
+error: literal out of range for `i8`
+ --> $DIR/validate-range-endpoints.rs:40:9
+ |
+LL | -10000..=-20 => {}
+ | ^^^^^^ this value does not fit into the type `i8` whose range is `-128..=127`
+
+error[E0004]: non-exhaustive patterns: `i8::MIN..=-17_i8` and `1_i8..=i8::MAX` not covered
+ --> $DIR/validate-range-endpoints.rs:51:11
+ |
+LL | match 0i8 {
+ | ^^^ patterns `i8::MIN..=-17_i8` and `1_i8..=i8::MAX` not covered
+ |
+ = note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
+ |
+LL ~ -10000..=0 => {},
+LL + i8::MIN..=-17_i8 | 1_i8..=i8::MAX => todo!()
+ |
+
+error[E0004]: non-exhaustive patterns: `i8::MIN..=-17_i8` not covered
+ --> $DIR/validate-range-endpoints.rs:55:11
+ |
+LL | match 0i8 {
+ | ^^^ pattern `i8::MIN..=-17_i8` not covered
+ |
+ = note: the matched value is of type `i8`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL ~ -10000.. => {},
+LL + i8::MIN..=-17_i8 => todo!()
+ |
+
+error: aborting due to 11 previous errors
+
+Some errors have detailed explanations: E0004, E0030.
+For more information about an error, try `rustc --explain E0004`.
diff --git a/tests/ui/methods/disambiguate-multiple-blanket-impl.rs b/tests/ui/methods/disambiguate-multiple-blanket-impl.rs
new file mode 100644
index 000000000..6a17f6a21
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-blanket-impl.rs
@@ -0,0 +1,38 @@
+trait A {
+ type Type;
+ const CONST: usize;
+ fn foo(&self);
+}
+
+trait B {
+ type Type;
+ const CONST: usize;
+ fn foo(&self);
+}
+
+#[derive(Debug)]
+struct S;
+
+impl<T: std::fmt::Debug> A for T {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self) {} //~ NOTE candidate #1
+}
+
+impl<T: std::fmt::Debug> B for T {
+ type Type = ();
+ const CONST: usize = 2; //~ NOTE candidate #2
+ fn foo(&self) {} //~ NOTE candidate #2
+}
+
+fn main() {
+ let s = S;
+ S::foo(&s); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP use fully-qualified syntax to disambiguate
+ S::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax to disambiguate
+ let _: S::Type; //~ ERROR ambiguous associated type
+ //~^ HELP use fully-qualified syntax
+}
diff --git a/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr b/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr
new file mode 100644
index 000000000..ccdd9a954
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr
@@ -0,0 +1,63 @@
+error[E0223]: ambiguous associated type
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:36:12
+ |
+LL | let _: S::Type;
+ | ^^^^^^^
+ |
+help: use fully-qualified syntax
+ |
+LL | let _: <S as A>::Type;
+ | ~~~~~~~~~~~~~~
+LL | let _: <S as B>::Type;
+ | ~~~~~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:30:8
+ |
+LL | S::foo(&s);
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:19:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:25:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | A::foo(&s);
+ | ~~~
+LL | B::foo(&s);
+ | ~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:33:8
+ |
+LL | S::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:18:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-blanket-impl.rs:24:5
+ |
+LL | const CONST: usize = 2;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | <S as A>::CONST;
+ | ~~~~~~~~~~
+LL | <S as B>::CONST;
+ | ~~~~~~~~~~
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0034, E0223.
+For more information about an error, try `rustc --explain E0034`.
diff --git a/tests/ui/methods/disambiguate-multiple-impl.rs b/tests/ui/methods/disambiguate-multiple-impl.rs
new file mode 100644
index 000000000..9a82ff015
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-impl.rs
@@ -0,0 +1,37 @@
+trait A {
+ type Type;
+ const CONST: usize;
+ fn foo(&self);
+}
+
+trait B {
+ type Type;
+ const CONST: usize;
+ fn foo(&self);
+}
+
+struct S;
+
+impl A for S {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self) {} //~ NOTE candidate #1
+}
+
+impl B for S {
+ type Type = ();
+ const CONST: usize = 2; //~ NOTE candidate #2
+ fn foo(&self) {} //~ NOTE candidate #2
+}
+
+fn main() {
+ let s = S;
+ S::foo(&s); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP use fully-qualified syntax
+ let _: S::Type = (); //~ ERROR ambiguous associated type
+ //~| HELP use fully-qualified syntax
+ let _ = S::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax
+}
diff --git a/tests/ui/methods/disambiguate-multiple-impl.stderr b/tests/ui/methods/disambiguate-multiple-impl.stderr
new file mode 100644
index 000000000..417212077
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-impl.stderr
@@ -0,0 +1,63 @@
+error[E0223]: ambiguous associated type
+ --> $DIR/disambiguate-multiple-impl.rs:32:12
+ |
+LL | let _: S::Type = ();
+ | ^^^^^^^
+ |
+help: use fully-qualified syntax
+ |
+LL | let _: <S as A>::Type = ();
+ | ~~~~~~~~~~~~~~
+LL | let _: <S as B>::Type = ();
+ | ~~~~~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-impl.rs:29:8
+ |
+LL | S::foo(&s);
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `S`
+ --> $DIR/disambiguate-multiple-impl.rs:18:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `S`
+ --> $DIR/disambiguate-multiple-impl.rs:24:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | A::foo(&s);
+ | ~~~
+LL | B::foo(&s);
+ | ~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-impl.rs:34:16
+ |
+LL | let _ = S::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `S`
+ --> $DIR/disambiguate-multiple-impl.rs:17:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `S`
+ --> $DIR/disambiguate-multiple-impl.rs:23:5
+ |
+LL | const CONST: usize = 2;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _ = <S as A>::CONST;
+ | ~~~~~~~~~~
+LL | let _ = <S as B>::CONST;
+ | ~~~~~~~~~~
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0034, E0223.
+For more information about an error, try `rustc --explain E0034`.
diff --git a/tests/ui/methods/disambiguate-multiple-trait-2.rs b/tests/ui/methods/disambiguate-multiple-trait-2.rs
new file mode 100644
index 000000000..829491d82
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-trait-2.rs
@@ -0,0 +1,54 @@
+trait A {
+ type Type; //~ NOTE ambiguous `Type` from `A`
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self); //~ NOTE candidate #1
+}
+
+trait B {
+ type Type; //~ NOTE ambiguous `Type` from `B`
+ const CONST: usize; //~ NOTE candidate #2
+ fn foo(&self); //~ NOTE candidate #2
+}
+
+trait C: A + B {}
+
+fn a<T: C>(t: T) {
+ t.foo(); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP disambiguate the method
+ //~| HELP disambiguate the method
+ let _ = T::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax
+ let _: T::Type; //~ ERROR ambiguous associated type
+ //~^ NOTE ambiguous associated type `Type`
+ //~| HELP use fully-qualified syntax
+ //~| HELP use fully-qualified syntax
+}
+
+#[derive(Debug)]
+struct S;
+
+impl<T: std::fmt::Debug> A for T {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self) {} //~ NOTE candidate #1
+}
+
+impl<T: std::fmt::Debug> B for T {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #2
+ fn foo(&self) {} //~ NOTE candidate #2
+}
+
+fn main() {
+ let s = S;
+ S::foo(&s); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP use fully-qualified syntax
+ let _ = S::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax
+ let _: S::Type; //~ ERROR ambiguous associated type
+ //~^ HELP use fully-qualified syntax
+}
diff --git a/tests/ui/methods/disambiguate-multiple-trait-2.stderr b/tests/ui/methods/disambiguate-multiple-trait-2.stderr
new file mode 100644
index 000000000..2778f254a
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-trait-2.stderr
@@ -0,0 +1,132 @@
+error[E0221]: ambiguous associated type `Type` in bounds of `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:23:12
+ |
+LL | type Type;
+ | --------- ambiguous `Type` from `A`
+...
+LL | type Type;
+ | --------- ambiguous `Type` from `B`
+...
+LL | let _: T::Type;
+ | ^^^^^^^ ambiguous associated type `Type`
+ |
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _: <T as A>::Type;
+ | ~~~~~~~~~~
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _: <T as B>::Type;
+ | ~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait-2.rs:16:7
+ |
+LL | t.foo();
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in the trait `A`
+ --> $DIR/disambiguate-multiple-trait-2.rs:4:5
+ |
+LL | fn foo(&self);
+ | ^^^^^^^^^^^^^^
+note: candidate #2 is defined in the trait `B`
+ --> $DIR/disambiguate-multiple-trait-2.rs:10:5
+ |
+LL | fn foo(&self);
+ | ^^^^^^^^^^^^^^
+help: disambiguate the method for candidate #1
+ |
+LL | A::foo(&t);
+ | ~~~~~~~~~~
+help: disambiguate the method for candidate #2
+ |
+LL | B::foo(&t);
+ | ~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait-2.rs:20:16
+ |
+LL | let _ = T::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in the trait `A`
+ --> $DIR/disambiguate-multiple-trait-2.rs:3:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in the trait `B`
+ --> $DIR/disambiguate-multiple-trait-2.rs:9:5
+ |
+LL | const CONST: usize;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _ = <T as A>::CONST;
+ | ~~~~~~~~~~
+LL | let _ = <T as B>::CONST;
+ | ~~~~~~~~~~
+
+error[E0223]: ambiguous associated type
+ --> $DIR/disambiguate-multiple-trait-2.rs:52:12
+ |
+LL | let _: S::Type;
+ | ^^^^^^^
+ |
+help: use fully-qualified syntax
+ |
+LL | let _: <S as A>::Type;
+ | ~~~~~~~~~~~~~~
+LL | let _: <S as B>::Type;
+ | ~~~~~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait-2.rs:46:8
+ |
+LL | S::foo(&s);
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:35:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:41:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | A::foo(&s);
+ | ~~~
+LL | B::foo(&s);
+ | ~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait-2.rs:49:16
+ |
+LL | let _ = S::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:34:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-trait-2.rs:40:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _ = <S as A>::CONST;
+ | ~~~~~~~~~~
+LL | let _ = <S as B>::CONST;
+ | ~~~~~~~~~~
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0034, E0221, E0223.
+For more information about an error, try `rustc --explain E0034`.
diff --git a/tests/ui/methods/disambiguate-multiple-trait.rs b/tests/ui/methods/disambiguate-multiple-trait.rs
new file mode 100644
index 000000000..c990d0475
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-trait.rs
@@ -0,0 +1,32 @@
+#![feature(associated_type_defaults)]
+
+trait A {
+ type Type = ();
+ const CONST: usize = 1; //~ NOTE candidate #1
+ fn foo(&self) {} //~ NOTE candidate #1
+}
+
+trait B {
+ type Type = ();
+ const CONST: usize = 2; //~ NOTE candidate #2
+ fn foo(&self) {} //~ NOTE candidate #2
+}
+
+#[derive(Debug)]
+struct S;
+
+impl<T: std::fmt::Debug> A for T {}
+
+impl<T: std::fmt::Debug> B for T {}
+
+fn main() {
+ let s = S;
+ S::foo(&s); //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `foo` found
+ //~| HELP use fully-qualified syntax
+ let _ = S::CONST; //~ ERROR multiple applicable items in scope
+ //~^ NOTE multiple `CONST` found
+ //~| HELP use fully-qualified syntax
+ let _: S::Type; //~ ERROR ambiguous associated type
+ //~^ HELP use fully-qualified syntax
+}
diff --git a/tests/ui/methods/disambiguate-multiple-trait.stderr b/tests/ui/methods/disambiguate-multiple-trait.stderr
new file mode 100644
index 000000000..e00498ca6
--- /dev/null
+++ b/tests/ui/methods/disambiguate-multiple-trait.stderr
@@ -0,0 +1,63 @@
+error[E0223]: ambiguous associated type
+ --> $DIR/disambiguate-multiple-trait.rs:30:12
+ |
+LL | let _: S::Type;
+ | ^^^^^^^
+ |
+help: use fully-qualified syntax
+ |
+LL | let _: <S as A>::Type;
+ | ~~~~~~~~~~~~~~
+LL | let _: <S as B>::Type;
+ | ~~~~~~~~~~~~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait.rs:24:8
+ |
+LL | S::foo(&s);
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-trait.rs:6:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-trait.rs:12:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | A::foo(&s);
+ | ~~~
+LL | B::foo(&s);
+ | ~~~
+
+error[E0034]: multiple applicable items in scope
+ --> $DIR/disambiguate-multiple-trait.rs:27:16
+ |
+LL | let _ = S::CONST;
+ | ^^^^^ multiple `CONST` found
+ |
+note: candidate #1 is defined in an impl of the trait `A` for the type `T`
+ --> $DIR/disambiguate-multiple-trait.rs:5:5
+ |
+LL | const CONST: usize = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `B` for the type `T`
+ --> $DIR/disambiguate-multiple-trait.rs:11:5
+ |
+LL | const CONST: usize = 2;
+ | ^^^^^^^^^^^^^^^^^^
+help: use fully-qualified syntax to disambiguate
+ |
+LL | let _ = <S as A>::CONST;
+ | ~~~~~~~~~~
+LL | let _ = <S as B>::CONST;
+ | ~~~~~~~~~~
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0034, E0223.
+For more information about an error, try `rustc --explain E0034`.
diff --git a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
index e0f8a5447..0a022dc39 100644
--- a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
+++ b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Vec<T>`
--> $DIR/method-ambig-one-trait-unknown-int-type.rs:24:9
|
LL | let mut x = Vec::new();
- | ^^^^^
+ | ^^^^^ ---------- type must be known at this point
|
help: consider giving `x` an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr b/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr
index 601e6bbb0..9a84768a9 100644
--- a/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr
+++ b/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr
@@ -16,12 +16,12 @@ LL | trait B { fn foo(&self); }
| ^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
-LL | A::foo(t);
- | ~~~~~~~~~
+LL | A::foo(&t);
+ | ~~~~~~~~~~
help: disambiguate the method for candidate #2
|
-LL | B::foo(t);
- | ~~~~~~~~~
+LL | B::foo(&t);
+ | ~~~~~~~~~~
error: aborting due to previous error
diff --git a/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr b/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr
index 4ba778e0e..5bb887b45 100644
--- a/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr
+++ b/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr
@@ -14,12 +14,10 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `AB`
|
LL | fn foo() {}
| ^^^^^^^^
-help: disambiguate the associated function for candidate #1
+help: use fully-qualified syntax to disambiguate
|
LL | <AB as A>::foo();
| ~~~~~~~~~~~
-help: disambiguate the associated function for candidate #2
- |
LL | <AB as B>::foo();
| ~~~~~~~~~~~
diff --git a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr
index 4e83e4b77..755179650 100644
--- a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr
+++ b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr
@@ -54,8 +54,8 @@ LL | let z = NuisanceFoo::foo(x);
| ~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #3
|
-LL | let z = FinalFoo::foo(x);
- | ~~~~~~~~~~~~~~~~
+LL | let z = FinalFoo::foo(&x);
+ | ~~~~~~~~~~~~~~~~~
error[E0308]: mismatched types
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:139:24
diff --git a/tests/ui/mir/addrof_alignment.rs b/tests/ui/mir/alignment/addrof_alignment.rs
index 892638bfb..f3423e97a 100644
--- a/tests/ui/mir/addrof_alignment.rs
+++ b/tests/ui/mir/alignment/addrof_alignment.rs
@@ -1,5 +1,4 @@
// run-pass
-// ignore-wasm32-bare: No panic messages
// compile-flags: -C debug-assertions
struct Misalignment {
@@ -9,7 +8,7 @@ struct Misalignment {
fn main() {
let items: [Misalignment; 2] = [Misalignment { a: 0 }, Misalignment { a: 1 }];
unsafe {
- let ptr: *const Misalignment = items.as_ptr().cast::<u8>().add(1).cast::<Misalignment>();
+ let ptr: *const Misalignment = items.as_ptr().byte_add(1);
let _ptr = core::ptr::addr_of!((*ptr).a);
}
}
diff --git a/tests/ui/mir/mir_alignment_check_i686-pc-windows-msvc.rs b/tests/ui/mir/alignment/i686-pc-windows-msvc.rs
index 56388c104..74ba1fde6 100644
--- a/tests/ui/mir/mir_alignment_check_i686-pc-windows-msvc.rs
+++ b/tests/ui/mir/alignment/i686-pc-windows-msvc.rs
@@ -11,9 +11,9 @@
fn main() {
let mut x = [0u64; 2];
- let ptr: *mut u8 = x.as_mut_ptr().cast::<u8>();
+ let ptr = x.as_mut_ptr();
unsafe {
- let misaligned = ptr.add(4).cast::<u64>();
+ let misaligned = ptr.byte_add(4);
assert!(misaligned.addr() % 8 != 0);
assert!(misaligned.addr() % 4 == 0);
*misaligned = 42;
diff --git a/tests/ui/mir/mir_alignment_check.rs b/tests/ui/mir/alignment/misaligned_lhs.rs
index d1bf3d46a..97644ba8e 100644
--- a/tests/ui/mir/mir_alignment_check.rs
+++ b/tests/ui/mir/alignment/misaligned_lhs.rs
@@ -6,8 +6,8 @@
fn main() {
let mut x = [0u32; 2];
- let ptr: *mut u8 = x.as_mut_ptr().cast::<u8>();
+ let ptr = x.as_mut_ptr();
unsafe {
- *(ptr.add(1).cast::<u32>()) = 42;
+ *(ptr.byte_add(1)) = 42;
}
}
diff --git a/tests/ui/mir/alignment/misaligned_rhs.rs b/tests/ui/mir/alignment/misaligned_rhs.rs
new file mode 100644
index 000000000..8534bc71a
--- /dev/null
+++ b/tests/ui/mir/alignment/misaligned_rhs.rs
@@ -0,0 +1,13 @@
+// run-fail
+// ignore-wasm32-bare: No panic messages
+// ignore-i686-pc-windows-msvc: #112480
+// compile-flags: -C debug-assertions
+// error-pattern: misaligned pointer dereference: address must be a multiple of 0x4 but is
+
+fn main() {
+ let mut x = [0u32; 2];
+ let ptr = x.as_mut_ptr();
+ unsafe {
+ let _v = *(ptr.byte_add(1));
+ }
+}
diff --git a/tests/ui/mir/alignment/packed.rs b/tests/ui/mir/alignment/packed.rs
new file mode 100644
index 000000000..754698591
--- /dev/null
+++ b/tests/ui/mir/alignment/packed.rs
@@ -0,0 +1,29 @@
+// run-pass
+// compile-flags: -C debug-assertions
+
+#![feature(strict_provenance, pointer_is_aligned)]
+
+#[repr(packed)]
+struct Misaligner {
+ _head: u8,
+ tail: u64,
+}
+
+fn main() {
+ let memory = [Misaligner { _head: 0, tail: 0}, Misaligner { _head: 0, tail: 0}];
+ // Test that we can use addr_of! to get the address of a packed member which according to its
+ // type is not aligned, but because it is a projection from a packed type is a valid place.
+ let ptr0 = std::ptr::addr_of!(memory[0].tail);
+ let ptr1 = std::ptr::addr_of!(memory[0].tail);
+ // Even if ptr0 happens to be aligned by chance, ptr1 is not.
+ assert!(!ptr0.is_aligned() || !ptr1.is_aligned());
+
+ // And also test that we can get the addr of a packed struct then do a member read from it.
+ unsafe {
+ let ptr = std::ptr::addr_of!(memory[0]);
+ let _tail = (*ptr).tail;
+
+ let ptr = std::ptr::addr_of!(memory[1]);
+ let _tail = (*ptr).tail;
+ }
+}
diff --git a/tests/ui/mir/alignment/place_computation.rs b/tests/ui/mir/alignment/place_computation.rs
new file mode 100644
index 000000000..fdd486425
--- /dev/null
+++ b/tests/ui/mir/alignment/place_computation.rs
@@ -0,0 +1,16 @@
+// run-pass
+// compile-flags: -C debug-assertions
+
+#[repr(align(8))]
+struct Misalignment {
+ a: u8,
+}
+
+fn main() {
+ let mem = 0u64;
+ let ptr = &mem as *const u64 as *const Misalignment;
+ unsafe {
+ let ptr = ptr.byte_add(1);
+ let _ref: &u8 = &(*ptr).a;
+ }
+}
diff --git a/tests/ui/mir/alignment/place_without_read.rs b/tests/ui/mir/alignment/place_without_read.rs
new file mode 100644
index 000000000..b4be7a50f
--- /dev/null
+++ b/tests/ui/mir/alignment/place_without_read.rs
@@ -0,0 +1,9 @@
+// run-pass
+// compile-flags: -C debug-assertions
+
+fn main() {
+ let ptr = 1 as *const u16;
+ unsafe {
+ let _ = *ptr;
+ }
+}
diff --git a/tests/ui/mir/alignment/two_pointers.rs b/tests/ui/mir/alignment/two_pointers.rs
new file mode 100644
index 000000000..29af21dff
--- /dev/null
+++ b/tests/ui/mir/alignment/two_pointers.rs
@@ -0,0 +1,15 @@
+// run-fail
+// ignore-wasm32-bare: No panic messages
+// ignore-i686-pc-windows-msvc: #112480
+// compile-flags: -C debug-assertions
+// error-pattern: misaligned pointer dereference: address must be a multiple of 0x4 but is
+
+fn main() {
+ let x = [0u32; 2];
+ let ptr = x.as_ptr();
+ let mut dest = 0u32;
+ let dest_ptr = &mut dest as *mut u32;
+ unsafe {
+ *dest_ptr = *(ptr.byte_add(1));
+ }
+}
diff --git a/tests/ui/mir/build-async-error-body-correctly.rs b/tests/ui/mir/build-async-error-body-correctly.rs
new file mode 100644
index 000000000..1787f80c0
--- /dev/null
+++ b/tests/ui/mir/build-async-error-body-correctly.rs
@@ -0,0 +1,8 @@
+// edition: 2021
+
+async fn asyncfn() {
+ let binding = match true {};
+ //~^ ERROR non-exhaustive patterns: type `bool` is non-empty
+}
+
+fn main() {}
diff --git a/tests/ui/mir/build-async-error-body-correctly.stderr b/tests/ui/mir/build-async-error-body-correctly.stderr
new file mode 100644
index 000000000..3d18c249a
--- /dev/null
+++ b/tests/ui/mir/build-async-error-body-correctly.stderr
@@ -0,0 +1,17 @@
+error[E0004]: non-exhaustive patterns: type `bool` is non-empty
+ --> $DIR/build-async-error-body-correctly.rs:4:25
+ |
+LL | let binding = match true {};
+ | ^^^^
+ |
+ = note: the matched value is of type `bool`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
+ |
+LL ~ let binding = match true {
+LL + _ => todo!(),
+LL ~ };
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/mir/issue-71793-inline-args-storage.rs b/tests/ui/mir/issue-71793-inline-args-storage.rs
index 18f2e38d1..3749d5ebf 100644
--- a/tests/ui/mir/issue-71793-inline-args-storage.rs
+++ b/tests/ui/mir/issue-71793-inline-args-storage.rs
@@ -1,5 +1,5 @@
// Verifies that inliner emits StorageLive & StorageDead when introducing
-// temporaries for arguments, so that they don't become part of the generator.
+// temporaries for arguments, so that they don't become part of the coroutine.
// Regression test for #71793.
//
// check-pass
diff --git a/tests/ui/mir/mir_match_test.rs b/tests/ui/mir/mir_match_test.rs
index 1f96d6737..d41a7f4a1 100644
--- a/tests/ui/mir/mir_match_test.rs
+++ b/tests/ui/mir/mir_match_test.rs
@@ -1,4 +1,5 @@
#![feature(exclusive_range_pattern)]
+#![allow(overlapping_range_endpoints)]
// run-pass
diff --git a/tests/ui/mir/remove-zsts-query-cycle.rs b/tests/ui/mir/remove-zsts-query-cycle.rs
index be4d68f2d..bcaf84688 100644
--- a/tests/ui/mir/remove-zsts-query-cycle.rs
+++ b/tests/ui/mir/remove-zsts-query-cycle.rs
@@ -1,5 +1,5 @@
// Regression test for #88972. Used to cause a query cycle:
-// optimized mir -> remove zsts -> layout of a generator -> optimized mir.
+// optimized mir -> remove zsts -> layout of a coroutine -> optimized mir.
//
// edition:2018
// compile-flags: --crate-type=lib -Zinline-mir=yes
diff --git a/tests/ui/mismatched_types/async-unwrap-suggestion.rs b/tests/ui/mismatched_types/async-unwrap-suggestion.rs
new file mode 100644
index 000000000..9698cc29f
--- /dev/null
+++ b/tests/ui/mismatched_types/async-unwrap-suggestion.rs
@@ -0,0 +1,22 @@
+// edition: 2021
+
+async fn dont_suggest() -> i32 {
+ if false {
+ return Ok(6);
+ //~^ ERROR mismatched types
+ }
+
+ 5
+}
+
+async fn do_suggest() -> i32 {
+ if false {
+ let s = Ok(6);
+ return s;
+ //~^ ERROR mismatched types
+ }
+
+ 5
+}
+
+fn main() {}
diff --git a/tests/ui/mismatched_types/async-unwrap-suggestion.stderr b/tests/ui/mismatched_types/async-unwrap-suggestion.stderr
new file mode 100644
index 000000000..80ca76a4b
--- /dev/null
+++ b/tests/ui/mismatched_types/async-unwrap-suggestion.stderr
@@ -0,0 +1,25 @@
+error[E0308]: mismatched types
+ --> $DIR/async-unwrap-suggestion.rs:5:16
+ |
+LL | return Ok(6);
+ | ^^^^^ expected `i32`, found `Result<{integer}, _>`
+ |
+ = note: expected type `i32`
+ found enum `Result<{integer}, _>`
+
+error[E0308]: mismatched types
+ --> $DIR/async-unwrap-suggestion.rs:15:16
+ |
+LL | return s;
+ | ^ expected `i32`, found `Result<{integer}, _>`
+ |
+ = note: expected type `i32`
+ found enum `Result<{integer}, _>`
+help: consider using `Result::expect` to unwrap the `Result<{integer}, _>` value, panicking if the value is a `Result::Err`
+ |
+LL | return s.expect("REASON");
+ | +++++++++++++++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/mismatched_types/issue-19109.stderr b/tests/ui/mismatched_types/issue-19109.stderr
index 5cef64bb1..ca819d93a 100644
--- a/tests/ui/mismatched_types/issue-19109.stderr
+++ b/tests/ui/mismatched_types/issue-19109.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-19109.rs:4:5
|
LL | fn function(t: &mut dyn Trait) {
- | - help: try adding a return type: `-> *mut dyn Trait`
+ | - help: try adding a return type: `-> *mut dyn Trait`
LL | t as *mut dyn Trait
| ^^^^^^^^^^^^^^^^^^^ expected `()`, found `*mut dyn Trait`
|
diff --git a/tests/ui/mismatched_types/issue-35030.stderr b/tests/ui/mismatched_types/issue-35030.stderr
index de4e067fe..881ff9097 100644
--- a/tests/ui/mismatched_types/issue-35030.stderr
+++ b/tests/ui/mismatched_types/issue-35030.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-35030.rs:9:14
|
LL | impl<bool> Parser<bool> for bool {
- | ---- this type parameter
+ | ---- expected this type parameter
LL | fn parse(text: &str) -> Option<bool> {
LL | Some(true)
| ---- ^^^^ expected type parameter `bool`, found `bool`
diff --git a/tests/ui/mismatched_types/mismatch-ty-dont-suggest.rs b/tests/ui/mismatched_types/mismatch-ty-dont-suggest.rs
new file mode 100644
index 000000000..b288a9b05
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-dont-suggest.rs
@@ -0,0 +1,23 @@
+#![allow(unused, dead_code)]
+
+fn test_unwrap() -> Option<i32> {
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b; // return type is not `Result`, we don't suggest ? here
+ //~^ ERROR mismatched types
+ Some(v)
+}
+
+fn test_unwrap_option() -> Result<i32, ()> {
+ let b = Some(1);
+ let v: i32 = b; // return type is not `Option`, we don't suggest ? here
+ //~^ ERROR mismatched types
+ Ok(v)
+}
+
+fn main() {
+ let v: i32 = Some(0); //~ ERROR mismatched types
+
+ let c = Ok(false);
+ let v: i32 = c; //~ ERROR mismatched types
+
+}
diff --git a/tests/ui/mismatched_types/mismatch-ty-dont-suggest.stderr b/tests/ui/mismatched_types/mismatch-ty-dont-suggest.stderr
new file mode 100644
index 000000000..4f8f9b1a8
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-dont-suggest.stderr
@@ -0,0 +1,55 @@
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-dont-suggest.rs:5:18
+ |
+LL | let v: i32 = b; // return type is not `Result`, we don't suggest ? here
+ | --- ^ expected `i32`, found `Result<i32, ()>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Result<i32, ()>`
+help: consider using `Result::expect` to unwrap the `Result<i32, ()>` value, panicking if the value is a `Result::Err`
+ |
+LL | let v: i32 = b.expect("REASON"); // return type is not `Result`, we don't suggest ? here
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-dont-suggest.rs:12:18
+ |
+LL | let v: i32 = b; // return type is not `Option`, we don't suggest ? here
+ | --- ^ expected `i32`, found `Option<{integer}>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<{integer}>`
+help: consider using `Option::expect` to unwrap the `Option<{integer}>` value, panicking if the value is an `Option::None`
+ |
+LL | let v: i32 = b.expect("REASON"); // return type is not `Option`, we don't suggest ? here
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-dont-suggest.rs:18:18
+ |
+LL | let v: i32 = Some(0);
+ | --- ^^^^^^^ expected `i32`, found `Option<{integer}>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<{integer}>`
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-dont-suggest.rs:21:18
+ |
+LL | let v: i32 = c;
+ | --- ^ expected `i32`, found `Result<bool, _>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Result<bool, _>`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.fixed b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.fixed
new file mode 100644
index 000000000..f3f560fe5
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.fixed
@@ -0,0 +1,31 @@
+// run-rustfix
+#![allow(unused, dead_code)]
+
+fn func() -> Option<i32> {
+ Some(1)
+}
+
+fn test_unwrap() -> Result<i32, ()> {
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b?; //~ ERROR mismatched types
+ Ok(v)
+}
+
+fn test_unwrap_option() -> Option<i32> {
+ let b = Some(1);
+ let v: i32 = b?; //~ ERROR mismatched types
+ Some(v)
+}
+
+fn main() {
+ let a = Some(1);
+ let v: i32 = a.expect("REASON"); //~ ERROR mismatched types
+
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b.expect("REASON"); //~ ERROR mismatched types
+
+ let v: i32 = func().expect("REASON"); //~ ERROR mismatched types
+
+ let a = None;
+ let v: i32 = a.expect("REASON"); //~ ERROR mismatched types
+}
diff --git a/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.rs b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.rs
new file mode 100644
index 000000000..14020e872
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.rs
@@ -0,0 +1,31 @@
+// run-rustfix
+#![allow(unused, dead_code)]
+
+fn func() -> Option<i32> {
+ Some(1)
+}
+
+fn test_unwrap() -> Result<i32, ()> {
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b; //~ ERROR mismatched types
+ Ok(v)
+}
+
+fn test_unwrap_option() -> Option<i32> {
+ let b = Some(1);
+ let v: i32 = b; //~ ERROR mismatched types
+ Some(v)
+}
+
+fn main() {
+ let a = Some(1);
+ let v: i32 = a; //~ ERROR mismatched types
+
+ let b: Result<i32, ()> = Ok(1);
+ let v: i32 = b; //~ ERROR mismatched types
+
+ let v: i32 = func(); //~ ERROR mismatched types
+
+ let a = None;
+ let v: i32 = a; //~ ERROR mismatched types
+}
diff --git a/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.stderr b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.stderr
new file mode 100644
index 000000000..9de23447f
--- /dev/null
+++ b/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.stderr
@@ -0,0 +1,93 @@
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:10:18
+ |
+LL | let v: i32 = b;
+ | --- ^ expected `i32`, found `Result<i32, ()>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Result<i32, ()>`
+help: use the `?` operator to extract the `Result<i32, ()>` value, propagating a `Result::Err` value to the caller
+ |
+LL | let v: i32 = b?;
+ | +
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:16:18
+ |
+LL | let v: i32 = b;
+ | --- ^ expected `i32`, found `Option<{integer}>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<{integer}>`
+help: use the `?` operator to extract the `Option<{integer}>` value, propagating an `Option::None` value to the caller
+ |
+LL | let v: i32 = b?;
+ | +
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:22:18
+ |
+LL | let v: i32 = a;
+ | --- ^ expected `i32`, found `Option<{integer}>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<{integer}>`
+help: consider using `Option::expect` to unwrap the `Option<{integer}>` value, panicking if the value is an `Option::None`
+ |
+LL | let v: i32 = a.expect("REASON");
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:25:18
+ |
+LL | let v: i32 = b;
+ | --- ^ expected `i32`, found `Result<i32, ()>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Result<i32, ()>`
+help: consider using `Result::expect` to unwrap the `Result<i32, ()>` value, panicking if the value is a `Result::Err`
+ |
+LL | let v: i32 = b.expect("REASON");
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:27:18
+ |
+LL | let v: i32 = func();
+ | --- ^^^^^^ expected `i32`, found `Option<i32>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<i32>`
+help: consider using `Option::expect` to unwrap the `Option<i32>` value, panicking if the value is an `Option::None`
+ |
+LL | let v: i32 = func().expect("REASON");
+ | +++++++++++++++++
+
+error[E0308]: mismatched types
+ --> $DIR/mismatch-ty-unwrap-expect.rs:30:18
+ |
+LL | let v: i32 = a;
+ | --- ^ expected `i32`, found `Option<_>`
+ | |
+ | expected due to this
+ |
+ = note: expected type `i32`
+ found enum `Option<_>`
+help: consider using `Option::expect` to unwrap the `Option<_>` value, panicking if the value is an `Option::None`
+ |
+LL | let v: i32 = a.expect("REASON");
+ | +++++++++++++++++
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/mismatched_types/recovered-block.rs b/tests/ui/mismatched_types/recovered-block.rs
index b230b47d3..a91bbe708 100644
--- a/tests/ui/mismatched_types/recovered-block.rs
+++ b/tests/ui/mismatched_types/recovered-block.rs
@@ -12,10 +12,4 @@ pub fn foo() -> Foo {
}
//~^^ ERROR missing `struct` for struct definition
-pub fn bar() -> Foo {
- fn
- Foo { text: "".to_string() }
-}
-//~^^ ERROR expected one of `(` or `<`, found `{`
-
fn main() {}
diff --git a/tests/ui/mismatched_types/recovered-block.stderr b/tests/ui/mismatched_types/recovered-block.stderr
index f275321ab..88d625456 100644
--- a/tests/ui/mismatched_types/recovered-block.stderr
+++ b/tests/ui/mismatched_types/recovered-block.stderr
@@ -9,11 +9,5 @@ help: add `struct` here to parse `Foo` as a public struct
LL | pub struct Foo { text }
| ++++++
-error: expected one of `(` or `<`, found `{`
- --> $DIR/recovered-block.rs:17:9
- |
-LL | Foo { text: "".to_string() }
- | ^ expected one of `(` or `<`
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs
index ac0831ce6..42adff43a 100644
--- a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs
+++ b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs
@@ -24,9 +24,9 @@ fn main() {
let _ = produces_string().and_then(takes_str_but_too_many_refs);
//~^ ERROR type mismatch in function arguments
let _ = produces_string().and_then(takes_str_but_wrong_abi);
- //~^ ERROR expected a `FnOnce<(String,)>` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
+ //~^ ERROR expected a `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
let _ = produces_string().and_then(takes_str_but_unsafe);
- //~^ ERROR expected a `FnOnce<(String,)>` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
+ //~^ ERROR expected a `FnOnce(String)` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
let _ = produces_string().and_then(no_args);
//~^ ERROR function is expected to take 1 argument, but it takes 0 arguments
let _ = Some(TypeWithoutDeref).and_then(takes_str_but_too_many_refs);
diff --git a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr
index ecfbd27b1..3175a2589 100644
--- a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr
+++ b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr
@@ -14,11 +14,11 @@ LL | let _ = produces_string().and_then(takes_str_but_too_many_refs);
note: required by a bound in `Option::<T>::and_then`
--> $SRC_DIR/core/src/option.rs:LL:COL
-error[E0277]: expected a `FnOnce<(String,)>` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
+error[E0277]: expected a `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
--> $DIR/suggest-option-asderef-unfixable.rs:26:40
|
LL | let _ = produces_string().and_then(takes_str_but_wrong_abi);
- | -------- ^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(String,)>` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
+ | -------- ^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
| |
| required by a bound introduced by this call
|
@@ -26,7 +26,7 @@ LL | let _ = produces_string().and_then(takes_str_but_wrong_abi);
note: required by a bound in `Option::<T>::and_then`
--> $SRC_DIR/core/src/option.rs:LL:COL
-error[E0277]: expected a `FnOnce<(String,)>` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
+error[E0277]: expected a `FnOnce(String)` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
--> $DIR/suggest-option-asderef-unfixable.rs:28:40
|
LL | let _ = produces_string().and_then(takes_str_but_unsafe);
diff --git a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr
index 31e4206a5..5f4d19439 100644
--- a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr
+++ b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr
@@ -5,6 +5,7 @@ LL | mod missing;
| ^^^^^^^^^^^^
|
= help: to create the module `missing`, create file "$DIR/foo/missing.rs" or "$DIR/foo/missing/mod.rs"
+ = note: if there is a `mod missing` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr
index 9d252398b..d5f5ea870 100644
--- a/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr
+++ b/tests/ui/missing_non_modrs_mod/missing_non_modrs_mod_inline.stderr
@@ -5,6 +5,7 @@ LL | mod missing;
| ^^^^^^^^^^^^
|
= help: to create the module `missing`, create file "$DIR/foo_inline/inline/missing.rs" or "$DIR/foo_inline/inline/missing/mod.rs"
+ = note: if there is a `mod missing` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/ui/modules/special_module_name.stderr b/tests/ui/modules/special_module_name.stderr
index bc4b4f1b3..84473bf8c 100644
--- a/tests/ui/modules/special_module_name.stderr
+++ b/tests/ui/modules/special_module_name.stderr
@@ -5,6 +5,7 @@ LL | mod lib;
| ^^^^^^^^
|
= help: to create the module `lib`, create file "$DIR/lib.rs" or "$DIR/lib/mod.rs"
+ = note: if there is a `mod lib` elsewhere in the crate already, import it with `use crate::...` instead
error[E0583]: file not found for module `main`
--> $DIR/special_module_name.rs:4:1
@@ -13,6 +14,7 @@ LL | mod main;
| ^^^^^^^^^
|
= help: to create the module `main`, create file "$DIR/main.rs" or "$DIR/main/mod.rs"
+ = note: if there is a `mod main` elsewhere in the crate already, import it with `use crate::...` instead
warning: found module declaration for lib.rs
--> $DIR/special_module_name.rs:1:1
diff --git a/tests/ui/native-library-link-flags/modifiers-override.stderr b/tests/ui/native-library-link-flags/modifiers-override.stderr
index eb3ab55c3..64427651e 100644
--- a/tests/ui/native-library-link-flags/modifiers-override.stderr
+++ b/tests/ui/native-library-link-flags/modifiers-override.stderr
@@ -21,6 +21,8 @@ error: overriding linking modifiers from command line is not supported
|
LL | extern "C" {}
| ^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/never_type/never-from-impl-is-reserved.stderr b/tests/ui/never_type/never-from-impl-is-reserved.stderr
index f9f7c787e..871c51205 100644
--- a/tests/ui/never_type/never-from-impl-is-reserved.stderr
+++ b/tests/ui/never_type/never-from-impl-is-reserved.stderr
@@ -5,7 +5,7 @@ LL | impl MyTrait for MyFoo {}
| ---------------------- first implementation here
LL | // This will conflict with the first impl if we impl `for<T> T: From<!>`.
LL | impl<T> MyTrait for T where T: From<!> {}
- | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyFoo`
|
= note: permitting this impl would forbid us from adding `impl<T> From<!> for T` later; see rust-lang/rust#64715 for details
diff --git a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
index 54c16230f..cb3786305 100644
--- a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
+++ b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr
@@ -5,6 +5,7 @@ LL | <E as From<_>>::from(never);
| ^ the trait `From<()>` is not implemented for `E`
|
= help: the trait `From<!>` is implemented for `E`
+ = help: for that trait implementation, expected `!`, found `()`
error: aborting due to previous error
diff --git a/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr b/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr
index 46dba0064..aeb0a1394 100644
--- a/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr
+++ b/tests/ui/nll/closure-malformed-projection-input-issue-102800.stderr
@@ -15,6 +15,7 @@ LL | let _: for<'a> fn(<&'a () as Trait>::Ty) = |_| {};
|
= note: `&'0 ()` must implement `Trait`, for any lifetime `'0`...
= note: ...but `Trait` is actually implemented for the type `&'static ()`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr
index 1aa7de1e1..a20f885fe 100644
--- a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr
+++ b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr
@@ -25,10 +25,13 @@ LL | | T: Trait<'a>,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/propagate-from-trait-match.rs:43:9
|
+LL | fn supply<'a, T>(value: T)
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | require(value);
| ^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Trait<'a> + 'a,
| ++++
diff --git a/tests/ui/nll/generator-distinct-lifetime.rs b/tests/ui/nll/coroutine-distinct-lifetime.rs
index 90fe6b569..0483b8858 100644
--- a/tests/ui/nll/generator-distinct-lifetime.rs
+++ b/tests/ui/nll/coroutine-distinct-lifetime.rs
@@ -1,7 +1,7 @@
-#![feature(generators)]
+#![feature(coroutines)]
// Test for issue #47189. Here, both `s` and `t` are live for the
-// generator's lifetime, but within the generator they have distinct
+// coroutine's lifetime, but within the coroutine they have distinct
// lifetimes. We accept this code -- even though the borrow extends
// over a yield -- because the data that is borrowed (`*x`) is not
// stored on the stack.
diff --git a/tests/ui/nll/generator-upvar-mutability.rs b/tests/ui/nll/coroutine-upvar-mutability.rs
index c49ea15b8..12853b16b 100644
--- a/tests/ui/nll/generator-upvar-mutability.rs
+++ b/tests/ui/nll/coroutine-upvar-mutability.rs
@@ -1,6 +1,6 @@
-// Check that generators respect the muatability of their upvars.
+// Check that coroutines respect the muatability of their upvars.
-#![feature(generators)]
+#![feature(coroutines)]
fn mutate_upvar() {
let x = 0;
diff --git a/tests/ui/nll/generator-upvar-mutability.stderr b/tests/ui/nll/coroutine-upvar-mutability.stderr
index 31b061b61..464bbc769 100644
--- a/tests/ui/nll/generator-upvar-mutability.stderr
+++ b/tests/ui/nll/coroutine-upvar-mutability.stderr
@@ -1,5 +1,5 @@
error[E0594]: cannot assign to `x`, as it is not declared as mutable
- --> $DIR/generator-upvar-mutability.rs:8:9
+ --> $DIR/coroutine-upvar-mutability.rs:8:9
|
LL | let x = 0;
| - help: consider changing this to be mutable: `mut x`
diff --git a/tests/ui/nll/extra-unused-mut.rs b/tests/ui/nll/extra-unused-mut.rs
index 340f2952a..b04e39542 100644
--- a/tests/ui/nll/extra-unused-mut.rs
+++ b/tests/ui/nll/extra-unused-mut.rs
@@ -2,7 +2,7 @@
// check-pass
-#![feature(generators)]
+#![feature(coroutines)]
#![deny(unused_mut)]
fn ref_argument(ref _y: i32) {}
@@ -16,7 +16,7 @@ fn mutable_upvar() {
}
// #50897
-fn generator_mutable_upvar() {
+fn coroutine_mutable_upvar() {
let mut x = 0;
move || {
x = 1;
diff --git a/tests/ui/nll/issue-48623-generator.rs b/tests/ui/nll/issue-48623-coroutine.rs
index 08d2584ee..bd11aaf14 100644
--- a/tests/ui/nll/issue-48623-generator.rs
+++ b/tests/ui/nll/issue-48623-coroutine.rs
@@ -2,7 +2,7 @@
#![allow(path_statements)]
#![allow(dead_code)]
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
struct WithDrop;
@@ -10,9 +10,9 @@ impl Drop for WithDrop {
fn drop(&mut self) {}
}
-fn reborrow_from_generator(r: &mut ()) {
+fn reborrow_from_coroutine(r: &mut ()) {
let d = WithDrop;
- move || { d; yield; &mut *r }; //~ WARN unused generator that must be used
+ move || { d; yield; &mut *r }; //~ WARN unused coroutine that must be used
}
fn main() {}
diff --git a/tests/ui/nll/issue-48623-generator.stderr b/tests/ui/nll/issue-48623-coroutine.stderr
index bfdfca210..1b7b1735a 100644
--- a/tests/ui/nll/issue-48623-generator.stderr
+++ b/tests/ui/nll/issue-48623-coroutine.stderr
@@ -1,10 +1,10 @@
-warning: unused generator that must be used
- --> $DIR/issue-48623-generator.rs:15:5
+warning: unused coroutine that must be used
+ --> $DIR/issue-48623-coroutine.rs:15:5
|
LL | move || { d; yield; &mut *r };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = note: generators are lazy and do nothing unless resumed
+ = note: coroutines are lazy and do nothing unless resumed
= note: `#[warn(unused_must_use)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/nll/issue-55850.rs b/tests/ui/nll/issue-55850.rs
index e6279bd02..fc873af94 100644
--- a/tests/ui/nll/issue-55850.rs
+++ b/tests/ui/nll/issue-55850.rs
@@ -1,16 +1,16 @@
#![allow(unused_mut)]
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
use std::marker::Unpin;
-use std::ops::Generator;
-use std::ops::GeneratorState::Yielded;
+use std::ops::Coroutine;
+use std::ops::CoroutineState::Yielded;
use std::pin::Pin;
pub struct GenIter<G>(G);
impl <G> Iterator for GenIter<G>
where
- G: Generator + Unpin,
+ G: Coroutine + Unpin,
{
type Item = G::Yield;
@@ -26,7 +26,7 @@ fn bug<'a>() -> impl Iterator<Item = &'a str> {
GenIter(move || {
let mut s = String::new();
yield &s[..] //~ ERROR cannot yield value referencing local variable `s` [E0515]
- //~| ERROR borrow may still be in use when generator yields
+ //~| ERROR borrow may still be in use when coroutine yields
})
}
diff --git a/tests/ui/nll/issue-55850.stderr b/tests/ui/nll/issue-55850.stderr
index 86a8cdc42..3d43817f4 100644
--- a/tests/ui/nll/issue-55850.stderr
+++ b/tests/ui/nll/issue-55850.stderr
@@ -7,7 +7,7 @@ LL | yield &s[..]
| | `s` is borrowed here
| yields a value referencing data owned by the current function
-error[E0626]: borrow may still be in use when generator yields
+error[E0626]: borrow may still be in use when coroutine yields
--> $DIR/issue-55850.rs:28:16
|
LL | yield &s[..]
diff --git a/tests/ui/nll/issue-97997.stderr b/tests/ui/nll/issue-97997.stderr
index 46440c021..89eaf77ad 100644
--- a/tests/ui/nll/issue-97997.stderr
+++ b/tests/ui/nll/issue-97997.stderr
@@ -15,6 +15,7 @@ LL | <fn(&u8) as Foo>::ASSOC;
|
= note: `Foo` would have to be implemented for the type `for<'a> fn(&'a u8)`
= note: ...but `Foo` is actually implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr b/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr
index d8b26f0b0..4e741abc2 100644
--- a/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr
+++ b/tests/ui/nll/issue-98589-closures-relate-named-regions.stderr
@@ -37,10 +37,12 @@ LL | || { None::<&'a &'b ()>; };
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/issue-98589-closures-relate-named-regions.rs:26:10
|
+LL | fn test_early_type<'a: 'a, T>() {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | || { None::<&'a T>; };
| ^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test_early_type<'a: 'a, T: 'a>() {
| ++++
@@ -48,10 +50,12 @@ LL | fn test_early_type<'a: 'a, T: 'a>() {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/issue-98589-closures-relate-named-regions.rs:32:10
|
+LL | fn test_late_type<'a, T>() {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | || { None::<&'a T>; };
| ^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test_late_type<'a, T: 'a>() {
| ++++
diff --git a/tests/ui/nll/issue-98693.stderr b/tests/ui/nll/issue-98693.stderr
index 15ca38aa2..a3d87d74a 100644
--- a/tests/ui/nll/issue-98693.stderr
+++ b/tests/ui/nll/issue-98693.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-98693.rs:16:9
|
LL | assert_static::<T>();
- | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test<T: 'static>() {
| +++++++++
diff --git a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr
index e0d476a33..cab75e630 100644
--- a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr
+++ b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/min-choice-reject-ambiguous.rs:17:5
|
+LL | fn test_b<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | type_test::<'_, T>() // This should pass if we pick 'b.
| ^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + 'a,
| ++++
@@ -12,10 +15,13 @@ LL | T: 'b + 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/min-choice-reject-ambiguous.rs:28:5
|
+LL | fn test_c<'a, 'b, 'c, T>() -> impl Cap<'a> + Cap<'b> + Cap<'c>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | type_test::<'_, T>() // This should pass if we pick 'c.
| ^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'c + 'a,
| ++++
diff --git a/tests/ui/nll/missing-universe-cause-issue-114907.stderr b/tests/ui/nll/missing-universe-cause-issue-114907.stderr
index c3dd4257a..988eee610 100644
--- a/tests/ui/nll/missing-universe-cause-issue-114907.stderr
+++ b/tests/ui/nll/missing-universe-cause-issue-114907.stderr
@@ -38,6 +38,7 @@ LL | accept(callback);
|
= note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
= note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0308]: mismatched types
--> $DIR/missing-universe-cause-issue-114907.rs:33:5
@@ -73,6 +74,8 @@ error: higher-ranked subtype error
|
LL | accept(callback);
| ^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/nll/move-errors.stderr b/tests/ui/nll/move-errors.stderr
index 58b8aa31d..0d994ef29 100644
--- a/tests/ui/nll/move-errors.stderr
+++ b/tests/ui/nll/move-errors.stderr
@@ -186,7 +186,7 @@ help: consider borrowing the pattern binding
LL | F(s, ref mut t) => (),
| +++
-error[E0507]: cannot move out of `x` as enum variant `Err` which is behind a shared reference
+error[E0507]: cannot move out of `x` as enum variant `Ok` which is behind a shared reference
--> $DIR/move-errors.rs:110:11
|
LL | match *x {
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr
new file mode 100644
index 000000000..6f9b33031
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr
@@ -0,0 +1,36 @@
+error[E0046]: not all trait items implemented, missing: `call`
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:18:1
+ |
+LL | fn call(x: Self) -> Self::Output;
+ | --------------------------------- `call` from trait
+...
+LL | impl<T: PlusOne> Callable for T {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
+
+error: unconstrained opaque type
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:22:19
+ |
+LL | type Output = impl PlusOne;
+ | ^^^^^^^^^^^^
+ |
+ = note: `Output` must be used in combination with a concrete type within the same impl
+
+error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:28:5
+ |
+LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne {
+ | -- ------------ opaque type defined here
+ | |
+ | hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here
+LL | <&mut i32 as Callable>::call(y)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: to declare that `impl PlusOne` captures `'a`, you can add an explicit `'a` lifetime bound
+ |
+LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + 'a {
+ | ++++
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0046, E0700.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr
new file mode 100644
index 000000000..6f9b33031
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr
@@ -0,0 +1,36 @@
+error[E0046]: not all trait items implemented, missing: `call`
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:18:1
+ |
+LL | fn call(x: Self) -> Self::Output;
+ | --------------------------------- `call` from trait
+...
+LL | impl<T: PlusOne> Callable for T {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
+
+error: unconstrained opaque type
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:22:19
+ |
+LL | type Output = impl PlusOne;
+ | ^^^^^^^^^^^^
+ |
+ = note: `Output` must be used in combination with a concrete type within the same impl
+
+error[E0700]: hidden type for `impl PlusOne` captures lifetime that does not appear in bounds
+ --> $DIR/location-insensitive-scopes-issue-116657.rs:28:5
+ |
+LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne {
+ | -- ------------ opaque type defined here
+ | |
+ | hidden type `<&'a mut i32 as Callable>::Output` captures the lifetime `'a` as defined here
+LL | <&mut i32 as Callable>::call(y)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: to declare that `impl PlusOne` captures `'a`, you can add an explicit `'a` lifetime bound
+ |
+LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + 'a {
+ | ++++
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0046, E0700.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs
new file mode 100644
index 000000000..ec17e0b09
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.rs
@@ -0,0 +1,33 @@
+// This is a non-regression test for issue #116657, where NLL and `-Zpolonius=next` computed
+// different loan scopes when a member constraint was not ultimately applied.
+
+// revisions: nll polonius
+// [polonius] compile-flags: -Zpolonius=next
+
+#![feature(impl_trait_in_assoc_type)]
+
+trait Callable {
+ type Output;
+ fn call(x: Self) -> Self::Output;
+}
+
+trait PlusOne {}
+
+impl<'a> PlusOne for &'a mut i32 {}
+
+impl<T: PlusOne> Callable for T {
+ //[nll]~^ ERROR not all trait items implemented
+ //[polonius]~^^ ERROR not all trait items implemented
+
+ type Output = impl PlusOne;
+ //[nll]~^ ERROR unconstrained opaque type
+ //[polonius]~^^ ERROR unconstrained opaque type
+}
+
+fn test<'a>(y: &'a mut i32) -> impl PlusOne {
+ <&mut i32 as Callable>::call(y)
+ //[nll]~^ ERROR hidden type for `impl PlusOne` captures lifetime
+ //[polonius]~^^ ERROR hidden type for `impl PlusOne` captures lifetime
+}
+
+fn main() {}
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr
new file mode 100644
index 000000000..5227ca8ec
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.nll.stderr
@@ -0,0 +1,40 @@
+error[E0597]: `a` does not live long enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:10:18
+ |
+LL | let b = |_| &a;
+ | --- -^
+ | | ||
+ | | |borrowed value does not live long enough
+ | | returning this value requires that `a` is borrowed for `'static`
+ | value captured here
+...
+LL | }
+ | - `a` dropped here while still borrowed
+ |
+note: due to current limitations in the borrow checker, this implies a `'static` lifetime
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22
+ |
+LL | fn bad<F: Fn(&()) -> &()>(_: F) {}
+ | ^^^
+
+error: implementation of `Fn` is not general enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5
+ |
+LL | bad(&b);
+ | ^^^^^^^ implementation of `Fn` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2`
+
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5
+ |
+LL | bad(&b);
+ | ^^^^^^^ implementation of `FnOnce` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr
new file mode 100644
index 000000000..5227ca8ec
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.polonius.stderr
@@ -0,0 +1,40 @@
+error[E0597]: `a` does not live long enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:10:18
+ |
+LL | let b = |_| &a;
+ | --- -^
+ | | ||
+ | | |borrowed value does not live long enough
+ | | returning this value requires that `a` is borrowed for `'static`
+ | value captured here
+...
+LL | }
+ | - `a` dropped here while still borrowed
+ |
+note: due to current limitations in the borrow checker, this implies a `'static` lifetime
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22
+ |
+LL | fn bad<F: Fn(&()) -> &()>(_: F) {}
+ | ^^^
+
+error: implementation of `Fn` is not general enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5
+ |
+LL | bad(&b);
+ | ^^^^^^^ implementation of `Fn` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2`
+
+error: implementation of `FnOnce` is not general enough
+ --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5
+ |
+LL | bad(&b);
+ | ^^^^^^^ implementation of `FnOnce` is not general enough
+ |
+ = note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`...
+ = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs
new file mode 100644
index 000000000..c165e7a1d
--- /dev/null
+++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-117146.rs
@@ -0,0 +1,20 @@
+// This is a non-regression test for issue #117146, where NLL and `-Zpolonius=next` computed
+// different loan scopes when a region flowed into an SCC whose representative was an existential
+// region.
+
+// revisions: nll polonius
+// [polonius] compile-flags: -Zpolonius=next
+
+fn main() {
+ let a = ();
+ let b = |_| &a;
+ //[nll]~^ ERROR `a` does not live long enough
+ //[polonius]~^^ ERROR `a` does not live long enough
+ bad(&b);
+ //[nll]~^ ERROR implementation of `Fn`
+ //[nll]~| ERROR implementation of `FnOnce`
+ //[polonius]~^^^ ERROR implementation of `Fn`
+ //[polonius]~| ERROR implementation of `FnOnce`
+}
+
+fn bad<F: Fn(&()) -> &()>(_: F) {}
diff --git a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr
index b945ffedd..804071a3e 100644
--- a/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr
+++ b/tests/ui/nll/relate_tys/impl-fn-ignore-binder-via-bottom.stderr
@@ -15,6 +15,7 @@ LL | let _x = <fn(&())>::make_f();
|
= note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())`
= note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: implementation of `Y` is not general enough
--> $DIR/impl-fn-ignore-binder-via-bottom.rs:30:14
@@ -24,6 +25,7 @@ LL | let _x = <fn(&())>::make_f();
|
= note: `Y` would have to be implemented for the type `for<'a> fn(&'a ())`
= note: ...but `Y` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr b/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr
index 64b08a9b3..ff9d75057 100644
--- a/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr
+++ b/tests/ui/nll/ty-outlives/impl-trait-outlives.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/impl-trait-outlives.rs:11:5
|
+LL | fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Debug + 'a,
| ++++
@@ -12,10 +15,13 @@ LL | T: Debug + 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/impl-trait-outlives.rs:26:5
|
+LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + Debug + 'a,
| ++++
diff --git a/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr b/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr
index d949e29b2..6de023ffd 100644
--- a/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr
+++ b/tests/ui/nll/ty-outlives/projection-implied-bounds.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/projection-implied-bounds.rs:30:36
|
LL | twice(value, |value_ref, item| invoke2(value_ref, item));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn generic2<T: Iterator + 'static>(value: T) {
| +++++++++
diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr
index 433024c30..4f93fb4ea 100644
--- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr
@@ -25,11 +25,16 @@ LL | | T: Iterator,
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-closure.rs:25:31
|
+LL | fn no_region<'a, T>(x: Box<T>) -> Box<dyn Anything + 'a>
+ | -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(x, |mut y| Box::new(y.next()))
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
- = note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | T: Iterator, <T as Iterator>::Item: 'a
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: external requirements
--> $DIR/projection-no-regions-closure.rs:34:23
@@ -82,11 +87,16 @@ LL | | T: 'b + Iterator,
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-closure.rs:42:31
|
+LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<dyn Anything + 'a>
+ | -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(x, |mut y| Box::new(y.next()))
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
- = help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
- = note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+LL | T: 'b + Iterator, <T as Iterator>::Item: 'a
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: external requirements
--> $DIR/projection-no-regions-closure.rs:52:23
diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr
index e0ff544fe..da76ac1c4 100644
--- a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr
+++ b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr
@@ -1,20 +1,30 @@
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-fn.rs:13:5
|
+LL | fn no_region<'a, T>(mut x: T) -> Box<dyn Anything + 'a>
+ | -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(x.next())
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
- = note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | T: Iterator, <T as Iterator>::Item: 'a
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-fn.rs:28:5
|
+LL | fn wrong_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a>
+ | -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(x.next())
- | ^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
- = help: consider adding an explicit lifetime bound `<T as Iterator>::Item: 'a`...
- = note: ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
+LL | T: 'b + Iterator, <T as Iterator>::Item: 'a
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
diff --git a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
index ebdce7bc1..dda603981 100644
--- a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr
@@ -27,10 +27,13 @@ LL | | T: Anything<'b>,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/projection-one-region-closure.rs:45:39
|
+LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Anything<'b> + 'a,
| ++++
@@ -77,10 +80,13 @@ LL | | 'a: 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/projection-one-region-closure.rs:56:39
|
+LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Anything<'b> + 'a,
| ++++
diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
index dbad8e478..c157e89ff 100644
--- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
+++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr
@@ -26,11 +26,13 @@ LL | | T: Anything<'b, 'c>,
error[E0309]: the associated type `<T as Anything<'?5, '?6>>::AssocType` may not live long enough
--> $DIR/projection-two-region-trait-bound-closure.rs:38:39
|
+LL | fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
+ | -- the associated type `<T as Anything<'?5, '?6>>::AssocType` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(cell, t, |cell, t| require(cell, t));
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'?5, '?6>>::AssocType` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<T as Anything<'?5, '?6>>::AssocType: 'a`...
- = note: ...so that the type `<T as Anything<'?5, '?6>>::AssocType` will meet its required lifetime bounds
note: external requirements
--> $DIR/projection-two-region-trait-bound-closure.rs:48:29
@@ -60,11 +62,13 @@ LL | | 'a: 'a,
error[E0309]: the associated type `<T as Anything<'?6, '?7>>::AssocType` may not live long enough
--> $DIR/projection-two-region-trait-bound-closure.rs:48:39
|
+LL | fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
+ | -- the associated type `<T as Anything<'?6, '?7>>::AssocType` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(cell, t, |cell, t| require(cell, t));
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'?6, '?7>>::AssocType` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<T as Anything<'?6, '?7>>::AssocType: 'a`...
- = note: ...so that the type `<T as Anything<'?6, '?7>>::AssocType` will meet its required lifetime bounds
note: external requirements
--> $DIR/projection-two-region-trait-bound-closure.rs:61:29
diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr
index b4435fe06..1fa74f67c 100644
--- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr
+++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr
@@ -1,11 +1,13 @@
error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
--> $DIR/projection-where-clause-env-wrong-bound.rs:15:5
|
+LL | fn foo1<'a, 'b, T>() -> &'a ()
+ | -- the associated type `<T as MyTrait<'_>>::Output` must be valid for the lifetime `'a` as defined here...
+...
LL | bar::<T::Output>()
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
- = note: ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds
error: aborting due to previous error
diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr
index ddeaf3c1f..c8dbe4ebc 100644
--- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr
+++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr
@@ -1,11 +1,13 @@
error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough
--> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5
|
+LL | fn foo1<'a, 'b, T>() -> &'a ()
+ | -- the associated type `<T as MyTrait<'_>>::Output` must be valid for the lifetime `'a` as defined here...
+...
LL | bar::<<T as MyTrait<'a>>::Output>()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`...
- = note: ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds
error: aborting due to previous error
diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-none.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-none.stderr
index 0df44644d..f78708dc4 100644
--- a/tests/ui/nll/ty-outlives/projection-where-clause-none.stderr
+++ b/tests/ui/nll/ty-outlives/projection-where-clause-none.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/projection-where-clause-none.rs:14:5
|
+LL | fn foo<'a, T>() -> &'a ()
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | bar::<T::Output>()
| ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: MyTrait<'a> + 'a,
| ++++
diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
index f58d49d84..59e29e9a4 100644
--- a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr
@@ -46,10 +46,12 @@ LL | fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-approximate-lower-bound.rs:29:31
|
+LL | fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn generic_fail<'a, T: 'a>(cell: Cell<&'a ()>, value: T) {
| ++++
diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
index ddad1d205..3468c5ad3 100644
--- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr
@@ -25,10 +25,13 @@ LL | | T: Debug,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-outlives-from-return-type.rs:26:27
|
+LL | fn no_region<'a, T>(x: Box<T>) -> Box<dyn Debug + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | with_signature(x, |y| y)
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Debug + 'a,
| ++++
@@ -36,10 +39,13 @@ LL | T: Debug + 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-outlives-from-return-type.rs:41:5
|
+LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + Debug + 'a,
| ++++
diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
index bb455e9ae..cef4a0f1e 100644
--- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr
@@ -24,10 +24,13 @@ LL | fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:32:9
|
+LL | fn no_region<'a, T>(a: Cell<&'a ()>, b: T) {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | require(&x, &y)
| ^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn no_region<'a, T: 'a>(a: Cell<&'a ()>, b: T) {
| ++++
@@ -84,10 +87,13 @@ LL | | T: 'b,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:65:9
|
+LL | fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T)
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | require(&x, &y)
| ^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + 'a,
| ++++
diff --git a/tests/ui/nll/ty-outlives/ty-param-fn-body.stderr b/tests/ui/nll/ty-outlives/ty-param-fn-body.stderr
index 5fb69255d..73f01ff15 100644
--- a/tests/ui/nll/ty-outlives/ty-param-fn-body.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-fn-body.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-fn-body.rs:17:5
|
+LL | fn region_static<'a, T>(cell: Cell<&'a usize>, t: T) {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | outlives(cell, t)
| ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn region_static<'a, T: 'a>(cell: Cell<&'a usize>, t: T) {
| ++++
diff --git a/tests/ui/nll/ty-outlives/ty-param-fn.stderr b/tests/ui/nll/ty-outlives/ty-param-fn.stderr
index 825b26d2f..56bd41051 100644
--- a/tests/ui/nll/ty-outlives/ty-param-fn.stderr
+++ b/tests/ui/nll/ty-outlives/ty-param-fn.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-fn.rs:9:5
|
+LL | fn no_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: Debug + 'a,
| ++++
@@ -12,10 +15,13 @@ LL | T: Debug + 'a,
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/ty-param-fn.rs:24:5
|
+LL | fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | x
| ^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | T: 'b + Debug + 'a,
| ++++
diff --git a/tests/ui/nll/type-check-pointer-comparisons.stderr b/tests/ui/nll/type-check-pointer-comparisons.stderr
index 0d8480a42..37098b585 100644
--- a/tests/ui/nll/type-check-pointer-comparisons.stderr
+++ b/tests/ui/nll/type-check-pointer-comparisons.stderr
@@ -61,6 +61,8 @@ LL | x == y;
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
help: `'a` and `'b` must be the same: replace one with the other
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lifetime may not live long enough
--> $DIR/type-check-pointer-comparisons.rs:16:5
@@ -93,6 +95,8 @@ LL | f == g;
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
help: `'a` and `'b` must be the same: replace one with the other
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/nll/user-annotations/normalization-2.stderr b/tests/ui/nll/user-annotations/normalization-2.stderr
index 6b0dcb414..dcf049a7a 100644
--- a/tests/ui/nll/user-annotations/normalization-2.stderr
+++ b/tests/ui/nll/user-annotations/normalization-2.stderr
@@ -131,6 +131,7 @@ help: the following changes may resolve your lifetime errors
|
= help: replace `'a` with `'static`
= help: replace `'b` with `'static`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lifetime may not live long enough
--> $DIR/normalization-2.rs:89:5
@@ -185,6 +186,7 @@ help: the following changes may resolve your lifetime errors
|
= help: replace `'a` with `'static`
= help: replace `'b` with `'static`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: lifetime may not live long enough
--> $DIR/normalization-2.rs:117:5
diff --git a/tests/ui/nll/user-annotations/normalization-infer.stderr b/tests/ui/nll/user-annotations/normalization-infer.stderr
index 12854ab68..41d563a55 100644
--- a/tests/ui/nll/user-annotations/normalization-infer.stderr
+++ b/tests/ui/nll/user-annotations/normalization-infer.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/normalization-infer.rs:11:12
|
LL | let _: <(_,) as Tr>::Ty = a;
- | ^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test1<A: 'static, B, C, D>(a: A, b: B, c: C) {
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `B` may not live long enough
--> $DIR/normalization-infer.rs:12:5
|
LL | Some::<<(_,) as Tr>::Ty>(b);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `B` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `B` must be valid for the static lifetime...
+ | ...so that the type `B` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test1<A, B: 'static, C, D>(a: A, b: B, c: C) {
| +++++++++
@@ -24,9 +30,12 @@ error[E0310]: the parameter type `C` may not live long enough
--> $DIR/normalization-infer.rs:13:11
|
LL | || -> <(_,) as Tr>::Ty { c };
- | ^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `C` must be valid for the static lifetime...
+ | ...so that the type `C` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test1<A, B, C: 'static, D>(a: A, b: B, c: C) {
| +++++++++
@@ -35,9 +44,12 @@ error[E0310]: the parameter type `D` may not live long enough
--> $DIR/normalization-infer.rs:14:6
|
LL | |d: <(_,) as Tr>::Ty| -> D { d };
- | ^ ...so that the type `D` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `D` must be valid for the static lifetime...
+ | ...so that the type `D` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test1<A, B, C, D: 'static>(a: A, b: B, c: C) {
| +++++++++
@@ -46,9 +58,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/normalization-infer.rs:28:12
|
LL | let _: Alias<_, _> = (a, 0u8);
- | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test2<A: 'static, B, C>(a: A, b: B, c: C) {
| +++++++++
@@ -57,9 +72,12 @@ error[E0310]: the parameter type `B` may not live long enough
--> $DIR/normalization-infer.rs:29:5
|
LL | Some::<Alias<_, _>>((b, 0u8));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `B` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `B` must be valid for the static lifetime...
+ | ...so that the type `B` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test2<A, B: 'static, C>(a: A, b: B, c: C) {
| +++++++++
@@ -68,9 +86,12 @@ error[E0310]: the parameter type `C` may not live long enough
--> $DIR/normalization-infer.rs:30:11
|
LL | || -> Alias<_, _> { (c, 0u8) };
- | ^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `C` must be valid for the static lifetime...
+ | ...so that the type `C` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test2<A, B, C: 'static>(a: A, b: B, c: C) {
| +++++++++
diff --git a/tests/ui/noexporttypeexe.stderr b/tests/ui/noexporttypeexe.stderr
index 26bafd31d..bf88ceaa5 100644
--- a/tests/ui/noexporttypeexe.stderr
+++ b/tests/ui/noexporttypeexe.stderr
@@ -8,6 +8,10 @@ LL | let x: isize = noexporttypelib::foo();
|
= note: expected type `isize`
found enum `Option<isize>`
+help: consider using `Option::expect` to unwrap the `Option<isize>` value, panicking if the value is an `Option::None`
+ |
+LL | let x: isize = noexporttypelib::foo().expect("REASON");
+ | +++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/numbers-arithmetic/saturating-float-casts-wasm.stderr b/tests/ui/numbers-arithmetic/saturating-float-casts-wasm.stderr
new file mode 100644
index 000000000..475b41388
--- /dev/null
+++ b/tests/ui/numbers-arithmetic/saturating-float-casts-wasm.stderr
@@ -0,0 +1,6 @@
+warning: unstable feature specified for `-Ctarget-feature`: `nontrapping-fptoint`
+ |
+ = note: this feature is not stably supported; its behavior can change in the future
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/object-safety/assoc_type_bounds.rs b/tests/ui/object-safety/assoc_type_bounds.rs
index 9abf7939c..8634ba626 100644
--- a/tests/ui/object-safety/assoc_type_bounds.rs
+++ b/tests/ui/object-safety/assoc_type_bounds.rs
@@ -7,7 +7,7 @@ trait Foo<T> {
trait Cake {}
impl Cake for () {}
-fn foo(_: &dyn Foo<()>) {} //~ ERROR: the value of the associated type `Bar` (from trait `Foo`) must be specified
-fn bar(_: &dyn Foo<i32>) {} //~ ERROR: the value of the associated type `Bar` (from trait `Foo`) must be specified
+fn foo(_: &dyn Foo<()>) {} //~ ERROR: the value of the associated type `Bar` in `Foo` must be specified
+fn bar(_: &dyn Foo<i32>) {} //~ ERROR: the value of the associated type `Bar` in `Foo` must be specified
fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds.stderr b/tests/ui/object-safety/assoc_type_bounds.stderr
index a1396dc3a..3d5482625 100644
--- a/tests/ui/object-safety/assoc_type_bounds.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Bar` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
--> $DIR/assoc_type_bounds.rs:10:16
|
LL | type Bar
@@ -7,7 +7,7 @@ LL | type Bar
LL | fn foo(_: &dyn Foo<()>) {}
| ^^^^^^^ help: specify the associated type: `Foo<(), Bar = Type>`
-error[E0191]: the value of the associated type `Bar` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
--> $DIR/assoc_type_bounds.rs:11:16
|
LL | type Bar
diff --git a/tests/ui/object-safety/assoc_type_bounds2.rs b/tests/ui/object-safety/assoc_type_bounds2.rs
index 0112123fd..f7dc2fb88 100644
--- a/tests/ui/object-safety/assoc_type_bounds2.rs
+++ b/tests/ui/object-safety/assoc_type_bounds2.rs
@@ -7,7 +7,7 @@ trait Foo<T> {
trait Cake {}
impl Cake for () {}
-fn foo(_: &dyn Foo<()>) {} //~ ERROR: the value of the associated type `Bar` (from trait `Foo`) must be specified
-fn bar(_: &dyn Foo<i32>) {} //~ ERROR: the value of the associated type `Bar` (from trait `Foo`) must be specified
+fn foo(_: &dyn Foo<()>) {} //~ ERROR: the value of the associated type `Bar` in `Foo` must be specified
+fn bar(_: &dyn Foo<i32>) {} //~ ERROR: the value of the associated type `Bar` in `Foo` must be specified
fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds2.stderr b/tests/ui/object-safety/assoc_type_bounds2.stderr
index 7a3c0e02d..815747436 100644
--- a/tests/ui/object-safety/assoc_type_bounds2.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds2.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Bar` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
--> $DIR/assoc_type_bounds2.rs:10:16
|
LL | type Bar
@@ -7,7 +7,7 @@ LL | type Bar
LL | fn foo(_: &dyn Foo<()>) {}
| ^^^^^^^ help: specify the associated type: `Foo<(), Bar = Type>`
-error[E0191]: the value of the associated type `Bar` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
--> $DIR/assoc_type_bounds2.rs:11:16
|
LL | type Bar
diff --git a/tests/ui/object-safety/assoc_type_bounds_implicit_sized.fixed b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.fixed
new file mode 100644
index 000000000..45c7e07a2
--- /dev/null
+++ b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.fixed
@@ -0,0 +1,10 @@
+// run-rustfix
+trait TraitWithAType {
+ type Item: ?Sized;
+}
+trait Trait {}
+struct A {}
+impl TraitWithAType for A {
+ type Item = dyn Trait; //~ ERROR E0277
+}
+fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds_implicit_sized.rs b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.rs
new file mode 100644
index 000000000..c3e958f49
--- /dev/null
+++ b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.rs
@@ -0,0 +1,10 @@
+// run-rustfix
+trait TraitWithAType {
+ type Item;
+}
+trait Trait {}
+struct A {}
+impl TraitWithAType for A {
+ type Item = dyn Trait; //~ ERROR E0277
+}
+fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds_implicit_sized.stderr b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.stderr
new file mode 100644
index 000000000..110e71507
--- /dev/null
+++ b/tests/ui/object-safety/assoc_type_bounds_implicit_sized.stderr
@@ -0,0 +1,20 @@
+error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time
+ --> $DIR/assoc_type_bounds_implicit_sized.rs:8:17
+ |
+LL | type Item = dyn Trait;
+ | ^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn Trait + 'static)`
+note: required by a bound in `TraitWithAType::Item`
+ --> $DIR/assoc_type_bounds_implicit_sized.rs:3:5
+ |
+LL | type Item;
+ | ^^^^^^^^^^ required by this bound in `TraitWithAType::Item`
+help: consider relaxing the implicit `Sized` restriction
+ |
+LL | type Item: ?Sized;
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_others.rs b/tests/ui/object-safety/assoc_type_bounds_sized_others.rs
index 647b72a75..5b07bc92f 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_others.rs
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_others.rs
@@ -10,7 +10,7 @@ trait Foo {
}
fn foo(_: &dyn Foo) {}
-//~^ ERROR the value of the associated type `Bop` (from trait `Foo`) must be specified
+//~^ ERROR the value of the associated type `Bop` in `Foo` must be specified
trait Bar {
type Bop;
@@ -20,6 +20,6 @@ trait Bar {
}
fn bar(_: &dyn Bar) {}
-//~^ ERROR the value of the associated type `Bop` (from trait `Bar`) must be specified
+//~^ ERROR the value of the associated type `Bop` in `Bar` must be specified
fn main() {}
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr
index e4c44334b..5438faaaf 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Bop` (from trait `Foo`) must be specified
+error[E0191]: the value of the associated type `Bop` in `Foo` must be specified
--> $DIR/assoc_type_bounds_sized_others.rs:12:16
|
LL | type Bop;
@@ -7,7 +7,7 @@ LL | type Bop;
LL | fn foo(_: &dyn Foo) {}
| ^^^ help: specify the associated type: `Foo<Bop = Type>`
-error[E0191]: the value of the associated type `Bop` (from trait `Bar`) must be specified
+error[E0191]: the value of the associated type `Bop` in `Bar` must be specified
--> $DIR/assoc_type_bounds_sized_others.rs:22:16
|
LL | type Bop;
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr
index d0a4179fe..659679e44 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr
@@ -14,6 +14,7 @@ LL | fn foo(_: &dyn Foo<Bar = ()>) {}
| ^^^^^^^^ help: remove this bound
|
= note: this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`.
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unnecessary associated type bound for not object safe associated type
--> $DIR/assoc_type_bounds_sized_unnecessary.rs:9:20
@@ -22,6 +23,7 @@ LL | fn foo(_: &dyn Foo<Bar = ()>) {}
| ^^^^^^^^ help: remove this bound
|
= note: this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`.
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
index 224d33fb2..b67a1244e 100644
--- a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
+++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr
@@ -33,6 +33,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
LL - fn bop<T: Bop + ?Sized>() {
LL + fn bop<T: Bop>() {
|
+help: consider relaxing the implicit `Sized` restriction
+ |
+LL | type Bar: Default + ?Sized
+ | ++++++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/object-safety/issue-19538.stderr b/tests/ui/object-safety/issue-19538.stderr
index 183245b23..31657501e 100644
--- a/tests/ui/object-safety/issue-19538.stderr
+++ b/tests/ui/object-safety/issue-19538.stderr
@@ -13,6 +13,7 @@ LL | fn foo<T>(&self, val: T);
LL | trait Bar: Foo { }
| --- this trait cannot be made into an object...
= help: consider moving `foo` to another trait
+ = help: only type `Thing` implements the trait, consider using it directly instead
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-19538.rs:17:30
@@ -29,6 +30,7 @@ LL | fn foo<T>(&self, val: T);
LL | trait Bar: Foo { }
| --- this trait cannot be made into an object...
= help: consider moving `foo` to another trait
+ = help: only type `Thing` implements the trait, consider using it directly instead
= note: required for the cast from `&mut Thing` to `&mut dyn Bar`
error: aborting due to 2 previous errors
diff --git a/tests/ui/object-safety/object-safety-issue-22040.stderr b/tests/ui/object-safety/object-safety-issue-22040.stderr
index 0262d5362..2e59d88bd 100644
--- a/tests/ui/object-safety/object-safety-issue-22040.stderr
+++ b/tests/ui/object-safety/object-safety-issue-22040.stderr
@@ -11,6 +11,7 @@ LL | trait Expr: Debug + PartialEq {
| ---- ^^^^^^^^^ ...because it uses `Self` as a type parameter
| |
| this trait cannot be made into an object...
+ = help: only type `SExpr<'x>` implements the trait, consider using it directly instead
error: aborting due to previous error
diff --git a/tests/ui/object-safety/object-safety-no-static.curr.stderr b/tests/ui/object-safety/object-safety-no-static.curr.stderr
index 1b025229e..b40470b45 100644
--- a/tests/ui/object-safety/object-safety-no-static.curr.stderr
+++ b/tests/ui/object-safety/object-safety-no-static.curr.stderr
@@ -11,6 +11,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo() {}
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `Bar` implements the trait, consider using it directly instead
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self) {}
diff --git a/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
index befcef952..1eae9a9b9 100644
--- a/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
+++ b/tests/ui/object-safety/object-safety-no-static.object_safe_for_dispatch.stderr
@@ -11,6 +11,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo() {}
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `Bar` implements the trait, consider using it directly instead
= note: required for the cast from `Box<Bar>` to `Box<dyn Foo>`
help: consider turning `foo` into a method by giving it a `&self` argument
|
diff --git a/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr b/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr
index 40429fe75..2d2bb27b8 100644
--- a/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr
+++ b/tests/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr
@@ -1,17 +1,11 @@
error[E0311]: the parameter type `Self` may not live long enough
|
-note: the parameter type `Self` must be valid for the lifetime `'a` as defined here...
- --> $DIR/object-safety-supertrait-mentions-GAT.rs:9:26
- |
-LL | trait SuperTrait<T>: for<'a> GatTrait<Gat<'a> = T> {
- | ^^
- = help: consider adding an explicit lifetime bound `Self: 'a`...
- = note: ...so that the type `Self` will meet its required lifetime bounds...
note: ...that is required by this bound
--> $DIR/object-safety-supertrait-mentions-GAT.rs:6:15
|
LL | Self: 'a;
| ^^
+ = help: consider adding an explicit lifetime bound `Self: 'a`...
error: associated item referring to unboxed trait object for its own trait
--> $DIR/object-safety-supertrait-mentions-GAT.rs:10:20
diff --git a/tests/ui/offset-of/offset-of-enum.rs b/tests/ui/offset-of/offset-of-enum.rs
index d73505821..a2d6aace4 100644
--- a/tests/ui/offset-of/offset-of-enum.rs
+++ b/tests/ui/offset-of/offset-of-enum.rs
@@ -1,4 +1,4 @@
-#![feature(offset_of)]
+#![feature(offset_of, offset_of_enum)]
use std::mem::offset_of;
@@ -9,5 +9,10 @@ enum Alpha {
fn main() {
offset_of!(Alpha::One, 0); //~ ERROR expected type, found variant `Alpha::One`
- offset_of!(Alpha, Two.0); //~ ERROR no field `Two` on type `Alpha`
+ offset_of!(Alpha, One); //~ ERROR `One` is an enum variant; expected field at end of `offset_of`
+ offset_of!(Alpha, Two.0);
+ offset_of!(Alpha, Two.1); //~ ERROR no field named `1` on enum variant `Alpha::Two`
+ offset_of!(Alpha, Two.foo); //~ ERROR no field named `foo` on enum variant `Alpha::Two`
+ offset_of!(Alpha, NonExistent); //~ ERROR no variant named `NonExistent` found for enum `Alpha`
+ offset_of!(Beta, One); //~ ERROR cannot find type `Beta` in this scope
}
diff --git a/tests/ui/offset-of/offset-of-enum.stderr b/tests/ui/offset-of/offset-of-enum.stderr
index 6958d199f..7e7ad41f5 100644
--- a/tests/ui/offset-of/offset-of-enum.stderr
+++ b/tests/ui/offset-of/offset-of-enum.stderr
@@ -7,13 +7,41 @@ LL | offset_of!(Alpha::One, 0);
| not a type
| help: try using the variant's enum: `Alpha`
-error[E0609]: no field `Two` on type `Alpha`
+error[E0412]: cannot find type `Beta` in this scope
+ --> $DIR/offset-of-enum.rs:17:16
+ |
+LL | offset_of!(Beta, One);
+ | ^^^^ not found in this scope
+
+error[E0795]: `One` is an enum variant; expected field at end of `offset_of`
--> $DIR/offset-of-enum.rs:12:23
|
-LL | offset_of!(Alpha, Two.0);
- | ^^^
+LL | offset_of!(Alpha, One);
+ | ^^^ enum variant
+
+error[E0609]: no field named `1` on enum variant `Alpha::Two`
+ --> $DIR/offset-of-enum.rs:14:23
+ |
+LL | offset_of!(Alpha, Two.1);
+ | ^^^ - ...does not have this field
+ | |
+ | this enum variant...
+
+error[E0609]: no field named `foo` on enum variant `Alpha::Two`
+ --> $DIR/offset-of-enum.rs:15:23
+ |
+LL | offset_of!(Alpha, Two.foo);
+ | ^^^ --- ...does not have this field
+ | |
+ | this enum variant...
+
+error[E0599]: no variant named `NonExistent` found for enum `Alpha`
+ --> $DIR/offset-of-enum.rs:16:23
+ |
+LL | offset_of!(Alpha, NonExistent);
+ | ^^^^^^^^^^^ variant not found
-error: aborting due to 2 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0573, E0609.
-For more information about an error, try `rustc --explain E0573`.
+Some errors have detailed explanations: E0412, E0573, E0599, E0609, E0795.
+For more information about an error, try `rustc --explain E0412`.
diff --git a/tests/ui/offset-of/offset-of-output-type.stderr b/tests/ui/offset-of/offset-of-output-type.stderr
index 6133f3263..233d49876 100644
--- a/tests/ui/offset-of/offset-of-output-type.stderr
+++ b/tests/ui/offset-of/offset-of-output-type.stderr
@@ -42,7 +42,7 @@ error[E0308]: mismatched types
--> $DIR/offset-of-output-type.rs:19:5
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
...
LL | offset_of!(S, v)
| ^^^^^^^^^^^^^^^^ expected `()`, found `usize`
diff --git a/tests/ui/offset-of/offset-of-private.rs b/tests/ui/offset-of/offset-of-private.rs
index 6b1a16ba6..b7affdb79 100644
--- a/tests/ui/offset-of/offset-of-private.rs
+++ b/tests/ui/offset-of/offset-of-private.rs
@@ -1,4 +1,4 @@
-#![feature(offset_of)]
+#![feature(offset_of, offset_of_enum)]
use std::mem::offset_of;
@@ -8,13 +8,20 @@ mod m {
pub public: u8,
private: u8,
}
+
#[repr(C)]
pub struct FooTuple(pub u8, u8);
+
#[repr(C)]
struct Bar {
pub public: u8,
private: u8,
}
+
+ pub enum Baz {
+ Var1(Foo),
+ Var2(u64),
+ }
}
fn main() {
@@ -25,4 +32,8 @@ fn main() {
offset_of!(m::Bar, public); //~ ERROR struct `Bar` is private
offset_of!(m::Bar, private); //~ ERROR struct `Bar` is private
//~| ERROR field `private` of struct `Bar` is private
+
+ offset_of!(m::Baz, Var1.0.public);
+ offset_of!(m::Baz, Var1.0.private); //~ ERROR field `private` of struct `Foo` is private
+ offset_of!(m::Baz, Var2.0);
}
diff --git a/tests/ui/offset-of/offset-of-private.stderr b/tests/ui/offset-of/offset-of-private.stderr
index 0674b58f8..930e30e63 100644
--- a/tests/ui/offset-of/offset-of-private.stderr
+++ b/tests/ui/offset-of/offset-of-private.stderr
@@ -1,46 +1,52 @@
error[E0603]: struct `Bar` is private
- --> $DIR/offset-of-private.rs:25:19
+ --> $DIR/offset-of-private.rs:32:19
|
LL | offset_of!(m::Bar, public);
| ^^^ private struct
|
note: the struct `Bar` is defined here
- --> $DIR/offset-of-private.rs:14:5
+ --> $DIR/offset-of-private.rs:16:5
|
LL | struct Bar {
| ^^^^^^^^^^
error[E0603]: struct `Bar` is private
- --> $DIR/offset-of-private.rs:26:19
+ --> $DIR/offset-of-private.rs:33:19
|
LL | offset_of!(m::Bar, private);
| ^^^ private struct
|
note: the struct `Bar` is defined here
- --> $DIR/offset-of-private.rs:14:5
+ --> $DIR/offset-of-private.rs:16:5
|
LL | struct Bar {
| ^^^^^^^^^^
error[E0616]: field `private` of struct `Foo` is private
- --> $DIR/offset-of-private.rs:22:24
+ --> $DIR/offset-of-private.rs:29:24
|
LL | offset_of!(m::Foo, private);
| ^^^^^^^ private field
error[E0616]: field `1` of struct `FooTuple` is private
- --> $DIR/offset-of-private.rs:24:29
+ --> $DIR/offset-of-private.rs:31:29
|
LL | offset_of!(m::FooTuple, 1);
| ^ private field
error[E0616]: field `private` of struct `Bar` is private
- --> $DIR/offset-of-private.rs:26:24
+ --> $DIR/offset-of-private.rs:33:24
|
LL | offset_of!(m::Bar, private);
| ^^^^^^^ private field
-error: aborting due to 5 previous errors
+error[E0616]: field `private` of struct `Foo` is private
+ --> $DIR/offset-of-private.rs:37:31
+ |
+LL | offset_of!(m::Baz, Var1.0.private);
+ | ^^^^^^^ private field
+
+error: aborting due to 6 previous errors
Some errors have detailed explanations: E0603, E0616.
For more information about an error, try `rustc --explain E0603`.
diff --git a/tests/ui/on-unimplemented/impl-substs.stderr b/tests/ui/on-unimplemented/impl-substs.stderr
index a0fad0acd..36d80f3e6 100644
--- a/tests/ui/on-unimplemented/impl-substs.stderr
+++ b/tests/ui/on-unimplemented/impl-substs.stderr
@@ -7,7 +7,8 @@ LL | Foo::<usize>::foo((1i32, 1i32, 1i32));
| required by a bound introduced by this call
|
= help: the trait `Foo<usize>` is not implemented for `(i32, i32, i32)`
- = help: the trait `Foo<A>` is implemented for `(A, B, C)`
+ = help: the trait `Foo<i32>` is implemented for `(i32, i32, i32)`
+ = help: for that trait implementation, expected `i32`, found `usize`
error: aborting due to previous error
diff --git a/tests/ui/on-unimplemented/on-impl.stderr b/tests/ui/on-unimplemented/on-impl.stderr
index 2253c5992..3a0b8353f 100644
--- a/tests/ui/on-unimplemented/on-impl.stderr
+++ b/tests/ui/on-unimplemented/on-impl.stderr
@@ -8,6 +8,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the trait `Index<usize>` is implemented for `[i32]`
+ = help: for that trait implementation, expected `usize`, found `u32`
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/on-impl.rs:22:5
@@ -17,6 +18,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the trait `Index<usize>` is implemented for `[i32]`
+ = help: for that trait implementation, expected `usize`, found `u32`
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/on-impl.rs:22:5
@@ -26,6 +28,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the trait `Index<usize>` is implemented for `[i32]`
+ = help: for that trait implementation, expected `usize`, found `u32`
error: aborting due to 3 previous errors
diff --git a/tests/ui/on-unimplemented/slice-index.stderr b/tests/ui/on-unimplemented/slice-index.stderr
index b9bca211f..5e0117be5 100644
--- a/tests/ui/on-unimplemented/slice-index.stderr
+++ b/tests/ui/on-unimplemented/slice-index.stderr
@@ -5,7 +5,8 @@ LL | x[1i32];
| ^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[i32]>` is not implemented for `i32`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[i32]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `i32`
= note: required for `[i32]` to implement `Index<i32>`
error[E0277]: the type `[i32]` cannot be indexed by `RangeTo<i32>`
diff --git a/tests/ui/or-patterns/exhaustiveness-pass.rs b/tests/ui/or-patterns/exhaustiveness-pass.rs
index e8c8a0e7b..428b9a19f 100644
--- a/tests/ui/or-patterns/exhaustiveness-pass.rs
+++ b/tests/ui/or-patterns/exhaustiveness-pass.rs
@@ -35,4 +35,10 @@ fn main() {
((0, 0) | (1, 0),) => {}
_ => {}
}
+
+ // This one caused ICE https://github.com/rust-lang/rust/issues/117378
+ match (0u8, 0) {
+ (x @ 0 | x @ (1 | 2), _) => {}
+ (3.., _) => {}
+ }
}
diff --git a/tests/ui/or-patterns/missing-bindings.stderr b/tests/ui/or-patterns/missing-bindings.stderr
index 4457b7893..7f182a857 100644
--- a/tests/ui/or-patterns/missing-bindings.stderr
+++ b/tests/ui/or-patterns/missing-bindings.stderr
@@ -103,22 +103,6 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| |
| variable not in all patterns
-error[E0408]: variable `c` is not bound in all patterns
- --> $DIR/missing-bindings.rs:45:33
- |
-LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
- | - ^^^^ pattern doesn't bind `c`
- | |
- | variable not in all patterns
-
-error[E0408]: variable `d` is not bound in all patterns
- --> $DIR/missing-bindings.rs:45:33
- |
-LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
- | - ^^^^ pattern doesn't bind `d`
- | |
- | variable not in all patterns
-
error[E0408]: variable `e` is not bound in all patterns
--> $DIR/missing-bindings.rs:45:10
|
@@ -143,6 +127,22 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| |
| variable not in all patterns
+error[E0408]: variable `c` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:45:33
+ |
+LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
+ | - ^^^^ pattern doesn't bind `c`
+ | |
+ | variable not in all patterns
+
+error[E0408]: variable `d` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:45:33
+ |
+LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
+ | - ^^^^ pattern doesn't bind `d`
+ | |
+ | variable not in all patterns
+
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:61:29
|
@@ -151,14 +151,6 @@ LL | Ok(a) | Err(_),
| |
| variable not in all patterns
-error[E0408]: variable `a` is not bound in all patterns
- --> $DIR/missing-bindings.rs:69:21
- |
-LL | A(_, a) |
- | - variable not in all patterns
-LL | B(b),
- | ^^^^ pattern doesn't bind `a`
-
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/missing-bindings.rs:68:21
|
@@ -168,6 +160,14 @@ LL | B(b),
| - variable not in all patterns
error[E0408]: variable `a` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:69:21
+ |
+LL | A(_, a) |
+ | - variable not in all patterns
+LL | B(b),
+ | ^^^^ pattern doesn't bind `a`
+
+error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:72:17
|
LL | A(_, a) |
@@ -185,6 +185,24 @@ LL | B(b),
LL | B(_)
| ^^^^ pattern doesn't bind `b`
+error[E0408]: variable `b` is not bound in all patterns
+ --> $DIR/missing-bindings.rs:57:13
+ |
+LL | / V1(
+LL | |
+LL | |
+LL | | A(
+... |
+LL | | B(Ok(a) | Err(a))
+LL | | ) |
+ | |_____________^ pattern doesn't bind `b`
+...
+LL | B(b),
+ | - variable not in all patterns
+...
+LL | V3(c),
+ | ^^^^^ pattern doesn't bind `b`
+
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/missing-bindings.rs:57:13
|
@@ -219,24 +237,6 @@ LL | A(_, a) |
LL | V3(c),
| ^^^^^ pattern doesn't bind `a`
-error[E0408]: variable `b` is not bound in all patterns
- --> $DIR/missing-bindings.rs:57:13
- |
-LL | / V1(
-LL | |
-LL | |
-LL | | A(
-... |
-LL | | B(Ok(a) | Err(a))
-LL | | ) |
- | |_____________^ pattern doesn't bind `b`
-...
-LL | B(b),
- | - variable not in all patterns
-...
-LL | V3(c),
- | ^^^^^ pattern doesn't bind `b`
-
error: aborting due to 26 previous errors
For more information about this error, try `rustc --explain E0408`.
diff --git a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr
index c16a90368..e09194d5d 100644
--- a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr
+++ b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr
@@ -2,9 +2,15 @@ error: expected identifier, found `:`
--> $DIR/or-patterns-syntactic-fail.rs:11:19
|
LL | let _ = |A | B: E| ();
- | ^ expected identifier
+ | ---- ^ expected identifier
+ | |
+ | while parsing the body of this closure
|
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
+help: you might have meant to open the body of the closure
+ |
+LL | let _ = |A | { B: E| ();
+ | +
error: top-level or-patterns are not allowed in function parameters
--> $DIR/or-patterns-syntactic-fail.rs:18:13
diff --git a/tests/ui/packed/packed-struct-drop-aligned.rs b/tests/ui/packed/packed-struct-drop-aligned.rs
index 9f9f41e25..4fec72763 100644
--- a/tests/ui/packed/packed-struct-drop-aligned.rs
+++ b/tests/ui/packed/packed-struct-drop-aligned.rs
@@ -1,9 +1,9 @@
// run-pass
-#![feature(generators)]
-#![feature(generator_trait)]
+#![feature(coroutines)]
+#![feature(coroutine_trait)]
use std::cell::Cell;
use std::mem;
-use std::ops::Generator;
+use std::ops::Coroutine;
use std::pin::Pin;
struct Aligned<'a> {
@@ -44,7 +44,7 @@ fn main() {
let _ = &p;
p.1 = Aligned { drop_count };
assert_eq!(drop_count.get(), 1);
- // Test that a generator drop function moves a value from a packed
+ // Test that a coroutine drop function moves a value from a packed
// struct to a separate local before dropping it. We move out the
// first field to generate and open drop for the second field.
drop(p.0);
diff --git a/tests/ui/parser/assoc-const-underscore-semantic-fail.rs b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs
index d37ce06c5..d37ce06c5 100644
--- a/tests/ui/parser/assoc-const-underscore-semantic-fail.rs
+++ b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs
diff --git a/tests/ui/parser/assoc-const-underscore-semantic-fail.stderr b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr
index 538bf0ec1..538bf0ec1 100644
--- a/tests/ui/parser/assoc-const-underscore-semantic-fail.stderr
+++ b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr
diff --git a/tests/ui/parser/assoc-const-underscore-syntactic-pass.rs b/tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs
index 60da408c8..60da408c8 100644
--- a/tests/ui/parser/assoc-const-underscore-syntactic-pass.rs
+++ b/tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs
diff --git a/tests/ui/parser/assoc-oddities-1.rs b/tests/ui/parser/assoc/assoc-oddities-1.rs
index 5914805e5..5914805e5 100644
--- a/tests/ui/parser/assoc-oddities-1.rs
+++ b/tests/ui/parser/assoc/assoc-oddities-1.rs
diff --git a/tests/ui/parser/assoc-oddities-1.stderr b/tests/ui/parser/assoc/assoc-oddities-1.stderr
index acf71b489..acf71b489 100644
--- a/tests/ui/parser/assoc-oddities-1.stderr
+++ b/tests/ui/parser/assoc/assoc-oddities-1.stderr
diff --git a/tests/ui/parser/assoc-oddities-2.rs b/tests/ui/parser/assoc/assoc-oddities-2.rs
index 3d35aad74..3d35aad74 100644
--- a/tests/ui/parser/assoc-oddities-2.rs
+++ b/tests/ui/parser/assoc/assoc-oddities-2.rs
diff --git a/tests/ui/parser/assoc-oddities-2.stderr b/tests/ui/parser/assoc/assoc-oddities-2.stderr
index d3b90c34c..d3b90c34c 100644
--- a/tests/ui/parser/assoc-oddities-2.stderr
+++ b/tests/ui/parser/assoc/assoc-oddities-2.stderr
diff --git a/tests/ui/parser/assoc-static-semantic-fail.rs b/tests/ui/parser/assoc/assoc-static-semantic-fail.rs
index 403160f12..403160f12 100644
--- a/tests/ui/parser/assoc-static-semantic-fail.rs
+++ b/tests/ui/parser/assoc/assoc-static-semantic-fail.rs
diff --git a/tests/ui/parser/assoc-static-semantic-fail.stderr b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr
index 8178bd223..8178bd223 100644
--- a/tests/ui/parser/assoc-static-semantic-fail.stderr
+++ b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr
diff --git a/tests/ui/parser/assoc-static-syntactic-fail.rs b/tests/ui/parser/assoc/assoc-static-syntactic-fail.rs
index 492f2ea16..492f2ea16 100644
--- a/tests/ui/parser/assoc-static-syntactic-fail.rs
+++ b/tests/ui/parser/assoc/assoc-static-syntactic-fail.rs
diff --git a/tests/ui/parser/assoc-static-syntactic-fail.stderr b/tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr
index e97236145..e97236145 100644
--- a/tests/ui/parser/assoc-static-syntactic-fail.stderr
+++ b/tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr
diff --git a/tests/ui/parser/assoc-type-in-type-arg.rs b/tests/ui/parser/assoc/assoc-type-in-type-arg.rs
index 000956ea2..000956ea2 100644
--- a/tests/ui/parser/assoc-type-in-type-arg.rs
+++ b/tests/ui/parser/assoc/assoc-type-in-type-arg.rs
diff --git a/tests/ui/parser/assoc-type-in-type-arg.stderr b/tests/ui/parser/assoc/assoc-type-in-type-arg.stderr
index b637702f2..b637702f2 100644
--- a/tests/ui/parser/assoc-type-in-type-arg.stderr
+++ b/tests/ui/parser/assoc/assoc-type-in-type-arg.stderr
diff --git a/tests/ui/parser/associated-types-project-from-hrtb-explicit.rs b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs
index b238a9ca2..b238a9ca2 100644
--- a/tests/ui/parser/associated-types-project-from-hrtb-explicit.rs
+++ b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs
diff --git a/tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr
index aa0fa0e3c..aa0fa0e3c 100644
--- a/tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr
+++ b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr
diff --git a/tests/ui/parser/attr-bad-meta-2.rs b/tests/ui/parser/attribute/attr-bad-meta-2.rs
index db612ed88..db612ed88 100644
--- a/tests/ui/parser/attr-bad-meta-2.rs
+++ b/tests/ui/parser/attribute/attr-bad-meta-2.rs
diff --git a/tests/ui/parser/attr-bad-meta-2.stderr b/tests/ui/parser/attribute/attr-bad-meta-2.stderr
index 6fc6fb665..6fc6fb665 100644
--- a/tests/ui/parser/attr-bad-meta-2.stderr
+++ b/tests/ui/parser/attribute/attr-bad-meta-2.stderr
diff --git a/tests/ui/parser/attr-bad-meta-3.rs b/tests/ui/parser/attribute/attr-bad-meta-3.rs
index b51e9f221..b51e9f221 100644
--- a/tests/ui/parser/attr-bad-meta-3.rs
+++ b/tests/ui/parser/attribute/attr-bad-meta-3.rs
diff --git a/tests/ui/parser/attr-bad-meta-3.stderr b/tests/ui/parser/attribute/attr-bad-meta-3.stderr
index 4fa420c79..4fa420c79 100644
--- a/tests/ui/parser/attr-bad-meta-3.stderr
+++ b/tests/ui/parser/attribute/attr-bad-meta-3.stderr
diff --git a/tests/ui/parser/attr-bad-meta.rs b/tests/ui/parser/attribute/attr-bad-meta.rs
index 8001977f5..8001977f5 100644
--- a/tests/ui/parser/attr-bad-meta.rs
+++ b/tests/ui/parser/attribute/attr-bad-meta.rs
diff --git a/tests/ui/parser/attr-bad-meta.stderr b/tests/ui/parser/attribute/attr-bad-meta.stderr
index 8d65c423c..8d65c423c 100644
--- a/tests/ui/parser/attr-bad-meta.stderr
+++ b/tests/ui/parser/attribute/attr-bad-meta.stderr
diff --git a/tests/ui/parser/attr-before-eof.rs b/tests/ui/parser/attribute/attr-before-eof.rs
index 6af1783e6..6af1783e6 100644
--- a/tests/ui/parser/attr-before-eof.rs
+++ b/tests/ui/parser/attribute/attr-before-eof.rs
diff --git a/tests/ui/parser/attr-before-eof.stderr b/tests/ui/parser/attribute/attr-before-eof.stderr
index a2acb9437..a2acb9437 100644
--- a/tests/ui/parser/attr-before-eof.stderr
+++ b/tests/ui/parser/attribute/attr-before-eof.stderr
diff --git a/tests/ui/parser/attr-dangling-in-fn.rs b/tests/ui/parser/attribute/attr-dangling-in-fn.rs
index c7c45bafb..c7c45bafb 100644
--- a/tests/ui/parser/attr-dangling-in-fn.rs
+++ b/tests/ui/parser/attribute/attr-dangling-in-fn.rs
diff --git a/tests/ui/parser/attr-dangling-in-fn.stderr b/tests/ui/parser/attribute/attr-dangling-in-fn.stderr
index b1bb3ab3b..b1bb3ab3b 100644
--- a/tests/ui/parser/attr-dangling-in-fn.stderr
+++ b/tests/ui/parser/attribute/attr-dangling-in-fn.stderr
diff --git a/tests/ui/parser/attr-dangling-in-mod.rs b/tests/ui/parser/attribute/attr-dangling-in-mod.rs
index 261ed3913..261ed3913 100644
--- a/tests/ui/parser/attr-dangling-in-mod.rs
+++ b/tests/ui/parser/attribute/attr-dangling-in-mod.rs
diff --git a/tests/ui/parser/attr-dangling-in-mod.stderr b/tests/ui/parser/attribute/attr-dangling-in-mod.stderr
index 1c892eac0..1c892eac0 100644
--- a/tests/ui/parser/attr-dangling-in-mod.stderr
+++ b/tests/ui/parser/attribute/attr-dangling-in-mod.stderr
diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.rs b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.rs
index d1950087c..d1950087c 100644
--- a/tests/ui/parser/attr-stmt-expr-attr-bad.rs
+++ b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.rs
diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr
index 96899fd3f..e46c59108 100644
--- a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr
+++ b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr
@@ -27,6 +27,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
= note: outer attributes, like `#[test]`, annotate the item following them
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: expected expression, found `)`
--> $DIR/attr-stmt-expr-attr-bad.rs:7:44
diff --git a/tests/ui/parser/attr-with-a-semicolon.rs b/tests/ui/parser/attribute/attr-with-a-semicolon.rs
index 56fe40b91..56fe40b91 100644
--- a/tests/ui/parser/attr-with-a-semicolon.rs
+++ b/tests/ui/parser/attribute/attr-with-a-semicolon.rs
diff --git a/tests/ui/parser/attr-with-a-semicolon.stderr b/tests/ui/parser/attribute/attr-with-a-semicolon.stderr
index 0de3490b8..0de3490b8 100644
--- a/tests/ui/parser/attr-with-a-semicolon.stderr
+++ b/tests/ui/parser/attribute/attr-with-a-semicolon.stderr
diff --git a/tests/ui/parser/attr.rs b/tests/ui/parser/attribute/attr.rs
index 42b2dfde8..42b2dfde8 100644
--- a/tests/ui/parser/attr.rs
+++ b/tests/ui/parser/attribute/attr.rs
diff --git a/tests/ui/parser/attr.stderr b/tests/ui/parser/attribute/attr.stderr
index 7cd0ac224..7cd0ac224 100644
--- a/tests/ui/parser/attr.stderr
+++ b/tests/ui/parser/attribute/attr.stderr
diff --git a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.rs b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.rs
index c2cc91d8f..c2cc91d8f 100644
--- a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.rs
+++ b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.rs
diff --git a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.stderr b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.stderr
index 4c5964715..4c5964715 100644
--- a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.stderr
+++ b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.stderr
diff --git a/tests/ui/parser/attrs-after-extern-mod.rs b/tests/ui/parser/attribute/attrs-after-extern-mod.rs
index e3f0fa0fc..e3f0fa0fc 100644
--- a/tests/ui/parser/attrs-after-extern-mod.rs
+++ b/tests/ui/parser/attribute/attrs-after-extern-mod.rs
diff --git a/tests/ui/parser/attrs-after-extern-mod.stderr b/tests/ui/parser/attribute/attrs-after-extern-mod.stderr
index 135d98457..135d98457 100644
--- a/tests/ui/parser/attrs-after-extern-mod.stderr
+++ b/tests/ui/parser/attribute/attrs-after-extern-mod.stderr
diff --git a/tests/ui/parser/break-in-unlabeled-block-in-macro.rs b/tests/ui/parser/break-in-unlabeled-block-in-macro.rs
new file mode 100644
index 000000000..eecc0026b
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block-in-macro.rs
@@ -0,0 +1,43 @@
+macro_rules! foo {
+ () => {
+ break (); //~ ERROR `break` outside of a loop or labeled block
+ };
+ ($e: expr) => {
+ break $e; //~ ERROR `break` outside of a loop or labeled block
+ };
+ (stmt $s: stmt) => {
+ $s
+ };
+ (@ $e: expr) => {
+ { break $e; } //~ ERROR `break` outside of a loop or labeled block
+ };
+ (=> $s: stmt) => {
+ { $s }
+ };
+}
+
+fn main() {
+ {
+ foo!();
+ }
+ {
+ foo!(());
+ }
+ {
+ foo!(stmt break ()); //~ ERROR `break` outside of a loop or labeled block
+ }
+ {
+ foo!(@ ());
+ }
+ {
+ foo!(=> break ()); //~ ERROR `break` outside of a loop or labeled block
+ }
+ {
+ macro_rules! bar {
+ () => {
+ break () //~ ERROR `break` outside of a loop or labeled block
+ };
+ }
+ bar!()
+ }
+}
diff --git a/tests/ui/parser/break-in-unlabeled-block-in-macro.stderr b/tests/ui/parser/break-in-unlabeled-block-in-macro.stderr
new file mode 100644
index 000000000..9407e8ac0
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block-in-macro.stderr
@@ -0,0 +1,69 @@
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:3:9
+ |
+LL | break ();
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+...
+LL | foo!();
+ | ------ in this macro invocation
+ |
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:6:9
+ |
+LL | break $e;
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+...
+LL | foo!(());
+ | -------- in this macro invocation
+ |
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:27:19
+ |
+LL | foo!(stmt break ());
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+ |
+help: consider labeling this block to be able to break within it
+ |
+LL ~ 'block: {
+LL ~ foo!(stmt break 'block ());
+ |
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:12:11
+ |
+LL | { break $e; }
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+...
+LL | foo!(@ ());
+ | ---------- in this macro invocation
+ |
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider labeling this block to be able to break within it
+ |
+LL | 'block: { break 'block $e; }
+ | +++++++ ++++++
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:33:17
+ |
+LL | foo!(=> break ());
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block-in-macro.rs:38:17
+ |
+LL | break ()
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+...
+LL | bar!()
+ | ------ in this macro invocation
+ |
+ = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0268`.
diff --git a/tests/ui/parser/break-in-unlabeled-block.fixed b/tests/ui/parser/break-in-unlabeled-block.fixed
new file mode 100644
index 000000000..088562325
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block.fixed
@@ -0,0 +1,11 @@
+// run-rustfix
+fn main() {
+ 'block: {
+ break 'block (); //~ ERROR `break` outside of a loop or labeled block
+ }
+ {
+ 'block: {
+ break 'block (); //~ ERROR `break` outside of a loop or labeled block
+ }
+ }
+}
diff --git a/tests/ui/parser/break-in-unlabeled-block.rs b/tests/ui/parser/break-in-unlabeled-block.rs
new file mode 100644
index 000000000..3e5587e9f
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block.rs
@@ -0,0 +1,11 @@
+// run-rustfix
+fn main() {
+ {
+ break (); //~ ERROR `break` outside of a loop or labeled block
+ }
+ {
+ {
+ break (); //~ ERROR `break` outside of a loop or labeled block
+ }
+ }
+}
diff --git a/tests/ui/parser/break-in-unlabeled-block.stderr b/tests/ui/parser/break-in-unlabeled-block.stderr
new file mode 100644
index 000000000..632cca80d
--- /dev/null
+++ b/tests/ui/parser/break-in-unlabeled-block.stderr
@@ -0,0 +1,27 @@
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block.rs:4:9
+ |
+LL | break ();
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+ |
+help: consider labeling this block to be able to break within it
+ |
+LL ~ 'block: {
+LL ~ break 'block ();
+ |
+
+error[E0268]: `break` outside of a loop or labeled block
+ --> $DIR/break-in-unlabeled-block.rs:8:13
+ |
+LL | break ();
+ | ^^^^^^^^ cannot `break` outside of a loop or labeled block
+ |
+help: consider labeling this block to be able to break within it
+ |
+LL ~ 'block: {
+LL ~ break 'block ();
+ |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0268`.
diff --git a/tests/ui/parser/deep-unmatched-angle-brackets.rs b/tests/ui/parser/deep-unmatched-angle-brackets.rs
new file mode 100644
index 000000000..f8d490e1c
--- /dev/null
+++ b/tests/ui/parser/deep-unmatched-angle-brackets.rs
@@ -0,0 +1,17 @@
+trait Mul<T> {
+ type Output;
+}
+trait Matrix: Mul<<Self as Matrix>::Row, Output = ()> {
+ type Row;
+ type Transpose: Matrix<Row = Self::Row>;
+}
+fn is_mul<S, T: Mul<S, Output = ()>>() {}
+fn f<T: Matrix>() {
+ is_mul::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<
+ f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<
+ f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<
+ f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::
+ <f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<>();
+ //~^ ERROR expected one of `!`, `+`, `,`, `::`, or `>`, found `(`
+}
+fn main() {}
diff --git a/tests/ui/parser/deep-unmatched-angle-brackets.stderr b/tests/ui/parser/deep-unmatched-angle-brackets.stderr
new file mode 100644
index 000000000..1f2850374
--- /dev/null
+++ b/tests/ui/parser/deep-unmatched-angle-brackets.stderr
@@ -0,0 +1,13 @@
+error: expected one of `!`, `+`, `,`, `::`, or `>`, found `(`
+ --> $DIR/deep-unmatched-angle-brackets.rs:14:63
+ |
+LL | <f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<>();
+ | ^ expected one of `!`, `+`, `,`, `::`, or `>`
+ |
+help: you might have meant to end the type parameters here
+ |
+LL | <f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<>>();
+ | +
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs
new file mode 100644
index 000000000..da1774ace
--- /dev/null
+++ b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs
@@ -0,0 +1,9 @@
+macro_rules! foo {
+<<<<<<< HEAD
+ //~^ ERROR encountered diff marker
+ () {
+=======
+ () { //
+>>>>>>> 7a4f13c blah blah blah
+ }
+}
diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr
new file mode 100644
index 000000000..e0b6f1b5e
--- /dev/null
+++ b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr
@@ -0,0 +1,18 @@
+error: encountered diff marker
+ --> $DIR/unclosed-delims-in-macro.rs:2:1
+ |
+LL | <<<<<<< HEAD
+ | ^^^^^^^ after this is the code before the merge
+...
+LL | =======
+ | -------
+LL | () { //
+LL | >>>>>>> 7a4f13c blah blah blah
+ | ^^^^^^^ above this are the incoming code changes
+ |
+ = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
+ = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
+ = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/diff-markers/unclosed-delims.rs b/tests/ui/parser/diff-markers/unclosed-delims.rs
new file mode 100644
index 000000000..653a605c2
--- /dev/null
+++ b/tests/ui/parser/diff-markers/unclosed-delims.rs
@@ -0,0 +1,14 @@
+mod tests {
+ #[test]
+<<<<<<< HEAD
+//~^ ERROR encountered diff marker
+//~| NOTE after this is the code before the merge
+//~| NOTE for an explanation on these markers
+ fn test1() {
+=======
+//~^ NOTE
+ fn test2() {
+>>>>>>> 7a4f13c blah blah blah
+//~^ NOTE above this are the incoming code changes
+ }
+}
diff --git a/tests/ui/parser/diff-markers/unclosed-delims.stderr b/tests/ui/parser/diff-markers/unclosed-delims.stderr
new file mode 100644
index 000000000..67199179b
--- /dev/null
+++ b/tests/ui/parser/diff-markers/unclosed-delims.stderr
@@ -0,0 +1,18 @@
+error: encountered diff marker
+ --> $DIR/unclosed-delims.rs:3:1
+ |
+LL | <<<<<<< HEAD
+ | ^^^^^^^ after this is the code before the merge
+...
+LL | =======
+ | -------
+...
+LL | >>>>>>> 7a4f13c blah blah blah
+ | ^^^^^^^ above this are the incoming code changes
+ |
+ = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
+ = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
+ = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/doc-comment-in-stmt.fixed b/tests/ui/parser/doc-comment-in-stmt.fixed
new file mode 100644
index 000000000..4b3ecccf6
--- /dev/null
+++ b/tests/ui/parser/doc-comment-in-stmt.fixed
@@ -0,0 +1,27 @@
+// run-rustfix
+#![allow(unused)]
+fn foo() -> bool {
+ false
+ // !self.allow_ty_infer()
+ //~^ ERROR found doc comment
+}
+
+fn bar() -> bool {
+ false
+ /* ! bar */ //~ ERROR found doc comment
+}
+
+fn baz() -> i32 {
+ 1 /* * baz */ //~ ERROR found doc comment
+}
+
+fn quux() -> i32 {
+ 2 // / quux
+ //~^ ERROR found doc comment
+}
+
+fn main() {
+ let x = 0;
+ let y = x.max(1) // !foo //~ ERROR found doc comment
+ .min(2);
+}
diff --git a/tests/ui/parser/doc-comment-in-stmt.rs b/tests/ui/parser/doc-comment-in-stmt.rs
index b02df1321..73d08f51c 100644
--- a/tests/ui/parser/doc-comment-in-stmt.rs
+++ b/tests/ui/parser/doc-comment-in-stmt.rs
@@ -1,3 +1,5 @@
+// run-rustfix
+#![allow(unused)]
fn foo() -> bool {
false
//!self.allow_ty_infer()
@@ -14,7 +16,12 @@ fn baz() -> i32 {
}
fn quux() -> i32 {
- 2 /*! quux */ //~ ERROR found doc comment
+ 2 /// quux
+ //~^ ERROR found doc comment
}
-fn main() {}
+fn main() {
+ let x = 0;
+ let y = x.max(1) //!foo //~ ERROR found doc comment
+ .min(2);
+}
diff --git a/tests/ui/parser/doc-comment-in-stmt.stderr b/tests/ui/parser/doc-comment-in-stmt.stderr
index febfb600c..7aefd5c99 100644
--- a/tests/ui/parser/doc-comment-in-stmt.stderr
+++ b/tests/ui/parser/doc-comment-in-stmt.stderr
@@ -1,50 +1,61 @@
error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `//!self.allow_ty_infer()`
- --> $DIR/doc-comment-in-stmt.rs:3:5
+ --> $DIR/doc-comment-in-stmt.rs:5:5
|
LL | false
| - expected one of `.`, `;`, `?`, `}`, or an operator
LL | //!self.allow_ty_infer()
| ^^^^^^^^^^^^^^^^^^^^^^^^ unexpected token
|
-help: add a space before `!` to use a regular comment
+help: add a space before `!` to write a regular comment
|
LL | // !self.allow_ty_infer()
- | ~~~~
+ | +
error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/*! bar */`
- --> $DIR/doc-comment-in-stmt.rs:9:5
+ --> $DIR/doc-comment-in-stmt.rs:11:5
|
LL | false
| - expected one of `.`, `;`, `?`, `}`, or an operator
LL | /*! bar */
| ^^^^^^^^^^ unexpected token
|
-help: add a space before `!` to use a regular comment
+help: add a space before `!` to write a regular comment
|
LL | /* ! bar */
- | ~~~~
+ | +
error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/** baz */`
- --> $DIR/doc-comment-in-stmt.rs:13:7
+ --> $DIR/doc-comment-in-stmt.rs:15:7
|
LL | 1 /** baz */
| ^^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
|
-help: add a space before `*` to use a regular comment
+help: add a space before the last `*` to write a regular comment
|
LL | 1 /* * baz */
- | ~~~~
+ | +
-error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/*! quux */`
- --> $DIR/doc-comment-in-stmt.rs:17:7
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/// quux`
+ --> $DIR/doc-comment-in-stmt.rs:19:7
|
-LL | 2 /*! quux */
- | ^^^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
+LL | 2 /// quux
+ | ^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
|
-help: add a space before `!` to use a regular comment
+help: add a space before the last `/` to write a regular comment
|
-LL | 2 /* ! quux */
- | ~~~~
+LL | 2 // / quux
+ | +
-error: aborting due to 4 previous errors
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found doc comment `//!foo
+ --> $DIR/doc-comment-in-stmt.rs:25:22
+ |
+LL | let y = x.max(1) //!foo
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of `.`, `;`, `?`, `else`, or an operator
+ |
+help: add a space before `!` to write a regular comment
+ |
+LL | let y = x.max(1) // !foo
+ | +
+
+error: aborting due to 5 previous errors
diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr
index e645b68ba..8250dd1ea 100644
--- a/tests/ui/parser/emoji-identifiers.stderr
+++ b/tests/ui/parser/emoji-identifiers.stderr
@@ -75,6 +75,12 @@ LL | 👀::full_of✨()
| |
| function or associated item not found in `👀`
| help: there is an associated function with a similar name: `full_of_✨`
+ |
+note: if you're trying to build a new `👀`, consider using `👀::full_of_✨` which returns `👀`
+ --> $DIR/emoji-identifiers.rs:4:5
+ |
+LL | fn full_of_✨() -> 👀 {
+ | ^^^^^^^^^^^^^^^^^^^^^
error[E0425]: cannot find function `i_like_to_😄_a_lot` in this scope
--> $DIR/emoji-identifiers.rs:13:13
diff --git a/tests/ui/parser/fn-header-semantic-fail.rs b/tests/ui/parser/fn-header-semantic-fail.rs
index 71f18a27e..f8b58cad7 100644
--- a/tests/ui/parser/fn-header-semantic-fail.rs
+++ b/tests/ui/parser/fn-header-semantic-fail.rs
@@ -13,25 +13,23 @@ fn main() {
//~^ ERROR functions cannot be both `const` and `async`
trait X {
- async fn ft1(); //~ ERROR functions in traits cannot be declared `async`
+ async fn ft1(); // OK.
unsafe fn ft2(); // OK.
const fn ft3(); //~ ERROR functions in traits cannot be declared const
extern "C" fn ft4(); // OK.
const async unsafe extern "C" fn ft5();
- //~^ ERROR functions in traits cannot be declared `async`
- //~| ERROR functions in traits cannot be declared const
+ //~^ ERROR functions in traits cannot be declared const
//~| ERROR functions cannot be both `const` and `async`
}
struct Y;
impl X for Y {
- async fn ft1() {} //~ ERROR functions in traits cannot be declared `async`
+ async fn ft1() {} // OK.
unsafe fn ft2() {} // OK.
const fn ft3() {} //~ ERROR functions in traits cannot be declared const
extern "C" fn ft4() {}
const async unsafe extern "C" fn ft5() {}
- //~^ ERROR functions in traits cannot be declared `async`
- //~| ERROR functions in traits cannot be declared const
+ //~^ ERROR functions in traits cannot be declared const
//~| ERROR functions cannot be both `const` and `async`
}
diff --git a/tests/ui/parser/fn-header-semantic-fail.stderr b/tests/ui/parser/fn-header-semantic-fail.stderr
index 7f7b7e835..cdf01e0c5 100644
--- a/tests/ui/parser/fn-header-semantic-fail.stderr
+++ b/tests/ui/parser/fn-header-semantic-fail.stderr
@@ -29,19 +29,19 @@ LL | const async unsafe extern "C" fn ft5();
| `const` because of this
error[E0379]: functions in traits cannot be declared const
- --> $DIR/fn-header-semantic-fail.rs:30:9
+ --> $DIR/fn-header-semantic-fail.rs:29:9
|
LL | const fn ft3() {}
| ^^^^^ functions in traits cannot be const
error[E0379]: functions in traits cannot be declared const
- --> $DIR/fn-header-semantic-fail.rs:32:9
+ --> $DIR/fn-header-semantic-fail.rs:31:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^ functions in traits cannot be const
error: functions cannot be both `const` and `async`
- --> $DIR/fn-header-semantic-fail.rs:32:9
+ --> $DIR/fn-header-semantic-fail.rs:31:9
|
LL | const async unsafe extern "C" fn ft5() {}
| ^^^^^-^^^^^------------------------------
@@ -50,7 +50,7 @@ LL | const async unsafe extern "C" fn ft5() {}
| `const` because of this
error: functions cannot be both `const` and `async`
- --> $DIR/fn-header-semantic-fail.rs:43:9
+ --> $DIR/fn-header-semantic-fail.rs:41:9
|
LL | const async unsafe extern "C" fn fi5() {}
| ^^^^^-^^^^^------------------------------
@@ -59,7 +59,7 @@ LL | const async unsafe extern "C" fn fi5() {}
| `const` because of this
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:48:18
+ --> $DIR/fn-header-semantic-fail.rs:46:18
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -72,7 +72,7 @@ LL | fn fe1();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:49:19
+ --> $DIR/fn-header-semantic-fail.rs:47:19
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -86,7 +86,7 @@ LL | fn fe2();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:50:18
+ --> $DIR/fn-header-semantic-fail.rs:48:18
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -100,7 +100,7 @@ LL | fn fe3();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:51:23
+ --> $DIR/fn-header-semantic-fail.rs:49:23
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -114,7 +114,7 @@ LL | fn fe4();
| ~~
error: functions in `extern` blocks cannot have qualifiers
- --> $DIR/fn-header-semantic-fail.rs:52:42
+ --> $DIR/fn-header-semantic-fail.rs:50:42
|
LL | extern "C" {
| ---------- in this `extern` block
@@ -128,7 +128,7 @@ LL | fn fe5();
| ~~
error: functions cannot be both `const` and `async`
- --> $DIR/fn-header-semantic-fail.rs:52:9
+ --> $DIR/fn-header-semantic-fail.rs:50:9
|
LL | const async unsafe extern "C" fn fe5();
| ^^^^^-^^^^^----------------------------
@@ -136,59 +136,6 @@ LL | const async unsafe extern "C" fn fe5();
| | `async` because of this
| `const` because of this
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:16:9
- |
-LL | async fn ft1();
- | -----^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:20:9
- |
-LL | const async unsafe extern "C" fn ft5();
- | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:28:9
- |
-LL | async fn ft1() {}
- | -----^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/fn-header-semantic-fail.rs:32:9
- |
-LL | const async unsafe extern "C" fn ft5() {}
- | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 18 previous errors
+error: aborting due to 14 previous errors
-Some errors have detailed explanations: E0379, E0706.
-For more information about an error, try `rustc --explain E0379`.
+For more information about this error, try `rustc --explain E0379`.
diff --git a/tests/ui/parser/issue-116781.rs b/tests/ui/parser/issue-116781.rs
new file mode 100644
index 000000000..0e951d2ea
--- /dev/null
+++ b/tests/ui/parser/issue-116781.rs
@@ -0,0 +1,8 @@
+#[derive(Debug)]
+struct Foo {
+ #[cfg(all())]
+ field: fn(($),), //~ ERROR expected pattern, found `$`
+ //~^ ERROR expected pattern, found `$`
+}
+
+fn main() {}
diff --git a/tests/ui/parser/issue-116781.stderr b/tests/ui/parser/issue-116781.stderr
new file mode 100644
index 000000000..1a77b60a5
--- /dev/null
+++ b/tests/ui/parser/issue-116781.stderr
@@ -0,0 +1,16 @@
+error: expected pattern, found `$`
+ --> $DIR/issue-116781.rs:4:16
+ |
+LL | field: fn(($),),
+ | ^ expected pattern
+
+error: expected pattern, found `$`
+ --> $DIR/issue-116781.rs:4:16
+ |
+LL | field: fn(($),),
+ | ^ expected pattern
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issue-100197-mut-let.fixed b/tests/ui/parser/issues/issue-100197-mut-let.fixed
index 5a8956222..5a8956222 100644
--- a/tests/ui/parser/issue-100197-mut-let.fixed
+++ b/tests/ui/parser/issues/issue-100197-mut-let.fixed
diff --git a/tests/ui/parser/issue-100197-mut-let.rs b/tests/ui/parser/issues/issue-100197-mut-let.rs
index 71103813a..71103813a 100644
--- a/tests/ui/parser/issue-100197-mut-let.rs
+++ b/tests/ui/parser/issues/issue-100197-mut-let.rs
diff --git a/tests/ui/parser/issue-100197-mut-let.stderr b/tests/ui/parser/issues/issue-100197-mut-let.stderr
index 86658e4f3..86658e4f3 100644
--- a/tests/ui/parser/issue-100197-mut-let.stderr
+++ b/tests/ui/parser/issues/issue-100197-mut-let.stderr
diff --git a/tests/ui/parser/issue-101477-enum.fixed b/tests/ui/parser/issues/issue-101477-enum.fixed
index 1dfeae22a..1dfeae22a 100644
--- a/tests/ui/parser/issue-101477-enum.fixed
+++ b/tests/ui/parser/issues/issue-101477-enum.fixed
diff --git a/tests/ui/parser/issue-101477-enum.rs b/tests/ui/parser/issues/issue-101477-enum.rs
index ea7051d69..ea7051d69 100644
--- a/tests/ui/parser/issue-101477-enum.rs
+++ b/tests/ui/parser/issues/issue-101477-enum.rs
diff --git a/tests/ui/parser/issue-101477-enum.stderr b/tests/ui/parser/issues/issue-101477-enum.stderr
index 94130671f..94130671f 100644
--- a/tests/ui/parser/issue-101477-enum.stderr
+++ b/tests/ui/parser/issues/issue-101477-enum.stderr
diff --git a/tests/ui/parser/issue-101477-let.fixed b/tests/ui/parser/issues/issue-101477-let.fixed
index 9989ad815..9989ad815 100644
--- a/tests/ui/parser/issue-101477-let.fixed
+++ b/tests/ui/parser/issues/issue-101477-let.fixed
diff --git a/tests/ui/parser/issue-101477-let.rs b/tests/ui/parser/issues/issue-101477-let.rs
index 8b0e8bee1..8b0e8bee1 100644
--- a/tests/ui/parser/issue-101477-let.rs
+++ b/tests/ui/parser/issues/issue-101477-let.rs
diff --git a/tests/ui/parser/issue-101477-let.stderr b/tests/ui/parser/issues/issue-101477-let.stderr
index 1b30d4b17..1b30d4b17 100644
--- a/tests/ui/parser/issue-101477-let.stderr
+++ b/tests/ui/parser/issues/issue-101477-let.stderr
diff --git a/tests/ui/parser/issue-102806.rs b/tests/ui/parser/issues/issue-102806.rs
index ba297bdc9..ba297bdc9 100644
--- a/tests/ui/parser/issue-102806.rs
+++ b/tests/ui/parser/issues/issue-102806.rs
diff --git a/tests/ui/parser/issue-102806.stderr b/tests/ui/parser/issues/issue-102806.stderr
index ba8174a82..ba8174a82 100644
--- a/tests/ui/parser/issue-102806.stderr
+++ b/tests/ui/parser/issues/issue-102806.stderr
diff --git a/tests/ui/parser/issue-103143.rs b/tests/ui/parser/issues/issue-103143.rs
index a584274c4..a584274c4 100644
--- a/tests/ui/parser/issue-103143.rs
+++ b/tests/ui/parser/issues/issue-103143.rs
diff --git a/tests/ui/parser/issue-103143.stderr b/tests/ui/parser/issues/issue-103143.stderr
index 4035c69af..4035c69af 100644
--- a/tests/ui/parser/issue-103143.stderr
+++ b/tests/ui/parser/issues/issue-103143.stderr
diff --git a/tests/ui/parser/issue-103381.fixed b/tests/ui/parser/issues/issue-103381.fixed
index 6a9fb9910..6a9fb9910 100644
--- a/tests/ui/parser/issue-103381.fixed
+++ b/tests/ui/parser/issues/issue-103381.fixed
diff --git a/tests/ui/parser/issue-103381.rs b/tests/ui/parser/issues/issue-103381.rs
index bf79e1010..bf79e1010 100644
--- a/tests/ui/parser/issue-103381.rs
+++ b/tests/ui/parser/issues/issue-103381.rs
diff --git a/tests/ui/parser/issue-103381.stderr b/tests/ui/parser/issues/issue-103381.stderr
index 85fcc18e7..85fcc18e7 100644
--- a/tests/ui/parser/issue-103381.stderr
+++ b/tests/ui/parser/issues/issue-103381.stderr
diff --git a/tests/ui/parser/issue-103425.rs b/tests/ui/parser/issues/issue-103425.rs
index c2f8123ca..c2f8123ca 100644
--- a/tests/ui/parser/issue-103425.rs
+++ b/tests/ui/parser/issues/issue-103425.rs
diff --git a/tests/ui/parser/issue-103425.stderr b/tests/ui/parser/issues/issue-103425.stderr
index 0efe3e3ca..0efe3e3ca 100644
--- a/tests/ui/parser/issue-103425.stderr
+++ b/tests/ui/parser/issues/issue-103425.stderr
diff --git a/tests/ui/parser/issue-103451.rs b/tests/ui/parser/issues/issue-103451.rs
index be33213f3..be33213f3 100644
--- a/tests/ui/parser/issue-103451.rs
+++ b/tests/ui/parser/issues/issue-103451.rs
diff --git a/tests/ui/parser/issue-103451.stderr b/tests/ui/parser/issues/issue-103451.stderr
index 6aacd5012..6aacd5012 100644
--- a/tests/ui/parser/issue-103451.stderr
+++ b/tests/ui/parser/issues/issue-103451.stderr
diff --git a/tests/ui/parser/issue-103748-ICE-wrong-braces.rs b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs
index 8012cb652..8012cb652 100644
--- a/tests/ui/parser/issue-103748-ICE-wrong-braces.rs
+++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs
diff --git a/tests/ui/parser/issue-103748-ICE-wrong-braces.stderr b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr
index b0d8b03ae..b0d8b03ae 100644
--- a/tests/ui/parser/issue-103748-ICE-wrong-braces.stderr
+++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr
diff --git a/tests/ui/parser/issue-104620.rs b/tests/ui/parser/issues/issue-104620.rs
index f49476c44..f49476c44 100644
--- a/tests/ui/parser/issue-104620.rs
+++ b/tests/ui/parser/issues/issue-104620.rs
diff --git a/tests/ui/parser/issue-104620.stderr b/tests/ui/parser/issues/issue-104620.stderr
index d06a6b255..d06a6b255 100644
--- a/tests/ui/parser/issue-104620.stderr
+++ b/tests/ui/parser/issues/issue-104620.stderr
diff --git a/tests/ui/parser/issue-104867-inc-dec-2.rs b/tests/ui/parser/issues/issue-104867-inc-dec-2.rs
index a006421a9..a006421a9 100644
--- a/tests/ui/parser/issue-104867-inc-dec-2.rs
+++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.rs
diff --git a/tests/ui/parser/issue-104867-inc-dec-2.stderr b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr
index 4e2d05468..4e2d05468 100644
--- a/tests/ui/parser/issue-104867-inc-dec-2.stderr
+++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr
diff --git a/tests/ui/parser/issue-104867-inc-dec.rs b/tests/ui/parser/issues/issue-104867-inc-dec.rs
index 760c67b4b..760c67b4b 100644
--- a/tests/ui/parser/issue-104867-inc-dec.rs
+++ b/tests/ui/parser/issues/issue-104867-inc-dec.rs
diff --git a/tests/ui/parser/issue-104867-inc-dec.stderr b/tests/ui/parser/issues/issue-104867-inc-dec.stderr
index 78bfd3e82..78bfd3e82 100644
--- a/tests/ui/parser/issue-104867-inc-dec.stderr
+++ b/tests/ui/parser/issues/issue-104867-inc-dec.stderr
diff --git a/tests/ui/parser/issue-105366.fixed b/tests/ui/parser/issues/issue-105366.fixed
index ad26643c3..ad26643c3 100644
--- a/tests/ui/parser/issue-105366.fixed
+++ b/tests/ui/parser/issues/issue-105366.fixed
diff --git a/tests/ui/parser/issue-105366.rs b/tests/ui/parser/issues/issue-105366.rs
index 311b6a60f..311b6a60f 100644
--- a/tests/ui/parser/issue-105366.rs
+++ b/tests/ui/parser/issues/issue-105366.rs
diff --git a/tests/ui/parser/issue-105366.stderr b/tests/ui/parser/issues/issue-105366.stderr
index 0a7408e2c..0a7408e2c 100644
--- a/tests/ui/parser/issue-105366.stderr
+++ b/tests/ui/parser/issues/issue-105366.stderr
diff --git a/tests/ui/parser/issue-105634.rs b/tests/ui/parser/issues/issue-105634.rs
index 579aa6e5b..579aa6e5b 100644
--- a/tests/ui/parser/issue-105634.rs
+++ b/tests/ui/parser/issues/issue-105634.rs
diff --git a/tests/ui/parser/issue-107705.rs b/tests/ui/parser/issues/issue-107705.rs
index b80984fcd..b80984fcd 100644
--- a/tests/ui/parser/issue-107705.rs
+++ b/tests/ui/parser/issues/issue-107705.rs
diff --git a/tests/ui/parser/issue-107705.stderr b/tests/ui/parser/issues/issue-107705.stderr
index d2d613461..d2d613461 100644
--- a/tests/ui/parser/issue-107705.stderr
+++ b/tests/ui/parser/issues/issue-107705.stderr
diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed b/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed
new file mode 100644
index 000000000..b819aa810
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed
@@ -0,0 +1,9 @@
+// run-rustfix
+
+pub fn missing() -> () {}
+//~^ ERROR missing parameters for function definition
+
+pub fn missing2() {}
+//~^ ERROR missing parameters for function definition
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.rs b/tests/ui/parser/issues/issue-108109-fn-missing-params.rs
new file mode 100644
index 000000000..01efe7280
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.rs
@@ -0,0 +1,9 @@
+// run-rustfix
+
+pub fn missing -> () {}
+//~^ ERROR missing parameters for function definition
+
+pub fn missing2 {}
+//~^ ERROR missing parameters for function definition
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr
new file mode 100644
index 000000000..86d3449cc
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr
@@ -0,0 +1,14 @@
+error: missing parameters for function definition
+ --> $DIR/issue-108109-fn-missing-params.rs:3:15
+ |
+LL | pub fn missing -> () {}
+ | ^ help: add a parameter list
+
+error: missing parameters for function definition
+ --> $DIR/issue-108109-fn-missing-params.rs:6:16
+ |
+LL | pub fn missing2 {}
+ | ^ help: add a parameter list
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed
new file mode 100644
index 000000000..eaae28886
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed
@@ -0,0 +1,8 @@
+// run-rustfix
+
+pub fn func<F>() where F: FnOnce() -> () {}
+//~^ ERROR expected one of
+//~| NOTE expected one of
+//~| NOTE `Fn` bounds require arguments in parentheses
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs
new file mode 100644
index 000000000..ea5c71150
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs
@@ -0,0 +1,8 @@
+// run-rustfix
+
+pub fn func<F>() where F: FnOnce -> () {}
+//~^ ERROR expected one of
+//~| NOTE expected one of
+//~| NOTE `Fn` bounds require arguments in parentheses
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr
new file mode 100644
index 000000000..7cda66757
--- /dev/null
+++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr
@@ -0,0 +1,11 @@
+error: expected one of `(`, `+`, `,`, `::`, `<`, or `{`, found `->`
+ --> $DIR/issue-108109-fn-trait-missing-paren.rs:3:34
+ |
+LL | pub fn func<F>() where F: FnOnce -> () {}
+ | -------^^ expected one of `(`, `+`, `,`, `::`, `<`, or `{`
+ | | |
+ | | help: try adding parentheses
+ | `Fn` bounds require arguments in parentheses
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issue-108495-dec.rs b/tests/ui/parser/issues/issue-108495-dec.rs
index e0816f84e..e0816f84e 100644
--- a/tests/ui/parser/issue-108495-dec.rs
+++ b/tests/ui/parser/issues/issue-108495-dec.rs
diff --git a/tests/ui/parser/issue-108495-dec.stderr b/tests/ui/parser/issues/issue-108495-dec.stderr
index 85b29038f..85b29038f 100644
--- a/tests/ui/parser/issue-108495-dec.stderr
+++ b/tests/ui/parser/issues/issue-108495-dec.stderr
diff --git a/tests/ui/parser/issue-112188.fixed b/tests/ui/parser/issues/issue-112188.fixed
index 5e73d8e38..5e73d8e38 100644
--- a/tests/ui/parser/issue-112188.fixed
+++ b/tests/ui/parser/issues/issue-112188.fixed
diff --git a/tests/ui/parser/issue-112188.rs b/tests/ui/parser/issues/issue-112188.rs
index 27ca192e5..27ca192e5 100644
--- a/tests/ui/parser/issue-112188.rs
+++ b/tests/ui/parser/issues/issue-112188.rs
diff --git a/tests/ui/parser/issue-112188.stderr b/tests/ui/parser/issues/issue-112188.stderr
index 6d2d8e6a3..6d2d8e6a3 100644
--- a/tests/ui/parser/issue-112188.stderr
+++ b/tests/ui/parser/issues/issue-112188.stderr
diff --git a/tests/ui/parser/issue-113342.rs b/tests/ui/parser/issues/issue-113342.rs
index 18b502736..18b502736 100644
--- a/tests/ui/parser/issue-113342.rs
+++ b/tests/ui/parser/issues/issue-113342.rs
diff --git a/tests/ui/parser/issue-113342.stderr b/tests/ui/parser/issues/issue-113342.stderr
index a0c5e665f..a0c5e665f 100644
--- a/tests/ui/parser/issue-113342.stderr
+++ b/tests/ui/parser/issues/issue-113342.stderr
diff --git a/tests/ui/parser/issues/issue-15980.rs b/tests/ui/parser/issues/issue-15980.rs
index 87faa7d5f..eb7b6ca82 100644
--- a/tests/ui/parser/issues/issue-15980.rs
+++ b/tests/ui/parser/issues/issue-15980.rs
@@ -9,9 +9,6 @@ fn main(){
//~^ ERROR expected identifier, found keyword `return`
//~| NOTE expected identifier, found keyword
}
- //~^ NOTE expected one of `.`, `=>`, `?`, or an operator
_ => {}
- //~^ ERROR expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
- //~| NOTE unexpected token
}
}
diff --git a/tests/ui/parser/issues/issue-15980.stderr b/tests/ui/parser/issues/issue-15980.stderr
index c59c81119..cf8d01147 100644
--- a/tests/ui/parser/issues/issue-15980.stderr
+++ b/tests/ui/parser/issues/issue-15980.stderr
@@ -11,15 +11,10 @@ help: escape `return` to use it as an identifier
|
LL | r#return
| ++
-
-error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
- --> $DIR/issue-15980.rs:13:9
+help: you might have meant to start a match arm after the match guard
|
-LL | }
- | - expected one of `.`, `=>`, `?`, or an operator
-LL |
-LL | _ => {}
- | ^ unexpected token
+LL | Err(ref e) if e.kind == io::EndOfFile => {
+ | ++
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/parser/issue-17718-parse-const.rs b/tests/ui/parser/issues/issue-17718-parse-const.rs
index d5a5f445d..d5a5f445d 100644
--- a/tests/ui/parser/issue-17718-parse-const.rs
+++ b/tests/ui/parser/issues/issue-17718-parse-const.rs
diff --git a/tests/ui/parser/issues/issue-32505.rs b/tests/ui/parser/issues/issue-32505.rs
index f31c00e5c..d95e7dc7d 100644
--- a/tests/ui/parser/issues/issue-32505.rs
+++ b/tests/ui/parser/issues/issue-32505.rs
@@ -1,5 +1,6 @@
pub fn test() {
foo(|_|) //~ ERROR expected expression, found `)`
+ //~^ ERROR cannot find function `foo` in this scope
}
fn main() { }
diff --git a/tests/ui/parser/issues/issue-32505.stderr b/tests/ui/parser/issues/issue-32505.stderr
index cdd779a93..27ad2c3e5 100644
--- a/tests/ui/parser/issues/issue-32505.stderr
+++ b/tests/ui/parser/issues/issue-32505.stderr
@@ -2,7 +2,21 @@ error: expected expression, found `)`
--> $DIR/issue-32505.rs:2:12
|
LL | foo(|_|)
- | ^ expected expression
+ | ---^ expected expression
+ | |
+ | while parsing the body of this closure
+ |
+help: you might have meant to open the body of the closure
+ |
+LL | foo(|_| {})
+ | ++
+
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/issue-32505.rs:2:5
+ |
+LL | foo(|_|)
+ | ^^^ not found in this scope
-error: aborting due to previous error
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/parser/issue-39616.rs b/tests/ui/parser/issues/issue-39616.rs
index 46b5aa334..46b5aa334 100644
--- a/tests/ui/parser/issue-39616.rs
+++ b/tests/ui/parser/issues/issue-39616.rs
diff --git a/tests/ui/parser/issue-39616.stderr b/tests/ui/parser/issues/issue-39616.stderr
index 393d1f2e2..393d1f2e2 100644
--- a/tests/ui/parser/issue-39616.stderr
+++ b/tests/ui/parser/issues/issue-39616.stderr
diff --git a/tests/ui/parser/issue-49257.rs b/tests/ui/parser/issues/issue-49257.rs
index a7fa19d52..a7fa19d52 100644
--- a/tests/ui/parser/issue-49257.rs
+++ b/tests/ui/parser/issues/issue-49257.rs
diff --git a/tests/ui/parser/issue-49257.stderr b/tests/ui/parser/issues/issue-49257.stderr
index 97e16f88b..97e16f88b 100644
--- a/tests/ui/parser/issue-49257.stderr
+++ b/tests/ui/parser/issues/issue-49257.stderr
diff --git a/tests/ui/parser/issues/issue-52496.stderr b/tests/ui/parser/issues/issue-52496.stderr
index 77335c64c..78c81bf5b 100644
--- a/tests/ui/parser/issues/issue-52496.stderr
+++ b/tests/ui/parser/issues/issue-52496.stderr
@@ -8,10 +8,15 @@ error: expected one of `,`, `:`, or `}`, found `.`
--> $DIR/issue-52496.rs:8:22
|
LL | let _ = Foo { bar.into(), bat: -1, . };
- | --- - ^ expected one of `,`, `:`, or `}`
+ | --- ---^ expected one of `,`, `:`, or `}`
| | |
- | | help: try naming a field: `bar:`
+ | | while parsing this struct field
| while parsing this struct
+ |
+help: try naming a field
+ |
+LL | let _ = Foo { bar: bar.into(), bat: -1, . };
+ | ++++
error: expected identifier, found `.`
--> $DIR/issue-52496.rs:8:40
diff --git a/tests/ui/parser/issue-61858.rs b/tests/ui/parser/issues/issue-61858.rs
index 6c3b56586..6c3b56586 100644
--- a/tests/ui/parser/issue-61858.rs
+++ b/tests/ui/parser/issues/issue-61858.rs
diff --git a/tests/ui/parser/issue-61858.stderr b/tests/ui/parser/issues/issue-61858.stderr
index 03f51c6e3..03f51c6e3 100644
--- a/tests/ui/parser/issue-61858.stderr
+++ b/tests/ui/parser/issues/issue-61858.stderr
diff --git a/tests/ui/parser/issue-68091-unicode-ident-after-if.rs b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs
index 57d36feb3..57d36feb3 100644
--- a/tests/ui/parser/issue-68091-unicode-ident-after-if.rs
+++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs
diff --git a/tests/ui/parser/issue-68091-unicode-ident-after-if.stderr b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr
index 6674b924e..6674b924e 100644
--- a/tests/ui/parser/issue-68091-unicode-ident-after-if.stderr
+++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr
diff --git a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs
index 1a90b4724..1a90b4724 100644
--- a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs
+++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs
diff --git a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr
index 0b9c364f1..0b9c364f1 100644
--- a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr
+++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs
index 30e7ef467..30e7ef467 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-1.rs
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr
index 2d873b461..2d873b461 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-1.stderr
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs
index 89aaa68ba..89aaa68ba 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-2.rs
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr
index 0ecb748a0..0ecb748a0 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-2.stderr
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs
index e98df8d7c..e98df8d7c 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-3.rs
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs
diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr
index dfc4407ed..dfc4407ed 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue-3.stderr
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr
diff --git a/tests/ui/parser/issue-68987-unmatch-issue.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue.rs
index 5a3620bf2..5a3620bf2 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue.rs
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue.rs
diff --git a/tests/ui/parser/issue-68987-unmatch-issue.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue.stderr
index cabd13324..cabd13324 100644
--- a/tests/ui/parser/issue-68987-unmatch-issue.stderr
+++ b/tests/ui/parser/issues/issue-68987-unmatch-issue.stderr
diff --git a/tests/ui/parser/issue-81804.rs b/tests/ui/parser/issues/issue-81804.rs
index ebc4752a1..ebc4752a1 100644
--- a/tests/ui/parser/issue-81804.rs
+++ b/tests/ui/parser/issues/issue-81804.rs
diff --git a/tests/ui/parser/issue-81804.stderr b/tests/ui/parser/issues/issue-81804.stderr
index de3b33ecd..de3b33ecd 100644
--- a/tests/ui/parser/issue-81804.stderr
+++ b/tests/ui/parser/issues/issue-81804.stderr
diff --git a/tests/ui/parser/issue-81827.rs b/tests/ui/parser/issues/issue-81827.rs
index 91defd12a..91defd12a 100644
--- a/tests/ui/parser/issue-81827.rs
+++ b/tests/ui/parser/issues/issue-81827.rs
diff --git a/tests/ui/parser/issue-81827.stderr b/tests/ui/parser/issues/issue-81827.stderr
index 63d135f73..63d135f73 100644
--- a/tests/ui/parser/issue-81827.stderr
+++ b/tests/ui/parser/issues/issue-81827.stderr
diff --git a/tests/ui/parser/issues/issue-84117.stderr b/tests/ui/parser/issues/issue-84117.stderr
index 237bc11bd..958f3b40b 100644
--- a/tests/ui/parser/issues/issue-84117.stderr
+++ b/tests/ui/parser/issues/issue-84117.stderr
@@ -47,6 +47,7 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
| |
| while parsing the type for `inner_local`
|
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: you might have meant to end the type parameters here
|
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str>, }
@@ -61,6 +62,8 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, fo
|
LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }
| ^ expected one of 8 possible tokens
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,`
--> $DIR/issue-84117.rs:2:33
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
index df0cd5439..099178a7d 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs
@@ -7,3 +7,8 @@ const async const fn test() {}
//~| NOTE expected one of `extern`, `fn`, or `unsafe`
//~| HELP `const` already used earlier, remove this one
//~| NOTE `const` first seen here
+//~| ERROR functions cannot be both `const` and `async`
+//~| NOTE `const` because of this
+//~| NOTE `async` because of this
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
index 977c6ebfe..4c55179ce 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr
@@ -13,5 +13,14 @@ note: `const` first seen here
LL | const async const fn test() {}
| ^^^^^
-error: aborting due to previous error
+error: functions cannot be both `const` and `async`
+ --> $DIR/const-async-const.rs:5:1
+ |
+LL | const async const fn test() {}
+ | ^^^^^-^^^^^-------------------
+ | | |
+ | | `async` because of this
+ | `const` because of this
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs
new file mode 100644
index 000000000..9d7fe4389
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs
@@ -0,0 +1,22 @@
+// test for #115714
+
+struct Misplaced;
+
+impl Misplaced {
+ unsafe const fn from_u32(val: u32) {}
+ //~^ ERROR expected one of `extern` or `fn`
+ fn oof(self){}
+}
+
+struct Duplicated;
+
+impl Duplicated {
+ unsafe unsafe fn from_u32(val: u32) {}
+ //~^ ERROR expected one of `extern` or `fn`
+ fn oof(self){}
+}
+
+fn main() {
+ Misplaced.oof();
+ Duplicated.oof();
+}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr
new file mode 100644
index 000000000..3f504a9eb
--- /dev/null
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr
@@ -0,0 +1,28 @@
+error: expected one of `extern` or `fn`, found keyword `const`
+ --> $DIR/recovery.rs:6:12
+ |
+LL | unsafe const fn from_u32(val: u32) {}
+ | -------^^^^^
+ | | |
+ | | expected one of `extern` or `fn`
+ | help: `const` must come before `unsafe`: `const unsafe`
+ |
+ = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+error: expected one of `extern` or `fn`, found keyword `unsafe`
+ --> $DIR/recovery.rs:14:12
+ |
+LL | unsafe unsafe fn from_u32(val: u32) {}
+ | ^^^^^^
+ | |
+ | expected one of `extern` or `fn`
+ | help: `unsafe` already used earlier, remove this one
+ |
+note: `unsafe` first seen here
+ --> $DIR/recovery.rs:14:5
+ |
+LL | unsafe unsafe fn from_u32(val: u32) {}
+ | ^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
index bbebc99e9..479426626 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs
@@ -12,3 +12,8 @@ async unsafe const fn test() {}
//~| HELP `const` must come before `async unsafe`
//~| SUGGESTION const async unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+//~| ERROR functions cannot be both `const` and `async`
+//~| NOTE `const` because of this
+//~| NOTE `async` because of this
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
index f455caba1..489e8eefb 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr
@@ -9,5 +9,14 @@ LL | async unsafe const fn test() {}
|
= note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
-error: aborting due to previous error
+error: functions cannot be both `const` and `async`
+ --> $DIR/several-kw-jump.rs:9:1
+ |
+LL | async unsafe const fn test() {}
+ | ^^^^^--------^^^^^-------------
+ | | |
+ | | `const` because of this
+ | `async` because of this
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
index 4ff4cf5c8..867f71c12 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs
@@ -12,3 +12,5 @@ unsafe async fn test() {}
//~| HELP `async` must come before `unsafe`
//~| SUGGESTION async unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
index 2f5fbc513..9a7f28210 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs
@@ -12,3 +12,5 @@ unsafe const fn test() {}
//~| HELP `const` must come before `unsafe`
//~| SUGGESTION const unsafe
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+fn main() {}
diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
index df2412e3e..8305ff4f6 100644
--- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
+++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs
@@ -12,3 +12,5 @@ extern unsafe fn test() {}
//~| HELP `unsafe` must come before `extern`
//~| SUGGESTION unsafe extern
//~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`
+
+fn main() {}
diff --git a/tests/ui/parser/issue-87694-duplicated-pub.rs b/tests/ui/parser/issues/issue-87694-duplicated-pub.rs
index e3ea61dc4..e3ea61dc4 100644
--- a/tests/ui/parser/issue-87694-duplicated-pub.rs
+++ b/tests/ui/parser/issues/issue-87694-duplicated-pub.rs
diff --git a/tests/ui/parser/issue-87694-duplicated-pub.stderr b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr
index 8d242bc9d..8d242bc9d 100644
--- a/tests/ui/parser/issue-87694-duplicated-pub.stderr
+++ b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr
diff --git a/tests/ui/parser/issue-87694-misplaced-pub.rs b/tests/ui/parser/issues/issue-87694-misplaced-pub.rs
index 3f824617c..3f824617c 100644
--- a/tests/ui/parser/issue-87694-misplaced-pub.rs
+++ b/tests/ui/parser/issues/issue-87694-misplaced-pub.rs
diff --git a/tests/ui/parser/issue-87694-misplaced-pub.stderr b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr
index 94c6a29ef..94c6a29ef 100644
--- a/tests/ui/parser/issue-87694-misplaced-pub.stderr
+++ b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr
diff --git a/tests/ui/parser/issues/issue-89396.fixed b/tests/ui/parser/issues/issue-89396.fixed
index 823ad8cd1..0c040ddea 100644
--- a/tests/ui/parser/issues/issue-89396.fixed
+++ b/tests/ui/parser/issues/issue-89396.fixed
@@ -8,9 +8,9 @@ fn main() {
let _ = match opt {
Some(_) => true,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
None => false,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
};
}
diff --git a/tests/ui/parser/issues/issue-89396.rs b/tests/ui/parser/issues/issue-89396.rs
index f1d9efa52..d95f666d7 100644
--- a/tests/ui/parser/issues/issue-89396.rs
+++ b/tests/ui/parser/issues/issue-89396.rs
@@ -8,9 +8,9 @@ fn main() {
let _ = match opt {
Some(_) = true,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
None -> false,
//~^ ERROR: expected one of
- //~| HELP: try using a fat arrow here
+ //~| HELP: use a fat arrow to start a match arm
};
}
diff --git a/tests/ui/parser/issues/issue-89396.stderr b/tests/ui/parser/issues/issue-89396.stderr
index 504420574..41ce07050 100644
--- a/tests/ui/parser/issues/issue-89396.stderr
+++ b/tests/ui/parser/issues/issue-89396.stderr
@@ -5,7 +5,7 @@ LL | Some(_) = true,
| ^
| |
| expected one of `=>`, `if`, or `|`
- | help: try using a fat arrow here: `=>`
+ | help: use a fat arrow to start a match arm: `=>`
error: expected one of `=>`, `@`, `if`, or `|`, found `->`
--> $DIR/issue-89396.rs:12:14
@@ -14,7 +14,7 @@ LL | None -> false,
| ^^
| |
| expected one of `=>`, `@`, `if`, or `|`
- | help: try using a fat arrow here: `=>`
+ | help: use a fat arrow to start a match arm: `=>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/issue-90728.rs b/tests/ui/parser/issues/issue-90728.rs
index d6a898361..d6a898361 100644
--- a/tests/ui/parser/issue-90728.rs
+++ b/tests/ui/parser/issues/issue-90728.rs
diff --git a/tests/ui/parser/issue-90728.stderr b/tests/ui/parser/issues/issue-90728.stderr
index b55c46030..b55c46030 100644
--- a/tests/ui/parser/issue-90728.stderr
+++ b/tests/ui/parser/issues/issue-90728.stderr
diff --git a/tests/ui/parser/issue-91421.rs b/tests/ui/parser/issues/issue-91421.rs
index 8bba27f37..8bba27f37 100644
--- a/tests/ui/parser/issue-91421.rs
+++ b/tests/ui/parser/issues/issue-91421.rs
diff --git a/tests/ui/parser/issue-91421.stderr b/tests/ui/parser/issues/issue-91421.stderr
index 2d9652051..2d9652051 100644
--- a/tests/ui/parser/issue-91421.stderr
+++ b/tests/ui/parser/issues/issue-91421.stderr
diff --git a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.fixed b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed
index 4b4a416b1..4b4a416b1 100644
--- a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.fixed
+++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed
diff --git a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.rs b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs
index 9cc886641..9cc886641 100644
--- a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.rs
+++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs
diff --git a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr
index edc640bf5..edc640bf5 100644
--- a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.stderr
+++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr
diff --git a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.fixed b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed
index 64ab6f62b..64ab6f62b 100644
--- a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.fixed
+++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed
diff --git a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.rs b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs
index 50520971f..50520971f 100644
--- a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.rs
+++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs
diff --git a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr
index 72377fc37..72377fc37 100644
--- a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.stderr
+++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr
diff --git a/tests/ui/parser/macro/macro-repeat.stderr b/tests/ui/parser/macro/macro-repeat.stderr
index 63554b197..ade2bbf9b 100644
--- a/tests/ui/parser/macro/macro-repeat.stderr
+++ b/tests/ui/parser/macro/macro-repeat.stderr
@@ -9,6 +9,8 @@ error: variable 'v' is still repeating at this depth
|
LL | $v
| ^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/missing-fat-arrow.rs b/tests/ui/parser/missing-fat-arrow.rs
new file mode 100644
index 000000000..325f1ccf2
--- /dev/null
+++ b/tests/ui/parser/missing-fat-arrow.rs
@@ -0,0 +1,38 @@
+fn main() {
+ let x = 1;
+ let y = 2;
+ let value = 3;
+
+ match value {
+ Some(x) if x == y {
+ self.next_token()?; //~ ERROR expected identifier, found keyword `self`
+ },
+ _ => {}
+ }
+ let _: i32 = (); //~ ERROR mismatched types
+}
+
+struct Foo {
+ value: usize
+}
+
+fn foo(a: Option<&mut Foo>, b: usize) {
+ match a {
+ Some(a) if a.value == b {
+ a.value = 1; //~ ERROR expected one of `,`, `:`, or `}`, found `.`
+ },
+ _ => {}
+ }
+ let _: i32 = (); //~ ERROR mismatched types
+}
+
+fn bar(a: Option<&mut Foo>, b: usize) {
+ match a {
+ Some(a) if a.value == b {
+ a.value, //~ ERROR expected one of `,`, `:`, or `}`, found `.`
+ } => {
+ }
+ _ => {}
+ }
+ let _: i32 = (); //~ ERROR mismatched types
+}
diff --git a/tests/ui/parser/missing-fat-arrow.stderr b/tests/ui/parser/missing-fat-arrow.stderr
new file mode 100644
index 000000000..a6c786905
--- /dev/null
+++ b/tests/ui/parser/missing-fat-arrow.stderr
@@ -0,0 +1,78 @@
+error: expected identifier, found keyword `self`
+ --> $DIR/missing-fat-arrow.rs:8:13
+ |
+LL | Some(x) if x == y {
+ | - while parsing this struct
+LL | self.next_token()?;
+ | ^^^^ expected identifier, found keyword
+ |
+help: you might have meant to start a match arm after the match guard
+ |
+LL | Some(x) if x == y => {
+ | ++
+
+error: expected one of `,`, `:`, or `}`, found `.`
+ --> $DIR/missing-fat-arrow.rs:22:14
+ |
+LL | Some(a) if a.value == b {
+ | - while parsing this struct
+LL | a.value = 1;
+ | -^ expected one of `,`, `:`, or `}`
+ | |
+ | while parsing this struct field
+ |
+help: try naming a field
+ |
+LL | a: a.value = 1;
+ | ++
+help: you might have meant to start a match arm after the match guard
+ |
+LL | Some(a) if a.value == b => {
+ | ++
+
+error: expected one of `,`, `:`, or `}`, found `.`
+ --> $DIR/missing-fat-arrow.rs:32:14
+ |
+LL | Some(a) if a.value == b {
+ | - while parsing this struct
+LL | a.value,
+ | -^ expected one of `,`, `:`, or `}`
+ | |
+ | while parsing this struct field
+ |
+help: try naming a field
+ |
+LL | a: a.value,
+ | ++
+help: you might have meant to start a match arm after the match guard
+ |
+LL | Some(a) if a.value == b => {
+ | ++
+
+error[E0308]: mismatched types
+ --> $DIR/missing-fat-arrow.rs:12:18
+ |
+LL | let _: i32 = ();
+ | --- ^^ expected `i32`, found `()`
+ | |
+ | expected due to this
+
+error[E0308]: mismatched types
+ --> $DIR/missing-fat-arrow.rs:26:18
+ |
+LL | let _: i32 = ();
+ | --- ^^ expected `i32`, found `()`
+ | |
+ | expected due to this
+
+error[E0308]: mismatched types
+ --> $DIR/missing-fat-arrow.rs:37:18
+ |
+LL | let _: i32 = ();
+ | --- ^^ expected `i32`, found `()`
+ | |
+ | expected due to this
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/parser/mod_file_not_exist.stderr b/tests/ui/parser/mod_file_not_exist.stderr
index 62456d518..c2f9d30d9 100644
--- a/tests/ui/parser/mod_file_not_exist.stderr
+++ b/tests/ui/parser/mod_file_not_exist.stderr
@@ -5,6 +5,7 @@ LL | mod not_a_real_file;
| ^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs"
+ = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead
error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
--> $DIR/mod_file_not_exist.rs:7:16
diff --git a/tests/ui/parser/mod_file_not_exist_windows.stderr b/tests/ui/parser/mod_file_not_exist_windows.stderr
index d5143dbe9..53b09d8ca 100644
--- a/tests/ui/parser/mod_file_not_exist_windows.stderr
+++ b/tests/ui/parser/mod_file_not_exist_windows.stderr
@@ -5,6 +5,7 @@ LL | mod not_a_real_file;
| ^^^^^^^^^^^^^^^^^^^^
|
= help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs"
+ = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead
error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux`
--> $DIR/mod_file_not_exist_windows.rs:7:16
diff --git a/tests/ui/parser/recover-missing-semi-before-item.fixed b/tests/ui/parser/recover-missing-semi-before-item.fixed
index 0be17e69e..acb846373 100644
--- a/tests/ui/parser/recover-missing-semi-before-item.fixed
+++ b/tests/ui/parser/recover-missing-semi-before-item.fixed
@@ -1,6 +1,6 @@
// run-rustfix
-#![allow(unused_variables, dead_code)]
+#![allow(unused_variables, dead_code, unused_imports)]
fn for_struct() {
let foo = 3; //~ ERROR expected `;`, found keyword `struct`
diff --git a/tests/ui/parser/recover-missing-semi-before-item.rs b/tests/ui/parser/recover-missing-semi-before-item.rs
index 867b7b749..ef6cfe3c4 100644
--- a/tests/ui/parser/recover-missing-semi-before-item.rs
+++ b/tests/ui/parser/recover-missing-semi-before-item.rs
@@ -1,6 +1,6 @@
// run-rustfix
-#![allow(unused_variables, dead_code)]
+#![allow(unused_variables, dead_code, unused_imports)]
fn for_struct() {
let foo = 3 //~ ERROR expected `;`, found keyword `struct`
diff --git a/tests/ui/parser/recover-quantified-closure.stderr b/tests/ui/parser/recover-quantified-closure.stderr
index 39eec80f6..37e93cbee 100644
--- a/tests/ui/parser/recover-quantified-closure.stderr
+++ b/tests/ui/parser/recover-quantified-closure.stderr
@@ -25,10 +25,10 @@ LL | for <Foo>::Bar in x {}
= help: consider removing `for<...>`
error: implicit types in closure signatures are forbidden when `for<...>` is present
- --> $DIR/recover-quantified-closure.rs:2:25
+ --> $DIR/recover-quantified-closure.rs:2:24
|
LL | for<'a> |x: &'a u8| *x + 1;
- | ------- ^
+ | ------- ^
| |
| `for<...>` is here
diff --git a/tests/ui/parser/removed-syntax-fn-sigil.rs b/tests/ui/parser/removed-syntax-fn-sigil.rs
index 725843429..d55a032d1 100644
--- a/tests/ui/parser/removed-syntax-fn-sigil.rs
+++ b/tests/ui/parser/removed-syntax-fn-sigil.rs
@@ -1,3 +1,4 @@
fn main() {
- let x: fn~() = || (); //~ ERROR expected `(`, found `~`
+ let x: fn~() = || (); //~ ERROR missing parameters for function definition
+ //~| ERROR expected one of `->`, `;`, or `=`, found `~`
}
diff --git a/tests/ui/parser/removed-syntax-fn-sigil.stderr b/tests/ui/parser/removed-syntax-fn-sigil.stderr
index 196a5af47..0d3774167 100644
--- a/tests/ui/parser/removed-syntax-fn-sigil.stderr
+++ b/tests/ui/parser/removed-syntax-fn-sigil.stderr
@@ -1,10 +1,14 @@
-error: expected `(`, found `~`
+error: missing parameters for function definition
--> $DIR/removed-syntax-fn-sigil.rs:2:14
|
LL | let x: fn~() = || ();
- | - ^ expected `(`
- | |
- | while parsing the type for `x`
+ | ^ help: add a parameter list
-error: aborting due to previous error
+error: expected one of `->`, `;`, or `=`, found `~`
+ --> $DIR/removed-syntax-fn-sigil.rs:2:14
+ |
+LL | let x: fn~() = || ();
+ | ^ expected one of `->`, `;`, or `=`
+
+error: aborting due to 2 previous errors
diff --git a/tests/ui/parser/removed-syntax-with-2.stderr b/tests/ui/parser/removed-syntax-with-2.stderr
index c6ae1ce67..e75c5bcd6 100644
--- a/tests/ui/parser/removed-syntax-with-2.stderr
+++ b/tests/ui/parser/removed-syntax-with-2.stderr
@@ -2,8 +2,9 @@ error: expected one of `,`, `:`, or `}`, found `a`
--> $DIR/removed-syntax-with-2.rs:8:31
|
LL | let b = S { foo: (), with a };
- | - ^ expected one of `,`, `:`, or `}`
- | |
+ | - ---- ^ expected one of `,`, `:`, or `}`
+ | | |
+ | | while parsing this struct field
| while parsing this struct
error[E0063]: missing field `bar` in initializer of `S`
diff --git a/tests/ui/parser/semi-in-let-chain.rs b/tests/ui/parser/semi-in-let-chain.rs
new file mode 100644
index 000000000..9c21af037
--- /dev/null
+++ b/tests/ui/parser/semi-in-let-chain.rs
@@ -0,0 +1,27 @@
+// Issue #117720
+
+#![feature(let_chains)]
+
+fn main() {
+ if let () = ()
+ && let () = (); //~ERROR
+ && let () = ()
+ {
+ }
+}
+
+fn foo() {
+ if let () = ()
+ && () == (); //~ERROR
+ && 1 < 0
+ {
+ }
+}
+
+fn bar() {
+ if let () = ()
+ && () == (); //~ERROR
+ && let () = ()
+ {
+ }
+}
diff --git a/tests/ui/parser/semi-in-let-chain.stderr b/tests/ui/parser/semi-in-let-chain.stderr
new file mode 100644
index 000000000..c1a8f9296
--- /dev/null
+++ b/tests/ui/parser/semi-in-let-chain.stderr
@@ -0,0 +1,50 @@
+error: expected `{`, found `;`
+ --> $DIR/semi-in-let-chain.rs:7:23
+ |
+LL | && let () = ();
+ | ^ expected `{`
+ |
+note: you likely meant to continue parsing the let-chain starting here
+ --> $DIR/semi-in-let-chain.rs:8:9
+ |
+LL | && let () = ()
+ | ^^^^^^
+help: consider removing this semicolon to parse the `let` as part of the same chain
+ |
+LL - && let () = ();
+LL + && let () = ()
+ |
+
+error: expected `{`, found `;`
+ --> $DIR/semi-in-let-chain.rs:15:20
+ |
+LL | && () == ();
+ | ^ expected `{`
+ |
+note: the `if` expression is missing a block after this condition
+ --> $DIR/semi-in-let-chain.rs:14:8
+ |
+LL | if let () = ()
+ | ________^
+LL | | && () == ();
+ | |___________________^
+
+error: expected `{`, found `;`
+ --> $DIR/semi-in-let-chain.rs:23:20
+ |
+LL | && () == ();
+ | ^ expected `{`
+ |
+note: you likely meant to continue parsing the let-chain starting here
+ --> $DIR/semi-in-let-chain.rs:24:9
+ |
+LL | && let () = ()
+ | ^^^^^^
+help: consider removing this semicolon to parse the `let` as part of the same chain
+ |
+LL - && () == ();
+LL + && () == ()
+ |
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/parser/ternary_operator.rs b/tests/ui/parser/ternary_operator.rs
index 23d537e77..c8810781b 100644
--- a/tests/ui/parser/ternary_operator.rs
+++ b/tests/ui/parser/ternary_operator.rs
@@ -1,69 +1,30 @@
-// A good chunk of these errors aren't shown to the user, but are still
-// required in the test for it to pass.
-
-fn a() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+fn a() {
let x = 5 > 2 ? true : false;
//~^ ERROR Rust has no ternary operator
//~| HELP use an `if-else` expression instead
- //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
- //~| HELP the trait `Try` is not implemented for `{integer}`
- //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
- //~| HELP the trait `FromResidual<_>` is not implemented for `()`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE the `?` operator cannot be applied to type `{integer}`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE cannot use the `?` operator in a function that returns `()`
- //~| NOTE in this expansion of desugaring of operator `?`
}
-fn b() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+fn b() {
let x = 5 > 2 ? { true } : { false };
//~^ ERROR Rust has no ternary operator
//~| HELP use an `if-else` expression instead
- //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
- //~| HELP the trait `Try` is not implemented for `{integer}`
- //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
- //~| HELP the trait `FromResidual<_>` is not implemented for `()`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE the `?` operator cannot be applied to type `{integer}`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE cannot use the `?` operator in a function that returns `()`
- //~| NOTE in this expansion of desugaring of operator `?`
}
-fn c() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+fn c() {
let x = 5 > 2 ? f32::MAX : f32::MIN;
//~^ ERROR Rust has no ternary operator
//~| HELP use an `if-else` expression instead
- //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
- //~| HELP the trait `Try` is not implemented for `{integer}`
- //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
- //~| HELP the trait `FromResidual<_>` is not implemented for `()`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE the `?` operator cannot be applied to type `{integer}`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE cannot use the `?` operator in a function that returns `()`
- //~| NOTE in this expansion of desugaring of operator `?`
}
-fn main() { //~ NOTE this function should return `Result` or `Option` to accept `?`
+fn bad() {
+ // regression test for #117208
+ v ? return;
+ //~^ ERROR expected one of
+}
+
+fn main() {
let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
//~^ ERROR Rust has no ternary operator
//~| HELP use an `if-else` expression instead
//~| ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
- //~| NOTE expected one of `.`, `;`, `?`, `else`, or an operator
- //~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277]
- //~| HELP the trait `Try` is not implemented for `{integer}`
- //~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277]
- //~| HELP the trait `FromResidual<_>` is not implemented for `()`
- //~| NOTE type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE the `?` operator cannot be applied to type `{integer}`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE in this expansion of desugaring of operator `?`
- //~| NOTE cannot use the `?` operator in a function that returns `()`
- //~| NOTE in this expansion of desugaring of operator `?`
}
diff --git a/tests/ui/parser/ternary_operator.stderr b/tests/ui/parser/ternary_operator.stderr
index af9565bbe..6635e1672 100644
--- a/tests/ui/parser/ternary_operator.stderr
+++ b/tests/ui/parser/ternary_operator.stderr
@@ -1,5 +1,5 @@
error: Rust has no ternary operator
- --> $DIR/ternary_operator.rs:5:19
+ --> $DIR/ternary_operator.rs:2:19
|
LL | let x = 5 > 2 ? true : false;
| ^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL | let x = 5 > 2 ? true : false;
= help: use an `if-else` expression instead
error: Rust has no ternary operator
- --> $DIR/ternary_operator.rs:21:19
+ --> $DIR/ternary_operator.rs:8:19
|
LL | let x = 5 > 2 ? { true } : { false };
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -15,15 +15,21 @@ LL | let x = 5 > 2 ? { true } : { false };
= help: use an `if-else` expression instead
error: Rust has no ternary operator
- --> $DIR/ternary_operator.rs:37:19
+ --> $DIR/ternary_operator.rs:14:19
|
LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: use an `if-else` expression instead
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found keyword `return`
+ --> $DIR/ternary_operator.rs:21:9
+ |
+LL | v ? return;
+ | ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
+
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
- --> $DIR/ternary_operator.rs:53:37
+ --> $DIR/ternary_operator.rs:26:37
|
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
@@ -31,85 +37,12 @@ LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: Rust has no ternary operator
- --> $DIR/ternary_operator.rs:53:19
+ --> $DIR/ternary_operator.rs:26:19
|
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use an `if-else` expression instead
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/ternary_operator.rs:5:17
- |
-LL | let x = 5 > 2 ? true : false;
- | ^^^ the `?` operator cannot be applied to type `{integer}`
- |
- = help: the trait `Try` is not implemented for `{integer}`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/ternary_operator.rs:5:19
- |
-LL | fn a() {
- | ------ this function should return `Result` or `Option` to accept `?`
-LL | let x = 5 > 2 ? true : false;
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/ternary_operator.rs:21:17
- |
-LL | let x = 5 > 2 ? { true } : { false };
- | ^^^ the `?` operator cannot be applied to type `{integer}`
- |
- = help: the trait `Try` is not implemented for `{integer}`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/ternary_operator.rs:21:19
- |
-LL | fn b() {
- | ------ this function should return `Result` or `Option` to accept `?`
-LL | let x = 5 > 2 ? { true } : { false };
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/ternary_operator.rs:37:17
- |
-LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
- | ^^^ the `?` operator cannot be applied to type `{integer}`
- |
- = help: the trait `Try` is not implemented for `{integer}`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/ternary_operator.rs:37:19
- |
-LL | fn c() {
- | ------ this function should return `Result` or `Option` to accept `?`
-LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error[E0277]: the `?` operator can only be applied to values that implement `Try`
- --> $DIR/ternary_operator.rs:53:17
- |
-LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
- | ^^^ the `?` operator cannot be applied to type `{integer}`
- |
- = help: the trait `Try` is not implemented for `{integer}`
-
-error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
- --> $DIR/ternary_operator.rs:53:19
- |
-LL | fn main() {
- | --------- this function should return `Result` or `Option` to accept `?`
-LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
- | ^ cannot use the `?` operator in a function that returns `()`
- |
- = help: the trait `FromResidual<_>` is not implemented for `()`
-
-error: aborting due to 13 previous errors
+error: aborting due to 6 previous errors
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/parser/unsafe-mod.stderr b/tests/ui/parser/unsafe-mod.stderr
index dac6e7a35..fbe24aa10 100644
--- a/tests/ui/parser/unsafe-mod.stderr
+++ b/tests/ui/parser/unsafe-mod.stderr
@@ -5,6 +5,7 @@ LL | unsafe mod n;
| ^^^^^^^^^^^^^
|
= help: to create the module `n`, create file "$DIR/n.rs" or "$DIR/n/mod.rs"
+ = note: if there is a `mod n` elsewhere in the crate already, import it with `use crate::...` instead
error: module cannot be declared unsafe
--> $DIR/unsafe-mod.rs:1:1
diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs
index 9eeee195e..f1238ec24 100644
--- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs
+++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs
@@ -5,5 +5,9 @@ fn f2<'a>(x: u8, y: Vec<&'a ...>) {}
//~^ ERROR C-variadic type `...` may not be nested inside another type
fn main() {
- let _recovery_witness: () = 0; //~ ERROR mismatched types
+ // While this is an error, wf-checks happen before typeck, and if any wf-checks
+ // encountered errors, we do not continue to typeck, even if the items are
+ // unrelated.
+ // FIXME(oli-obk): make this report a type mismatch again.
+ let _recovery_witness: () = 0;
}
diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr
index 8b9d676a4..7ca6a6d1b 100644
--- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr
+++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr
@@ -10,15 +10,6 @@ error[E0743]: C-variadic type `...` may not be nested inside another type
LL | fn f2<'a>(x: u8, y: Vec<&'a ...>) {}
| ^^^
-error[E0308]: mismatched types
- --> $DIR/variadic-ffi-nested-syntactic-fail.rs:8:33
- |
-LL | let _recovery_witness: () = 0;
- | -- ^ expected `()`, found integer
- | |
- | expected due to this
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0308, E0743.
-For more information about an error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0743`.
diff --git a/tests/ui/parser/variadic-ffi-semantic-restrictions.rs b/tests/ui/parser/variadic-ffi-semantic-restrictions.rs
index 0b61e267d..b173e23e7 100644
--- a/tests/ui/parser/variadic-ffi-semantic-restrictions.rs
+++ b/tests/ui/parser/variadic-ffi-semantic-restrictions.rs
@@ -32,6 +32,18 @@ extern "C" fn f3_3(..., x: isize) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
//~| ERROR `...` must be the last argument of a C-variadic function
+const unsafe extern "C" fn f4_1(x: isize, ...) {}
+//~^ ERROR functions cannot be both `const` and C-variadic
+
+const extern "C" fn f4_2(x: isize, ...) {}
+//~^ ERROR functions cannot be both `const` and C-variadic
+//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
+
+const extern "C" fn f4_3(..., x: isize, ...) {}
+//~^ ERROR functions cannot be both `const` and C-variadic
+//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
+//~| ERROR `...` must be the last argument of a C-variadic function
+
extern "C" {
fn e_f1(...);
//~^ ERROR C-variadic function must be declared with at least one named argument
@@ -49,12 +61,13 @@ impl X {
//~| ERROR C-variadic function must be declared with at least one named argument
fn i_f3(..., x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
- //~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
//~| ERROR `...` must be the last argument of a C-variadic function
fn i_f4(..., x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
- //~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
//~| ERROR `...` must be the last argument of a C-variadic function
+ const fn i_f5(x: isize, ...) {}
+ //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
+ //~| ERROR functions cannot be both `const` and C-variadic
}
trait T {
diff --git a/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr b/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr
index f1cbbb279..18526080e 100644
--- a/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr
+++ b/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr
@@ -76,131 +76,172 @@ error: only foreign or `unsafe extern "C"` functions may be C-variadic
LL | extern "C" fn f3_3(..., x: isize) {}
| ^^^
+error: functions cannot be both `const` and C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:35:1
+ |
+LL | const unsafe extern "C" fn f4_1(x: isize, ...) {}
+ | ^^^^^ `const` because of this ^^^ C-variadic because of this
+
+error: functions cannot be both `const` and C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:38:1
+ |
+LL | const extern "C" fn f4_2(x: isize, ...) {}
+ | ^^^^^ `const` because of this ^^^ C-variadic because of this
+
+error: only foreign or `unsafe extern "C"` functions may be C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:38:36
+ |
+LL | const extern "C" fn f4_2(x: isize, ...) {}
+ | ^^^
+
+error: `...` must be the last argument of a C-variadic function
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:42:26
+ |
+LL | const extern "C" fn f4_3(..., x: isize, ...) {}
+ | ^^^
+
+error: functions cannot be both `const` and C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:42:1
+ |
+LL | const extern "C" fn f4_3(..., x: isize, ...) {}
+ | ^^^^^ ^^^ ^^^ C-variadic because of this
+ | | |
+ | | C-variadic because of this
+ | `const` because of this
+
+error: only foreign or `unsafe extern "C"` functions may be C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:42:26
+ |
+LL | const extern "C" fn f4_3(..., x: isize, ...) {}
+ | ^^^ ^^^
+
error: C-variadic function must be declared with at least one named argument
- --> $DIR/variadic-ffi-semantic-restrictions.rs:36:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:48:13
|
LL | fn e_f1(...);
| ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:38:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13
|
LL | fn e_f2(..., x: isize);
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:45:23
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:57:23
|
LL | fn i_f1(x: isize, ...) {}
| ^^^
error: C-variadic function must be declared with at least one named argument
- --> $DIR/variadic-ffi-semantic-restrictions.rs:47:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:59:13
|
LL | fn i_f2(...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:47:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:59:13
|
LL | fn i_f2(...) {}
| ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13
- |
-LL | fn i_f3(..., x: isize, ...) {}
- | ^^^
-
-error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:62:13
|
LL | fn i_f3(..., x: isize, ...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:50:28
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:62:13
|
LL | fn i_f3(..., x: isize, ...) {}
- | ^^^
+ | ^^^ ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:54:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
|
LL | fn i_f4(..., x: isize, ...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:54:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
|
LL | fn i_f4(..., x: isize, ...) {}
- | ^^^
+ | ^^^ ^^^
+
+error: functions cannot be both `const` and C-variadic
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:68:5
+ |
+LL | const fn i_f5(x: isize, ...) {}
+ | ^^^^^ ^^^ C-variadic because of this
+ | |
+ | `const` because of this
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:54:28
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:68:29
|
-LL | fn i_f4(..., x: isize, ...) {}
- | ^^^
+LL | const fn i_f5(x: isize, ...) {}
+ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:61:23
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:74:23
|
LL | fn t_f1(x: isize, ...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:63:23
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:76:23
|
LL | fn t_f2(x: isize, ...);
| ^^^
error: C-variadic function must be declared with at least one named argument
- --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:78:13
|
LL | fn t_f3(...) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:78:13
|
LL | fn t_f3(...) {}
| ^^^
error: C-variadic function must be declared with at least one named argument
- --> $DIR/variadic-ffi-semantic-restrictions.rs:68:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:81:13
|
LL | fn t_f4(...);
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:68:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:81:13
|
LL | fn t_f4(...);
| ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:71:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:84:13
|
LL | fn t_f5(..., x: isize) {}
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:71:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:84:13
|
LL | fn t_f5(..., x: isize) {}
| ^^^
error: `...` must be the last argument of a C-variadic function
- --> $DIR/variadic-ffi-semantic-restrictions.rs:74:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:87:13
|
LL | fn t_f6(..., x: isize);
| ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic
- --> $DIR/variadic-ffi-semantic-restrictions.rs:74:13
+ --> $DIR/variadic-ffi-semantic-restrictions.rs:87:13
|
LL | fn t_f6(..., x: isize);
| ^^^
-error: aborting due to 34 previous errors
+error: aborting due to 40 previous errors
diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
index c0a6558a1..0b4324876 100644
--- a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
+++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
@@ -307,6 +307,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false
| ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0507]: cannot move out of `a` in pattern guard
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:66
@@ -323,6 +324,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false
| ^ move occurs because `a` has type `&mut Result<U, U>`, which does not implement the `Copy` trait
|
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9
diff --git a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.fixed b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.fixed
new file mode 100644
index 000000000..cf6c2a24f
--- /dev/null
+++ b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.fixed
@@ -0,0 +1,18 @@
+// run-rustfix
+struct S {
+ field_name: (),
+}
+
+fn main() {
+ match (S {field_name: ()}) {
+ S {field_name: ref _foo} => {} //~ ERROR expected `,`
+ }
+ match (S {field_name: ()}) {
+ S {field_name: mut _foo} => {} //~ ERROR expected `,`
+ }
+ match (S {field_name: ()}) {
+ S {field_name: ref mut _foo} => {} //~ ERROR expected `,`
+ }
+ // Verify that we recover enough to run typeck.
+ let _: usize = 3usize; //~ ERROR mismatched types
+}
diff --git a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.rs b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.rs
new file mode 100644
index 000000000..98772c118
--- /dev/null
+++ b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.rs
@@ -0,0 +1,18 @@
+// run-rustfix
+struct S {
+ field_name: (),
+}
+
+fn main() {
+ match (S {field_name: ()}) {
+ S {ref field_name: _foo} => {} //~ ERROR expected `,`
+ }
+ match (S {field_name: ()}) {
+ S {mut field_name: _foo} => {} //~ ERROR expected `,`
+ }
+ match (S {field_name: ()}) {
+ S {ref mut field_name: _foo} => {} //~ ERROR expected `,`
+ }
+ // Verify that we recover enough to run typeck.
+ let _: usize = 3u8; //~ ERROR mismatched types
+}
diff --git a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr
new file mode 100644
index 000000000..e80789253
--- /dev/null
+++ b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr
@@ -0,0 +1,58 @@
+error: expected `,`
+ --> $DIR/incorrect-placement-of-pattern-modifiers.rs:8:26
+ |
+LL | S {ref field_name: _foo} => {}
+ | - ^
+ | |
+ | while parsing the fields for this pattern
+ |
+help: the pattern modifiers belong after the `:`
+ |
+LL - S {ref field_name: _foo} => {}
+LL + S {field_name: ref _foo} => {}
+ |
+
+error: expected `,`
+ --> $DIR/incorrect-placement-of-pattern-modifiers.rs:11:26
+ |
+LL | S {mut field_name: _foo} => {}
+ | - ^
+ | |
+ | while parsing the fields for this pattern
+ |
+help: the pattern modifiers belong after the `:`
+ |
+LL - S {mut field_name: _foo} => {}
+LL + S {field_name: mut _foo} => {}
+ |
+
+error: expected `,`
+ --> $DIR/incorrect-placement-of-pattern-modifiers.rs:14:30
+ |
+LL | S {ref mut field_name: _foo} => {}
+ | - ^
+ | |
+ | while parsing the fields for this pattern
+ |
+help: the pattern modifiers belong after the `:`
+ |
+LL - S {ref mut field_name: _foo} => {}
+LL + S {field_name: ref mut _foo} => {}
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/incorrect-placement-of-pattern-modifiers.rs:17:20
+ |
+LL | let _: usize = 3u8;
+ | ----- ^^^ expected `usize`, found `u8`
+ | |
+ | expected due to this
+ |
+help: change the type of the numeric literal from `u8` to `usize`
+ |
+LL | let _: usize = 3usize;
+ | ~~~~~
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/pattern/issue-115599.rs b/tests/ui/pattern/issue-115599.rs
new file mode 100644
index 000000000..7a222b90a
--- /dev/null
+++ b/tests/ui/pattern/issue-115599.rs
@@ -0,0 +1,7 @@
+const CONST_STRING: String = String::new();
+
+fn main() {
+ let empty_str = String::from("");
+ if let CONST_STRING = empty_str {}
+ //~^ ERROR to use a constant of type `Vec<u8>` in a pattern, `Vec<u8>` must be annotated with `#[derive(PartialEq, Eq)]`
+}
diff --git a/tests/ui/pattern/issue-115599.stderr b/tests/ui/pattern/issue-115599.stderr
new file mode 100644
index 000000000..e6cb6c1dd
--- /dev/null
+++ b/tests/ui/pattern/issue-115599.stderr
@@ -0,0 +1,11 @@
+error: to use a constant of type `Vec<u8>` in a pattern, `Vec<u8>` must be annotated with `#[derive(PartialEq, Eq)]`
+ --> $DIR/issue-115599.rs:5:12
+ |
+LL | if let CONST_STRING = empty_str {}
+ | ^^^^^^^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
+
+error: aborting due to previous error
+
diff --git a/tests/ui/pattern/issue-94866.stderr b/tests/ui/pattern/issue-94866.stderr
index b3c17ce89..dee4b3f55 100644
--- a/tests/ui/pattern/issue-94866.stderr
+++ b/tests/ui/pattern/issue-94866.stderr
@@ -5,10 +5,10 @@ LL | match Enum::A {
| ^^^^^^^ pattern `Enum::B` not covered
|
note: `Enum` defined here
- --> $DIR/issue-94866.rs:7:16
+ --> $DIR/issue-94866.rs:7:6
|
LL | enum Enum { A, B }
- | ---- ^ not covered
+ | ^^^^ - not covered
= note: the matched value is of type `Enum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/non-structural-match-types.mir.stderr b/tests/ui/pattern/non-structural-match-types.mir.stderr
new file mode 100644
index 000000000..7a9e5b7e0
--- /dev/null
+++ b/tests/ui/pattern/non-structural-match-types.mir.stderr
@@ -0,0 +1,14 @@
+error: `{closure@$DIR/non-structural-match-types.rs:12:17: 12:19}` cannot be used in patterns
+ --> $DIR/non-structural-match-types.rs:12:9
+ |
+LL | const { || {} } => {}
+ | ^^^^^^^^^^^^^^^
+
+error: `{async block@$DIR/non-structural-match-types.rs:15:17: 15:25}` cannot be used in patterns
+ --> $DIR/non-structural-match-types.rs:15:9
+ |
+LL | const { async {} } => {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/pattern/non-structural-match-types.rs b/tests/ui/pattern/non-structural-match-types.rs
index 5c3315473..fb7779fa8 100644
--- a/tests/ui/pattern/non-structural-match-types.rs
+++ b/tests/ui/pattern/non-structural-match-types.rs
@@ -1,4 +1,7 @@
// edition:2021
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
#![allow(incomplete_features)]
#![allow(unreachable_code)]
#![feature(const_async_blocks)]
@@ -6,9 +9,9 @@
fn main() {
match loop {} {
- const { || {} } => {}, //~ ERROR cannot be used in patterns
+ const { || {} } => {} //~ ERROR cannot be used in patterns
}
match loop {} {
- const { async {} } => {}, //~ ERROR cannot be used in patterns
+ const { async {} } => {} //~ ERROR cannot be used in patterns
}
}
diff --git a/tests/ui/pattern/non-structural-match-types.stderr b/tests/ui/pattern/non-structural-match-types.stderr
deleted file mode 100644
index 43d92775e..000000000
--- a/tests/ui/pattern/non-structural-match-types.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: `{closure@$DIR/non-structural-match-types.rs:9:17: 9:19}` cannot be used in patterns
- --> $DIR/non-structural-match-types.rs:9:9
- |
-LL | const { || {} } => {},
- | ^^^^^^^^^^^^^^^
-
-error: `{async block@$DIR/non-structural-match-types.rs:12:17: 12:25}` cannot be used in patterns
- --> $DIR/non-structural-match-types.rs:12:9
- |
-LL | const { async {} } => {},
- | ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/pattern/non-structural-match-types.thir.stderr b/tests/ui/pattern/non-structural-match-types.thir.stderr
new file mode 100644
index 000000000..7a9e5b7e0
--- /dev/null
+++ b/tests/ui/pattern/non-structural-match-types.thir.stderr
@@ -0,0 +1,14 @@
+error: `{closure@$DIR/non-structural-match-types.rs:12:17: 12:19}` cannot be used in patterns
+ --> $DIR/non-structural-match-types.rs:12:9
+ |
+LL | const { || {} } => {}
+ | ^^^^^^^^^^^^^^^
+
+error: `{async block@$DIR/non-structural-match-types.rs:15:17: 15:25}` cannot be used in patterns
+ --> $DIR/non-structural-match-types.rs:15:9
+ |
+LL | const { async {} } => {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/pattern/patkind-litrange-no-expr.stderr b/tests/ui/pattern/patkind-litrange-no-expr.stderr
index eb1ee7e45..45a261489 100644
--- a/tests/ui/pattern/patkind-litrange-no-expr.stderr
+++ b/tests/ui/pattern/patkind-litrange-no-expr.stderr
@@ -9,6 +9,8 @@ error: arbitrary expressions aren't allowed in patterns
|
LL | Arith = 1 + 1,
| ^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/pattern/slice-patterns-irrefutable.stderr b/tests/ui/pattern/slice-patterns-irrefutable.stderr
index fac99534f..e98ee28d6 100644
--- a/tests/ui/pattern/slice-patterns-irrefutable.stderr
+++ b/tests/ui/pattern/slice-patterns-irrefutable.stderr
@@ -3,6 +3,9 @@ error[E0282]: type annotations needed for `[_; 3]`
|
LL | let b;
| ^
+LL |
+LL | [a, b] = Default::default();
+ | - type must be known at this point
|
help: consider giving `b` an explicit type, where the placeholders `_` are specified
|
diff --git a/tests/ui/pattern/usefulness/conflicting_bindings.rs b/tests/ui/pattern/usefulness/conflicting_bindings.rs
new file mode 100644
index 000000000..0b3e7ce9e
--- /dev/null
+++ b/tests/ui/pattern/usefulness/conflicting_bindings.rs
@@ -0,0 +1,24 @@
+#![feature(if_let_guard, let_chains)]
+
+fn main() {
+ let mut x = Some(String::new());
+ let ref mut y @ ref mut z = x;
+ //~^ ERROR: mutable more than once
+ let Some(ref mut y @ ref mut z) = x else { return };
+ //~^ ERROR: mutable more than once
+ if let Some(ref mut y @ ref mut z) = x {}
+ //~^ ERROR: mutable more than once
+ if let Some(ref mut y @ ref mut z) = x && true {}
+ //~^ ERROR: mutable more than once
+ while let Some(ref mut y @ ref mut z) = x {}
+ //~^ ERROR: mutable more than once
+ while let Some(ref mut y @ ref mut z) = x && true {}
+ //~^ ERROR: mutable more than once
+ match x {
+ ref mut y @ ref mut z => {} //~ ERROR: mutable more than once
+ }
+ match () {
+ () if let Some(ref mut y @ ref mut z) = x => {} //~ ERROR: mutable more than once
+ _ => {}
+ }
+}
diff --git a/tests/ui/pattern/usefulness/conflicting_bindings.stderr b/tests/ui/pattern/usefulness/conflicting_bindings.stderr
new file mode 100644
index 000000000..679fc83e7
--- /dev/null
+++ b/tests/ui/pattern/usefulness/conflicting_bindings.stderr
@@ -0,0 +1,66 @@
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:5:9
+ |
+LL | let ref mut y @ ref mut z = x;
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:7:14
+ |
+LL | let Some(ref mut y @ ref mut z) = x else { return };
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:9:17
+ |
+LL | if let Some(ref mut y @ ref mut z) = x {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:11:17
+ |
+LL | if let Some(ref mut y @ ref mut z) = x && true {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:13:20
+ |
+LL | while let Some(ref mut y @ ref mut z) = x {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:15:20
+ |
+LL | while let Some(ref mut y @ ref mut z) = x && true {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:18:9
+ |
+LL | ref mut y @ ref mut z => {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/conflicting_bindings.rs:21:24
+ |
+LL | () if let Some(ref mut y @ ref mut z) = x => {}
+ | ^^^^^^^^^ --------- value is mutably borrowed by `z` here
+ | |
+ | value is mutably borrowed by `y` here
+
+error: aborting due to 8 previous errors
+
diff --git a/tests/ui/pattern/usefulness/consts-opaque.rs b/tests/ui/pattern/usefulness/consts-opaque.rs
index c10c6205a..27e305a39 100644
--- a/tests/ui/pattern/usefulness/consts-opaque.rs
+++ b/tests/ui/pattern/usefulness/consts-opaque.rs
@@ -30,15 +30,13 @@ fn main() {
match FOO {
FOO => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- _ => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ _ => {}
}
match FOO_REF {
FOO_REF => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- Foo(_) => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ Foo(_) => {}
}
// This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071)
@@ -51,39 +49,31 @@ fn main() {
match BAR {
Bar => {}
- BAR => {} // should not be emitting unreachable warning
+ BAR => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- //~| ERROR unreachable pattern
_ => {}
- //~^ ERROR unreachable pattern
}
match BAR {
BAR => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- Bar => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ Bar => {}
_ => {}
- //~^ ERROR unreachable pattern
}
match BAR {
BAR => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- BAR => {} // should not be emitting unreachable warning
+ BAR => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- //~| ERROR unreachable pattern
- _ => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ _ => {}
}
match BAZ {
BAZ => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- Baz::Baz1 => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ Baz::Baz1 => {}
_ => {}
- //~^ ERROR unreachable pattern
}
match BAZ {
@@ -91,16 +81,13 @@ fn main() {
BAZ => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
_ => {}
- //~^ ERROR unreachable pattern
}
match BAZ {
BAZ => {}
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- Baz::Baz2 => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
- _ => {} // should not be emitting unreachable warning
- //~^ ERROR unreachable pattern
+ Baz::Baz2 => {}
+ _ => {}
}
type Quux = fn(usize, usize) -> usize;
@@ -108,8 +95,10 @@ fn main() {
const QUUX: Quux = quux;
match QUUX {
- QUUX => {}
- QUUX => {}
+ QUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
+ QUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
_ => {}
}
@@ -118,14 +107,17 @@ fn main() {
const WRAPQUUX: Wrap<Quux> = Wrap(quux);
match WRAPQUUX {
- WRAPQUUX => {}
- WRAPQUUX => {}
+ WRAPQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
+ WRAPQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
}
match WRAPQUUX {
Wrap(_) => {}
- WRAPQUUX => {}
+ WRAPQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
}
match WRAPQUUX {
@@ -134,7 +126,8 @@ fn main() {
match WRAPQUUX {
//~^ ERROR: non-exhaustive patterns: `Wrap(_)` not covered
- WRAPQUUX => {}
+ WRAPQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
}
#[derive(PartialEq, Eq)]
@@ -145,9 +138,11 @@ fn main() {
const WHOKNOWSQUUX: WhoKnows<Quux> = WhoKnows::Yay(quux);
match WHOKNOWSQUUX {
- WHOKNOWSQUUX => {}
+ WHOKNOWSQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
WhoKnows::Yay(_) => {}
- WHOKNOWSQUUX => {}
+ WHOKNOWSQUUX => {} //~WARN behave unpredictably
+ //~| previously accepted
WhoKnows::Nope => {}
}
}
diff --git a/tests/ui/pattern/usefulness/consts-opaque.stderr b/tests/ui/pattern/usefulness/consts-opaque.stderr
index e01b06ccc..09f72ba92 100644
--- a/tests/ui/pattern/usefulness/consts-opaque.stderr
+++ b/tests/ui/pattern/usefulness/consts-opaque.stderr
@@ -8,7 +8,7 @@ LL | FOO => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:38:9
+ --> $DIR/consts-opaque.rs:37:9
|
LL | FOO_REF => {}
| ^^^^^^^
@@ -17,7 +17,7 @@ LL | FOO_REF => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
warning: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:46:9
+ --> $DIR/consts-opaque.rs:44:9
|
LL | FOO_REF_REF => {}
| ^^^^^^^^^^^
@@ -29,16 +29,16 @@ LL | FOO_REF_REF => {}
= note: `#[warn(indirect_structural_match)]` on by default
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:54:9
+ --> $DIR/consts-opaque.rs:52:9
|
-LL | BAR => {} // should not be emitting unreachable warning
+LL | BAR => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:62:9
+ --> $DIR/consts-opaque.rs:58:9
|
LL | BAR => {}
| ^^^
@@ -47,7 +47,7 @@ LL | BAR => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:71:9
+ --> $DIR/consts-opaque.rs:65:9
|
LL | BAR => {}
| ^^^
@@ -56,16 +56,16 @@ LL | BAR => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:73:9
+ --> $DIR/consts-opaque.rs:67:9
|
-LL | BAR => {} // should not be emitting unreachable warning
+LL | BAR => {}
| ^^^
|
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:81:9
+ --> $DIR/consts-opaque.rs:73:9
|
LL | BAZ => {}
| ^^^
@@ -74,7 +74,7 @@ LL | BAZ => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:91:9
+ --> $DIR/consts-opaque.rs:81:9
|
LL | BAZ => {}
| ^^^
@@ -83,7 +83,7 @@ LL | BAZ => {}
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/consts-opaque.rs:98:9
+ --> $DIR/consts-opaque.rs:87:9
|
LL | BAZ => {}
| ^^^
@@ -91,146 +91,96 @@ LL | BAZ => {}
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:33:9
- |
-LL | FOO => {}
- | --- matches any value
-LL |
-LL | _ => {} // should not be emitting unreachable warning
- | ^ unreachable pattern
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:98:9
|
-note: the lint level is defined here
- --> $DIR/consts-opaque.rs:6:9
+LL | QUUX => {}
+ | ^^^^
|
-LL | #![deny(unreachable_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+ = note: `#[warn(pointer_structural_match)]` on by default
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:40:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:100:9
|
-LL | FOO_REF => {}
- | ------- matches any value
-LL |
-LL | Foo(_) => {} // should not be emitting unreachable warning
- | ^^^^^^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:54:9
+LL | QUUX => {}
+ | ^^^^
|
-LL | Bar => {}
- | --- matches any value
-LL | BAR => {} // should not be emitting unreachable warning
- | ^^^ unreachable pattern
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:57:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:110:9
|
-LL | Bar => {}
- | --- matches any value
-...
-LL | _ => {}
- | ^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:64:9
+LL | WRAPQUUX => {}
+ | ^^^^^^^^
|
-LL | BAR => {}
- | --- matches any value
-LL |
-LL | Bar => {} // should not be emitting unreachable warning
- | ^^^ unreachable pattern
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:66:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:112:9
|
-LL | BAR => {}
- | --- matches any value
-...
-LL | _ => {}
- | ^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:73:9
+LL | WRAPQUUX => {}
+ | ^^^^^^^^
|
-LL | BAR => {}
- | --- matches any value
-LL |
-LL | BAR => {} // should not be emitting unreachable warning
- | ^^^ unreachable pattern
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:76:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:119:9
|
-LL | BAR => {}
- | --- matches any value
-...
-LL | _ => {} // should not be emitting unreachable warning
- | ^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:83:9
+LL | WRAPQUUX => {}
+ | ^^^^^^^^
|
-LL | BAZ => {}
- | --- matches any value
-LL |
-LL | Baz::Baz1 => {} // should not be emitting unreachable warning
- | ^^^^^^^^^ unreachable pattern
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:85:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:129:9
|
-LL | BAZ => {}
- | --- matches any value
-...
-LL | _ => {}
- | ^ unreachable pattern
-
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:93:9
+LL | WRAPQUUX => {}
+ | ^^^^^^^^
|
-LL | BAZ => {}
- | --- matches any value
-LL |
-LL | _ => {}
- | ^ unreachable pattern
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:100:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:141:9
|
-LL | BAZ => {}
- | --- matches any value
-LL |
-LL | Baz::Baz2 => {} // should not be emitting unreachable warning
- | ^^^^^^^^^ unreachable pattern
+LL | WHOKNOWSQUUX => {}
+ | ^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
-error: unreachable pattern
- --> $DIR/consts-opaque.rs:102:9
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/consts-opaque.rs:144:9
|
-LL | BAZ => {}
- | --- matches any value
-...
-LL | _ => {} // should not be emitting unreachable warning
- | ^ unreachable pattern
+LL | WHOKNOWSQUUX => {}
+ | ^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
error[E0004]: non-exhaustive patterns: `Wrap(_)` not covered
- --> $DIR/consts-opaque.rs:135:11
+ --> $DIR/consts-opaque.rs:127:11
|
LL | match WRAPQUUX {
| ^^^^^^^^ pattern `Wrap(_)` not covered
|
note: `Wrap<fn(usize, usize) -> usize>` defined here
- --> $DIR/consts-opaque.rs:117:12
+ --> $DIR/consts-opaque.rs:106:12
|
LL | struct Wrap<T>(T);
| ^^^^
= note: the matched value is of type `Wrap<fn(usize, usize) -> usize>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
-LL ~ WRAPQUUX => {},
-LL + Wrap(_) => todo!()
- |
+LL | WRAPQUUX => {}, Wrap(_) => todo!()
+ | ++++++++++++++++++++
-error: aborting due to 23 previous errors; 1 warning emitted
+error: aborting due to 10 previous errors; 9 warnings emitted
For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
index ff29de03d..24f3eaa52 100644
--- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
+++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
@@ -23,13 +23,13 @@ LL | match HiddenEnum::A {
| ^^^^^^^^^^^^^ pattern `HiddenEnum::B` not covered
|
note: `HiddenEnum` defined here
- --> $DIR/auxiliary/hidden.rs:3:5
+ --> $DIR/auxiliary/hidden.rs:1:1
|
LL | pub enum HiddenEnum {
- | -------------------
+ | ^^^^^^^^^^^^^^^^^^^
LL | A,
LL | B,
- | ^ not covered
+ | - not covered
= note: the matched value is of type `HiddenEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
@@ -44,13 +44,13 @@ LL | match HiddenEnum::A {
| ^^^^^^^^^^^^^ patterns `HiddenEnum::B` and `_` not covered
|
note: `HiddenEnum` defined here
- --> $DIR/auxiliary/hidden.rs:3:5
+ --> $DIR/auxiliary/hidden.rs:1:1
|
LL | pub enum HiddenEnum {
- | -------------------
+ | ^^^^^^^^^^^^^^^^^^^
LL | A,
LL | B,
- | ^ not covered
+ | - not covered
= note: the matched value is of type `HiddenEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -83,13 +83,13 @@ LL | match InCrate::A {
| ^^^^^^^^^^ pattern `InCrate::C` not covered
|
note: `InCrate` defined here
- --> $DIR/doc-hidden-non-exhaustive.rs:11:5
+ --> $DIR/doc-hidden-non-exhaustive.rs:7:6
|
LL | enum InCrate {
- | -------
+ | ^^^^^^^
...
LL | C,
- | ^ not covered
+ | - not covered
= note: the matched value is of type `InCrate`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr
index 5b81a8c3d..8f9bd5bde 100644
--- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr
+++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr
@@ -1,5 +1,5 @@
error: unreachable pattern
- --> $DIR/empty-match.rs:58:9
+ --> $DIR/empty-match.rs:68:9
|
LL | _ => {},
| ^
@@ -11,25 +11,25 @@ LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
- --> $DIR/empty-match.rs:61:9
+ --> $DIR/empty-match.rs:71:9
|
LL | _ if false => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:68:9
+ --> $DIR/empty-match.rs:78:9
|
LL | _ => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:71:9
+ --> $DIR/empty-match.rs:81:9
|
LL | _ if false => {},
| ^
error[E0005]: refutable pattern in local binding
- --> $DIR/empty-match.rs:76:9
+ --> $DIR/empty-match.rs:86:9
|
LL | let None = x;
| ^^^^ pattern `Some(_)` not covered
@@ -44,19 +44,19 @@ LL | if let None = x { todo!() };
| ++ +++++++++++
error: unreachable pattern
- --> $DIR/empty-match.rs:88:9
+ --> $DIR/empty-match.rs:98:9
|
LL | _ => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:91:9
+ --> $DIR/empty-match.rs:101:9
|
LL | _ if false => {},
| ^
error[E0004]: non-exhaustive patterns: type `u8` is non-empty
- --> $DIR/empty-match.rs:109:20
+ --> $DIR/empty-match.rs:119:20
|
LL | match_no_arms!(0u8);
| ^^^
@@ -65,7 +65,7 @@ LL | match_no_arms!(0u8);
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty
- --> $DIR/empty-match.rs:111:20
+ --> $DIR/empty-match.rs:121:20
|
LL | match_no_arms!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^
@@ -79,7 +79,7 @@ LL | struct NonEmptyStruct1;
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty
- --> $DIR/empty-match.rs:113:20
+ --> $DIR/empty-match.rs:123:20
|
LL | match_no_arms!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^
@@ -93,7 +93,7 @@ LL | struct NonEmptyStruct2(bool);
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty
- --> $DIR/empty-match.rs:115:20
+ --> $DIR/empty-match.rs:125:20
|
LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -107,7 +107,7 @@ LL | union NonEmptyUnion1 {
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty
- --> $DIR/empty-match.rs:117:20
+ --> $DIR/empty-match.rs:127:20
|
LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -121,42 +121,44 @@ LL | union NonEmptyUnion2 {
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered
- --> $DIR/empty-match.rs:119:20
+ --> $DIR/empty-match.rs:129:20
|
LL | match_no_arms!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered
|
note: `NonEmptyEnum1` defined here
- --> $DIR/empty-match.rs:33:5
+ --> $DIR/empty-match.rs:32:6
|
LL | enum NonEmptyEnum1 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum1`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern
error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
- --> $DIR/empty-match.rs:122:20
+ --> $DIR/empty-match.rs:132:20
|
LL | match_no_arms!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
|
note: `NonEmptyEnum2` defined here
- --> $DIR/empty-match.rs:40:5
+ --> $DIR/empty-match.rs:39:6
|
LL | enum NonEmptyEnum2 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
...
LL | Bar,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum2`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
- --> $DIR/empty-match.rs:125:20
+ --> $DIR/empty-match.rs:135:20
|
LL | match_no_arms!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
@@ -166,11 +168,19 @@ note: `NonEmptyEnum5` defined here
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
+...
+LL | V1, V2, V3, V4, V5,
+ | -- -- -- -- -- not covered
+ | | | | |
+ | | | | not covered
+ | | | not covered
+ | | not covered
+ | not covered
= note: the matched value is of type `NonEmptyEnum5`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms
error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/empty-match.rs:129:24
+ --> $DIR/empty-match.rs:139:24
|
LL | match_guarded_arm!(0u8);
| ^^^ pattern `_` not covered
@@ -184,7 +194,7 @@ LL + _ => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered
- --> $DIR/empty-match.rs:134:24
+ --> $DIR/empty-match.rs:144:24
|
LL | match_guarded_arm!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered
@@ -203,7 +213,7 @@ LL + NonEmptyStruct1 => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered
- --> $DIR/empty-match.rs:139:24
+ --> $DIR/empty-match.rs:149:24
|
LL | match_guarded_arm!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered
@@ -222,7 +232,7 @@ LL + NonEmptyStruct2(_) => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered
- --> $DIR/empty-match.rs:144:24
+ --> $DIR/empty-match.rs:154:24
|
LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
@@ -241,7 +251,7 @@ LL + NonEmptyUnion1 { .. } => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered
- --> $DIR/empty-match.rs:149:24
+ --> $DIR/empty-match.rs:159:24
|
LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
@@ -260,18 +270,19 @@ LL + NonEmptyUnion2 { .. } => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered
- --> $DIR/empty-match.rs:154:24
+ --> $DIR/empty-match.rs:164:24
|
LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered
|
note: `NonEmptyEnum1` defined here
- --> $DIR/empty-match.rs:33:5
+ --> $DIR/empty-match.rs:32:6
|
LL | enum NonEmptyEnum1 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum1`
= note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
@@ -281,21 +292,22 @@ LL + NonEmptyEnum1::Foo(_) => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
- --> $DIR/empty-match.rs:159:24
+ --> $DIR/empty-match.rs:169:24
|
LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
|
note: `NonEmptyEnum2` defined here
- --> $DIR/empty-match.rs:40:5
+ --> $DIR/empty-match.rs:39:6
|
LL | enum NonEmptyEnum2 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
...
LL | Bar,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum2`
= note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
@@ -305,7 +317,7 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
- --> $DIR/empty-match.rs:164:24
+ --> $DIR/empty-match.rs:174:24
|
LL | match_guarded_arm!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
@@ -315,6 +327,14 @@ note: `NonEmptyEnum5` defined here
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
+...
+LL | V1, V2, V3, V4, V5,
+ | -- -- -- -- -- not covered
+ | | | | |
+ | | | | not covered
+ | | | not covered
+ | | not covered
+ | not covered
= note: the matched value is of type `NonEmptyEnum5`
= note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr
index 6d1745508..7f0389f40 100644
--- a/tests/ui/pattern/usefulness/empty-match.normal.stderr
+++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr
@@ -1,5 +1,5 @@
error: unreachable pattern
- --> $DIR/empty-match.rs:58:9
+ --> $DIR/empty-match.rs:68:9
|
LL | _ => {},
| ^
@@ -11,25 +11,25 @@ LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
- --> $DIR/empty-match.rs:61:9
+ --> $DIR/empty-match.rs:71:9
|
LL | _ if false => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:68:9
+ --> $DIR/empty-match.rs:78:9
|
LL | _ => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:71:9
+ --> $DIR/empty-match.rs:81:9
|
LL | _ if false => {},
| ^
error[E0005]: refutable pattern in local binding
- --> $DIR/empty-match.rs:76:9
+ --> $DIR/empty-match.rs:86:9
|
LL | let None = x;
| ^^^^ pattern `Some(_)` not covered
@@ -43,19 +43,19 @@ LL | if let None = x { todo!() };
| ++ +++++++++++
error: unreachable pattern
- --> $DIR/empty-match.rs:88:9
+ --> $DIR/empty-match.rs:98:9
|
LL | _ => {},
| ^
error: unreachable pattern
- --> $DIR/empty-match.rs:91:9
+ --> $DIR/empty-match.rs:101:9
|
LL | _ if false => {},
| ^
error[E0004]: non-exhaustive patterns: type `u8` is non-empty
- --> $DIR/empty-match.rs:109:20
+ --> $DIR/empty-match.rs:119:20
|
LL | match_no_arms!(0u8);
| ^^^
@@ -64,7 +64,7 @@ LL | match_no_arms!(0u8);
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct1` is non-empty
- --> $DIR/empty-match.rs:111:20
+ --> $DIR/empty-match.rs:121:20
|
LL | match_no_arms!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^
@@ -78,7 +78,7 @@ LL | struct NonEmptyStruct1;
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyStruct2` is non-empty
- --> $DIR/empty-match.rs:113:20
+ --> $DIR/empty-match.rs:123:20
|
LL | match_no_arms!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^
@@ -92,7 +92,7 @@ LL | struct NonEmptyStruct2(bool);
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty
- --> $DIR/empty-match.rs:115:20
+ --> $DIR/empty-match.rs:125:20
|
LL | match_no_arms!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -106,7 +106,7 @@ LL | union NonEmptyUnion1 {
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty
- --> $DIR/empty-match.rs:117:20
+ --> $DIR/empty-match.rs:127:20
|
LL | match_no_arms!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -120,42 +120,44 @@ LL | union NonEmptyUnion2 {
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern
error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered
- --> $DIR/empty-match.rs:119:20
+ --> $DIR/empty-match.rs:129:20
|
LL | match_no_arms!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered
|
note: `NonEmptyEnum1` defined here
- --> $DIR/empty-match.rs:33:5
+ --> $DIR/empty-match.rs:32:6
|
LL | enum NonEmptyEnum1 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum1`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern
error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
- --> $DIR/empty-match.rs:122:20
+ --> $DIR/empty-match.rs:132:20
|
LL | match_no_arms!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
|
note: `NonEmptyEnum2` defined here
- --> $DIR/empty-match.rs:40:5
+ --> $DIR/empty-match.rs:39:6
|
LL | enum NonEmptyEnum2 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
...
LL | Bar,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum2`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
- --> $DIR/empty-match.rs:125:20
+ --> $DIR/empty-match.rs:135:20
|
LL | match_no_arms!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
@@ -165,11 +167,19 @@ note: `NonEmptyEnum5` defined here
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
+...
+LL | V1, V2, V3, V4, V5,
+ | -- -- -- -- -- not covered
+ | | | | |
+ | | | | not covered
+ | | | not covered
+ | | not covered
+ | not covered
= note: the matched value is of type `NonEmptyEnum5`
= help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or multiple match arms
error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/empty-match.rs:129:24
+ --> $DIR/empty-match.rs:139:24
|
LL | match_guarded_arm!(0u8);
| ^^^ pattern `_` not covered
@@ -183,7 +193,7 @@ LL + _ => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered
- --> $DIR/empty-match.rs:134:24
+ --> $DIR/empty-match.rs:144:24
|
LL | match_guarded_arm!(NonEmptyStruct1);
| ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered
@@ -202,7 +212,7 @@ LL + NonEmptyStruct1 => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered
- --> $DIR/empty-match.rs:139:24
+ --> $DIR/empty-match.rs:149:24
|
LL | match_guarded_arm!(NonEmptyStruct2(true));
| ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered
@@ -221,7 +231,7 @@ LL + NonEmptyStruct2(_) => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered
- --> $DIR/empty-match.rs:144:24
+ --> $DIR/empty-match.rs:154:24
|
LL | match_guarded_arm!((NonEmptyUnion1 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered
@@ -240,7 +250,7 @@ LL + NonEmptyUnion1 { .. } => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered
- --> $DIR/empty-match.rs:149:24
+ --> $DIR/empty-match.rs:159:24
|
LL | match_guarded_arm!((NonEmptyUnion2 { foo: () }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered
@@ -259,18 +269,19 @@ LL + NonEmptyUnion2 { .. } => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered
- --> $DIR/empty-match.rs:154:24
+ --> $DIR/empty-match.rs:164:24
|
LL | match_guarded_arm!(NonEmptyEnum1::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered
|
note: `NonEmptyEnum1` defined here
- --> $DIR/empty-match.rs:33:5
+ --> $DIR/empty-match.rs:32:6
|
LL | enum NonEmptyEnum1 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum1`
= note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
@@ -280,21 +291,22 @@ LL + NonEmptyEnum1::Foo(_) => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
- --> $DIR/empty-match.rs:159:24
+ --> $DIR/empty-match.rs:169:24
|
LL | match_guarded_arm!(NonEmptyEnum2::Foo(true));
| ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered
|
note: `NonEmptyEnum2` defined here
- --> $DIR/empty-match.rs:40:5
+ --> $DIR/empty-match.rs:39:6
|
LL | enum NonEmptyEnum2 {
- | -------------
+ | ^^^^^^^^^^^^^
+...
LL | Foo(bool),
- | ^^^ not covered
+ | --- not covered
...
LL | Bar,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `NonEmptyEnum2`
= note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
@@ -304,7 +316,7 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!()
|
error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
- --> $DIR/empty-match.rs:164:24
+ --> $DIR/empty-match.rs:174:24
|
LL | match_guarded_arm!(NonEmptyEnum5::V1);
| ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered
@@ -314,6 +326,14 @@ note: `NonEmptyEnum5` defined here
|
LL | enum NonEmptyEnum5 {
| ^^^^^^^^^^^^^
+...
+LL | V1, V2, V3, V4, V5,
+ | -- -- -- -- -- not covered
+ | | | | |
+ | | | | not covered
+ | | | not covered
+ | | not covered
+ | not covered
= note: the matched value is of type `NonEmptyEnum5`
= note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
diff --git a/tests/ui/pattern/usefulness/empty-match.rs b/tests/ui/pattern/usefulness/empty-match.rs
index d56d2e3c8..fe5d0bce1 100644
--- a/tests/ui/pattern/usefulness/empty-match.rs
+++ b/tests/ui/pattern/usefulness/empty-match.rs
@@ -30,17 +30,17 @@ union NonEmptyUnion2 {
bar: (),
}
enum NonEmptyEnum1 {
- Foo(bool),
//~^ NOTE `NonEmptyEnum1` defined here
//~| NOTE `NonEmptyEnum1` defined here
- //~| NOTE not covered
+ Foo(bool),
+ //~^ NOTE not covered
//~| NOTE not covered
}
enum NonEmptyEnum2 {
- Foo(bool),
//~^ NOTE `NonEmptyEnum2` defined here
//~| NOTE `NonEmptyEnum2` defined here
- //~| NOTE not covered
+ Foo(bool),
+ //~^ NOTE not covered
//~| NOTE not covered
Bar,
//~^ NOTE not covered
@@ -50,6 +50,16 @@ enum NonEmptyEnum5 {
//~^ NOTE `NonEmptyEnum5` defined here
//~| NOTE `NonEmptyEnum5` defined here
V1, V2, V3, V4, V5,
+ //~^ NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
+ //~| NOTE not covered
}
fn empty_enum(x: EmptyEnum) {
diff --git a/tests/ui/pattern/usefulness/floats.rs b/tests/ui/pattern/usefulness/floats.rs
index 095f5ac9a..2616dfadb 100644
--- a/tests/ui/pattern/usefulness/floats.rs
+++ b/tests/ui/pattern/usefulness/floats.rs
@@ -1,19 +1,45 @@
+#![feature(exclusive_range_pattern)]
#![allow(illegal_floating_point_literal_pattern)]
#![deny(unreachable_patterns)]
fn main() {
match 0.0 {
- 0.0..=1.0 => {}
- _ => {} // ok
+ 0.0..=1.0 => {}
+ _ => {} // ok
}
- match 0.0 { //~ ERROR non-exhaustive patterns
- 0.0..=1.0 => {}
+ match 0.0 {
+ //~^ ERROR non-exhaustive patterns
+ 0.0..=1.0 => {}
}
match 1.0f64 {
- 0.01f64 ..= 6.5f64 => {}
- 0.02f64 => {} //~ ERROR unreachable pattern
- _ => {}
+ 0.01f64..=6.5f64 => {}
+ 0.005f64 => {}
+ 0.01f64 => {} //~ ERROR unreachable pattern
+ 0.02f64 => {} //~ ERROR unreachable pattern
+ 6.5f64 => {} //~ ERROR unreachable pattern
+ 6.6f64 => {}
+ 1.0f64..=4.0f64 => {} //~ ERROR unreachable pattern
+ 5.0f64..=7.0f64 => {}
+ _ => {}
+ };
+ match 1.0f64 {
+ 0.01f64..6.5f64 => {}
+ 6.5f64 => {} // this is reachable
+ _ => {}
+ };
+
+ match 1.0f32 {
+ 0.01f32..=6.5f32 => {}
+ 0.01f32 => {} //~ ERROR unreachable pattern
+ 0.02f32 => {} //~ ERROR unreachable pattern
+ 6.5f32 => {} //~ ERROR unreachable pattern
+ _ => {}
+ };
+ match 1.0f32 {
+ 0.01f32..6.5f32 => {}
+ 6.5f32 => {} // this is reachable
+ _ => {}
};
}
diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr
index d66d4ba29..f50419118 100644
--- a/tests/ui/pattern/usefulness/floats.stderr
+++ b/tests/ui/pattern/usefulness/floats.stderr
@@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/floats.rs:10:11
+ --> $DIR/floats.rs:11:11
|
LL | match 0.0 {
| ^^^ pattern `_` not covered
@@ -7,22 +7,58 @@ LL | match 0.0 {
= note: the matched value is of type `f64`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
-LL ~ 0.0..=1.0 => {},
-LL + _ => todo!()
+LL ~ 0.0..=1.0 => {},
+LL + _ => todo!()
|
error: unreachable pattern
- --> $DIR/floats.rs:16:7
+ --> $DIR/floats.rs:19:9
|
-LL | 0.02f64 => {}
- | ^^^^^^^
+LL | 0.01f64 => {}
+ | ^^^^^^^
|
note: the lint level is defined here
- --> $DIR/floats.rs:2:9
+ --> $DIR/floats.rs:3:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: unreachable pattern
+ --> $DIR/floats.rs:20:9
+ |
+LL | 0.02f64 => {}
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:21:9
+ |
+LL | 6.5f64 => {}
+ | ^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:23:9
+ |
+LL | 1.0f64..=4.0f64 => {}
+ | ^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:35:9
+ |
+LL | 0.01f32 => {}
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:36:9
+ |
+LL | 0.02f32 => {}
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/floats.rs:37:9
+ |
+LL | 6.5f32 => {}
+ | ^^^^^^
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs
index 5ea92b070..33c1dfd39 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs
+++ b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.rs
@@ -8,7 +8,7 @@ macro_rules! m {
$t2 => {}
_ => {}
}
- }
+ };
}
fn main() {
@@ -16,9 +16,9 @@ fn main() {
m!(0u8, 30..=40, 20..=30); //~ ERROR multiple patterns overlap on their endpoints
m!(0u8, 20..=30, 31..=40);
m!(0u8, 20..=30, 29..=40);
- m!(0u8, 20.. 30, 29..=40); //~ ERROR multiple patterns overlap on their endpoints
- m!(0u8, 20.. 30, 28..=40);
- m!(0u8, 20.. 30, 30..=40);
+ m!(0u8, 20..30, 29..=40); //~ ERROR multiple patterns overlap on their endpoints
+ m!(0u8, 20..30, 28..=40);
+ m!(0u8, 20..30, 30..=40);
m!(0u8, 20..=30, 30..=30);
m!(0u8, 20..=30, 30..=31); //~ ERROR multiple patterns overlap on their endpoints
m!(0u8, 20..=30, 29..=30);
@@ -28,7 +28,7 @@ fn main() {
m!(0u8, 20..=30, 20);
m!(0u8, 20..=30, 25);
m!(0u8, 20..=30, 30);
- m!(0u8, 20.. 30, 29);
+ m!(0u8, 20..30, 29);
m!(0u8, 20, 20..=30);
m!(0u8, 25, 20..=30);
m!(0u8, 30, 20..=30);
@@ -36,19 +36,21 @@ fn main() {
match 0u8 {
0..=10 => {}
20..=30 => {}
- 10..=20 => {} //~ ERROR multiple patterns overlap on their endpoints
+ 10..=20 => {}
+ //~^ ERROR multiple patterns overlap on their endpoints
+ //~| ERROR multiple patterns overlap on their endpoints
_ => {}
}
match (0u8, true) {
(0..=10, true) => {}
- (10..20, true) => {} // not detected
- (10..20, false) => {}
+ (10..20, true) => {} //~ ERROR multiple patterns overlap on their endpoints
+ (10..20, false) => {} //~ ERROR multiple patterns overlap on their endpoints
_ => {}
}
match (true, 0u8) {
(true, 0..=10) => {}
(true, 10..20) => {} //~ ERROR multiple patterns overlap on their endpoints
- (false, 10..20) => {}
+ (false, 10..20) => {} //~ ERROR multiple patterns overlap on their endpoints
_ => {}
}
match Some(0u8) {
diff --git a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr
index ea0e8f6e4..a87205d76 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr
+++ b/tests/ui/pattern/usefulness/integer-ranges/overlapping_range_endpoints.stderr
@@ -24,10 +24,10 @@ LL | m!(0u8, 30..=40, 20..=30);
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
- --> $DIR/overlapping_range_endpoints.rs:19:22
+ --> $DIR/overlapping_range_endpoints.rs:19:21
|
-LL | m!(0u8, 20.. 30, 29..=40);
- | ------- ^^^^^^^ ... with this range
+LL | m!(0u8, 20..30, 29..=40);
+ | ------ ^^^^^^^ ... with this range
| |
| this range overlaps on `29_u8`...
|
@@ -59,6 +59,15 @@ error: multiple patterns overlap on their endpoints
LL | 0..=10 => {}
| ------ this range overlaps on `10_u8`...
LL | 20..=30 => {}
+LL | 10..=20 => {}
+ | ^^^^^^^ ... with this range
+ |
+ = note: you likely meant to write mutually exclusive ranges
+
+error: multiple patterns overlap on their endpoints
+ --> $DIR/overlapping_range_endpoints.rs:39:9
+ |
+LL | 20..=30 => {}
| ------- this range overlaps on `20_u8`...
LL | 10..=20 => {}
| ^^^^^^^ ... with this range
@@ -66,7 +75,28 @@ LL | 10..=20 => {}
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
- --> $DIR/overlapping_range_endpoints.rs:50:16
+ --> $DIR/overlapping_range_endpoints.rs:46:10
+ |
+LL | (0..=10, true) => {}
+ | ------ this range overlaps on `10_u8`...
+LL | (10..20, true) => {}
+ | ^^^^^^ ... with this range
+ |
+ = note: you likely meant to write mutually exclusive ranges
+
+error: multiple patterns overlap on their endpoints
+ --> $DIR/overlapping_range_endpoints.rs:47:10
+ |
+LL | (0..=10, true) => {}
+ | ------ this range overlaps on `10_u8`...
+LL | (10..20, true) => {}
+LL | (10..20, false) => {}
+ | ^^^^^^ ... with this range
+ |
+ = note: you likely meant to write mutually exclusive ranges
+
+error: multiple patterns overlap on their endpoints
+ --> $DIR/overlapping_range_endpoints.rs:52:16
|
LL | (true, 0..=10) => {}
| ------ this range overlaps on `10_u8`...
@@ -76,7 +106,18 @@ LL | (true, 10..20) => {}
= note: you likely meant to write mutually exclusive ranges
error: multiple patterns overlap on their endpoints
- --> $DIR/overlapping_range_endpoints.rs:56:14
+ --> $DIR/overlapping_range_endpoints.rs:53:17
+ |
+LL | (true, 0..=10) => {}
+ | ------ this range overlaps on `10_u8`...
+LL | (true, 10..20) => {}
+LL | (false, 10..20) => {}
+ | ^^^^^^ ... with this range
+ |
+ = note: you likely meant to write mutually exclusive ranges
+
+error: multiple patterns overlap on their endpoints
+ --> $DIR/overlapping_range_endpoints.rs:58:14
|
LL | Some(0..=10) => {}
| ------ this range overlaps on `10_u8`...
@@ -85,5 +126,5 @@ LL | Some(10..20) => {}
|
= note: you likely meant to write mutually exclusive ranges
-error: aborting due to 8 previous errors
+error: aborting due to 12 previous errors
diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr
index 9f277fa1e..7f26c93aa 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr
+++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.allow.stderr
@@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: type `usize` is non-empty
- --> $DIR/pointer-sized-int.rs:48:11
+ --> $DIR/pointer-sized-int.rs:54:11
|
LL | match 7usize {}
| ^^^^^^
diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr
index df330c60b..d16ec5412 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr
+++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr
@@ -1,162 +1,162 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:12:11
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:14:11
|
LL | match 0usize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` not covered
|
= note: the matched value is of type `usize`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 0 ..= usize::MAX => {},
-LL + _ => todo!()
+LL + usize::MAX.. => todo!()
|
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:17:11
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:19:11
|
LL | match 0isize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ isize::MIN ..= isize::MAX => {},
-LL + _ => todo!()
+LL + ..isize::MIN | isize::MAX.. => todo!()
|
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:22:8
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:25:8
|
LL | m!(0usize, 0..=usize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` not covered
|
= note: the matched value is of type `usize`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
-LL | match $s { $($t)+ => {}, _ => todo!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, usize::MAX.. => todo!() }
+ | +++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:24:8
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:27:8
|
LL | m!(0usize, 0..5 | 5..=usize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` not covered
|
= note: the matched value is of type `usize`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
-LL | match $s { $($t)+ => {}, _ => todo!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, usize::MAX.. => todo!() }
+ | +++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:26:8
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:29:8
|
LL | m!(0usize, 0..usize::MAX | usize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` not covered
|
= note: the matched value is of type `usize`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
-LL | match $s { $($t)+ => {}, _ => todo!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, usize::MAX.. => todo!() }
+ | +++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `(_, _)` not covered
- --> $DIR/pointer-sized-int.rs:28:8
+error[E0004]: non-exhaustive patterns: `(usize::MAX.., _)` not covered
+ --> $DIR/pointer-sized-int.rs:31:8
|
LL | m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
- | ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ | ^^^^^^^^^^^^^^ pattern `(usize::MAX.., _)` not covered
|
= note: the matched value is of type `(usize, bool)`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
-LL | match $s { $($t)+ => {}, (_, _) => todo!() }
- | +++++++++++++++++++
+LL | match $s { $($t)+ => {}, (usize::MAX.., _) => todo!() }
+ | ++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:31:8
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:36:8
|
LL | m!(0isize, isize::MIN..=isize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
-LL | match $s { $($t)+ => {}, _ => todo!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() }
+ | ++++++++++++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:33:8
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:38:8
|
LL | m!(0isize, isize::MIN..5 | 5..=isize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
-LL | match $s { $($t)+ => {}, _ => todo!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() }
+ | ++++++++++++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:35:8
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:40:8
|
LL | m!(0isize, isize::MIN..isize::MAX | isize::MAX);
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
-LL | match $s { $($t)+ => {}, _ => todo!() }
- | ++++++++++++++
+LL | match $s { $($t)+ => {}, ..isize::MIN | isize::MAX.. => todo!() }
+ | ++++++++++++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `(_, _)` not covered
- --> $DIR/pointer-sized-int.rs:37:8
+error[E0004]: non-exhaustive patterns: `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered
+ --> $DIR/pointer-sized-int.rs:42:8
|
LL | m!((0isize, true), (isize::MIN..5, true)
- | ^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ | ^^^^^^^^^^^^^^ patterns `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered
|
= note: the matched value is of type `(isize, bool)`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
-LL | match $s { $($t)+ => {}, (_, _) => todo!() }
- | +++++++++++++++++++
+LL | match $s { $($t)+ => {}, (..isize::MIN, _) | (isize::MAX.., _) => todo!() }
+ | ++++++++++++++++++++++++++++++++++++++++++++++++++
-error[E0004]: non-exhaustive patterns: `_` not covered
- --> $DIR/pointer-sized-int.rs:41:11
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ --> $DIR/pointer-sized-int.rs:47:11
|
LL | match 0isize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ 1 ..= isize::MAX => {},
-LL + _ => todo!()
+LL + ..isize::MIN | isize::MAX.. => todo!()
|
error[E0004]: non-exhaustive patterns: type `usize` is non-empty
- --> $DIR/pointer-sized-int.rs:48:11
+ --> $DIR/pointer-sized-int.rs:54:11
|
LL | match 7usize {}
| ^^^^^^
diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs
index 1ed18c267..20a3cbe12 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs
+++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.rs
@@ -1,6 +1,7 @@
// revisions: allow deny
#![feature(exclusive_range_pattern)]
#![cfg_attr(allow, feature(precise_pointer_size_matching))]
+#![allow(overlapping_range_endpoints)]
macro_rules! m {
($s:expr, $($t:tt)+) => {
@@ -8,6 +9,7 @@ macro_rules! m {
}
}
+#[rustfmt::skip]
fn main() {
match 0usize {
//[deny]~^ ERROR non-exhaustive patterns
@@ -19,6 +21,7 @@ fn main() {
isize::MIN ..= isize::MAX => {}
}
+ m!(0usize, 0..);
m!(0usize, 0..=usize::MAX);
//[deny]~^ ERROR non-exhaustive patterns
m!(0usize, 0..5 | 5..=usize::MAX);
@@ -27,7 +30,9 @@ fn main() {
//[deny]~^ ERROR non-exhaustive patterns
m!((0usize, true), (0..5, true) | (5..=usize::MAX, true) | (0..=usize::MAX, false));
//[deny]~^ ERROR non-exhaustive patterns
+ m!(0usize, 0..=usize::MAX | usize::MAX..);
+ m!(0isize, ..0 | 0..);
m!(0isize, isize::MIN..=isize::MAX);
//[deny]~^ ERROR non-exhaustive patterns
m!(0isize, isize::MIN..5 | 5..=isize::MAX);
@@ -37,6 +42,7 @@ fn main() {
m!((0isize, true), (isize::MIN..5, true)
| (5..=isize::MAX, true) | (isize::MIN..=isize::MAX, false));
//[deny]~^^ ERROR non-exhaustive patterns
+ m!(0isize, ..=isize::MIN | isize::MIN..=isize::MAX | isize::MAX..);
match 0isize {
//[deny]~^ ERROR non-exhaustive patterns
diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs
index a2aa655ca..d60f479c0 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs
+++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.rs
@@ -1,18 +1,18 @@
// This tests that the lint message explains the reason for the error.
fn main() {
match 0usize {
- //~^ ERROR non-exhaustive patterns: `_` not covered
- //~| NOTE pattern `_` not covered
+ //~^ ERROR non-exhaustive patterns: `usize::MAX..` not covered
+ //~| NOTE pattern `usize::MAX..` not covered
//~| NOTE the matched value is of type `usize`
//~| NOTE `usize` does not have a fixed maximum value
0..=usize::MAX => {}
}
match 0isize {
- //~^ ERROR non-exhaustive patterns: `_` not covered
- //~| NOTE pattern `_` not covered
+ //~^ ERROR non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
+ //~| NOTE patterns `..isize::MIN` and `isize::MAX..` not covered
//~| NOTE the matched value is of type `isize`
- //~| NOTE `isize` does not have a fixed maximum value
+ //~| NOTE `isize` does not have fixed minimum and maximum values
isize::MIN..=isize::MAX => {}
}
}
diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr
index b80411b26..a7f93648e 100644
--- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr
+++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr
@@ -1,31 +1,31 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
--> $DIR/precise_pointer_matching-message.rs:3:11
|
LL | match 0usize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ pattern `usize::MAX..` not covered
|
= note: the matched value is of type `usize`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 0..=usize::MAX => {},
-LL + _ => todo!()
+LL + usize::MAX.. => todo!()
|
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `..isize::MIN` and `isize::MAX..` not covered
--> $DIR/precise_pointer_matching-message.rs:11:11
|
LL | match 0isize {
- | ^^^^^^ pattern `_` not covered
+ | ^^^^^^ patterns `..isize::MIN` and `isize::MAX..` not covered
|
= note: the matched value is of type `isize`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ isize::MIN..=isize::MAX => {},
-LL + _ => todo!()
+LL + ..isize::MIN | isize::MAX.. => todo!()
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/pattern/usefulness/issue-35609.stderr b/tests/ui/pattern/usefulness/issue-35609.stderr
index 6d5e2f410..9feedfde4 100644
--- a/tests/ui/pattern/usefulness/issue-35609.stderr
+++ b/tests/ui/pattern/usefulness/issue-35609.stderr
@@ -107,6 +107,9 @@ LL | match Some(A) {
|
note: `Option<Enum>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
+ ::: $SRC_DIR/core/src/option.rs:LL:COL
+ |
+ = note: not covered
= note: the matched value is of type `Option<Enum>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
diff --git a/tests/ui/pattern/usefulness/issue-39362.stderr b/tests/ui/pattern/usefulness/issue-39362.stderr
index b8b17918a..8dc534916 100644
--- a/tests/ui/pattern/usefulness/issue-39362.stderr
+++ b/tests/ui/pattern/usefulness/issue-39362.stderr
@@ -5,12 +5,12 @@ LL | match f {
| ^ patterns `Foo::Bar { bar: Bar::C, .. }`, `Foo::Bar { bar: Bar::D, .. }`, `Foo::Bar { bar: Bar::E, .. }` and 1 more not covered
|
note: `Foo` defined here
- --> $DIR/issue-39362.rs:2:5
+ --> $DIR/issue-39362.rs:1:6
|
LL | enum Foo {
- | ---
+ | ^^^
LL | Bar { bar: Bar, id: usize }
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
diff --git a/tests/ui/pattern/usefulness/issue-40221.stderr b/tests/ui/pattern/usefulness/issue-40221.stderr
index 4973e42b0..40b42af26 100644
--- a/tests/ui/pattern/usefulness/issue-40221.stderr
+++ b/tests/ui/pattern/usefulness/issue-40221.stderr
@@ -5,12 +5,12 @@ LL | match proto {
| ^^^^^ pattern `P::C(PC::QA)` not covered
|
note: `P` defined here
- --> $DIR/issue-40221.rs:2:5
+ --> $DIR/issue-40221.rs:1:6
|
LL | enum P {
- | -
+ | ^
LL | C(PC),
- | ^ not covered
+ | - not covered
= note: the matched value is of type `P`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/issue-56379.stderr b/tests/ui/pattern/usefulness/issue-56379.stderr
index b3e40b992..50e13bdfd 100644
--- a/tests/ui/pattern/usefulness/issue-56379.stderr
+++ b/tests/ui/pattern/usefulness/issue-56379.stderr
@@ -5,16 +5,16 @@ LL | match Foo::A(true) {
| ^^^^^^^^^^^^ patterns `Foo::A(false)`, `Foo::B(false)` and `Foo::C(false)` not covered
|
note: `Foo` defined here
- --> $DIR/issue-56379.rs:2:5
+ --> $DIR/issue-56379.rs:1:6
|
LL | enum Foo {
- | ---
+ | ^^^
LL | A(bool),
- | ^ not covered
+ | - not covered
LL | B(bool),
- | ^ not covered
+ | - not covered
LL | C(bool),
- | ^ not covered
+ | - not covered
= note: the matched value is of type `Foo`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs
index 8f58227ee..6cbcfed70 100644
--- a/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs
+++ b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.rs
@@ -6,19 +6,19 @@ struct B<T, U>(T, U);
fn main() {
match 0 {
- //~^ ERROR non-exhaustive patterns: `_` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `usize::MAX..` not covered [E0004]
0 => (),
1..=usize::MAX => (),
}
match (0usize, 0usize) {
- //~^ ERROR non-exhaustive patterns: `(_, _)` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `(usize::MAX.., _)` not covered [E0004]
(0, 0) => (),
(1..=usize::MAX, 1..=usize::MAX) => (),
}
match (0isize, 0usize) {
- //~^ ERROR non-exhaustive patterns: `(_, _)` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered [E0004]
(isize::MIN..=isize::MAX, 0) => (),
(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
}
@@ -30,14 +30,14 @@ fn main() {
}
match Some(4) {
- //~^ ERROR non-exhaustive patterns: `Some(_)` not covered
+ //~^ ERROR non-exhaustive patterns: `Some(usize::MAX..)` not covered
Some(0) => (),
Some(1..=usize::MAX) => (),
None => (),
}
match Some(Some(Some(0))) {
- //~^ ERROR non-exhaustive patterns: `Some(Some(Some(_)))` not covered
+ //~^ ERROR non-exhaustive patterns: `Some(Some(Some(usize::MAX..)))` not covered
Some(Some(Some(0))) => (),
Some(Some(Some(1..=usize::MAX))) => (),
Some(Some(None)) => (),
@@ -46,13 +46,13 @@ fn main() {
}
match (A { a: 0usize }) {
- //~^ ERROR non-exhaustive patterns: `A { .. }` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `A { a: usize::MAX.. }` not covered [E0004]
A { a: 0 } => (),
A { a: 1..=usize::MAX } => (),
}
match B(0isize, 0usize) {
- //~^ ERROR non-exhaustive patterns: `B(_, _)` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `B(..isize::MIN, _)` and `B(isize::MAX.., _)` not covered [E0004]
B(isize::MIN..=isize::MAX, 0) => (),
B(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
}
@@ -60,7 +60,7 @@ fn main() {
// Should report only the note about usize not having fixed max value and not report
// report the note about isize
match B(0isize, 0usize) {
- //~^ ERROR non-exhaustive patterns: `B(_, _)` not covered [E0004]
+ //~^ ERROR non-exhaustive patterns: `B(_, usize::MAX..)` not covered [E0004]
B(_, 0) => (),
B(_, 1..=usize::MAX) => (),
}
diff --git a/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr
index ea1d99e20..556efcda5 100644
--- a/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr
+++ b/tests/ui/pattern/usefulness/issue-85222-types-containing-non-exhaustive-types.stderr
@@ -1,46 +1,46 @@
-error[E0004]: non-exhaustive patterns: `_` not covered
+error[E0004]: non-exhaustive patterns: `usize::MAX..` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:8:11
|
LL | match 0 {
- | ^ pattern `_` not covered
+ | ^ pattern `usize::MAX..` not covered
|
= note: the matched value is of type `usize`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ 1..=usize::MAX => (),
-LL ~ _ => todo!(),
+LL ~ usize::MAX.. => todo!(),
|
-error[E0004]: non-exhaustive patterns: `(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `(usize::MAX.., _)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:14:11
|
LL | match (0usize, 0usize) {
- | ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ | ^^^^^^^^^^^^^^^^ pattern `(usize::MAX.., _)` not covered
|
= note: the matched value is of type `(usize, usize)`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ (1..=usize::MAX, 1..=usize::MAX) => (),
-LL ~ (_, _) => todo!(),
+LL ~ (usize::MAX.., _) => todo!(),
|
-error[E0004]: non-exhaustive patterns: `(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:20:11
|
LL | match (0isize, 0usize) {
- | ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+ | ^^^^^^^^^^^^^^^^ patterns `(..isize::MIN, _)` and `(isize::MAX.., _)` not covered
|
= note: the matched value is of type `(isize, usize)`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ (isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
-LL ~ (_, _) => todo!(),
+LL ~ (..isize::MIN, _) | (isize::MAX.., _) => todo!(),
|
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
@@ -61,11 +61,11 @@ LL ~ None => {},
LL + Some(_) => todo!()
|
-error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+error[E0004]: non-exhaustive patterns: `Some(usize::MAX..)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:32:11
|
LL | match Some(4) {
- | ^^^^^^^ pattern `Some(_)` not covered
+ | ^^^^^^^ pattern `Some(usize::MAX..)` not covered
|
note: `Option<usize>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -73,19 +73,19 @@ note: `Option<usize>` defined here
|
= note: not covered
= note: the matched value is of type `Option<usize>`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ None => (),
-LL ~ Some(_) => todo!(),
+LL ~ Some(usize::MAX..) => todo!(),
|
-error[E0004]: non-exhaustive patterns: `Some(Some(Some(_)))` not covered
+error[E0004]: non-exhaustive patterns: `Some(Some(Some(usize::MAX..)))` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:39:11
|
LL | match Some(Some(Some(0))) {
- | ^^^^^^^^^^^^^^^^^^^ pattern `Some(Some(Some(_)))` not covered
+ | ^^^^^^^^^^^^^^^^^^^ pattern `Some(Some(Some(usize::MAX..)))` not covered
|
note: `Option<Option<Option<usize>>>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -97,19 +97,19 @@ note: `Option<Option<Option<usize>>>` defined here
|
= note: not covered
= note: the matched value is of type `Option<Option<Option<usize>>>`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ None => (),
-LL ~ Some(Some(Some(_))) => todo!(),
+LL ~ Some(Some(Some(usize::MAX..))) => todo!(),
|
-error[E0004]: non-exhaustive patterns: `A { .. }` not covered
+error[E0004]: non-exhaustive patterns: `A { a: usize::MAX.. }` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:48:11
|
LL | match (A { a: 0usize }) {
- | ^^^^^^^^^^^^^^^^^ pattern `A { .. }` not covered
+ | ^^^^^^^^^^^^^^^^^ pattern `A { a: usize::MAX.. }` not covered
|
note: `A<usize>` defined here
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:1:8
@@ -117,19 +117,19 @@ note: `A<usize>` defined here
LL | struct A<T> {
| ^
= note: the matched value is of type `A<usize>`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ A { a: 1..=usize::MAX } => (),
-LL ~ A { .. } => todo!(),
+LL ~ A { a: usize::MAX.. } => todo!(),
|
-error[E0004]: non-exhaustive patterns: `B(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `B(..isize::MIN, _)` and `B(isize::MAX.., _)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:54:11
|
LL | match B(0isize, 0usize) {
- | ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered
+ | ^^^^^^^^^^^^^^^^^ patterns `B(..isize::MIN, _)` and `B(isize::MAX.., _)` not covered
|
note: `B<isize, usize>` defined here
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8
@@ -137,19 +137,19 @@ note: `B<isize, usize>` defined here
LL | struct B<T, U>(T, U);
| ^
= note: the matched value is of type `B<isize, usize>`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `isize` does not have fixed minimum and maximum values, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ B(isize::MIN..=isize::MAX, 1..=usize::MAX) => (),
-LL ~ B(_, _) => todo!(),
+LL ~ B(..isize::MIN, _) | B(isize::MAX.., _) => todo!(),
|
-error[E0004]: non-exhaustive patterns: `B(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `B(_, usize::MAX..)` not covered
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:62:11
|
LL | match B(0isize, 0usize) {
- | ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered
+ | ^^^^^^^^^^^^^^^^^ pattern `B(_, usize::MAX..)` not covered
|
note: `B<isize, usize>` defined here
--> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8
@@ -157,12 +157,12 @@ note: `B<isize, usize>` defined here
LL | struct B<T, U>(T, U);
| ^
= note: the matched value is of type `B<isize, usize>`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
+ = note: `usize` does not have a fixed maximum value, so half-open ranges are necessary to match exhaustively
= help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ B(_, 1..=usize::MAX) => (),
-LL ~ B(_, _) => todo!(),
+LL ~ B(_, usize::MAX..) => todo!(),
|
error: aborting due to 9 previous errors
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs
index 5145f7690..1d1ea8e49 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs
+++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs
@@ -1,10 +1,15 @@
+#![feature(custom_inner_attributes)]
+#![rustfmt::skip]
// Test the "defined here" and "not covered" diagnostic hints.
// We also make sure that references are peeled off from the scrutinee type
// so that the diagnostics work better with default binding modes.
#[derive(Clone)]
enum E {
- //~^ NOTE
+ //~^ NOTE `E` defined here
+ //~| NOTE `E` defined here
+ //~| NOTE `E` defined here
+ //~| NOTE
//~| NOTE
//~| NOTE
//~| NOTE
@@ -12,10 +17,7 @@ enum E {
//~| NOTE
A,
B,
- //~^ NOTE `E` defined here
- //~| NOTE `E` defined here
- //~| NOTE `E` defined here
- //~| NOTE not covered
+ //~^ NOTE not covered
//~| NOTE not covered
//~| NOTE not covered
//~| NOTE not covered
@@ -79,12 +81,12 @@ fn by_ref_thrice(e: & &mut &E) {
}
enum Opt {
- //~^ NOTE
+ //~^ NOTE `Opt` defined here
+ //~| NOTE
//~| NOTE
Some(u8),
None,
- //~^ NOTE `Opt` defined here
- //~| NOTE not covered
+ //~^ NOTE not covered
//~| NOTE not covered
}
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
index 8489e2f14..a9e55fa53 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr
@@ -1,20 +1,20 @@
error[E0004]: non-exhaustive patterns: `E::B` and `E::C` not covered
- --> $DIR/non-exhaustive-defined-here.rs:35:11
+ --> $DIR/non-exhaustive-defined-here.rs:37:11
|
LL | match e1 {
| ^^ patterns `E::B` and `E::C` not covered
|
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:14:5
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
- | -
+ | ^
...
LL | B,
- | ^ not covered
+ | - not covered
...
LL | C
- | ^ not covered
+ | - not covered
= note: the matched value is of type `E`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -23,7 +23,7 @@ LL + E::B | E::C => todo!()
|
error[E0005]: refutable pattern in local binding
- --> $DIR/non-exhaustive-defined-here.rs:41:9
+ --> $DIR/non-exhaustive-defined-here.rs:43:9
|
LL | let E::A = e;
| ^^^^ patterns `E::B` and `E::C` not covered
@@ -31,7 +31,7 @@ LL | let E::A = e;
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:6:6
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
| ^
@@ -48,22 +48,22 @@ LL | if let E::A = e { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `&E::B` and `&E::C` not covered
- --> $DIR/non-exhaustive-defined-here.rs:50:11
+ --> $DIR/non-exhaustive-defined-here.rs:52:11
|
LL | match e {
| ^ patterns `&E::B` and `&E::C` not covered
|
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:14:5
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
- | -
+ | ^
...
LL | B,
- | ^ not covered
+ | - not covered
...
LL | C
- | ^ not covered
+ | - not covered
= note: the matched value is of type `&E`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -72,7 +72,7 @@ LL + &E::B | &E::C => todo!()
|
error[E0005]: refutable pattern in local binding
- --> $DIR/non-exhaustive-defined-here.rs:57:9
+ --> $DIR/non-exhaustive-defined-here.rs:59:9
|
LL | let E::A = e;
| ^^^^ patterns `&E::B` and `&E::C` not covered
@@ -80,7 +80,7 @@ LL | let E::A = e;
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:6:6
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
| ^
@@ -97,22 +97,22 @@ LL | if let E::A = e { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `&&mut &E::B` and `&&mut &E::C` not covered
- --> $DIR/non-exhaustive-defined-here.rs:66:11
+ --> $DIR/non-exhaustive-defined-here.rs:68:11
|
LL | match e {
| ^ patterns `&&mut &E::B` and `&&mut &E::C` not covered
|
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:14:5
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
- | -
+ | ^
...
LL | B,
- | ^ not covered
+ | - not covered
...
LL | C
- | ^ not covered
+ | - not covered
= note: the matched value is of type `&&mut &E`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -121,7 +121,7 @@ LL + &&mut &E::B | &&mut &E::C => todo!()
|
error[E0005]: refutable pattern in local binding
- --> $DIR/non-exhaustive-defined-here.rs:73:9
+ --> $DIR/non-exhaustive-defined-here.rs:75:9
|
LL | let E::A = e;
| ^^^^ patterns `&&mut &E::B` and `&&mut &E::C` not covered
@@ -129,7 +129,7 @@ LL | let E::A = e;
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `E` defined here
- --> $DIR/non-exhaustive-defined-here.rs:6:6
+ --> $DIR/non-exhaustive-defined-here.rs:8:6
|
LL | enum E {
| ^
@@ -146,19 +146,19 @@ LL | if let E::A = e { todo!() };
| ++ +++++++++++
error[E0004]: non-exhaustive patterns: `Opt::None` not covered
- --> $DIR/non-exhaustive-defined-here.rs:92:11
+ --> $DIR/non-exhaustive-defined-here.rs:94:11
|
LL | match e {
| ^ pattern `Opt::None` not covered
|
note: `Opt` defined here
- --> $DIR/non-exhaustive-defined-here.rs:85:5
+ --> $DIR/non-exhaustive-defined-here.rs:83:6
|
LL | enum Opt {
- | ---
+ | ^^^
...
LL | None,
- | ^^^^ not covered
+ | ---- not covered
= note: the matched value is of type `Opt`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
@@ -167,7 +167,7 @@ LL + Opt::None => todo!()
|
error[E0005]: refutable pattern in local binding
- --> $DIR/non-exhaustive-defined-here.rs:99:9
+ --> $DIR/non-exhaustive-defined-here.rs:101:9
|
LL | let Opt::Some(ref _x) = e;
| ^^^^^^^^^^^^^^^^^ pattern `Opt::None` not covered
@@ -175,7 +175,7 @@ LL | let Opt::Some(ref _x) = e;
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Opt` defined here
- --> $DIR/non-exhaustive-defined-here.rs:81:6
+ --> $DIR/non-exhaustive-defined-here.rs:83:6
|
LL | enum Opt {
| ^^^
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr
index 98e417a17..310049fe1 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr
@@ -18,10 +18,10 @@ LL | match x {
| ^ pattern `T::A(U::C)` not covered
|
note: `T` defined here
- --> $DIR/non-exhaustive-match-nested.rs:1:10
+ --> $DIR/non-exhaustive-match-nested.rs:1:6
|
LL | enum T { A(U), B }
- | - ^ not covered
+ | ^ - not covered
= note: the matched value is of type `T`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr
index e59e8885e..4bebd3cbb 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr
@@ -5,10 +5,10 @@ LL | match x { T::B => { } }
| ^ pattern `T::A` not covered
|
note: `T` defined here
- --> $DIR/non-exhaustive-match.rs:3:10
+ --> $DIR/non-exhaustive-match.rs:3:6
|
LL | enum T { A, B }
- | - ^ not covered
+ | ^ - not covered
= note: the matched value is of type `T`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
@@ -79,10 +79,10 @@ LL | match T::A {
| ^^^^ pattern `T::B` not covered
|
note: `T` defined here
- --> $DIR/non-exhaustive-match.rs:3:13
+ --> $DIR/non-exhaustive-match.rs:3:6
|
LL | enum T { A, B }
- | - ^ not covered
+ | ^ - not covered
= note: the matched value is of type `T`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs
index 4bd344219..9e60d4f41 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs
+++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.rs
@@ -1,88 +1,101 @@
struct Foo {
first: bool,
- second: Option<[usize; 4]>
+ second: Option<[usize; 4]>,
}
fn struct_with_a_nested_enum_and_vector() {
match (Foo { first: true, second: None }) {
-//~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
+ //~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([0_usize, _, _, _]) }` and `Foo { first: false, second: Some([2_usize.., _, _, _]) }` not covered
Foo { first: true, second: None } => (),
Foo { first: true, second: Some(_) } => (),
Foo { first: false, second: None } => (),
- Foo { first: false, second: Some([1, 2, 3, 4]) } => ()
+ Foo { first: false, second: Some([1, 2, 3, 4]) } => (),
}
}
enum Color {
Red,
Green,
- CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
+ CustomRGBA { a: bool, r: u8, g: u8, b: u8 },
}
fn enum_with_single_missing_variant() {
match Color::Red {
- //~^ ERROR non-exhaustive patterns: `Color::Red` not covered
+ //~^ ERROR non-exhaustive patterns: `Color::Red` not covered
Color::CustomRGBA { .. } => (),
- Color::Green => ()
+ Color::Green => (),
}
}
enum Direction {
- North, East, South, West
+ North,
+ East,
+ South,
+ West,
}
fn enum_with_multiple_missing_variants() {
match Direction::North {
- //~^ ERROR non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered
- Direction::North => ()
+ //~^ ERROR non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered
+ Direction::North => (),
}
}
enum ExcessiveEnum {
- First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth
+ First,
+ Second,
+ Third,
+ Fourth,
+ Fifth,
+ Sixth,
+ Seventh,
+ Eighth,
+ Ninth,
+ Tenth,
+ Eleventh,
+ Twelfth,
}
fn enum_with_excessive_missing_variants() {
match ExcessiveEnum::First {
- //~^ ERROR `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered
-
- ExcessiveEnum::First => ()
+ //~^ ERROR `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered
+ ExcessiveEnum::First => (),
}
}
fn enum_struct_variant() {
match Color::Red {
- //~^ ERROR non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered
+ //~^ ERROR non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered
Color::Red => (),
Color::Green => (),
Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (),
- Color::CustomRGBA { a: false, r: _, g: _, b: _ } => ()
+ Color::CustomRGBA { a: false, r: _, g: _, b: _ } => (),
}
}
enum Enum {
First,
- Second(bool)
+ Second(bool),
}
fn vectors_with_nested_enums() {
let x: &'static [Enum] = &[Enum::First, Enum::Second(false)];
match *x {
- //~^ ERROR non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered
+ //~^ ERROR non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered
[] => (),
[_] => (),
[Enum::First, _] => (),
[Enum::Second(true), Enum::First] => (),
[Enum::Second(true), Enum::Second(true)] => (),
[Enum::Second(false), _] => (),
- [_, _, ref tail @ .., _] => ()
+ [_, _, ref tail @ .., _] => (),
}
}
fn missing_nil() {
match ((), false) {
- //~^ ERROR non-exhaustive patterns: `((), false)` not covered
- ((), true) => ()
+ //~^ ERROR non-exhaustive patterns: `((), false)` not covered
+ ((), true) => (),
}
}
diff --git a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
index d798ec722..cceb1d8f6 100644
--- a/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
+++ b/tests/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr
@@ -1,8 +1,8 @@
-error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
+error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([0_usize, _, _, _]) }` and `Foo { first: false, second: Some([2_usize.., _, _, _]) }` not covered
--> $DIR/non-exhaustive-pattern-witness.rs:7:11
|
LL | match (Foo { first: true, second: None }) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo { first: false, second: Some([0_usize, _, _, _]) }` and `Foo { first: false, second: Some([2_usize.., _, _, _]) }` not covered
|
note: `Foo` defined here
--> $DIR/non-exhaustive-pattern-witness.rs:1:8
@@ -10,12 +10,10 @@ note: `Foo` defined here
LL | struct Foo {
| ^^^
= note: the matched value is of type `Foo`
- = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
- = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ Foo { first: false, second: Some([1, 2, 3, 4]) } => (),
-LL + Foo { first: false, second: Some([_, _, _, _]) } => todo!()
+LL ~ Foo { first: false, second: Some([0_usize, _, _, _]) } | Foo { first: false, second: Some([2_usize.., _, _, _]) } => todo!(),
|
error[E0004]: non-exhaustive patterns: `Color::Red` not covered
@@ -25,83 +23,96 @@ LL | match Color::Red {
| ^^^^^^^^^^ pattern `Color::Red` not covered
|
note: `Color` defined here
- --> $DIR/non-exhaustive-pattern-witness.rs:17:5
+ --> $DIR/non-exhaustive-pattern-witness.rs:16:6
|
LL | enum Color {
- | -----
+ | ^^^^^
LL | Red,
- | ^^^ not covered
+ | --- not covered
= note: the matched value is of type `Color`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Color::Green => (),
-LL + Color::Red => todo!()
+LL ~ Color::Red => todo!(),
|
error[E0004]: non-exhaustive patterns: `Direction::East`, `Direction::South` and `Direction::West` not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:35:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:38:11
|
LL | match Direction::North {
| ^^^^^^^^^^^^^^^^ patterns `Direction::East`, `Direction::South` and `Direction::West` not covered
|
note: `Direction` defined here
- --> $DIR/non-exhaustive-pattern-witness.rs:31:12
+ --> $DIR/non-exhaustive-pattern-witness.rs:30:6
|
LL | enum Direction {
- | ---------
-LL | North, East, South, West
- | ^^^^ ^^^^^ ^^^^ not covered
- | | |
- | | not covered
- | not covered
+ | ^^^^^^^^^
+LL | North,
+LL | East,
+ | ---- not covered
+LL | South,
+ | ----- not covered
+LL | West,
+ | ---- not covered
= note: the matched value is of type `Direction`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ Direction::North => (),
-LL + Direction::East | Direction::South | Direction::West => todo!()
+LL ~ Direction::East | Direction::South | Direction::West => todo!(),
|
error[E0004]: non-exhaustive patterns: `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:46:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:60:11
|
LL | match ExcessiveEnum::First {
| ^^^^^^^^^^^^^^^^^^^^ patterns `ExcessiveEnum::Second`, `ExcessiveEnum::Third`, `ExcessiveEnum::Fourth` and 8 more not covered
|
note: `ExcessiveEnum` defined here
- --> $DIR/non-exhaustive-pattern-witness.rs:41:6
+ --> $DIR/non-exhaustive-pattern-witness.rs:44:6
|
LL | enum ExcessiveEnum {
| ^^^^^^^^^^^^^
+LL | First,
+LL | Second,
+ | ------ not covered
+LL | Third,
+ | ----- not covered
+LL | Fourth,
+ | ------ not covered
+LL | Fifth,
+ | ----- not covered
+LL | Sixth,
+ | ----- not covered
= note: the matched value is of type `ExcessiveEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms
|
LL ~ ExcessiveEnum::First => (),
-LL + _ => todo!()
+LL ~ _ => todo!(),
|
error[E0004]: non-exhaustive patterns: `Color::CustomRGBA { a: true, .. }` not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:54:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:67:11
|
LL | match Color::Red {
| ^^^^^^^^^^ pattern `Color::CustomRGBA { a: true, .. }` not covered
|
note: `Color` defined here
- --> $DIR/non-exhaustive-pattern-witness.rs:19:5
+ --> $DIR/non-exhaustive-pattern-witness.rs:16:6
|
LL | enum Color {
- | -----
+ | ^^^^^
...
-LL | CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
- | ^^^^^^^^^^ not covered
+LL | CustomRGBA { a: bool, r: u8, g: u8, b: u8 },
+ | ---------- not covered
= note: the matched value is of type `Color`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ Color::CustomRGBA { a: false, r: _, g: _, b: _ } => (),
-LL + Color::CustomRGBA { a: true, .. } => todo!()
+LL ~ Color::CustomRGBA { a: true, .. } => todo!(),
|
error[E0004]: non-exhaustive patterns: `[Enum::Second(true), Enum::Second(false)]` not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:70:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:83:11
|
LL | match *x {
| ^^ pattern `[Enum::Second(true), Enum::Second(false)]` not covered
@@ -110,11 +121,11 @@ LL | match *x {
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ [_, _, ref tail @ .., _] => (),
-LL + [Enum::Second(true), Enum::Second(false)] => todo!()
+LL ~ [Enum::Second(true), Enum::Second(false)] => todo!(),
|
error[E0004]: non-exhaustive patterns: `((), false)` not covered
- --> $DIR/non-exhaustive-pattern-witness.rs:83:11
+ --> $DIR/non-exhaustive-pattern-witness.rs:96:11
|
LL | match ((), false) {
| ^^^^^^^^^^^ pattern `((), false)` not covered
@@ -123,7 +134,7 @@ LL | match ((), false) {
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
LL ~ ((), true) => (),
-LL + ((), false) => todo!()
+LL ~ ((), false) => todo!(),
|
error: aborting due to 7 previous errors
diff --git a/tests/ui/pattern/usefulness/refutable-pattern-errors.rs b/tests/ui/pattern/usefulness/refutable-pattern-errors.rs
index 7a3e991d5..7603da1bb 100644
--- a/tests/ui/pattern/usefulness/refutable-pattern-errors.rs
+++ b/tests/ui/pattern/usefulness/refutable-pattern-errors.rs
@@ -1,6 +1,6 @@
-fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
+fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) {}
//~^ ERROR refutable pattern in function argument
-//~| `(_, _)` not covered
+//~| `(..=0_isize, _)` and `(2_isize.., _)` not covered
fn main() {
let (1, (Some(1), 2..=3)) = (1, (None, 2));
diff --git a/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr b/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr
index beb51a4d4..e66cd1130 100644
--- a/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr
+++ b/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr
@@ -1,8 +1,8 @@
error[E0005]: refutable pattern in function argument
--> $DIR/refutable-pattern-errors.rs:1:9
|
-LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
- | ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) {}
+ | ^^^^^^^^^^^^^^^^^^^^^ patterns `(..=0_isize, _)` and `(2_isize.., _)` not covered
|
= note: the matched value is of type `(isize, (Option<isize>, isize))`
diff --git a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs
index 17dc38ab2..4203dd94d 100644
--- a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs
+++ b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.rs
@@ -1,6 +1,6 @@
fn main() {
let f = |3: isize| println!("hello");
//~^ ERROR refutable pattern in function argument
- //~| `_` not covered
+ //~| `..=2_isize` and `4_isize..` not covered
f(4);
}
diff --git a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr
index ab3f6f69f..01f077909 100644
--- a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr
+++ b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr
@@ -2,7 +2,7 @@ error[E0005]: refutable pattern in function argument
--> $DIR/refutable-pattern-in-fn-arg.rs:2:14
|
LL | let f = |3: isize| println!("hello");
- | ^ pattern `_` not covered
+ | ^ patterns `..=2_isize` and `4_isize..` not covered
|
= note: the matched value is of type `isize`
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
diff --git a/tests/ui/pattern/usefulness/slice_of_empty.rs b/tests/ui/pattern/usefulness/slice_of_empty.rs
new file mode 100644
index 000000000..fe0688711
--- /dev/null
+++ b/tests/ui/pattern/usefulness/slice_of_empty.rs
@@ -0,0 +1,22 @@
+#![feature(never_type)]
+#![feature(exhaustive_patterns)]
+#![deny(unreachable_patterns)]
+
+fn main() {}
+
+fn foo(nevers: &[!]) {
+ match nevers {
+ &[] => (),
+ };
+
+ match nevers {
+ &[] => (),
+ &[_] => (), //~ ERROR unreachable pattern
+ &[_, _, ..] => (), //~ ERROR unreachable pattern
+ };
+
+ match nevers {
+ //~^ ERROR non-exhaustive patterns: `&[]` not covered
+ &[_] => (), //~ ERROR unreachable pattern
+ };
+}
diff --git a/tests/ui/pattern/usefulness/slice_of_empty.stderr b/tests/ui/pattern/usefulness/slice_of_empty.stderr
new file mode 100644
index 000000000..07bb6b3a6
--- /dev/null
+++ b/tests/ui/pattern/usefulness/slice_of_empty.stderr
@@ -0,0 +1,39 @@
+error: unreachable pattern
+ --> $DIR/slice_of_empty.rs:14:9
+ |
+LL | &[_] => (),
+ | ^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/slice_of_empty.rs:3:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/slice_of_empty.rs:15:9
+ |
+LL | &[_, _, ..] => (),
+ | ^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/slice_of_empty.rs:20:9
+ |
+LL | &[_] => (),
+ | ^^^^
+
+error[E0004]: non-exhaustive patterns: `&[]` not covered
+ --> $DIR/slice_of_empty.rs:18:11
+ |
+LL | match nevers {
+ | ^^^^^^ pattern `&[]` not covered
+ |
+ = note: the matched value is of type `&[!]`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+ |
+LL | &[_] => (), &[] => todo!(),
+ | ++++++++++++++++
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr
index f944c25a9..f75517fb7 100644
--- a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr
+++ b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr
@@ -5,13 +5,13 @@ LL | match UnstableEnum::Stable {
| ^^^^^^^^^^^^^^^^^^^^ patterns `UnstableEnum::Stable2` and `_` not covered
|
note: `UnstableEnum` defined here
- --> $DIR/auxiliary/unstable.rs:9:5
+ --> $DIR/auxiliary/unstable.rs:5:1
|
LL | pub enum UnstableEnum {
- | ---------------------
+ | ^^^^^^^^^^^^^^^^^^^^^
...
LL | Stable2,
- | ^^^^^^^ not covered
+ | ------- not covered
= note: the matched value is of type `UnstableEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr
index 22425aa0d..3d2b540a9 100644
--- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr
+++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr
@@ -5,12 +5,12 @@ LL | match x {
| ^ pattern `A::B { x: Some(_) }` not covered
|
note: `A` defined here
- --> $DIR/struct-like-enum-nonexhaustive.rs:2:5
+ --> $DIR/struct-like-enum-nonexhaustive.rs:1:6
|
LL | enum A {
- | -
+ | ^
LL | B { x: Option<isize> },
- | ^ not covered
+ | - not covered
= note: the matched value is of type `A`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
index 50c7fc889..ef707ed4a 100644
--- a/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
+++ b/tests/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr
@@ -1,8 +1,8 @@
-error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered
+error[E0004]: non-exhaustive patterns: `Foo(..=0_isize, _)` and `Foo(3_isize.., _)` not covered
--> $DIR/tuple-struct-nonexhaustive.rs:5:11
|
LL | match x {
- | ^ pattern `Foo(_, _)` not covered
+ | ^ patterns `Foo(..=0_isize, _)` and `Foo(3_isize.., _)` not covered
|
note: `Foo` defined here
--> $DIR/tuple-struct-nonexhaustive.rs:1:8
@@ -10,12 +10,10 @@ note: `Foo` defined here
LL | struct Foo(isize, isize);
| ^^^
= note: the matched value is of type `Foo`
- = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively
- = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ Foo(2, b) => println!("{}", b),
-LL + Foo(_, _) => todo!()
+LL + Foo(..=0_isize, _) | Foo(3_isize.., _) => todo!()
|
error: aborting due to previous error
diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr
index d776249b2..4a4945156 100644
--- a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr
+++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr
@@ -5,13 +5,13 @@ LL | match UnstableEnum::Stable {
| ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Unstable` not covered
|
note: `UnstableEnum` defined here
- --> $DIR/auxiliary/unstable.rs:11:5
+ --> $DIR/auxiliary/unstable.rs:5:1
|
LL | pub enum UnstableEnum {
- | ---------------------
+ | ^^^^^^^^^^^^^^^^^^^^^
...
LL | Unstable,
- | ^^^^^^^^ not covered
+ | -------- not covered
= note: the matched value is of type `UnstableEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
diff --git a/tests/ui/polymorphization/generators.rs b/tests/ui/polymorphization/coroutine.rs
index 779bac0ac..3f28e89e3 100644
--- a/tests/ui/polymorphization/generators.rs
+++ b/tests/ui/polymorphization/coroutine.rs
@@ -1,10 +1,10 @@
// build-fail
// compile-flags:-Zpolymorphize=on -Zinline-mir=off
-#![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)]
+#![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)]
//~^ WARN the feature `generic_const_exprs` is incomplete
use std::marker::Unpin;
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
enum YieldOrReturn<Y, R> {
@@ -14,13 +14,13 @@ enum YieldOrReturn<Y, R> {
fn finish<T, Y, R>(mut t: T) -> Vec<YieldOrReturn<Y, R>>
where
- T: Generator<(), Yield = Y, Return = R> + Unpin,
+ T: Coroutine<(), Yield = Y, Return = R> + Unpin,
{
let mut results = Vec::new();
loop {
match Pin::new(&mut t).resume(()) {
- GeneratorState::Yielded(yielded) => results.push(YieldOrReturn::Yield(yielded)),
- GeneratorState::Complete(returned) => {
+ CoroutineState::Yielded(yielded) => results.push(YieldOrReturn::Yield(yielded)),
+ CoroutineState::Complete(returned) => {
results.push(YieldOrReturn::Return(returned));
return results;
}
@@ -28,10 +28,10 @@ where
}
}
-// This test checks that the polymorphization analysis functions on generators.
+// This test checks that the polymorphization analysis functions on coroutines.
#[rustc_polymorphize_error]
-pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
+pub fn unused_type<T>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin {
|| {
//~^ ERROR item has unused generic parameters
yield 1;
@@ -40,7 +40,7 @@ pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin
}
#[rustc_polymorphize_error]
-pub fn used_type_in_yield<Y: Default>() -> impl Generator<(), Yield = Y, Return = u32> + Unpin {
+pub fn used_type_in_yield<Y: Default>() -> impl Coroutine<(), Yield = Y, Return = u32> + Unpin {
|| {
yield Y::default();
2
@@ -48,7 +48,7 @@ pub fn used_type_in_yield<Y: Default>() -> impl Generator<(), Yield = Y, Return
}
#[rustc_polymorphize_error]
-pub fn used_type_in_return<R: Default>() -> impl Generator<(), Yield = u32, Return = R> + Unpin {
+pub fn used_type_in_return<R: Default>() -> impl Coroutine<(), Yield = u32, Return = R> + Unpin {
|| {
yield 3;
R::default()
@@ -56,7 +56,7 @@ pub fn used_type_in_return<R: Default>() -> impl Generator<(), Yield = u32, Retu
}
#[rustc_polymorphize_error]
-pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
+pub fn unused_const<const T: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin {
|| {
//~^ ERROR item has unused generic parameters
yield 1;
@@ -65,7 +65,7 @@ pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return =
}
#[rustc_polymorphize_error]
-pub fn used_const_in_yield<const Y: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin
+pub fn used_const_in_yield<const Y: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin
{
|| {
yield Y;
@@ -74,7 +74,7 @@ pub fn used_const_in_yield<const Y: u32>() -> impl Generator<(), Yield = u32, Re
}
#[rustc_polymorphize_error]
-pub fn used_const_in_return<const R: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin
+pub fn used_const_in_return<const R: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin
{
|| {
yield 4;
diff --git a/tests/ui/polymorphization/generators.stderr b/tests/ui/polymorphization/coroutine.stderr
index 32d49d25f..67b55a598 100644
--- a/tests/ui/polymorphization/generators.stderr
+++ b/tests/ui/polymorphization/coroutine.stderr
@@ -1,24 +1,24 @@
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
- --> $DIR/generators.rs:3:12
+ --> $DIR/coroutine.rs:3:12
|
-LL | #![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)]
+LL | #![feature(generic_const_exprs, coroutines, coroutine_trait, rustc_attrs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default
error: item has unused generic parameters
- --> $DIR/generators.rs:35:5
+ --> $DIR/coroutine.rs:35:5
|
-LL | pub fn unused_type<T>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
+LL | pub fn unused_type<T>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin {
| - generic parameter `T` is unused
LL | || {
| ^^
error: item has unused generic parameters
- --> $DIR/generators.rs:60:5
+ --> $DIR/coroutine.rs:60:5
|
-LL | pub fn unused_const<const T: u32>() -> impl Generator<(), Yield = u32, Return = u32> + Unpin {
+LL | pub fn unused_const<const T: u32>() -> impl Coroutine<(), Yield = u32, Return = u32> + Unpin {
| ------------ generic parameter `T` is unused
LL | || {
| ^^
diff --git a/tests/ui/print_type_sizes/generator.rs b/tests/ui/print_type_sizes/coroutine.rs
index d1cd36274..aae72e0f3 100644
--- a/tests/ui/print_type_sizes/generator.rs
+++ b/tests/ui/print_type_sizes/coroutine.rs
@@ -2,11 +2,11 @@
// build-pass
// ignore-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
-use std::ops::Generator;
+use std::ops::Coroutine;
-fn generator<const C: usize>(array: [u8; C]) -> impl Generator<Yield = (), Return = ()> {
+fn coroutine<const C: usize>(array: [u8; C]) -> impl Coroutine<Yield = (), Return = ()> {
move |()| {
yield ();
let _ = array;
@@ -14,5 +14,5 @@ fn generator<const C: usize>(array: [u8; C]) -> impl Generator<Yield = (), Retur
}
pub fn foo() {
- let _ = generator([0; 8192]);
+ let _ = coroutine([0; 8192]);
}
diff --git a/tests/ui/print_type_sizes/generator.stdout b/tests/ui/print_type_sizes/coroutine.stdout
index f8c52a595..5d5133955 100644
--- a/tests/ui/print_type_sizes/generator.stdout
+++ b/tests/ui/print_type_sizes/coroutine.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `{generator@$DIR/generator.rs:10:5: 10:14}`: 8193 bytes, alignment: 1 bytes
+print-type-size type: `{coroutine@$DIR/coroutine.rs:10:5: 10:14}`: 8193 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 8192 bytes
print-type-size upvar `.array`: 8192 bytes
diff --git a/tests/ui/print_type_sizes/generator_discr_placement.rs b/tests/ui/print_type_sizes/coroutine_discr_placement.rs
index 6adc14f9b..78fe75cde 100644
--- a/tests/ui/print_type_sizes/generator_discr_placement.rs
+++ b/tests/ui/print_type_sizes/coroutine_discr_placement.rs
@@ -2,10 +2,10 @@
// build-pass
// ignore-pass
-// Tests a generator that has its discriminant as the *final* field.
+// Tests a coroutine that has its discriminant as the *final* field.
// Avoid emitting panic handlers, like the rest of these tests...
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(dropping_copy_types)]
pub fn foo() {
diff --git a/tests/ui/print_type_sizes/generator_discr_placement.stdout b/tests/ui/print_type_sizes/coroutine_discr_placement.stdout
index f7bdee111..f34a8e9a7 100644
--- a/tests/ui/print_type_sizes/generator_discr_placement.stdout
+++ b/tests/ui/print_type_sizes/coroutine_discr_placement.stdout
@@ -1,4 +1,4 @@
-print-type-size type: `{generator@$DIR/generator_discr_placement.rs:12:13: 12:15}`: 8 bytes, alignment: 4 bytes
+print-type-size type: `{coroutine@$DIR/coroutine_discr_placement.rs:12:13: 12:15}`: 8 bytes, alignment: 4 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 0 bytes
print-type-size variant `Suspend0`: 7 bytes
diff --git a/tests/ui/privacy/associated-item-privacy-trait.rs b/tests/ui/privacy/associated-item-privacy-trait.rs
index db77a6a72..f038ae9e2 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.rs
+++ b/tests/ui/privacy/associated-item-privacy-trait.rs
@@ -23,7 +23,7 @@ mod priv_trait {
let _: <Pub as PrivTr>::AssocTy;
//~^ ERROR associated type `PrivTr::AssocTy` is private
pub type InSignatureTy = <Pub as PrivTr>::AssocTy;
- //~^ ERROR trait `PrivTr` is private
+ //~^ ERROR associated type `PrivTr::AssocTy` is private
pub trait InSignatureTr: PrivTr {}
//~^ ERROR trait `PrivTr` is private
impl PrivTr for u8 {}
diff --git a/tests/ui/privacy/associated-item-privacy-trait.stderr b/tests/ui/privacy/associated-item-privacy-trait.stderr
index eb905bf7e..4e9dfa4a8 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.stderr
+++ b/tests/ui/privacy/associated-item-privacy-trait.stderr
@@ -53,11 +53,11 @@ LL | priv_trait::mac!();
|
= note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: trait `PrivTr` is private
+error: associated type `PrivTr::AssocTy` is private
--> $DIR/associated-item-privacy-trait.rs:25:34
|
LL | pub type InSignatureTy = <Pub as PrivTr>::AssocTy;
- | ^^^^^^^^^^^^^^^^^^^^^^^^ private trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ private associated type
...
LL | priv_trait::mac!();
| ------------------ in this macro invocation
diff --git a/tests/ui/privacy/effective_visibilities.stderr b/tests/ui/privacy/effective_visibilities.stderr
index f74f812e1..41d63532d 100644
--- a/tests/ui/privacy/effective_visibilities.stderr
+++ b/tests/ui/privacy/effective_visibilities.stderr
@@ -45,6 +45,8 @@ error: not in the table
|
LL | struct PrivStruct;
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
--> $DIR/effective_visibilities.rs:25:9
@@ -81,6 +83,8 @@ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImpl
|
LL | A(
| ^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub
--> $DIR/effective_visibilities.rs:38:17
diff --git a/tests/ui/privacy/effective_visibilities_full_priv.stderr b/tests/ui/privacy/effective_visibilities_full_priv.stderr
index 29d82e2ee..0577be147 100644
--- a/tests/ui/privacy/effective_visibilities_full_priv.stderr
+++ b/tests/ui/privacy/effective_visibilities_full_priv.stderr
@@ -9,6 +9,8 @@ error: not in the table
|
LL | struct Priv;
| ^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: Direct: pub(crate), Reexported: pub(crate), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate)
--> $DIR/effective_visibilities_full_priv.rs:13:5
diff --git a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
index 6f115e78e..653dcab57 100644
--- a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
+++ b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.rs
@@ -2,13 +2,17 @@
mod rank {
pub use self::Professor::*;
//~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `self::Professor::*`
pub use self::Lieutenant::{JuniorGrade, Full};
//~^ ERROR `JuniorGrade` is private, and cannot be re-exported
//~| ERROR `Full` is private, and cannot be re-exported
+ //~| ERROR unused imports: `Full`, `JuniorGrade`
pub use self::PettyOfficer::*;
//~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `self::PettyOfficer::*`
pub use self::Crewman::*;
//~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `self::Crewman::*`
enum Professor {
Adjunct,
diff --git a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
index 59b181fab..df5968ba3 100644
--- a/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
+++ b/tests/ui/privacy/issue-46209-private-enum-variant-reexport.stderr
@@ -1,23 +1,23 @@
error[E0364]: `JuniorGrade` is private, and cannot be re-exported
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^^^^^^^^
|
note: consider marking `JuniorGrade` as `pub` in the imported module
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:32
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^^^^^^^^
error[E0364]: `Full` is private, and cannot be re-exported
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^
|
note: consider marking `Full` as `pub` in the imported module
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:5:45
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:45
|
LL | pub use self::Lieutenant::{JuniorGrade, Full};
| ^^^^
@@ -34,18 +34,42 @@ note: the lint level is defined here
LL | #[deny(unused_imports)]
| ^^^^^^^^^^^^^^
+error: unused import: `self::Professor::*`
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:3:13
+ |
+LL | pub use self::Professor::*;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: unused imports: `Full`, `JuniorGrade`
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:6:32
+ |
+LL | pub use self::Lieutenant::{JuniorGrade, Full};
+ | ^^^^^^^^^^^ ^^^^
+
error: glob import doesn't reexport anything because no candidate is public enough
- --> $DIR/issue-46209-private-enum-variant-reexport.rs:8:13
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
|
LL | pub use self::PettyOfficer::*;
| ^^^^^^^^^^^^^^^^^^^^^
-error: glob import doesn't reexport anything because no candidate is public enough
+error: unused import: `self::PettyOfficer::*`
--> $DIR/issue-46209-private-enum-variant-reexport.rs:10:13
|
+LL | pub use self::PettyOfficer::*;
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: glob import doesn't reexport anything because no candidate is public enough
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
+ |
+LL | pub use self::Crewman::*;
+ | ^^^^^^^^^^^^^^^^
+
+error: unused import: `self::Crewman::*`
+ --> $DIR/issue-46209-private-enum-variant-reexport.rs:13:13
+ |
LL | pub use self::Crewman::*;
| ^^^^^^^^^^^^^^^^
-error: aborting due to 5 previous errors
+error: aborting due to 9 previous errors
For more information about this error, try `rustc --explain E0364`.
diff --git a/tests/ui/privacy/privacy1.stderr b/tests/ui/privacy/privacy1.stderr
index ca8f242e0..a3552e146 100644
--- a/tests/ui/privacy/privacy1.stderr
+++ b/tests/ui/privacy/privacy1.stderr
@@ -21,6 +21,7 @@ note: the module `baz` is defined here
|
LL | mod baz {
| ^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0603]: module `baz` is private
--> $DIR/privacy1.rs:141:18
diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr
index 6497b7ff5..ac7e5547d 100644
--- a/tests/ui/privacy/private-in-public-warn.stderr
+++ b/tests/ui/privacy/private-in-public-warn.stderr
@@ -246,7 +246,7 @@ error: trait `traits_where::PrivTr` is more private than the item `traits_where:
--> $DIR/private-in-public-warn.rs:68:5
|
LL | impl<T> Pub<T> where T: PrivTr {}
- | ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
|
note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
--> $DIR/private-in-public-warn.rs:55:5
diff --git a/tests/ui/privacy/private-in-public.rs b/tests/ui/privacy/private-in-public.rs
index f54f9e38f..3fff2d517 100644
--- a/tests/ui/privacy/private-in-public.rs
+++ b/tests/ui/privacy/private-in-public.rs
@@ -104,8 +104,8 @@ mod aliases_pub {
// This should be OK, but associated type aliases are not substituted yet
pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- //~^ WARNING trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
- //~| WARNING type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
+ //~^ WARNING type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
+ //~| WARNING associated type `aliases_pub::PrivTr::Assoc` is more private than the item `aliases_pub::f3`
impl PrivUseAlias {
pub fn f(arg: Priv) {}
@@ -133,8 +133,8 @@ mod aliases_priv {
pub fn f1(arg: PrivUseAlias) {} //~ WARNING type `Priv1` is more private than the item `aliases_priv::f1`
pub fn f2(arg: PrivAlias) {} //~ WARNING type `Priv2` is more private than the item `aliases_priv::f2`
pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
- //~^ WARNING trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
- //~| WARNING type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
+ //~^ WARNING type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
+ //~| WARNING associated type `aliases_priv::PrivTr::Assoc` is more private than the item `aliases_priv::f3`
}
mod aliases_params {
diff --git a/tests/ui/privacy/private-in-public.stderr b/tests/ui/privacy/private-in-public.stderr
index d8f9fd007..49cc2e19b 100644
--- a/tests/ui/privacy/private-in-public.stderr
+++ b/tests/ui/privacy/private-in-public.stderr
@@ -208,7 +208,7 @@ warning: trait `traits_where::PrivTr` is more private than the item `traits_wher
--> $DIR/private-in-public.rs:52:5
|
LL | impl<T> Pub<T> where T: PrivTr {
- | ^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `traits_where::Pub<T>` is reachable at visibility `pub(crate)`
|
note: but trait `traits_where::PrivTr` is only usable at visibility `pub(self)`
--> $DIR/private-in-public.rs:42:5
@@ -276,17 +276,17 @@ note: but type `impls::Priv` is only usable at visibility `pub(self)`
LL | struct Priv;
| ^^^^^^^^^^^
-warning: trait `aliases_pub::PrivTr` is more private than the item `aliases_pub::f3`
+warning: associated type `aliases_pub::PrivTr::Assoc` is more private than the item `aliases_pub::f3`
--> $DIR/private-in-public.rs:106:5
|
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_pub::f3` is reachable at visibility `pub(crate)`
|
-note: but trait `aliases_pub::PrivTr` is only usable at visibility `pub(self)`
- --> $DIR/private-in-public.rs:100:5
+note: but associated type `aliases_pub::PrivTr::Assoc` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:101:9
|
-LL | trait PrivTr {
- | ^^^^^^^^^^^^
+LL | type Assoc = m::Pub3;
+ | ^^^^^^^^^^
warning: type `aliases_pub::Priv` is more private than the item `aliases_pub::f3`
--> $DIR/private-in-public.rs:106:5
@@ -324,17 +324,17 @@ note: but type `Priv2` is only usable at visibility `pub(self)`
LL | struct Priv2;
| ^^^^^^^^^^^^
-warning: trait `aliases_priv::PrivTr` is more private than the item `aliases_priv::f3`
+warning: associated type `aliases_priv::PrivTr::Assoc` is more private than the item `aliases_priv::f3`
--> $DIR/private-in-public.rs:135:5
|
LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `aliases_priv::f3` is reachable at visibility `pub(crate)`
|
-note: but trait `aliases_priv::PrivTr` is only usable at visibility `pub(self)`
- --> $DIR/private-in-public.rs:128:5
+note: but associated type `aliases_priv::PrivTr::Assoc` is only usable at visibility `pub(self)`
+ --> $DIR/private-in-public.rs:129:9
|
-LL | trait PrivTr {
- | ^^^^^^^^^^^^
+LL | type Assoc = Priv3;
+ | ^^^^^^^^^^
warning: type `aliases_priv::Priv` is more private than the item `aliases_priv::f3`
--> $DIR/private-in-public.rs:135:5
diff --git a/tests/ui/privacy/private-variant-reexport.rs b/tests/ui/privacy/private-variant-reexport.rs
index 688284460..b59243af6 100644
--- a/tests/ui/privacy/private-variant-reexport.rs
+++ b/tests/ui/privacy/private-variant-reexport.rs
@@ -12,7 +12,9 @@ mod m3 {
#[deny(unused_imports)]
mod m4 {
- pub use ::E::*; //~ ERROR glob import doesn't reexport anything
+ pub use ::E::*;
+ //~^ ERROR glob import doesn't reexport anything
+ //~| ERROR unused import: `::E::*`
}
enum E { V }
diff --git a/tests/ui/privacy/private-variant-reexport.stderr b/tests/ui/privacy/private-variant-reexport.stderr
index 78771ee30..2f041934a 100644
--- a/tests/ui/privacy/private-variant-reexport.stderr
+++ b/tests/ui/privacy/private-variant-reexport.stderr
@@ -42,7 +42,13 @@ note: the lint level is defined here
LL | #[deny(unused_imports)]
| ^^^^^^^^^^^^^^
-error: aborting due to 4 previous errors
+error: unused import: `::E::*`
+ --> $DIR/private-variant-reexport.rs:15:13
+ |
+LL | pub use ::E::*;
+ | ^^^^^^
+
+error: aborting due to 5 previous errors
Some errors have detailed explanations: E0364, E0365.
For more information about an error, try `rustc --explain E0364`.
diff --git a/tests/ui/privacy/sealed-traits/sealed-trait-local.rs b/tests/ui/privacy/sealed-traits/sealed-trait-local.rs
index 778ddf0f8..9ae01259a 100644
--- a/tests/ui/privacy/sealed-traits/sealed-trait-local.rs
+++ b/tests/ui/privacy/sealed-traits/sealed-trait-local.rs
@@ -13,7 +13,43 @@ pub mod a {
}
}
-struct S;
-impl a::Sealed for S {} //~ ERROR the trait bound `S: Hidden` is not satisfied
+pub mod c {
+ pub trait Sealed: self::d::Hidden {
+ fn foo() {}
+ }
+
+ struct X;
+ impl Sealed for X {}
+ impl self::d::Hidden for X {}
+
+ struct Y;
+ impl Sealed for Y {}
+ impl self::d::Hidden for Y {}
+
+ mod d {
+ pub trait Hidden {}
+ }
+}
+pub mod e {
+ pub trait Sealed: self::f::Hidden {
+ fn foo() {}
+ }
+
+ struct X;
+ impl self::f::Hidden for X {}
+
+ struct Y;
+ impl self::f::Hidden for Y {}
+ impl<T: self::f::Hidden> Sealed for T {}
+
+ mod f {
+ pub trait Hidden {}
+ }
+}
+
+struct S;
+impl a::Sealed for S {} //~ ERROR the trait bound
+impl c::Sealed for S {} //~ ERROR the trait bound
+impl e::Sealed for S {} //~ ERROR the trait bound
fn main() {}
diff --git a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
index 5f8076fc8..a7f77a1c0 100644
--- a/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
+++ b/tests/ui/privacy/sealed-traits/sealed-trait-local.stderr
@@ -1,16 +1,50 @@
-error[E0277]: the trait bound `S: Hidden` is not satisfied
- --> $DIR/sealed-trait-local.rs:17:20
+error[E0277]: the trait bound `S: b::Hidden` is not satisfied
+ --> $DIR/sealed-trait-local.rs:52:20
|
LL | impl a::Sealed for S {}
- | ^ the trait `Hidden` is not implemented for `S`
+ | ^ the trait `b::Hidden` is not implemented for `S`
|
-note: required by a bound in `Sealed`
+note: required by a bound in `a::Sealed`
--> $DIR/sealed-trait-local.rs:3:23
|
LL | pub trait Sealed: self::b::Hidden {
| ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
= note: `Sealed` is a "sealed trait", because to implement it you also need to implement `a::b::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = help: the following type implements the trait:
+ a::X
-error: aborting due to previous error
+error[E0277]: the trait bound `S: d::Hidden` is not satisfied
+ --> $DIR/sealed-trait-local.rs:53:20
+ |
+LL | impl c::Sealed for S {}
+ | ^ the trait `d::Hidden` is not implemented for `S`
+ |
+note: required by a bound in `c::Sealed`
+ --> $DIR/sealed-trait-local.rs:17:23
+ |
+LL | pub trait Sealed: self::d::Hidden {
+ | ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
+ = note: `Sealed` is a "sealed trait", because to implement it you also need to implement `c::d::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = help: the following types implement the trait:
+ c::X
+ c::Y
+
+error[E0277]: the trait bound `S: f::Hidden` is not satisfied
+ --> $DIR/sealed-trait-local.rs:54:20
+ |
+LL | impl e::Sealed for S {}
+ | ^ the trait `f::Hidden` is not implemented for `S`
+ |
+note: required by a bound in `e::Sealed`
+ --> $DIR/sealed-trait-local.rs:35:23
+ |
+LL | pub trait Sealed: self::f::Hidden {
+ | ^^^^^^^^^^^^^^^ required by this bound in `Sealed`
+ = note: `Sealed` is a "sealed trait", because to implement it you also need to implement `e::f::Hidden`, which is not accessible; this is usually done to force you to use one of the provided types that already implement it
+ = help: the following types implement the trait:
+ e::X
+ e::Y
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/privacy/suggest-box-new.fixed b/tests/ui/privacy/suggest-box-new.fixed
new file mode 100644
index 000000000..f5ae5c2ab
--- /dev/null
+++ b/tests/ui/privacy/suggest-box-new.fixed
@@ -0,0 +1,15 @@
+// run-rustfix
+#![allow(dead_code)]
+struct U <T> {
+ wtf: Option<Box<U<T>>>,
+ x: T,
+}
+fn main() {
+ U {
+ wtf: Some(Box::new(U { //~ ERROR cannot initialize a tuple struct which contains private fields
+ wtf: None,
+ x: (),
+ })),
+ x: ()
+ };
+}
diff --git a/tests/ui/privacy/suggest-box-new.rs b/tests/ui/privacy/suggest-box-new.rs
new file mode 100644
index 000000000..2e18dba8b
--- /dev/null
+++ b/tests/ui/privacy/suggest-box-new.rs
@@ -0,0 +1,15 @@
+// run-rustfix
+#![allow(dead_code)]
+struct U <T> {
+ wtf: Option<Box<U<T>>>,
+ x: T,
+}
+fn main() {
+ U {
+ wtf: Some(Box(U { //~ ERROR cannot initialize a tuple struct which contains private fields
+ wtf: None,
+ x: (),
+ })),
+ x: ()
+ };
+}
diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr
new file mode 100644
index 000000000..ed7fa0364
--- /dev/null
+++ b/tests/ui/privacy/suggest-box-new.stderr
@@ -0,0 +1,20 @@
+error[E0423]: cannot initialize a tuple struct which contains private fields
+ --> $DIR/suggest-box-new.rs:9:19
+ |
+LL | wtf: Some(Box(U {
+ | ^^^
+ |
+note: constructor is not visible here due to private fields
+ --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
+ |
+ = note: private field
+ |
+ = note: private field
+help: you might have meant to use the `new` associated function
+ |
+LL | wtf: Some(Box::new(U {
+ | +++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0423`.
diff --git a/tests/ui/privacy/where-priv-type.stderr b/tests/ui/privacy/where-priv-type.stderr
index dcc249c63..650766458 100644
--- a/tests/ui/privacy/where-priv-type.stderr
+++ b/tests/ui/privacy/where-priv-type.stderr
@@ -41,8 +41,11 @@ LL | struct PrivTy;
warning: type `PrivTy` is more private than the item `S`
--> $DIR/where-priv-type.rs:39:1
|
-LL | impl S
- | ^^^^^^ implementation `S` is reachable at visibility `pub`
+LL | / impl S
+LL | |
+LL | | where
+LL | | PrivTy:
+ | |___________^ implementation `S` is reachable at visibility `pub`
|
note: but type `PrivTy` is only usable at visibility `pub(crate)`
--> $DIR/where-priv-type.rs:8:1
diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
index c47687433..ee79ce3f5 100644
--- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
+++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr
@@ -41,8 +41,11 @@ LL | trait PrivTr {}
warning: trait `PrivTr` is more private than the item `S`
--> $DIR/where-pub-type-impls-priv-trait.rs:41:1
|
-LL | impl S
- | ^^^^^^ implementation `S` is reachable at visibility `pub`
+LL | / impl S
+LL | |
+LL | | where
+LL | | PubTy: PrivTr
+ | |_________________^ implementation `S` is reachable at visibility `pub`
|
note: but trait `PrivTr` is only usable at visibility `pub(crate)`
--> $DIR/where-pub-type-impls-priv-trait.rs:10:1
diff --git a/tests/ui/proc-macro/bad-projection.rs b/tests/ui/proc-macro/bad-projection.rs
index d214c7ac8..c7cffdc9b 100644
--- a/tests/ui/proc-macro/bad-projection.rs
+++ b/tests/ui/proc-macro/bad-projection.rs
@@ -13,3 +13,5 @@ trait Project {
#[proc_macro]
pub fn uwu() -> <() as Project>::Assoc {}
//~^ ERROR the trait bound `(): Project` is not satisfied
+//~| ERROR the trait bound `(): Project` is not satisfied
+//~| ERROR function is expected to take 1 argument, but it takes 0 arguments
diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr
index 8716defa1..aea5d6d7c 100644
--- a/tests/ui/proc-macro/bad-projection.stderr
+++ b/tests/ui/proc-macro/bad-projection.stderr
@@ -10,6 +10,32 @@ help: this trait has no implementations, consider adding one
LL | trait Project {
| ^^^^^^^^^^^^^
-error: aborting due to previous error
+error[E0593]: function is expected to take 1 argument, but it takes 0 arguments
+ --> $DIR/bad-projection.rs:14:1
+ |
+LL | pub fn uwu() -> <() as Project>::Assoc {}
+ | --------------------------------------^^^
+ | |
+ | expected function that takes 1 argument
+ | takes 0 arguments
+ | required by a bound introduced by this call
+ |
+note: required by a bound in `ProcMacro::bang`
+ --> $SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL
+
+error[E0277]: the trait bound `(): Project` is not satisfied
+ --> $DIR/bad-projection.rs:14:1
+ |
+LL | pub fn uwu() -> <() as Project>::Assoc {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Project` is not implemented for `()`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/bad-projection.rs:9:1
+ |
+LL | trait Project {
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0593.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/proc-macro/issue-37788.stderr b/tests/ui/proc-macro/issue-37788.stderr
index e437bb90b..0a116d6f8 100644
--- a/tests/ui/proc-macro/issue-37788.stderr
+++ b/tests/ui/proc-macro/issue-37788.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-37788.rs:8:5
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE.
LL | std::cell::Cell::new(0)
| ^^^^^^^^^^^^^^^^^^^^^^^- help: consider using a semicolon here: `;`
diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.rs b/tests/ui/proc-macro/issue-75930-derive-cfg.rs
index ef56e8e02..e0213527c 100644
--- a/tests/ui/proc-macro/issue-75930-derive-cfg.rs
+++ b/tests/ui/proc-macro/issue-75930-derive-cfg.rs
@@ -16,6 +16,36 @@ extern crate std;
#[macro_use]
extern crate test_macros;
+// Note: the expected output contains this sequence:
+// ```
+// Punct {
+// ch: '<',
+// spacing: Joint,
+// span: $DIR/issue-75930-derive-cfg.rs:25:11: 25:12 (#0),
+// },
+// Ident {
+// ident: "B",
+// span: $DIR/issue-75930-derive-cfg.rs:25:29: 25:30 (#0),
+// },
+// ```
+// It's surprising to see a `Joint` token tree followed by an `Ident` token
+// tree, because `Joint` is supposed to only be used if the following token is
+// `Punct`.
+//
+// It is because of this code from below:
+// ```
+// struct Foo<#[cfg(FALSE)] A, B>
+// ```
+// When the token stream is formed during parsing, `<` is followed immediately
+// by `#`, which is punctuation, so it is marked `Joint`. But before being
+// passed to the proc macro it is rewritten to this:
+// ```
+// struct Foo<B>
+// ```
+// But the `Joint` marker on the `<` is not updated. Perhaps it should be
+// corrected before being passed to the proc macro? But a prior attempt to do
+// that kind of correction caused the problem seen in #76399, so maybe not.
+
#[print_helper(a)] //~ WARN derive helper attribute is used before it is introduced
//~| WARN this was previously accepted
#[cfg_attr(not(FALSE), allow(dead_code))]
diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.stderr b/tests/ui/proc-macro/issue-75930-derive-cfg.stderr
index 6d1efb0dc..1017745de 100644
--- a/tests/ui/proc-macro/issue-75930-derive-cfg.stderr
+++ b/tests/ui/proc-macro/issue-75930-derive-cfg.stderr
@@ -1,5 +1,5 @@
warning: derive helper attribute is used before it is introduced
- --> $DIR/issue-75930-derive-cfg.rs:19:3
+ --> $DIR/issue-75930-derive-cfg.rs:49:3
|
LL | #[print_helper(a)]
| ^^^^^^^^^^^^
@@ -12,7 +12,7 @@ LL | #[derive(Print)]
= note: `#[warn(legacy_derive_helpers)]` on by default
warning: derive helper attribute is used before it is introduced
- --> $DIR/issue-75930-derive-cfg.rs:19:3
+ --> $DIR/issue-75930-derive-cfg.rs:49:3
|
LL | #[print_helper(a)]
| ^^^^^^^^^^^^
@@ -22,6 +22,7 @@ LL | #[derive(Print)]
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #79202 <https://github.com/rust-lang/rust/issues/79202>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 2 warnings emitted
diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout
index 83afd0d3e..31a1c44b6 100644
--- a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout
+++ b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout
@@ -26,158 +26,158 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:19:1: 19:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:1: 49:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:19:3: 19:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:3: 49:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "a",
- span: $DIR/issue-75930-derive-cfg.rs:19:16: 19:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:16: 49:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:19:15: 19:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:15: 49:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:19:2: 19:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:2: 49:19 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:21:1: 21:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:21:24: 21:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:24: 51:29 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "dead_code",
- span: $DIR/issue-75930-derive-cfg.rs:21:30: 21:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:30: 51:39 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:29: 21:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:29: 51:40 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:1: 21:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:23:1: 23:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:1: 53:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "derive",
- span: $DIR/issue-75930-derive-cfg.rs:23:3: 23:9 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:3: 53:9 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "Print",
- span: $DIR/issue-75930-derive-cfg.rs:23:10: 23:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:10: 53:15 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:23:9: 23:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:9: 53:16 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:23:2: 23:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:53:2: 53:17 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:24:1: 24:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:1: 54:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:24:3: 24:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:3: 54:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "b",
- span: $DIR/issue-75930-derive-cfg.rs:24:16: 24:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:16: 54:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:15: 24:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:15: 54:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:2: 24:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:2: 54:19 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:25:1: 25:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:1: 55:7 (#0),
},
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:25:8: 25:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:8: 55:11 (#0),
},
Punct {
ch: '<',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:25:11: 25:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:11: 55:12 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:12: 25:13 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:12: 55:13 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:25:14: 25:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:14: 55:17 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:25:18: 25:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:18: 55:23 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:17: 25:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:17: 55:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:13: 25:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:13: 55:25 (#0),
},
Ident {
ident: "A",
- span: $DIR/issue-75930-derive-cfg.rs:25:26: 25:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:26: 55:27 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:27: 25:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:27: 55:28 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:25:29: 25:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:29: 55:30 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:30: 25:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:30: 55:31 (#0),
},
Group {
delimiter: Brace,
@@ -185,128 +185,128 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:26:5: 26:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:5: 56:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:26:7: 26:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:7: 56:10 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:26:11: 26:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:11: 56:16 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:26:10: 26:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:10: 56:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:26:6: 26:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:6: 56:18 (#0),
},
Ident {
ident: "first",
- span: $DIR/issue-75930-derive-cfg.rs:26:19: 26:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:19: 56:24 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:26:24: 26:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:24: 56:25 (#0),
},
Ident {
ident: "String",
- span: $DIR/issue-75930-derive-cfg.rs:26:26: 26:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:26: 56:32 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:26:32: 26:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:56:32: 56:33 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:5: 27:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:5: 57:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg_attr",
- span: $DIR/issue-75930-derive-cfg.rs:27:7: 27:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:7: 57:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:27:16: 27:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:16: 57:21 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:21: 27:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:21: 57:22 (#0),
},
Ident {
ident: "deny",
- span: $DIR/issue-75930-derive-cfg.rs:27:23: 27:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:23: 57:27 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "warnings",
- span: $DIR/issue-75930-derive-cfg.rs:27:28: 27:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:28: 57:36 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:27:27: 27:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:27: 57:37 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:27:15: 27:38 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:15: 57:38 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:27:6: 27:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:6: 57:39 (#0),
},
Ident {
ident: "second",
- span: $DIR/issue-75930-derive-cfg.rs:27:40: 27:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:40: 57:46 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:46: 27:47 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:46: 57:47 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:27:48: 27:52 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:48: 57:52 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:52: 27:53 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:52: 57:53 (#0),
},
Ident {
ident: "third",
- span: $DIR/issue-75930-derive-cfg.rs:28:5: 28:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:5: 58:10 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:10: 28:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:10: 58:11 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:28:13: 28:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:15 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:15: 28:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:16 (#0),
},
Group {
delimiter: Brace,
@@ -314,145 +314,145 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:29:9: 29:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:9: 59:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:29:11: 29:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:11: 59:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:29:15: 29:20 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:29:14: 29:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:29:10: 29:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:10: 59:22 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:29:23: 29:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:23: 59:29 (#0),
},
Ident {
ident: "Bar",
- span: $DIR/issue-75930-derive-cfg.rs:29:30: 29:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:30: 59:33 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:29:33: 29:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:59:33: 59:34 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:9: 30:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:9: 60:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:30:11: 30:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:11: 60:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:30:15: 30:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:30:19: 30:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:19: 60:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:18: 30:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:18: 60:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:14: 30:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:10: 30:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:10: 60:27 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:30:28: 30:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:28: 60:34 (#0),
},
Ident {
ident: "Inner",
- span: $DIR/issue-75930-derive-cfg.rs:30:35: 30:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:35: 60:40 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:40: 30:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:40: 60:41 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:9: 31:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:9: 61:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:31:11: 31:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:11: 61:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:31:15: 31:20 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:15: 61:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:31:14: 31:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:14: 61:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:31:10: 31:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:10: 61:22 (#0),
},
Ident {
ident: "let",
- span: $DIR/issue-75930-derive-cfg.rs:31:23: 31:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:23: 61:26 (#0),
},
Ident {
ident: "a",
- span: $DIR/issue-75930-derive-cfg.rs:31:27: 31:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:27: 61:28 (#0),
},
Punct {
ch: '=',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:29: 31:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:29: 61:30 (#0),
},
Literal {
kind: Integer,
symbol: "25",
suffix: None,
- span: $DIR/issue-75930-derive-cfg.rs:31:31: 31:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:31: 61:33 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:31:33: 31:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:61:33: 61:34 (#0),
},
Ident {
ident: "match",
- span: $DIR/issue-75930-derive-cfg.rs:32:9: 32:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:9: 62:14 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:32:15: 32:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:15: 62:19 (#0),
},
Group {
delimiter: Brace,
@@ -460,194 +460,194 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:33:13: 33:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:13: 63:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:33:15: 33:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:15: 63:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:33:19: 33:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:19: 63:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:33:18: 33:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:18: 63:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:33:14: 33:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:14: 63:26 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:33:27: 33:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:27: 63:31 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:33:32: 33:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:32: 63:33 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:33:33: 33:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:33: 63:34 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:33:35: 33:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:35: 63:37 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:33:37: 33:38 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:63:37: 63:38 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:13: 34:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg_attr",
- span: $DIR/issue-75930-derive-cfg.rs:34:15: 34:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:15: 64:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:34:24: 34:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:24: 64:27 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:34:28: 34:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:28: 64:33 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:27: 34:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:27: 64:34 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:34: 34:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:34: 64:35 (#0),
},
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:34:36: 34:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:36: 64:41 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "warnings",
- span: $DIR/issue-75930-derive-cfg.rs:34:42: 34:50 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:42: 64:50 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:41: 34:51 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:41: 64:51 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:23: 34:52 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:23: 64:52 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:14: 34:53 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:14: 64:53 (#0),
},
Ident {
ident: "false",
- span: $DIR/issue-75930-derive-cfg.rs:34:54: 34:59 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:54: 64:59 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:61 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:60: 64:61 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:61: 34:62 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:61: 64:62 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:34:63: 34:65 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:63: 64:65 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:65: 34:66 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:65: 64:66 (#0),
},
Ident {
ident: "_",
- span: $DIR/issue-75930-derive-cfg.rs:35:13: 35:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:13: 65:14 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:15: 65:16 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:35:16: 35:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:16: 65:17 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:35:18: 35:20 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:18: 65:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:32:20: 36:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:20: 66:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:36:10: 36:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:66:10: 66:11 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:38:9: 38:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:9: 68:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:38:11: 38:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:11: 68:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "should_be_removed",
- span: $DIR/issue-75930-derive-cfg.rs:38:24: 38:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:24: 68:41 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:38:23: 38:42 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:23: 68:42 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:38:10: 38:43 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:68:10: 68:43 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:39:9: 39:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:69:9: 69:11 (#0),
},
Ident {
ident: "removed_fn",
- span: $DIR/issue-75930-derive-cfg.rs:39:12: 39:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:69:12: 69:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:39:22: 39:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:69:22: 69:24 (#0),
},
Group {
delimiter: Brace,
@@ -655,108 +655,108 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:40:13: 40:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:13: 70:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:40:14: 40:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:14: 70:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:40:16: 40:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:16: 70:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:40:20: 40:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:20: 70:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:40:19: 40:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:19: 70:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:40:15: 40:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:70:15: 70:27 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:39:25: 41:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:69:25: 71:10 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:43:9: 43:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:9: 73:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:43:11: 43:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:11: 73:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "c",
- span: $DIR/issue-75930-derive-cfg.rs:43:24: 43:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:24: 73:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:23: 43:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:23: 73:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:10: 43:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:10: 73:27 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:43:28: 43:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:28: 73:29 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:43:30: 43:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:30: 73:33 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:43:34: 43:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:34: 73:37 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:43:38: 43:43 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:38: 73:43 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:37: 43:44 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:37: 73:44 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:33: 43:45 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:33: 73:45 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:29: 43:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:29: 73:46 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:43:47: 43:49 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:47: 73:49 (#0),
},
Ident {
ident: "kept_fn",
- span: $DIR/issue-75930-derive-cfg.rs:43:50: 43:57 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:50: 73:57 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:43:57: 43:59 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:57: 73:59 (#0),
},
Group {
delimiter: Brace,
@@ -764,82 +764,82 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:44:13: 44:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:13: 74:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:44:14: 44:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:14: 74:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:44:16: 44:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:16: 74:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:44:20: 44:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:20: 74:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:44:24: 44:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:24: 74:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:23: 44:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:23: 74:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:19: 44:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:19: 74:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:15: 44:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:15: 74:32 (#0),
},
Ident {
ident: "let",
- span: $DIR/issue-75930-derive-cfg.rs:45:13: 45:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:13: 75:16 (#0),
},
Ident {
ident: "my_val",
- span: $DIR/issue-75930-derive-cfg.rs:45:17: 45:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:17: 75:23 (#0),
},
Punct {
ch: '=',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:45:24: 45:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:24: 75:25 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:45:26: 45:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:26: 75:30 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:45:30: 45:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:30: 75:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:60: 46:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:60: 76:10 (#0),
},
Ident {
ident: "enum",
- span: $DIR/issue-75930-derive-cfg.rs:48:9: 48:13 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:9: 78:13 (#0),
},
Ident {
ident: "TupleEnum",
- span: $DIR/issue-75930-derive-cfg.rs:48:14: 48:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:14: 78:23 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:49:13: 49:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:79:13: 79:16 (#0),
},
Group {
delimiter: Parenthesis,
@@ -847,166 +847,166 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:50:17: 50:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:17: 80:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:50:19: 50:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:19: 80:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:50:23: 50:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:23: 80:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:50:22: 50:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:22: 80:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:50:18: 50:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:18: 80:30 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:50:31: 50:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:31: 80:33 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:50:33: 50:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:80:33: 80:34 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:51:17: 51:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:17: 81:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:51:19: 51:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:19: 81:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:51:23: 51:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:23: 81:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:51:22: 51:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:22: 81:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:51:18: 51:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:18: 81:30 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:51:31: 51:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:31: 81:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:51:35: 51:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:81:35: 81:36 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:52:17: 52:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:17: 82:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:52:19: 52:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:19: 82:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:52:23: 52:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:23: 82:26 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:52:27: 52:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:27: 82:32 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:26: 52:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:26: 82:33 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:22: 52:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:22: 82:34 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:18: 52:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:18: 82:35 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:52:36: 52:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:36: 82:39 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:52:39: 52:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:39: 82:40 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:53:17: 53:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:17: 83:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:53:19: 53:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:19: 83:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:53:23: 53:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:23: 83:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:53:22: 53:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:22: 83:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:53:18: 53:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:18: 83:30 (#0),
},
Ident {
ident: "String",
- span: $DIR/issue-75930-derive-cfg.rs:53:31: 53:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:31: 83:37 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:53:37: 53:38 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:37: 83:38 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:53:39: 53:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:39: 83:41 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:49:16: 54:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:79:16: 84:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:48:24: 55:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:24: 85:10 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:57:9: 57:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:9: 87:15 (#0),
},
Ident {
ident: "TupleStruct",
- span: $DIR/issue-75930-derive-cfg.rs:57:16: 57:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:16: 87:27 (#0),
},
Group {
delimiter: Parenthesis,
@@ -1014,139 +1014,139 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:13: 88:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:15: 88:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:58:19: 58:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:19: 88:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:58:18: 58:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:18: 88:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:58:14: 58:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:14: 88:26 (#0),
},
Ident {
ident: "String",
- span: $DIR/issue-75930-derive-cfg.rs:58:27: 58:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:27: 88:33 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:58:33: 58:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:88:33: 88:34 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:59:13: 59:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:13: 89:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:15: 89:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:59:19: 59:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:19: 89:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:59:23: 59:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:23: 89:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:22: 59:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:22: 89:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:18: 59:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:18: 89:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:14: 89:31 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:59:32: 59:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:32: 89:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:59:35: 59:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:35: 89:36 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:60:13: 60:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:13: 90:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:15: 90:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:60:19: 60:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:19: 90:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:60:18: 60:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:18: 90:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:14: 90:26 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:60:27: 60:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:27: 90:31 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:60:31: 60:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:90:31: 90:32 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:61:13: 61:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:91:13: 91:15 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:57:27: 62:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:27: 92:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:62:10: 62:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:92:10: 92:11 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:64:9: 64:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:94:9: 94:11 (#0),
},
Ident {
ident: "plain_removed_fn",
- span: $DIR/issue-75930-derive-cfg.rs:64:12: 64:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:94:12: 94:28 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:64:28: 64:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:94:28: 94:30 (#0),
},
Group {
delimiter: Brace,
@@ -1154,122 +1154,122 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:65:13: 65:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:13: 95:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:65:14: 65:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:14: 95:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg_attr",
- span: $DIR/issue-75930-derive-cfg.rs:65:16: 65:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:16: 95:24 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:65:25: 65:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:25: 95:28 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:65:29: 65:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:29: 95:34 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:65:28: 65:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:28: 95:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:65:35: 65:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:35: 95:36 (#0),
},
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:65:37: 65:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:37: 95:40 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:65:41: 65:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:41: 95:46 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:65:40: 65:47 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:40: 95:47 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:65:24: 65:48 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:24: 95:48 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:65:15: 65:49 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:95:15: 95:49 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:64:31: 66:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:94:31: 96:10 (#0),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: $DIR/issue-75930-derive-cfg.rs:68:9: 68:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:98:9: 98:10 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:28:17: 69:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:17: 99:6 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:28:12: 69:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:12: 99:7 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:69:7: 69:8 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:99:7: 99:8 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:70:5: 70:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:5: 100:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:70:7: 70:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:7: 100:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "d",
- span: $DIR/issue-75930-derive-cfg.rs:70:20: 70:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:20: 100:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:70:19: 70:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:19: 100:22 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:70:6: 70:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:6: 100:23 (#0),
},
Ident {
ident: "fourth",
- span: $DIR/issue-75930-derive-cfg.rs:71:5: 71:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:5: 101:11 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:71:11: 71:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:11: 101:12 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:71:13: 71:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:13: 101:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:32: 72:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:32: 102:2 (#0),
},
]
PRINT-DERIVE INPUT (DISPLAY): #[print_helper(a)] #[allow(dead_code)] #[print_helper(b)] struct Foo < B >
@@ -1289,141 +1289,141 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:19:1: 19:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:1: 49:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:19:3: 19:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:3: 49:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "a",
- span: $DIR/issue-75930-derive-cfg.rs:19:16: 19:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:16: 49:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:19:15: 19:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:15: 49:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:19:2: 19:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:49:2: 49:19 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:21:1: 21:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:21:24: 21:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:24: 51:29 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "dead_code",
- span: $DIR/issue-75930-derive-cfg.rs:21:30: 21:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:30: 51:39 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:29: 21:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:29: 51:40 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:21:1: 21:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:51:1: 51:2 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:24:1: 24:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:1: 54:2 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:24:3: 24:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:3: 54:15 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "b",
- span: $DIR/issue-75930-derive-cfg.rs:24:16: 24:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:16: 54:17 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:15: 24:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:15: 54:18 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:24:2: 24:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:54:2: 54:19 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:25:1: 25:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:1: 55:7 (#0),
},
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:25:8: 25:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:8: 55:11 (#0),
},
Punct {
ch: '<',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:25:11: 25:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:11: 55:12 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:25:29: 25:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:29: 55:30 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:25:30: 25:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:30: 55:31 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "second",
- span: $DIR/issue-75930-derive-cfg.rs:27:40: 27:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:40: 57:46 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:46: 27:47 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:46: 57:47 (#0),
},
Ident {
ident: "bool",
- span: $DIR/issue-75930-derive-cfg.rs:27:48: 27:52 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:48: 57:52 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:27:52: 27:53 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:57:52: 57:53 (#0),
},
Ident {
ident: "third",
- span: $DIR/issue-75930-derive-cfg.rs:28:5: 28:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:5: 58:10 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:10: 28:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:10: 58:11 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:28:13: 28:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:13: 58:15 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:28:15: 28:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:15: 58:16 (#0),
},
Group {
delimiter: Brace,
@@ -1431,58 +1431,58 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:9: 30:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:9: 60:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:30:11: 30:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:11: 60:14 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:30:15: 30:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:15: 60:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:30:19: 30:24 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:19: 60:24 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:18: 30:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:18: 60:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:14: 30:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:14: 60:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:30:10: 30:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:10: 60:27 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:30:28: 30:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:28: 60:34 (#0),
},
Ident {
ident: "Inner",
- span: $DIR/issue-75930-derive-cfg.rs:30:35: 30:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:35: 60:40 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:30:40: 30:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:60:40: 60:41 (#0),
},
Ident {
ident: "match",
- span: $DIR/issue-75930-derive-cfg.rs:32:9: 32:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:9: 62:14 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:32:15: 32:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:15: 62:19 (#0),
},
Group {
delimiter: Brace,
@@ -1490,151 +1490,151 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:13: 34:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "allow",
- span: $DIR/issue-75930-derive-cfg.rs:34:36: 34:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:36: 64:41 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "warnings",
- span: $DIR/issue-75930-derive-cfg.rs:34:42: 34:50 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:42: 64:50 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:41: 34:51 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:41: 64:51 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:34:13: 34:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:13: 64:14 (#0),
},
Ident {
ident: "false",
- span: $DIR/issue-75930-derive-cfg.rs:34:54: 34:59 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:54: 64:59 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:34:60: 34:61 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:60: 64:61 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:61: 34:62 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:61: 64:62 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:34:63: 34:65 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:63: 64:65 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:34:65: 34:66 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:64:65: 64:66 (#0),
},
Ident {
ident: "_",
- span: $DIR/issue-75930-derive-cfg.rs:35:13: 35:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:13: 65:14 (#0),
},
Punct {
ch: '=',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:35:15: 35:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:15: 65:16 (#0),
},
Punct {
ch: '>',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:35:16: 35:17 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:16: 65:17 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:35:18: 35:20 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:65:18: 65:20 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:32:20: 36:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:62:20: 66:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:36:10: 36:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:66:10: 66:11 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:43:9: 43:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:9: 73:10 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:43:11: 43:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:11: 73:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "c",
- span: $DIR/issue-75930-derive-cfg.rs:43:24: 43:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:24: 73:25 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:23: 43:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:23: 73:26 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:10: 43:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:10: 73:27 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:43:28: 43:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:28: 73:29 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:43:30: 43:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:30: 73:33 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:43:34: 43:37 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:34: 73:37 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:43:38: 43:43 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:38: 73:43 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:37: 43:44 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:37: 73:44 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:33: 43:45 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:33: 73:45 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:29: 43:46 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:29: 73:46 (#0),
},
Ident {
ident: "fn",
- span: $DIR/issue-75930-derive-cfg.rs:43:47: 43:49 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:47: 73:49 (#0),
},
Ident {
ident: "kept_fn",
- span: $DIR/issue-75930-derive-cfg.rs:43:50: 43:57 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:50: 73:57 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [],
- span: $DIR/issue-75930-derive-cfg.rs:43:57: 43:59 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:57: 73:59 (#0),
},
Group {
delimiter: Brace,
@@ -1642,82 +1642,82 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Joint,
- span: $DIR/issue-75930-derive-cfg.rs:44:13: 44:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:13: 74:14 (#0),
},
Punct {
ch: '!',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:44:14: 44:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:14: 74:15 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:44:16: 44:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:16: 74:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:44:20: 44:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:20: 74:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:44:24: 44:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:24: 74:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:23: 44:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:23: 74:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:19: 44:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:19: 74:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:44:15: 44:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:74:15: 74:32 (#0),
},
Ident {
ident: "let",
- span: $DIR/issue-75930-derive-cfg.rs:45:13: 45:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:13: 75:16 (#0),
},
Ident {
ident: "my_val",
- span: $DIR/issue-75930-derive-cfg.rs:45:17: 45:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:17: 75:23 (#0),
},
Punct {
ch: '=',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:45:24: 45:25 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:24: 75:25 (#0),
},
Ident {
ident: "true",
- span: $DIR/issue-75930-derive-cfg.rs:45:26: 45:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:26: 75:30 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:45:30: 45:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:75:30: 75:31 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:43:60: 46:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:73:60: 76:10 (#0),
},
Ident {
ident: "enum",
- span: $DIR/issue-75930-derive-cfg.rs:48:9: 48:13 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:9: 78:13 (#0),
},
Ident {
ident: "TupleEnum",
- span: $DIR/issue-75930-derive-cfg.rs:48:14: 48:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:14: 78:23 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Ident {
ident: "Foo",
- span: $DIR/issue-75930-derive-cfg.rs:49:13: 49:16 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:79:13: 79:16 (#0),
},
Group {
delimiter: Parenthesis,
@@ -1725,64 +1725,64 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:52:17: 52:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:17: 82:18 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:52:19: 52:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:19: 82:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:52:23: 52:26 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:23: 82:26 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:52:27: 52:32 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:27: 82:32 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:26: 52:33 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:26: 82:33 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:22: 52:34 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:22: 82:34 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:52:18: 52:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:18: 82:35 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:52:36: 52:39 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:36: 82:39 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:52:39: 52:40 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:82:39: 82:40 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:53:39: 53:41 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:83:39: 83:41 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:49:16: 54:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:79:16: 84:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:48:24: 55:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:78:24: 85:10 (#0),
},
Ident {
ident: "struct",
- span: $DIR/issue-75930-derive-cfg.rs:57:9: 57:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:9: 87:15 (#0),
},
Ident {
ident: "TupleStruct",
- span: $DIR/issue-75930-derive-cfg.rs:57:16: 57:27 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:16: 87:27 (#0),
},
Group {
delimiter: Parenthesis,
@@ -1790,115 +1790,115 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:59:13: 59:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:13: 89:14 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "cfg",
- span: $DIR/issue-75930-derive-cfg.rs:59:15: 59:18 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:15: 89:18 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "not",
- span: $DIR/issue-75930-derive-cfg.rs:59:19: 59:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:19: 89:22 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "FALSE",
- span: $DIR/issue-75930-derive-cfg.rs:59:23: 59:28 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:23: 89:28 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:22: 59:29 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:22: 89:29 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:18: 59:30 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:18: 89:30 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:59:14: 59:31 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:14: 89:31 (#0),
},
Ident {
ident: "i32",
- span: $DIR/issue-75930-derive-cfg.rs:59:32: 59:35 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:32: 89:35 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:59:35: 59:36 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:89:35: 89:36 (#0),
},
Ident {
ident: "u8",
- span: $DIR/issue-75930-derive-cfg.rs:61:13: 61:15 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:91:13: 91:15 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:57:27: 62:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:87:27: 92:10 (#0),
},
Punct {
ch: ';',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:62:10: 62:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:92:10: 92:11 (#0),
},
Literal {
kind: Integer,
symbol: "0",
suffix: None,
- span: $DIR/issue-75930-derive-cfg.rs:68:9: 68:10 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:98:9: 98:10 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:28:17: 69:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:17: 99:6 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:28:12: 69:7 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:58:12: 99:7 (#0),
},
Punct {
ch: ',',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:69:7: 69:8 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:99:7: 99:8 (#0),
},
Punct {
ch: '#',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:70:5: 70:6 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:5: 100:6 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "print_helper",
- span: $DIR/issue-75930-derive-cfg.rs:70:7: 70:19 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:7: 100:19 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "d",
- span: $DIR/issue-75930-derive-cfg.rs:70:20: 70:21 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:20: 100:21 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:70:19: 70:22 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:19: 100:22 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:70:6: 70:23 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:100:6: 100:23 (#0),
},
Ident {
ident: "fourth",
- span: $DIR/issue-75930-derive-cfg.rs:71:5: 71:11 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:5: 101:11 (#0),
},
Punct {
ch: ':',
spacing: Alone,
- span: $DIR/issue-75930-derive-cfg.rs:71:11: 71:12 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:11: 101:12 (#0),
},
Ident {
ident: "B",
- span: $DIR/issue-75930-derive-cfg.rs:71:13: 71:14 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:101:13: 101:14 (#0),
},
],
- span: $DIR/issue-75930-derive-cfg.rs:25:32: 72:2 (#0),
+ span: $DIR/issue-75930-derive-cfg.rs:55:32: 102:2 (#0),
},
]
diff --git a/tests/ui/proc-macro/macro-namespace-reserved-2.stderr b/tests/ui/proc-macro/macro-namespace-reserved-2.stderr
index b9effe7cf..047112406 100644
--- a/tests/ui/proc-macro/macro-namespace-reserved-2.stderr
+++ b/tests/ui/proc-macro/macro-namespace-reserved-2.stderr
@@ -143,6 +143,7 @@ LL | #[derive(my_macro)]
| ^^^^^^^^
|
= note: `my_macro` is in scope, but it is a function-like macro
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 20 previous errors
diff --git a/tests/ui/proc-macro/pretty-print-hack-show.local.stderr b/tests/ui/proc-macro/pretty-print-hack-show.local.stderr
index 873054927..118882f73 100644
--- a/tests/ui/proc-macro/pretty-print-hack-show.local.stderr
+++ b/tests/ui/proc-macro/pretty-print-hack-show.local.stderr
@@ -18,6 +18,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
@@ -28,6 +29,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
@@ -38,6 +40,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -58,6 +61,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -68,6 +72,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -78,6 +83,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 8 previous errors
diff --git a/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr b/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr
index 873054927..118882f73 100644
--- a/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr
+++ b/tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr
@@ -18,6 +18,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
@@ -28,6 +29,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
@@ -38,6 +40,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -58,6 +61,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -68,6 +72,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: using an old version of `rental`
--> $DIR/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
@@ -78,6 +83,7 @@ LL | enum ProceduralMasqueradeDummyType {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 8 previous errors
diff --git a/tests/ui/proc-macro/resolve-error.stderr b/tests/ui/proc-macro/resolve-error.stderr
index 3c3f24d0f..e7639f474 100644
--- a/tests/ui/proc-macro/resolve-error.stderr
+++ b/tests/ui/proc-macro/resolve-error.stderr
@@ -44,6 +44,8 @@ error: cannot find derive macro `attr_proc_macra` in this scope
|
LL | #[derive(attr_proc_macra)]
| ^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `Dlona` in this scope
--> $DIR/resolve-error.rs:40:10
@@ -66,6 +68,8 @@ LL | #[derive(Dlona)]
|
LL | pub fn derive_clonea(input: TokenStream) -> TokenStream {
| ------------------------------------------------------- similarly named derive macro `Clona` defined here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find derive macro `Dlone` in this scope
--> $DIR/resolve-error.rs:35:10
@@ -84,6 +88,8 @@ LL | #[derive(Dlone)]
--> $SRC_DIR/core/src/clone.rs:LL:COL
|
= note: similarly named derive macro `Clone` defined here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find attribute `FooWithLongNan` in this scope
--> $DIR/resolve-error.rs:32:3
@@ -123,6 +129,8 @@ LL | #[derive(FooWithLongNan)]
|
LL | pub fn derive_foo(input: TokenStream) -> TokenStream {
| ---------------------------------------------------- similarly named derive macro `FooWithLongName` defined here
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 14 previous errors
diff --git a/tests/ui/proc-macro/resolved-located-at.stderr b/tests/ui/proc-macro/resolved-located-at.stderr
index 0b4dbcba6..a4f838521 100644
--- a/tests/ui/proc-macro/resolved-located-at.stderr
+++ b/tests/ui/proc-macro/resolved-located-at.stderr
@@ -10,7 +10,7 @@ error[E0308]: mismatched types
--> $DIR/resolved-located-at.rs:7:27
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | resolve_located_at!(a b)
| ^ expected `()`, found `S`
|
diff --git a/tests/ui/proc-macro/span-preservation.stderr b/tests/ui/proc-macro/span-preservation.stderr
index 8c15cb9de..3ad9c539f 100644
--- a/tests/ui/proc-macro/span-preservation.stderr
+++ b/tests/ui/proc-macro/span-preservation.stderr
@@ -38,7 +38,7 @@ error[E0308]: mismatched types
--> $DIR/span-preservation.rs:39:5
|
LL | extern "C" fn bar() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
@@ -46,7 +46,7 @@ error[E0308]: mismatched types
--> $DIR/span-preservation.rs:44:5
|
LL | extern "C" fn baz() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
@@ -54,7 +54,7 @@ error[E0308]: mismatched types
--> $DIR/span-preservation.rs:49:5
|
LL | extern "Rust" fn rust_abi() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
@@ -62,7 +62,7 @@ error[E0308]: mismatched types
--> $DIR/span-preservation.rs:54:5
|
LL | extern "\x43" fn c_abi_escaped() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
diff --git a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr
index 4f3f9d1eb..21f1fdba8 100644
--- a/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr
+++ b/tests/ui/range/range-pattern-out-of-bounds-issue-68972.stderr
@@ -2,13 +2,13 @@ error: literal out of range for `u8`
--> $DIR/range-pattern-out-of-bounds-issue-68972.rs:5:14
|
LL | 251..257 => {}
- | ^^^ this value doesn't fit in `u8` whose maximum value is `255`
+ | ^^^ this value does not fit into the type `u8` whose range is `0..=255`
error: literal out of range for `u8`
--> $DIR/range-pattern-out-of-bounds-issue-68972.rs:7:15
|
LL | 251..=256 => {}
- | ^^^ this value doesn't fit in `u8` whose maximum value is `255`
+ | ^^^ this value does not fit into the type `u8` whose range is `0..=255`
error: aborting due to 2 previous errors
diff --git a/tests/ui/reachable/reachable-unnameable-type-alias.rs b/tests/ui/reachable/reachable-unnameable-type-alias.rs
index 461355f87..ce830d2d4 100644
--- a/tests/ui/reachable/reachable-unnameable-type-alias.rs
+++ b/tests/ui/reachable/reachable-unnameable-type-alias.rs
@@ -1,14 +1,14 @@
// run-pass
#![feature(staged_api)]
-#![stable(feature = "a", since = "b")]
+#![stable(feature = "a", since = "3.3.3")]
mod inner_private_module {
// UnnameableTypeAlias isn't marked as reachable, so no stability annotation is required here
pub type UnnameableTypeAlias = u8;
}
-#[stable(feature = "a", since = "b")]
+#[stable(feature = "a", since = "3.3.3")]
pub fn f() -> inner_private_module::UnnameableTypeAlias {
0
}
diff --git a/tests/ui/recursion_limit/empty.stderr b/tests/ui/recursion_limit/empty.stderr
index cb5c0c35a..2f7306775 100644
--- a/tests/ui/recursion_limit/empty.stderr
+++ b/tests/ui/recursion_limit/empty.stderr
@@ -13,6 +13,8 @@ LL | #![recursion_limit = ""]
| ^^^^^^^^^^^^^^^^^^^^^--^
| |
| `limit` must be a non-negative integer
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/recursion_limit/invalid_digit.stderr b/tests/ui/recursion_limit/invalid_digit.stderr
index 4dc93ad5f..4fda30390 100644
--- a/tests/ui/recursion_limit/invalid_digit.stderr
+++ b/tests/ui/recursion_limit/invalid_digit.stderr
@@ -13,6 +13,8 @@ LL | #![recursion_limit = "-100"]
| ^^^^^^^^^^^^^^^^^^^^^------^
| |
| not a valid integer
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/recursion_limit/overflow.stderr b/tests/ui/recursion_limit/overflow.stderr
index 2f622d28b..6057177de 100644
--- a/tests/ui/recursion_limit/overflow.stderr
+++ b/tests/ui/recursion_limit/overflow.stderr
@@ -13,6 +13,8 @@ LL | #![recursion_limit = "999999999999999999999999"]
| ^^^^^^^^^^^^^^^^^^^^^--------------------------^
| |
| `limit` is too large
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/regions/closure-in-projection-issue-97405.rs b/tests/ui/regions/closure-in-projection-issue-97405.rs
index e567d5c27..548953397 100644
--- a/tests/ui/regions/closure-in-projection-issue-97405.rs
+++ b/tests/ui/regions/closure-in-projection-issue-97405.rs
@@ -1,5 +1,5 @@
// Regression test for #97405.
-// In `good_generic_fn` the param `T` ends up in the substs of closures/generators,
+// In `good_generic_fn` the param `T` ends up in the substs of closures/coroutines,
// but we should be able to prove `<Gen<T> as Iterator>::Item: 'static` without
// requiring `T: 'static`
diff --git a/tests/ui/regions/closure-in-projection-issue-97405.stderr b/tests/ui/regions/closure-in-projection-issue-97405.stderr
index c08f1059e..7070dfef1 100644
--- a/tests/ui/regions/closure-in-projection-issue-97405.stderr
+++ b/tests/ui/regions/closure-in-projection-issue-97405.stderr
@@ -3,27 +3,33 @@ error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not li
|
LL | assert_static(opaque(async move { t; }).next());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the associated type `<impl Iterator as Iterator>::Item` must be valid for the static lifetime...
+ | ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`...
- = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough
--> $DIR/closure-in-projection-issue-97405.rs:26:5
|
LL | assert_static(opaque(move || { t; }).next());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the associated type `<impl Iterator as Iterator>::Item` must be valid for the static lifetime...
+ | ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`...
- = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough
--> $DIR/closure-in-projection-issue-97405.rs:28:5
|
LL | assert_static(opaque(opaque(async move { t; }).next()).next());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the associated type `<impl Iterator as Iterator>::Item` must be valid for the static lifetime...
+ | ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
|
= help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`...
- = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds
error: aborting due to 3 previous errors
diff --git a/tests/ui/regions/regions-close-associated-type-into-object.stderr b/tests/ui/regions/regions-close-associated-type-into-object.stderr
index f7dcaa9d9..6fb514377 100644
--- a/tests/ui/regions/regions-close-associated-type-into-object.stderr
+++ b/tests/ui/regions/regions-close-associated-type-into-object.stderr
@@ -3,36 +3,56 @@ error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
|
LL | Box::new(item)
| ^^^^^^^^^^^^^^
+ | |
+ | the associated type `<T as Iter>::Item` must be valid for the static lifetime...
+ | ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
- = note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | fn bad1<T: Iter>(v: T) -> Box<dyn X + 'static> where <T as Iter>::Item: 'static
+ | ++++++++++++++++++++++++++++++++
error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:22:5
|
LL | Box::new(item)
| ^^^^^^^^^^^^^^
+ | |
+ | the associated type `<T as Iter>::Item` must be valid for the static lifetime...
+ | ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
- = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
- = note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+LL | where Box<T::Item> : X, <T as Iter>::Item: 'static
+ | ++++++++++++++++++++++++++++
error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:28:5
|
+LL | fn bad3<'a, T: Iter>(v: T) -> Box<dyn X + 'a>
+ | -- the associated type `<T as Iter>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(item)
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
- = note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | fn bad3<'a, T: Iter>(v: T) -> Box<dyn X + 'a> where <T as Iter>::Item: 'a
+ | +++++++++++++++++++++++++++
error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
--> $DIR/regions-close-associated-type-into-object.rs:35:5
|
+LL | fn bad4<'a, T: Iter>(v: T) -> Box<dyn X + 'a>
+ | -- the associated type `<T as Iter>::Item` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(item)
- | ^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^ ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
- = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
- = note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+LL | where Box<T::Item> : X, <T as Iter>::Item: 'a
+ | +++++++++++++++++++++++
error: aborting due to 4 previous errors
diff --git a/tests/ui/regions/regions-close-object-into-object-4.stderr b/tests/ui/regions/regions-close-object-into-object-4.stderr
index 7a9f1ab00..b8b414b7e 100644
--- a/tests/ui/regions/regions-close-object-into-object-4.stderr
+++ b/tests/ui/regions/regions-close-object-into-object-4.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/regions-close-object-into-object-4.rs:9:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+ | ^^^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/regions-close-object-into-object-4.rs:9:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| +++++++++
@@ -24,9 +30,13 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/regions-close-object-into-object-4.rs:9:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider adding an explicit lifetime bound
|
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| +++++++++
@@ -61,9 +71,12 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/regions-close-object-into-object-4.rs:9:14
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+ | ^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn i<'a, T, U: 'static>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
| +++++++++
diff --git a/tests/ui/regions/regions-close-object-into-object-5.stderr b/tests/ui/regions/regions-close-object-into-object-5.stderr
index 311e8868c..4a2f4f847 100644
--- a/tests/ui/regions/regions-close-object-into-object-5.stderr
+++ b/tests/ui/regions/regions-close-object-into-object-5.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-object-into-object-5.rs:17:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-object-into-object-5.rs:17:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
| +++++++++
@@ -24,9 +30,13 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-object-into-object-5.rs:17:5
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider adding an explicit lifetime bound
|
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
| +++++++++
@@ -44,9 +54,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-object-into-object-5.rs:17:14
|
LL | Box::new(B(&*v)) as Box<dyn X>
- | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn f<'a, T: 'static, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
| +++++++++
diff --git a/tests/ui/regions/regions-close-over-type-parameter-1.stderr b/tests/ui/regions/regions-close-over-type-parameter-1.stderr
index b7b557d7a..1cd5b7f22 100644
--- a/tests/ui/regions/regions-close-over-type-parameter-1.stderr
+++ b/tests/ui/regions/regions-close-over-type-parameter-1.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/regions-close-over-type-parameter-1.rs:11:5
|
LL | Box::new(v) as Box<dyn SomeTrait + 'static>
- | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn make_object1<A: SomeTrait + 'static>(v: A) -> Box<dyn SomeTrait + 'static> {
| +++++++++
@@ -12,10 +15,12 @@ LL | fn make_object1<A: SomeTrait + 'static>(v: A) -> Box<dyn SomeTrait + 'stati
error[E0309]: the parameter type `A` may not live long enough
--> $DIR/regions-close-over-type-parameter-1.rs:20:5
|
+LL | fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box<dyn SomeTrait + 'b> {
+ | -- the parameter type `A` must be valid for the lifetime `'b` as defined here...
LL | Box::new(v) as Box<dyn SomeTrait + 'b>
| ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn make_object3<'a, 'b, A: SomeTrait + 'a + 'b>(v: A) -> Box<dyn SomeTrait + 'b> {
| ++++
diff --git a/tests/ui/regions/regions-close-param-into-object.stderr b/tests/ui/regions/regions-close-param-into-object.stderr
index 9162be5b9..385441d32 100644
--- a/tests/ui/regions/regions-close-param-into-object.stderr
+++ b/tests/ui/regions/regions-close-param-into-object.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-param-into-object.rs:6:5
|
LL | Box::new(v)
- | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | where T : X + 'static
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/regions-close-param-into-object.rs:12:5
|
LL | Box::new(v)
- | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn p2<T: 'static>(v: Box<T>) -> Box<dyn X + 'static>
| +++++++++
@@ -23,10 +29,13 @@ LL | fn p2<T: 'static>(v: Box<T>) -> Box<dyn X + 'static>
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-close-param-into-object.rs:18:5
|
+LL | fn p3<'a,T>(v: T) -> Box<dyn X + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(v)
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | where T : X + 'a
| ++++
@@ -34,10 +43,13 @@ LL | where T : X + 'a
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-close-param-into-object.rs:24:5
|
+LL | fn p4<'a,T>(v: Box<T>) -> Box<dyn X + 'a>
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+...
LL | Box::new(v)
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn p4<'a,T: 'a>(v: Box<T>) -> Box<dyn X + 'a>
| ++++
diff --git a/tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr b/tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr
index 7c9f40556..8c1791fc1 100644
--- a/tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr
+++ b/tests/ui/regions/regions-implied-bounds-projection-gap-1.stderr
@@ -1,10 +1,13 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-implied-bounds-projection-gap-1.rs:16:5
|
+LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
+ | -- the parameter type `T` must be valid for the lifetime `'x` as defined here...
+LL | {
LL | wf::<&'x T>();
| ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn func<'x, T:Trait1<'x> + 'x>(t: &'x T::Foo)
| ++++
diff --git a/tests/ui/regions/regions-infer-bound-from-trait-self.stderr b/tests/ui/regions/regions-infer-bound-from-trait-self.stderr
index e88f79a3a..d0c4b9a57 100644
--- a/tests/ui/regions/regions-infer-bound-from-trait-self.stderr
+++ b/tests/ui/regions/regions-infer-bound-from-trait-self.stderr
@@ -1,11 +1,16 @@
error[E0309]: the parameter type `Self` may not live long enough
--> $DIR/regions-infer-bound-from-trait-self.rs:46:9
|
+LL | trait InheritsFromNothing<'a> : Sized {
+ | -- the parameter type `Self` must be valid for the lifetime `'a` as defined here...
+LL | fn foo(self, x: Inv<'a>) {
LL | check_bound(x, self)
- | ^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `Self` will meet its required lifetime bounds
|
- = help: consider adding an explicit lifetime bound `Self: 'a`...
- = note: ...so that the type `Self` will meet its required lifetime bounds
+help: consider adding an explicit lifetime bound
+ |
+LL | trait InheritsFromNothing<'a> : Sized where Self: 'a {
+ | ++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/regions/regions-infer-bound-from-trait.stderr b/tests/ui/regions/regions-infer-bound-from-trait.stderr
index 3ee71543d..b9be11a46 100644
--- a/tests/ui/regions/regions-infer-bound-from-trait.stderr
+++ b/tests/ui/regions/regions-infer-bound-from-trait.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `A` may not live long enough
--> $DIR/regions-infer-bound-from-trait.rs:33:5
|
+LL | fn bar1<'a,A>(x: Inv<'a>, a: A) {
+ | -- the parameter type `A` must be valid for the lifetime `'a` as defined here...
LL | check_bound(x, a)
| ^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn bar1<'a,A: 'a>(x: Inv<'a>, a: A) {
| ++++
@@ -12,10 +14,12 @@ LL | fn bar1<'a,A: 'a>(x: Inv<'a>, a: A) {
error[E0309]: the parameter type `A` may not live long enough
--> $DIR/regions-infer-bound-from-trait.rs:37:5
|
+LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) {
+ | -- the parameter type `A` must be valid for the lifetime `'a` as defined here...
LL | check_bound(x, a)
| ^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn bar2<'a,'b,A:Is<'b> + 'a>(x: Inv<'a>, y: Inv<'b>, a: A) {
| ++++
diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs
index d4fea2b19..987fd455f 100644
--- a/tests/ui/repr/16-bit-repr-c-enum.rs
+++ b/tests/ui/repr/16-bit-repr-c-enum.rs
@@ -8,7 +8,7 @@
#![feature(no_core, lang_items, intrinsics, staged_api, rustc_attrs)]
#![no_core]
#![crate_type = "lib"]
-#![stable(feature = "", since = "")]
+#![stable(feature = "intrinsics_for_test", since = "3.3.3")]
#![allow(dead_code)]
// Test that the repr(C) attribute doesn't break compilation
@@ -22,8 +22,8 @@ enum Foo {
}
extern "rust-intrinsic" {
- #[stable(feature = "", since = "")]
- #[rustc_const_stable(feature = "", since = "")]
+ #[stable(feature = "intrinsics_for_test", since = "3.3.3")]
+ #[rustc_const_stable(feature = "intrinsics_for_test", since = "3.3.3")]
#[rustc_safe_intrinsic]
fn size_of<T>() -> usize;
}
diff --git a/tests/ui/repr/repr-align-assign.stderr b/tests/ui/repr/repr-align-assign.stderr
index b878ae0d1..3606d0221 100644
--- a/tests/ui/repr/repr-align-assign.stderr
+++ b/tests/ui/repr/repr-align-assign.stderr
@@ -15,12 +15,16 @@ error[E0693]: incorrect `repr(align)` attribute format
|
LL | #[repr(align=8)]
| ^^^^^^^ help: use parentheses instead: `align(8)`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0693]: incorrect `repr(align)` attribute format
--> $DIR/repr-align-assign.rs:9:8
|
LL | #[repr(align="8")]
| ^^^^^^^^^ help: use parentheses instead: `align(8)`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/repr/repr-align.stderr b/tests/ui/repr/repr-align.stderr
index 900a811bb..84d33a08a 100644
--- a/tests/ui/repr/repr-align.stderr
+++ b/tests/ui/repr/repr-align.stderr
@@ -39,36 +39,48 @@ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
|
LL | #[repr(align(16.0))]
| ^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not a power of two
--> $DIR/repr-align.rs:7:8
|
LL | #[repr(align(15))]
| ^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
--> $DIR/repr-align.rs:11:8
|
LL | #[repr(align(4294967296))]
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
--> $DIR/repr-align.rs:18:8
|
LL | #[repr(align(16.0))]
| ^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: not a power of two
--> $DIR/repr-align.rs:22:8
|
LL | #[repr(align(15))]
| ^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0589]: invalid `repr(align)` attribute: larger than 2^29
--> $DIR/repr-align.rs:26:8
|
LL | #[repr(align(4294967296))]
| ^^^^^^^^^^^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 12 previous errors
diff --git a/tests/ui/resolve/fn-new-doesnt-exist.rs b/tests/ui/resolve/fn-new-doesnt-exist.rs
new file mode 100644
index 000000000..4f6290808
--- /dev/null
+++ b/tests/ui/resolve/fn-new-doesnt-exist.rs
@@ -0,0 +1,5 @@
+use std::net::TcpStream;
+
+fn main() {
+ let stream = TcpStream::new(); //~ ERROR no function or associated item named `new` found
+}
diff --git a/tests/ui/resolve/fn-new-doesnt-exist.stderr b/tests/ui/resolve/fn-new-doesnt-exist.stderr
new file mode 100644
index 000000000..39adc0fde
--- /dev/null
+++ b/tests/ui/resolve/fn-new-doesnt-exist.stderr
@@ -0,0 +1,14 @@
+error[E0599]: no function or associated item named `new` found for struct `TcpStream` in the current scope
+ --> $DIR/fn-new-doesnt-exist.rs:4:28
+ |
+LL | let stream = TcpStream::new();
+ | ^^^ function or associated item not found in `TcpStream`
+ |
+note: if you're trying to build a new `TcpStream` consider using one of the following associated functions:
+ TcpStream::connect
+ TcpStream::connect_timeout
+ --> $SRC_DIR/std/src/net/tcp.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/resolve/issue-116164.rs b/tests/ui/resolve/issue-116164.rs
new file mode 100644
index 000000000..d30c8f514
--- /dev/null
+++ b/tests/ui/resolve/issue-116164.rs
@@ -0,0 +1,19 @@
+#![allow(unused_imports)]
+
+mod inner {
+ pub enum Example {
+ ExOne,
+ }
+}
+
+mod reexports {
+ pub use crate::inner::Example as _;
+}
+
+use crate::reexports::*;
+//~^ SUGGESTION: use inner::Example::ExOne
+
+fn main() {
+ ExOne;
+ //~^ ERROR: cannot find value `ExOne` in this scope
+}
diff --git a/tests/ui/resolve/issue-116164.stderr b/tests/ui/resolve/issue-116164.stderr
new file mode 100644
index 000000000..5820a189f
--- /dev/null
+++ b/tests/ui/resolve/issue-116164.stderr
@@ -0,0 +1,14 @@
+error[E0425]: cannot find value `ExOne` in this scope
+ --> $DIR/issue-116164.rs:17:5
+ |
+LL | ExOne;
+ | ^^^^^ not found in this scope
+ |
+help: consider importing this unit variant
+ |
+LL + use inner::Example::ExOne;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/resolve/issue-55673.fixed b/tests/ui/resolve/issue-55673.fixed
new file mode 100644
index 000000000..261742a26
--- /dev/null
+++ b/tests/ui/resolve/issue-55673.fixed
@@ -0,0 +1,21 @@
+// run-rustfix
+#![allow(dead_code)]
+trait Foo {
+ type Bar;
+}
+
+fn foo<T: Foo>()
+where
+ T::Bar: std::fmt::Debug,
+ //~^ ERROR associated type `Baa` not found for `T`
+{
+}
+
+fn bar<T>()
+where
+ T::Bar: std::fmt::Debug, T: Foo
+ //~^ ERROR associated type `Baa` not found for `T`
+{
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-55673.rs b/tests/ui/resolve/issue-55673.rs
index 0436bd397..6ac49be14 100644
--- a/tests/ui/resolve/issue-55673.rs
+++ b/tests/ui/resolve/issue-55673.rs
@@ -1,3 +1,5 @@
+// run-rustfix
+#![allow(dead_code)]
trait Foo {
type Bar;
}
@@ -9,4 +11,11 @@ where
{
}
+fn bar<T>()
+where
+ T::Baa: std::fmt::Debug,
+ //~^ ERROR associated type `Baa` not found for `T`
+{
+}
+
fn main() {}
diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr
index 39318f959..ffc325223 100644
--- a/tests/ui/resolve/issue-55673.stderr
+++ b/tests/ui/resolve/issue-55673.stderr
@@ -1,9 +1,29 @@
error[E0220]: associated type `Baa` not found for `T`
- --> $DIR/issue-55673.rs:7:8
+ --> $DIR/issue-55673.rs:9:8
|
LL | T::Baa: std::fmt::Debug,
| ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
+ |
+help: change the associated type name to use `Bar` from `Foo`
+ |
+LL | T::Bar: std::fmt::Debug,
+ | ~~~
+
+error[E0220]: associated type `Baa` not found for `T`
+ --> $DIR/issue-55673.rs:16:8
+ |
+LL | T::Baa: std::fmt::Debug,
+ | ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
+ |
+help: consider further restricting type parameter `T`
+ |
+LL | T::Baa: std::fmt::Debug, T: Foo
+ | ~~~~~~~~
+help: and also change the associated type name
+ |
+LL | T::Bar: std::fmt::Debug,
+ | ~~~
-error: aborting due to previous error
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
index 49462f52f..927ecd9ae 100644
--- a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
+++ b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.rs
@@ -9,11 +9,9 @@ impl A {
trait B {
async fn associated();
- //~^ ERROR cannot be declared `async`
}
impl B for A {
async fn associated(); //~ ERROR without body
- //~^ ERROR cannot be declared `async`
}
fn main() {}
diff --git a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
index 1354abb4f..da9eeea95 100644
--- a/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
+++ b/tests/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr
@@ -15,39 +15,12 @@ LL | async fn inherent();
| help: provide a definition for the function: `{ <body> }`
error: associated function in `impl` without body
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
+ --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:14:5
|
LL | async fn associated();
| ^^^^^^^^^^^^^^^^^^^^^-
| |
| help: provide a definition for the function: `{ <body> }`
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:5
- |
-LL | async fn associated();
- | -----^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0706]: functions in traits cannot be declared `async`
- --> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
- |
-LL | async fn associated();
- | -----^^^^^^^^^^^^^^^^^
- | |
- | `async` because of this
- |
- = note: `async` trait functions are not currently supported
- = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
- = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
- = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0706`.
diff --git a/tests/ui/resolve/issue-82865.stderr b/tests/ui/resolve/issue-82865.stderr
index 730fd6d60..9d0439d9d 100644
--- a/tests/ui/resolve/issue-82865.stderr
+++ b/tests/ui/resolve/issue-82865.stderr
@@ -15,6 +15,13 @@ LL | Box::z
LL | mac!();
| ------ in this macro invocation
|
+note: if you're trying to build a new `Box<_, _>` consider using one of the following associated functions:
+ Box::<T>::new
+ Box::<T>::new_uninit
+ Box::<T>::new_zeroed
+ Box::<T>::try_new
+ and 18 others
+ --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
= note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr
index 42b7281d7..d6240fb8f 100644
--- a/tests/ui/resolve/resolve-inconsistent-names.stderr
+++ b/tests/ui/resolve/resolve-inconsistent-names.stderr
@@ -1,11 +1,3 @@
-error[E0408]: variable `a` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:13:12
- |
-LL | a | b => {}
- | - ^ pattern doesn't bind `a`
- | |
- | variable not in all patterns
-
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:13:8
|
@@ -14,6 +6,14 @@ LL | a | b => {}
| |
| pattern doesn't bind `b`
+error[E0408]: variable `a` is not bound in all patterns
+ --> $DIR/resolve-inconsistent-names.rs:13:12
+ |
+LL | a | b => {}
+ | - ^ pattern doesn't bind `a`
+ | |
+ | variable not in all patterns
+
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:19:9
|
@@ -54,6 +54,19 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
| |
| first binding
+error[E0408]: variable `Const2` is not bound in all patterns
+ --> $DIR/resolve-inconsistent-names.rs:31:9
+ |
+LL | (CONST1, _) | (_, Const2) => ()
+ | ^^^^^^^^^^^ ------ variable not in all patterns
+ | |
+ | pattern doesn't bind `Const2`
+ |
+help: if you meant to match on constant `m::Const2`, use the full path in the pattern
+ |
+LL | (CONST1, _) | (_, m::Const2) => ()
+ | ~~~~~~~~~
+
error[E0408]: variable `CONST1` is not bound in all patterns
--> $DIR/resolve-inconsistent-names.rs:31:23
|
@@ -68,19 +81,6 @@ note: you might have meant to match on constant `m::CONST1`, which exists but is
LL | const CONST1: usize = 10;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not accessible
-error[E0408]: variable `Const2` is not bound in all patterns
- --> $DIR/resolve-inconsistent-names.rs:31:9
- |
-LL | (CONST1, _) | (_, Const2) => ()
- | ^^^^^^^^^^^ ------ variable not in all patterns
- | |
- | pattern doesn't bind `Const2`
- |
-help: if you meant to match on constant `m::Const2`, use the full path in the pattern
- |
-LL | (CONST1, _) | (_, m::Const2) => ()
- | ~~~~~~~~~
-
error[E0308]: mismatched types
--> $DIR/resolve-inconsistent-names.rs:19:19
|
diff --git a/tests/ui/return/return-impl-trait-bad.stderr b/tests/ui/return/return-impl-trait-bad.stderr
index 237b85ee6..a015b9f53 100644
--- a/tests/ui/return/return-impl-trait-bad.stderr
+++ b/tests/ui/return/return-impl-trait-bad.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn bad_echo<T>(_t: T) -> T {
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
LL | "this should not suggest impl Trait"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
@@ -17,7 +17,7 @@ error[E0308]: mismatched types
LL | fn bad_echo_2<T: Trait>(_t: T) -> T {
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
LL | "this will not suggest it, because that would probably be wrong"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
@@ -30,7 +30,7 @@ error[E0308]: mismatched types
LL | fn other_bounds_bad<T>() -> T
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
...
LL | "don't suggest this, because Option<T> places additional constraints"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
@@ -46,7 +46,7 @@ LL | fn used_in_trait<T>() -> T
| | |
| | expected `T` because of return type
| | help: consider using an impl return type: `impl Send`
- | this type parameter
+ | expected this type parameter
...
LL | "don't suggest this, because the generic param is used in the bound."
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
diff --git a/tests/ui/return/return-impl-trait.stderr b/tests/ui/return/return-impl-trait.stderr
index 43d40972f..707f014a1 100644
--- a/tests/ui/return/return-impl-trait.stderr
+++ b/tests/ui/return/return-impl-trait.stderr
@@ -5,7 +5,7 @@ LL | fn bar<T: Trait + std::marker::Sync>() -> T
| - -
| | |
| | expected `T` because of return type
- | this type parameter help: consider using an impl return type: `impl Trait + std::marker::Sync + Send`
+ | expected this type parameter help: consider using an impl return type: `impl Trait + std::marker::Sync + Send`
...
LL | ()
| ^^ expected type parameter `T`, found `()`
@@ -21,7 +21,7 @@ LL | fn other_bounds<T>() -> T
| | |
| | expected `T` because of return type
| | help: consider using an impl return type: `impl Trait`
- | this type parameter
+ | expected this type parameter
...
LL | ()
| ^^ expected type parameter `T`, found `()`
diff --git a/tests/ui/return/return-struct.stderr b/tests/ui/return/return-struct.stderr
index e6c0363e3..282e6498e 100644
--- a/tests/ui/return/return-struct.stderr
+++ b/tests/ui/return/return-struct.stderr
@@ -17,7 +17,7 @@ error[E0308]: mismatched types
--> $DIR/return-struct.rs:15:5
|
LL | fn bar() {
- | - help: try adding a return type: `-> Age`
+ | - help: try adding a return type: `-> Age`
LL | let mut age = 29;
LL | Age::Years(age, 55)
| ^^^^^^^^^^^^^^^^^^^ expected `()`, found `Age`
@@ -26,7 +26,7 @@ error[E0308]: mismatched types
--> $DIR/return-struct.rs:20:5
|
LL | fn baz() {
- | - help: try adding a return type: `-> S`
+ | - help: try adding a return type: `-> S`
LL | S
| ^ expected `()`, found `S`
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs
index 2b3fbd2a4..e591b2a93 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs
@@ -40,7 +40,8 @@ fn main() {
const CFN1: Wrap<fn()> = Wrap(trivial);
let input: Wrap<fn()> = Wrap(trivial);
match Wrap(input) {
- Wrap(CFN1) => count += 1,
+ Wrap(CFN1) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -48,7 +49,8 @@ fn main() {
const CFN2: Wrap<fn(SM)> = Wrap(sm_to);
let input: Wrap<fn(SM)> = Wrap(sm_to);
match Wrap(input) {
- Wrap(CFN2) => count += 1,
+ Wrap(CFN2) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -56,7 +58,8 @@ fn main() {
const CFN3: Wrap<fn() -> SM> = Wrap(to_sm);
let input: Wrap<fn() -> SM> = Wrap(to_sm);
match Wrap(input) {
- Wrap(CFN3) => count += 1,
+ Wrap(CFN3) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -64,7 +67,8 @@ fn main() {
const CFN4: Wrap<fn(NotSM)> = Wrap(not_sm_to);
let input: Wrap<fn(NotSM)> = Wrap(not_sm_to);
match Wrap(input) {
- Wrap(CFN4) => count += 1,
+ Wrap(CFN4) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -72,7 +76,8 @@ fn main() {
const CFN5: Wrap<fn() -> NotSM> = Wrap(to_not_sm);
let input: Wrap<fn() -> NotSM> = Wrap(to_not_sm);
match Wrap(input) {
- Wrap(CFN5) => count += 1,
+ Wrap(CFN5) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -80,7 +85,8 @@ fn main() {
const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to);
let input: Wrap<fn(&SM)> = Wrap(r_sm_to);
match Wrap(input) {
- Wrap(CFN6) => count += 1,
+ Wrap(CFN6) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -88,7 +94,8 @@ fn main() {
const CFN7: Wrap<fn(&()) -> &SM> = Wrap(r_to_r_sm);
let input: Wrap<fn(&()) -> &SM> = Wrap(r_to_r_sm);
match Wrap(input) {
- Wrap(CFN7) => count += 1,
+ Wrap(CFN7) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -96,7 +103,8 @@ fn main() {
const CFN8: Wrap<fn(&NotSM)> = Wrap(r_not_sm_to);
let input: Wrap<fn(&NotSM)> = Wrap(r_not_sm_to);
match Wrap(input) {
- Wrap(CFN8) => count += 1,
+ Wrap(CFN8) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -104,7 +112,8 @@ fn main() {
const CFN9: Wrap<fn(&()) -> &NotSM> = Wrap(r_to_r_not_sm);
let input: Wrap<fn(&()) -> &NotSM> = Wrap(r_to_r_not_sm);
match Wrap(input) {
- Wrap(CFN9) => count += 1,
+ Wrap(CFN9) => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Wrap(_) => {}
};
@@ -126,7 +135,8 @@ fn main() {
let input = Foo { alpha: not_sm_to, beta: to_not_sm, gamma: sm_to, delta: to_sm };
match input {
- CFOO => count += 1,
+ CFOO => count += 1, //~WARN behave unpredictably
+ //~| previously accepted
Foo { .. } => {}
};
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr
new file mode 100644
index 000000000..080bf5885
--- /dev/null
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.stderr
@@ -0,0 +1,93 @@
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:43:14
+ |
+LL | Wrap(CFN1) => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+ = note: `#[warn(pointer_structural_match)]` on by default
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:52:14
+ |
+LL | Wrap(CFN2) => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:61:14
+ |
+LL | Wrap(CFN3) => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:70:14
+ |
+LL | Wrap(CFN4) => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:79:14
+ |
+LL | Wrap(CFN5) => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:88:14
+ |
+LL | Wrap(CFN6) => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:97:14
+ |
+LL | Wrap(CFN7) => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:106:14
+ |
+LL | Wrap(CFN8) => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:115:14
+ |
+LL | Wrap(CFN9) => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/fn-ptr-is-structurally-matchable.rs:138:9
+ |
+LL | CFOO => count += 1,
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: 10 warnings emitted
+
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs
index 567685950..b05b8c8da 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs
@@ -26,6 +26,7 @@ fn my_fn(_args: &[A]) {
}
const TEST: Fn = my_fn;
+const TEST2: (Fn, u8) = (TEST, 0);
struct B(Fn);
@@ -33,8 +34,14 @@ fn main() {
let s = B(my_fn);
match s {
B(TEST) => println!("matched"),
- //~^ WARN pointers in patterns behave unpredictably
+ //~^ WARN behave unpredictably
//~| WARN this was previously accepted by the compiler but is being phased out
_ => panic!("didn't match")
};
+ match (s.0, 0) {
+ TEST2 => println!("matched"),
+ //~^ WARN behave unpredictably
+ //~| WARN this was previously accepted by the compiler but is being phased out
+ _ => panic!("didn't match")
+ }
}
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
index d6afc0255..4fdfce60b 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
@@ -1,5 +1,5 @@
-warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
- --> $DIR/issue-63479-match-fnptr.rs:35:7
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-63479-match-fnptr.rs:36:7
|
LL | B(TEST) => println!("matched"),
| ^^^^
@@ -12,5 +12,14 @@ note: the lint level is defined here
LL | #![warn(pointer_structural_match)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-warning: 1 warning emitted
+warning: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+ --> $DIR/issue-63479-match-fnptr.rs:42:5
+ |
+LL | TEST2 => println!("matched"),
+ | ^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
+
+warning: 2 warnings emitted
diff --git a/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr b/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr
index d183eaaa6..5f8c5dbe6 100644
--- a/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr
+++ b/tests/ui/rfcs/rfc-1623-static/rfc1623-2.stderr
@@ -15,6 +15,7 @@ LL | f: &id,
|
= note: expected trait `for<'a, 'b> Fn<(&'a Foo<'b>,)>`
found trait `Fn<(&Foo<'_>,)>`
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: implementation of `FnOnce` is not general enough
--> $DIR/rfc1623-2.rs:28:8
diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
index 77227ebd8..1933a68c2 100644
--- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
+++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.rs
@@ -1,4 +1,3 @@
-#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
mod child {
diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
index c4371a002..40f736c21 100644
--- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
+++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr
@@ -1,11 +1,11 @@
error[E0277]: the trait bound `Something: Termination` is not satisfied
- --> $DIR/issue-103052-2.rs:12:22
+ --> $DIR/issue-103052-2.rs:11:22
|
LL | fn main() -> Something {
| ^^^^^^^^^ the trait `Termination` is not implemented for `Something`
|
note: required by a bound in `Main::{opaque#0}`
- --> $DIR/issue-103052-2.rs:6:27
+ --> $DIR/issue-103052-2.rs:5:27
|
LL | fn main() -> impl std::process::Termination;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::{opaque#0}`
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
index de1bf8be8..7386f10a6 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr
@@ -17,18 +17,18 @@ LL | match NonExhaustiveEnum::Unit {}
| ^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonExhaustiveEnum::Unit`, `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered
|
note: `NonExhaustiveEnum` defined here
- --> $DIR/enum_same_crate_empty_match.rs:5:5
+ --> $DIR/enum_same_crate_empty_match.rs:4:10
|
LL | pub enum NonExhaustiveEnum {
- | -----------------
+ | ^^^^^^^^^^^^^^^^^
LL | Unit,
- | ^^^^ not covered
+ | ---- not covered
LL |
LL | Tuple(u32),
- | ^^^^^ not covered
+ | ----- not covered
LL |
LL | Struct { field: u32 }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `NonExhaustiveEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
@@ -44,18 +44,18 @@ LL | match NormalEnum::Unit {}
| ^^^^^^^^^^^^^^^^ patterns `NormalEnum::Unit`, `NormalEnum::Tuple(_)` and `NormalEnum::Struct { .. }` not covered
|
note: `NormalEnum` defined here
- --> $DIR/enum_same_crate_empty_match.rs:14:5
+ --> $DIR/enum_same_crate_empty_match.rs:13:10
|
LL | pub enum NormalEnum {
- | ----------
+ | ^^^^^^^^^^
LL | Unit,
- | ^^^^ not covered
+ | ---- not covered
LL |
LL | Tuple(u32),
- | ^^^^^ not covered
+ | ----- not covered
LL |
LL | Struct { field: u32 }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `NormalEnum`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr
new file mode 100644
index 000000000..9192c6614
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.lint.stderr
@@ -0,0 +1,75 @@
+error: some variants are not matched explicitly
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:15:11
+ |
+LL | match val {
+ | ^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+ |
+ = help: ensure that all variants are matched explicitly by adding the suggested match arms
+ = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:14:12
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: some variants are not matched explicitly
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:23:11
+ |
+LL | match val {
+ | ^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+ |
+ = help: ensure that all variants are matched explicitly by adding the suggested match arms
+ = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:22:27
+ |
+LL | #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:34:9
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[deny(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:42:9
+ |
+LL | #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[deny(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:50:9
+ |
+LL | #[cfg_attr(lint, warn(non_exhaustive_omitted_patterns))]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[warn(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+error: aborting due to 2 previous errors; 3 warnings emitted
+
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr
new file mode 100644
index 000000000..46093eb9f
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.normal.stderr
@@ -0,0 +1,31 @@
+error: some variants are not matched explicitly
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:15:11
+ |
+LL | match val {
+ | ^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+ |
+ = help: ensure that all variants are matched explicitly by adding the suggested match arms
+ = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:14:12
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: the lint level must be set on the whole match
+ --> $DIR/omitted-patterns-dont-lint-on-arm.rs:34:9
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ------------------------------- remove this attribute
+LL | _ => {}
+ | ^
+ |
+ = help: it no longer has any effect to set the lint level on an individual match arm
+help: set the lint level on the whole match
+ |
+LL + #[deny(non_exhaustive_omitted_patterns)]
+LL | match val {
+ |
+
+error: aborting due to previous error; 1 warning emitted
+
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs
new file mode 100644
index 000000000..33f9f56a5
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns-dont-lint-on-arm.rs
@@ -0,0 +1,53 @@
+// revisions: normal lint
+// Test that putting the lint level on a match arm emits a warning, as this was previously
+// meaningful and is no longer.
+#![feature(non_exhaustive_omitted_patterns_lint)]
+
+// aux-build:enums.rs
+extern crate enums;
+
+use enums::NonExhaustiveEnum;
+
+fn main() {
+ let val = NonExhaustiveEnum::Unit;
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match val {
+ //~^ ERROR some variants are not matched explicitly
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ _ => {}
+ }
+
+ #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ match val {
+ //[lint]~^ ERROR some variants are not matched explicitly
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ _ => {}
+ }
+
+ match val {
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ #[deny(non_exhaustive_omitted_patterns)]
+ _ => {}
+ }
+ //~^^ WARN lint level must be set on the whole match
+
+ match val {
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ #[cfg_attr(lint, deny(non_exhaustive_omitted_patterns))]
+ _ => {}
+ }
+ //[lint]~^^ WARN lint level must be set on the whole match
+
+ match val {
+ NonExhaustiveEnum::Unit => {}
+ NonExhaustiveEnum::Tuple(_) => {}
+ #[cfg_attr(lint, warn(non_exhaustive_omitted_patterns))]
+ _ => {}
+ }
+ //[lint]~^^ WARN lint level must be set on the whole match
+}
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
index 3482af747..e0a6051a8 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs
@@ -13,8 +13,8 @@ use enums::{
EmptyNonExhaustiveEnum, NestedNonExhaustive, NonExhaustiveEnum, NonExhaustiveSingleVariant,
VariantNonExhaustive,
};
-use unstable::{UnstableEnum, OnlyUnstableEnum, UnstableStruct, OnlyUnstableStruct};
use structs::{FunctionalRecord, MixedVisFields, NestedStruct, NormalStruct};
+use unstable::{OnlyUnstableEnum, OnlyUnstableStruct, UnstableEnum, UnstableStruct};
#[non_exhaustive]
#[derive(Default)]
@@ -35,10 +35,10 @@ fn main() {
let enumeration = Bar::A;
// Ok: this is a crate local non_exhaustive enum
+ #[deny(non_exhaustive_omitted_patterns)]
match enumeration {
Bar::A => {}
Bar::B => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
@@ -51,50 +51,87 @@ fn main() {
_ => {}
}
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
+ //~^ some variants are not matched explicitly
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
+ //~^ some variants are not matched explicitly
NonExhaustiveEnum::Unit | NonExhaustiveEnum::Struct { .. } => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
let x = 5;
+ // We ignore the guard.
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
NonExhaustiveEnum::Unit if x > 10 => {}
NonExhaustiveEnum::Tuple(_) => {}
NonExhaustiveEnum::Struct { .. } => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (non_enum, true) {
+ (NonExhaustiveEnum::Unit, true) => {}
+ (NonExhaustiveEnum::Tuple(_), false) => {}
+ (NonExhaustiveEnum::Struct { .. }, false) => {}
+ _ => {}
+ }
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (non_enum, true) {
+ //~^ some variants are not matched explicitly
+ (NonExhaustiveEnum::Unit, true) => {}
+ (NonExhaustiveEnum::Tuple(_), false) => {}
+ _ => {}
+ }
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (true, non_enum) {
+ (true, NonExhaustiveEnum::Unit) => {}
+ (false, NonExhaustiveEnum::Tuple(_)) => {}
+ (false, NonExhaustiveEnum::Struct { .. }) => {}
+ _ => {}
+ }
+ #[deny(non_exhaustive_omitted_patterns)]
+ match (true, non_enum) {
+ //~^ some variants are not matched explicitly
+ (true, NonExhaustiveEnum::Unit) => {}
+ (false, NonExhaustiveEnum::Tuple(_)) => {}
+ _ => {}
+ }
+
+ #[deny(non_exhaustive_omitted_patterns)]
+ match Some(non_enum) {
+ //~^ some variants are not matched explicitly
+ Some(NonExhaustiveEnum::Unit) => {}
+ Some(NonExhaustiveEnum::Tuple(_)) => {}
+ _ => {}
+ }
// Ok: all covered and not `unreachable-patterns`
#[deny(unreachable_patterns)]
+ #[deny(non_exhaustive_omitted_patterns)]
match non_enum {
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
NonExhaustiveEnum::Struct { .. } => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
#[deny(non_exhaustive_omitted_patterns)]
match NestedNonExhaustive::B {
+ //~^ some variants are not matched explicitly
NestedNonExhaustive::A(NonExhaustiveEnum::Unit) => {}
NestedNonExhaustive::A(_) => {}
NestedNonExhaustive::B => {}
_ => {}
}
- //~^^ some variants are not matched explicitly
- //~^^^^^ some variants are not matched explicitly
#[warn(non_exhaustive_omitted_patterns)]
match VariantNonExhaustive::Baz(1, 2) {
@@ -120,30 +157,36 @@ fn main() {
#[warn(non_exhaustive_omitted_patterns)]
let MixedVisFields { a, b, .. } = MixedVisFields::default();
- // Ok: because this only has 1 variant
+ // Ok: this only has 1 variant
#[deny(non_exhaustive_omitted_patterns)]
match NonExhaustiveSingleVariant::A(true) {
NonExhaustiveSingleVariant::A(true) => {}
_ => {}
}
+ // We can't catch the case below, so for consistency we don't catch this one either.
#[deny(non_exhaustive_omitted_patterns)]
match NonExhaustiveSingleVariant::A(true) {
_ => {}
}
- //~^^ some variants are not matched explicitly
+ // We can't catch this case, because this would require digging fully through all the values of
+ // any type we encounter. We need to be able to only consider present constructors.
+ #[deny(non_exhaustive_omitted_patterns)]
+ match &NonExhaustiveSingleVariant::A(true) {
+ _ => {}
+ }
// Ok: we don't lint on `if let` expressions
#[deny(non_exhaustive_omitted_patterns)]
if let NonExhaustiveEnum::Tuple(_) = non_enum {}
+ #[deny(non_exhaustive_omitted_patterns)]
match UnstableEnum::Stable {
+ //~^ some variants are not matched explicitly
UnstableEnum::Stable => {}
UnstableEnum::Stable2 => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
// Ok: the feature is on and all variants are matched
#[deny(non_exhaustive_omitted_patterns)]
@@ -164,10 +207,10 @@ fn main() {
#[deny(non_exhaustive_omitted_patterns)]
match OnlyUnstableEnum::Unstable {
+ //~^ some variants are not matched explicitly
OnlyUnstableEnum::Unstable => {}
_ => {}
}
- //~^^ some variants are not matched explicitly
#[warn(non_exhaustive_omitted_patterns)]
let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new();
@@ -194,14 +237,13 @@ fn main() {
let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit;
//~^ refutable pattern in local binding
- // Check that matching on a reference results in a correctly spanned diagnostic
#[deny(non_exhaustive_omitted_patterns)]
match &non_enum {
+ //~^ some variants are not matched explicitly
NonExhaustiveEnum::Unit => {}
NonExhaustiveEnum::Tuple(_) => {}
_ => {}
}
- //~^^ some variants are not matched explicitly
}
#[deny(non_exhaustive_omitted_patterns)]
@@ -209,3 +251,10 @@ fn main() {
pub fn takes_non_exhaustive(_: NonExhaustiveEnum) {
let _closure = |_: NonExhaustiveEnum| {};
}
+
+// ICE #117033
+enum Void {}
+#[deny(non_exhaustive_omitted_patterns)]
+pub fn void(v: Void) -> ! {
+ match v {}
+}
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr
index 923394474..7db61f124 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.stderr
@@ -1,5 +1,5 @@
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:102:9
+ --> $DIR/omitted-patterns.rs:139:9
|
LL | VariantNonExhaustive::Bar { x, .. } => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `y` not listed
@@ -7,13 +7,13 @@ LL | VariantNonExhaustive::Bar { x, .. } => {}
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `VariantNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:99:12
+ --> $DIR/omitted-patterns.rs:136:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:107:9
+ --> $DIR/omitted-patterns.rs:144:9
|
LL | let FunctionalRecord { first_field, second_field, .. } = FunctionalRecord::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `third_field` not listed
@@ -21,13 +21,13 @@ LL | let FunctionalRecord { first_field, second_field, .. } = FunctionalReco
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `FunctionalRecord` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:106:12
+ --> $DIR/omitted-patterns.rs:143:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:115:29
+ --> $DIR/omitted-patterns.rs:152:29
|
LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = NestedStruct::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `second_field` not listed
@@ -35,13 +35,13 @@ LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = Nested
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `NormalStruct` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:114:12
+ --> $DIR/omitted-patterns.rs:151:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:115:9
+ --> $DIR/omitted-patterns.rs:152:9
|
LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = NestedStruct::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `foo` not listed
@@ -50,7 +50,7 @@ LL | let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = Nested
= note: the pattern is of type `NestedStruct` and the `non_exhaustive_omitted_patterns` attribute was found
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:173:9
+ --> $DIR/omitted-patterns.rs:216:9
|
LL | let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `unstable2` not listed
@@ -58,13 +58,13 @@ LL | let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new();
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `OnlyUnstableStruct` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:172:12
+ --> $DIR/omitted-patterns.rs:215:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: some fields are not explicitly listed
- --> $DIR/omitted-patterns.rs:181:9
+ --> $DIR/omitted-patterns.rs:224:9
|
LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `unstable` not listed
@@ -72,120 +72,125 @@ LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
= help: ensure that all fields are mentioned explicitly by adding the suggested fields
= note: the pattern is of type `UnstableStruct` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:180:12
+ --> $DIR/omitted-patterns.rs:223:12
|
LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:58:9
+ --> $DIR/omitted-patterns.rs:55:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+LL | match non_enum {
+ | ^^^^^^^^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:57:16
+ --> $DIR/omitted-patterns.rs:54:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:65:9
+ --> $DIR/omitted-patterns.rs:63:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Tuple(_)` not covered
+LL | match non_enum {
+ | ^^^^^^^^ pattern `NonExhaustiveEnum::Tuple(_)` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:64:16
+ --> $DIR/omitted-patterns.rs:62:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:75:9
+ --> $DIR/omitted-patterns.rs:87:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Unit` not covered
+LL | match (non_enum, true) {
+ | ^^^^^^^^^^^^^^^^ pattern `(NonExhaustiveEnum::Struct { .. }, _)` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `(NonExhaustiveEnum, bool)` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:74:16
+ --> $DIR/omitted-patterns.rs:86:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:92:32
+ --> $DIR/omitted-patterns.rs:102:11
|
-LL | NestedNonExhaustive::A(_) => {}
- | ^ patterns `NonExhaustiveEnum::Tuple(_)` and `NonExhaustiveEnum::Struct { .. }` not covered
+LL | match (true, non_enum) {
+ | ^^^^^^^^^^^^^^^^ pattern `(_, NonExhaustiveEnum::Struct { .. })` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `(bool, NonExhaustiveEnum)` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:89:12
+ --> $DIR/omitted-patterns.rs:101:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:94:9
+ --> $DIR/omitted-patterns.rs:110:11
|
-LL | _ => {}
- | ^ pattern `NestedNonExhaustive::C` not covered
+LL | match Some(non_enum) {
+ | ^^^^^^^^^^^^^^ pattern `Some(NonExhaustiveEnum::Struct { .. })` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NestedNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `Option<NonExhaustiveEnum>` and the `non_exhaustive_omitted_patterns` attribute was found
+note: the lint level is defined here
+ --> $DIR/omitted-patterns.rs:109:12
+ |
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:132:9
+ --> $DIR/omitted-patterns.rs:128:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveSingleVariant::A(_)` not covered
+LL | match NestedNonExhaustive::B {
+ | ^^^^^^^^^^^^^^^^^^^^^^ patterns `NestedNonExhaustive::C`, `NestedNonExhaustive::A(NonExhaustiveEnum::Tuple(_))` and `NestedNonExhaustive::A(NonExhaustiveEnum::Struct { .. })` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveSingleVariant` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `NestedNonExhaustive` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:130:12
+ --> $DIR/omitted-patterns.rs:127:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:144:9
+ --> $DIR/omitted-patterns.rs:184:11
|
-LL | _ => {}
- | ^ pattern `UnstableEnum::Unstable` not covered
+LL | match UnstableEnum::Stable {
+ | ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Unstable` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `UnstableEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:143:16
+ --> $DIR/omitted-patterns.rs:183:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:168:9
+ --> $DIR/omitted-patterns.rs:209:11
|
-LL | _ => {}
- | ^ pattern `OnlyUnstableEnum::Unstable2` not covered
+LL | match OnlyUnstableEnum::Unstable {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `OnlyUnstableEnum::Unstable2` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `OnlyUnstableEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:165:12
+ --> $DIR/omitted-patterns.rs:208:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0005]: refutable pattern in local binding
- --> $DIR/omitted-patterns.rs:194:9
+ --> $DIR/omitted-patterns.rs:237:9
|
LL | let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit;
| ^^^^^^^^^^^^^^^ pattern `_` not covered
@@ -199,15 +204,15 @@ LL | let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit
| ++++++++++++++++
error: some variants are not matched explicitly
- --> $DIR/omitted-patterns.rs:202:9
+ --> $DIR/omitted-patterns.rs:241:11
|
-LL | _ => {}
- | ^ pattern `NonExhaustiveEnum::Struct { .. }` not covered
+LL | match &non_enum {
+ | ^^^^^^^^^ pattern `&NonExhaustiveEnum::Struct { .. }` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
- = note: the matched value is of type `NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
+ = note: the matched value is of type `&NonExhaustiveEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/omitted-patterns.rs:198:12
+ --> $DIR/omitted-patterns.rs:240:12
|
LL | #[deny(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
index 82ee68687..1828fdef9 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs
@@ -6,23 +6,23 @@
// aux-build:unstable.rs
extern crate unstable;
-use unstable::{UnstableEnum, OnlyUnstableEnum, UnstableStruct, OnlyUnstableStruct};
+use unstable::{OnlyUnstableEnum, OnlyUnstableStruct, UnstableEnum, UnstableStruct};
fn main() {
// OK: this matches all the stable variants
+ #[deny(non_exhaustive_omitted_patterns)]
match UnstableEnum::Stable {
UnstableEnum::Stable => {}
UnstableEnum::Stable2 => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
+ #[deny(non_exhaustive_omitted_patterns)]
match UnstableEnum::Stable {
+ //~^ some variants are not matched explicitly
UnstableEnum::Stable => {}
- #[deny(non_exhaustive_omitted_patterns)]
_ => {}
}
- //~^^ some variants are not matched explicitly
// Ok: although this is a bit odd, we don't have anything to report
// since there is no stable variants and the feature is off
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr
index f38368590..27939176f 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.stderr
@@ -13,18 +13,18 @@ LL | #[warn(non_exhaustive_omitted_patterns)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: some variants are not matched explicitly
- --> $DIR/stable-omitted-patterns.rs:23:9
+ --> $DIR/stable-omitted-patterns.rs:21:11
|
-LL | _ => {}
- | ^ pattern `UnstableEnum::Stable2` not covered
+LL | match UnstableEnum::Stable {
+ | ^^^^^^^^^^^^^^^^^^^^ pattern `UnstableEnum::Stable2` not covered
|
= help: ensure that all variants are matched explicitly by adding the suggested match arms
= note: the matched value is of type `UnstableEnum` and the `non_exhaustive_omitted_patterns` attribute was found
note: the lint level is defined here
- --> $DIR/stable-omitted-patterns.rs:22:16
+ --> $DIR/stable-omitted-patterns.rs:20:12
|
-LL | #[deny(non_exhaustive_omitted_patterns)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deny(non_exhaustive_omitted_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr
index a9c54af04..c125756a6 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr
@@ -62,14 +62,14 @@ LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
- --> $DIR/auxiliary/uninhabited.rs:17:23
+ --> $DIR/auxiliary/uninhabited.rs:16:1
|
LL | pub enum UninhabitedVariants {
- | ----------------------------
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
- | ^^^^^ not covered
+ | ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr
index ec2a2f6f0..7a12aca85 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr
@@ -43,14 +43,14 @@ LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
- --> $DIR/match_same_crate.rs:16:23
+ --> $DIR/match_same_crate.rs:15:10
|
LL | pub enum UninhabitedVariants {
- | -------------------
+ | ^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
- | ^^^^^ not covered
+ | ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr
index b6b777ec5..19e2546b0 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr
@@ -62,14 +62,14 @@ LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
- --> $DIR/auxiliary/uninhabited.rs:17:23
+ --> $DIR/auxiliary/uninhabited.rs:16:1
|
LL | pub enum UninhabitedVariants {
- | ----------------------------
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
- | ^^^^^ not covered
+ | ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
- | ^^^^^^ not covered
+ | ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
diff --git a/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs b/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs
index 670c423a7..86bcf1f6f 100644
--- a/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs
+++ b/tests/ui/rfcs/rfc-2091-track-caller/tracked-closure.rs
@@ -2,10 +2,10 @@
#![feature(stmt_expr_attributes)]
#![feature(closure_track_caller)]
-#![feature(generator_trait)]
-#![feature(generators)]
+#![feature(coroutine_trait)]
+#![feature(coroutines)]
-use std::ops::{Generator, GeneratorState};
+use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
use std::panic::Location;
@@ -93,53 +93,53 @@ fn test_closure() {
#[track_caller]
-fn mono_generator<F: Generator<String, Yield = (&'static str, String, Loc), Return = ()>>(
+fn mono_coroutine<F: Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>(
val: Pin<&mut F>
) -> (&'static str, String, Loc) {
match val.resume("Mono".to_string()) {
- GeneratorState::Yielded(val) => val,
+ CoroutineState::Yielded(val) => val,
_ => unreachable!()
}
}
#[track_caller]
-fn dyn_generator(
- val: Pin<&mut dyn Generator<String, Yield = (&'static str, String, Loc), Return = ()>>
+fn dyn_coroutine(
+ val: Pin<&mut dyn Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>
) -> (&'static str, String, Loc) {
match val.resume("Dyn".to_string()) {
- GeneratorState::Yielded(val) => val,
+ CoroutineState::Yielded(val) => val,
_ => unreachable!()
}
}
-fn test_generator() {
- let generator = #[track_caller] |arg: String| {
+fn test_coroutine() {
+ let coroutine = #[track_caller] |arg: String| {
yield ("first", arg.clone(), Location::caller());
yield ("second", arg.clone(), Location::caller());
};
- let mut pinned = Box::pin(generator);
- let (dyn_ret, dyn_arg, dyn_loc) = dyn_generator(pinned.as_mut());
+ let mut pinned = Box::pin(coroutine);
+ let (dyn_ret, dyn_arg, dyn_loc) = dyn_coroutine(pinned.as_mut());
assert_eq!(dyn_ret, "first");
assert_eq!(dyn_arg, "Dyn".to_string());
- // The `Generator` trait does not have `#[track_caller]` on `resume`, so
+ // The `Coroutine` trait does not have `#[track_caller]` on `resume`, so
// this will not match.
assert_ne!(dyn_loc.file(), file!());
- let (mono_ret, mono_arg, mono_loc) = mono_generator(pinned.as_mut());
+ let (mono_ret, mono_arg, mono_loc) = mono_coroutine(pinned.as_mut());
let mono_line = line!() - 1;
assert_eq!(mono_ret, "second");
- // The generator ignores the argument to the second `resume` call
+ // The coroutine ignores the argument to the second `resume` call
assert_eq!(mono_arg, "Dyn".to_string());
assert_eq!(mono_loc.file(), file!());
assert_eq!(mono_loc.line(), mono_line);
assert_eq!(mono_loc.column(), 42);
- let non_tracked_generator = || { yield Location::caller(); };
- let non_tracked_line = line!() - 1; // This is the line of the generator, not its caller
- let non_tracked_loc = match Box::pin(non_tracked_generator).as_mut().resume(()) {
- GeneratorState::Yielded(val) => val,
+ let non_tracked_coroutine = || { yield Location::caller(); };
+ let non_tracked_line = line!() - 1; // This is the line of the coroutine, not its caller
+ let non_tracked_loc = match Box::pin(non_tracked_coroutine).as_mut().resume(()) {
+ CoroutineState::Yielded(val) => val,
_ => unreachable!()
};
assert_eq!(non_tracked_loc.file(), file!());
@@ -150,5 +150,5 @@ fn test_generator() {
fn main() {
test_closure();
- test_generator();
+ test_coroutine();
}
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr
index 0c388f5fe..041f7ebc0 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/dont-infer-static.stderr
@@ -2,14 +2,17 @@ error[E0310]: the parameter type `U` may not live long enough
--> $DIR/dont-infer-static.rs:6:10
|
LL | bar: Bar<U>
- | ^^^^^^ ...so that the type `U` will meet its required lifetime bounds...
+ | ^^^^^^
+ | |
+ | the parameter type `U` must be valid for the static lifetime...
+ | ...so that the type `U` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/dont-infer-static.rs:8:15
|
LL | struct Bar<T: 'static> {
| ^^^^^^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Foo<U: 'static> {
| +++++++++
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr
index 2c660b285..5b605f3ee 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-enum-not-wf.rs:17:18
|
+LL | enum Ref1<'a, T> {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | Ref1Variant1(RequireOutlives<'a, T>),
| ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | enum Ref1<'a, T: 'a> {
| ++++
@@ -12,10 +14,13 @@ LL | enum Ref1<'a, T: 'a> {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-enum-not-wf.rs:22:25
|
+LL | enum Ref2<'a, T> {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+LL | Ref2Variant1,
LL | Ref2Variant2(isize, RequireOutlives<'a, T>),
| ^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | enum Ref2<'a, T: 'a> {
| ++++
@@ -23,10 +28,12 @@ LL | enum Ref2<'a, T: 'a> {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-enum-not-wf.rs:35:23
|
+LL | enum RefDouble<'a, 'b, T> {
+ | -- the parameter type `T` must be valid for the lifetime `'b` as defined here...
LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | enum RefDouble<'a, 'b, T: 'b> {
| ++++
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
index 34ff1362c..eb17ce736 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:13:16
|
+LL | impl<'a, T> Trait<'a, T> for usize {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = &'a T;
| ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for usize {
| ++++
@@ -12,6 +14,8 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:21:16
|
+LL | impl<'a, T> Trait<'a, T> for u32 {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = RefOk<'a, T>;
| ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
|
@@ -20,7 +24,7 @@ note: ...that is required by this bound
|
LL | struct RefOk<'a, T:'a> {
| ^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
| ++++
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
index d27fde582..087e54244 100644
--- a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
+++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `x`
- --> $DIR/move-guard-if-let-chain.rs:12:27
+ --> $DIR/move-guard-if-let-chain.rs:12:23
|
LL | let x: Box<_> = Box::new(1);
| - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
@@ -7,7 +7,7 @@ LL | let x: Box<_> = Box::new(1);
LL | (1, 2) if let y = x && c => (),
| - value moved here
LL | (1, 2) if let z = x => (),
- | ^ value used here after move
+ | ^ value used here after move
|
help: borrow this binding in the pattern to avoid moving the value
|
@@ -15,7 +15,7 @@ LL | (1, 2) if let ref y = x && c => (),
| +++
error[E0382]: use of moved value: `x`
- --> $DIR/move-guard-if-let-chain.rs:36:27
+ --> $DIR/move-guard-if-let-chain.rs:36:23
|
LL | let x: Box<_> = Box::new(1);
| - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
@@ -23,7 +23,7 @@ LL | let x: Box<_> = Box::new(1);
LL | (1, _) if let y = x && c => (),
| - value moved here
LL | (_, 2) if let z = x => (),
- | ^ value used here after move
+ | ^ value used here after move
|
help: borrow this binding in the pattern to avoid moving the value
|
@@ -31,15 +31,13 @@ LL | (1, _) if let ref y = x && c => (),
| +++
error[E0382]: use of moved value: `x`
- --> $DIR/move-guard-if-let-chain.rs:59:36
+ --> $DIR/move-guard-if-let-chain.rs:59:32
|
LL | let x: Box<_> = Box::new(1);
| - move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
...
LL | (1, _) | (_, 2) if let y = x && c => (),
- | - ^ value used here after move
- | |
- | value moved here
+ | ^ value used here after move
|
help: borrow this binding in the pattern to avoid moving the value
|
diff --git a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
index e97fdcce1..9dc339abc 100644
--- a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
+++ b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr
@@ -1,13 +1,14 @@
error[E0382]: use of moved value: `a`
- --> $DIR/dbg-macro-move-semantics.rs:9:18
+ --> $DIR/dbg-macro-move-semantics.rs:9:13
|
LL | let a = NoCopy(0);
| - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
LL | let _ = dbg!(a);
| ------- value moved here
LL | let _ = dbg!(a);
- | ^ value used here after move
+ | ^^^^^^^ value used here after move
|
+ = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
index 43bda4962..1374ad935 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs
@@ -21,14 +21,14 @@ fn call_once(f: impl FnOnce()) {
}
fn main() {
- call(foo); //~ ERROR expected a `Fn<()>` closure, found `fn() {foo}`
- call_mut(foo); //~ ERROR expected a `FnMut<()>` closure, found `fn() {foo}`
- call_once(foo); //~ ERROR expected a `FnOnce<()>` closure, found `fn() {foo}`
+ call(foo); //~ ERROR expected a `Fn()` closure, found `fn() {foo}`
+ call_mut(foo); //~ ERROR expected a `FnMut()` closure, found `fn() {foo}`
+ call_once(foo); //~ ERROR expected a `FnOnce()` closure, found `fn() {foo}`
call(foo_unsafe);
- //~^ ERROR expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
+ //~^ ERROR expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
call_mut(foo_unsafe);
- //~^ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
+ //~^ ERROR expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
call_once(foo_unsafe);
- //~^ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
+ //~^ ERROR expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
}
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr
index fc7bf2277..100f20482 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<()>` closure, found `fn() {foo}`
+error[E0277]: expected a `Fn()` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:24:10
|
LL | call(foo);
- | ---- ^^^ expected an `Fn<()>` closure, found `fn() {foo}`
+ | ---- ^^^ expected an `Fn()` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
@@ -15,11 +15,11 @@ note: required by a bound in `call`
LL | fn call(f: impl Fn()) {
| ^^^^ required by this bound in `call`
-error[E0277]: expected a `FnMut<()>` closure, found `fn() {foo}`
+error[E0277]: expected a `FnMut()` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:25:14
|
LL | call_mut(foo);
- | -------- ^^^ expected an `FnMut<()>` closure, found `fn() {foo}`
+ | -------- ^^^ expected an `FnMut()` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
@@ -32,11 +32,11 @@ note: required by a bound in `call_mut`
LL | fn call_mut(f: impl FnMut()) {
| ^^^^^^^ required by this bound in `call_mut`
-error[E0277]: expected a `FnOnce<()>` closure, found `fn() {foo}`
+error[E0277]: expected a `FnOnce()` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:26:15
|
LL | call_once(foo);
- | --------- ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}`
+ | --------- ^^^ expected an `FnOnce()` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
@@ -49,7 +49,7 @@ note: required by a bound in `call_once`
LL | fn call_once(f: impl FnOnce()) {
| ^^^^^^^^ required by this bound in `call_once`
-error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
+error[E0277]: expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:28:10
|
LL | call(foo_unsafe);
@@ -58,6 +58,7 @@ LL | call(foo_unsafe);
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call`
@@ -66,7 +67,7 @@ note: required by a bound in `call`
LL | fn call(f: impl Fn()) {
| ^^^^ required by this bound in `call`
-error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
+error[E0277]: expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:30:14
|
LL | call_mut(foo_unsafe);
@@ -75,6 +76,7 @@ LL | call_mut(foo_unsafe);
| required by a bound introduced by this call
|
= help: the trait `FnMut<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_mut`
@@ -83,7 +85,7 @@ note: required by a bound in `call_mut`
LL | fn call_mut(f: impl FnMut()) {
| ^^^^^^^ required by this bound in `call_mut`
-error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
+error[E0277]: expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:32:15
|
LL | call_once(foo_unsafe);
@@ -92,6 +94,7 @@ LL | call_once(foo_unsafe);
| required by a bound introduced by this call
|
= help: the trait `FnOnce<()>` is not implemented for fn item `unsafe fn() {foo_unsafe}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_once`
diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr b/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr
index 7639ae9f6..8ca6a37c6 100644
--- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr
+++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.stderr
@@ -5,6 +5,7 @@ LL | mod řųśť;
| ^^^^^^^^^
|
= help: to create the module `řųśť`, create file "$DIR/řųśť.rs" or "$DIR/řųśť/mod.rs"
+ = note: if there is a `mod řųśť` elsewhere in the crate already, import it with `use crate::...` instead
error[E0754]: trying to load file for module `řųśť` with non-ascii identifier name
--> $DIR/mod_file_nonascii_forbidden.rs:1:5
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
index ad11c090f..6d436018b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
@@ -1,14 +1,12 @@
-error[E0277]: the trait bound `T: Foo` is not satisfied
- --> $DIR/assoc-type-const-bound-usage.rs:12:6
+error[E0308]: mismatched types
+ --> $DIR/assoc-type-const-bound-usage.rs:12:5
|
LL | <T as Foo>::Assoc::foo();
- | ^ the trait `Foo` is not implemented for `T`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `host`, found `true`
|
-help: consider further restricting this bound
- |
-LL | const fn foo<T: ~const Foo + Foo>() {
- | +++++
+ = note: expected constant `host`
+ found constant `true`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs
index f396deff4..8e4de57b0 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.rs
@@ -4,7 +4,6 @@
associated_type_bounds,
const_trait_impl,
const_cmp,
- return_position_impl_trait_in_trait,
)]
use std::marker::Destruct;
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
index f9078e227..4a9090d0b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-impl-trait.stderr
@@ -5,31 +5,31 @@ LL | const_cmp,
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:12:30
+ --> $DIR/const-impl-trait.rs:11:30
|
LL | const fn cmp(a: &impl ~const PartialEq) -> bool {
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:16:30
+ --> $DIR/const-impl-trait.rs:15:30
|
LL | const fn wrap(x: impl ~const PartialEq + ~const Destruct)
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:17:20
+ --> $DIR/const-impl-trait.rs:16:20
|
LL | -> impl ~const PartialEq + ~const Destruct
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:24:29
+ --> $DIR/const-impl-trait.rs:23:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy;
| ^^^^^^^^^
error: ~const can only be applied to `#[const_trait]` traits
- --> $DIR/const-impl-trait.rs:28:29
+ --> $DIR/const-impl-trait.rs:27:29
|
LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy {
| ^^^^^^^^^
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs
index 1b45cd9aa..13881e042 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs
@@ -7,7 +7,7 @@
#![feature(staged_api)]
#![feature(const_trait_impl)]
-#![stable(since = "1", feature = "foo")]
+#![stable(feature = "foo", since = "3.3.3")]
#[const_trait]
trait Tr {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs
new file mode 100644
index 000000000..a74c50cc8
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/auxiliary/cross-crate.rs
@@ -0,0 +1,12 @@
+#![feature(const_trait_impl, effects)]
+
+pub const fn foo() {}
+
+#[const_trait]
+pub trait Bar {
+ fn bar();
+}
+
+impl Bar for () {
+ fn bar() {}
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs
new file mode 100644
index 000000000..1e22ddcea
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs
@@ -0,0 +1,28 @@
+#![feature(const_trait_impl, effects)]
+
+#[const_trait]
+trait MyTrait {
+ fn do_something(&self);
+}
+
+trait OtherTrait {
+ fn do_something_else() where Self: ~const MyTrait;
+ //~^ ERROR `~const` is not allowed here
+}
+
+struct MyStruct<T>(T);
+
+impl const MyTrait for u32 {
+ fn do_something(&self) {}
+}
+
+impl<T> MyStruct<T> {
+ pub fn foo(&self) where T: ~const MyTrait {
+ //~^ ERROR `~const` is not allowed here
+ self.0.do_something();
+ }
+}
+
+fn main() {
+ MyStruct(0u32).foo();
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr
new file mode 100644
index 000000000..9210f6427
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr
@@ -0,0 +1,26 @@
+error: `~const` is not allowed here
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:9:40
+ |
+LL | fn do_something_else() where Self: ~const MyTrait;
+ | ^^^^^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:9:8
+ |
+LL | fn do_something_else() where Self: ~const MyTrait;
+ | ^^^^^^^^^^^^^^^^^
+
+error: `~const` is not allowed here
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:20:32
+ |
+LL | pub fn foo(&self) where T: ~const MyTrait {
+ | ^^^^^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/const-bound-on-not-const-associated-fn.rs:20:12
+ |
+LL | pub fn foo(&self) where T: ~const MyTrait {
+ | ^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs
new file mode 100644
index 000000000..6598d1da0
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.rs
@@ -0,0 +1,15 @@
+#![feature(const_closures, const_trait_impl, effects)]
+#![allow(incomplete_features)]
+
+trait Foo {
+ fn foo(&self);
+}
+
+impl Foo for () {
+ fn foo(&self) {}
+}
+
+fn main() {
+ (const || { (()).foo() })();
+ //~^ ERROR: cannot call non-const fn
+}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr
new file mode 100644
index 000000000..002d586ac
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const_closure-const_trait_impl-ice-113381.stderr
@@ -0,0 +1,11 @@
+error[E0015]: cannot call non-const fn `<() as Foo>::foo` in constant functions
+ --> $DIR/const_closure-const_trait_impl-ice-113381.rs:13:22
+ |
+LL | (const || { (()).foo() })();
+ | ^^^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs
new file mode 100644
index 000000000..1954d2942
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/ice-113375-index-out-of-bounds-generics.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+// effects ice https://github.com/rust-lang/rust/issues/113375 index out of bounds
+
+#![allow(incomplete_features, unused)]
+#![feature(effects, adt_const_params)]
+
+struct Bar<T>(T);
+
+impl<T> Bar<T> {
+ const fn value() -> usize {
+ 42
+ }
+}
+
+struct Foo<const N: [u8; Bar::<u32>::value()]>;
+
+pub fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs
new file mode 100644
index 000000000..c38b4b3f1
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs
@@ -0,0 +1,504 @@
+#![crate_type = "lib"]
+#![feature(no_core, lang_items, unboxed_closures, auto_traits, intrinsics, rustc_attrs)]
+#![feature(fundamental)]
+#![feature(const_trait_impl, effects, const_mut_refs)]
+#![allow(internal_features)]
+#![no_std]
+#![no_core]
+
+// known-bug: #110395
+
+#[lang = "sized"]
+trait Sized {}
+#[lang = "copy"]
+trait Copy {}
+
+#[lang = "add"]
+#[const_trait]
+trait Add<Rhs = Self> {
+ type Output;
+
+ fn add(self, rhs: Rhs) -> Self::Output;
+}
+
+// FIXME we shouldn't need to have to specify `Rhs`.
+impl const Add<i32> for i32 {
+ type Output = i32;
+ fn add(self, rhs: i32) -> i32 {
+ loop {}
+ }
+}
+
+fn foo() {
+ let x = 42_i32 + 43_i32;
+}
+
+const fn bar() {
+ let x = 42_i32 + 43_i32;
+}
+
+
+#[lang = "Try"]
+#[const_trait]
+trait Try: FromResidual {
+ type Output;
+ type Residual;
+
+ #[lang = "from_output"]
+ fn from_output(output: Self::Output) -> Self;
+
+ #[lang = "branch"]
+ fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
+}
+
+// FIXME
+// #[const_trait]
+trait FromResidual<R = <Self as Try>::Residual> {
+ #[lang = "from_residual"]
+ fn from_residual(residual: R) -> Self;
+}
+
+enum ControlFlow<B, C = ()> {
+ #[lang = "Continue"]
+ Continue(C),
+ #[lang = "Break"]
+ Break(B),
+}
+
+#[const_trait]
+#[lang = "fn"]
+#[rustc_paren_sugar]
+trait Fn<Args: Tuple>: ~const FnMut<Args> {
+ extern "rust-call" fn call(&self, args: Args) -> Self::Output;
+}
+
+#[const_trait]
+#[lang = "fn_mut"]
+#[rustc_paren_sugar]
+trait FnMut<Args: Tuple>: ~const FnOnce<Args> {
+ extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
+}
+
+#[const_trait]
+#[lang = "fn_once"]
+#[rustc_paren_sugar]
+trait FnOnce<Args: Tuple> {
+ type Output;
+
+ extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
+}
+
+struct ConstFnMutClosure<CapturedData, Function> {
+ data: CapturedData,
+ func: Function,
+}
+
+#[lang = "tuple_trait"]
+pub trait Tuple {}
+
+macro_rules! impl_fn_mut_tuple {
+ ($($var:ident)*) => {
+ impl<'a, $($var,)* ClosureArguments: Tuple, Function, ClosureReturnValue> const
+ FnOnce<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function>
+ where
+ Function: ~const Fn(($(&mut $var),*), ClosureArguments) -> ClosureReturnValue,
+ Function: ~const Destruct,
+ {
+ type Output = ClosureReturnValue;
+
+ extern "rust-call" fn call_once(mut self, args: ClosureArguments) -> Self::Output {
+ self.call_mut(args)
+ }
+ }
+ impl<'a, $($var,)* ClosureArguments: Tuple, Function, ClosureReturnValue> const
+ FnMut<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function>
+ where
+ Function: ~const Fn(($(&mut $var),*), ClosureArguments)-> ClosureReturnValue,
+ Function: ~const Destruct,
+ {
+ extern "rust-call" fn call_mut(&mut self, args: ClosureArguments) -> Self::Output {
+ #[allow(non_snake_case)]
+ let ($($var),*) = &mut self.data;
+ (self.func)(($($var),*), args)
+ }
+ }
+ };
+}
+//impl_fn_mut_tuple!(A);
+//impl_fn_mut_tuple!(A B);
+//impl_fn_mut_tuple!(A B C);
+//impl_fn_mut_tuple!(A B C D);
+//impl_fn_mut_tuple!(A B C D E);
+
+#[lang = "receiver"]
+trait Receiver {}
+
+impl<T: ?Sized> Receiver for &T {}
+
+impl<T: ?Sized> Receiver for &mut T {}
+
+#[lang = "destruct"]
+#[const_trait]
+trait Destruct {}
+
+#[lang = "freeze"]
+unsafe auto trait Freeze {}
+
+#[lang = "drop"]
+#[const_trait]
+trait Drop {
+ fn drop(&mut self);
+}
+
+/*
+#[const_trait]
+trait Residual<O> {
+ type TryType: ~const Try<Output = O, Residual = Self> + Try<Output = O, Residual = Self>;
+}
+*/
+
+const fn size_of<T>() -> usize {
+ 42
+}
+
+impl Copy for u8 {}
+
+impl usize {
+ #[rustc_allow_incoherent_impl]
+ const fn repeat_u8(x: u8) -> usize {
+ usize::from_ne_bytes([x; size_of::<usize>()])
+ }
+ #[rustc_allow_incoherent_impl]
+ const fn from_ne_bytes(bytes: [u8; size_of::<Self>()]) -> Self {
+ loop {}
+ }
+}
+
+#[rustc_do_not_const_check] // hooked by const-eval
+const fn panic_display() {
+ panic_fmt();
+}
+
+fn panic_fmt() {}
+
+#[lang = "index"]
+#[const_trait]
+trait Index<Idx: ?Sized> {
+ type Output: ?Sized;
+
+ fn index(&self, index: Idx) -> &Self::Output;
+}
+
+
+#[const_trait]
+unsafe trait SliceIndex<T: ?Sized> {
+ type Output: ?Sized;
+ fn index(self, slice: &T) -> &Self::Output;
+}
+
+impl<T, I> const Index<I> for [T]
+where
+ I: ~const SliceIndex<[T]>,
+{
+ type Output = I::Output;
+
+ #[inline]
+ fn index(&self, index: I) -> &I::Output {
+ index.index(self)
+ }
+}
+/* FIXME
+impl<T, I, const N: usize> const Index<I> for [T; N]
+where
+ [T]: ~const Index<I>,
+{
+ type Output = <[T] as Index<I>>::Output;
+
+ #[inline]
+ // FIXME: make `Self::Output` act like `<Self as ~const Index<I>>::Output`
+ fn index(&self, index: I) -> &<[T] as Index<I>>::Output {
+ Index::index(self as &[T], index)
+ }
+}
+*/
+
+#[lang = "unsize"]
+trait Unsize<T: ?Sized> {
+}
+
+#[lang = "coerce_unsized"]
+trait CoerceUnsized<T: ?Sized> {
+}
+
+impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
+
+
+#[lang = "deref"]
+// #[const_trait] FIXME
+trait Deref {
+ #[lang = "deref_target"]
+ type Target: ?Sized;
+
+ fn deref(&self) -> &Self::Target;
+}
+
+
+impl<T: ?Sized> /* const */ Deref for &T {
+ type Target = T;
+
+ fn deref(&self) -> &T {
+ *self
+ }
+}
+
+impl<T: ?Sized> /* const */ Deref for &mut T {
+ type Target = T;
+
+ fn deref(&self) -> &T {
+ *self
+ }
+}
+
+enum Option<T> {
+ #[lang = "None"]
+ None,
+ #[lang = "Some"]
+ Some(T),
+}
+
+impl<T> Option<T> {
+ const fn as_ref(&self) -> Option<&T> {
+ match *self {
+ Some(ref x) => Some(x),
+ None => None,
+ }
+ }
+
+ const fn as_mut(&mut self) -> Option<&mut T> {
+ match *self {
+ Some(ref mut x) => Some(x),
+ None => None,
+ }
+ }
+}
+
+use Option::*;
+
+/*
+const fn as_deref<T>(opt: &Option<T>) -> Option<&T::Target>
+where
+ T: ~const Deref,
+{
+ match opt {
+ Option::Some(t) => Option::Some(t.deref()),
+ Option::None => Option::None,
+ }
+}
+*/
+
+#[const_trait]
+trait Into<T>: Sized {
+ fn into(self) -> T;
+}
+
+#[const_trait]
+trait From<T>: Sized {
+ fn from(value: T) -> Self;
+}
+
+impl<T, U> const Into<U> for T
+where
+ U: ~const From<T>,
+{
+ fn into(self) -> U {
+ U::from(self)
+ }
+}
+
+impl<T> const From<T> for T {
+ fn from(t: T) -> T {
+ t
+ }
+}
+
+enum Result<T, E> {
+ Ok(T),
+ Err(E),
+}
+use Result::*;
+
+fn from_str(s: &str) -> Result<bool, ()> {
+ match s {
+ "true" => Ok(true),
+ "false" => Ok(false),
+ _ => Err(()),
+ }
+}
+
+#[lang = "eq"]
+#[const_trait]
+trait PartialEq<Rhs: ?Sized = Self> {
+ fn eq(&self, other: &Rhs) -> bool;
+ fn ne(&self, other: &Rhs) -> bool {
+ !self.eq(other)
+ }
+}
+
+// FIXME(effects): again, this should not error without Rhs specified
+impl PartialEq<str> for str {
+ fn eq(&self, other: &str) -> bool {
+ loop {}
+ }
+}
+
+
+#[lang = "not"]
+#[const_trait]
+trait Not {
+ type Output;
+ fn not(self) -> Self::Output;
+}
+
+impl const Not for bool {
+ type Output = bool;
+ fn not(self) -> bool {
+ !self
+ }
+}
+
+impl Copy for bool {}
+impl<'a> Copy for &'a str {}
+
+#[lang = "pin"]
+#[fundamental]
+#[repr(transparent)]
+struct Pin<P> {
+ pointer: P,
+}
+
+impl<P> Pin<P> {
+ #[lang = "new_unchecked"]
+ const unsafe fn new_unchecked(pointer: P) -> Pin<P> {
+ Pin { pointer }
+ }
+}
+
+impl<'a, T: ?Sized> Pin<&'a T> {
+ const fn get_ref(self) -> &'a T {
+ self.pointer
+ }
+}
+
+
+impl<P: Deref> Pin<P> {
+ /* const */ fn as_ref(&self) -> Pin<&P::Target>
+ where
+ P: /* ~const */ Deref,
+ {
+ unsafe { Pin::new_unchecked(&*self.pointer) }
+ }
+}
+
+
+impl<'a, T: ?Sized> Pin<&'a mut T> {
+ const unsafe fn get_unchecked_mut(self) -> &'a mut T {
+ self.pointer
+ }
+}
+/* FIXME lol
+impl<T> Option<T> {
+ const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {
+ match Pin::get_ref(self).as_ref() {
+ Some(x) => unsafe { Some(Pin::new_unchecked(x)) },
+ None => None,
+ }
+ }
+
+ const fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {
+ unsafe {
+ match Pin::get_unchecked_mut(self).as_mut() {
+ Some(x) => Some(Pin::new_unchecked(x)),
+ None => None,
+ }
+ }
+ }
+}
+*/
+
+impl<P: /* ~const */ Deref> /* const */ Deref for Pin<P> {
+ type Target = P::Target;
+ fn deref(&self) -> &P::Target {
+ Pin::get_ref(Pin::as_ref(self))
+ }
+}
+
+impl<T> /* const */ Deref for Option<T> {
+ type Target = T;
+ fn deref(&self) -> &T {
+ loop {}
+ }
+}
+
+impl<P: Receiver> Receiver for Pin<P> {}
+
+impl<T: Clone> Clone for RefCell<T> {
+ fn clone(&self) -> RefCell<T> {
+ RefCell::new(self.borrow().clone())
+ }
+}
+
+struct RefCell<T: ?Sized> {
+ borrow: UnsafeCell<()>,
+ value: UnsafeCell<T>,
+}
+impl<T> RefCell<T> {
+ const fn new(value: T) -> RefCell<T> {
+ loop {}
+ }
+}
+impl<T: ?Sized> RefCell<T> {
+ fn borrow(&self) -> Ref<'_, T> {
+ loop {}
+ }
+}
+
+#[lang = "unsafe_cell"]
+#[repr(transparent)]
+struct UnsafeCell<T: ?Sized> {
+ value: T,
+}
+
+struct Ref<'b, T: ?Sized + 'b> {
+ value: *const T,
+ borrow: &'b UnsafeCell<()>,
+}
+
+impl<T: ?Sized> Deref for Ref<'_, T> {
+ type Target = T;
+
+ #[inline]
+ fn deref(&self) -> &T {
+ loop {}
+ }
+}
+
+#[lang = "clone"]
+#[rustc_trivial_field_reads]
+#[const_trait]
+trait Clone: Sized {
+ fn clone(&self) -> Self;
+ fn clone_from(&mut self, source: &Self)
+ where
+ Self: ~const Destruct,
+ {
+ *self = source.clone()
+ }
+}
+
+#[lang = "structural_peq"]
+trait StructuralPartialEq {}
+
+#[lang = "structural_teq"]
+trait StructuralEq {}
+
+const fn drop<T: ~const Destruct>(_: T) {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr
new file mode 100644
index 000000000..024293742
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr
@@ -0,0 +1,32 @@
+error[E0369]: cannot add `i32` to `i32`
+ --> $DIR/minicore.rs:33:20
+ |
+LL | let x = 42_i32 + 43_i32;
+ | ------ ^ ------ i32
+ | |
+ | i32
+
+error[E0369]: cannot add `i32` to `i32`
+ --> $DIR/minicore.rs:37:20
+ |
+LL | let x = 42_i32 + 43_i32;
+ | ------ ^ ------ i32
+ | |
+ | i32
+
+error[E0600]: cannot apply unary operator `!` to type `bool`
+ --> $DIR/minicore.rs:343:9
+ |
+LL | !self.eq(other)
+ | ^^^^^^^^^^^^^^^ cannot apply unary operator `!`
+
+error[E0600]: cannot apply unary operator `!` to type `bool`
+ --> $DIR/minicore.rs:365:9
+ |
+LL | !self
+ | ^^^^^ cannot apply unary operator `!`
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0369, E0600.
+For more information about an error, try `rustc --explain E0369`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs
new file mode 100644
index 000000000..8e4850197
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.rs
@@ -0,0 +1,18 @@
+// aux-build: cross-crate.rs
+extern crate cross_crate;
+
+use cross_crate::{Bar, foo};
+
+fn main() {
+ foo::<true>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<true>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+}
+
+const FOO: () = {
+ foo::<false>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<false>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+};
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr
new file mode 100644
index 000000000..cc870ad33
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr
@@ -0,0 +1,59 @@
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:14:5
+ |
+LL | foo::<false>();
+ | ^^^--------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:3:14
+ |
+LL | pub const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:16:12
+ |
+LL | <() as Bar<false>>::bar();
+ | ^^^------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:6:11
+ |
+LL | pub trait Bar {
+ | ^^^
+
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:7:5
+ |
+LL | foo::<true>();
+ | ^^^-------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:3:14
+ |
+LL | pub const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params-cross-crate.rs:9:12
+ |
+LL | <() as Bar<true>>::bar();
+ | ^^^------ help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/auxiliary/cross-crate.rs:6:11
+ |
+LL | pub trait Bar {
+ | ^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs
new file mode 100644
index 000000000..929da1ca8
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.rs
@@ -0,0 +1,27 @@
+#![feature(const_trait_impl, effects)]
+
+const fn foo() {}
+
+#[const_trait]
+trait Bar {
+ fn bar();
+}
+
+impl Bar for () {
+ fn bar() {}
+}
+
+fn main() {
+ foo::<true>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<true>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+}
+
+const FOO: () = {
+ foo::<false>();
+ //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied
+ <() as Bar<false>>::bar();
+ //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied
+ //~| ERROR: mismatched types
+};
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr
new file mode 100644
index 000000000..0745d0304
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr
@@ -0,0 +1,69 @@
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:22:5
+ |
+LL | foo::<false>();
+ | ^^^--------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:3:10
+ |
+LL | const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:24:12
+ |
+LL | <() as Bar<false>>::bar();
+ | ^^^------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:6:7
+ |
+LL | trait Bar {
+ | ^^^
+
+error[E0308]: mismatched types
+ --> $DIR/no-explicit-const-params.rs:24:5
+ |
+LL | <() as Bar<false>>::bar();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `false`, found `true`
+ |
+ = note: expected constant `false`
+ found constant `true`
+
+error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:15:5
+ |
+LL | foo::<true>();
+ | ^^^-------- help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: function defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:3:10
+ |
+LL | const fn foo() {}
+ | ^^^
+
+error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
+ --> $DIR/no-explicit-const-params.rs:17:12
+ |
+LL | <() as Bar<true>>::bar();
+ | ^^^------ help: remove these generics
+ | |
+ | expected 0 generic arguments
+ |
+note: trait defined here, with 0 generic parameters
+ --> $DIR/no-explicit-const-params.rs:6:7
+ |
+LL | trait Bar {
+ | ^^^
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0107, E0308.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs
new file mode 100644
index 000000000..b30d7743e
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/project.rs
@@ -0,0 +1,11 @@
+// check-pass
+#![feature(const_trait_impl, effects)]
+
+pub trait Owo<X = <Self as Uwu>::T> {}
+
+#[const_trait]
+pub trait Uwu: Owo {
+ type T;
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr
index 8bf00eaff..e8ae7e4e3 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-102156.stderr
@@ -13,6 +13,7 @@ LL | use core::convert::{From, TryFrom};
| ^^^^ maybe a missing crate `core`?
|
= help: consider adding `extern crate core` to use the `core` crate
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
index 97f346e8c..b60399c57 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
index 97f346e8c..b60399c57 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
index 2897eabb0..eb12a236d 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: ~const can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:17:24
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
index 9839a4f24..cd0ee7327 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr
@@ -9,6 +9,8 @@ error: ~const can only be applied to `#[const_trait]` traits
|
LL | trait Bar: ~const Foo {}
| ^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
index 89d74cecf..4b720b534 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.rs
@@ -7,7 +7,8 @@ struct Foo<const N: usize>;
impl<const N: usize> Foo<N> {
fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
- //~^ ERROR mismatched types
+ //~^ ERROR `~const` is not allowed here
+ //~| ERROR mismatched types
Foo
}
}
@@ -30,7 +31,7 @@ fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
}
fn main() {
- let foo = Foo::<0>;
- let foo = bar::<(), _>(foo);
- let _foo = bar::<(), _>(foo);
+ let foo = Foo::<0>;
+ let foo = bar::<(), _>(foo);
+ let _foo = bar::<(), _>(foo);
}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
index ec5d21d33..be7a83dc1 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
@@ -1,17 +1,29 @@
error: `~const` is not allowed here
- --> $DIR/tilde-const-and-const-params.rs:26:11
+ --> $DIR/tilde-const-and-const-params.rs:9:15
+ |
+LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
+ | ^^^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/tilde-const-and-const-params.rs:9:8
+ |
+LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
+ | ^^^
+
+error: `~const` is not allowed here
+ --> $DIR/tilde-const-and-const-params.rs:27:11
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^^^^^^^^^^
|
note: this function is not `const`, so it cannot have `~const` trait bounds
- --> $DIR/tilde-const-and-const-params.rs:26:4
+ --> $DIR/tilde-const-and-const-params.rs:27:4
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^
error[E0308]: mismatched types
- --> $DIR/tilde-const-and-const-params.rs:26:61
+ --> $DIR/tilde-const-and-const-params.rs:27:61
|
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
| ^^^^^^^^^ expected `false`, found `true`
@@ -28,6 +40,6 @@ LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> {
= note: expected constant `false`
found constant `true`
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
index c94563d35..2a9647da7 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.stderr
@@ -1,35 +1,21 @@
-error[E0277]: the trait bound `T: ~const Bar` is not satisfied
+error[E0308]: mismatched types
--> $DIR/trait-where-clause-const.rs:21:5
|
LL | T::b();
- | ^ the trait `Bar` is not implemented for `T`
+ | ^^^^^^ expected `host`, found `true`
|
-note: required by a bound in `Foo::b`
- --> $DIR/trait-where-clause-const.rs:15:24
- |
-LL | fn b() where Self: ~const Bar;
- | ^^^^^^^^^^ required by this bound in `Foo::b`
-help: consider further restricting this bound
- |
-LL | const fn test1<T: ~const Foo + Bar + Bar>() {
- | +++++
+ = note: expected constant `host`
+ found constant `true`
-error[E0277]: the trait bound `T: ~const Bar` is not satisfied
- --> $DIR/trait-where-clause-const.rs:23:12
+error[E0308]: mismatched types
+ --> $DIR/trait-where-clause-const.rs:23:5
|
LL | T::c::<T>();
- | ^ the trait `Bar` is not implemented for `T`
- |
-note: required by a bound in `Foo::c`
- --> $DIR/trait-where-clause-const.rs:16:13
- |
-LL | fn c<T: ~const Bar>();
- | ^^^^^^^^^^ required by this bound in `Foo::c`
-help: consider further restricting this bound
+ | ^^^^^^^^^^^ expected `host`, found `true`
|
-LL | const fn test1<T: ~const Foo + Bar + Bar>() {
- | +++++
+ = note: expected constant `host`
+ found constant `true`
error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs
index 85ca5fc90..11f353f3f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.rs
@@ -6,7 +6,9 @@ trait Bar {}
trait Foo {
fn a();
fn b() where Self: ~const Bar;
+ //~^ ERROR `~const` is not allowed here
fn c<T: ~const Bar>();
+ //~^ ERROR `~const` is not allowed here
}
fn test1<T: Foo>() {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
index 255878e17..3d6fedbab 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause.stderr
@@ -1,5 +1,29 @@
+error: `~const` is not allowed here
+ --> $DIR/trait-where-clause.rs:8:24
+ |
+LL | fn b() where Self: ~const Bar;
+ | ^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/trait-where-clause.rs:8:8
+ |
+LL | fn b() where Self: ~const Bar;
+ | ^
+
+error: `~const` is not allowed here
+ --> $DIR/trait-where-clause.rs:10:13
+ |
+LL | fn c<T: ~const Bar>();
+ | ^^^^^^^^^^
+ |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+ --> $DIR/trait-where-clause.rs:10:8
+ |
+LL | fn c<T: ~const Bar>();
+ | ^
+
error[E0277]: the trait bound `T: Bar` is not satisfied
- --> $DIR/trait-where-clause.rs:14:5
+ --> $DIR/trait-where-clause.rs:16:5
|
LL | T::b();
| ^ the trait `Bar` is not implemented for `T`
@@ -15,13 +39,13 @@ LL | fn test1<T: Foo + Bar>() {
| +++++
error[E0277]: the trait bound `T: Bar` is not satisfied
- --> $DIR/trait-where-clause.rs:16:12
+ --> $DIR/trait-where-clause.rs:18:12
|
LL | T::c::<T>();
| ^ the trait `Bar` is not implemented for `T`
|
note: required by a bound in `Foo::c`
- --> $DIR/trait-where-clause.rs:9:13
+ --> $DIR/trait-where-clause.rs:10:13
|
LL | fn c<T: ~const Bar>();
| ^^^^^^^^^^ required by this bound in `Foo::c`
@@ -30,6 +54,6 @@ help: consider further restricting this bound
LL | fn test1<T: Foo + Bar>() {
| +++++
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr
index 497ee440d..c0a322edc 100644
--- a/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr
+++ b/tests/ui/rust-2018/edition-lint-fully-qualified-paths.stderr
@@ -20,6 +20,7 @@ LL | let _: <foo::Baz as ::foo::Foo>::Bar = ();
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-fully-qualified-paths.rs:25:13
diff --git a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr
index f5ec287d2..1f4190665 100644
--- a/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr
+++ b/tests/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr
@@ -861,12 +861,7 @@ LL | $($name: 'a, $name: 'a, )+;
| ^^^^^^^^^ ^^^^^^^^^
...
LL | m!(T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15);
- | ---------------------------------------------------------
- | |
- | in this macro invocation
- | in this macro invocation
- | in this macro invocation
- | in this macro invocation
+ | --------------------------------------------------------- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove these bounds
diff --git a/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr b/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr
index 8769cbb35..041572be8 100644
--- a/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr
+++ b/tests/ui/rust-2018/edition-lint-nested-empty-paths.stderr
@@ -29,6 +29,7 @@ LL | use foo::{bar::{XX, baz::{}}};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-nested-empty-paths.rs:27:5
@@ -47,6 +48,7 @@ LL | use foo::{bar::{baz::{}, baz1::{}}};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 5 previous errors
diff --git a/tests/ui/rust-2018/edition-lint-nested-paths.stderr b/tests/ui/rust-2018/edition-lint-nested-paths.stderr
index 354a6fe32..4a70bb7e5 100644
--- a/tests/ui/rust-2018/edition-lint-nested-paths.stderr
+++ b/tests/ui/rust-2018/edition-lint-nested-paths.stderr
@@ -20,6 +20,7 @@ LL | use foo::{a, b};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-nested-paths.rs:23:13
@@ -38,6 +39,7 @@ LL | use foo::{self as x, c};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/rust-2018/edition-lint-paths.stderr b/tests/ui/rust-2018/edition-lint-paths.stderr
index 42652be94..fde17338d 100644
--- a/tests/ui/rust-2018/edition-lint-paths.stderr
+++ b/tests/ui/rust-2018/edition-lint-paths.stderr
@@ -38,6 +38,7 @@ LL | use {main, Bar as SomethingElse};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-paths.rs:25:9
@@ -47,6 +48,7 @@ LL | use {main, Bar as SomethingElse};
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> $DIR/edition-lint-paths.rs:40:5
diff --git a/tests/ui/rust-2018/uniform-paths/cross-crate.stderr b/tests/ui/rust-2018/uniform-paths/cross-crate.stderr
index 45f77a0c9..8682c56d2 100644
--- a/tests/ui/rust-2018/uniform-paths/cross-crate.stderr
+++ b/tests/ui/rust-2018/uniform-paths/cross-crate.stderr
@@ -33,6 +33,7 @@ note: the tool module imported here
|
LL | use cross_crate::*;
| ^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
index 908bb4985..3dacb7969 100644
--- a/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
+++ b/tests/ui/rust-2018/uniform-paths/prelude-fail-2.stderr
@@ -51,6 +51,7 @@ note: the tool module imported here
|
LL | use rustfmt as imported_rustfmt;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot use a tool module through an import
--> $DIR/prelude-fail-2.rs:19:13
@@ -63,6 +64,7 @@ note: the tool module imported here
|
LL | pub use rustfmt as imported_rustfmt;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
diff --git a/tests/ui/sanitize/issue-111184-generator-witness.rs b/tests/ui/sanitize/issue-111184-coroutine-witness.rs
index d36d8bce5..dffb739f2 100644
--- a/tests/ui/sanitize/issue-111184-generator-witness.rs
+++ b/tests/ui/sanitize/issue-111184-coroutine-witness.rs
@@ -1,4 +1,4 @@
-// Regression test for issue 111184, where ty::GeneratorWitness were not expected to occur in
+// Regression test for issue 111184, where ty::CoroutineWitness were not expected to occur in
// encode_ty and caused the compiler to ICE.
//
// needs-sanitizer-cfi
diff --git a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr
index 8328178e8..1006c3bc1 100644
--- a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr
+++ b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr
@@ -3,6 +3,8 @@ error: cfi sanitizer is not supported for this target
error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`
error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr
index 8328178e8..1006c3bc1 100644
--- a/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr
+++ b/tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr
@@ -3,6 +3,8 @@ error: cfi sanitizer is not supported for this target
error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`
error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr
new file mode 100644
index 000000000..cbf5e6c54
--- /dev/null
+++ b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr
@@ -0,0 +1,13 @@
+error[E0658]: `R` cannot be used as the type of `self` without the `arbitrary_self_types` feature
+ --> $DIR/arbitrary-self-from-method-substs.rs:8:43
+ |
+LL | fn get<R: Deref<Target = Self>>(self: R) -> u32 {
+ | ^
+ |
+ = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
+ = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable
+ = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/self/arbitrary-self-from-method-substs.stderr b/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr
index 6c252fadf..7378d53c3 100644
--- a/tests/ui/self/arbitrary-self-from-method-substs.stderr
+++ b/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/arbitrary-self-from-method-substs.rs:14:5
+ --> $DIR/arbitrary-self-from-method-substs.rs:16:5
|
LL | foo.get::<&Foo>();
| ^^^ expected `&Foo`, found `Foo`
diff --git a/tests/ui/self/arbitrary-self-from-method-substs.rs b/tests/ui/self/arbitrary-self-from-method-substs.rs
index 0f911a208..004445dc3 100644
--- a/tests/ui/self/arbitrary-self-from-method-substs.rs
+++ b/tests/ui/self/arbitrary-self-from-method-substs.rs
@@ -1,10 +1,12 @@
-#![feature(arbitrary_self_types)]
+// revisions: default feature
+#![cfg_attr(feature, feature(arbitrary_self_types))]
use std::ops::Deref;
struct Foo(u32);
impl Foo {
- fn get<R: Deref<Target=Self>>(self: R) -> u32 {
+ fn get<R: Deref<Target = Self>>(self: R) -> u32 {
+ //[default]~^ ERROR: `R` cannot be used as the type of `self`
self.0
}
}
@@ -12,5 +14,5 @@ impl Foo {
fn main() {
let mut foo = Foo(1);
foo.get::<&Foo>();
- //~^ ERROR mismatched types
+ //[feature]~^ ERROR mismatched types
}
diff --git a/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr b/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
index 13591f5b6..fdd18c6b3 100644
--- a/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
+++ b/tests/ui/self/arbitrary-self-types-not-object-safe.curr.stderr
@@ -14,6 +14,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo(self: &Rc<Self>) -> usize;
| ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
+ = help: only type `usize` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/arbitrary-self-types-not-object-safe.rs:33:13
@@ -31,6 +32,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo(self: &Rc<Self>) -> usize;
| ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
+ = help: only type `usize` implements the trait, consider using it directly instead
= note: required for the cast from `Rc<usize>` to `Rc<dyn Foo>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr b/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
index 593f70535..0a567ddcc 100644
--- a/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
+++ b/tests/ui/self/arbitrary-self-types-not-object-safe.object_safe_for_dispatch.stderr
@@ -14,6 +14,7 @@ LL | trait Foo {
| --- this trait cannot be made into an object...
LL | fn foo(self: &Rc<Self>) -> usize;
| ^^^^^^^^^ ...because method `foo`'s `self` parameter cannot be dispatched on
+ = help: only type `usize` implements the trait, consider using it directly instead
= note: required for the cast from `Rc<usize>` to `Rc<dyn Foo>`
error: aborting due to previous error
diff --git a/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed b/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed
index ccd65ff40..a400a1672 100644
--- a/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed
+++ b/tests/ui/self/arbitrary_self_types_needing_mut_pin.fixed
@@ -8,5 +8,6 @@ impl S {
}
fn main() {
- Pin::new(&mut S).x(); //~ ERROR no method named `x` found
+ let mut pinned = std::pin::pin!(S);
+ pinned.as_mut().x(); //~ ERROR no method named `x` found
}
diff --git a/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr b/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr
index f34ce4dce..5dcb58611 100644
--- a/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr
+++ b/tests/ui/self/arbitrary_self_types_needing_mut_pin.stderr
@@ -4,16 +4,14 @@ error[E0599]: no method named `x` found for struct `S` in the current scope
LL | struct S;
| -------- method `x` not found for this struct
...
-LL | fn x(self: Pin<&mut Self>) {
- | - the method is available for `Pin<&mut S>` here
-...
LL | S.x();
| ^ method not found in `S`
|
-help: consider wrapping the receiver expression with the appropriate type
+help: consider pinning the expression
+ |
+LL ~ let mut pinned = std::pin::pin!(S);
+LL ~ pinned.as_mut().x();
|
-LL | Pin::new(&mut S).x();
- | +++++++++++++ +
error: aborting due to previous error
diff --git a/tests/ui/self/self-impl.stderr b/tests/ui/self/self-impl.stderr
index 36372b644..18ffd1542 100644
--- a/tests/ui/self/self-impl.stderr
+++ b/tests/ui/self/self-impl.stderr
@@ -2,13 +2,13 @@ error[E0223]: ambiguous associated type
--> $DIR/self-impl.rs:23:16
|
LL | let _: <Self>::Baz = true;
- | ^^^^^^^^^^^ help: use the fully-qualified path: `<Bar as Foo>::Baz`
+ | ^^^^^^^^^^^ help: use fully-qualified syntax: `<Bar as Foo>::Baz`
error[E0223]: ambiguous associated type
--> $DIR/self-impl.rs:25:16
|
LL | let _: Self::Baz = true;
- | ^^^^^^^^^ help: use the fully-qualified path: `<Bar as Foo>::Baz`
+ | ^^^^^^^^^ help: use fully-qualified syntax: `<Bar as Foo>::Baz`
error: aborting due to 2 previous errors
diff --git a/tests/ui/self/self_type_keyword.rs b/tests/ui/self/self_type_keyword.rs
index b42bf8eea..96d24715e 100644
--- a/tests/ui/self/self_type_keyword.rs
+++ b/tests/ui/self/self_type_keyword.rs
@@ -22,6 +22,8 @@ pub fn main() {
//~^ ERROR cannot find macro `Self` in this scope
Foo { Self } => (),
//~^ ERROR expected identifier, found keyword `Self`
+ //~| ERROR mismatched types
+ //~| ERROR `Foo` does not have a field named `Self`
}
}
diff --git a/tests/ui/self/self_type_keyword.stderr b/tests/ui/self/self_type_keyword.stderr
index aca08d811..6e65fae80 100644
--- a/tests/ui/self/self_type_keyword.stderr
+++ b/tests/ui/self/self_type_keyword.stderr
@@ -31,19 +31,19 @@ LL | Foo { Self } => (),
| ^^^^ expected identifier, found keyword
error: expected identifier, found keyword `Self`
- --> $DIR/self_type_keyword.rs:29:26
+ --> $DIR/self_type_keyword.rs:31:26
|
LL | extern crate core as Self;
| ^^^^ expected identifier, found keyword
error: expected identifier, found keyword `Self`
- --> $DIR/self_type_keyword.rs:34:32
+ --> $DIR/self_type_keyword.rs:36:32
|
LL | use std::option::Option as Self;
| ^^^^ expected identifier, found keyword
error: expected identifier, found keyword `Self`
- --> $DIR/self_type_keyword.rs:39:11
+ --> $DIR/self_type_keyword.rs:41:11
|
LL | trait Self {}
| ^^^^ expected identifier, found keyword
@@ -80,7 +80,22 @@ LL | struct Bar<'Self>;
|
= help: consider removing `'Self`, referring to it in a field, or using a marker such as `PhantomData`
-error: aborting due to 12 previous errors
+error[E0308]: mismatched types
+ --> $DIR/self_type_keyword.rs:23:9
+ |
+LL | match 15 {
+ | -- this expression has type `{integer}`
+...
+LL | Foo { Self } => (),
+ | ^^^^^^^^^^^^ expected integer, found `Foo`
+
+error[E0026]: struct `Foo` does not have a field named `Self`
+ --> $DIR/self_type_keyword.rs:23:15
+ |
+LL | Foo { Self } => (),
+ | ^^^^ struct `Foo` does not have this field
+
+error: aborting due to 14 previous errors
-Some errors have detailed explanations: E0392, E0531.
-For more information about an error, try `rustc --explain E0392`.
+Some errors have detailed explanations: E0026, E0308, E0392, E0531.
+For more information about an error, try `rustc --explain E0026`.
diff --git a/tests/ui/simd/array-trait.rs b/tests/ui/simd/array-trait.rs
index 45c10b378..883d718c4 100644
--- a/tests/ui/simd/array-trait.rs
+++ b/tests/ui/simd/array-trait.rs
@@ -22,6 +22,7 @@ impl Simd for i32x4 {
#[derive(Copy, Clone)]
pub struct T<S: Simd>([S::Lane; S::SIZE]);
//~^ ERROR unconstrained generic constant
+//~| ERROR SIMD vector element type should be a primitive scalar
extern "platform-intrinsic" {
fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T;
diff --git a/tests/ui/simd/array-trait.stderr b/tests/ui/simd/array-trait.stderr
index 765215c39..cf6026912 100644
--- a/tests/ui/simd/array-trait.stderr
+++ b/tests/ui/simd/array-trait.stderr
@@ -6,5 +6,12 @@ LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
|
= help: try adding a `where` bound using this expression: `where [(); S::SIZE]:`
-error: aborting due to previous error
+error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
+ --> $DIR/array-trait.rs:23:1
+ |
+LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0077`.
diff --git a/tests/ui/sized/unsized-binding.rs b/tests/ui/sized/unsized-binding.rs
new file mode 100644
index 000000000..3b99b0f6e
--- /dev/null
+++ b/tests/ui/sized/unsized-binding.rs
@@ -0,0 +1,5 @@
+fn main() {
+ let x = *""; //~ ERROR E0277
+ println!("{}", x);
+ println!("{}", x);
+}
diff --git a/tests/ui/sized/unsized-binding.stderr b/tests/ui/sized/unsized-binding.stderr
new file mode 100644
index 000000000..af3066850
--- /dev/null
+++ b/tests/ui/sized/unsized-binding.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/unsized-binding.rs:2:9
+ |
+LL | let x = *"";
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `str`
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/span/issue-37767.stderr b/tests/ui/span/issue-37767.stderr
index b612fdf16..457870821 100644
--- a/tests/ui/span/issue-37767.stderr
+++ b/tests/ui/span/issue-37767.stderr
@@ -16,12 +16,12 @@ LL | fn foo(&mut self) {}
| ^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
-LL | A::foo(&a)
- | ~~~~~~~~~~
+LL | A::foo(&mut a)
+ | ~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
|
-LL | B::foo(&a)
- | ~~~~~~~~~~
+LL | B::foo(&mut a)
+ | ~~~~~~~~~~~~~~
error[E0034]: multiple applicable items in scope
--> $DIR/issue-37767.rs:22:7
diff --git a/tests/ui/span/issue-39698.stderr b/tests/ui/span/issue-39698.stderr
index 81211b20a..500080832 100644
--- a/tests/ui/span/issue-39698.stderr
+++ b/tests/ui/span/issue-39698.stderr
@@ -1,3 +1,13 @@
+error[E0408]: variable `b` is not bound in all patterns
+ --> $DIR/issue-39698.rs:10:9
+ |
+LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
+ | ^^^^^^^^^^^ - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `b`
+ | | | |
+ | | | pattern doesn't bind `b`
+ | | variable not in all patterns
+ | pattern doesn't bind `b`
+
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/issue-39698.rs:10:9
|
@@ -8,16 +18,6 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}
| | pattern doesn't bind `c`
| pattern doesn't bind `c`
-error[E0408]: variable `d` is not bound in all patterns
- --> $DIR/issue-39698.rs:10:37
- |
-LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
- | - - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `d`
- | | | |
- | | | pattern doesn't bind `d`
- | | variable not in all patterns
- | variable not in all patterns
-
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/issue-39698.rs:10:23
|
@@ -28,15 +28,15 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}
| | pattern doesn't bind `a`
| variable not in all patterns
-error[E0408]: variable `b` is not bound in all patterns
- --> $DIR/issue-39698.rs:10:9
+error[E0408]: variable `d` is not bound in all patterns
+ --> $DIR/issue-39698.rs:10:37
|
LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
- | ^^^^^^^^^^^ - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `b`
- | | | |
- | | | pattern doesn't bind `b`
- | | variable not in all patterns
- | pattern doesn't bind `b`
+ | - - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `d`
+ | | | |
+ | | | pattern doesn't bind `d`
+ | | variable not in all patterns
+ | variable not in all patterns
error: aborting due to 4 previous errors
diff --git a/tests/ui/span/issue-43927-non-ADT-derive.stderr b/tests/ui/span/issue-43927-non-ADT-derive.stderr
index e3ae37e36..a22a4d2b4 100644
--- a/tests/ui/span/issue-43927-non-ADT-derive.stderr
+++ b/tests/ui/span/issue-43927-non-ADT-derive.stderr
@@ -11,11 +11,15 @@ error: `derive` attribute cannot be used at crate level
|
LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | struct DerivedOn;
+ | --------- the inner attribute doesn't annotate this struct
|
help: perhaps you meant to use an outer attribute
|
-LL | #[derive(Debug, PartialEq, Eq)] // should be an outer attribute!
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
+LL + #[derive(Debug, PartialEq, Eq)] // should be an outer attribute!
+ |
error: aborting due to 2 previous errors
diff --git a/tests/ui/span/lint-unused-unsafe-thir.rs b/tests/ui/span/lint-unused-unsafe-thir.rs
deleted file mode 100644
index adb72c26b..000000000
--- a/tests/ui/span/lint-unused-unsafe-thir.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-// FIXME: This file is tracking old lint behavior that's still unchanged in the
-// unstable -Zthir-unsafeck implementation. See lint-unused-unsafe.rs for more details.
-//
-// Exercise the unused_unsafe attribute in some positive and negative cases
-
-// compile-flags: -Zthir-unsafeck
-
-#![allow(dead_code)]
-#![deny(unused_unsafe)]
-
-
-mod foo {
- extern "C" {
- pub fn bar();
- }
-}
-
-fn callback<T, F>(_f: F) -> T where F: FnOnce() -> T { panic!() }
-unsafe fn unsf() {}
-
-fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
-fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block
-unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block
-fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block
-unsafe fn bad5() { unsafe { unsf() } }
-fn bad6() {
- unsafe { // don't put the warning here
- unsafe { //~ ERROR: unnecessary `unsafe` block
- unsf()
- }
- }
-}
-unsafe fn bad7() {
- unsafe {
- unsafe { //~ ERROR: unnecessary `unsafe` block
- unsf()
- }
- }
-}
-
-unsafe fn good0() { unsf() }
-fn good1() { unsafe { unsf() } }
-fn good2() {
- /* bug uncovered when implementing warning about unused unsafe blocks. Be
- sure that when purity is inherited that the source of the unsafe-ness
- is tracked correctly */
- unsafe {
- unsafe fn what() -> Vec<String> { panic!() }
-
- callback(|| {
- what();
- });
- }
-}
-
-unsafe fn good3() { foo::bar() }
-fn good4() { unsafe { foo::bar() } }
-
-#[allow(unused_unsafe)] fn allowed() { unsafe {} }
-
-fn main() {}
diff --git a/tests/ui/span/lint-unused-unsafe-thir.stderr b/tests/ui/span/lint-unused-unsafe-thir.stderr
deleted file mode 100644
index 3bcbb7597..000000000
--- a/tests/ui/span/lint-unused-unsafe-thir.stderr
+++ /dev/null
@@ -1,50 +0,0 @@
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:21:13
- |
-LL | fn bad1() { unsafe {} }
- | ^^^^^^ unnecessary `unsafe` block
- |
-note: the lint level is defined here
- --> $DIR/lint-unused-unsafe-thir.rs:9:9
- |
-LL | #![deny(unused_unsafe)]
- | ^^^^^^^^^^^^^
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:22:13
- |
-LL | fn bad2() { unsafe { bad1() } }
- | ^^^^^^ unnecessary `unsafe` block
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:23:20
- |
-LL | unsafe fn bad3() { unsafe {} }
- | ---------------- ^^^^^^ unnecessary `unsafe` block
- | |
- | because it's nested under this `unsafe` fn
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:24:13
- |
-LL | fn bad4() { unsafe { callback(||{}) } }
- | ^^^^^^ unnecessary `unsafe` block
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:28:9
- |
-LL | unsafe { // don't put the warning here
- | ------ because it's nested under this `unsafe` block
-LL | unsafe {
- | ^^^^^^ unnecessary `unsafe` block
-
-error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe-thir.rs:35:9
- |
-LL | unsafe {
- | ------ because it's nested under this `unsafe` block
-LL | unsafe {
- | ^^^^^^ unnecessary `unsafe` block
-
-error: aborting due to 6 previous errors
-
diff --git a/tests/ui/span/lint-unused-unsafe.mir.stderr b/tests/ui/span/lint-unused-unsafe.mir.stderr
index d8412908c..9e8d33592 100644
--- a/tests/ui/span/lint-unused-unsafe.mir.stderr
+++ b/tests/ui/span/lint-unused-unsafe.mir.stderr
@@ -1,77 +1,77 @@
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:26:13
+ --> $DIR/lint-unused-unsafe.rs:22:13
|
LL | fn bad1() { unsafe {} }
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:14:9
+ --> $DIR/lint-unused-unsafe.rs:10:9
|
LL | #![deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:27:13
+ --> $DIR/lint-unused-unsafe.rs:23:13
|
LL | fn bad2() { unsafe { bad1() } }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:28:20
+ --> $DIR/lint-unused-unsafe.rs:24:20
|
LL | unsafe fn bad3() { unsafe {} }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:29:13
+ --> $DIR/lint-unused-unsafe.rs:25:13
|
LL | fn bad4() { unsafe { callback(||{}) } }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:32:5
+ --> $DIR/lint-unused-unsafe.rs:28:5
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:39:5
+ --> $DIR/lint-unused-unsafe.rs:35:5
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:74:9
+ --> $DIR/lint-unused-unsafe.rs:70:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:83:9
+ --> $DIR/lint-unused-unsafe.rs:79:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:84:13
+ --> $DIR/lint-unused-unsafe.rs:80:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:85:13
+ --> $DIR/lint-unused-unsafe.rs:81:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:90:9
+ --> $DIR/lint-unused-unsafe.rs:86:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:100:13
+ --> $DIR/lint-unused-unsafe.rs:96:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -80,7 +80,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:101:13
+ --> $DIR/lint-unused-unsafe.rs:97:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -89,7 +89,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:102:13
+ --> $DIR/lint-unused-unsafe.rs:98:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -98,7 +98,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:112:17
+ --> $DIR/lint-unused-unsafe.rs:108:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -107,13 +107,13 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:110:20
+ --> $DIR/lint-unused-unsafe.rs:106:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:113:17
+ --> $DIR/lint-unused-unsafe.rs:109:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -122,7 +122,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:114:17
+ --> $DIR/lint-unused-unsafe.rs:110:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -131,37 +131,37 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:124:9
+ --> $DIR/lint-unused-unsafe.rs:120:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:134:9
+ --> $DIR/lint-unused-unsafe.rs:130:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:135:13
+ --> $DIR/lint-unused-unsafe.rs:131:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:136:13
+ --> $DIR/lint-unused-unsafe.rs:132:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:142:9
+ --> $DIR/lint-unused-unsafe.rs:138:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:153:13
+ --> $DIR/lint-unused-unsafe.rs:149:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -170,7 +170,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:154:13
+ --> $DIR/lint-unused-unsafe.rs:150:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -179,7 +179,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:155:13
+ --> $DIR/lint-unused-unsafe.rs:151:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -188,7 +188,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:166:17
+ --> $DIR/lint-unused-unsafe.rs:162:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -197,13 +197,13 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:164:20
+ --> $DIR/lint-unused-unsafe.rs:160:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:167:17
+ --> $DIR/lint-unused-unsafe.rs:163:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -212,7 +212,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:168:17
+ --> $DIR/lint-unused-unsafe.rs:164:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -221,37 +221,37 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:178:9
+ --> $DIR/lint-unused-unsafe.rs:174:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:188:9
+ --> $DIR/lint-unused-unsafe.rs:184:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:189:13
+ --> $DIR/lint-unused-unsafe.rs:185:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:190:13
+ --> $DIR/lint-unused-unsafe.rs:186:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:196:9
+ --> $DIR/lint-unused-unsafe.rs:192:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:207:13
+ --> $DIR/lint-unused-unsafe.rs:203:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -260,7 +260,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:208:13
+ --> $DIR/lint-unused-unsafe.rs:204:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -269,7 +269,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:209:13
+ --> $DIR/lint-unused-unsafe.rs:205:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -278,7 +278,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:220:17
+ --> $DIR/lint-unused-unsafe.rs:216:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -287,13 +287,13 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:218:20
+ --> $DIR/lint-unused-unsafe.rs:214:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:221:17
+ --> $DIR/lint-unused-unsafe.rs:217:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -302,7 +302,7 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:222:17
+ --> $DIR/lint-unused-unsafe.rs:218:17
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -311,13 +311,13 @@ LL | unsafe { unsf() }
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:242:9
+ --> $DIR/lint-unused-unsafe.rs:238:9
|
LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:255:13
+ --> $DIR/lint-unused-unsafe.rs:251:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -325,7 +325,7 @@ LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:268:13
+ --> $DIR/lint-unused-unsafe.rs:264:13
|
LL | unsafe {
| ------ because it's nested under this `unsafe` block
@@ -333,37 +333,37 @@ LL | unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:286:20
+ --> $DIR/lint-unused-unsafe.rs:282:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:295:20
+ --> $DIR/lint-unused-unsafe.rs:291:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:296:24
+ --> $DIR/lint-unused-unsafe.rs:292:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:297:24
+ --> $DIR/lint-unused-unsafe.rs:293:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:302:20
+ --> $DIR/lint-unused-unsafe.rs:298:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:312:24
+ --> $DIR/lint-unused-unsafe.rs:308:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -372,7 +372,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:313:24
+ --> $DIR/lint-unused-unsafe.rs:309:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -381,7 +381,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:314:24
+ --> $DIR/lint-unused-unsafe.rs:310:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -390,7 +390,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:324:28
+ --> $DIR/lint-unused-unsafe.rs:320:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -399,13 +399,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:322:20
+ --> $DIR/lint-unused-unsafe.rs:318:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:325:28
+ --> $DIR/lint-unused-unsafe.rs:321:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -414,7 +414,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:326:28
+ --> $DIR/lint-unused-unsafe.rs:322:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -423,37 +423,37 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:336:20
+ --> $DIR/lint-unused-unsafe.rs:332:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:346:20
+ --> $DIR/lint-unused-unsafe.rs:342:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:347:24
+ --> $DIR/lint-unused-unsafe.rs:343:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:348:24
+ --> $DIR/lint-unused-unsafe.rs:344:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:354:20
+ --> $DIR/lint-unused-unsafe.rs:350:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:365:24
+ --> $DIR/lint-unused-unsafe.rs:361:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -462,7 +462,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:366:24
+ --> $DIR/lint-unused-unsafe.rs:362:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -471,7 +471,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:367:24
+ --> $DIR/lint-unused-unsafe.rs:363:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -480,7 +480,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:378:28
+ --> $DIR/lint-unused-unsafe.rs:374:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -489,13 +489,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:376:20
+ --> $DIR/lint-unused-unsafe.rs:372:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:379:28
+ --> $DIR/lint-unused-unsafe.rs:375:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -504,7 +504,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:380:28
+ --> $DIR/lint-unused-unsafe.rs:376:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -513,37 +513,37 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:390:20
+ --> $DIR/lint-unused-unsafe.rs:386:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:400:20
+ --> $DIR/lint-unused-unsafe.rs:396:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:401:24
+ --> $DIR/lint-unused-unsafe.rs:397:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:402:24
+ --> $DIR/lint-unused-unsafe.rs:398:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:408:20
+ --> $DIR/lint-unused-unsafe.rs:404:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:419:24
+ --> $DIR/lint-unused-unsafe.rs:415:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -552,7 +552,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:420:24
+ --> $DIR/lint-unused-unsafe.rs:416:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -561,7 +561,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:421:24
+ --> $DIR/lint-unused-unsafe.rs:417:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -570,7 +570,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:432:28
+ --> $DIR/lint-unused-unsafe.rs:428:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -579,13 +579,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:430:20
+ --> $DIR/lint-unused-unsafe.rs:426:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:433:28
+ --> $DIR/lint-unused-unsafe.rs:429:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -594,7 +594,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:434:28
+ --> $DIR/lint-unused-unsafe.rs:430:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -603,13 +603,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:454:20
+ --> $DIR/lint-unused-unsafe.rs:450:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:467:24
+ --> $DIR/lint-unused-unsafe.rs:463:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -617,7 +617,7 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:480:24
+ --> $DIR/lint-unused-unsafe.rs:476:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -625,37 +625,37 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:499:20
+ --> $DIR/lint-unused-unsafe.rs:495:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:508:20
+ --> $DIR/lint-unused-unsafe.rs:504:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:509:24
+ --> $DIR/lint-unused-unsafe.rs:505:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:510:24
+ --> $DIR/lint-unused-unsafe.rs:506:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:515:20
+ --> $DIR/lint-unused-unsafe.rs:511:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:525:24
+ --> $DIR/lint-unused-unsafe.rs:521:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -664,7 +664,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:526:24
+ --> $DIR/lint-unused-unsafe.rs:522:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -673,7 +673,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:527:24
+ --> $DIR/lint-unused-unsafe.rs:523:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -682,7 +682,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:537:28
+ --> $DIR/lint-unused-unsafe.rs:533:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -691,13 +691,13 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:535:20
+ --> $DIR/lint-unused-unsafe.rs:531:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:538:28
+ --> $DIR/lint-unused-unsafe.rs:534:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -706,7 +706,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:539:28
+ --> $DIR/lint-unused-unsafe.rs:535:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -715,37 +715,37 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:549:20
+ --> $DIR/lint-unused-unsafe.rs:545:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:559:20
+ --> $DIR/lint-unused-unsafe.rs:555:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:560:24
+ --> $DIR/lint-unused-unsafe.rs:556:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:561:24
+ --> $DIR/lint-unused-unsafe.rs:557:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:567:20
+ --> $DIR/lint-unused-unsafe.rs:563:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:578:24
+ --> $DIR/lint-unused-unsafe.rs:574:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -754,7 +754,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:579:24
+ --> $DIR/lint-unused-unsafe.rs:575:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -763,7 +763,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:580:24
+ --> $DIR/lint-unused-unsafe.rs:576:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -772,7 +772,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:591:28
+ --> $DIR/lint-unused-unsafe.rs:587:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -781,13 +781,13 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:589:20
+ --> $DIR/lint-unused-unsafe.rs:585:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:592:28
+ --> $DIR/lint-unused-unsafe.rs:588:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -796,7 +796,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:593:28
+ --> $DIR/lint-unused-unsafe.rs:589:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -805,37 +805,37 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:603:20
+ --> $DIR/lint-unused-unsafe.rs:599:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:613:20
+ --> $DIR/lint-unused-unsafe.rs:609:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:614:24
+ --> $DIR/lint-unused-unsafe.rs:610:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:615:24
+ --> $DIR/lint-unused-unsafe.rs:611:24
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:621:20
+ --> $DIR/lint-unused-unsafe.rs:617:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:632:24
+ --> $DIR/lint-unused-unsafe.rs:628:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -844,7 +844,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:633:24
+ --> $DIR/lint-unused-unsafe.rs:629:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -853,7 +853,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:634:24
+ --> $DIR/lint-unused-unsafe.rs:630:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -862,7 +862,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:645:28
+ --> $DIR/lint-unused-unsafe.rs:641:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -871,13 +871,13 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:643:20
+ --> $DIR/lint-unused-unsafe.rs:639:20
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:646:28
+ --> $DIR/lint-unused-unsafe.rs:642:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -886,7 +886,7 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:647:28
+ --> $DIR/lint-unused-unsafe.rs:643:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -895,13 +895,13 @@ LL | let _ = || unsafe { let _ = || unsf(); };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:667:20
+ --> $DIR/lint-unused-unsafe.rs:663:20
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:680:24
+ --> $DIR/lint-unused-unsafe.rs:676:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -909,7 +909,7 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:693:24
+ --> $DIR/lint-unused-unsafe.rs:689:24
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -917,37 +917,37 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:711:24
+ --> $DIR/lint-unused-unsafe.rs:707:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:721:24
+ --> $DIR/lint-unused-unsafe.rs:717:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:722:28
+ --> $DIR/lint-unused-unsafe.rs:718:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:723:28
+ --> $DIR/lint-unused-unsafe.rs:719:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:729:24
+ --> $DIR/lint-unused-unsafe.rs:725:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:740:28
+ --> $DIR/lint-unused-unsafe.rs:736:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -956,7 +956,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:741:28
+ --> $DIR/lint-unused-unsafe.rs:737:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -965,7 +965,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:742:28
+ --> $DIR/lint-unused-unsafe.rs:738:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -974,7 +974,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:753:32
+ --> $DIR/lint-unused-unsafe.rs:749:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -983,13 +983,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:751:24
+ --> $DIR/lint-unused-unsafe.rs:747:24
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:754:32
+ --> $DIR/lint-unused-unsafe.rs:750:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -998,7 +998,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:755:32
+ --> $DIR/lint-unused-unsafe.rs:751:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1007,37 +1007,37 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:765:24
+ --> $DIR/lint-unused-unsafe.rs:761:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:775:24
+ --> $DIR/lint-unused-unsafe.rs:771:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:776:28
+ --> $DIR/lint-unused-unsafe.rs:772:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:777:28
+ --> $DIR/lint-unused-unsafe.rs:773:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:783:24
+ --> $DIR/lint-unused-unsafe.rs:779:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:794:28
+ --> $DIR/lint-unused-unsafe.rs:790:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1046,7 +1046,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:795:28
+ --> $DIR/lint-unused-unsafe.rs:791:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1055,7 +1055,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:796:28
+ --> $DIR/lint-unused-unsafe.rs:792:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1064,7 +1064,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:807:32
+ --> $DIR/lint-unused-unsafe.rs:803:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1073,13 +1073,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:805:24
+ --> $DIR/lint-unused-unsafe.rs:801:24
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:808:32
+ --> $DIR/lint-unused-unsafe.rs:804:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1088,7 +1088,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:809:32
+ --> $DIR/lint-unused-unsafe.rs:805:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1097,13 +1097,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:829:24
+ --> $DIR/lint-unused-unsafe.rs:825:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:842:28
+ --> $DIR/lint-unused-unsafe.rs:838:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1111,7 +1111,7 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:855:28
+ --> $DIR/lint-unused-unsafe.rs:851:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1119,37 +1119,37 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:869:24
+ --> $DIR/lint-unused-unsafe.rs:865:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:879:24
+ --> $DIR/lint-unused-unsafe.rs:875:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:880:28
+ --> $DIR/lint-unused-unsafe.rs:876:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:881:28
+ --> $DIR/lint-unused-unsafe.rs:877:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:887:24
+ --> $DIR/lint-unused-unsafe.rs:883:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:898:28
+ --> $DIR/lint-unused-unsafe.rs:894:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1158,7 +1158,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:899:28
+ --> $DIR/lint-unused-unsafe.rs:895:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1167,7 +1167,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:900:28
+ --> $DIR/lint-unused-unsafe.rs:896:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1176,7 +1176,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:911:32
+ --> $DIR/lint-unused-unsafe.rs:907:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1185,13 +1185,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:909:24
+ --> $DIR/lint-unused-unsafe.rs:905:24
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:912:32
+ --> $DIR/lint-unused-unsafe.rs:908:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1200,7 +1200,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:913:32
+ --> $DIR/lint-unused-unsafe.rs:909:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1209,37 +1209,37 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:923:24
+ --> $DIR/lint-unused-unsafe.rs:919:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:933:24
+ --> $DIR/lint-unused-unsafe.rs:929:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:934:28
+ --> $DIR/lint-unused-unsafe.rs:930:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:935:28
+ --> $DIR/lint-unused-unsafe.rs:931:28
|
LL | let _ = || unsafe {};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:941:24
+ --> $DIR/lint-unused-unsafe.rs:937:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:952:28
+ --> $DIR/lint-unused-unsafe.rs:948:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1248,7 +1248,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:953:28
+ --> $DIR/lint-unused-unsafe.rs:949:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1257,7 +1257,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:954:28
+ --> $DIR/lint-unused-unsafe.rs:950:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1266,7 +1266,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:965:32
+ --> $DIR/lint-unused-unsafe.rs:961:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1275,13 +1275,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
- --> $DIR/lint-unused-unsafe.rs:963:24
+ --> $DIR/lint-unused-unsafe.rs:959:24
|
LL | #[deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:966:32
+ --> $DIR/lint-unused-unsafe.rs:962:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1290,7 +1290,7 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:967:32
+ --> $DIR/lint-unused-unsafe.rs:963:32
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1299,13 +1299,13 @@ LL | let _ = || unsafe { unsf() };
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:987:24
+ --> $DIR/lint-unused-unsafe.rs:983:24
|
LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1000:28
+ --> $DIR/lint-unused-unsafe.rs:996:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1313,7 +1313,7 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1013:28
+ --> $DIR/lint-unused-unsafe.rs:1009:28
|
LL | let _ = || unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1321,13 +1321,13 @@ LL | let _ = || unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1059:29
+ --> $DIR/lint-unused-unsafe.rs:1055:29
|
LL | let _ = async { unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1066:33
+ --> $DIR/lint-unused-unsafe.rs:1062:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1336,7 +1336,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1067:33
+ --> $DIR/lint-unused-unsafe.rs:1063:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1345,7 +1345,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1068:33
+ --> $DIR/lint-unused-unsafe.rs:1064:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1354,13 +1354,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1073:29
+ --> $DIR/lint-unused-unsafe.rs:1069:29
|
LL | let _ = async { unsafe {
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1080:33
+ --> $DIR/lint-unused-unsafe.rs:1076:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1369,7 +1369,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1081:33
+ --> $DIR/lint-unused-unsafe.rs:1077:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1378,7 +1378,7 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1082:33
+ --> $DIR/lint-unused-unsafe.rs:1078:33
|
LL | let _ = async { unsafe {
| ------ because it's nested under this `unsafe` block
@@ -1387,13 +1387,13 @@ LL | let _ = async { unsafe { let _ = async { unsf() }; }};
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1092:22
+ --> $DIR/lint-unused-unsafe.rs:1088:22
|
LL | let _x: [(); unsafe { 0 }] = [];
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/lint-unused-unsafe.rs:1096:22
+ --> $DIR/lint-unused-unsafe.rs:1092:22
|
LL | let _x: [(); unsafe { unsafe { size() } }] = [];
| ^^^^^^ unnecessary `unsafe` block
diff --git a/tests/ui/span/lint-unused-unsafe.rs b/tests/ui/span/lint-unused-unsafe.rs
index 5d042768b..ca615f64f 100644
--- a/tests/ui/span/lint-unused-unsafe.rs
+++ b/tests/ui/span/lint-unused-unsafe.rs
@@ -3,12 +3,8 @@
// edition:2018
-// revisions: mir
-
-// FIXME: Adapt -Zthir-unsafeck to behave the same as the mir version after #93678,
-// then delete lint-unused-unsafe-thir.rs, and go back to using the settings below
-// // revisions: mir thir
-// // [thir]compile-flags: -Zthir-unsafeck
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
#![allow(dead_code)]
#![deny(unused_unsafe)]
diff --git a/tests/ui/span/lint-unused-unsafe.thir.stderr b/tests/ui/span/lint-unused-unsafe.thir.stderr
new file mode 100644
index 000000000..9e8d33592
--- /dev/null
+++ b/tests/ui/span/lint-unused-unsafe.thir.stderr
@@ -0,0 +1,1402 @@
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:22:13
+ |
+LL | fn bad1() { unsafe {} }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:10:9
+ |
+LL | #![deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:23:13
+ |
+LL | fn bad2() { unsafe { bad1() } }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:24:20
+ |
+LL | unsafe fn bad3() { unsafe {} }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:25:13
+ |
+LL | fn bad4() { unsafe { callback(||{}) } }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:28:5
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:35:5
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:70:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:79:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:80:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:81:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:86:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:96:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:97:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:98:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:108:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:106:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:109:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:110:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:120:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:130:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:131:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:132:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:138:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:149:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:150:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:151:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:162:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:160:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:163:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:164:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:174:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:184:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:185:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:186:13
+ |
+LL | unsafe {}
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:192:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:203:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:204:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:205:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:216:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:214:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:217:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:218:17
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | unsafe { unsf() }
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:238:9
+ |
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:251:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:264:13
+ |
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:282:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:291:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:292:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:293:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:298:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:308:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:309:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:310:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:320:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:318:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:321:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:322:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:332:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:342:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:343:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:344:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:350:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:361:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:362:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:363:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:374:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:372:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:375:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:376:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:386:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:396:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:397:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:398:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:404:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:415:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:416:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:417:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:428:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:426:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:429:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:430:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:450:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:463:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:476:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:495:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:504:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:505:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:506:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:511:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:521:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsf();
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:522:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:523:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:533:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:531:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:534:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:535:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:545:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:555:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:556:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:557:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:563:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:574:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsf();
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:575:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:576:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:587:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:585:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:588:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:589:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:599:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:609:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:610:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:611:24
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:617:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:628:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsf();
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:629:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:630:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:641:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:639:20
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:642:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:643:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { let _ = || unsf(); };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:663:20
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:676:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:689:24
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:707:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:717:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:718:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:719:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:725:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:736:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:737:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:738:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:749:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:747:24
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:750:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:751:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:761:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:771:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:772:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:773:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:779:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:790:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:791:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:792:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:803:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:801:24
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:804:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:805:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:825:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:838:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:851:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:865:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:875:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:876:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:877:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:883:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:894:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:895:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:896:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:907:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:905:24
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:908:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:909:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:919:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:929:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:930:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:931:28
+ |
+LL | let _ = || unsafe {};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:937:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:948:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | unsf();
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:949:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:950:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:961:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: the lint level is defined here
+ --> $DIR/lint-unused-unsafe.rs:959:24
+ |
+LL | #[deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:962:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:963:32
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = || unsafe { unsf() };
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:983:24
+ |
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:996:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1009:28
+ |
+LL | let _ = || unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = || unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1055:29
+ |
+LL | let _ = async { unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1062:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = async { unsf() };
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1063:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1064:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1069:29
+ |
+LL | let _ = async { unsafe {
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1076:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | let _ = async { unsf() };
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1077:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1078:33
+ |
+LL | let _ = async { unsafe {
+ | ------ because it's nested under this `unsafe` block
+...
+LL | let _ = async { unsafe { let _ = async { unsf() }; }};
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1088:22
+ |
+LL | let _x: [(); unsafe { 0 }] = [];
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: unnecessary `unsafe` block
+ --> $DIR/lint-unused-unsafe.rs:1092:22
+ |
+LL | let _x: [(); unsafe { unsafe { size() } }] = [];
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: aborting due to 174 previous errors
+
diff --git a/tests/ui/specialization/issue-52050.stderr b/tests/ui/specialization/issue-52050.stderr
index c263fe467..85aac16f6 100644
--- a/tests/ui/specialization/issue-52050.stderr
+++ b/tests/ui/specialization/issue-52050.stderr
@@ -11,11 +11,13 @@ LL | #![feature(specialization)]
error[E0119]: conflicting implementations of trait `IntoPyDictPointer` for type `()`
--> $DIR/issue-52050.rs:28:1
|
-LL | impl<I> IntoPyDictPointer for I
- | ------------------------------- first implementation here
+LL | / impl<I> IntoPyDictPointer for I
+LL | | where
+LL | | I: Iterator,
+ | |________________- first implementation here
...
-LL | impl IntoPyDictPointer for ()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+LL | impl IntoPyDictPointer for ()
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
|
= note: upstream crates may add a new impl of trait `std::iter::Iterator` for type `()` in future versions
diff --git a/tests/ui/specialization/min_specialization/issue-79224.rs b/tests/ui/specialization/min_specialization/issue-79224.rs
index 104bddd07..a118cb28b 100644
--- a/tests/ui/specialization/min_specialization/issue-79224.rs
+++ b/tests/ui/specialization/min_specialization/issue-79224.rs
@@ -19,6 +19,7 @@ impl<B: ?Sized> Display for Cow<'_, B> {
//~^ ERROR: the trait bound `B: Clone` is not satisfied [E0277]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
//~^ ERROR: the trait bound `B: Clone` is not satisfied [E0277]
+ //~| ERROR: the trait bound `B: Clone` is not satisfied [E0277]
write!(f, "foo")
}
}
diff --git a/tests/ui/specialization/min_specialization/issue-79224.stderr b/tests/ui/specialization/min_specialization/issue-79224.stderr
index 9a4d557a1..754157949 100644
--- a/tests/ui/specialization/min_specialization/issue-79224.stderr
+++ b/tests/ui/specialization/min_specialization/issue-79224.stderr
@@ -22,6 +22,18 @@ help: consider further restricting this bound
LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++
-error: aborting due to 2 previous errors
+error[E0277]: the trait bound `B: Clone` is not satisfied
+ --> $DIR/issue-79224.rs:20:5
+ |
+LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
+ |
+ = note: required for `B` to implement `ToOwned`
+help: consider further restricting this bound
+ |
+LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
+ | +++++++++++++++++++
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/stability-attribute/stability-attribute-issue-43027.rs b/tests/ui/stability-attribute/stability-attribute-issue-43027.rs
index 3f4fdfd01..810fbef7b 100644
--- a/tests/ui/stability-attribute/stability-attribute-issue-43027.rs
+++ b/tests/ui/stability-attribute/stability-attribute-issue-43027.rs
@@ -1,12 +1,12 @@
// check-pass
#![feature(staged_api)]
-#![stable(feature = "test", since = "0")]
+#![stable(feature = "test", since = "3.3.3")]
-#[stable(feature = "test", since = "0")]
+#[stable(feature = "test", since = "3.3.3")]
pub struct A<T>(pub T);
-#[stable(feature = "test", since = "0")]
-pub struct B<T>(#[stable(feature = "test", since = "0")] pub T);
+#[stable(feature = "test", since = "3.3.3")]
+pub struct B<T>(#[stable(feature = "test", since = "3.3.3")] pub T);
fn main() {
// Make sure the field is used to fill the stability cache
diff --git a/tests/ui/stability-attribute/stability-attribute-sanity-4.rs b/tests/ui/stability-attribute/stability-attribute-sanity-4.rs
index 64f996352..01a46d15c 100644
--- a/tests/ui/stability-attribute/stability-attribute-sanity-4.rs
+++ b/tests/ui/stability-attribute/stability-attribute-sanity-4.rs
@@ -17,11 +17,12 @@ mod bogus_attribute_types_2 {
#[stable = "a"] //~ ERROR malformed `stable` attribute
fn f4() { }
- #[stable(feature = "a", since = "b")]
+ #[stable(feature = "a", since = "3.3.3")]
#[deprecated] //~ ERROR missing 'since'
+ //~^ ERROR missing 'note'
fn f5() { }
- #[stable(feature = "a", since = "b")]
+ #[stable(feature = "a", since = "3.3.3")]
#[deprecated = "a"] //~ ERROR missing 'since'
fn f6() { }
}
diff --git a/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr b/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr
index a76f5be1e..8ead943ff 100644
--- a/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr
+++ b/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr
@@ -28,12 +28,19 @@ error[E0542]: missing 'since'
LL | #[deprecated]
| ^^^^^^^^^^^^^
+error[E0543]: missing 'note'
+ --> $DIR/stability-attribute-sanity-4.rs:21:5
+ |
+LL | #[deprecated]
+ | ^^^^^^^^^^^^^
+
error[E0542]: missing 'since'
- --> $DIR/stability-attribute-sanity-4.rs:25:5
+ --> $DIR/stability-attribute-sanity-4.rs:26:5
|
LL | #[deprecated = "a"]
| ^^^^^^^^^^^^^^^^^^^
-error: aborting due to 6 previous errors
+error: aborting due to 7 previous errors
-For more information about this error, try `rustc --explain E0542`.
+Some errors have detailed explanations: E0542, E0543.
+For more information about an error, try `rustc --explain E0542`.
diff --git a/tests/ui/stability-attribute/stability-attribute-sanity.rs b/tests/ui/stability-attribute/stability-attribute-sanity.rs
index cc30e6ab9..7857a0603 100644
--- a/tests/ui/stability-attribute/stability-attribute-sanity.rs
+++ b/tests/ui/stability-attribute/stability-attribute-sanity.rs
@@ -5,19 +5,19 @@
#![stable(feature = "rust1", since = "1.0.0")]
mod bogus_attribute_types_1 {
- #[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541]
+ #[stable(feature = "a", since = "4.4.4", reason)] //~ ERROR unknown meta item 'reason' [E0541]
fn f1() { }
#[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539]
fn f2() { }
- #[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539]
+ #[stable(feature, since = "3.3.3")] //~ ERROR incorrect meta item [E0539]
fn f3() { }
#[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539]
fn f5() { }
- #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539]
+ #[stable(feature(b), since = "3.3.3")] //~ ERROR incorrect meta item [E0539]
fn f6() { }
}
@@ -28,7 +28,7 @@ mod missing_feature_names {
#[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547]
fn f2() { }
- #[stable(since = "a")] //~ ERROR missing 'feature' [E0546]
+ #[stable(since = "3.3.3")] //~ ERROR missing 'feature' [E0546]
fn f3() { }
}
@@ -36,40 +36,39 @@ mod missing_version {
#[stable(feature = "a")] //~ ERROR missing 'since' [E0542]
fn f1() { }
- #[stable(feature = "a", since = "b")]
+ #[stable(feature = "a", since = "4.4.4")]
#[deprecated(note = "a")] //~ ERROR missing 'since' [E0542]
fn f2() { }
- #[stable(feature = "a", since = "b")]
- #[deprecated(since = "a")] //~ ERROR missing 'note' [E0543]
+ #[stable(feature = "a", since = "4.4.4")]
+ #[deprecated(since = "5.5.5")] //~ ERROR missing 'note' [E0543]
fn f3() { }
}
#[unstable(feature = "b", issue = "none")]
-#[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
+#[stable(feature = "a", since = "4.4.4")] //~ ERROR multiple stability levels [E0544]
fn multiple1() { }
#[unstable(feature = "b", issue = "none")]
#[unstable(feature = "b", issue = "none")] //~ ERROR multiple stability levels [E0544]
fn multiple2() { }
-#[stable(feature = "a", since = "b")]
-#[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
+#[stable(feature = "a", since = "4.4.4")]
+#[stable(feature = "a", since = "4.4.4")] //~ ERROR multiple stability levels [E0544]
fn multiple3() { }
-#[stable(feature = "a", since = "b")] //~ ERROR invalid stability version found
-#[deprecated(since = "b", note = "text")]
-#[deprecated(since = "b", note = "text")] //~ ERROR multiple `deprecated` attributes
+#[stable(feature = "e", since = "b")] //~ ERROR 'since' must be a Rust version number, such as "1.31.0"
+#[deprecated(since = "5.5.5", note = "text")]
+#[deprecated(since = "5.5.5", note = "text")] //~ ERROR multiple `deprecated` attributes
#[rustc_const_unstable(feature = "c", issue = "none")]
#[rustc_const_unstable(feature = "d", issue = "none")] //~ ERROR multiple stability levels
pub const fn multiple4() { }
-#[stable(feature = "a", since = "1.0.0")] //~ ERROR invalid deprecation version found
-//~^ ERROR feature `a` is declared stable since 1.0.0
-#[deprecated(since = "invalid", note = "text")]
+#[stable(feature = "a", since = "1.0.0")] //~ ERROR feature `a` is declared stable since 1.0.0
+#[deprecated(since = "invalid", note = "text")] //~ ERROR 'since' must be a Rust version number, such as "1.31.0"
fn invalid_deprecation_version() {}
-#[deprecated(since = "a", note = "text")]
+#[deprecated(since = "5.5.5", note = "text")]
fn deprecated_without_unstable_or_stable() { }
//~^^ ERROR deprecated attribute must be paired with either stable or unstable attribute
diff --git a/tests/ui/stability-attribute/stability-attribute-sanity.stderr b/tests/ui/stability-attribute/stability-attribute-sanity.stderr
index 89a8425f5..c614fc2b9 100644
--- a/tests/ui/stability-attribute/stability-attribute-sanity.stderr
+++ b/tests/ui/stability-attribute/stability-attribute-sanity.stderr
@@ -1,20 +1,20 @@
error: multiple `deprecated` attributes
--> $DIR/stability-attribute-sanity.rs:62:1
|
-LL | #[deprecated(since = "b", note = "text")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+LL | #[deprecated(since = "5.5.5", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/stability-attribute-sanity.rs:61:1
|
-LL | #[deprecated(since = "b", note = "text")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deprecated(since = "5.5.5", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0541]: unknown meta item 'reason'
- --> $DIR/stability-attribute-sanity.rs:8:42
+ --> $DIR/stability-attribute-sanity.rs:8:46
|
-LL | #[stable(feature = "a", since = "b", reason)]
- | ^^^^^^ expected one of `feature`, `since`
+LL | #[stable(feature = "a", since = "4.4.4", reason)]
+ | ^^^^^^ expected one of `feature`, `since`
error[E0539]: incorrect meta item
--> $DIR/stability-attribute-sanity.rs:11:29
@@ -25,7 +25,7 @@ LL | #[stable(feature = "a", since)]
error[E0539]: incorrect meta item
--> $DIR/stability-attribute-sanity.rs:14:14
|
-LL | #[stable(feature, since = "a")]
+LL | #[stable(feature, since = "3.3.3")]
| ^^^^^^^
error[E0539]: incorrect meta item
@@ -37,7 +37,7 @@ LL | #[stable(feature = "a", since(b))]
error[E0539]: incorrect meta item
--> $DIR/stability-attribute-sanity.rs:20:14
|
-LL | #[stable(feature(b), since = "a")]
+LL | #[stable(feature(b), since = "3.3.3")]
| ^^^^^^^^^^
error[E0546]: missing 'feature'
@@ -55,8 +55,8 @@ LL | #[unstable(feature = "b")]
error[E0546]: missing 'feature'
--> $DIR/stability-attribute-sanity.rs:31:5
|
-LL | #[stable(since = "a")]
- | ^^^^^^^^^^^^^^^^^^^^^^
+LL | #[stable(since = "3.3.3")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0542]: missing 'since'
--> $DIR/stability-attribute-sanity.rs:36:5
@@ -73,14 +73,14 @@ LL | #[deprecated(note = "a")]
error[E0543]: missing 'note'
--> $DIR/stability-attribute-sanity.rs:44:5
|
-LL | #[deprecated(since = "a")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deprecated(since = "5.5.5")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0544]: multiple stability levels
--> $DIR/stability-attribute-sanity.rs:49:1
|
-LL | #[stable(feature = "a", since = "b")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[stable(feature = "a", since = "4.4.4")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0544]: multiple stability levels
--> $DIR/stability-attribute-sanity.rs:53:1
@@ -91,7 +91,13 @@ LL | #[unstable(feature = "b", issue = "none")]
error[E0544]: multiple stability levels
--> $DIR/stability-attribute-sanity.rs:57:1
|
-LL | #[stable(feature = "a", since = "b")]
+LL | #[stable(feature = "a", since = "4.4.4")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: 'since' must be a Rust version number, such as "1.31.0"
+ --> $DIR/stability-attribute-sanity.rs:60:1
+ |
+LL | #[stable(feature = "e", since = "b")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0544]: multiple stability levels
@@ -100,31 +106,19 @@ error[E0544]: multiple stability levels
LL | #[rustc_const_unstable(feature = "d", issue = "none")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: invalid stability version found
- --> $DIR/stability-attribute-sanity.rs:60:1
+error: 'since' must be a Rust version number, such as "1.31.0"
+ --> $DIR/stability-attribute-sanity.rs:68:1
|
-LL | #[stable(feature = "a", since = "b")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid stability version
-...
-LL | pub const fn multiple4() { }
- | ---------------------------- the stability attribute annotates this item
-
-error: invalid deprecation version found
- --> $DIR/stability-attribute-sanity.rs:67:1
- |
-LL | #[stable(feature = "a", since = "1.0.0")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid deprecation version
-...
-LL | fn invalid_deprecation_version() {}
- | ----------------------------------- the stability attribute annotates this item
+LL | #[deprecated(since = "invalid", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0549]: deprecated attribute must be paired with either stable or unstable attribute
- --> $DIR/stability-attribute-sanity.rs:72:1
+ --> $DIR/stability-attribute-sanity.rs:71:1
|
-LL | #[deprecated(since = "a", note = "text")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #[deprecated(since = "5.5.5", note = "text")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0711]: feature `a` is declared stable since 1.0.0, but was previously declared stable since b
+error[E0711]: feature `a` is declared stable since 1.0.0, but was previously declared stable since 4.4.4
--> $DIR/stability-attribute-sanity.rs:67:1
|
LL | #[stable(feature = "a", since = "1.0.0")]
diff --git a/tests/ui/stability-attribute/stability-attribute-trait-impl.rs b/tests/ui/stability-attribute/stability-attribute-trait-impl.rs
index 1d138e264..880000ee7 100644
--- a/tests/ui/stability-attribute/stability-attribute-trait-impl.rs
+++ b/tests/ui/stability-attribute/stability-attribute-trait-impl.rs
@@ -1,13 +1,13 @@
#![feature(staged_api, never_type, rust_cold_cc)]
//~^ ERROR module has missing stability attribute
-#[stable(feature = "a", since = "1")]
+#[stable(feature = "a", since = "3.3.3")]
struct StableType;
#[unstable(feature = "b", issue = "none")]
struct UnstableType;
-#[stable(feature = "c", since = "1")]
+#[stable(feature = "c", since = "3.3.3")]
trait StableTrait {}
#[unstable(feature = "d", issue = "none")]
diff --git a/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr b/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr
index 96322c2c9..018786dd2 100644
--- a/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr
+++ b/tests/ui/stability-attribute/stability-attribute-trait-impl.stderr
@@ -21,7 +21,7 @@ error: module has missing stability attribute
LL | / #![feature(staged_api, never_type, rust_cold_cc)]
LL | |
LL | |
-LL | | #[stable(feature = "a", since = "1")]
+LL | | #[stable(feature = "a", since = "3.3.3")]
... |
LL | |
LL | | fn main() {}
diff --git a/tests/ui/str/str-idx.stderr b/tests/ui/str/str-idx.stderr
index cb1a6fcac..e8bbb8058 100644
--- a/tests/ui/str/str-idx.stderr
+++ b/tests/ui/str/str-idx.stderr
@@ -7,7 +7,8 @@ LL | let _: u8 = s[4];
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
= note: required for `str` to implement `Index<{integer}>`
error[E0277]: the type `str` cannot be indexed by `{integer}`
@@ -21,7 +22,8 @@ LL | let _ = s.get(4);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
note: required by a bound in `core::str::<impl str>::get`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
@@ -36,7 +38,8 @@ LL | let _ = s.get_unchecked(4);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
note: required by a bound in `core::str::<impl str>::get_unchecked`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
diff --git a/tests/ui/str/str-mut-idx.stderr b/tests/ui/str/str-mut-idx.stderr
index ca4b86ba3..e6835bb54 100644
--- a/tests/ui/str/str-mut-idx.stderr
+++ b/tests/ui/str/str-mut-idx.stderr
@@ -31,7 +31,8 @@ LL | s[1usize] = bot();
| ^^^^^^ string indices are ranges of `usize`
|
= help: the trait `SliceIndex<str>` is not implemented for `usize`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
= note: required for `str` to implement `Index<usize>`
error[E0277]: the type `str` cannot be indexed by `{integer}`
@@ -45,7 +46,8 @@ LL | s.get_mut(1);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
note: required by a bound in `core::str::<impl str>::get_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
@@ -60,7 +62,8 @@ LL | s.get_unchecked_mut(1);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[_]>` is implemented for `usize`
+ = help: for that trait implementation, expected `[_]`, found `str`
note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
diff --git a/tests/ui/structs/method-chain-expression-failure.rs b/tests/ui/structs/method-chain-expression-failure.rs
new file mode 100644
index 000000000..43ebc5bac
--- /dev/null
+++ b/tests/ui/structs/method-chain-expression-failure.rs
@@ -0,0 +1,31 @@
+struct A;
+struct B;
+struct C;
+struct D;
+struct E;
+
+impl A {
+ fn b(&self) -> B { B }
+ fn foo(&self) {}
+}
+
+impl B {
+ fn c(&self) -> C { C }
+}
+
+impl C {
+ fn d(&self) -> D { D }
+ fn foo(&self) {}
+}
+
+impl D {
+ fn e(&self) -> E { E }
+}
+
+impl E {
+ fn f(&self) {}
+}
+fn main() {
+ A.b().c().d().e().foo();
+//~^ ERROR no method named `foo` found for struct `E` in the current scope
+}
diff --git a/tests/ui/structs/method-chain-expression-failure.stderr b/tests/ui/structs/method-chain-expression-failure.stderr
new file mode 100644
index 000000000..ba635ab1f
--- /dev/null
+++ b/tests/ui/structs/method-chain-expression-failure.stderr
@@ -0,0 +1,15 @@
+error[E0599]: no method named `foo` found for struct `E` in the current scope
+ --> $DIR/method-chain-expression-failure.rs:29:23
+ |
+LL | struct E;
+ | -------- method `foo` not found for this struct
+...
+LL | A.b().c().d().e().foo();
+ | - --- ^^^ method not found in `E`
+ | | |
+ | | method `foo` is available on `&C`
+ | method `foo` is available on `&A`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/structs/struct-path-associated-type.stderr b/tests/ui/structs/struct-path-associated-type.stderr
index acfddaf37..0c9d2aad5 100644
--- a/tests/ui/structs/struct-path-associated-type.stderr
+++ b/tests/ui/structs/struct-path-associated-type.stderr
@@ -48,19 +48,19 @@ error[E0223]: ambiguous associated type
--> $DIR/struct-path-associated-type.rs:32:13
|
LL | let s = S::A {};
- | ^^^^ help: use the fully-qualified path: `<S as Tr>::A`
+ | ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
error[E0223]: ambiguous associated type
--> $DIR/struct-path-associated-type.rs:33:13
|
LL | let z = S::A::<u8> {};
- | ^^^^ help: use the fully-qualified path: `<S as Tr>::A`
+ | ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
error[E0223]: ambiguous associated type
--> $DIR/struct-path-associated-type.rs:35:9
|
LL | S::A {} => {}
- | ^^^^ help: use the fully-qualified path: `<S as Tr>::A`
+ | ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
error: aborting due to 8 previous errors
diff --git a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
index 128160f10..2dd6fb6a3 100644
--- a/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
+++ b/tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
@@ -18,7 +18,10 @@ error[E0599]: no method named `sort` found for unit type `()` in the current sco
--> $DIR/chain-method-call-mutation-in-place.rs:3:72
|
LL | vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i).sort();
- | ^^^^ method not found in `()`
+ | ------------- --------------------- ^^^^ method not found in `()`
+ | | |
+ | | method `sort` is available on `&mut [i32]`
+ | method `sort` is available on `Vec<i32>`
|
note: method `sort_by_key` modifies its receiver in-place, it is not meant to be used in method chains.
--> $DIR/chain-method-call-mutation-in-place.rs:3:53
diff --git a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
index 0716005c6..8c973995c 100644
--- a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
+++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | fn wat<T>(t: &T) -> T {
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
LL | t.clone()
| ^^^^^^^^^ expected type parameter `T`, found `&T`
|
diff --git a/tests/ui/suggestions/deref-path-method.stderr b/tests/ui/suggestions/deref-path-method.stderr
index 1cc37d611..0372a7e6c 100644
--- a/tests/ui/suggestions/deref-path-method.stderr
+++ b/tests/ui/suggestions/deref-path-method.stderr
@@ -4,6 +4,13 @@ error[E0599]: no function or associated item named `contains` found for struct `
LL | Vec::contains(&vec, &0);
| ^^^^^^^^ function or associated item not found in `Vec<_, _>`
|
+note: if you're trying to build a new `Vec<_, _>` consider using one of the following associated functions:
+ Vec::<T>::new
+ Vec::<T>::with_capacity
+ Vec::<T>::from_raw_parts
+ Vec::<T, A>::new_in
+ and 2 others
+ --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
help: the function `contains` is implemented on `[_]`
|
LL | <[_]>::contains(&vec, &0);
diff --git a/tests/ui/suggestions/dont-suggest-ref/simple.stderr b/tests/ui/suggestions/dont-suggest-ref/simple.stderr
index 526326524..7d902dbcc 100644
--- a/tests/ui/suggestions/dont-suggest-ref/simple.stderr
+++ b/tests/ui/suggestions/dont-suggest-ref/simple.stderr
@@ -43,7 +43,7 @@ LL - while let Either::One(_t) = *r { }
LL + while let Either::One(_t) = r { }
|
-error[E0507]: cannot move out of `r` as enum variant `Two` which is behind a shared reference
+error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
--> $DIR/simple.rs:47:11
|
LL | match *r {
@@ -124,7 +124,7 @@ LL - while let Either::One(_t) = *rm { }
LL + while let Either::One(_t) = rm { }
|
-error[E0507]: cannot move out of `rm` as enum variant `Two` which is behind a mutable reference
+error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
--> $DIR/simple.rs:70:11
|
LL | match *rm {
@@ -392,7 +392,7 @@ LL - while let &Either::One(_t) = r { }
LL + while let Either::One(_t) = r { }
|
-error[E0507]: cannot move out of `r` as enum variant `Two` which is behind a shared reference
+error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference
--> $DIR/simple.rs:155:11
|
LL | match r {
@@ -491,7 +491,7 @@ LL - while let &mut Either::One(_t) = rm { }
LL + while let Either::One(_t) = rm { }
|
-error[E0507]: cannot move out of `rm` as enum variant `Two` which is behind a mutable reference
+error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
--> $DIR/simple.rs:187:11
|
LL | match rm {
diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
index 5093448d2..7c81825e5 100644
--- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
+++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/expected-boxed-future-isnt-pinned.rs:11:5
|
LL | fn foo<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
- | - this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
+ | - found this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
LL | // We could instead use an `async` block, but this way we have no std spans.
LL | x
| ^ expected `Pin<Box<...>>`, found type parameter `F`
@@ -30,7 +30,7 @@ error[E0308]: mismatched types
--> $DIR/expected-boxed-future-isnt-pinned.rs:19:14
|
LL | fn baz<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
- | - this type parameter
+ | - found this type parameter
LL | Pin::new(x)
| -------- ^ expected `Box<dyn Future<Output = ...> + Send>`, found type parameter `F`
| |
diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr
index b476d6101..2c29cfa0b 100644
--- a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr
+++ b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr
@@ -26,9 +26,9 @@ error: lifetime may not live long enough
--> $DIR/impl-trait-missing-lifetime.rs:16:69
|
LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
- | -------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
- | |
- | return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
+ | ----------------------------------------------------------------- ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
+ | |
+ | return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/issue-101623.stderr b/tests/ui/suggestions/issue-101623.stderr
index 361483cc0..9f00de174 100644
--- a/tests/ui/suggestions/issue-101623.stderr
+++ b/tests/ui/suggestions/issue-101623.stderr
@@ -7,7 +7,8 @@ LL | Trait::do_stuff({ fun(&mut *inner) });
| | the trait `Trait<'_>` is not implemented for `*mut ()`
| required by a bound introduced by this call
|
- = help: the trait `Trait<'a>` is implemented for `()`
+ = help: the trait `Trait<'_>` is implemented for `()`
+ = help: for that trait implementation, expected `()`, found `*mut ()`
error: aborting due to previous error
diff --git a/tests/ui/suggestions/issue-102972.fixed b/tests/ui/suggestions/issue-102972.fixed
new file mode 100644
index 000000000..ebd73b2dc
--- /dev/null
+++ b/tests/ui/suggestions/issue-102972.fixed
@@ -0,0 +1,41 @@
+// run-rustfix
+
+fn test1() {
+ let mut chars = "Hello".chars();
+ let iter = chars.by_ref();
+ while let Some(_c) = iter.next() {
+ iter.next(); //~ ERROR cannot borrow `chars` as mutable more than once at a time
+ }
+}
+
+fn test2() {
+ let v = vec![1, 2, 3];
+ let mut iter = v.iter();
+ while let Some(_i) = iter.next() {
+ iter.next(); //~ ERROR borrow of moved value: `iter`
+ }
+}
+
+fn test3() {
+ let v = vec![(), (), ()];
+ let mut i = v.iter();
+ let iter = i.by_ref();
+ while let Some(()) = iter.next() {
+ iter.next(); //~ ERROR cannot borrow `i`
+ }
+}
+
+fn test4() {
+ let v = vec![(), (), ()];
+ let mut iter = v.iter();
+ while let Some(()) = iter.next() {
+ iter.next(); //~ ERROR borrow of moved value: `iter`
+ }
+}
+
+fn main() {
+ test1();
+ test2();
+ test3();
+ test4();
+}
diff --git a/tests/ui/suggestions/issue-102972.rs b/tests/ui/suggestions/issue-102972.rs
index 106288b05..1f8e97767 100644
--- a/tests/ui/suggestions/issue-102972.rs
+++ b/tests/ui/suggestions/issue-102972.rs
@@ -1,3 +1,5 @@
+// run-rustfix
+
fn test1() {
let mut chars = "Hello".chars();
for _c in chars.by_ref() {
@@ -13,4 +15,25 @@ fn test2() {
}
}
-fn main() { }
+fn test3() {
+ let v = vec![(), (), ()];
+ let mut i = v.iter();
+ for () in i.by_ref() {
+ i.next(); //~ ERROR cannot borrow `i`
+ }
+}
+
+fn test4() {
+ let v = vec![(), (), ()];
+ let mut iter = v.iter();
+ for () in iter {
+ iter.next(); //~ ERROR borrow of moved value: `iter`
+ }
+}
+
+fn main() {
+ test1();
+ test2();
+ test3();
+ test4();
+}
diff --git a/tests/ui/suggestions/issue-102972.stderr b/tests/ui/suggestions/issue-102972.stderr
index 3303d6bbc..4b0d3b96f 100644
--- a/tests/ui/suggestions/issue-102972.stderr
+++ b/tests/ui/suggestions/issue-102972.stderr
@@ -1,5 +1,5 @@
error[E0499]: cannot borrow `chars` as mutable more than once at a time
- --> $DIR/issue-102972.rs:4:9
+ --> $DIR/issue-102972.rs:6:9
|
LL | for _c in chars.by_ref() {
| --------------
@@ -8,9 +8,17 @@ LL | for _c in chars.by_ref() {
| first borrow later used here
LL | chars.next();
| ^^^^^ second mutable borrow occurs here
+ |
+ = note: a for loop advances the iterator for you, the result is stored in `_c`
+help: if you want to call `next` on a iterator within the loop, consider using `while let`
+ |
+LL ~ let iter = chars.by_ref();
+LL ~ while let Some(_c) = iter.next() {
+LL ~ iter.next();
+ |
error[E0382]: borrow of moved value: `iter`
- --> $DIR/issue-102972.rs:12:9
+ --> $DIR/issue-102972.rs:14:9
|
LL | let mut iter = v.iter();
| -------- move occurs because `iter` has type `std::slice::Iter<'_, i32>`, which does not implement the `Copy` trait
@@ -19,10 +27,52 @@ LL | for _i in iter {
LL | iter.next();
| ^^^^ value borrowed here after move
|
+ = note: a for loop advances the iterator for you, the result is stored in `_i`
note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+help: if you want to call `next` on a iterator within the loop, consider using `while let`
+ |
+LL | while let Some(_i) = iter.next() {
+ | ~~~~~~~~~~~~~~~ ~~~ +++++++
+
+error[E0499]: cannot borrow `i` as mutable more than once at a time
+ --> $DIR/issue-102972.rs:22:9
+ |
+LL | for () in i.by_ref() {
+ | ----------
+ | |
+ | first mutable borrow occurs here
+ | first borrow later used here
+LL | i.next();
+ | ^ second mutable borrow occurs here
+ |
+ = note: a for loop advances the iterator for you, the result is stored in its pattern
+help: if you want to call `next` on a iterator within the loop, consider using `while let`
+ |
+LL ~ let iter = i.by_ref();
+LL ~ while let Some(()) = iter.next() {
+LL ~ iter.next();
+ |
+
+error[E0382]: borrow of moved value: `iter`
+ --> $DIR/issue-102972.rs:30:9
+ |
+LL | let mut iter = v.iter();
+ | -------- move occurs because `iter` has type `std::slice::Iter<'_, ()>`, which does not implement the `Copy` trait
+LL | for () in iter {
+ | ---- `iter` moved due to this implicit call to `.into_iter()`
+LL | iter.next();
+ | ^^^^ value borrowed here after move
+ |
+ = note: a for loop advances the iterator for you, the result is stored in its pattern
+note: `into_iter` takes ownership of the receiver `self`, which moves `iter`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+help: if you want to call `next` on a iterator within the loop, consider using `while let`
+ |
+LL | while let Some(()) = iter.next() {
+ | ~~~~~~~~~~~~~~~ ~~~ +++++++
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
Some errors have detailed explanations: E0382, E0499.
For more information about an error, try `rustc --explain E0382`.
diff --git a/tests/ui/suggestions/issue-104961.fixed b/tests/ui/suggestions/issue-104961.fixed
index 520d638b1..36917cf33 100644
--- a/tests/ui/suggestions/issue-104961.fixed
+++ b/tests/ui/suggestions/issue-104961.fixed
@@ -2,12 +2,12 @@
fn foo(x: &str) -> bool {
x.starts_with(&("hi".to_string() + " you"))
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `String`
+ //~^ ERROR expected a `FnMut(char)` closure, found `String`
}
fn foo2(x: &str) -> bool {
x.starts_with(&"hi".to_string())
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `String`
+ //~^ ERROR expected a `FnMut(char)` closure, found `String`
}
fn main() {
diff --git a/tests/ui/suggestions/issue-104961.rs b/tests/ui/suggestions/issue-104961.rs
index aeb787abb..25a8e0c45 100644
--- a/tests/ui/suggestions/issue-104961.rs
+++ b/tests/ui/suggestions/issue-104961.rs
@@ -2,12 +2,12 @@
fn foo(x: &str) -> bool {
x.starts_with("hi".to_string() + " you")
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `String`
+ //~^ ERROR expected a `FnMut(char)` closure, found `String`
}
fn foo2(x: &str) -> bool {
x.starts_with("hi".to_string())
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `String`
+ //~^ ERROR expected a `FnMut(char)` closure, found `String`
}
fn main() {
diff --git a/tests/ui/suggestions/issue-104961.stderr b/tests/ui/suggestions/issue-104961.stderr
index 8cec6a3f8..7e795a74c 100644
--- a/tests/ui/suggestions/issue-104961.stderr
+++ b/tests/ui/suggestions/issue-104961.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `FnMut<(char,)>` closure, found `String`
+error[E0277]: expected a `FnMut(char)` closure, found `String`
--> $DIR/issue-104961.rs:4:19
|
LL | x.starts_with("hi".to_string() + " you")
@@ -15,7 +15,7 @@ help: consider borrowing here
LL | x.starts_with(&("hi".to_string() + " you"))
| ++ +
-error[E0277]: expected a `FnMut<(char,)>` closure, found `String`
+error[E0277]: expected a `FnMut(char)` closure, found `String`
--> $DIR/issue-104961.rs:9:19
|
LL | x.starts_with("hi".to_string())
diff --git a/tests/ui/suggestions/issue-109291.stderr b/tests/ui/suggestions/issue-109291.stderr
index 4ef5948d9..644841fdf 100644
--- a/tests/ui/suggestions/issue-109291.stderr
+++ b/tests/ui/suggestions/issue-109291.stderr
@@ -6,6 +6,13 @@ LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capt
| |
| function or associated item not found in `Backtrace`
| help: there is an associated function with a similar name: `force_capture`
+ |
+note: if you're trying to build a new `Backtrace` consider using one of the following associated functions:
+ Backtrace::capture
+ Backtrace::force_capture
+ Backtrace::disabled
+ Backtrace::create
+ --> $SRC_DIR/std/src/backtrace.rs:LL:COL
error: aborting due to previous error
diff --git a/tests/ui/suggestions/issue-61963.stderr b/tests/ui/suggestions/issue-61963.stderr
index b99b1b0b9..ec62153b0 100644
--- a/tests/ui/suggestions/issue-61963.stderr
+++ b/tests/ui/suggestions/issue-61963.stderr
@@ -37,6 +37,7 @@ LL | bar: Box<Bar>,
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | bar: Box<dyn Bar>,
@@ -50,6 +51,7 @@ LL | bar: Box<Bar>,
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | bar: Box<dyn Bar>,
@@ -63,6 +65,7 @@ LL | pub struct Foo {
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | dyn pub struct Foo {
@@ -76,6 +79,7 @@ LL | pub struct Foo {
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | dyn pub struct Foo {
@@ -89,6 +93,7 @@ LL | pub struct Foo {
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: use `dyn`
|
LL | dyn pub struct Foo {
diff --git a/tests/ui/suggestions/issue-62843.stderr b/tests/ui/suggestions/issue-62843.stderr
index b6e271de8..ead8f1854 100644
--- a/tests/ui/suggestions/issue-62843.stderr
+++ b/tests/ui/suggestions/issue-62843.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `FnMut<(char,)>` closure, found `String`
+error[E0277]: expected a `FnMut(char)` closure, found `String`
--> $DIR/issue-62843.rs:4:32
|
LL | println!("{:?}", line.find(pattern));
diff --git a/tests/ui/suggestions/issue-81839.stderr b/tests/ui/suggestions/issue-81839.stderr
index 6d0a0c7b3..238ee637c 100644
--- a/tests/ui/suggestions/issue-81839.stderr
+++ b/tests/ui/suggestions/issue-81839.stderr
@@ -4,15 +4,22 @@ error[E0308]: `match` arms have incompatible types
LL | / match num {
LL | | 1 => {
LL | | cx.answer_str("hi");
- | | --------------------
- | | | |
- | | | help: consider removing this semicolon
- | | this is found to be of type `()`
+ | | -------------------- this is found to be of type `()`
LL | | }
LL | | _ => cx.answer_str("hi"),
| | ^^^^^^^^^^^^^^^^^^^ expected `()`, found future
LL | | }
| |_____- `match` arms have incompatible types
+ |
+help: consider removing this semicolon
+ |
+LL - cx.answer_str("hi");
+LL + cx.answer_str("hi")
+ |
+help: consider using a semicolon here, but this will discard any values in the match arms
+ |
+LL | };
+ | +
error: aborting due to previous error
diff --git a/tests/ui/suggestions/issue-83892.stderr b/tests/ui/suggestions/issue-83892.stderr
index baf6b1447..5e471819b 100644
--- a/tests/ui/suggestions/issue-83892.stderr
+++ b/tests/ui/suggestions/issue-83892.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-83892.rs:9:15
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | match () {
LL | () => func()
| ^^^^^^ expected `()`, found `u8`
diff --git a/tests/ui/suggestions/issue-84973-blacklist.rs b/tests/ui/suggestions/issue-84973-blacklist.rs
index 6813b07a2..6a35d779c 100644
--- a/tests/ui/suggestions/issue-84973-blacklist.rs
+++ b/tests/ui/suggestions/issue-84973-blacklist.rs
@@ -1,7 +1,7 @@
// Checks that certain traits for which we don't want to suggest borrowing
// are blacklisted and don't cause the suggestion to be issued.
-#![feature(generators)]
+#![feature(coroutines)]
fn f_copy<T: Copy>(t: T) {}
fn f_clone<T: Clone>(t: T) {}
diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr
index c8ce146ce..e0bdb6949 100644
--- a/tests/ui/suggestions/issue-84973-blacklist.stderr
+++ b/tests/ui/suggestions/issue-84973-blacklist.stderr
@@ -31,11 +31,11 @@ LL + #[derive(Clone)]
LL | struct S;
|
-error[E0277]: `{static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22}` cannot be unpinned
+error[E0277]: `{static coroutine@$DIR/issue-84973-blacklist.rs:17:13: 17:22}` cannot be unpinned
--> $DIR/issue-84973-blacklist.rs:17:13
|
LL | f_unpin(static || { yield; });
- | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22}`
+ | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/issue-84973-blacklist.rs:17:13: 17:22}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/suggestions/lifetimes/issue-105544.fixed b/tests/ui/suggestions/lifetimes/issue-105544.fixed
index 47087eb47..c92114e18 100644
--- a/tests/ui/suggestions/lifetimes/issue-105544.fixed
+++ b/tests/ui/suggestions/lifetimes/issue-105544.fixed
@@ -2,7 +2,7 @@
#![allow(warnings)]
-fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
+fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + 'a { //~ NOTE the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
//~^ HELP consider adding an explicit lifetime bound
(d, p)
//~^ ERROR the parameter type `impl Sized` may not live long enough
@@ -10,19 +10,20 @@ fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the
}
fn foo1<'b>(d: impl Sized + 'b, p: &'b mut ()) -> impl Sized + '_ {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ NOTE the parameter type `impl Sized` must be valid for the lifetime `'b` as defined here...
+//~| HELP consider adding an explicit lifetime bound
(d, p) //~ NOTE ...so that the type `impl Sized` will meet its required lifetime bounds
//~^ ERROR the parameter type `impl Sized` may not live long enough
}
-fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
+fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + 'b { //~ NOTE the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
//~^ HELP consider adding an explicit lifetime bound
(d, p)
//~^ ERROR the parameter type `impl Sized + 'a` may not live long enough
//~| NOTE ...so that the type `impl Sized + 'a` will meet its required lifetime bounds
}
-fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
+fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + 'a { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
//~^ HELP consider adding an explicit lifetime bound
(d, p)
//~^ ERROR the parameter type `T` may not live long enough
@@ -30,12 +31,13 @@ fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE th
}
fn bar1<'b, T : Sized + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ NOTE the parameter type `T` must be valid for the lifetime `'b` as defined here...
+//~| HELP consider adding an explicit lifetime bound
(d, p) //~ NOTE ...so that the type `T` will meet its required lifetime bounds
//~^ ERROR the parameter type `T` may not live long enough
}
-fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
+fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + 'b { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
//~^ HELP consider adding an explicit lifetime bound
(d, p)
//~^ ERROR the parameter type `T` may not live long enough
diff --git a/tests/ui/suggestions/lifetimes/issue-105544.rs b/tests/ui/suggestions/lifetimes/issue-105544.rs
index bd3bc1ef9..bbd0f097f 100644
--- a/tests/ui/suggestions/lifetimes/issue-105544.rs
+++ b/tests/ui/suggestions/lifetimes/issue-105544.rs
@@ -10,7 +10,8 @@ fn foo(d: impl Sized, p: &mut ()) -> impl Sized + '_ { //~ NOTE the parameter ty
}
fn foo1<'b>(d: impl Sized, p: &'b mut ()) -> impl Sized + '_ {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ NOTE the parameter type `impl Sized` must be valid for the lifetime `'b` as defined here...
+//~| HELP consider adding an explicit lifetime bound
(d, p) //~ NOTE ...so that the type `impl Sized` will meet its required lifetime bounds
//~^ ERROR the parameter type `impl Sized` may not live long enough
}
@@ -30,7 +31,8 @@ fn bar<T : Sized>(d: T, p: & mut ()) -> impl Sized + '_ { //~ NOTE the parameter
}
fn bar1<'b, T : Sized>(d: T, p: &'b mut ()) -> impl Sized + '_ {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ NOTE the parameter type `T` must be valid for the lifetime `'b` as defined here...
+//~| HELP consider adding an explicit lifetime bound
(d, p) //~ NOTE ...so that the type `T` will meet its required lifetime bounds
//~^ ERROR the parameter type `T` may not live long enough
}
diff --git a/tests/ui/suggestions/lifetimes/issue-105544.stderr b/tests/ui/suggestions/lifetimes/issue-105544.stderr
index 08fe21b11..553643c0c 100644
--- a/tests/ui/suggestions/lifetimes/issue-105544.stderr
+++ b/tests/ui/suggestions/lifetimes/issue-105544.stderr
@@ -1,108 +1,86 @@
error[E0311]: the parameter type `impl Sized` may not live long enough
--> $DIR/issue-105544.rs:7:5
|
-LL | (d, p)
- | ^^^^^^
- |
-note: the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
- --> $DIR/issue-105544.rs:5:26
- |
LL | fn foo(d: impl Sized, p: &mut ()) -> impl Sized + '_ {
- | ^^^^^^^
-note: ...so that the type `impl Sized` will meet its required lifetime bounds
- --> $DIR/issue-105544.rs:7:5
- |
+ | ------- the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
+LL |
LL | (d, p)
- | ^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^ ...so that the type `impl Sized` will meet its required lifetime bounds
|
-LL | fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ {
- | ++++ ++++ ++
+help: consider adding an explicit lifetime bound
+ |
+LL | fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + 'a {
+ | ++++ ++++ ++ ~~
error[E0309]: the parameter type `impl Sized` may not live long enough
- --> $DIR/issue-105544.rs:14:5
+ --> $DIR/issue-105544.rs:15:5
|
+LL | fn foo1<'b>(d: impl Sized, p: &'b mut ()) -> impl Sized + '_ {
+ | -- the parameter type `impl Sized` must be valid for the lifetime `'b` as defined here...
+...
LL | (d, p)
| ^^^^^^ ...so that the type `impl Sized` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn foo1<'b>(d: impl Sized + 'b, p: &'b mut ()) -> impl Sized + '_ {
| ++++
error[E0311]: the parameter type `impl Sized + 'a` may not live long enough
- --> $DIR/issue-105544.rs:20:5
- |
-LL | (d, p)
- | ^^^^^^
- |
-note: the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
- --> $DIR/issue-105544.rs:18:36
+ --> $DIR/issue-105544.rs:21:5
|
LL | fn foo2<'a>(d: impl Sized + 'a, p: &mut ()) -> impl Sized + '_ {
- | ^^^^^^^
-note: ...so that the type `impl Sized + 'a` will meet its required lifetime bounds
- --> $DIR/issue-105544.rs:20:5
- |
+ | ------- the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
+LL |
LL | (d, p)
- | ^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^ ...so that the type `impl Sized + 'a` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + '_ {
- | +++ ++++ ++
+LL | fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + 'b {
+ | +++ ++++ ++ ~~
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/issue-105544.rs:27:5
- |
-LL | (d, p)
- | ^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/issue-105544.rs:25:28
+ --> $DIR/issue-105544.rs:28:5
|
LL | fn bar<T : Sized>(d: T, p: & mut ()) -> impl Sized + '_ {
- | ^^^^^^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/issue-105544.rs:27:5
- |
+ | -------- the parameter type `T` must be valid for the anonymous lifetime defined here...
+LL |
LL | (d, p)
- | ^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ {
- | +++ ++++ ++
+LL | fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + 'a {
+ | +++ ++++ ++ ~~
error[E0309]: the parameter type `T` may not live long enough
- --> $DIR/issue-105544.rs:34:5
+ --> $DIR/issue-105544.rs:36:5
|
+LL | fn bar1<'b, T : Sized>(d: T, p: &'b mut ()) -> impl Sized + '_ {
+ | -- the parameter type `T` must be valid for the lifetime `'b` as defined here...
+...
LL | (d, p)
| ^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn bar1<'b, T : Sized + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ {
| ++++
error[E0311]: the parameter type `T` may not live long enough
- --> $DIR/issue-105544.rs:40:5
- |
-LL | (d, p)
- | ^^^^^^
- |
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/issue-105544.rs:38:38
+ --> $DIR/issue-105544.rs:42:5
|
LL | fn bar2<'a, T : Sized + 'a>(d: T, p: &mut ()) -> impl Sized + '_ {
- | ^^^^^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/issue-105544.rs:40:5
- |
+ | ------- the parameter type `T` must be valid for the anonymous lifetime defined here...
+LL |
LL | (d, p)
- | ^^^^^^
-help: consider adding an explicit lifetime bound...
+ | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
|
-LL | fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ {
- | +++ ++++ ++
+LL | fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + 'b {
+ | +++ ++++ ++ ~~
error: aborting due to 6 previous errors
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed
index 4013d98c3..474986283 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed
@@ -19,11 +19,16 @@ trait Test {
fn test(&self);
}
-fn func<'a, T: Test + 'a>(foo: &'a Foo<'a>, t: T) {
+fn func<'a, T: Test + 'a>(_dummy: &Foo, foo: &Foo<'a>, t: T) {
foo.bar(move |_| {
//~^ ERROR the parameter type `T` may not live long enough
t.test();
});
}
+// Test that the suggested fix does not overconstrain `func`. See #115375.
+fn test_func<'a, T: Test + 'a>(dummy: &Foo, foo: &Foo<'a>, t: T) {
+ func(dummy, foo, t);
+}
+
fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs
index 4096d95e5..99c8e9626 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.rs
@@ -19,11 +19,16 @@ trait Test {
fn test(&self);
}
-fn func<T: Test>(foo: &Foo, t: T) {
+fn func<T: Test>(_dummy: &Foo, foo: &Foo, t: T) {
foo.bar(move |_| {
//~^ ERROR the parameter type `T` may not live long enough
t.test();
});
}
+// Test that the suggested fix does not overconstrain `func`. See #115375.
+fn test_func<'a, T: Test + 'a>(dummy: &Foo, foo: &Foo<'a>, t: T) {
+ func(dummy, foo, t);
+}
+
fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr
index 936d87f79..6c63e1ada 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr
@@ -1,29 +1,18 @@
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/missing-lifetimes-in-signature-2.rs:23:5
|
+LL | fn func<T: Test>(_dummy: &Foo, foo: &Foo, t: T) {
+ | --- the parameter type `T` must be valid for the anonymous lifetime defined here...
LL | / foo.bar(move |_| {
LL | |
LL | | t.test();
LL | | });
- | |______^
+ | |______^ ...so that the type `T` will meet its required lifetime bounds
|
-note: the parameter type `T` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature-2.rs:22:24
+help: consider adding an explicit lifetime bound
|
-LL | fn func<T: Test>(foo: &Foo, t: T) {
- | ^^^
-note: ...so that the type `T` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature-2.rs:23:5
- |
-LL | / foo.bar(move |_| {
-LL | |
-LL | | t.test();
-LL | | });
- | |______^
-help: consider adding an explicit lifetime bound...
- |
-LL | fn func<'a, T: Test + 'a>(foo: &'a Foo<'a>, t: T) {
- | +++ ++++ ++ ++++
+LL | fn func<'a, T: Test + 'a>(_dummy: &Foo, foo: &Foo<'a>, t: T) {
+ | +++ ++++ ++++
error: aborting due to previous error
diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
index 318ea4083..64af17c83 100644
--- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
+++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr
@@ -28,28 +28,18 @@ LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
error[E0311]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:30:5
|
+LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
+ | ------ the parameter type `G` must be valid for the anonymous lifetime defined here...
+...
LL | / move || {
LL | |
LL | | *dest = g.get();
LL | | }
- | |_____^
- |
-note: the parameter type `G` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature.rs:26:26
- |
-LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
- | ^^^^^^
-note: ...so that the type `G` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature.rs:30:5
+ | |_____^ ...so that the type `G` will meet its required lifetime bounds
|
-LL | / move || {
-LL | |
-LL | | *dest = g.get();
-LL | | }
- | |_____^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL ~ fn bar<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + '_
+LL ~ fn bar<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a
LL | where
LL ~ G: Get<T> + 'a,
|
@@ -57,85 +47,53 @@ LL ~ G: Get<T> + 'a,
error[E0311]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:52:5
|
+LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
+ | ------ the parameter type `G` must be valid for the anonymous lifetime defined here...
+...
LL | / move || {
LL | |
LL | | *dest = g.get();
LL | | }
- | |_____^
- |
-note: the parameter type `G` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature.rs:48:34
- |
-LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
- | ^^^^^^
-note: ...so that the type `G` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature.rs:52:5
+ | |_____^ ...so that the type `G` will meet its required lifetime bounds
|
-LL | / move || {
-LL | |
-LL | | *dest = g.get();
-LL | | }
- | |_____^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + '_
- | +++ ++++ ++
+LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b
+ | +++ ++++ ++ ~~
error[E0311]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:61:9
|
+LL | fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
+ | ------ the parameter type `G` must be valid for the anonymous lifetime defined here...
LL | / move || {
LL | |
LL | | *dest = g.get();
LL | | }
- | |_________^
+ | |_________^ ...so that the type `G` will meet its required lifetime bounds
|
-note: the parameter type `G` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature.rs:60:47
+help: consider adding an explicit lifetime bound
|
-LL | fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
- | ^^^^^^
-note: ...so that the type `G` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature.rs:61:9
- |
-LL | / move || {
-LL | |
-LL | | *dest = g.get();
-LL | | }
- | |_________^
-help: consider adding an explicit lifetime bound...
- |
-LL | fn qux<'c, 'b, G: Get<T> + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl FnOnce() + '_ {
- | +++ ++++ ++
+LL | fn qux<'c, 'b, G: Get<T> + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl FnOnce() + 'c {
+ | +++ ++++ ++ ~~
error[E0311]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:73:5
|
+LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
+ | ------ the parameter type `G` must be valid for the anonymous lifetime defined here...
+...
LL | / move || {
LL | |
LL | |
LL | | *dest = g.get();
LL | | }
- | |_____^
- |
-note: the parameter type `G` must be valid for the anonymous lifetime defined here...
- --> $DIR/missing-lifetimes-in-signature.rs:69:34
- |
-LL | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
- | ^^^^^^
-note: ...so that the type `G` will meet its required lifetime bounds
- --> $DIR/missing-lifetimes-in-signature.rs:73:5
+ | |_____^ ...so that the type `G` will meet its required lifetime bounds
|
-LL | / move || {
-LL | |
-LL | |
-LL | | *dest = g.get();
-LL | | }
- | |_____^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
-LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + '_ + 'a
- | +++ ++++ ++
+LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b + 'a
+ | +++ ++++ ++ ~~
error[E0621]: explicit lifetime required in the type of `dest`
--> $DIR/missing-lifetimes-in-signature.rs:73:5
@@ -153,13 +111,16 @@ LL | | }
error[E0309]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:85:5
|
+LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a
+ | -- the parameter type `G` must be valid for the lifetime `'a` as defined here...
+...
LL | / move || {
LL | |
LL | | *dest = g.get();
LL | | }
| |_____^ ...so that the type `G` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | G: Get<T> + 'a,
| ++++
diff --git a/tests/ui/suggestions/lifetimes/type-param-bound-scope.fixed b/tests/ui/suggestions/lifetimes/type-param-bound-scope.fixed
new file mode 100644
index 000000000..470cc67b9
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-bound-scope.fixed
@@ -0,0 +1,47 @@
+// Make sure we suggest the bound `T: 'a` in the correct scope:
+// trait, impl or associated fn.
+// run-rustfix
+
+struct Inv<'a>(Option<*mut &'a u8>);
+
+fn check_bound<'a, A: 'a>(_: A, _: Inv<'a>) {}
+
+trait Trait1<'a>: Sized where Self: 'a {
+ fn foo(self, lt: Inv<'a>) {
+ check_bound(self, lt)
+ //~^ ERROR parameter type `Self` may not live long enough
+ }
+}
+
+trait Trait2: Sized {
+ fn foo<'a>(self, lt: Inv<'a>) where Self: 'a {
+ check_bound(self, lt)
+ //~^ ERROR parameter type `Self` may not live long enough
+ }
+}
+
+trait Trait3<T> {
+ fn foo<'a>(arg: T, lt: Inv<'a>) where T: 'a {
+ check_bound(arg, lt)
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+trait Trait4<'a> {
+ fn foo<T: 'a>(arg: T, lt: Inv<'a>) {
+ check_bound(arg, lt)
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+trait Trait5<'a> {
+ fn foo(self, _: Inv<'a>);
+}
+impl<'a, T: 'a> Trait5<'a> for T {
+ fn foo(self, lt: Inv<'a>) {
+ check_bound(self, lt);
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/type-param-bound-scope.rs b/tests/ui/suggestions/lifetimes/type-param-bound-scope.rs
new file mode 100644
index 000000000..874788e13
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-bound-scope.rs
@@ -0,0 +1,47 @@
+// Make sure we suggest the bound `T: 'a` in the correct scope:
+// trait, impl or associated fn.
+// run-rustfix
+
+struct Inv<'a>(Option<*mut &'a u8>);
+
+fn check_bound<'a, A: 'a>(_: A, _: Inv<'a>) {}
+
+trait Trait1<'a>: Sized {
+ fn foo(self, lt: Inv<'a>) {
+ check_bound(self, lt)
+ //~^ ERROR parameter type `Self` may not live long enough
+ }
+}
+
+trait Trait2: Sized {
+ fn foo<'a>(self, lt: Inv<'a>) {
+ check_bound(self, lt)
+ //~^ ERROR parameter type `Self` may not live long enough
+ }
+}
+
+trait Trait3<T> {
+ fn foo<'a>(arg: T, lt: Inv<'a>) {
+ check_bound(arg, lt)
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+trait Trait4<'a> {
+ fn foo<T>(arg: T, lt: Inv<'a>) {
+ check_bound(arg, lt)
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+trait Trait5<'a> {
+ fn foo(self, _: Inv<'a>);
+}
+impl<'a, T> Trait5<'a> for T {
+ fn foo(self, lt: Inv<'a>) {
+ check_bound(self, lt);
+ //~^ ERROR parameter type `T` may not live long enough
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/type-param-bound-scope.stderr b/tests/ui/suggestions/lifetimes/type-param-bound-scope.stderr
new file mode 100644
index 000000000..d3ca2cc11
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-bound-scope.stderr
@@ -0,0 +1,71 @@
+error[E0309]: the parameter type `Self` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:11:9
+ |
+LL | trait Trait1<'a>: Sized {
+ | -- the parameter type `Self` must be valid for the lifetime `'a` as defined here...
+LL | fn foo(self, lt: Inv<'a>) {
+LL | check_bound(self, lt)
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `Self` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | trait Trait1<'a>: Sized where Self: 'a {
+ | ++++++++++++++
+
+error[E0309]: the parameter type `Self` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:18:9
+ |
+LL | fn foo<'a>(self, lt: Inv<'a>) {
+ | -- the parameter type `Self` must be valid for the lifetime `'a` as defined here...
+LL | check_bound(self, lt)
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `Self` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | fn foo<'a>(self, lt: Inv<'a>) where Self: 'a {
+ | ++++++++++++++
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:25:9
+ |
+LL | fn foo<'a>(arg: T, lt: Inv<'a>) {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+LL | check_bound(arg, lt)
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | fn foo<'a>(arg: T, lt: Inv<'a>) where T: 'a {
+ | +++++++++++
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:32:9
+ |
+LL | trait Trait4<'a> {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+LL | fn foo<T>(arg: T, lt: Inv<'a>) {
+LL | check_bound(arg, lt)
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | fn foo<T: 'a>(arg: T, lt: Inv<'a>) {
+ | ++++
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/type-param-bound-scope.rs:42:9
+ |
+LL | impl<'a, T> Trait5<'a> for T {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
+LL | fn foo(self, lt: Inv<'a>) {
+LL | check_bound(self, lt);
+ | ^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | impl<'a, T: 'a> Trait5<'a> for T {
+ | ++++
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.fixed b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.fixed
new file mode 100644
index 000000000..e30c55645
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.fixed
@@ -0,0 +1,52 @@
+// We want to suggest a bound `T: 'a` but `'a` is elided,
+// run-rustfix
+// edition: 2018
+#![allow(dead_code)]
+
+struct Inv<'a>(Option<*mut &'a u8>);
+
+fn check_bound<'a, A: 'a>(_: A, _: Inv<'a>) {}
+
+struct Elided<'a, T = ()>(Inv<'a>, T);
+
+struct MyTy<X>(X);
+
+impl<'a, X> MyTy<Elided<'a, X>> {
+ async fn foo<A: 'a>(self, arg: A, _: &str) -> &str {
+ check_bound(arg, self.0 .0);
+ //~^ ERROR parameter type `A` may not live long enough
+ ""
+ }
+}
+
+// Make sure the new lifetime name doesn't conflict with
+// other early- or late-bound lifetimes in-scope.
+impl<'a, A> MyTy<(A, &'a ())> {
+ async fn foo2<'b>(
+ arg: A,
+ lt: Inv<'b>,
+ ) -> (
+ impl Into<&'b str> + Into<&'b str> + 'b,
+ impl Into<Option<Elided<'b>>> + 'b,
+ impl Into<Option<Elided<'b, ()>>>,
+ ) where A: 'b {
+ check_bound(arg, lt);
+ //~^ ERROR parameter type `A` may not live long enough
+ ("", None, None)
+ }
+
+ // same as above but there is a late-bound lifetime named `'b`.
+ async fn bar2<'c, 'b>(_dummy: &'a u8, arg: A, lt: Inv<'c>) where A: 'c {
+ check_bound(arg, lt);
+ //~^ ERROR parameter type `A` may not live long enough
+ }
+}
+
+impl<'a, A: 'a> MyTy<Elided<'a, A>> {
+ async fn foo3(self) {
+ check_bound(self.0 .1, self.0 .0);
+ //~^ ERROR parameter type `A` may not live long enough
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.rs b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.rs
new file mode 100644
index 000000000..85f08808b
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.rs
@@ -0,0 +1,52 @@
+// We want to suggest a bound `T: 'a` but `'a` is elided,
+// run-rustfix
+// edition: 2018
+#![allow(dead_code)]
+
+struct Inv<'a>(Option<*mut &'a u8>);
+
+fn check_bound<'a, A: 'a>(_: A, _: Inv<'a>) {}
+
+struct Elided<'a, T = ()>(Inv<'a>, T);
+
+struct MyTy<X>(X);
+
+impl<X> MyTy<Elided<'_, X>> {
+ async fn foo<A>(self, arg: A, _: &str) -> &str {
+ check_bound(arg, self.0 .0);
+ //~^ ERROR parameter type `A` may not live long enough
+ ""
+ }
+}
+
+// Make sure the new lifetime name doesn't conflict with
+// other early- or late-bound lifetimes in-scope.
+impl<'a, A> MyTy<(A, &'a ())> {
+ async fn foo2(
+ arg: A,
+ lt: Inv<'_>,
+ ) -> (
+ impl Into<&str> + Into<&'_ str> + '_,
+ impl Into<Option<Elided>> + '_,
+ impl Into<Option<Elided<()>>>,
+ ) {
+ check_bound(arg, lt);
+ //~^ ERROR parameter type `A` may not live long enough
+ ("", None, None)
+ }
+
+ // same as above but there is a late-bound lifetime named `'b`.
+ async fn bar2<'b>(_dummy: &'a u8, arg: A, lt: Inv<'_>) {
+ check_bound(arg, lt);
+ //~^ ERROR parameter type `A` may not live long enough
+ }
+}
+
+impl<A> MyTy<Elided<'_, A>> {
+ async fn foo3(self) {
+ check_bound(self.0 .1, self.0 .0);
+ //~^ ERROR parameter type `A` may not live long enough
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr
new file mode 100644
index 000000000..2f74a006b
--- /dev/null
+++ b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr
@@ -0,0 +1,66 @@
+error[E0311]: the parameter type `A` may not live long enough
+ --> $DIR/type-param-missing-lifetime.rs:16:9
+ |
+LL | impl<X> MyTy<Elided<'_, X>> {
+ | -- the parameter type `A` must be valid for the anonymous lifetime as defined here...
+LL | async fn foo<A>(self, arg: A, _: &str) -> &str {
+LL | check_bound(arg, self.0 .0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL ~ impl<'a, X> MyTy<Elided<'a, X>> {
+LL ~ async fn foo<A: 'a>(self, arg: A, _: &str) -> &str {
+ |
+
+error[E0311]: the parameter type `A` may not live long enough
+ --> $DIR/type-param-missing-lifetime.rs:33:9
+ |
+LL | lt: Inv<'_>,
+ | ------- the parameter type `A` must be valid for the anonymous lifetime defined here...
+...
+LL | check_bound(arg, lt);
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL ~ async fn foo2<'b>(
+LL | arg: A,
+LL ~ lt: Inv<'b>,
+LL | ) -> (
+LL ~ impl Into<&'b str> + Into<&'b str> + 'b,
+LL ~ impl Into<Option<Elided<'b>>> + 'b,
+LL ~ impl Into<Option<Elided<'b, ()>>>,
+LL ~ ) where A: 'b {
+ |
+
+error[E0311]: the parameter type `A` may not live long enough
+ --> $DIR/type-param-missing-lifetime.rs:40:9
+ |
+LL | async fn bar2<'b>(_dummy: &'a u8, arg: A, lt: Inv<'_>) {
+ | ------- the parameter type `A` must be valid for the anonymous lifetime defined here...
+LL | check_bound(arg, lt);
+ | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | async fn bar2<'c, 'b>(_dummy: &'a u8, arg: A, lt: Inv<'c>) where A: 'c {
+ | +++ ~~ +++++++++++
+
+error[E0311]: the parameter type `A` may not live long enough
+ --> $DIR/type-param-missing-lifetime.rs:47:9
+ |
+LL | impl<A> MyTy<Elided<'_, A>> {
+ | -- the parameter type `A` must be valid for the anonymous lifetime as defined here...
+LL | async fn foo3(self) {
+LL | check_bound(self.0 .1, self.0 .0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ |
+help: consider adding an explicit lifetime bound
+ |
+LL | impl<'a, A: 'a> MyTy<Elided<'a, A>> {
+ | +++ ++++ ~~
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0311`.
diff --git a/tests/ui/suggestions/missing-lifetime-specifier.stderr b/tests/ui/suggestions/missing-lifetime-specifier.stderr
index 21d237838..fa4bc2fa7 100644
--- a/tests/ui/suggestions/missing-lifetime-specifier.stderr
+++ b/tests/ui/suggestions/missing-lifetime-specifier.stderr
@@ -164,6 +164,7 @@ note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -182,6 +183,7 @@ note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -200,6 +202,7 @@ note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -218,6 +221,7 @@ note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -254,6 +258,7 @@ note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -272,6 +277,7 @@ note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -290,6 +296,7 @@ note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
@@ -308,6 +315,7 @@ note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
diff --git a/tests/ui/suggestions/path-display.stderr b/tests/ui/suggestions/path-display.stderr
index 8359b3658..46d0b3582 100644
--- a/tests/ui/suggestions/path-display.stderr
+++ b/tests/ui/suggestions/path-display.stderr
@@ -5,6 +5,7 @@ LL | println!("{}", path);
| ^^^^ `Path` cannot be formatted with the default formatter; call `.display()` on it
|
= help: the trait `std::fmt::Display` is not implemented for `Path`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -15,6 +16,7 @@ LL | println!("{}", path);
| ^^^^ `PathBuf` cannot be formatted with the default formatter; call `.display()` on it
|
= help: the trait `std::fmt::Display` is not implemented for `PathBuf`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/tests/ui/suggestions/restrict-existing-type-bounds.stderr b/tests/ui/suggestions/restrict-existing-type-bounds.stderr
index 14a244b79..fe8338c18 100644
--- a/tests/ui/suggestions/restrict-existing-type-bounds.stderr
+++ b/tests/ui/suggestions/restrict-existing-type-bounds.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/restrict-existing-type-bounds.rs:13:12
|
LL | impl<T: TryAdd> TryAdd for Option<T> {
- | - this type parameter
+ | - found this type parameter
...
LL | Ok(self)
| -- ^^^^ expected `Option<<T as TryAdd>::Output>`, found `Option<T>`
@@ -29,7 +29,7 @@ error[E0308]: mismatched types
--> $DIR/restrict-existing-type-bounds.rs:26:12
|
LL | impl<T: TryAdd<Error = X>> TryAdd for Other<T> {
- | - this type parameter
+ | - found this type parameter
...
LL | Ok(self)
| -- ^^^^ expected `Other<<T as TryAdd>::Output>`, found `Other<T>`
diff --git a/tests/ui/suggestions/return-closures.stderr b/tests/ui/suggestions/return-closures.stderr
index f0810bbb2..97c13200a 100644
--- a/tests/ui/suggestions/return-closures.stderr
+++ b/tests/ui/suggestions/return-closures.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/return-closures.rs:3:5
|
LL | fn foo() {
- | - help: try adding a return type: `-> impl for<'a> Fn(&'a i32) -> i32`
+ | - help: try adding a return type: `-> impl for<'a> Fn(&'a i32) -> i32`
LL |
LL | |x: &i32| 1i32
| ^^^^^^^^^^^^^^ expected `()`, found closure
@@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/return-closures.rs:9:5
|
LL | fn bar(i: impl Sized) {
- | - help: a return type might be missing here: `-> _`
+ | - help: a return type might be missing here: `-> _`
LL |
LL | || i
| ^^^^ expected `()`, found closure
diff --git a/tests/ui/suggestions/silenced-binding-typo.fixed b/tests/ui/suggestions/silenced-binding-typo.fixed
new file mode 100644
index 000000000..e0f9e31be
--- /dev/null
+++ b/tests/ui/suggestions/silenced-binding-typo.fixed
@@ -0,0 +1,5 @@
+// run-rustfix
+fn main() {
+ let x = 42; //~ HELP
+ let _y = x; //~ ERROR
+}
diff --git a/tests/ui/suggestions/silenced-binding-typo.rs b/tests/ui/suggestions/silenced-binding-typo.rs
new file mode 100644
index 000000000..6cadd5a93
--- /dev/null
+++ b/tests/ui/suggestions/silenced-binding-typo.rs
@@ -0,0 +1,5 @@
+// run-rustfix
+fn main() {
+ let _x = 42; //~ HELP
+ let _y = x; //~ ERROR
+}
diff --git a/tests/ui/suggestions/silenced-binding-typo.stderr b/tests/ui/suggestions/silenced-binding-typo.stderr
new file mode 100644
index 000000000..9c0e6e265
--- /dev/null
+++ b/tests/ui/suggestions/silenced-binding-typo.stderr
@@ -0,0 +1,14 @@
+error[E0425]: cannot find value `x` in this scope
+ --> $DIR/silenced-binding-typo.rs:4:14
+ |
+LL | let _y = x;
+ | ^
+ |
+help: a local variable with a similar name exists, consider changing it
+ |
+LL | let x = 42;
+ | ~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/suggestions/slice-issue-87994.stderr b/tests/ui/suggestions/slice-issue-87994.stderr
index 84ecd749b..656f71eb8 100644
--- a/tests/ui/suggestions/slice-issue-87994.stderr
+++ b/tests/ui/suggestions/slice-issue-87994.stderr
@@ -1,4 +1,4 @@
-error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
+error[E0277]: `[i32]` is not an iterator
--> $DIR/slice-issue-87994.rs:3:12
|
LL | for _ in v[1..] {
@@ -13,7 +13,7 @@ LL | for _ in &v[1..] {
LL | for _ in &mut v[1..] {
| ++++
-error[E0277]: `[i32]` is not an iterator
+error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/slice-issue-87994.rs:3:12
|
LL | for _ in v[1..] {
@@ -28,7 +28,7 @@ LL | for _ in &v[1..] {
LL | for _ in &mut v[1..] {
| ++++
-error[E0277]: the size for values of type `[K]` cannot be known at compilation time
+error[E0277]: `[K]` is not an iterator
--> $DIR/slice-issue-87994.rs:11:13
|
LL | for i2 in v2[1..] {
@@ -43,7 +43,7 @@ LL | for i2 in &v2[1..] {
LL | for i2 in &mut v2[1..] {
| ++++
-error[E0277]: `[K]` is not an iterator
+error[E0277]: the size for values of type `[K]` cannot be known at compilation time
--> $DIR/slice-issue-87994.rs:11:13
|
LL | for i2 in v2[1..] {
diff --git a/tests/ui/suggestions/suggest-dereferencing-index.stderr b/tests/ui/suggestions/suggest-dereferencing-index.stderr
index 147dc9234..adf013399 100644
--- a/tests/ui/suggestions/suggest-dereferencing-index.stderr
+++ b/tests/ui/suggestions/suggest-dereferencing-index.stderr
@@ -5,7 +5,8 @@ LL | let one_item_please: i32 = [1, 2, 3][i];
| ^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `&usize`
- = help: the trait `SliceIndex<[T]>` is implemented for `usize`
+ = help: the trait `SliceIndex<[{integer}]>` is implemented for `usize`
+ = help: for that trait implementation, expected `usize`, found `&usize`
= note: required for `[{integer}]` to implement `Index<&usize>`
help: dereference this index
|
diff --git a/tests/ui/suggestions/suggest-impl-trait-lifetime.fixed b/tests/ui/suggestions/suggest-impl-trait-lifetime.fixed
index 589ee1a47..4f2fd5ba6 100644
--- a/tests/ui/suggestions/suggest-impl-trait-lifetime.fixed
+++ b/tests/ui/suggestions/suggest-impl-trait-lifetime.fixed
@@ -3,9 +3,10 @@
use std::fmt::Debug;
fn foo(d: impl Debug + 'static) {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ HELP consider adding an explicit lifetime bound
bar(d);
//~^ ERROR the parameter type `impl Debug` may not live long enough
+//~| NOTE the parameter type `impl Debug` must be valid for the static lifetime...
//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds
}
diff --git a/tests/ui/suggestions/suggest-impl-trait-lifetime.rs b/tests/ui/suggestions/suggest-impl-trait-lifetime.rs
index 9a87129fb..a266e360e 100644
--- a/tests/ui/suggestions/suggest-impl-trait-lifetime.rs
+++ b/tests/ui/suggestions/suggest-impl-trait-lifetime.rs
@@ -3,9 +3,10 @@
use std::fmt::Debug;
fn foo(d: impl Debug) {
-//~^ HELP consider adding an explicit lifetime bound...
+//~^ HELP consider adding an explicit lifetime bound
bar(d);
//~^ ERROR the parameter type `impl Debug` may not live long enough
+//~| NOTE the parameter type `impl Debug` must be valid for the static lifetime...
//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds
}
diff --git a/tests/ui/suggestions/suggest-impl-trait-lifetime.stderr b/tests/ui/suggestions/suggest-impl-trait-lifetime.stderr
index cf912f4aa..1660db1aa 100644
--- a/tests/ui/suggestions/suggest-impl-trait-lifetime.stderr
+++ b/tests/ui/suggestions/suggest-impl-trait-lifetime.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `impl Debug` may not live long enough
--> $DIR/suggest-impl-trait-lifetime.rs:7:5
|
LL | bar(d);
- | ^^^^^^ ...so that the type `impl Debug` will meet its required lifetime bounds
+ | ^^^^^^
+ | |
+ | the parameter type `impl Debug` must be valid for the static lifetime...
+ | ...so that the type `impl Debug` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn foo(d: impl Debug + 'static) {
| +++++++++
diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.fixed b/tests/ui/suggestions/suggest-ret-on-async-w-late.fixed
new file mode 100644
index 000000000..0a0838331
--- /dev/null
+++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.fixed
@@ -0,0 +1,14 @@
+// edition: 2021
+// run-rustfix
+
+#![allow(unused)]
+
+// Make sure we don't ICE when suggesting a return type
+// for an async fn that has late-bound vars...
+
+async fn ice(_: &i32) -> bool {
+ true
+ //~^ ERROR mismatched types
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.rs b/tests/ui/suggestions/suggest-ret-on-async-w-late.rs
index 459b94f94..5c8f185bd 100644
--- a/tests/ui/suggestions/suggest-ret-on-async-w-late.rs
+++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.rs
@@ -1,4 +1,7 @@
// edition: 2021
+// run-rustfix
+
+#![allow(unused)]
// Make sure we don't ICE when suggesting a return type
// for an async fn that has late-bound vars...
diff --git a/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr
index bff864b22..352f6da36 100644
--- a/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr
+++ b/tests/ui/suggestions/suggest-ret-on-async-w-late.stderr
@@ -1,8 +1,8 @@
error[E0308]: mismatched types
- --> $DIR/suggest-ret-on-async-w-late.rs:7:5
+ --> $DIR/suggest-ret-on-async-w-late.rs:10:5
|
LL | async fn ice(_: &i32) {
- | - help: try adding a return type: `-> bool`
+ | - help: try adding a return type: `-> bool`
LL | true
| ^^^^ expected `()`, found `bool`
diff --git a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr
index 0ca5b9b92..0d1eed67c 100644
--- a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr
+++ b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/suggest-trait-in-ufcs-in-hrtb.rs:5:38
|
LL | impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {}
- | ^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'a S as IntoIterator>::Item`
+ | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<&'a S as IntoIterator>::Item`
error: aborting due to previous error
diff --git a/tests/ui/suggestions/trait-hidden-method.stderr b/tests/ui/suggestions/trait-hidden-method.stderr
index a5a65d193..5dec20718 100644
--- a/tests/ui/suggestions/trait-hidden-method.stderr
+++ b/tests/ui/suggestions/trait-hidden-method.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified
+error[E0191]: the value of the associated type `Item` in `Iterator` must be specified
--> $DIR/trait-hidden-method.rs:6:33
|
LL | Box::new(1..=10) as Box<dyn Iterator>
diff --git a/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr b/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr
index 7deb9a434..980c2455c 100644
--- a/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr
+++ b/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr
@@ -124,7 +124,7 @@ error[E0308]: mismatched types
--> $DIR/trait-with-missing-associated-type-restriction.rs:31:9
|
LL | fn baz<D: std::fmt::Debug, T: Trait<A = D>>(x: T) {
- | - this type parameter
+ | - found this type parameter
LL | qux(x.func())
| --- ^^^^^^^^ expected `usize`, found type parameter `D`
| |
diff --git a/tests/ui/suggestions/unnamable-types.rs b/tests/ui/suggestions/unnamable-types.rs
index f2485041d..a4e32d7c8 100644
--- a/tests/ui/suggestions/unnamable-types.rs
+++ b/tests/ui/suggestions/unnamable-types.rs
@@ -1,7 +1,7 @@
// Test that we do not suggest to add type annotations for unnamable types.
#![crate_type="lib"]
-#![feature(generators)]
+#![feature(coroutines)]
const A = 5;
//~^ ERROR: missing type for `const` item
diff --git a/tests/ui/suggestions/unnamable-types.stderr b/tests/ui/suggestions/unnamable-types.stderr
index 19e9af145..d003b9169 100644
--- a/tests/ui/suggestions/unnamable-types.stderr
+++ b/tests/ui/suggestions/unnamable-types.stderr
@@ -55,7 +55,7 @@ error: missing type for `const` item
LL | const G = || -> i32 { yield 0; return 1; };
| ^
|
-note: however, the inferred type `{generator@$DIR/unnamable-types.rs:37:11: 37:20}` cannot be named
+note: however, the inferred type `{coroutine@$DIR/unnamable-types.rs:37:11: 37:20}` cannot be named
--> $DIR/unnamable-types.rs:37:11
|
LL | const G = || -> i32 { yield 0; return 1; };
diff --git a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr
index 175a5fbba..7c84dd4b8 100644
--- a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr
+++ b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr
@@ -14,7 +14,7 @@ help: replace the generic bounds with the associated types
LL | i: Box<dyn T<usize, usize, A = usize, C = usize, B=usize>>,
| +++ +++
-error[E0191]: the value of the associated types `A` (from trait `T`), `C` (from trait `T`) must be specified
+error[E0191]: the value of the associated types `C` and `A` in `T` must be specified
--> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16
|
LL | type A;
diff --git a/tests/ui/symbol-mangling-version/bad-value.bad.stderr b/tests/ui/symbol-mangling-version/bad-value.bad.stderr
new file mode 100644
index 000000000..c36c73c60
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/bad-value.bad.stderr
@@ -0,0 +1,2 @@
+error: incorrect value `bad-value` for codegen option `symbol-mangling-version` - either `legacy` or `v0` (RFC 2603) was expected
+
diff --git a/tests/ui/symbol-mangling-version/bad-value.blank.stderr b/tests/ui/symbol-mangling-version/bad-value.blank.stderr
new file mode 100644
index 000000000..0e70af5b8
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/bad-value.blank.stderr
@@ -0,0 +1,2 @@
+error: incorrect value `` for codegen option `symbol-mangling-version` - either `legacy` or `v0` (RFC 2603) was expected
+
diff --git a/tests/ui/symbol-mangling-version/bad-value.no-value.stderr b/tests/ui/symbol-mangling-version/bad-value.no-value.stderr
new file mode 100644
index 000000000..77013b72b
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/bad-value.no-value.stderr
@@ -0,0 +1,2 @@
+error: codegen option `symbol-mangling-version` requires either `legacy` or `v0` (RFC 2603) (C symbol-mangling-version=<value>)
+
diff --git a/tests/ui/symbol-mangling-version/bad-value.rs b/tests/ui/symbol-mangling-version/bad-value.rs
new file mode 100644
index 000000000..7623857d4
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/bad-value.rs
@@ -0,0 +1,6 @@
+// revisions: no-value blank bad
+// [no-value] compile-flags: -Csymbol-mangling-version
+// [blank] compile-flags: -Csymbol-mangling-version=
+// [bad] compile-flags: -Csymbol-mangling-version=bad-value
+
+fn main() {}
diff --git a/tests/ui/symbol-mangling-version/stable.rs b/tests/ui/symbol-mangling-version/stable.rs
new file mode 100644
index 000000000..dac9bb18d
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/stable.rs
@@ -0,0 +1,5 @@
+// check-pass
+// revisions: v0
+// [v0] compile-flags: -Csymbol-mangling-version=v0
+
+fn main() {}
diff --git a/tests/ui/symbol-mangling-version/unstable.legacy.stderr b/tests/ui/symbol-mangling-version/unstable.legacy.stderr
new file mode 100644
index 000000000..c5b359b41
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/unstable.legacy.stderr
@@ -0,0 +1,2 @@
+error: `-C symbol-mangling-version=legacy` requires `-Z unstable-options`
+
diff --git a/tests/ui/symbol-mangling-version/unstable.rs b/tests/ui/symbol-mangling-version/unstable.rs
new file mode 100644
index 000000000..df87a39cd
--- /dev/null
+++ b/tests/ui/symbol-mangling-version/unstable.rs
@@ -0,0 +1,6 @@
+// revisions: legacy legacy-ok
+// [legacy] compile-flags: -Csymbol-mangling-version=legacy
+// [legacy-ok] check-pass
+// [legacy-ok] compile-flags: -Zunstable-options -Csymbol-mangling-version=legacy
+
+fn main() {}
diff --git a/tests/ui/target-feature/gate.rs b/tests/ui/target-feature/gate.rs
index 782444417..971a4654b 100644
--- a/tests/ui/target-feature/gate.rs
+++ b/tests/ui/target-feature/gate.rs
@@ -18,6 +18,7 @@
// gate-test-bpf_target_feature
// gate-test-aarch64_ver_target_feature
// gate-test-csky_target_feature
+// gate-test-loongarch_target_feature
#[target_feature(enable = "avx512bw")]
//~^ ERROR: currently unstable
diff --git a/tests/ui/target-feature/gate.stderr b/tests/ui/target-feature/gate.stderr
index f56efb3bb..0ec7427c3 100644
--- a/tests/ui/target-feature/gate.stderr
+++ b/tests/ui/target-feature/gate.stderr
@@ -1,5 +1,5 @@
error[E0658]: the target feature `avx512bw` is currently unstable
- --> $DIR/gate.rs:22:18
+ --> $DIR/gate.rs:23:18
|
LL | #[target_feature(enable = "avx512bw")]
| ^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/target-feature/similar-feature-suggestion.stderr b/tests/ui/target-feature/similar-feature-suggestion.stderr
index 2f376065f..f39dfd401 100644
--- a/tests/ui/target-feature/similar-feature-suggestion.stderr
+++ b/tests/ui/target-feature/similar-feature-suggestion.stderr
@@ -1,6 +1,6 @@
-warning: unknown feature specified for `-Ctarget-feature`: `rdrnd`
+warning: unknown and unstable feature specified for `-Ctarget-feature`: `rdrnd`
|
- = note: it is still passed through to the codegen backend
+ = note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future
= help: you might have meant: `rdrand`
warning: 1 warning emitted
diff --git a/tests/ui/target-feature/unstable-feature.rs b/tests/ui/target-feature/unstable-feature.rs
new file mode 100644
index 000000000..bd0d72938
--- /dev/null
+++ b/tests/ui/target-feature/unstable-feature.rs
@@ -0,0 +1,6 @@
+// compile-flags: -Ctarget-feature=+vaes --crate-type=rlib --target=x86_64-unknown-linux-gnu
+// build-pass
+// needs-llvm-components: x86
+
+#![feature(no_core)]
+#![no_core]
diff --git a/tests/ui/target-feature/unstable-feature.stderr b/tests/ui/target-feature/unstable-feature.stderr
new file mode 100644
index 000000000..d34544c5c
--- /dev/null
+++ b/tests/ui/target-feature/unstable-feature.stderr
@@ -0,0 +1,6 @@
+warning: unstable feature specified for `-Ctarget-feature`: `vaes`
+ |
+ = note: this feature is not stably supported; its behavior can change in the future
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/thread-local/thread-local-static.stderr b/tests/ui/thread-local/thread-local-static.mir.stderr
index 712050a25..607d7ee90 100644
--- a/tests/ui/thread-local/thread-local-static.stderr
+++ b/tests/ui/thread-local/thread-local-static.mir.stderr
@@ -1,5 +1,5 @@
error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/thread-local-static.rs:7:12
+ --> $DIR/thread-local-static.rs:10:12
|
LL | const fn g(x: &mut [u32; 8]) {
| ^
@@ -8,13 +8,13 @@ LL | const fn g(x: &mut [u32; 8]) {
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0625]: thread-local statics cannot be accessed at compile-time
- --> $DIR/thread-local-static.rs:9:28
+ --> $DIR/thread-local-static.rs:12:28
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^
error[E0013]: constant functions cannot refer to statics
- --> $DIR/thread-local-static.rs:9:28
+ --> $DIR/thread-local-static.rs:12:28
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^
@@ -22,7 +22,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
= help: consider extracting the value of the `static` to a `const`, and referring to that
error[E0658]: mutable references are not allowed in constant functions
- --> $DIR/thread-local-static.rs:9:23
+ --> $DIR/thread-local-static.rs:12:23
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^^^^^^
@@ -31,7 +31,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
- --> $DIR/thread-local-static.rs:9:23
+ --> $DIR/thread-local-static.rs:12:23
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^^^^^^ use of mutable static
diff --git a/tests/ui/thread-local/thread-local-static.rs b/tests/ui/thread-local/thread-local-static.rs
index c7fee9e6b..afaffbb7e 100644
--- a/tests/ui/thread-local/thread-local-static.rs
+++ b/tests/ui/thread-local/thread-local-static.rs
@@ -1,7 +1,10 @@
// edition:2018
+// revisions: mir thir
+//thir: -Zthir-unsafeck
#![feature(thread_local)]
#![feature(const_swap)]
+
#[thread_local]
static mut STATIC_VAR_2: [u32; 8] = [4; 8];
const fn g(x: &mut [u32; 8]) {
diff --git a/tests/ui/thread-local/thread-local-static.thir.stderr b/tests/ui/thread-local/thread-local-static.thir.stderr
new file mode 100644
index 000000000..607d7ee90
--- /dev/null
+++ b/tests/ui/thread-local/thread-local-static.thir.stderr
@@ -0,0 +1,44 @@
+error[E0658]: mutable references are not allowed in constant functions
+ --> $DIR/thread-local-static.rs:10:12
+ |
+LL | const fn g(x: &mut [u32; 8]) {
+ | ^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-static.rs:12:28
+ |
+LL | std::mem::swap(x, &mut STATIC_VAR_2)
+ | ^^^^^^^^^^^^
+
+error[E0013]: constant functions cannot refer to statics
+ --> $DIR/thread-local-static.rs:12:28
+ |
+LL | std::mem::swap(x, &mut STATIC_VAR_2)
+ | ^^^^^^^^^^^^
+ |
+ = help: consider extracting the value of the `static` to a `const`, and referring to that
+
+error[E0658]: mutable references are not allowed in constant functions
+ --> $DIR/thread-local-static.rs:12:23
+ |
+LL | std::mem::swap(x, &mut STATIC_VAR_2)
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/thread-local-static.rs:12:23
+ |
+LL | std::mem::swap(x, &mut STATIC_VAR_2)
+ | ^^^^^^^^^^^^^^^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0013, E0133, E0625, E0658.
+For more information about an error, try `rustc --explain E0013`.
diff --git a/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs b/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs
index fd53bb607..61f54ac4e 100644
--- a/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs
+++ b/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs
@@ -37,7 +37,7 @@ macro_rules! is_sync_send {
}
fn main() {
- // The iterator "generator" list should exhaust what corresponding
+ // The iterator "coroutine" list should exhaust what corresponding
// implementations have where `Sync` and `Send` semantics apply.
all_sync_send!(BinaryHeap::<usize>::new(), iter, drain, into_iter);
diff --git a/tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr b/tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr
index 71fd5f1d4..2045dc6a3 100644
--- a/tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr
+++ b/tests/ui/tool-attributes/tool-attributes-misplaced-1.stderr
@@ -9,6 +9,8 @@ error: cannot find derive macro `rustfmt` in this scope
|
LL | #[derive(rustfmt)]
| ^^^^^^^
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: cannot find attribute `rustfmt` in this scope
--> $DIR/tool-attributes-misplaced-1.rs:9:3
diff --git a/tests/ui/tool_lints.stderr b/tests/ui/tool_lints.stderr
index d36cd193b..f1d825cab 100644
--- a/tests/ui/tool_lints.stderr
+++ b/tests/ui/tool_lints.stderr
@@ -13,6 +13,7 @@ LL | #[warn(foo::bar)]
| ^^^
|
= help: add `#![register_tool(foo)]` to the crate root
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr
index b114d295d..63280b861 100644
--- a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr
+++ b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr
@@ -12,8 +12,11 @@ LL + use std::borrow::Cow;
error[E0119]: conflicting implementations of trait `From<LabelText>` for type `LabelText`
--> $DIR/impl-bound-with-references-error.rs:9:1
|
-LL | impl<T> From<T> for LabelText
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / impl<T> From<T> for LabelText
+LL | |
+LL | | where
+LL | | T: Into<Cow<'static, str>>,
+ | |_______________________________^
|
= note: conflicting implementation in crate `core`:
- impl<T> From<T> for T;
diff --git a/tests/ui/trait-bounds/mismatch-fn-trait.stderr b/tests/ui/trait-bounds/mismatch-fn-trait.stderr
index 961e6d88f..519aa9ea3 100644
--- a/tests/ui/trait-bounds/mismatch-fn-trait.stderr
+++ b/tests/ui/trait-bounds/mismatch-fn-trait.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnMut(u32)`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnMut(u32)`
--> $DIR/mismatch-fn-trait.rs:4:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnMut(u32)`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnMut(u32)`
| |
| required by a bound introduced by this call
|
@@ -14,11 +14,11 @@ note: required by a bound in `take`
LL | fn take(_f: impl FnMut(i32)) {}
| ^^^^^^^^^^ required by this bound in `take`
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnMut(i32, i32)`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnMut(i32, i32)`
--> $DIR/mismatch-fn-trait.rs:9:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnMut(i32, i32)`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnMut(i32, i32)`
| |
| required by a bound introduced by this call
|
@@ -29,11 +29,11 @@ note: required by a bound in `take`
LL | fn take(_f: impl FnMut(i32)) {}
| ^^^^^^^^^^ required by this bound in `take`
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnMut()`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnMut()`
--> $DIR/mismatch-fn-trait.rs:14:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnMut()`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnMut()`
| |
| required by a bound introduced by this call
|
@@ -44,11 +44,11 @@ note: required by a bound in `take`
LL | fn take(_f: impl FnMut(i32)) {}
| ^^^^^^^^^^ required by this bound in `take`
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnOnce(i32)`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnOnce(i32)`
--> $DIR/mismatch-fn-trait.rs:19:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnOnce(i32)`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnOnce(i32)`
| |
| required by a bound introduced by this call
|
@@ -59,11 +59,11 @@ note: required by a bound in `take`
LL | fn take(_f: impl FnMut(i32)) {}
| ^^^^^^^^^^ required by this bound in `take`
-error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnOnce(u32)`
+error[E0277]: expected a `FnMut(i32)` closure, found `impl FnOnce(u32)`
--> $DIR/mismatch-fn-trait.rs:24:10
|
LL | take(f)
- | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnOnce(u32)`
+ | ---- ^ expected an `FnMut(i32)` closure, found `impl FnOnce(u32)`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.fixed b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.fixed
new file mode 100644
index 000000000..b3f5ad52d
--- /dev/null
+++ b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.fixed
@@ -0,0 +1,11 @@
+// run-rustfix
+pub trait MyTrait {
+ type T;
+
+ fn bar(self) -> Self::T;
+}
+
+pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
+ return a.bar(); //~ ERROR mismatched types
+}
+fn main() {}
diff --git a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.rs b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.rs
new file mode 100644
index 000000000..213abda77
--- /dev/null
+++ b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.rs
@@ -0,0 +1,11 @@
+// run-rustfix
+pub trait MyTrait {
+ type T;
+
+ fn bar(self) -> Self::T;
+}
+
+pub fn foo<A: MyTrait, B>(a: A) -> B {
+ return a.bar(); //~ ERROR mismatched types
+}
+fn main() {}
diff --git a/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr
new file mode 100644
index 000000000..61132efc4
--- /dev/null
+++ b/tests/ui/trait-bounds/restrict-assoc-type-of-generic-bound.stderr
@@ -0,0 +1,20 @@
+error[E0308]: mismatched types
+ --> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
+ |
+LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
+ | - - expected `B` because of return type
+ | |
+ | expected this type parameter
+LL | return a.bar();
+ | ^^^^^^^ expected type parameter `B`, found associated type
+ |
+ = note: expected type parameter `B`
+ found associated type `<A as MyTrait>::T`
+help: consider further restricting this bound
+ |
+LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
+ | +++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/traits/alias/object-fail.stderr b/tests/ui/traits/alias/object-fail.stderr
index 048a150df..a27a3ea0e 100644
--- a/tests/ui/traits/alias/object-fail.stderr
+++ b/tests/ui/traits/alias/object-fail.stderr
@@ -9,7 +9,7 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all
|
= note: the trait cannot be made into an object because it uses `Self` as a type parameter
-error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified
+error[E0191]: the value of the associated type `Item` in `Iterator` must be specified
--> $DIR/object-fail.rs:9:17
|
LL | let _: &dyn IteratorAlias = &vec![123].into_iter();
diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs
new file mode 100644
index 000000000..e0edd5224
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs
@@ -0,0 +1,43 @@
+// Regression test for #116464
+// Checks that we do not suggest Trait<..., Assoc=arg> when the trait
+// is referred to from one of its impls but do so at all other places
+
+pub trait Trait<T> {
+ type Assoc;
+}
+
+impl<T, S> Trait<T> for i32 {
+ type Assoc = String;
+}
+
+// Should not not trigger suggestion here...
+impl<T, S> Trait<T, S> for () {}
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+
+//... but should do so in all of the below cases except the last one
+fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+//~| ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+ 3
+}
+
+struct Struct<T: Trait<u32, String>> {
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+ a: T
+}
+
+trait AnotherTrait<T: Trait<T, i32>> {}
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+
+impl<T: Trait<u32, String>> Struct<T> {}
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+
+// Test for self type. Should not trigger suggestion as it doesn't have an
+// associated type
+trait YetAnotherTrait {}
+impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
+//~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied
+
+
+fn main() {
+}
diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
new file mode 100644
index 000000000..711ccf1b6
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
@@ -0,0 +1,109 @@
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:14:12
+ |
+LL | impl<T, S> Trait<T, S> for () {}
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:18:12
+ |
+LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | fn func<T: Trait<u32, Assoc = String>>(t: T) -> impl Trait<(), i32> {
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:18:46
+ |
+LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), Assoc = i32> {
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:24:18
+ |
+LL | struct Struct<T: Trait<u32, String>> {
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | struct Struct<T: Trait<u32, Assoc = String>> {
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:29:23
+ |
+LL | trait AnotherTrait<T: Trait<T, i32>> {}
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | trait AnotherTrait<T: Trait<T, Assoc = i32>> {}
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:32:9
+ |
+LL | impl<T: Trait<u32, String>> Struct<T> {}
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | impl<T: Trait<u32, Assoc = String>> Struct<T> {}
+ | +++++++
+
+error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:38:58
+ |
+LL | impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
+ | ^^^^^^ - help: remove this generic argument
+ | |
+ | expected 1 generic argument
+ |
+note: struct defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:24:8
+ |
+LL | struct Struct<T: Trait<u32, String>> {
+ | ^^^^^^ -
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
index eb2fb6e84..1359eb6cb 100644
--- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
+++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
@@ -11,5 +11,5 @@ fn f<T: for<'r> X<'r> + ?Sized>() {
fn main() {
f::<dyn for<'x> X<'x, F = i32>>();
- //~^ expected a `FnOnce<(&i32,)>` closure, found `i32`
+ //~^ expected a `FnOnce(&i32)` closure, found `i32`
}
diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr
index 10e82c54e..68b9319d6 100644
--- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr
+++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnOnce<(&i32,)>` closure, found `i32`
+error[E0277]: expected a `FnOnce(&i32)` closure, found `i32`
--> $DIR/check-trait-object-bounds-2.rs:13:9
|
LL | f::<dyn for<'x> X<'x, F = i32>>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&i32)` closure, found `i32`
|
= help: the trait `for<'a> FnOnce<(&'a i32,)>` is not implemented for `i32`
note: required by a bound in `f`
diff --git a/tests/ui/traits/associated_type_bound/impl-is-shadowed.rs b/tests/ui/traits/associated_type_bound/impl-is-shadowed.rs
new file mode 100644
index 000000000..6c3125a9f
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/impl-is-shadowed.rs
@@ -0,0 +1,21 @@
+// check-pass
+trait Bar<'a> {
+ type Assoc: 'static;
+}
+
+impl<'a> Bar<'a> for () {
+ type Assoc = ();
+}
+
+struct ImplsStatic<CG: Bar<'static>> {
+ d: &'static <CG as Bar<'static>>::Assoc,
+}
+
+fn caller(b: ImplsStatic<()>)
+where
+ for<'a> (): Bar<'a>
+{
+ let _: &<() as Bar<'static>>::Assoc = b.d;
+}
+
+fn main() {}
diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs
index f9a934764..f8e3f8e96 100644
--- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs
+++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs
@@ -1,7 +1,7 @@
fn strip_lf(s: &str) -> &str {
s.strip_suffix(b'\n').unwrap_or(s)
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `u8`
- //~| NOTE expected an `FnMut<(char,)>` closure, found `u8`
+ //~^ ERROR expected a `FnMut(char)` closure, found `u8`
+ //~| NOTE expected an `FnMut(char)` closure, found `u8`
//~| HELP the trait `FnMut<(char,)>` is not implemented for `u8`
//~| HELP the following other types implement trait `Pattern<'a>`:
//~| NOTE required for `u8` to implement `Pattern<'_>`
diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr
index b1c683e47..f30fe12b2 100644
--- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr
+++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnMut<(char,)>` closure, found `u8`
+error[E0277]: expected a `FnMut(char)` closure, found `u8`
--> $DIR/assoc-fn-bound-root-obligation.rs:2:7
|
LL | s.strip_suffix(b'\n').unwrap_or(s)
- | ^^^^^^^^^^^^ expected an `FnMut<(char,)>` closure, found `u8`
+ | ^^^^^^^^^^^^ expected an `FnMut(char)` closure, found `u8`
|
= help: the trait `FnMut<(char,)>` is not implemented for `u8`
= help: the following other types implement trait `Pattern<'a>`:
diff --git a/tests/ui/traits/bound/on-structs-and-enums-static.rs b/tests/ui/traits/bound/on-structs-and-enums-static.rs
index df3f8b8a5..066416cb3 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-static.rs
+++ b/tests/ui/traits/bound/on-structs-and-enums-static.rs
@@ -8,7 +8,7 @@ struct Foo<T:Trait> {
static X: Foo<usize> = Foo {
//~^ ERROR E0277
- x: 1,
+ x: 1, //~ ERROR: E0277
};
fn main() {
diff --git a/tests/ui/traits/bound/on-structs-and-enums-static.stderr b/tests/ui/traits/bound/on-structs-and-enums-static.stderr
index fa14aff68..28bbe00c5 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-static.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-static.stderr
@@ -15,6 +15,23 @@ note: required by a bound in `Foo`
LL | struct Foo<T:Trait> {
| ^^^^^ required by this bound in `Foo`
-error: aborting due to previous error
+error[E0277]: the trait bound `usize: Trait` is not satisfied
+ --> $DIR/on-structs-and-enums-static.rs:11:8
+ |
+LL | x: 1,
+ | ^ the trait `Trait` is not implemented for `usize`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-static.rs:1:1
+ |
+LL | trait Trait {
+ | ^^^^^^^^^^^
+note: required by a bound in `Foo`
+ --> $DIR/on-structs-and-enums-static.rs:5:14
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^ required by this bound in `Foo`
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/coercion-generic-bad.stderr b/tests/ui/traits/coercion-generic-bad.stderr
index e7e8a7967..30a3c40db 100644
--- a/tests/ui/traits/coercion-generic-bad.stderr
+++ b/tests/ui/traits/coercion-generic-bad.stderr
@@ -5,6 +5,7 @@ LL | let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct`
|
= help: the trait `Trait<&'static str>` is implemented for `Struct`
+ = help: for that trait implementation, expected `&'static str`, found `isize`
= note: required for the cast from `Box<Struct>` to `Box<dyn Trait<isize>>`
error: aborting due to previous error
diff --git a/tests/ui/traits/copy-guessing.stderr b/tests/ui/traits/copy-guessing.stderr
index 568b7e5a6..7e676c9da 100644
--- a/tests/ui/traits/copy-guessing.stderr
+++ b/tests/ui/traits/copy-guessing.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Option<T>`
--> $DIR/copy-guessing.rs:20:9
|
LL | let n = None;
- | ^
+ | ^ ---- type must be known at this point
|
help: consider giving `n` an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
index 9a444be50..205b1173e 100644
--- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
+++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
@@ -14,7 +14,5 @@ impl<X> Method<u32> for Thing<X> {
fn main() {
let thing = Thing(true);
- thing.method(42);
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ thing.method(42); //~ ERROR type annotations needed
}
diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
index 57b2587ae..2185c51e5 100644
--- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
+++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11
- |
-LL | thing.method(42);
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Thing<bool> as Method<T>>::method(thing, 42);
- | +++++++++++++++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11
|
@@ -28,7 +17,6 @@ help: try using a fully qualified path to specify the expected types
LL | <Thing<bool> as Method<T>>::method(thing, 42);
| +++++++++++++++++++++++++++++++++++ ~
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/issue-33140-hack-boundaries.stderr b/tests/ui/traits/issue-33140-hack-boundaries.stderr
index 80a502c63..06e1dfd37 100644
--- a/tests/ui/traits/issue-33140-hack-boundaries.stderr
+++ b/tests/ui/traits/issue-33140-hack-boundaries.stderr
@@ -60,7 +60,7 @@ error[E0119]: conflicting implementations of trait `Trait5` for type `(dyn Send
LL | impl Trait5 for dyn Send {}
| ------------------------ first implementation here
LL | impl Trait5 for dyn Send where u32: Copy {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
error: aborting due to 8 previous errors
diff --git a/tests/ui/traits/issue-38404.stderr b/tests/ui/traits/issue-38404.stderr
index f8625f53b..a5c258eb3 100644
--- a/tests/ui/traits/issue-38404.stderr
+++ b/tests/ui/traits/issue-38404.stderr
@@ -25,6 +25,7 @@ LL | trait A<T>: std::ops::Add<Self> + Sized {}
| ^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter
LL | trait B<T>: A<T> {}
| - this trait cannot be made into an object...
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-38604.stderr b/tests/ui/traits/issue-38604.stderr
index d53276024..3ab9af21b 100644
--- a/tests/ui/traits/issue-38604.stderr
+++ b/tests/ui/traits/issue-38604.stderr
@@ -11,6 +11,7 @@ LL | trait Foo where u32: Q<Self> {
| --- ^^^^^^^ ...because it uses `Self` as a type parameter
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/issue-38604.rs:15:9
@@ -25,6 +26,7 @@ LL | trait Foo where u32: Q<Self> {
| --- ^^^^^^^ ...because it uses `Self` as a type parameter
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
= note: required for the cast from `Box<()>` to `Box<dyn Foo>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-52893.stderr b/tests/ui/traits/issue-52893.stderr
index db807a388..c57921a08 100644
--- a/tests/ui/traits/issue-52893.stderr
+++ b/tests/ui/traits/issue-52893.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-52893.rs:53:22
|
LL | impl<F, Name, P> AddClass<Name, F> for Class<P>
- | - this type parameter
+ | - expected this type parameter
...
LL | builder.push(output);
| ---- ^^^^^^ expected type parameter `F`, found `Class<P>`
diff --git a/tests/ui/traits/issue-59029-1.stderr b/tests/ui/traits/issue-59029-1.stderr
index 203a89285..5c47eefcd 100644
--- a/tests/ui/traits/issue-59029-1.stderr
+++ b/tests/ui/traits/issue-59029-1.stderr
@@ -2,13 +2,15 @@ error[E0220]: associated type `Res` not found for `Self`
--> $DIR/issue-59029-1.rs:5:52
|
LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>;
- | ^^^ there is a similarly named associated type `Res` in the trait `Svc`
+ | ^^^ there is an associated type `Res` in the trait `Svc`
error[E0220]: associated type `Res` not found for `Self`
--> $DIR/issue-59029-1.rs:5:52
|
LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>;
- | ^^^ there is a similarly named associated type `Res` in the trait `Svc`
+ | ^^^ there is an associated type `Res` in the trait `Svc`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-77982.rs b/tests/ui/traits/issue-77982.rs
index f5be6cf21..2331dda91 100644
--- a/tests/ui/traits/issue-77982.rs
+++ b/tests/ui/traits/issue-77982.rs
@@ -1,3 +1,4 @@
+// ignore-windows different list of satisfying impls
use std::collections::HashMap;
fn what() {
diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr
index 33cc186ac..592cfd970 100644
--- a/tests/ui/traits/issue-77982.stderr
+++ b/tests/ui/traits/issue-77982.stderr
@@ -1,5 +1,5 @@
error[E0283]: type annotations needed
- --> $DIR/issue-77982.rs:8:10
+ --> $DIR/issue-77982.rs:9:10
|
LL | opts.get(opt.as_ref());
| ^^^ ------------ type must be known at this point
@@ -18,7 +18,7 @@ LL | opts.get::<Q>(opt.as_ref());
| +++++
error[E0283]: type annotations needed
- --> $DIR/issue-77982.rs:8:10
+ --> $DIR/issue-77982.rs:9:10
|
LL | opts.get(opt.as_ref());
| ^^^ ------ type must be known at this point
@@ -35,25 +35,34 @@ help: consider specifying the generic argument
LL | opts.get::<Q>(opt.as_ref());
| +++++
-error[E0282]: type annotations needed
- --> $DIR/issue-77982.rs:13:59
+error[E0283]: type annotations needed
+ --> $DIR/issue-77982.rs:14:59
|
LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
- | ^^^^
- |
+ | --- ^^^^
+ | |
+ | type must be known at this point
+ |
+ = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate:
+ - impl From<Ipv4Addr> for u32;
+ - impl From<NonZeroU32> for u32;
+ - impl From<bool> for u32;
+ - impl From<char> for u32;
+ - impl From<u16> for u32;
+ - impl From<u8> for u32;
help: try using a fully qualified path to specify the expected types
|
LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(<u32 as Into<T>>::into(0u32))).collect();
| +++++++++++++++++++++++ ~
error[E0283]: type annotations needed for `Box<T>`
- --> $DIR/issue-77982.rs:36:9
+ --> $DIR/issue-77982.rs:37:9
|
LL | let _ = ().foo();
| ^ --- type must be known at this point
|
note: multiple `impl`s satisfying `(): Foo<'_, _>` found
- --> $DIR/issue-77982.rs:29:1
+ --> $DIR/issue-77982.rs:30:1
|
LL | impl Foo<'static, u32> for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -65,13 +74,13 @@ LL | let _: Box<T> = ().foo();
| ++++++++
error[E0283]: type annotations needed for `Box<T>`
- --> $DIR/issue-77982.rs:40:9
+ --> $DIR/issue-77982.rs:41:9
|
LL | let _ = (&()).bar();
| ^ --- type must be known at this point
|
note: multiple `impl`s satisfying `&(): Bar<'_, _>` found
- --> $DIR/issue-77982.rs:32:1
+ --> $DIR/issue-77982.rs:33:1
|
LL | impl<'a> Bar<'static, u32> for &'a () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -84,5 +93,4 @@ LL | let _: Box<T> = (&()).bar();
error: aborting due to 5 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr
index f53813189..244cc2fc5 100644
--- a/tests/ui/traits/item-privacy.stderr
+++ b/tests/ui/traits/item-privacy.stderr
@@ -8,11 +8,10 @@ LL | S.a();
| ^ method not found in `S`
|
= help: items from traits can only be used if the trait is implemented and in scope
-note: `method::A` defines an item `a`, perhaps you need to implement it
- --> $DIR/item-privacy.rs:6:5
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+ |
+LL + use method::A;
|
-LL | trait A {
- | ^^^^^^^
error[E0599]: no method named `b` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:68:7
@@ -51,11 +50,10 @@ LL | S::a(&S);
| ^ function or associated item not found in `S`
|
= help: items from traits can only be used if the trait is implemented and in scope
-note: `method::A` defines an item `a`, perhaps you need to implement it
- --> $DIR/item-privacy.rs:6:5
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+ |
+LL + use method::A;
|
-LL | trait A {
- | ^^^^^^^
error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:80:8
@@ -91,11 +89,10 @@ LL | S::A;
| ^ associated item not found in `S`
|
= help: items from traits can only be used if the trait is implemented and in scope
-note: `assoc_const::A` defines an item `A`, perhaps you need to implement it
- --> $DIR/item-privacy.rs:24:5
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+ |
+LL + use assoc_const::A;
|
-LL | trait A {
- | ^^^^^^^
error[E0599]: no associated item named `B` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:98:8
@@ -143,6 +140,7 @@ LL | const C: u8 = 0;
= help: consider moving `C` to another trait
= help: consider moving `A` to another trait
= help: consider moving `B` to another trait
+ = help: only type `S` implements the trait, consider using it directly instead
error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:115:12
@@ -159,13 +157,13 @@ error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:116:12
|
LL | let _: S::B;
- | ^^^^ help: use the fully-qualified path: `<S as assoc_ty::B>::B`
+ | ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::B>::B`
error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:117:12
|
LL | let _: S::C;
- | ^^^^ help: use the fully-qualified path: `<S as assoc_ty::C>::C`
+ | ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::C>::C`
error[E0624]: associated type `A` is private
--> $DIR/item-privacy.rs:119:12
diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.rs b/tests/ui/traits/multidispatch-convert-ambig-dest.rs
index aa74e11c3..36e1e868f 100644
--- a/tests/ui/traits/multidispatch-convert-ambig-dest.rs
+++ b/tests/ui/traits/multidispatch-convert-ambig-dest.rs
@@ -25,7 +25,6 @@ where T : Convert<U>
fn a() {
test(22, std::default::Default::default());
//~^ ERROR type annotations needed
- //~| ERROR type annotations needed
}
fn main() {}
diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
index e927f26e9..e3bfc78bb 100644
--- a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
+++ b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/multidispatch-convert-ambig-dest.rs:26:5
- |
-LL | test(22, std::default::Default::default());
- | ^^^^ cannot infer type of the type parameter `U` declared on the function `test`
- |
-help: consider specifying the generic arguments
- |
-LL | test::<i32, U>(22, std::default::Default::default());
- | ++++++++++
-
error[E0283]: type annotations needed
--> $DIR/multidispatch-convert-ambig-dest.rs:26:5
|
@@ -37,7 +26,6 @@ help: consider specifying the generic arguments
LL | test::<i32, U>(22, std::default::Default::default());
| ++++++++++
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.rs b/tests/ui/traits/new-solver/alias-bound-unsound.rs
index 38d83d289..825e874d7 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.rs
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.rs
@@ -27,6 +27,5 @@ fn main() {
//~| ERROR overflow evaluating the requirement `<() as Foo>::Item well-formed`
//~| ERROR overflow evaluating the requirement `String <: <() as Foo>::Item`
//~| ERROR overflow evaluating the requirement `&<() as Foo>::Item well-formed`
- //~| ERROR type annotations needed
println!("{x}");
}
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.stderr b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
index abc6677c1..ca4b5c90f 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.stderr
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
@@ -11,18 +11,7 @@ note: required by a bound in `Foo::Item`
LL | type Item: Copy
| ^^^^ required by this bound in `Foo::Item`
-error[E0282]: type annotations needed
- --> $DIR/alias-bound-unsound.rs:24:5
- |
-LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^ cannot infer type of the type parameter `T` declared on the function `drop`
- |
-help: consider specifying the generic argument
- |
-LL | drop::<T>(<() as Foo>::copy_me(&x));
- | +++++
-
-error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item`
--> $DIR/alias-bound-unsound.rs:24:31
|
LL | drop(<() as Foo>::copy_me(&x));
@@ -30,40 +19,39 @@ LL | drop(<() as Foo>::copy_me(&x));
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item`
- --> $DIR/alias-bound-unsound.rs:24:31
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _`
+ --> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed`
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Sized`
--> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
+ = note: the return type of a function must have a statically known size
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _`
- --> $DIR/alias-bound-unsound.rs:24:10
+error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+ --> $DIR/alias-bound-unsound.rs:24:31
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Sized`
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed`
--> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
- = note: the return type of a function must have a statically known size
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
index 47004821a..414deb477 100644
--- a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
+++ b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
@@ -1,9 +1,16 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/runaway-impl-candidate-selection.rs:13:22
|
LL | println!("{:?}", iter::<_>());
| ^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `iter`
+ |
+ = note: cannot satisfy `_: Iterator`
+note: required by a bound in `iter`
+ --> $DIR/runaway-impl-candidate-selection.rs:8:12
+ |
+LL | fn iter<T: Iterator>() -> <T as Iterator>::Item {
+ | ^^^^^^^^ required by this bound in `iter`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/coherence/issue-102048.stderr b/tests/ui/traits/new-solver/coherence/issue-102048.stderr
index 17a43838f..41bf68a1d 100644
--- a/tests/ui/traits/new-solver/coherence/issue-102048.stderr
+++ b/tests/ui/traits/new-solver/coherence/issue-102048.stderr
@@ -1,11 +1,15 @@
error[E0119]: conflicting implementations of trait `Trait<for<'a> fn(<_ as WithAssoc1<'a>>::Assoc, <_ as WithAssoc2<'a>>::Assoc)>` for type `(_, _)`
--> $DIR/issue-102048.rs:39:1
|
-LL | impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
- | --------------------------------------------------------------------------------------------------- first implementation here
+LL | / impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
+LL | | where
+LL | | T: for<'a> WithAssoc1<'a> + for<'a> WithAssoc2<'a, Assoc = i32>,
+LL | | U: for<'a> WithAssoc2<'a>,
+ | |______________________________- first implementation here
...
-LL | impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)`
+LL | / impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
+LL | | U: for<'a> WithAssoc1<'a>
+ | |_____________________________^ conflicting implementation for `(_, _)`
error: aborting due to previous error
diff --git a/tests/ui/traits/new-solver/coroutine.fail.stderr b/tests/ui/traits/new-solver/coroutine.fail.stderr
new file mode 100644
index 000000000..14e67727d
--- /dev/null
+++ b/tests/ui/traits/new-solver/coroutine.fail.stderr
@@ -0,0 +1,64 @@
+error[E0277]: the trait bound `{coroutine@$DIR/coroutine.rs:18:21: 18:23}: Coroutine<A>` is not satisfied
+ --> $DIR/coroutine.rs:18:21
+ |
+LL | needs_coroutine(|| {
+ | _____---------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | |
+LL | |
+LL | | yield ();
+LL | | });
+ | |_____^ the trait `Coroutine<A>` is not implemented for `{coroutine@$DIR/coroutine.rs:18:21: 18:23}`
+ |
+note: required by a bound in `needs_coroutine`
+ --> $DIR/coroutine.rs:14:28
+ |
+LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_coroutine`
+
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:18:21: 18:23} as Coroutine<A>>::Yield == B`
+ --> $DIR/coroutine.rs:18:21
+ |
+LL | needs_coroutine(|| {
+ | _____---------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | |
+LL | |
+LL | | yield ();
+LL | | });
+ | |_____^ types differ
+ |
+note: required by a bound in `needs_coroutine`
+ --> $DIR/coroutine.rs:14:41
+ |
+LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+ | ^^^^^^^^^ required by this bound in `needs_coroutine`
+
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:18:21: 18:23} as Coroutine<A>>::Return == C`
+ --> $DIR/coroutine.rs:18:21
+ |
+LL | needs_coroutine(|| {
+ | _____---------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | |
+LL | |
+LL | | yield ();
+LL | | });
+ | |_____^ types differ
+ |
+note: required by a bound in `needs_coroutine`
+ --> $DIR/coroutine.rs:14:52
+ |
+LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+ | ^^^^^^^^^^ required by this bound in `needs_coroutine`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0271, E0277.
+For more information about an error, try `rustc --explain E0271`.
diff --git a/tests/ui/traits/new-solver/coroutine.rs b/tests/ui/traits/new-solver/coroutine.rs
new file mode 100644
index 000000000..af16f70fb
--- /dev/null
+++ b/tests/ui/traits/new-solver/coroutine.rs
@@ -0,0 +1,32 @@
+// compile-flags: -Ztrait-solver=next
+// edition: 2021
+// revisions: pass fail
+//[pass] check-pass
+
+#![feature(coroutine_trait, coroutines)]
+
+use std::ops::Coroutine;
+
+struct A;
+struct B;
+struct C;
+
+fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+
+#[cfg(fail)]
+fn main() {
+ needs_coroutine(|| {
+ //[fail]~^ ERROR Coroutine<A>` is not satisfied
+ //[fail]~| ERROR as Coroutine<A>>::Yield == B`
+ //[fail]~| ERROR as Coroutine<A>>::Return == C`
+ yield ();
+ });
+}
+
+#[cfg(pass)]
+fn main() {
+ needs_coroutine(|_: A| {
+ let _: A = yield B;
+ C
+ })
+}
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
index fcafdcf63..44e763ef9 100644
--- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
@@ -27,6 +27,5 @@ fn impls<T: Trait>() {}
fn main() {
impls::<W<_>>();
- //~^ ERROR type annotations needed
- //~| ERROR overflow evaluating the requirement
+ //~^ ERROR overflow evaluating the requirement
}
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
index a86115671..1ac0e2977 100644
--- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/fixpoint-exponential-growth.rs:29:5
- |
-LL | impls::<W<_>>();
- | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
-
error[E0275]: overflow evaluating the requirement `W<_>: Trait`
--> $DIR/fixpoint-exponential-growth.rs:29:13
|
@@ -17,7 +11,6 @@ note: required by a bound in `impls`
LL | fn impls<T: Trait>() {}
| ^^^^^ required by this bound in `impls`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs b/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs
new file mode 100644
index 000000000..51f62bc23
--- /dev/null
+++ b/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs
@@ -0,0 +1,10 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+trait Foo {
+ fn test() -> impl Fn(u32) -> u32 {
+ |x| x.count_ones()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
index 7ad495a35..368f5cd0c 100644
--- a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
+++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
@@ -13,7 +13,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `()`
LL | impl Foo for () {}
| --------------- first implementation here
LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {}
- | ^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/new-solver/fn-trait.rs b/tests/ui/traits/new-solver/fn-trait.rs
index 0599e51d7..0a19e6265 100644
--- a/tests/ui/traits/new-solver/fn-trait.rs
+++ b/tests/ui/traits/new-solver/fn-trait.rs
@@ -18,15 +18,15 @@ fn main() {
require_fn(f);
require_fn(f as fn() -> i32);
require_fn(f as unsafe fn() -> i32);
- //~^ ERROR: expected a `Fn<()>` closure, found `unsafe fn() -> i32`
+ //~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32`
//~| ERROR: type mismatch resolving `<unsafe fn() -> i32 as FnOnce<()>>::Output == i32`
require_fn(g);
- //~^ ERROR: expected a `Fn<()>` closure, found `extern "C" fn() -> i32 {g}`
+ //~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
//~| ERROR: type mismatch resolving `<extern "C" fn() -> i32 {g} as FnOnce<()>>::Output == i32`
require_fn(g as extern "C" fn() -> i32);
- //~^ ERROR: expected a `Fn<()>` closure, found `extern "C" fn() -> i32`
+ //~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32`
//~| ERROR: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output == i32`
require_fn(h);
- //~^ ERROR: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}`
+ //~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
//~| ERROR: type mismatch resolving `<unsafe fn() -> i32 {h} as FnOnce<()>>::Output == i32`
}
diff --git a/tests/ui/traits/new-solver/fn-trait.stderr b/tests/ui/traits/new-solver/fn-trait.stderr
index d52bcaf25..e33487235 100644
--- a/tests/ui/traits/new-solver/fn-trait.stderr
+++ b/tests/ui/traits/new-solver/fn-trait.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32`
+error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32`
--> $DIR/fn-trait.rs:20:16
|
LL | require_fn(f as unsafe fn() -> i32);
@@ -7,6 +7,7 @@ LL | require_fn(f as unsafe fn() -> i32);
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for `unsafe fn() -> i32`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() -> i32` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `require_fn`
--> $DIR/fn-trait.rs:3:23
@@ -28,11 +29,11 @@ note: required by a bound in `require_fn`
LL | fn require_fn(_: impl Fn() -> i32) {}
| ^^^ required by this bound in `require_fn`
-error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32 {g}`
+error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
--> $DIR/fn-trait.rs:23:16
|
LL | require_fn(g);
- | ---------- ^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32 {g}`
+ | ---------- ^ expected an `Fn()` closure, found `extern "C" fn() -> i32 {g}`
| |
| required by a bound introduced by this call
|
@@ -58,11 +59,11 @@ note: required by a bound in `require_fn`
LL | fn require_fn(_: impl Fn() -> i32) {}
| ^^^ required by this bound in `require_fn`
-error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32`
+error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32`
--> $DIR/fn-trait.rs:26:16
|
LL | require_fn(g as extern "C" fn() -> i32);
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn()` closure, found `extern "C" fn() -> i32`
| |
| required by a bound introduced by this call
|
@@ -88,7 +89,7 @@ note: required by a bound in `require_fn`
LL | fn require_fn(_: impl Fn() -> i32) {}
| ^^^ required by this bound in `require_fn`
-error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}`
+error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
--> $DIR/fn-trait.rs:29:16
|
LL | require_fn(h);
@@ -97,6 +98,7 @@ LL | require_fn(h);
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for fn item `unsafe fn() -> i32 {h}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() -> i32 {h}` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `require_fn`
--> $DIR/fn-trait.rs:3:23
diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
index 9a8060133..9aa4f4531 100644
--- a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
+++ b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
@@ -1,9 +1,18 @@
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed: cannot satisfy `<<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc == <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
--> $DIR/generalize-proj-new-universe-index-2.rs:74:5
|
LL | bound::<<Rigid as IdHigherRankedBound>::Assoc, <Wrapper<Leaf> as Id>::Assoc, _>()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `V` declared on the function `bound`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc == <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
+ |
+note: required by a bound in `bound`
+ --> $DIR/generalize-proj-new-universe-index-2.rs:69:21
+ |
+LL | fn bound<T: ?Sized, U: ?Sized, V: ?Sized>()
+ | ----- required by a bound in this function
+LL | where
+LL | T: WithAssoc<U, Assoc = V>,
+ | ^^^^^^^^^ required by this bound in `bound`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/traits/new-solver/generator.fail.stderr b/tests/ui/traits/new-solver/generator.fail.stderr
deleted file mode 100644
index e3fe4bf5a..000000000
--- a/tests/ui/traits/new-solver/generator.fail.stderr
+++ /dev/null
@@ -1,64 +0,0 @@
-error[E0277]: the trait bound `{generator@$DIR/generator.rs:18:21: 18:23}: Generator<A>` is not satisfied
- --> $DIR/generator.rs:18:21
- |
-LL | needs_generator(|| {
- | _____---------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | |
-LL | |
-LL | | yield ();
-LL | | });
- | |_____^ the trait `Generator<A>` is not implemented for `{generator@$DIR/generator.rs:18:21: 18:23}`
- |
-note: required by a bound in `needs_generator`
- --> $DIR/generator.rs:14:28
- |
-LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_generator`
-
-error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator<A>>::Yield == B`
- --> $DIR/generator.rs:18:21
- |
-LL | needs_generator(|| {
- | _____---------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | |
-LL | |
-LL | | yield ();
-LL | | });
- | |_____^ types differ
- |
-note: required by a bound in `needs_generator`
- --> $DIR/generator.rs:14:41
- |
-LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
- | ^^^^^^^^^ required by this bound in `needs_generator`
-
-error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator<A>>::Return == C`
- --> $DIR/generator.rs:18:21
- |
-LL | needs_generator(|| {
- | _____---------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | |
-LL | |
-LL | | yield ();
-LL | | });
- | |_____^ types differ
- |
-note: required by a bound in `needs_generator`
- --> $DIR/generator.rs:14:52
- |
-LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
- | ^^^^^^^^^^ required by this bound in `needs_generator`
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0271, E0277.
-For more information about an error, try `rustc --explain E0271`.
diff --git a/tests/ui/traits/new-solver/generator.rs b/tests/ui/traits/new-solver/generator.rs
deleted file mode 100644
index 364373ca8..000000000
--- a/tests/ui/traits/new-solver/generator.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// compile-flags: -Ztrait-solver=next
-// edition: 2021
-// revisions: pass fail
-//[pass] check-pass
-
-#![feature(generator_trait, generators)]
-
-use std::ops::Generator;
-
-struct A;
-struct B;
-struct C;
-
-fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
-
-#[cfg(fail)]
-fn main() {
- needs_generator(|| {
- //[fail]~^ ERROR Generator<A>` is not satisfied
- //[fail]~| ERROR as Generator<A>>::Yield == B`
- //[fail]~| ERROR as Generator<A>>::Return == C`
- yield ();
- });
-}
-
-#[cfg(pass)]
-fn main() {
- needs_generator(|_: A| {
- let _: A = yield B;
- C
- })
-}
diff --git a/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs b/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs
new file mode 100644
index 000000000..cc16cc871
--- /dev/null
+++ b/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs
@@ -0,0 +1,9 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+// edition:2021
+
+trait Foo {
+ async fn bar() {}
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
index 062832012..f482e8cfa 100644
--- a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
+++ b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
@@ -1,9 +1,17 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/normalizes_to_ignores_unnormalizable_candidate.rs:36:5
|
LL | foo(unconstrained())
- | ^^^ cannot infer type of the type parameter `T` declared on the function `foo`
+ | ^^^ --------------- type must be known at this point
+ | |
+ | cannot infer type of the type parameter `T` declared on the function `foo`
|
+ = note: cannot satisfy `_: Trait`
+note: required by a bound in `foo`
+ --> $DIR/normalizes_to_ignores_unnormalizable_candidate.rs:19:11
+ |
+LL | fn foo<T: Trait<Assoc = u8>>(x: T) {}
+ | ^^^^^^^^^^^^^^^^^ required by this bound in `foo`
help: consider specifying the generic argument
|
LL | foo::<T>(unconstrained())
@@ -11,4 +19,4 @@ LL | foo::<T>(unconstrained())
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/object-unsafety.stderr b/tests/ui/traits/new-solver/object-unsafety.stderr
index bb7c68b89..914a8f9d4 100644
--- a/tests/ui/traits/new-solver/object-unsafety.stderr
+++ b/tests/ui/traits/new-solver/object-unsafety.stderr
@@ -42,7 +42,7 @@ error[E0308]: mismatched types
LL | pub fn copy_any<T>(t: &T) -> T {
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
LL | copy::<dyn Setup<From=T>>(t)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
index b37f09ee1..3d2e70a63 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
@@ -15,6 +15,5 @@ fn impls<T: Trait>() {}
fn main() {
impls::<W<_>>();
- //~^ ERROR type annotations needed
- //~| ERROR overflow evaluating the requirement `W<_>: Trait`
+ //~^ ERROR overflow evaluating the requirement `W<_>: Trait`
}
diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
index beed40f36..023efc41a 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/exponential-trait-goals.rs:17:5
- |
-LL | impls::<W<_>>();
- | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
-
error[E0275]: overflow evaluating the requirement `W<_>: Trait`
--> $DIR/exponential-trait-goals.rs:17:13
|
@@ -17,7 +11,6 @@ note: required by a bound in `impls`
LL | fn impls<T: Trait>() {}
| ^^^^^ required by this bound in `impls`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/specialization-transmute.rs b/tests/ui/traits/new-solver/specialization-transmute.rs
index f6b19e7ad..fac7d76f8 100644
--- a/tests/ui/traits/new-solver/specialization-transmute.rs
+++ b/tests/ui/traits/new-solver/specialization-transmute.rs
@@ -10,7 +10,7 @@ trait Default {
}
impl<T> Default for T {
- default type Id = T;
+ default type Id = T; //~ ERROR type annotations needed
// This will be fixed by #111994
fn intu(&self) -> &Self::Id { //~ ERROR type annotations needed
self
diff --git a/tests/ui/traits/new-solver/specialization-transmute.stderr b/tests/ui/traits/new-solver/specialization-transmute.stderr
index 09b1405fe..18965a465 100644
--- a/tests/ui/traits/new-solver/specialization-transmute.stderr
+++ b/tests/ui/traits/new-solver/specialization-transmute.stderr
@@ -16,6 +16,13 @@ LL | fn intu(&self) -> &Self::Id {
|
= note: cannot satisfy `<T as Default>::Id == _`
-error: aborting due to previous error; 1 warning emitted
+error[E0282]: type annotations needed
+ --> $DIR/specialization-transmute.rs:13:23
+ |
+LL | default type Id = T;
+ | ^ cannot infer type for associated type `<T as Default>::Id`
+
+error: aborting due to 2 previous errors; 1 warning emitted
-For more information about this error, try `rustc --explain E0284`.
+Some errors have detailed explanations: E0282, E0284.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.stderr b/tests/ui/traits/new-solver/specialization-unconstrained.stderr
index 9915da1a2..ed4dafa14 100644
--- a/tests/ui/traits/new-solver/specialization-unconstrained.stderr
+++ b/tests/ui/traits/new-solver/specialization-unconstrained.stderr
@@ -8,12 +8,6 @@ LL | #![feature(specialization)]
= help: consider using `min_specialization` instead, which is more stable and complete
= note: `#[warn(incomplete_features)]` on by default
-error[E0282]: type annotations needed
- --> $DIR/specialization-unconstrained.rs:14:22
- |
-LL | default type Id = T;
- | ^ cannot infer type for associated type `<T as Default>::Id`
-
error[E0284]: type annotations needed: cannot satisfy `<u32 as Default>::Id == ()`
--> $DIR/specialization-unconstrained.rs:20:5
|
@@ -26,6 +20,12 @@ note: required by a bound in `test`
LL | fn test<T: Default<Id = U>, U>() {}
| ^^^^^^ required by this bound in `test`
+error[E0282]: type annotations needed
+ --> $DIR/specialization-unconstrained.rs:14:22
+ |
+LL | default type Id = T;
+ | ^ cannot infer type for associated type `<T as Default>::Id`
+
error: aborting due to 2 previous errors; 1 warning emitted
Some errors have detailed explanations: E0282, E0284.
diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr b/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr
new file mode 100644
index 000000000..9f373cc50
--- /dev/null
+++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/non-lifetime-via-dyn-builtin.rs:5:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr b/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr
new file mode 100644
index 000000000..9f373cc50
--- /dev/null
+++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/non-lifetime-via-dyn-builtin.rs:5:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.rs b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs
new file mode 100644
index 000000000..9a8a5ced2
--- /dev/null
+++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs
@@ -0,0 +1,16 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+// check-pass
+
+#![feature(non_lifetime_binders)]
+//~^ WARN the feature `non_lifetime_binders` is incomplete and may not be safe
+
+fn trivial<A>()
+where
+ for<B> dyn Fn(A, *const B): Fn(A, *const B),
+{
+}
+
+fn main() {
+ trivial::<u8>();
+}
diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
index ed9b57cb1..d8db07277 100644
--- a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
+++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
@@ -23,13 +23,13 @@ LL | where
LL | for<V> V: Sized,
| ^^^^^ required by this bound in `foo`
-error[E0277]: the size for values of type `V` cannot be known at compilation time
+error[E0277]: `V` is not an iterator
--> $DIR/bad-sized-cond.rs:20:5
|
LL | bar();
- | ^^^ doesn't have a size known at compile-time
+ | ^^^ `V` is not an iterator
|
- = help: the trait `Sized` is not implemented for `V`
+ = help: the trait `Iterator` is not implemented for `V`
= note: required for `V` to implement `IntoIterator`
note: required by a bound in `bar`
--> $DIR/bad-sized-cond.rs:12:15
@@ -40,13 +40,13 @@ LL | where
LL | for<V> V: IntoIterator,
| ^^^^^^^^^^^^ required by this bound in `bar`
-error[E0277]: `V` is not an iterator
+error[E0277]: the size for values of type `V` cannot be known at compilation time
--> $DIR/bad-sized-cond.rs:20:5
|
LL | bar();
- | ^^^ `V` is not an iterator
+ | ^^^ doesn't have a size known at compile-time
|
- = help: the trait `Iterator` is not implemented for `V`
+ = help: the trait `Sized` is not implemented for `V`
= note: required for `V` to implement `IntoIterator`
note: required by a bound in `bar`
--> $DIR/bad-sized-cond.rs:12:15
diff --git a/tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs b/tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs
new file mode 100644
index 000000000..b999f251d
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+trait Foo {
+ type Bar<T>
+ where
+ dyn Send + 'static: Send;
+}
+
+impl Foo for () {
+ type Bar<T> = i32;
+ // We take `<() as Foo>::Bar<T>: Sized` and normalize it under the where clause
+ // of `for<S> <() as Foo>::Bar<S> = i32`. This gives us back `i32: Send` with
+ // the nested obligation `(dyn Send + 'static): Send`. However, during candidate
+ // assembly for object types, we disqualify any obligations that has non-region
+ // late-bound vars in the param env(!), rather than just the predicate. This causes
+ // the where clause to not hold even though it trivially should.
+}
+
+fn main() {}
diff --git a/tests/ui/traits/non_lifetime_binders/on-rpit.rs b/tests/ui/traits/non_lifetime_binders/on-rpit.rs
new file mode 100644
index 000000000..c501e057e
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/on-rpit.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(non_lifetime_binders)]
+//~^ WARN the feature `non_lifetime_binders` is incomplete
+
+trait Trait<T: ?Sized> {}
+
+impl<T: ?Sized> Trait<T> for i32 {}
+
+fn produce() -> impl for<T> Trait<T> {
+ 16
+}
+
+fn main() {
+ let _ = produce();
+}
diff --git a/tests/ui/traits/non_lifetime_binders/on-rpit.stderr b/tests/ui/traits/non_lifetime_binders/on-rpit.stderr
new file mode 100644
index 000000000..34c56068c
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/on-rpit.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/on-rpit.rs:3:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
index d56519223..b6e540c5f 100644
--- a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
+++ b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
@@ -20,6 +20,7 @@ LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
= note: required for the cast from `&()` to `&dyn Foo`
error[E0038]: the trait `Foo` cannot be made into an object
@@ -35,6 +36,7 @@ LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/supertrait-object-safety.rs:22:5
@@ -49,6 +51,7 @@ LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
error: aborting due to 3 previous errors; 1 warning emitted
diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
index 538e74ee1..e9e2f6b12 100644
--- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
+++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
@@ -18,7 +18,5 @@ where
fn main() {
let a = A(B);
- a.method();
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ a.method(); //~ ERROR type annotations needed
}
diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
index 92d9d32cf..86ae49b32 100644
--- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
+++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7
- |
-LL | a.method();
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <A<B> as V<U>>::method(a);
- | +++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7
|
@@ -35,7 +24,6 @@ help: try using a fully qualified path to specify the expected types
LL | <A<B> as V<U>>::method(a);
| +++++++++++++++++++++++ ~
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/object/object-unsafe-missing-assoc-type.rs b/tests/ui/traits/object/object-unsafe-missing-assoc-type.rs
new file mode 100644
index 000000000..21f7fd92e
--- /dev/null
+++ b/tests/ui/traits/object/object-unsafe-missing-assoc-type.rs
@@ -0,0 +1,7 @@
+trait Foo {
+ type Bar<T>;
+}
+
+fn bar(x: &dyn Foo) {} //~ ERROR the trait `Foo` cannot be made into an object
+
+fn main() {}
diff --git a/tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr b/tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr
new file mode 100644
index 000000000..fcaa583e2
--- /dev/null
+++ b/tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr
@@ -0,0 +1,18 @@
+error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/object-unsafe-missing-assoc-type.rs:5:16
+ |
+LL | fn bar(x: &dyn Foo) {}
+ | ^^^ `Foo` cannot be made into an object
+ |
+note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+ --> $DIR/object-unsafe-missing-assoc-type.rs:2:10
+ |
+LL | trait Foo {
+ | --- this trait cannot be made into an object...
+LL | type Bar<T>;
+ | ^^^ ...because it contains the generic associated type `Bar`
+ = help: consider moving `Bar` to another trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/traits/object/print_vtable_sizes.stdout b/tests/ui/traits/object/print_vtable_sizes.stdout
index ce90c7621..b43e168df 100644
--- a/tests/ui/traits/object/print_vtable_sizes.stdout
+++ b/tests/ui/traits/object/print_vtable_sizes.stdout
@@ -1,11 +1,11 @@
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "E", "entries": "6", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "2", "upcasting_cost_percent": "50" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "G", "entries": "14", "entries_ignoring_upcasting": "11", "entries_for_upcasting": "3", "upcasting_cost_percent": "27.27272727272727" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "A", "entries": "6", "entries_ignoring_upcasting": "5", "entries_for_upcasting": "1", "upcasting_cost_percent": "20" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "B", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "D", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "F", "entries": "6", "entries_ignoring_upcasting": "6", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "help::MarkerWithSuper", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "help::Super", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "help::V", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "E", "entries": "6", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "2", "upcasting_cost_percent": "50" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "G", "entries": "14", "entries_ignoring_upcasting": "11", "entries_for_upcasting": "3", "upcasting_cost_percent": "27.27272727272727" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "A", "entries": "6", "entries_ignoring_upcasting": "5", "entries_for_upcasting": "1", "upcasting_cost_percent": "20" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "B", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "D", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "F", "entries": "6", "entries_ignoring_upcasting": "6", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::MarkerWithSuper", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::Super", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::V", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
diff --git a/tests/ui/traits/object/safety.stderr b/tests/ui/traits/object/safety.stderr
index a51b69759..19a46a502 100644
--- a/tests/ui/traits/object/safety.stderr
+++ b/tests/ui/traits/object/safety.stderr
@@ -11,6 +11,7 @@ LL | trait Tr {
| -- this trait cannot be made into an object...
LL | fn foo();
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `St` implements the trait, consider using it directly instead
= note: required for the cast from `&St` to `&dyn Tr`
help: consider turning `foo` into a method by giving it a `&self` argument
|
@@ -34,6 +35,7 @@ LL | trait Tr {
| -- this trait cannot be made into an object...
LL | fn foo();
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `St` implements the trait, consider using it directly instead
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self);
diff --git a/tests/ui/traits/object/with-self-in-projection-output-bad.rs b/tests/ui/traits/object/with-self-in-projection-output-bad.rs
index f34fa80a0..9515397fb 100644
--- a/tests/ui/traits/object/with-self-in-projection-output-bad.rs
+++ b/tests/ui/traits/object/with-self-in-projection-output-bad.rs
@@ -43,8 +43,8 @@ impl NormalizableHelper for u32
fn main() {
let _x: Box<dyn Helper<Target=i32>> = Box::new(2u32);
- //~^ ERROR the value of the associated type `Output` (from trait `Base`) must be specified
+ //~^ ERROR the value of the associated type `Output` in `Base` must be specified
let _y: Box<dyn NormalizableHelper<Target=i32>> = Box::new(2u32);
- //~^ ERROR the value of the associated type `Output` (from trait `Base`) must be specified
+ //~^ ERROR the value of the associated type `Output` in `Base` must be specified
}
diff --git a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr
index 641bfe236..c9b36e8d2 100644
--- a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr
+++ b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Output` (from trait `Base`) must be specified
+error[E0191]: the value of the associated type `Output` in `Base` must be specified
--> $DIR/with-self-in-projection-output-bad.rs:45:21
|
LL | type Output;
@@ -7,7 +7,7 @@ LL | type Output;
LL | let _x: Box<dyn Helper<Target=i32>> = Box::new(2u32);
| ^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Helper<Target=i32, Output = Type>`
-error[E0191]: the value of the associated type `Output` (from trait `Base`) must be specified
+error[E0191]: the value of the associated type `Output` in `Base` must be specified
--> $DIR/with-self-in-projection-output-bad.rs:48:21
|
LL | type Output;
diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.fixed b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
index 7a8433f90..d03d733c7 100644
--- a/tests/ui/traits/suggest-dereferences/root-obligation.fixed
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
@@ -4,7 +4,7 @@ fn get_vowel_count(string: &str) -> usize {
string
.chars()
.filter(|c| "aeiou".contains(*c))
- //~^ ERROR expected a `Fn<(char,)>` closure, found `char`
+ //~^ ERROR expected a `Fn(char)` closure, found `char`
.count()
}
diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.rs b/tests/ui/traits/suggest-dereferences/root-obligation.rs
index 51bac2107..9d9ffb3f5 100644
--- a/tests/ui/traits/suggest-dereferences/root-obligation.rs
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.rs
@@ -4,7 +4,7 @@ fn get_vowel_count(string: &str) -> usize {
string
.chars()
.filter(|c| "aeiou".contains(c))
- //~^ ERROR expected a `Fn<(char,)>` closure, found `char`
+ //~^ ERROR expected a `Fn(char)` closure, found `char`
.count()
}
diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.stderr b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
index 1363fb8c4..a19708e46 100644
--- a/tests/ui/traits/suggest-dereferences/root-obligation.stderr
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(char,)>` closure, found `char`
+error[E0277]: expected a `Fn(char)` closure, found `char`
--> $DIR/root-obligation.rs:6:38
|
LL | .filter(|c| "aeiou".contains(c))
- | -------- ^ expected an `Fn<(char,)>` closure, found `char`
+ | -------- ^ expected an `Fn(char)` closure, found `char`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr
index 2aea3783f..43cef7027 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/suggest-fully-qualified-closure.rs:23:7
- |
-LL | q.lol(||());
- | ^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
- | +++ ~
-
error[E0283]: type annotations needed
--> $DIR/suggest-fully-qualified-closure.rs:23:7
|
@@ -28,7 +17,6 @@ help: try using a fully qualified path to specify the expected types
LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
| +++ ~
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
index 9a2cf469d..f0861857b 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
+++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
@@ -42,9 +42,7 @@ impl<T> DerefMut for DerefsTo<T> {
fn main() {
let mut thing = Thing;
- thing.method();
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ thing.method(); //~ ERROR type annotations needed
thing.mut_method(); //~ ERROR type annotations needed
thing.by_self(); //~ ERROR type annotations needed
diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
index 68b31a1ca..841acb5ff 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11
- |
-LL | thing.method();
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Thing as Method<T>>::method(&thing);
- | ++++++++++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11
|
@@ -29,7 +18,7 @@ LL | <Thing as Method<T>>::method(&thing);
| ++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:48:11
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:46:11
|
LL | thing.mut_method();
| ^^^^^^^^^^
@@ -48,7 +37,7 @@ LL | <Thing as Method<T>>::mut_method(&mut thing);
| +++++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:49:11
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:47:11
|
LL | thing.by_self();
| ^^^^^^^
@@ -67,7 +56,7 @@ LL | <&Thing as MethodRef<T>>::by_self(&thing);
| +++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:50:14
|
LL | deref_to.method();
| ^^^^^^
@@ -86,7 +75,7 @@ LL | <Thing as Method<T>>::method(&deref_to);
| ++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:53:14
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:51:14
|
LL | deref_to.mut_method();
| ^^^^^^^^^^
@@ -105,7 +94,7 @@ LL | <Thing as Method<T>>::mut_method(&mut deref_to);
| +++++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:54:14
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14
|
LL | deref_to.by_self();
| ^^^^^^^
@@ -124,7 +113,7 @@ LL | <&Thing as MethodRef<T>>::by_self(&deref_to);
| +++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:55:20
|
LL | deref_deref_to.method();
| ^^^^^^
@@ -143,7 +132,7 @@ LL | <Thing as Method<T>>::method(&deref_deref_to);
| ++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:58:20
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:56:20
|
LL | deref_deref_to.mut_method();
| ^^^^^^^^^^
@@ -162,7 +151,7 @@ LL | <Thing as Method<T>>::mut_method(&mut deref_deref_to);
| +++++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:59:20
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20
|
LL | deref_deref_to.by_self();
| ^^^^^^^
@@ -180,7 +169,6 @@ help: try using a fully qualified path to specify the expected types
LL | <&Thing as MethodRef<T>>::by_self(&deref_deref_to);
| +++++++++++++++++++++++++++++++++++ ~
-error: aborting due to 10 previous errors
+error: aborting due to 9 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
index da640c8c8..6a63e27f7 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
+++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
@@ -42,9 +42,7 @@ impl<T> DerefMut for DerefsTo<T> {
fn main() {
let mut ref_thing = &Thing;
- ref_thing.method();
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ ref_thing.method(); //~ ERROR type annotations needed
ref_thing.by_self(); //~ ERROR type annotations needed
let mut mut_thing = &mut Thing;
diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
index 27518a54e..1865d81ba 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15
- |
-LL | ref_thing.method();
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Thing as Method<T>>::method(ref_thing);
- | +++++++++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15
|
@@ -29,7 +18,7 @@ LL | <Thing as Method<T>>::method(ref_thing);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:48:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:46:15
|
LL | ref_thing.by_self();
| ^^^^^^^
@@ -48,7 +37,7 @@ LL | <&Thing as MethodRef<T>>::by_self(ref_thing);
| ++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:49:15
|
LL | mut_thing.method();
| ^^^^^^
@@ -67,7 +56,7 @@ LL | <Thing as Method<T>>::method(mut_thing);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:52:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:50:15
|
LL | mut_thing.mut_method();
| ^^^^^^^^^^
@@ -86,7 +75,7 @@ LL | <Thing as Method<T>>::mut_method(mut_thing);
| +++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:53:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15
|
LL | mut_thing.by_self();
| ^^^^^^^
@@ -105,7 +94,7 @@ LL | <&Thing as MethodRef<T>>::by_self(mut_thing);
| ++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:54:14
|
LL | deref_to.method();
| ^^^^^^
@@ -124,7 +113,7 @@ LL | <Thing as Method<T>>::method(deref_to);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:57:14
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:55:14
|
LL | deref_to.mut_method();
| ^^^^^^^^^^
@@ -143,7 +132,7 @@ LL | <Thing as Method<T>>::mut_method(deref_to);
| +++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:58:14
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14
|
LL | deref_to.by_self();
| ^^^^^^^
@@ -162,7 +151,7 @@ LL | <&Thing as MethodRef<T>>::by_self(deref_to);
| ++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:59:20
|
LL | deref_deref_to.method();
| ^^^^^^
@@ -181,7 +170,7 @@ LL | <Thing as Method<T>>::method(deref_deref_to);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:62:20
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:60:20
|
LL | deref_deref_to.mut_method();
| ^^^^^^^^^^
@@ -200,7 +189,7 @@ LL | <Thing as Method<T>>::mut_method(deref_deref_to);
| +++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:63:20
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20
|
LL | deref_deref_to.by_self();
| ^^^^^^^
@@ -218,7 +207,6 @@ help: try using a fully qualified path to specify the expected types
LL | <&Thing as MethodRef<T>>::by_self(deref_deref_to);
| ++++++++++++++++++++++++++++++++++ ~
-error: aborting due to 12 previous errors
+error: aborting due to 11 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr
index 74a0fc427..3972e5397 100644
--- a/tests/ui/traits/test-2.stderr
+++ b/tests/ui/traits/test-2.stderr
@@ -42,6 +42,9 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
+ i32
+ u32
error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/test-2.rs:13:5
@@ -59,6 +62,9 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
+ i32
+ u32
error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/test-2.rs:13:6
@@ -76,6 +82,9 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
+ i32
+ u32
= note: required for the cast from `Box<{integer}>` to `Box<dyn bar>`
error: aborting due to 5 previous errors
diff --git a/tests/ui/try-block/try-block-bad-type.stderr b/tests/ui/try-block/try-block-bad-type.stderr
index e11c3f810..b41bf86d3 100644
--- a/tests/ui/try-block/try-block-bad-type.stderr
+++ b/tests/ui/try-block/try-block-bad-type.stderr
@@ -6,6 +6,7 @@ LL | Err("")?;
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the trait `From<Infallible>` is implemented for `TryFromSliceError`
+ = help: for that trait implementation, expected `Infallible`, found `&str`
= note: required for `Result<u32, TryFromSliceError>` to implement `FromResidual<Result<Infallible, &str>>`
error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str`
diff --git a/tests/ui/try-trait/bad-interconversion.stderr b/tests/ui/try-trait/bad-interconversion.stderr
index 7eb392faa..d8b9431be 100644
--- a/tests/ui/try-trait/bad-interconversion.stderr
+++ b/tests/ui/try-trait/bad-interconversion.stderr
@@ -73,7 +73,8 @@ LL | ControlFlow::Continue(Err("hello")?)
| ^ this `?` produces `Result<Infallible, &str>`, which is incompatible with `ControlFlow<String>`
|
= help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `ControlFlow<String>`
- = help: the trait `FromResidual` is implemented for `ControlFlow<B, C>`
+ = help: the trait `FromResidual<ControlFlow<String, Infallible>>` is implemented for `ControlFlow<String>`
+ = help: for that trait implementation, expected `ControlFlow<String, Infallible>`, found `Result<Infallible, &str>`
error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
--> $DIR/bad-interconversion.rs:37:12
@@ -84,7 +85,8 @@ LL | Some(3)?;
| ^ this `?` produces `Option<Infallible>`, which is incompatible with `ControlFlow<u64>`
|
= help: the trait `FromResidual<Option<Infallible>>` is not implemented for `ControlFlow<u64>`
- = help: the trait `FromResidual` is implemented for `ControlFlow<B, C>`
+ = help: the trait `FromResidual<ControlFlow<u64, Infallible>>` is implemented for `ControlFlow<u64>`
+ = help: for that trait implementation, expected `ControlFlow<u64, Infallible>`, found `Option<Infallible>`
error[E0277]: the `?` operator in a function that returns `ControlFlow<B, _>` can only be used on other `ControlFlow<B, _>`s (with the same Break type)
--> $DIR/bad-interconversion.rs:43:29
@@ -96,7 +98,8 @@ LL | ControlFlow::Break(4_u8)?;
|
= help: the trait `FromResidual<ControlFlow<u8, Infallible>>` is not implemented for `ControlFlow<i64>`
= note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow`
- = help: the trait `FromResidual` is implemented for `ControlFlow<B, C>`
+ = help: the trait `FromResidual<ControlFlow<i64, Infallible>>` is implemented for `ControlFlow<i64>`
+ = help: for that trait implementation, expected `i64`, found `u8`
error: aborting due to 8 previous errors
diff --git a/tests/ui/tuple/tuple-struct-fields/test2.stderr b/tests/ui/tuple/tuple-struct-fields/test2.stderr
index 64a9ac135..784411aba 100644
--- a/tests/ui/tuple/tuple-struct-fields/test2.stderr
+++ b/tests/ui/tuple/tuple-struct-fields/test2.stderr
@@ -22,6 +22,8 @@ error[E0412]: cannot find type `foo` in this scope
|
LL | define_struct! { (foo) }
| ^^^ not found in this scope
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/tuple/tuple-struct-fields/test3.stderr b/tests/ui/tuple/tuple-struct-fields/test3.stderr
index 75262ed57..00b07c031 100644
--- a/tests/ui/tuple/tuple-struct-fields/test3.stderr
+++ b/tests/ui/tuple/tuple-struct-fields/test3.stderr
@@ -22,6 +22,8 @@ error[E0412]: cannot find type `foo` in this scope
|
LL | define_struct! { foo }
| ^^^ not found in this scope
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
index e24cb1128..96a5c1327 100644
--- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
+++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:13:25
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
LL | fn ts_variant() {
LL | Self::TSVariant(());
| --------------- ^^ expected type parameter `T`, found `()`
@@ -50,7 +50,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:17:31
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::<()>::TSVariant(());
| --------------------- ^^ expected type parameter `T`, found `()`
@@ -98,7 +98,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:26:29
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::SVariant { v: () };
| ^^ expected type parameter `T`, found `()`
@@ -125,7 +125,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:28:35
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::SVariant::<()> { v: () };
| ^^ expected type parameter `T`, found `()`
@@ -158,7 +158,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:31:35
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::<()>::SVariant { v: () };
| ^^ expected type parameter `T`, found `()`
@@ -206,7 +206,7 @@ error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:34:41
|
LL | impl<T> Enum<T> {
- | - this type parameter
+ | - expected this type parameter
...
LL | Self::<()>::SVariant::<()> { v: () };
| ^^ expected type parameter `T`, found `()`
diff --git a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr
index 0202a2fea..359bd09ec 100644
--- a/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr
+++ b/tests/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr
@@ -36,6 +36,7 @@ note: `V` could also refer to the associated type defined here
|
LL | type V;
| ^^^^^^
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
index 660950d59..cad75cffe 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs
@@ -5,9 +5,6 @@
mod m {
pub type Foo = impl std::fmt::Debug;
- //~^ ERROR: cycle detected when computing type of opaque `m::Foo::{opaque#0}` [E0391]
- //~| ERROR: cycle detected when computing type of opaque `m::Foo::{opaque#0}` [E0391]
-
pub fn foo() -> Foo {
22_u32
}
diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
index d86988266..d47b1fe36 100644
--- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
+++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr
@@ -1,44 +1,5 @@
-error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
- --> $DIR/auto-trait-leakage3.rs:7:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires type-checking `m::bar`...
- --> $DIR/auto-trait-leakage3.rs:16:9
- |
-LL | is_send(foo());
- | ^^^^^^^
- = note: ...which requires evaluating trait selection obligation `m::Foo: core::marker::Send`...
- = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `m::Foo::{opaque#0}`
- --> $DIR/auto-trait-leakage3.rs:7:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
- --> $DIR/auto-trait-leakage3.rs:7:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires type-checking `m::bar`...
- --> $DIR/auto-trait-leakage3.rs:15:5
- |
-LL | pub fn bar() {
- | ^^^^^^^^^^^^
- = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `m::Foo::{opaque#0}`
- --> $DIR/auto-trait-leakage3.rs:7:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
error: cannot check whether the hidden type of `auto_trait_leakage3[211d]::m::Foo::{opaque#0}` satisfies auto traits
- --> $DIR/auto-trait-leakage3.rs:16:17
+ --> $DIR/auto-trait-leakage3.rs:13:17
|
LL | is_send(foo());
| ------- ^^^^^
@@ -51,16 +12,15 @@ note: opaque type is declared here
LL | pub type Foo = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/auto-trait-leakage3.rs:15:12
+ --> $DIR/auto-trait-leakage3.rs:12:12
|
LL | pub fn bar() {
| ^^^
note: required by a bound in `is_send`
- --> $DIR/auto-trait-leakage3.rs:20:19
+ --> $DIR/auto-trait-leakage3.rs:17:19
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/type-alias-impl-trait/closure_parent_substs.rs b/tests/ui/type-alias-impl-trait/closure_parent_substs.rs
index 3ff20d99a..7d8193b26 100644
--- a/tests/ui/type-alias-impl-trait/closure_parent_substs.rs
+++ b/tests/ui/type-alias-impl-trait/closure_parent_substs.rs
@@ -1,5 +1,5 @@
// When WF checking the hidden type in the ParamEnv of the opaque type,
-// one complication arises when the hidden type is a closure/generator:
+// one complication arises when the hidden type is a closure/coroutine:
// the "parent_substs" of the type may reference lifetime parameters
// not present in the opaque type.
// These region parameters are not really useful in this check.
diff --git a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr
index ae6462bb6..3484485e3 100644
--- a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr
+++ b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr
@@ -46,14 +46,17 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/closure_wf_outlives.rs:54:22
|
LL | type Opaque<T> = impl Sized;
- | ^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | ^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/closure_wf_outlives.rs:59:12
|
LL | T: 'static,
| ^^^^^^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | type Opaque<T: 'static> = impl Sized;
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs
new file mode 100644
index 000000000..4c56fe2d1
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait.rs
@@ -0,0 +1,13 @@
+// check-pass
+
+#![feature(type_alias_impl_trait)]
+
+type Opaque<'lt> = impl Sized + 'lt;
+
+fn test<'a>(
+ arg: impl Iterator<Item = &'a u8>,
+) -> impl Iterator<Item = Opaque<'a>> {
+ arg
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait2.rs b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait2.rs
new file mode 100644
index 000000000..97f8c799f
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/duplicate-lifetimes-from-rpit-containing-tait2.rs
@@ -0,0 +1,15 @@
+// check-pass
+// edition: 2021
+
+#![feature(type_alias_impl_trait)]
+
+struct Foo<'a>(&'a ());
+
+impl<'a> Foo<'a> {
+ async fn new() -> () {
+ type T = impl Sized;
+ let _: T = ();
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
index 8c3a25dbf..c352a33fb 100644
--- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr
@@ -17,9 +17,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/generic_type_does_not_live_long_enough.rs:13:9
|
LL | t
- | ^ ...so that the type `T` will meet its required lifetime bounds
+ | ^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn wrong_generic<T: 'static>(t: T) -> WrongGeneric<T> {
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained.rs b/tests/ui/type-alias-impl-trait/generic_underconstrained.rs
index d87a25aad..1acacc778 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained.rs
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained.rs
@@ -8,5 +8,6 @@ type Underconstrained<T: Trait> = impl Send;
// no `Trait` bound
fn underconstrain<T>(_: T) -> Underconstrained<T> {
//~^ ERROR the trait bound `T: Trait`
+ //~| ERROR the trait bound `T: Trait`
unimplemented!()
}
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr
index bc9280127..88529b370 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained.stderr
@@ -14,6 +14,27 @@ help: consider restricting type parameter `T`
LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
| +++++++
-error: aborting due to previous error
+error[E0277]: the trait bound `T: Trait` is not satisfied
+ --> $DIR/generic_underconstrained.rs:9:51
+ |
+LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
+ | ___________________________________________________^
+LL | |
+LL | |
+LL | | unimplemented!()
+LL | | }
+ | |_^ the trait `Trait` is not implemented for `T`
+ |
+note: required by a bound on the type alias `Underconstrained`
+ --> $DIR/generic_underconstrained.rs:6:26
+ |
+LL | type Underconstrained<T: Trait> = impl Send;
+ | ^^^^^ required by this bound
+help: consider restricting type parameter `T`
+ |
+LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
+ | +++++++
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs b/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs
index 8adc0bf32..1e1bece9a 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained2.rs
@@ -7,6 +7,7 @@ type Underconstrained<T: std::fmt::Debug> = impl Send;
// not a defining use, because it doesn't define *all* possible generics
fn underconstrained<U>(_: U) -> Underconstrained<U> {
//~^ ERROR `U` doesn't implement `Debug`
+ //~| ERROR `U` doesn't implement `Debug`
5u32
}
@@ -15,5 +16,6 @@ type Underconstrained2<T: std::fmt::Debug> = impl Send;
// not a defining use, because it doesn't define *all* possible generics
fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
//~^ ERROR `V` doesn't implement `Debug`
+ //~| ERROR `V` doesn't implement `Debug`
5u32
}
diff --git a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr
index fdc9ec090..b3b9cbca9 100644
--- a/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr
+++ b/tests/ui/type-alias-impl-trait/generic_underconstrained2.stderr
@@ -15,13 +15,13 @@ LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
| +++++++++++++++++
error[E0277]: `V` doesn't implement `Debug`
- --> $DIR/generic_underconstrained2.rs:16:43
+ --> $DIR/generic_underconstrained2.rs:17:43
|
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
note: required by a bound on the type alias `Underconstrained2`
- --> $DIR/generic_underconstrained2.rs:13:27
+ --> $DIR/generic_underconstrained2.rs:14:27
|
LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
| ^^^^^^^^^^^^^^^ required by this bound
@@ -30,6 +30,48 @@ help: consider restricting type parameter `V`
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
| +++++++++++++++++
-error: aborting due to 2 previous errors
+error[E0277]: `U` doesn't implement `Debug`
+ --> $DIR/generic_underconstrained2.rs:8:53
+ |
+LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
+ | _____________________________________________________^
+LL | |
+LL | |
+LL | | 5u32
+LL | | }
+ | |_^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
+ |
+note: required by a bound on the type alias `Underconstrained`
+ --> $DIR/generic_underconstrained2.rs:5:26
+ |
+LL | type Underconstrained<T: std::fmt::Debug> = impl Send;
+ | ^^^^^^^^^^^^^^^ required by this bound
+help: consider restricting type parameter `U`
+ |
+LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
+ | +++++++++++++++++
+
+error[E0277]: `V` doesn't implement `Debug`
+ --> $DIR/generic_underconstrained2.rs:17:64
+ |
+LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
+ | ________________________________________________________________^
+LL | |
+LL | |
+LL | | 5u32
+LL | | }
+ | |_^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
+ |
+note: required by a bound on the type alias `Underconstrained2`
+ --> $DIR/generic_underconstrained2.rs:14:27
+ |
+LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
+ | ^^^^^^^^^^^^^^^ required by this bound
+help: consider restricting type parameter `V`
+ |
+LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
+ | +++++++++++++++++
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr b/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr
index aaf75cc3d..e35913be8 100644
--- a/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr
+++ b/tests/ui/type-alias-impl-trait/impl_trait_for_same_tait.stderr
@@ -15,6 +15,8 @@ LL | impl Bop for Bar<()> {}
...
LL | impl Bop for Barr {}
| ^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<()>`
+ |
+ = note: upstream crates may add a new impl of trait `std::marker::FnPtr` for type `Barr` in future versions
error[E0119]: conflicting implementations of trait `Bop` for type `Bar<()>`
--> $DIR/impl_trait_for_same_tait.rs:30:1
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr
index 399775641..d6dd20739 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr
@@ -22,9 +22,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/implied_lifetime_wf_check3.rs:29:41
|
LL | fn test<A>() where Ty<A>: 'static { assert_static::<A>() }
- | ^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test<A: 'static>() where Ty<A>: 'static { assert_static::<A>() }
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr
index 47bc31e78..81bc64bc3 100644
--- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr
+++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/implied_lifetime_wf_check4_static.rs:4:18
|
LL | type Ty<A> = impl Sized + 'static;
- | ^^^^^^^^^^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds
+ | ^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `A` must be valid for the static lifetime...
+ | ...so that the type `A` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | type Ty<A: 'static> = impl Sized + 'static;
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.rs b/tests/ui/type-alias-impl-trait/inference-cycle.rs
index 20175a4fe..6e4507ed4 100644
--- a/tests/ui/type-alias-impl-trait/inference-cycle.rs
+++ b/tests/ui/type-alias-impl-trait/inference-cycle.rs
@@ -3,17 +3,14 @@
mod m {
pub type Foo = impl std::fmt::Debug;
- //~^ ERROR cycle detected
- //~| ERROR cycle detected
-
- // Cycle: error today, but it'd be nice if it eventually worked
pub fn foo() -> Foo {
is_send(bar())
}
pub fn bar() {
- is_send(foo()); // Today: error
+ // Cycle: error today, but it'd be nice if it eventually worked
+ is_send(foo());
//~^ ERROR: cannot check whether the hidden type of `inference_cycle[4ecc]::m::Foo::{opaque#0}` satisfies auto traits
}
diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.stderr b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
index 4ab059d05..ef7abe588 100644
--- a/tests/ui/type-alias-impl-trait/inference-cycle.stderr
+++ b/tests/ui/type-alias-impl-trait/inference-cycle.stderr
@@ -1,46 +1,7 @@
-error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
- --> $DIR/inference-cycle.rs:5:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires type-checking `m::bar`...
- --> $DIR/inference-cycle.rs:16:9
- |
-LL | is_send(foo()); // Today: error
- | ^^^^^^^
- = note: ...which requires evaluating trait selection obligation `m::Foo: core::marker::Send`...
- = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `m::Foo::{opaque#0}`
- --> $DIR/inference-cycle.rs:5:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error[E0391]: cycle detected when computing type of opaque `m::Foo::{opaque#0}`
- --> $DIR/inference-cycle.rs:5:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- |
-note: ...which requires type-checking `m::bar`...
- --> $DIR/inference-cycle.rs:15:5
- |
-LL | pub fn bar() {
- | ^^^^^^^^^^^^
- = note: ...which again requires computing type of opaque `m::Foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `m::Foo::{opaque#0}`
- --> $DIR/inference-cycle.rs:5:20
- |
-LL | pub type Foo = impl std::fmt::Debug;
- | ^^^^^^^^^^^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
error: cannot check whether the hidden type of `inference_cycle[4ecc]::m::Foo::{opaque#0}` satisfies auto traits
- --> $DIR/inference-cycle.rs:16:17
+ --> $DIR/inference-cycle.rs:13:17
|
-LL | is_send(foo()); // Today: error
+LL | is_send(foo());
| ------- ^^^^^
| |
| required by a bound introduced by this call
@@ -51,16 +12,15 @@ note: opaque type is declared here
LL | pub type Foo = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/inference-cycle.rs:15:12
+ --> $DIR/inference-cycle.rs:11:12
|
LL | pub fn bar() {
| ^^^
note: required by a bound in `is_send`
- --> $DIR/inference-cycle.rs:24:19
+ --> $DIR/inference-cycle.rs:21:19
|
LL | fn is_send<T: Send>(_: T) {}
| ^^^^ required by this bound in `is_send`
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs
new file mode 100644
index 000000000..6609d4eb5
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.rs
@@ -0,0 +1,8 @@
+#![feature(type_alias_impl_trait)]
+
+type T = impl Copy;
+//~^ ERROR cannot resolve opaque type
+
+static STATIC: T = None::<&'static T>;
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr
new file mode 100644
index 000000000..50ae6f386
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/infinite-cycle-involving-weak.stderr
@@ -0,0 +1,9 @@
+error[E0720]: cannot resolve opaque type
+ --> $DIR/infinite-cycle-involving-weak.rs:3:10
+ |
+LL | type T = impl Copy;
+ | ^^^^^^^^^ cannot resolve opaque type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0720`.
diff --git a/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs b/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs
new file mode 100644
index 000000000..ad1ede9c3
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs
@@ -0,0 +1,22 @@
+#![feature(coroutines, coroutine_trait, rustc_attrs)]
+#![feature(type_alias_impl_trait)]
+
+// check-pass
+
+mod gen {
+ use std::ops::Coroutine;
+
+ pub type CoroOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>;
+
+ pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> CoroOnce<Y, R> {
+ move || {
+ yield yielding;
+
+ return returning;
+ }
+ }
+}
+
+const FOO: gen::CoroOnce<usize, usize> = gen::const_coroutine(10, 100);
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs b/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs
deleted file mode 100644
index a213dbba4..000000000
--- a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-#![feature(generators, generator_trait, rustc_attrs)]
-#![feature(type_alias_impl_trait)]
-
-// check-pass
-
-mod gen {
- use std::ops::Generator;
-
- pub type GenOnce<Y, R> = impl Generator<Yield = Y, Return = R>;
-
- pub const fn const_generator<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> {
- move || {
- yield yielding;
-
- return returning;
- }
- }
-}
-
-const FOO: gen::GenOnce<usize, usize> = gen::const_generator(10, 100);
-
-fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs b/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs
new file mode 100644
index 000000000..bc6a34392
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs
@@ -0,0 +1,39 @@
+// check-pass
+
+#![feature(coroutines, coroutine_trait)]
+#![feature(type_alias_impl_trait)]
+
+use std::ops::{Coroutine, CoroutineState};
+use std::pin::Pin;
+
+type RandCoroutine<'a> = impl Coroutine<Return = (), Yield = u64> + 'a;
+fn rand_coroutine<'a>(rng: &'a ()) -> RandCoroutine<'a> {
+ move || {
+ let _rng = rng;
+ loop {
+ yield 0;
+ }
+ }
+}
+
+pub type RandCoroutineWithIndirection<'c> = impl Coroutine<Return = (), Yield = u64> + 'c;
+pub fn rand_coroutine_with_indirection<'a>(rng: &'a ()) -> RandCoroutineWithIndirection<'a> {
+ fn helper<'b>(rng: &'b ()) -> impl 'b + Coroutine<Return = (), Yield = u64> {
+ move || {
+ let _rng = rng;
+ loop {
+ yield 0;
+ }
+ }
+ }
+
+ helper(rng)
+}
+
+fn main() {
+ let mut gen = rand_coroutine(&());
+ match unsafe { Pin::new_unchecked(&mut gen) }.resume(()) {
+ CoroutineState::Yielded(_) => {}
+ CoroutineState::Complete(_) => {}
+ };
+}
diff --git a/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs b/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs
deleted file mode 100644
index 477b61390..000000000
--- a/tests/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// check-pass
-
-#![feature(generators, generator_trait)]
-#![feature(type_alias_impl_trait)]
-
-use std::ops::{Generator, GeneratorState};
-use std::pin::Pin;
-
-type RandGenerator<'a> = impl Generator<Return = (), Yield = u64> + 'a;
-fn rand_generator<'a>(rng: &'a ()) -> RandGenerator<'a> {
- move || {
- let _rng = rng;
- loop {
- yield 0;
- }
- }
-}
-
-pub type RandGeneratorWithIndirection<'c> = impl Generator<Return = (), Yield = u64> + 'c;
-pub fn rand_generator_with_indirection<'a>(rng: &'a ()) -> RandGeneratorWithIndirection<'a> {
- fn helper<'b>(rng: &'b ()) -> impl 'b + Generator<Return = (), Yield = u64> {
- move || {
- let _rng = rng;
- loop {
- yield 0;
- }
- }
- }
-
- helper(rng)
-}
-
-fn main() {
- let mut gen = rand_generator(&());
- match unsafe { Pin::new_unchecked(&mut gen) }.resume(()) {
- GeneratorState::Yielded(_) => {}
- GeneratorState::Complete(_) => {}
- };
-}
diff --git a/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs b/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs
index 27ca7d0fd..a1cf23dab 100644
--- a/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs
+++ b/tests/ui/type-alias-impl-trait/issue-58662-simplified.rs
@@ -1,6 +1,6 @@
// check-pass
-#![feature(generators, generator_trait)]
+#![feature(coroutines, coroutine_trait)]
#![feature(type_alias_impl_trait)]
trait Trait {}
diff --git a/tests/ui/type-alias-impl-trait/issue-63279.rs b/tests/ui/type-alias-impl-trait/issue-63279.rs
index 0e46745c6..02f211146 100644
--- a/tests/ui/type-alias-impl-trait/issue-63279.rs
+++ b/tests/ui/type-alias-impl-trait/issue-63279.rs
@@ -3,11 +3,11 @@
type Closure = impl FnOnce();
fn c() -> Closure {
- //~^ ERROR: expected a `FnOnce<()>` closure, found `()`
+ //~^ ERROR: expected a `FnOnce()` closure, found `()`
|| -> Closure { || () }
//~^ ERROR: mismatched types
//~| ERROR: mismatched types
- //~| ERROR: expected a `FnOnce<()>` closure, found `()`
+ //~| ERROR: expected a `FnOnce()` closure, found `()`
}
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-63279.stderr b/tests/ui/type-alias-impl-trait/issue-63279.stderr
index a86856247..58cafd21c 100644
--- a/tests/ui/type-alias-impl-trait/issue-63279.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-63279.stderr
@@ -1,17 +1,17 @@
-error[E0277]: expected a `FnOnce<()>` closure, found `()`
+error[E0277]: expected a `FnOnce()` closure, found `()`
--> $DIR/issue-63279.rs:5:11
|
LL | fn c() -> Closure {
- | ^^^^^^^ expected an `FnOnce<()>` closure, found `()`
+ | ^^^^^^^ expected an `FnOnce()` closure, found `()`
|
= help: the trait `FnOnce<()>` is not implemented for `()`
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
-error[E0277]: expected a `FnOnce<()>` closure, found `()`
+error[E0277]: expected a `FnOnce()` closure, found `()`
--> $DIR/issue-63279.rs:7:11
|
LL | || -> Closure { || () }
- | ^^^^^^^ expected an `FnOnce<()>` closure, found `()`
+ | ^^^^^^^ expected an `FnOnce()` closure, found `()`
|
= help: the trait `FnOnce<()>` is not implemented for `()`
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
diff --git a/tests/ui/type-alias-impl-trait/issue-94429.rs b/tests/ui/type-alias-impl-trait/issue-94429.rs
index d764545f9..306e73003 100644
--- a/tests/ui/type-alias-impl-trait/issue-94429.rs
+++ b/tests/ui/type-alias-impl-trait/issue-94429.rs
@@ -1,18 +1,18 @@
-#![feature(impl_trait_in_assoc_type, generator_trait, generators)]
-use std::ops::Generator;
+#![feature(impl_trait_in_assoc_type, coroutine_trait, coroutines)]
+use std::ops::Coroutine;
trait Runnable {
- type Gen: Generator<Yield = (), Return = ()>;
+ type Coro: Coroutine<Yield = (), Return = ()>;
- fn run(&mut self) -> Self::Gen;
+ fn run(&mut self) -> Self::Coro;
}
struct Implementor {}
impl Runnable for Implementor {
- type Gen = impl Generator<Yield = (), Return = ()>;
+ type Coro = impl Coroutine<Yield = (), Return = ()>;
- fn run(&mut self) -> Self::Gen {
+ fn run(&mut self) -> Self::Coro {
//~^ ERROR: type mismatch resolving
move || {
yield 1;
diff --git a/tests/ui/type-alias-impl-trait/issue-94429.stderr b/tests/ui/type-alias-impl-trait/issue-94429.stderr
index 26605cdd2..360ecfa61 100644
--- a/tests/ui/type-alias-impl-trait/issue-94429.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-94429.stderr
@@ -1,8 +1,8 @@
-error[E0271]: type mismatch resolving `<{generator@$DIR/issue-94429.rs:17:9: 17:16} as Generator>::Yield == ()`
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/issue-94429.rs:17:9: 17:16} as Coroutine>::Yield == ()`
--> $DIR/issue-94429.rs:15:26
|
-LL | fn run(&mut self) -> Self::Gen {
- | ^^^^^^^^^ expected integer, found `()`
+LL | fn run(&mut self) -> Self::Coro {
+ | ^^^^^^^^^^ expected integer, found `()`
error: aborting due to previous error
diff --git a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
index fdd8fa65b..5bd854be8 100644
--- a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
+++ b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs
@@ -26,11 +26,9 @@ fn upvar() {
fn enum_upvar() {
type T = impl Copy;
let foo: T = Some((1u32, 2u32));
- let x = move || {
- match foo {
- None => (),
- Some((a, b)) => (),
- }
+ let x = move || match foo {
+ None => (),
+ Some((a, b)) => (),
};
}
@@ -63,6 +61,19 @@ mod only_pattern {
None => {}
}
}
+
+ type V = impl Copy;
+
+ fn baz(baz: Option<V>) {
+ match baz {
+ _ => {}
+ Some((mut x, mut y)) => {
+ x = 42;
+ y = "foo";
+ }
+ None => {}
+ }
+ }
}
mod only_pattern_rpit {
@@ -71,11 +82,7 @@ mod only_pattern_rpit {
let (mut x, mut y) = foo(false);
x = 42;
y = "foo";
- if b {
- panic!()
- } else {
- foo(true)
- }
+ if b { panic!() } else { foo(true) }
}
fn bar(b: bool) -> Option<impl Copy> {
diff --git a/tests/ui/type-alias-impl-trait/nested_impl_trait_in_assoc_ty.rs b/tests/ui/type-alias-impl-trait/nested_impl_trait_in_assoc_ty.rs
new file mode 100644
index 000000000..5f3dbaa17
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested_impl_trait_in_assoc_ty.rs
@@ -0,0 +1,44 @@
+//! This test checks that we do not walk types in async blocks for
+//! determining the opaque types that appear in a signature. async blocks,
+//! all other coroutines and closures are always private and not part of
+//! a signature. They become part of a signature via `dyn Trait` or `impl Trait`,
+//! which is something that we process abstractly without looking at its hidden
+//! types.
+// edition: 2021
+// check-pass
+
+#![feature(impl_trait_in_assoc_type)]
+
+use std::future::Future;
+
+pub struct MemtableLocalStateStore {
+ mem_table: MemTable,
+}
+
+impl LocalStateStore for MemtableLocalStateStore {
+ type IterStream<'a> = impl Sized + 'a where Self: 'a;
+
+ fn iter(&self) -> impl Future<Output = Self::IterStream<'_>> + '_ {
+ async move { merge_stream(self.mem_table.iter()) }
+ }
+}
+
+trait LocalStateStore {
+ type IterStream<'a>
+ where
+ Self: 'a;
+
+ fn iter(&self) -> impl Future<Output = Self::IterStream<'_>> + '_;
+}
+
+struct MemTable;
+
+impl MemTable {
+ fn iter<'a>(&'a self) -> impl Iterator<Item = &'a ()> {
+ std::iter::empty()
+ }
+}
+
+pub(crate) async fn merge_stream<'a>(mem_table_iter: impl Iterator<Item = &'a ()>) {}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.fixed b/tests/ui/type-alias-impl-trait/not_well_formed.fixed
new file mode 100644
index 000000000..d98e83ff6
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/not_well_formed.fixed
@@ -0,0 +1,19 @@
+// run-rustfix
+#![feature(type_alias_impl_trait)]
+#![allow(dead_code)]
+
+fn main() {}
+
+trait TraitWithAssoc {
+ type Assoc;
+}
+
+type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>; //~ associated type `Assoc` not found for `V`
+
+trait Trait<U> {}
+
+impl<W> Trait<W> for () {}
+
+fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T> {
+ ()
+}
diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.rs b/tests/ui/type-alias-impl-trait/not_well_formed.rs
index fbb7a4d58..18f173a69 100644
--- a/tests/ui/type-alias-impl-trait/not_well_formed.rs
+++ b/tests/ui/type-alias-impl-trait/not_well_formed.rs
@@ -1,4 +1,6 @@
+// run-rustfix
#![feature(type_alias_impl_trait)]
+#![allow(dead_code)]
fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.stderr b/tests/ui/type-alias-impl-trait/not_well_formed.stderr
index c36b95f47..b267e6a75 100644
--- a/tests/ui/type-alias-impl-trait/not_well_formed.stderr
+++ b/tests/ui/type-alias-impl-trait/not_well_formed.stderr
@@ -1,8 +1,13 @@
error[E0220]: associated type `Assoc` not found for `V`
- --> $DIR/not_well_formed.rs:9:29
+ --> $DIR/not_well_formed.rs:11:29
|
LL | type Foo<V> = impl Trait<V::Assoc>;
- | ^^^^^ there is a similarly named associated type `Assoc` in the trait `TraitWithAssoc`
+ | ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc`
+ |
+help: consider restricting type parameter `V`
+ |
+LL | type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
+ | ++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs
new file mode 100644
index 000000000..3d1759097
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.rs
@@ -0,0 +1,17 @@
+// test for #113326
+#![feature(type_alias_impl_trait)]
+
+pub type Diff = impl Fn(usize) -> usize;
+
+pub fn lift() -> Diff {
+ |_: usize |loop {}
+}
+
+pub fn add(
+ n: Diff,
+ m: Diff,
+) -> Diff {
+ move |x: usize| m(n(x)) //~ ERROR: concrete type differs
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr
new file mode 100644
index 000000000..b2898a211
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/recursive-fn-tait.stderr
@@ -0,0 +1,14 @@
+error: concrete type differs from previous defining opaque type use
+ --> $DIR/recursive-fn-tait.rs:14:5
+ |
+LL | move |x: usize| m(n(x))
+ | ^^^^^^^^^^^^^^^^^^^^^^^ expected `{closure@$DIR/recursive-fn-tait.rs:7:5: 7:16}`, got `{closure@$DIR/recursive-fn-tait.rs:14:5: 14:20}`
+ |
+note: previous use here
+ --> $DIR/recursive-fn-tait.rs:7:5
+ |
+LL | |_: usize |loop {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/type-alias-impl-trait/reveal_local.rs b/tests/ui/type-alias-impl-trait/reveal_local.rs
index 7943bb240..07fd989b0 100644
--- a/tests/ui/type-alias-impl-trait/reveal_local.rs
+++ b/tests/ui/type-alias-impl-trait/reveal_local.rs
@@ -3,9 +3,6 @@
use std::fmt::Debug;
type Foo = impl Debug;
-//~^ ERROR cycle detected
-//~| ERROR cycle detected
-//~| ERROR cycle detected
fn is_send<T: Send>() {}
diff --git a/tests/ui/type-alias-impl-trait/reveal_local.stderr b/tests/ui/type-alias-impl-trait/reveal_local.stderr
index c62fd88f4..796e2d011 100644
--- a/tests/ui/type-alias-impl-trait/reveal_local.stderr
+++ b/tests/ui/type-alias-impl-trait/reveal_local.stderr
@@ -1,44 +1,5 @@
-error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
- --> $DIR/reveal_local.rs:5:12
- |
-LL | type Foo = impl Debug;
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `not_good`...
- --> $DIR/reveal_local.rs:15:5
- |
-LL | is_send::<Foo>();
- | ^^^^^^^^^^^^^^
- = note: ...which requires evaluating trait selection obligation `Foo: core::marker::Send`...
- = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `Foo::{opaque#0}`
- --> $DIR/reveal_local.rs:5:12
- |
-LL | type Foo = impl Debug;
- | ^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
- --> $DIR/reveal_local.rs:5:12
- |
-LL | type Foo = impl Debug;
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `not_good`...
- --> $DIR/reveal_local.rs:12:1
- |
-LL | fn not_good() {
- | ^^^^^^^^^^^^^
- = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `Foo::{opaque#0}`
- --> $DIR/reveal_local.rs:5:12
- |
-LL | type Foo = impl Debug;
- | ^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
- --> $DIR/reveal_local.rs:15:15
+ --> $DIR/reveal_local.rs:12:15
|
LL | is_send::<Foo>();
| ^^^
@@ -49,37 +10,18 @@ note: opaque type is declared here
LL | type Foo = impl Debug;
| ^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/reveal_local.rs:12:4
+ --> $DIR/reveal_local.rs:9:4
|
LL | fn not_good() {
| ^^^^^^^^
note: required by a bound in `is_send`
- --> $DIR/reveal_local.rs:10:15
+ --> $DIR/reveal_local.rs:7:15
|
LL | fn is_send<T: Send>() {}
| ^^^^ required by this bound in `is_send`
-error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
- --> $DIR/reveal_local.rs:5:12
- |
-LL | type Foo = impl Debug;
- | ^^^^^^^^^^
- |
-note: ...which requires type-checking `not_gooder`...
- --> $DIR/reveal_local.rs:19:1
- |
-LL | fn not_gooder() -> Foo {
- | ^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `Foo::{opaque#0}`
- --> $DIR/reveal_local.rs:5:12
- |
-LL | type Foo = impl Debug;
- | ^^^^^^^^^^
- = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits
- --> $DIR/reveal_local.rs:25:15
+ --> $DIR/reveal_local.rs:22:15
|
LL | is_send::<Foo>();
| ^^^
@@ -90,16 +32,15 @@ note: opaque type is declared here
LL | type Foo = impl Debug;
| ^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
- --> $DIR/reveal_local.rs:19:4
+ --> $DIR/reveal_local.rs:16:4
|
LL | fn not_gooder() -> Foo {
| ^^^^^^^^^^
note: required by a bound in `is_send`
- --> $DIR/reveal_local.rs:10:15
+ --> $DIR/reveal_local.rs:7:15
|
LL | fn is_send<T: Send>() {}
| ^^^^ required by this bound in `is_send`
-error: aborting due to 5 previous errors
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs
index 857066c78..9796823a7 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.rs
@@ -4,7 +4,7 @@
// FIXME: this is ruled out for now but should work
type Foo = fn() -> impl Send;
-//~^ ERROR: `impl Trait` only allowed in function and inherent method return types
+//~^ ERROR: `impl Trait` only allowed in function and inherent method argument and return types
fn make_foo() -> Foo {
|| 15
diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr
index ff375b2ff..e57c59d61 100644
--- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr
+++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-fn-type.stderr
@@ -1,4 +1,4 @@
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in `fn` pointer return types
--> $DIR/type-alias-impl-trait-fn-type.rs:6:20
|
LL | type Foo = fn() -> impl Send;
diff --git a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs
new file mode 100644
index 000000000..ae3d317ab
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.rs
@@ -0,0 +1,14 @@
+#![feature(type_alias_impl_trait)]
+
+type Tait = impl Copy;
+// Make sure that this TAIT isn't considered unconstrained...
+
+fn empty_opaque() -> Tait {
+ if false {
+ match empty_opaque() {}
+ //~^ ERROR non-empty
+ }
+ 0u8
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr
new file mode 100644
index 000000000..6cc5b7a8a
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/unconstrained-due-to-bad-pattern.stderr
@@ -0,0 +1,17 @@
+error[E0004]: non-exhaustive patterns: type `Tait` is non-empty
+ --> $DIR/unconstrained-due-to-bad-pattern.rs:8:15
+ |
+LL | match empty_opaque() {}
+ | ^^^^^^^^^^^^^^
+ |
+ = note: the matched value is of type `Tait`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
+ |
+LL ~ match empty_opaque() {
+LL + _ => todo!(),
+LL + }
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr b/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr
index 9e96323ab..7d72c9f81 100644
--- a/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr
+++ b/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-in-associated-type.rs:36:23
|
+LL | impl<'a, T> Trait<'a, T> for () {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Opaque = impl Sized + 'a;
| ^^^^^^^^^^^^^^^ ...so that the type `&'a T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for () {
| ++++
@@ -12,10 +14,12 @@ LL | impl<'a, T: 'a> Trait<'a, T> for () {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-in-associated-type.rs:36:23
|
+LL | impl<'a, T> Trait<'a, T> for () {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Opaque = impl Sized + 'a;
| ^^^^^^^^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for () {
| ++++
diff --git a/tests/ui/type-alias-impl-trait/wf-nested.fail.stderr b/tests/ui/type-alias-impl-trait/wf-nested.fail.stderr
index 753a46e88..2858afcd4 100644
--- a/tests/ui/type-alias-impl-trait/wf-nested.fail.stderr
+++ b/tests/ui/type-alias-impl-trait/wf-nested.fail.stderr
@@ -2,14 +2,17 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-nested.rs:55:27
|
LL | type InnerOpaque<T> = impl Sized;
- | ^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
+ | ^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/wf-nested.rs:12:20
|
LL | struct IsStatic<T: 'static>(T);
| ^^^^^^^
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | type InnerOpaque<T: 'static> = impl Sized;
| +++++++++
diff --git a/tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr b/tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr
index 9ab6685a7..285e4f18c 100644
--- a/tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr
+++ b/tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-nested.rs:46:17
|
LL | let _ = outer.get();
- | ^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
+ | ^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the type `T` will meet its required lifetime bounds
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | fn test<T: 'static>() {
| +++++++++
diff --git a/tests/ui/type-inference/sort_by_key.stderr b/tests/ui/type-inference/sort_by_key.stderr
index de7b4b248..81af024b3 100644
--- a/tests/ui/type-inference/sort_by_key.stderr
+++ b/tests/ui/type-inference/sort_by_key.stderr
@@ -1,9 +1,14 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/sort_by_key.rs:3:40
|
LL | lst.sort_by_key(|&(v, _)| v.iter().sum());
- | ^^^ cannot infer type of the type parameter `S` declared on the method `sum`
+ | ----------- ^^^ cannot infer type of the type parameter `S` declared on the method `sum`
+ | |
+ | type must be known at this point
|
+ = note: cannot satisfy `_: Ord`
+note: required by a bound in `slice::<impl [T]>::sort_by_key`
+ --> $SRC_DIR/alloc/src/slice.rs:LL:COL
help: consider specifying the generic argument
|
LL | lst.sort_by_key(|&(v, _)| v.iter().sum::<S>());
@@ -11,4 +16,4 @@ LL | lst.sort_by_key(|&(v, _)| v.iter().sum::<S>());
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr b/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr
index 09c4b2053..7be00341d 100644
--- a/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr
+++ b/tests/ui/type/type-check/cannot_infer_local_or_vec.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Vec<_>`
--> $DIR/cannot_infer_local_or_vec.rs:2:9
|
LL | let x = vec![];
- | ^
+ | ^ ------ type must be known at this point
|
help: consider giving `x` an explicit type, where the placeholders `_` are specified
|
diff --git a/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs b/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs
new file mode 100644
index 000000000..adf3049b4
--- /dev/null
+++ b/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.rs
@@ -0,0 +1,6 @@
+fn foo() -> Result<String, ()> {
+ let out: Result<(), ()> = Ok(());
+ out //~ ERROR mismatched types
+}
+
+fn main() {}
diff --git a/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.stderr b/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.stderr
new file mode 100644
index 000000000..447b22a15
--- /dev/null
+++ b/tests/ui/type/type-check/issue-116967-cannot-coerce-returned-result.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-116967-cannot-coerce-returned-result.rs:3:5
+ |
+LL | fn foo() -> Result<String, ()> {
+ | ------------------ expected `Result<String, ()>` because of return type
+LL | let out: Result<(), ()> = Ok(());
+LL | out
+ | ^^^ expected `Result<String, ()>`, found `Result<(), ()>`
+ |
+ = note: expected enum `Result<String, _>`
+ found enum `Result<(), _>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type/type-check/point-at-inference-issue-116155.rs b/tests/ui/type/type-check/point-at-inference-issue-116155.rs
new file mode 100644
index 000000000..1e9942d42
--- /dev/null
+++ b/tests/ui/type/type-check/point-at-inference-issue-116155.rs
@@ -0,0 +1,17 @@
+struct S<T>(T);
+
+impl<T> S<T> {
+ fn new() -> Self {
+ loop {}
+ }
+
+ fn constrain<F: Fn() -> T>(&self, _f: F) {}
+}
+
+fn main() {
+ let s = S::new();
+ let c = || true;
+ s.constrain(c);
+ let _: S<usize> = s;
+ //~^ ERROR mismatched types
+}
diff --git a/tests/ui/type/type-check/point-at-inference-issue-116155.stderr b/tests/ui/type/type-check/point-at-inference-issue-116155.stderr
new file mode 100644
index 000000000..c8c01603c
--- /dev/null
+++ b/tests/ui/type/type-check/point-at-inference-issue-116155.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/point-at-inference-issue-116155.rs:15:23
+ |
+LL | s.constrain(c);
+ | - - this argument has type `{closure@$DIR/point-at-inference-issue-116155.rs:13:13: 13:15}`...
+ | |
+ | ... which causes `s` to have type `S<bool>`
+LL | let _: S<usize> = s;
+ | -------- ^ expected `S<usize>`, found `S<bool>`
+ | |
+ | expected due to this
+ |
+ = note: expected struct `S<usize>`
+ found struct `S<bool>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr b/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
index 8a296dc7e..4412c49ea 100644
--- a/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
+++ b/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
@@ -24,6 +24,7 @@ LL | trait MyAdd<Rhs=Self> { fn add(&self, other: &Rhs) -> Self; }
| |
| this trait cannot be made into an object...
= help: consider moving `add` to another trait
+ = help: only type `i32` implements the trait, consider using it directly instead
error: aborting due to 2 previous errors
diff --git a/tests/ui/typeck/bad-index-due-to-nested.stderr b/tests/ui/typeck/bad-index-due-to-nested.stderr
index f9cdb280e..0b705d467 100644
--- a/tests/ui/typeck/bad-index-due-to-nested.stderr
+++ b/tests/ui/typeck/bad-index-due-to-nested.stderr
@@ -40,7 +40,7 @@ error[E0308]: mismatched types
--> $DIR/bad-index-due-to-nested.rs:20:9
|
LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
- | - this type parameter
+ | - found this type parameter
LL | map[k]
| ^ expected `&K`, found type parameter `K`
|
@@ -55,7 +55,7 @@ error[E0308]: mismatched types
--> $DIR/bad-index-due-to-nested.rs:20:5
|
LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
- | - this type parameter ----- expected `&'a V` because of return type
+ | - found this type parameter ----- expected `&'a V` because of return type
LL | map[k]
| ^^^^^^ expected `&V`, found type parameter `V`
|
diff --git a/tests/ui/typeck/escaping_bound_vars.rs b/tests/ui/typeck/escaping_bound_vars.rs
new file mode 100644
index 000000000..1fb063d2c
--- /dev/null
+++ b/tests/ui/typeck/escaping_bound_vars.rs
@@ -0,0 +1,16 @@
+// Test for issues/115517 which is fixed by pull/115486
+// This should not ice
+trait Test<const C: usize> {}
+
+trait Elide<T> {
+ fn call();
+}
+
+pub fn test()
+where
+ (): Test<{ 1 + (<() as Elide(&())>::call) }>,
+ //~^ ERROR cannot capture late-bound lifetime in constant
+{
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/escaping_bound_vars.stderr b/tests/ui/typeck/escaping_bound_vars.stderr
new file mode 100644
index 000000000..f7077e52a
--- /dev/null
+++ b/tests/ui/typeck/escaping_bound_vars.stderr
@@ -0,0 +1,10 @@
+error: cannot capture late-bound lifetime in constant
+ --> $DIR/escaping_bound_vars.rs:11:35
+ |
+LL | (): Test<{ 1 + (<() as Elide(&())>::call) }>,
+ | -^
+ | |
+ | lifetime defined here
+
+error: aborting due to previous error
+
diff --git a/tests/ui/typeck/issue-104513-ice.rs b/tests/ui/typeck/issue-104513-ice.rs
index bcac0fa1e..4968d3f51 100644
--- a/tests/ui/typeck/issue-104513-ice.rs
+++ b/tests/ui/typeck/issue-104513-ice.rs
@@ -1,6 +1,6 @@
struct S;
fn f() {
let _: S<impl Oops> = S; //~ ERROR cannot find trait `Oops` in this scope
- //~^ ERROR `impl Trait` only allowed in function and inherent method return types
+ //~^ ERROR `impl Trait` only allowed in function and inherent method argument and return types
}
fn main() {}
diff --git a/tests/ui/typeck/issue-104513-ice.stderr b/tests/ui/typeck/issue-104513-ice.stderr
index 09187d786..56c6b3361 100644
--- a/tests/ui/typeck/issue-104513-ice.stderr
+++ b/tests/ui/typeck/issue-104513-ice.stderr
@@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Oops` in this scope
LL | let _: S<impl Oops> = S;
| ^^^^ not found in this scope
-error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
+error[E0562]: `impl Trait` only allowed in function and inherent method argument and return types, not in variable bindings
--> $DIR/issue-104513-ice.rs:3:14
|
LL | let _: S<impl Oops> = S;
diff --git a/tests/ui/typeck/issue-107087.stderr b/tests/ui/typeck/issue-107087.stderr
index 70f193208..8921e3f76 100644
--- a/tests/ui/typeck/issue-107087.stderr
+++ b/tests/ui/typeck/issue-107087.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/issue-107087.rs:16:5
|
LL | A::B::<>::C
- | ^^^^^^^^ help: use the fully-qualified path: `<A<_> as Foo>::B`
+ | ^^^^^^^^ help: use fully-qualified syntax: `<A<_> as Foo>::B`
error: aborting due to previous error
diff --git a/tests/ui/typeck/issue-110052.stderr b/tests/ui/typeck/issue-110052.stderr
index 0c15c03a7..75374fa61 100644
--- a/tests/ui/typeck/issue-110052.stderr
+++ b/tests/ui/typeck/issue-110052.stderr
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
--> $DIR/issue-110052.rs:6:30
|
LL | for<'iter> dyn Validator<<&'iter I>::Item>:,
- | ^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'iter I as IntoIterator>::Item`
+ | ^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<&'iter I as IntoIterator>::Item`
error: aborting due to previous error
diff --git a/tests/ui/typeck/issue-114529-illegal-break-with-value.rs b/tests/ui/typeck/issue-114529-illegal-break-with-value.rs
new file mode 100644
index 000000000..613d1b634
--- /dev/null
+++ b/tests/ui/typeck/issue-114529-illegal-break-with-value.rs
@@ -0,0 +1,20 @@
+// Regression test for issue #114529
+// Tests that we do not ICE during const eval for a
+// break-with-value in contexts where it is illegal
+
+#[allow(while_true)]
+fn main() {
+ [(); {
+ while true {
+ break 9; //~ ERROR `break` with value from a `while` loop
+ };
+ 51
+ }];
+
+ [(); {
+ while let Some(v) = Some(9) {
+ break v; //~ ERROR `break` with value from a `while` loop
+ };
+ 51
+ }];
+}
diff --git a/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr b/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr
new file mode 100644
index 000000000..4d6c27bbb
--- /dev/null
+++ b/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr
@@ -0,0 +1,29 @@
+error[E0571]: `break` with value from a `while` loop
+ --> $DIR/issue-114529-illegal-break-with-value.rs:9:13
+ |
+LL | while true {
+ | ---------- you can't `break` with a value in a `while` loop
+LL | break 9;
+ | ^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
+help: use `break` on its own without a value inside this `while` loop
+ |
+LL | break;
+ | ~~~~~
+
+error[E0571]: `break` with value from a `while` loop
+ --> $DIR/issue-114529-illegal-break-with-value.rs:16:13
+ |
+LL | while let Some(v) = Some(9) {
+ | --------------------------- you can't `break` with a value in a `while` loop
+LL | break v;
+ | ^^^^^^^ can only break with a value inside `loop` or breakable block
+ |
+help: use `break` on its own without a value inside this `while` loop
+ |
+LL | break;
+ | ~~~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0571`.
diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs
index a1b9a7eba..193544ebd 100644
--- a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs
+++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs
@@ -5,7 +5,7 @@
trait Trait {
- fn func<const N: u32>() -> [ (); N ];
+ fn func<const N: u32>() -> [ (); N ]; //~ ERROR mismatched types
}
struct S {}
diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr
index 9843651b1..16aaf0615 100644
--- a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr
+++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr
@@ -4,6 +4,12 @@ error[E0308]: mismatched types
LL | fn func<const N: u32>() -> [ (); { () }] {
| ^^ expected `usize`, found `()`
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/const-in-impl-fn-return-type.rs:8:38
+ |
+LL | fn func<const N: u32>() -> [ (); N ];
+ | ^ expected `usize`, found `u32`
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs
new file mode 100644
index 000000000..c319c63ed
--- /dev/null
+++ b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.rs
@@ -0,0 +1,96 @@
+// Regression test for ICE #116473.
+// The ICE occurs when arguments are specified on an enum variant
+// (which is illegal) and the variant and its preceding path are
+// located at different places such as in different macros or
+// different expansions of the same macro (i.e. when the macro
+// calls itself recursively)
+
+enum Enum<T1, T2> { VariantA { _v1: T1, _v2: T2 }, VariantB }
+
+type EnumUnit = Enum<(), ()>;
+
+// Recursive macro call using a tt metavariable for variant
+macro_rules! recursive_tt {
+ () => (recursive_tt!(VariantB));
+ ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
+
+
+// Recursive macro call using an ident metavariable for variant
+// (the behaviour is different for tt and ident)
+macro_rules! recursive_ident {
+ () => (recursive_ident!(VariantB));
+ ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
+
+
+// Mested macro calls (i.e. one calling another) using a tt
+// metavariable for variant
+macro_rules! nested1_tt {
+ () => (nested2_tt!(VariantB));
+}
+
+macro_rules! nested2_tt {
+ ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
+
+
+// Mested macro calls using an ident metavariable for variant
+// (the behaviour is different for tt and ident)
+macro_rules! nested1_ident {
+ () => (nested2_ident!(VariantB));
+}
+
+macro_rules! nested2_ident {
+ ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
+
+
+// Mested macro calls when args are passed as metavariable
+// instead of the enum variant
+macro_rules! nested1_tt_args_in_first_macro {
+ () => (nested2_tt_args_in_first_macro!(i32, u32));
+}
+
+macro_rules! nested2_tt_args_in_first_macro {
+ ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+ = 5 { true } else { false });
+}
+
+// Mested macro calls when args are passed as metavariable
+// instead of the enum variant
+macro_rules! nested1_ident_args_in_first_macro {
+ () => (nested2_ident_args_in_first_macro!(i32, u32));
+}
+
+macro_rules! nested2_ident_args_in_first_macro {
+ ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+ = 5 { true } else { false });
+}
+
+fn main() {
+ // Macro cases
+ recursive_tt!();
+ recursive_ident!();
+ nested1_tt!();
+ nested1_ident!();
+ nested1_tt_args_in_first_macro!();
+ nested1_ident_args_in_first_macro!();
+
+ // Regular, non-macro case
+ if let EnumUnit::VariantB::<i32, u32> {} = 5 { true } else { false };
+ //~^ ERROR type arguments are not allowed on this type
+ //~| ERROR mismatched types
+}
diff --git a/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr
new file mode 100644
index 000000000..b17936ee3
--- /dev/null
+++ b/tests/ui/typeck/issue-116473-ice-wrong-span-variant-args.stderr
@@ -0,0 +1,237 @@
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:15:51
+ |
+LL | ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | -------- ^^^ ^^^ type argument not allowed
+ | |
+ | not allowed on this type
+...
+LL | recursive_tt!();
+ | --------------- in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `recursive_tt` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+LL + ($variant:tt) => (if let EnumUnit::<i32, u32>::$variant {} = 5 { true } else { false });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:15:30
+ |
+LL | ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+...
+LL | recursive_tt!();
+ | --------------- in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `recursive_tt` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:25:54
+ |
+LL | () => (recursive_ident!(VariantB));
+ | -------- not allowed on this type
+LL | ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^ ^^^ type argument not allowed
+...
+LL | recursive_ident!();
+ | ------------------ in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `recursive_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+LL + ($variant:ident) => (if let EnumUnit::<i32, u32>::$variant {} = 5 { true } else { false });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:25:33
+ |
+LL | ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+...
+LL | recursive_ident!();
+ | ------------------ in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `recursive_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:38:51
+ |
+LL | ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | -------- ^^^ ^^^ type argument not allowed
+ | |
+ | not allowed on this type
+...
+LL | nested1_tt!();
+ | ------------- in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `nested2_tt` which comes from the expansion of the macro `nested1_tt` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+LL + ($variant:tt) => (if let EnumUnit::<i32, u32>::$variant {} = 5 { true } else { false });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:38:30
+ |
+LL | ($variant:tt) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+...
+LL | nested1_tt!();
+ | ------------- in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `nested2_tt` which comes from the expansion of the macro `nested1_tt` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:51:54
+ |
+LL | () => (nested2_ident!(VariantB));
+ | -------- not allowed on this type
+...
+LL | ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^ ^^^ type argument not allowed
+...
+LL | nested1_ident!();
+ | ---------------- in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `nested2_ident` which comes from the expansion of the macro `nested1_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+LL + ($variant:ident) => (if let EnumUnit::<i32, u32>::$variant {} = 5 { true } else { false });
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:51:33
+ |
+LL | ($variant:ident) => (if let EnumUnit::$variant::<i32, u32> {} = 5 { true } else { false });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+...
+LL | nested1_ident!();
+ | ---------------- in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `nested2_ident` which comes from the expansion of the macro `nested1_ident` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:64:58
+ |
+LL | ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ | -------- ^^^^^ ^^^^^ type argument not allowed
+ | |
+ | not allowed on this type
+...
+LL | nested1_tt_args_in_first_macro!();
+ | --------------------------------- in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `nested1_tt_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+LL + ($arg1:tt, $arg2:tt) => (if let EnumUnit::<$arg1, $arg2>::VariantB {}
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:64:37
+ |
+LL | ($arg1:tt, $arg2:tt) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `Enum<(), ()>`
+...
+LL | = 5 { true } else { false });
+ | - this expression has type `{integer}`
+...
+LL | nested1_tt_args_in_first_macro!();
+ | --------------------------------- in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `nested2_tt_args_in_first_macro` which comes from the expansion of the macro `nested1_tt_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:77:64
+ |
+LL | ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ | -------- ^^^^^ ^^^^^ type argument not allowed
+ | |
+ | not allowed on this type
+...
+LL | nested1_ident_args_in_first_macro!();
+ | ------------------------------------ in this macro invocation
+ |
+ = note: enum variants can't have type parameters
+ = note: this error originates in the macro `nested2_ident_args_in_first_macro` which comes from the expansion of the macro `nested1_ident_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+LL + ($arg1:ident, $arg2:ident) => (if let EnumUnit::<$arg1, $arg2>::VariantB {}
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:77:43
+ |
+LL | ($arg1:ident, $arg2:ident) => (if let EnumUnit::VariantB::<$arg1, $arg2> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected integer, found `Enum<(), ()>`
+...
+LL | = 5 { true } else { false });
+ | - this expression has type `{integer}`
+...
+LL | nested1_ident_args_in_first_macro!();
+ | ------------------------------------ in this macro invocation
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+ = note: this error originates in the macro `nested2_ident_args_in_first_macro` which comes from the expansion of the macro `nested1_ident_args_in_first_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0109]: type arguments are not allowed on this type
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:93:33
+ |
+LL | if let EnumUnit::VariantB::<i32, u32> {} = 5 { true } else { false };
+ | -------- ^^^ ^^^ type argument not allowed
+ | |
+ | not allowed on this type
+ |
+ = note: enum variants can't have type parameters
+help: you might have meant to specify type parameters on enum `Enum`
+ |
+LL - if let EnumUnit::VariantB::<i32, u32> {} = 5 { true } else { false };
+LL + if let EnumUnit::<i32, u32>::VariantB {} = 5 { true } else { false };
+ |
+
+error[E0308]: mismatched types
+ --> $DIR/issue-116473-ice-wrong-span-variant-args.rs:93:12
+ |
+LL | if let EnumUnit::VariantB::<i32, u32> {} = 5 { true } else { false };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `{integer}`
+ | |
+ | expected integer, found `Enum<(), ()>`
+ |
+ = note: expected type `{integer}`
+ found enum `Enum<(), ()>`
+
+error: aborting due to 14 previous errors
+
+Some errors have detailed explanations: E0109, E0308.
+For more information about an error, try `rustc --explain E0109`.
diff --git a/tests/ui/typeck/issue-13853.stderr b/tests/ui/typeck/issue-13853.stderr
index 8ecb8b680..0683c7829 100644
--- a/tests/ui/typeck/issue-13853.stderr
+++ b/tests/ui/typeck/issue-13853.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-13853.rs:14:9
|
LL | fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
- | - this type parameter - expected `I` because of return type
+ | - expected this type parameter - expected `I` because of return type
...
LL | self.iter()
| ^^^^^^^^^^^ expected type parameter `I`, found `Iter<'_, N>`
diff --git a/tests/ui/typeck/issue-36708.stderr b/tests/ui/typeck/issue-36708.stderr
index 140f19f1f..f1e0f4719 100644
--- a/tests/ui/typeck/issue-36708.stderr
+++ b/tests/ui/typeck/issue-36708.stderr
@@ -2,7 +2,12 @@ error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0
--> $DIR/issue-36708.rs:8:12
|
LL | fn foo<T>() {}
- | ^ found 1 type parameter, expected 0
+ | ^ found 1 type parameter
+ |
+ ::: $DIR/auxiliary/issue-36708.rs:4:5
+ |
+LL | fn foo();
+ | --------- expected 0 type parameters
error: aborting due to previous error
diff --git a/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr b/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr
index dc4bc5b5f..6c3302f29 100644
--- a/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr
+++ b/tests/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-57673-ice-on-deref-of-boxed-trait.rs:5:5
|
LL | fn ice(x: Box<dyn Iterator<Item=()>>) {
- | - help: try adding a return type: `-> (dyn Iterator<Item = ()> + 'static)`
+ | - help: try adding a return type: `-> (dyn Iterator<Item = ()> + 'static)`
LL | *x
| ^^ expected `()`, found `dyn Iterator`
|
diff --git a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr
index 0d72ae118..c46f4ec1e 100644
--- a/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr
+++ b/tests/ui/typeck/issue-90027-async-fn-return-suggestion.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-90027-async-fn-return-suggestion.rs:4:5
|
LL | async fn hello() {
- | - help: try adding a return type: `-> i32`
+ | - help: try adding a return type: `-> i32`
LL | 0
| ^ expected `()`, found integer
diff --git a/tests/ui/typeck/issue-91267.stderr b/tests/ui/typeck/issue-91267.stderr
index 72acd9c67..7e48b2519 100644
--- a/tests/ui/typeck/issue-91267.stderr
+++ b/tests/ui/typeck/issue-91267.stderr
@@ -14,7 +14,7 @@ error[E0308]: mismatched types
--> $DIR/issue-91267.rs:4:5
|
LL | fn main() {
- | - expected `()` because of default return type
+ | - expected `()` because of default return type
LL | type_ascribe!(0, u8<e<5>=e>)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `u8`
diff --git a/tests/ui/typeck/issue-91334.rs b/tests/ui/typeck/issue-91334.rs
index 29204276b..1ffc56e66 100644
--- a/tests/ui/typeck/issue-91334.rs
+++ b/tests/ui/typeck/issue-91334.rs
@@ -2,6 +2,6 @@
// error-pattern: this file contains an unclosed delimiter
-#![feature(generators)]
+#![feature(coroutines)]
fn f(){||yield(((){),
diff --git a/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr b/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr
index f53abe53b..c4f164295 100644
--- a/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr
+++ b/tests/ui/typeck/tag-that-dare-not-speak-its-name.stderr
@@ -8,6 +8,10 @@ LL | let x : char = last(y);
|
= note: expected type `char`
found enum `Option<_>`
+help: consider using `Option::expect` to unwrap the `Option<_>` value, panicking if the value is an `Option::None`
+ |
+LL | let x : char = last(y).expect("REASON");
+ | +++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr
index a3517af87..67ca2b061 100644
--- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr
+++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr
@@ -21,6 +21,8 @@ LL | trait Trait: Copy<dyn Send> {}
| ^^^^---------- help: remove these generics
| |
| expected 0 generic arguments
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/typeck-builtin-bound-type-parameters.rs:8:21
diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.rs b/tests/ui/ufcs/ufcs-explicit-self-bad.rs
index cb1fac0ba..9b0f99a18 100644
--- a/tests/ui/ufcs/ufcs-explicit-self-bad.rs
+++ b/tests/ui/ufcs/ufcs-explicit-self-bad.rs
@@ -36,6 +36,7 @@ impl<'a, T> SomeTrait for &'a Bar<T> {
fn dummy1(self: &&'a Bar<T>) { }
fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched `self` parameter type
//~^ ERROR mismatched `self` parameter type
+ //~| ERROR has an incompatible type for trait
fn dummy3(self: &&Bar<T>) {}
//~^ ERROR mismatched `self` parameter type
//~| expected reference `&'a Bar<T>`
diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr
index f325d1d81..0efaa41d4 100644
--- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr
+++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr
@@ -64,7 +64,7 @@ LL | fn dummy2(self: &Bar<T>) {}
| ^^^^^^^
error[E0308]: mismatched `self` parameter type
- --> $DIR/ufcs-explicit-self-bad.rs:39:21
+ --> $DIR/ufcs-explicit-self-bad.rs:40:21
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^^ lifetime mismatch
@@ -72,7 +72,7 @@ LL | fn dummy3(self: &&Bar<T>) {}
= note: expected reference `&'a Bar<T>`
found reference `&Bar<T>`
note: the anonymous lifetime defined here...
- --> $DIR/ufcs-explicit-self-bad.rs:39:22
+ --> $DIR/ufcs-explicit-self-bad.rs:40:22
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^
@@ -83,7 +83,7 @@ LL | impl<'a, T> SomeTrait for &'a Bar<T> {
| ^^
error[E0308]: mismatched `self` parameter type
- --> $DIR/ufcs-explicit-self-bad.rs:39:21
+ --> $DIR/ufcs-explicit-self-bad.rs:40:21
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^^ lifetime mismatch
@@ -96,12 +96,29 @@ note: the lifetime `'a` as defined here...
LL | impl<'a, T> SomeTrait for &'a Bar<T> {
| ^^
note: ...does not necessarily outlive the anonymous lifetime defined here
- --> $DIR/ufcs-explicit-self-bad.rs:39:22
+ --> $DIR/ufcs-explicit-self-bad.rs:40:22
|
LL | fn dummy3(self: &&Bar<T>) {}
| ^^^^^^^
-error: aborting due to 7 previous errors
+error[E0053]: method `dummy2` has an incompatible type for trait
+ --> $DIR/ufcs-explicit-self-bad.rs:37:21
+ |
+LL | fn dummy2(self: &Bar<T>) {}
+ | ------^^^^^^^
+ | | |
+ | | expected `&'a Bar<T>`, found `Bar<T>`
+ | help: change the self-receiver type to match the trait: `&self`
+ |
+note: type in trait
+ --> $DIR/ufcs-explicit-self-bad.rs:31:15
+ |
+LL | fn dummy2(&self);
+ | ^^^^^
+ = note: expected signature `fn(&&'a Bar<T>)`
+ found signature `fn(&Bar<T>)`
+
+error: aborting due to 8 previous errors
-Some errors have detailed explanations: E0307, E0308.
-For more information about an error, try `rustc --explain E0307`.
+Some errors have detailed explanations: E0053, E0307, E0308.
+For more information about an error, try `rustc --explain E0053`.
diff --git a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs
index 9d0aa4132..057bdf0f6 100644
--- a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs
+++ b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs
@@ -5,5 +5,5 @@
fn g<F>(_: F) where F: FnOnce(Option<F>) {}
fn main() {
- g(|_| { }); //~ ERROR closure/generator type that references itself
+ g(|_| { }); //~ ERROR closure/coroutine type that references itself
}
diff --git a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr
index 6d5dbca05..9d3c1902c 100644
--- a/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr
@@ -1,4 +1,4 @@
-error[E0644]: closure/generator type that references itself
+error[E0644]: closure/coroutine type that references itself
--> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7
|
LL | g(|_| { });
diff --git a/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr b/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr
index 0ea1c1dcd..ce4d0fe25 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(isize,)>` closure, found `S`
+error[E0277]: expected a `Fn(isize)` closure, found `S`
--> $DIR/unboxed-closures-fnmut-as-fn.rs:27:21
|
LL | let x = call_it(&S, 22);
- | ------- ^^ expected an `Fn<(isize,)>` closure, found `S`
+ | ------- ^^ expected an `Fn(isize)` closure, found `S`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.rs b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.rs
new file mode 100644
index 000000000..157383fed
--- /dev/null
+++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.rs
@@ -0,0 +1,23 @@
+fn test() {
+ let x = match **x { //~ ERROR
+ Some(&a) if { panic!() } => {}
+ };
+ let mut p = &x;
+
+ {
+ let mut closure = expect_sig(|p, y| *p = y);
+ closure(&mut p, &y); //~ ERROR
+ //~^ ERROR
+ }
+
+ deref(p); //~ ERROR
+}
+
+fn expect_sig<F>(f: F) -> F
+where
+ F: FnMut(&mut &i32, &i32),
+{
+ f
+}
+
+fn main() {}
diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr
new file mode 100644
index 000000000..1470c32d7
--- /dev/null
+++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr
@@ -0,0 +1,44 @@
+error[E0425]: cannot find value `x` in this scope
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:2:21
+ |
+LL | let x = match **x {
+ | ^ not found in this scope
+
+error[E0425]: cannot find value `y` in this scope
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:9:26
+ |
+LL | closure(&mut p, &y);
+ | ^ help: a local variable with a similar name exists: `p`
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:9:17
+ |
+LL | closure(&mut p, &y);
+ | ------- ^^^^^^ expected `&mut &i32`, found `&mut &()`
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected mutable reference `&mut &i32`
+ found mutable reference `&mut &()`
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:8:39
+ |
+LL | let mut closure = expect_sig(|p, y| *p = y);
+ | ^
+
+error[E0425]: cannot find function `deref` in this scope
+ --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:13:5
+ |
+LL | deref(p);
+ | ^^^^^ not found in this scope
+ |
+help: use the `.` operator to call the method `Deref::deref` on `&&()`
+ |
+LL - deref(p);
+LL + p.deref();
+ |
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0308, E0425.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs
index 9f76849e5..0999f61b0 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs
+++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.rs
@@ -1,7 +1,35 @@
use std::ops::FnMut;
-pub fn main() {
+fn main() {
let mut f = |x: isize, y: isize| -> isize { x + y };
- let z = f(1_usize, 2); //~ ERROR mismatched types
+ let z = f(1_usize, 2); //~ ERROR mismatched types
println!("{}", z);
+ let mut g = |x, y| { x + y };
+ let y = g(1_i32, 2);
+ let z = g(1_usize, 2); //~ ERROR mismatched types
+ println!("{}", z);
+}
+
+trait T {
+ fn bar(&self) {
+ let identity = |x| x;
+ identity(1u8);
+ identity(1u16); //~ ERROR mismatched types
+ let identity = |x| x;
+ identity(&1u8);
+ identity(&1u16); //~ ERROR mismatched types
+ }
+}
+
+struct S;
+
+impl T for S {
+ fn bar(&self) {
+ let identity = |x| x;
+ identity(1u8);
+ identity(1u16); //~ ERROR mismatched types
+ let identity = |x| x;
+ identity(&1u8);
+ identity(&1u16); //~ ERROR mismatched types
+ }
}
diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr
index 455f83f57..327df50e6 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr
@@ -16,6 +16,127 @@ help: change the type of the numeric literal from `usize` to `isize`
LL | let z = f(1_isize, 2);
| ~~~~~
-error: aborting due to previous error
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:9:15
+ |
+LL | let z = g(1_usize, 2);
+ | - ^^^^^^^ expected `i32`, found `usize`
+ | |
+ | arguments to this function are incorrect
+ |
+note: expected because the closure was earlier called with an argument of type `i32`
+ --> $DIR/unboxed-closures-type-mismatch.rs:8:15
+ |
+LL | let y = g(1_i32, 2);
+ | - ^^^^^ expected because this argument is of type `i32`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:7:18
+ |
+LL | let mut g = |x, y| { x + y };
+ | ^
+help: change the type of the numeric literal from `usize` to `i32`
+ |
+LL | let z = g(1_i32, 2);
+ | ~~~
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:17:18
+ |
+LL | identity(1u16);
+ | -------- ^^^^ expected `u8`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: expected because the closure was earlier called with an argument of type `u8`
+ --> $DIR/unboxed-closures-type-mismatch.rs:16:18
+ |
+LL | identity(1u8);
+ | -------- ^^^ expected because this argument is of type `u8`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:15:25
+ |
+LL | let identity = |x| x;
+ | ^
+help: change the type of the numeric literal from `u16` to `u8`
+ |
+LL | identity(1u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:20:18
+ |
+LL | identity(&1u16);
+ | -------- ^^^^^ expected `&u8`, found `&u16`
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected reference `&u8`
+ found reference `&u16`
+note: expected because the closure was earlier called with an argument of type `&u8`
+ --> $DIR/unboxed-closures-type-mismatch.rs:19:18
+ |
+LL | identity(&1u8);
+ | -------- ^^^^ expected because this argument is of type `&u8`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:18:25
+ |
+LL | let identity = |x| x;
+ | ^
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:30:18
+ |
+LL | identity(1u16);
+ | -------- ^^^^ expected `u8`, found `u16`
+ | |
+ | arguments to this function are incorrect
+ |
+note: expected because the closure was earlier called with an argument of type `u8`
+ --> $DIR/unboxed-closures-type-mismatch.rs:29:18
+ |
+LL | identity(1u8);
+ | -------- ^^^ expected because this argument is of type `u8`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:28:25
+ |
+LL | let identity = |x| x;
+ | ^
+help: change the type of the numeric literal from `u16` to `u8`
+ |
+LL | identity(1u8);
+ | ~~
+
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:33:18
+ |
+LL | identity(&1u16);
+ | -------- ^^^^^ expected `&u8`, found `&u16`
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected reference `&u8`
+ found reference `&u16`
+note: expected because the closure was earlier called with an argument of type `&u8`
+ --> $DIR/unboxed-closures-type-mismatch.rs:32:18
+ |
+LL | identity(&1u8);
+ | -------- ^^^^ expected because this argument is of type `&u8`
+ | |
+ | in this closure call
+note: closure parameter defined here
+ --> $DIR/unboxed-closures-type-mismatch.rs:31:25
+ |
+LL | let identity = |x| x;
+ | ^
+
+error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr b/tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr
index 802696e1b..d836af2b0 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `Fn<(&isize,)>` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `Fn(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-unsafe-extern-fn.rs:20:21
|
LL | let x = call_it(&square, 22);
@@ -14,7 +14,7 @@ note: required by a bound in `call_it`
LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
-error[E0277]: expected a `FnMut<(&isize,)>` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `FnMut(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-unsafe-extern-fn.rs:25:25
|
LL | let y = call_it_mut(&mut square, 22);
@@ -30,7 +30,7 @@ note: required by a bound in `call_it_mut`
LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
-error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `FnOnce(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-unsafe-extern-fn.rs:30:26
|
LL | let z = call_it_once(square, 22);
diff --git a/tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr b/tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr
index 0bbb9836c..c0dcf83a5 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `Fn(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-abi.rs:20:21
|
LL | let x = call_it(&square, 22);
- | ------- ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+ | ------- ^^^^^^^ expected an `Fn(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
@@ -13,11 +13,11 @@ note: required by a bound in `call_it`
LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
-error[E0277]: expected a `FnMut<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `FnMut(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-abi.rs:25:25
|
LL | let y = call_it_mut(&mut square, 22);
- | ----------- ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+ | ----------- ^^^^^^^^^^^ expected an `FnMut(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
@@ -28,11 +28,11 @@ note: required by a bound in `call_it_mut`
LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
-error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+error[E0277]: expected a `FnOnce(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-abi.rs:30:26
|
LL | let z = call_it_once(square, 22);
- | ------------ ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
+ | ------------ ^^^^^^ expected an `FnOnce(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr b/tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr
index 31a66790c..d261c38f5 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `Fn<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}`
+error[E0277]: expected a `Fn(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:21:21
|
LL | let x = call_it(&square, 22);
@@ -14,7 +14,7 @@ note: required by a bound in `call_it`
LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
-error[E0277]: expected a `FnMut<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}`
+error[E0277]: expected a `FnMut(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:26:25
|
LL | let y = call_it_mut(&mut square, 22);
@@ -30,7 +30,7 @@ note: required by a bound in `call_it_mut`
LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
-error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}`
+error[E0277]: expected a `FnOnce(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
--> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:31:26
|
LL | let z = call_it_once(square, 22);
diff --git a/tests/ui/uninhabited/diverging-guard.rs b/tests/ui/uninhabited/diverging-guard.rs
new file mode 100644
index 000000000..7d57cd51c
--- /dev/null
+++ b/tests/ui/uninhabited/diverging-guard.rs
@@ -0,0 +1,10 @@
+// check-pass
+
+enum Void {}
+
+fn main() {
+ let x: Void;
+ match x {
+ _ if { loop {} } => (),
+ }
+}
diff --git a/tests/ui/union/issue-81199.rs b/tests/ui/union/issue-81199.rs
index 628e7c6ed..b8b0d9d33 100644
--- a/tests/ui/union/issue-81199.rs
+++ b/tests/ui/union/issue-81199.rs
@@ -4,6 +4,7 @@ union PtrRepr<T: ?Sized> {
mut_ptr: *mut T,
components: PtrComponents<T>,
//~^ ERROR the trait bound
+ //~| ERROR field must implement `Copy`
}
#[repr(C)]
diff --git a/tests/ui/union/issue-81199.stderr b/tests/ui/union/issue-81199.stderr
index 5bb986753..0dd894beb 100644
--- a/tests/ui/union/issue-81199.stderr
+++ b/tests/ui/union/issue-81199.stderr
@@ -5,7 +5,7 @@ LL | components: PtrComponents<T>,
| ^^^^^^^^^^^^^^^^ the trait `Pointee` is not implemented for `T`
|
note: required by a bound in `PtrComponents`
- --> $DIR/issue-81199.rs:10:25
+ --> $DIR/issue-81199.rs:11:25
|
LL | struct PtrComponents<T: Pointee + ?Sized> {
| ^^^^^^^ required by this bound in `PtrComponents`
@@ -14,6 +14,19 @@ help: consider further restricting this bound
LL | union PtrRepr<T: ?Sized + Pointee> {
| +++++++++
-error: aborting due to previous error
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/issue-81199.rs:5:5
+ |
+LL | components: PtrComponents<T>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | components: std::mem::ManuallyDrop<PtrComponents<T>>,
+ | +++++++++++++++++++++++ +
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0740.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/union/union-unsafe.mir.stderr b/tests/ui/union/union-unsafe.mir.stderr
index 544213dbc..15f059ffa 100644
--- a/tests/ui/union/union-unsafe.mir.stderr
+++ b/tests/ui/union/union-unsafe.mir.stderr
@@ -1,5 +1,5 @@
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:33:5
+ --> $DIR/union-unsafe.rs:34:5
|
LL | *(u.p) = 13;
| ^^^^^^^^^^^ access to union field
@@ -7,7 +7,7 @@ LL | *(u.p) = 13;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:46:6
+ --> $DIR/union-unsafe.rs:47:6
|
LL | *u3.a = T::default();
| ^^^^ access to union field
@@ -15,7 +15,7 @@ LL | *u3.a = T::default();
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:52:6
+ --> $DIR/union-unsafe.rs:53:6
|
LL | *u3.a = T::default();
| ^^^^ access to union field
@@ -23,7 +23,7 @@ LL | *u3.a = T::default();
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:60:13
+ --> $DIR/union-unsafe.rs:61:13
|
LL | let a = u1.a;
| ^^^^ access to union field
@@ -31,7 +31,7 @@ LL | let a = u1.a;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:63:14
+ --> $DIR/union-unsafe.rs:64:14
|
LL | let U1 { a } = u1;
| ^ access to union field
@@ -39,7 +39,7 @@ LL | let U1 { a } = u1;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:64:12
+ --> $DIR/union-unsafe.rs:65:12
|
LL | if let U1 { a: 12 } = u1 {}
| ^^^^^^^^^^^^ access to union field
@@ -47,7 +47,15 @@ LL | if let U1 { a: 12 } = u1 {}
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:69:6
+ --> $DIR/union-unsafe.rs:66:12
+ |
+LL | if let Some(U1 { a: 13 }) = Some(u1) {}
+ | ^^^^^^^^^^^^^^^^^^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:71:6
|
LL | *u2.a = String::from("new");
| ^^^^ access to union field
@@ -55,7 +63,7 @@ LL | *u2.a = String::from("new");
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:73:6
+ --> $DIR/union-unsafe.rs:75:6
|
LL | *u3.a = 1;
| ^^^^ access to union field
@@ -63,13 +71,13 @@ LL | *u3.a = 1;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:77:6
+ --> $DIR/union-unsafe.rs:79:6
|
LL | *u3.a = String::from("new");
| ^^^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
-error: aborting due to 9 previous errors
+error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/union/union-unsafe.rs b/tests/ui/union/union-unsafe.rs
index 5e1837a90..d1465486f 100644
--- a/tests/ui/union/union-unsafe.rs
+++ b/tests/ui/union/union-unsafe.rs
@@ -1,30 +1,31 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
-use std::mem::ManuallyDrop;
use std::cell::RefCell;
+use std::mem::ManuallyDrop;
union U1 {
- a: u8
+ a: u8,
}
union U2 {
- a: ManuallyDrop<String>
+ a: ManuallyDrop<String>,
}
union U3<T> {
- a: ManuallyDrop<T>
+ a: ManuallyDrop<T>,
}
union U4<T: Copy> {
- a: T
+ a: T,
}
union URef {
p: &'static mut i32,
}
-union URefCell { // field that does not drop but is not `Copy`, either
+union URefCell {
+ // field that does not drop but is not `Copy`, either
a: (ManuallyDrop<RefCell<i32>>, i32),
}
@@ -62,6 +63,7 @@ fn main() {
let U1 { a } = u1; //~ ERROR access to union field is unsafe
if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe
+ if let Some(U1 { a: 13 }) = Some(u1) {} //~ ERROR access to union field is unsafe
// let U1 { .. } = u1; // OK
let mut u2 = U2 { a: ManuallyDrop::new(String::from("old")) }; // OK
diff --git a/tests/ui/union/union-unsafe.thir.stderr b/tests/ui/union/union-unsafe.thir.stderr
index f959fe5bd..9ce835497 100644
--- a/tests/ui/union/union-unsafe.thir.stderr
+++ b/tests/ui/union/union-unsafe.thir.stderr
@@ -1,5 +1,5 @@
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:33:6
+ --> $DIR/union-unsafe.rs:34:6
|
LL | *(u.p) = 13;
| ^^^^^ access to union field
@@ -7,7 +7,7 @@ LL | *(u.p) = 13;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:46:6
+ --> $DIR/union-unsafe.rs:47:6
|
LL | *u3.a = T::default();
| ^^^^ access to union field
@@ -15,7 +15,7 @@ LL | *u3.a = T::default();
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:52:6
+ --> $DIR/union-unsafe.rs:53:6
|
LL | *u3.a = T::default();
| ^^^^ access to union field
@@ -23,7 +23,7 @@ LL | *u3.a = T::default();
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:60:13
+ --> $DIR/union-unsafe.rs:61:13
|
LL | let a = u1.a;
| ^^^^ access to union field
@@ -31,7 +31,7 @@ LL | let a = u1.a;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:63:14
+ --> $DIR/union-unsafe.rs:64:14
|
LL | let U1 { a } = u1;
| ^ access to union field
@@ -39,15 +39,23 @@ LL | let U1 { a } = u1;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:64:8
+ --> $DIR/union-unsafe.rs:65:20
|
LL | if let U1 { a: 12 } = u1 {}
- | ^^^^^^^^^^^^^^^^^^^^^ access to union field
+ | ^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:69:6
+ --> $DIR/union-unsafe.rs:66:25
+ |
+LL | if let Some(U1 { a: 13 }) = Some(u1) {}
+ | ^^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:71:6
|
LL | *u2.a = String::from("new");
| ^^^^ access to union field
@@ -55,7 +63,7 @@ LL | *u2.a = String::from("new");
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:73:6
+ --> $DIR/union-unsafe.rs:75:6
|
LL | *u3.a = 1;
| ^^^^ access to union field
@@ -63,13 +71,13 @@ LL | *u3.a = 1;
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
error[E0133]: access to union field is unsafe and requires unsafe function or block
- --> $DIR/union-unsafe.rs:77:6
+ --> $DIR/union-unsafe.rs:79:6
|
LL | *u3.a = String::from("new");
| ^^^^ access to union field
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
-error: aborting due to 9 previous errors
+error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/union/union-unsized.mirunsafeck.stderr b/tests/ui/union/union-unsized.mirunsafeck.stderr
index 59ab835fb..f8da20413 100644
--- a/tests/ui/union/union-unsized.mirunsafeck.stderr
+++ b/tests/ui/union/union-unsized.mirunsafeck.stderr
@@ -17,7 +17,7 @@ LL | a: Box<str>,
| ++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/union-unsized.rs:13:8
+ --> $DIR/union-unsized.rs:14:8
|
LL | b: str,
| ^^^ doesn't have a size known at compile-time
@@ -34,6 +34,31 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | b: Box<str>,
| ++++ +
-error: aborting due to 2 previous errors
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/union-unsized.rs:5:5
+ |
+LL | a: str,
+ | ^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | a: std::mem::ManuallyDrop<str>,
+ | +++++++++++++++++++++++ +
+
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/union-unsized.rs:14:5
+ |
+LL | b: str,
+ | ^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | b: std::mem::ManuallyDrop<str>,
+ | +++++++++++++++++++++++ +
+
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0740.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/union/union-unsized.rs b/tests/ui/union/union-unsized.rs
index 8e897d7d3..b95b2e414 100644
--- a/tests/ui/union/union-unsized.rs
+++ b/tests/ui/union/union-unsized.rs
@@ -4,6 +4,7 @@
union U {
a: str,
//~^ ERROR the size for values of type
+ //~| ERROR field must implement `Copy`
b: u8,
}
@@ -12,6 +13,7 @@ union W {
a: u8,
b: str,
//~^ ERROR the size for values of type
+ //~| ERROR field must implement `Copy`
}
fn main() {}
diff --git a/tests/ui/union/union-unsized.thirunsafeck.stderr b/tests/ui/union/union-unsized.thirunsafeck.stderr
index 59ab835fb..f8da20413 100644
--- a/tests/ui/union/union-unsized.thirunsafeck.stderr
+++ b/tests/ui/union/union-unsized.thirunsafeck.stderr
@@ -17,7 +17,7 @@ LL | a: Box<str>,
| ++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/union-unsized.rs:13:8
+ --> $DIR/union-unsized.rs:14:8
|
LL | b: str,
| ^^^ doesn't have a size known at compile-time
@@ -34,6 +34,31 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | b: Box<str>,
| ++++ +
-error: aborting due to 2 previous errors
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/union-unsized.rs:5:5
+ |
+LL | a: str,
+ | ^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | a: std::mem::ManuallyDrop<str>,
+ | +++++++++++++++++++++++ +
+
+error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
+ --> $DIR/union-unsized.rs:14:5
+ |
+LL | b: str,
+ | ^^^^^^
+ |
+ = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
+help: wrap the field type in `ManuallyDrop<...>`
+ |
+LL | b: std::mem::ManuallyDrop<str>,
+ | +++++++++++++++++++++++ +
+
+error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0740.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/unknown-lint-tool-name.stderr b/tests/ui/unknown-lint-tool-name.stderr
index 5f8349ce6..72731ab1e 100644
--- a/tests/ui/unknown-lint-tool-name.stderr
+++ b/tests/ui/unknown-lint-tool-name.stderr
@@ -21,6 +21,7 @@ LL | #![deny(foo::bar)]
| ^^^
|
= help: add `#![register_tool(foo)]` to the crate root
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
--> $DIR/unknown-lint-tool-name.rs:4:9
@@ -29,6 +30,7 @@ LL | #[allow(foo::bar)]
| ^^^
|
= help: add `#![register_tool(foo)]` to the crate root
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors
diff --git a/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr b/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr
index 32f8d2f45..f0450aea4 100644
--- a/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr
+++ b/tests/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr
@@ -8,11 +8,13 @@ error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr b/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr
index 2a2a9811b..20a36b28d 100644
--- a/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr
+++ b/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr
@@ -20,6 +20,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unknown lint: `test_unstable_lint`
--> $DIR/deny-unstable-lint-inline.rs:4:1
@@ -29,6 +30,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors
diff --git a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr
index dd9ecf02f..a2deecf1c 100644
--- a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr
+++ b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr
@@ -8,11 +8,13 @@ warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `test_unstable_lint`
|
= note: the `test_unstable_lint` lint is unstable
= help: add `-Zcrate-attr="feature(test_unstable_lint)"` to the command-line options to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr
index 0548cd226..12afb2e29 100644
--- a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr
+++ b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr
@@ -20,6 +20,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: unknown lint: `test_unstable_lint`
--> $DIR/warn-unknown-unstable-lint-inline.rs:4:1
@@ -29,6 +30,7 @@ LL | #![allow(test_unstable_lint)]
|
= note: the `test_unstable_lint` lint is unstable
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 3 warnings emitted
diff --git a/tests/ui/unresolved/auxiliary/library.rs b/tests/ui/unresolved/auxiliary/library.rs
new file mode 100644
index 000000000..1169ed962
--- /dev/null
+++ b/tests/ui/unresolved/auxiliary/library.rs
@@ -0,0 +1 @@
+pub struct SomeUsefulType;
diff --git a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.rs b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.rs
new file mode 100644
index 000000000..af8207aaa
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.rs
@@ -0,0 +1,31 @@
+// Test that we don't prepend `::` to paths referencing crates from the extern prelude
+// when it can be avoided[^1] since it's more idiomatic to do so.
+//
+// [^1]: Counterexample: `unresolved-import-suggest-disambiguated-crate-name.rs`
+#![feature(decl_macro)] // allows us to create items with hygienic names
+
+// aux-crate:library=library.rs
+// edition: 2021
+
+mod hygiene {
+ make!();
+ macro make() {
+ // This won't conflict with the suggested *non-global* path as the syntax context differs.
+ mod library {}
+ }
+
+ mod module {}
+ use module::SomeUsefulType; //~ ERROR unresolved import `module::SomeUsefulType`
+}
+
+mod glob {
+ use inner::*;
+ mod inner {
+ mod library {}
+ }
+
+ mod module {}
+ use module::SomeUsefulType; //~ ERROR unresolved import `module::SomeUsefulType`
+}
+
+fn main() {}
diff --git a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr
new file mode 100644
index 000000000..b0352ab67
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr
@@ -0,0 +1,25 @@
+error[E0432]: unresolved import `module::SomeUsefulType`
+ --> $DIR/unresolved-import-avoid-suggesting-global-path.rs:18:9
+ |
+LL | use module::SomeUsefulType;
+ | ^^^^^^^^^^^^^^^^^^^^^^ no `SomeUsefulType` in `hygiene::module`
+ |
+help: consider importing this struct instead
+ |
+LL | use library::SomeUsefulType;
+ | ~~~~~~~~~~~~~~~~~~~~~~~
+
+error[E0432]: unresolved import `module::SomeUsefulType`
+ --> $DIR/unresolved-import-avoid-suggesting-global-path.rs:28:9
+ |
+LL | use module::SomeUsefulType;
+ | ^^^^^^^^^^^^^^^^^^^^^^ no `SomeUsefulType` in `glob::module`
+ |
+help: consider importing this struct instead
+ |
+LL | use library::SomeUsefulType;
+ | ~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.fixed b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.fixed
new file mode 100644
index 000000000..2b20d3f10
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.fixed
@@ -0,0 +1,19 @@
+// Regression test for issue #116970.
+//
+// When we suggest importing an item from a crate found in the extern prelude and there
+// happens to exist a module or type in the current scope with the same name as the crate,
+// disambiguate the suggested path by making it global (i.e., by prefixing it with `::`).
+//
+// For context, when it can be avoided we don't prepend `::` to paths referencing crates
+// from the extern prelude. See also `unresolved-import-avoid-suggesting-global-path.rs`.
+
+// run-rustfix
+
+// compile-flags: --crate-type=lib
+// aux-crate:library=library.rs
+// edition: 2021
+
+mod library {} // this module shares the same name as the external crate!
+
+mod module {}
+pub use ::library::SomeUsefulType; //~ ERROR unresolved import `module::SomeUsefulType`
diff --git a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.rs b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.rs
new file mode 100644
index 000000000..b810a7f52
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.rs
@@ -0,0 +1,19 @@
+// Regression test for issue #116970.
+//
+// When we suggest importing an item from a crate found in the extern prelude and there
+// happens to exist a module or type in the current scope with the same name as the crate,
+// disambiguate the suggested path by making it global (i.e., by prefixing it with `::`).
+//
+// For context, when it can be avoided we don't prepend `::` to paths referencing crates
+// from the extern prelude. See also `unresolved-import-avoid-suggesting-global-path.rs`.
+
+// run-rustfix
+
+// compile-flags: --crate-type=lib
+// aux-crate:library=library.rs
+// edition: 2021
+
+mod library {} // this module shares the same name as the external crate!
+
+mod module {}
+pub use module::SomeUsefulType; //~ ERROR unresolved import `module::SomeUsefulType`
diff --git a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr
new file mode 100644
index 000000000..f139c0f3c
--- /dev/null
+++ b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr
@@ -0,0 +1,14 @@
+error[E0432]: unresolved import `module::SomeUsefulType`
+ --> $DIR/unresolved-import-suggest-disambiguated-crate-name.rs:19:9
+ |
+LL | pub use module::SomeUsefulType;
+ | ^^^^^^^^^^^^^^^^^^^^^^ no `SomeUsefulType` in `module`
+ |
+help: consider importing this struct instead
+ |
+LL | pub use ::library::SomeUsefulType;
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr
index fbc621f4d..ea53bf59d 100644
--- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.mir.stderr
@@ -1,12 +1,12 @@
warning: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:5
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:13:5
|
LL | unsf();
| ^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
- --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:11:1
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:1
|
LL | unsafe fn foo() {
| ^^^^^^^^^^^^^^^
diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs
index a192f3445..1b429955c 100644
--- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.rs
@@ -1,17 +1,21 @@
// edition: 2024
// compile-flags: -Zunstable-options
// check-pass
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
#![crate_type = "lib"]
-
#![deny(unused_unsafe)]
unsafe fn unsf() {}
unsafe fn foo() {
unsf();
- //~^ WARN call to unsafe function is unsafe and requires unsafe block
+ //[mir]~^ WARN call to unsafe function is unsafe and requires unsafe block
+ //[thir]~^^ WARN call to unsafe function `unsf` is unsafe and requires unsafe block
// no unused_unsafe
- unsafe { unsf(); }
+ unsafe {
+ unsf();
+ }
}
diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr
new file mode 100644
index 000000000..d63843ed2
--- /dev/null
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.thir.stderr
@@ -0,0 +1,16 @@
+warning: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:13:5
+ |
+LL | unsf();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:12:1
+ |
+LL | unsafe fn foo() {
+ | ^^^^^^^^^^^^^^^
+ = note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/unsafe/initializing-ranged-via-ctor.stderr b/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
index d34554c66..13438fd31 100644
--- a/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
+++ b/tests/ui/unsafe/initializing-ranged-via-ctor.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `FnOnce<({integer},)>` closure, found `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
+error[E0277]: expected a `FnOnce({integer})` closure, found `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}`
--> $DIR/initializing-ranged-via-ctor.rs:9:34
|
LL | println!("{:?}", Some(1).map(NonZeroAndOneU8).unwrap());
diff --git a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr
index 9e9cbcf33..2267da315 100644
--- a/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr
+++ b/tests/ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.thir.stderr
@@ -16,9 +16,9 @@ LL | #[deny(unused_unsafe)]
error: unnecessary `unsafe` block
--> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:12:38
|
-LL | unsafe {
- | ------ because it's nested under this `unsafe` block
-...
+LL | unsafe {
+ | ------ because it's nested under this `unsafe` block
+LL | v.set_len(24);
LL | |w: &mut Vec<u32>| { unsafe {
| ^^^^^^ unnecessary `unsafe` block
diff --git a/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr
index 427843f8d..dc6bd72f5 100644
--- a/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr
+++ b/tests/ui/unsafe/ranged_ints2.mirunsafeck.stderr
@@ -6,6 +6,14 @@ LL | let y = &mut x.0;
|
= note: mutating layout constrained fields cannot statically be checked for valid values
-error: aborting due to previous error
+error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block
+ --> $DIR/ranged_ints2.rs:12:25
+ |
+LL | if let Some(NonZero(ref mut y)) = Some(x) {}
+ | ^^^^^^^^^ mutation of layout constrained field
+ |
+ = note: mutating layout constrained fields cannot statically be checked for valid values
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/unsafe/ranged_ints2.rs b/tests/ui/unsafe/ranged_ints2.rs
index 9a6bb18f9..ad9d598ab 100644
--- a/tests/ui/unsafe/ranged_ints2.rs
+++ b/tests/ui/unsafe/ranged_ints2.rs
@@ -9,4 +9,5 @@ pub(crate) struct NonZero<T>(pub(crate) T);
fn main() {
let mut x = unsafe { NonZero(1) };
let y = &mut x.0; //~ ERROR mutation of layout constrained field is unsafe
+ if let Some(NonZero(ref mut y)) = Some(x) {} //~ ERROR mutation of layout constrained field is unsafe
}
diff --git a/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr b/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr
index 427843f8d..dc6bd72f5 100644
--- a/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr
+++ b/tests/ui/unsafe/ranged_ints2.thirunsafeck.stderr
@@ -6,6 +6,14 @@ LL | let y = &mut x.0;
|
= note: mutating layout constrained fields cannot statically be checked for valid values
-error: aborting due to previous error
+error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block
+ --> $DIR/ranged_ints2.rs:12:25
+ |
+LL | if let Some(NonZero(ref mut y)) = Some(x) {}
+ | ^^^^^^^^^ mutation of layout constrained field
+ |
+ = note: mutating layout constrained fields cannot statically be checked for valid values
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr
index 13c080e5b..ad0621a1d 100644
--- a/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr
+++ b/tests/ui/unsafe/rfc-2585-unsafe_op_in_unsafe_fn.thir.stderr
@@ -5,6 +5,11 @@ LL | unsf();
| ^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:1
+ |
+LL | unsafe fn deny_level() {
+ | ^^^^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:4:9
|
@@ -46,6 +51,11 @@ LL | unsf();
| ^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:27:1
+ |
+LL | unsafe fn warning_level() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:8
|
@@ -76,12 +86,10 @@ LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
error: unnecessary `unsafe` block
- --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:14
+ --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:49:5
|
LL | unsafe { unsafe { unsf() } }
- | ------ ^^^^^^ unnecessary `unsafe` block
- | |
- | because it's nested under this `unsafe` block
+ | ^^^^^^ unnecessary `unsafe` block
error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
--> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:76:5
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed
index db1c10221..b59029df6 100644
--- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.fixed
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.fixed
@@ -1,7 +1,10 @@
// run-rustfix
// aux-build:external_unsafe_macro.rs
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
#![deny(unsafe_op_in_unsafe_fn)] //~ NOTE
+#![crate_name = "wrapping_unsafe_block_sugg"]
extern crate external_unsafe_macro;
@@ -9,11 +12,13 @@ unsafe fn unsf() {}
pub unsafe fn foo() { unsafe {
//~^ NOTE an unsafe function restricts its caller, but its body is safe by default
- unsf(); //~ ERROR call to unsafe function is unsafe
- //~^ NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
//~| NOTE
- unsf(); //~ ERROR call to unsafe function is unsafe
- //~^ NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
//~| NOTE
}}
@@ -39,10 +44,12 @@ pub unsafe fn baz() -> i32 { unsafe {
}}
macro_rules! unsafe_macro { () => (unsf()) }
-//~^ ERROR call to unsafe function is unsafe
+//[mir]~^ ERROR call to unsafe function is unsafe
+//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe
//~| NOTE
//~| NOTE
-//~| ERROR call to unsafe function is unsafe
+//[mir]~| ERROR call to unsafe function is unsafe
+//[thir]~| ERROR call to unsafe function `unsf` is unsafe
//~| NOTE
//~| NOTE
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr
index 43f619c27..7a1b83c73 100644
--- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.stderr
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.mir.stderr
@@ -1,23 +1,23 @@
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:12:5
+ --> $DIR/wrapping-unsafe-block-sugg.rs:15:5
|
LL | unsf();
| ^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
- --> $DIR/wrapping-unsafe-block-sugg.rs:10:1
+ --> $DIR/wrapping-unsafe-block-sugg.rs:13:1
|
LL | pub unsafe fn foo() {
| ^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
- --> $DIR/wrapping-unsafe-block-sugg.rs:4:9
+ --> $DIR/wrapping-unsafe-block-sugg.rs:6:9
|
LL | #![deny(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:15:5
+ --> $DIR/wrapping-unsafe-block-sugg.rs:19:5
|
LL | unsf();
| ^^^^^^ call to unsafe function
@@ -25,20 +25,20 @@ LL | unsf();
= note: consult the function's documentation for information on how to avoid undefined behavior
error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:22:13
+ --> $DIR/wrapping-unsafe-block-sugg.rs:27:13
|
LL | let y = *x;
| ^^ dereference of raw pointer
|
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
- --> $DIR/wrapping-unsafe-block-sugg.rs:20:1
+ --> $DIR/wrapping-unsafe-block-sugg.rs:25:1
|
LL | pub unsafe fn bar(x: *const i32) -> i32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:25:9
+ --> $DIR/wrapping-unsafe-block-sugg.rs:30:9
|
LL | y + *x
| ^^ dereference of raw pointer
@@ -46,20 +46,20 @@ LL | y + *x
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
error: use of mutable static is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:33:13
+ --> $DIR/wrapping-unsafe-block-sugg.rs:38:13
|
LL | let y = BAZ;
| ^^^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
- --> $DIR/wrapping-unsafe-block-sugg.rs:31:1
+ --> $DIR/wrapping-unsafe-block-sugg.rs:36:1
|
LL | pub unsafe fn baz() -> i32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of mutable static is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:36:9
+ --> $DIR/wrapping-unsafe-block-sugg.rs:41:9
|
LL | y + BAZ
| ^^^ use of mutable static
@@ -67,7 +67,7 @@ LL | y + BAZ
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:41:36
+ --> $DIR/wrapping-unsafe-block-sugg.rs:46:36
|
LL | macro_rules! unsafe_macro { () => (unsf()) }
| ^^^^^^ call to unsafe function
@@ -77,14 +77,14 @@ LL | unsafe_macro!();
|
= note: consult the function's documentation for information on how to avoid undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
- --> $DIR/wrapping-unsafe-block-sugg.rs:49:1
+ --> $DIR/wrapping-unsafe-block-sugg.rs:56:1
|
LL | pub unsafe fn unsafe_in_macro() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
error: call to unsafe function is unsafe and requires unsafe block (error E0133)
- --> $DIR/wrapping-unsafe-block-sugg.rs:41:36
+ --> $DIR/wrapping-unsafe-block-sugg.rs:46:36
|
LL | macro_rules! unsafe_macro { () => (unsf()) }
| ^^^^^^ call to unsafe function
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs b/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs
index 9c6be4589..3629b8a1b 100644
--- a/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.rs
@@ -1,7 +1,10 @@
// run-rustfix
// aux-build:external_unsafe_macro.rs
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
#![deny(unsafe_op_in_unsafe_fn)] //~ NOTE
+#![crate_name = "wrapping_unsafe_block_sugg"]
extern crate external_unsafe_macro;
@@ -9,11 +12,13 @@ unsafe fn unsf() {}
pub unsafe fn foo() {
//~^ NOTE an unsafe function restricts its caller, but its body is safe by default
- unsf(); //~ ERROR call to unsafe function is unsafe
- //~^ NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
//~| NOTE
- unsf(); //~ ERROR call to unsafe function is unsafe
- //~^ NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
//~| NOTE
}
@@ -39,10 +44,12 @@ pub unsafe fn baz() -> i32 {
}
macro_rules! unsafe_macro { () => (unsf()) }
-//~^ ERROR call to unsafe function is unsafe
+//[mir]~^ ERROR call to unsafe function is unsafe
+//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe
//~| NOTE
//~| NOTE
-//~| ERROR call to unsafe function is unsafe
+//[mir]~| ERROR call to unsafe function is unsafe
+//[thir]~| ERROR call to unsafe function `unsf` is unsafe
//~| NOTE
//~| NOTE
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed
new file mode 100644
index 000000000..b59029df6
--- /dev/null
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.fixed
@@ -0,0 +1,73 @@
+// run-rustfix
+// aux-build:external_unsafe_macro.rs
+// revisions: mir thir
+// [thir]compile-flags: -Zthir-unsafeck
+
+#![deny(unsafe_op_in_unsafe_fn)] //~ NOTE
+#![crate_name = "wrapping_unsafe_block_sugg"]
+
+extern crate external_unsafe_macro;
+
+unsafe fn unsf() {}
+
+pub unsafe fn foo() { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
+ //~| NOTE
+ unsf(); //[mir]~ ERROR call to unsafe function is unsafe
+ //[thir]~^ ERROR call to unsafe function `unsf` is unsafe
+ //~^^ NOTE
+ //~| NOTE
+}}
+
+pub unsafe fn bar(x: *const i32) -> i32 { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ let y = *x; //~ ERROR dereference of raw pointer is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
+ y + *x //~ ERROR dereference of raw pointer is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
+}}
+
+static mut BAZ: i32 = 0;
+pub unsafe fn baz() -> i32 { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ let y = BAZ; //~ ERROR use of mutable static is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
+ y + BAZ //~ ERROR use of mutable static is unsafe and requires unsafe block
+ //~^ NOTE
+ //~| NOTE
+}}
+
+macro_rules! unsafe_macro { () => (unsf()) }
+//[mir]~^ ERROR call to unsafe function is unsafe
+//[thir]~^^ ERROR call to unsafe function `unsf` is unsafe
+//~| NOTE
+//~| NOTE
+//[mir]~| ERROR call to unsafe function is unsafe
+//[thir]~| ERROR call to unsafe function `unsf` is unsafe
+//~| NOTE
+//~| NOTE
+
+pub unsafe fn unsafe_in_macro() { unsafe {
+ //~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ unsafe_macro!();
+ //~^ NOTE
+ //~| NOTE
+ unsafe_macro!();
+ //~^ NOTE
+ //~| NOTE
+}}
+
+pub unsafe fn unsafe_in_external_macro() {
+ // FIXME: https://github.com/rust-lang/rust/issues/112504
+ // FIXME: ~^ NOTE an unsafe function restricts its caller, but its body is safe by default
+ external_unsafe_macro::unsafe_macro!();
+ external_unsafe_macro::unsafe_macro!();
+}
+
+fn main() {}
diff --git a/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr
new file mode 100644
index 000000000..b1fb35f85
--- /dev/null
+++ b/tests/ui/unsafe/wrapping-unsafe-block-sugg.thir.stderr
@@ -0,0 +1,99 @@
+error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:15:5
+ |
+LL | unsf();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/wrapping-unsafe-block-sugg.rs:13:1
+ |
+LL | pub unsafe fn foo() {
+ | ^^^^^^^^^^^^^^^^^^^
+note: the lint level is defined here
+ --> $DIR/wrapping-unsafe-block-sugg.rs:6:9
+ |
+LL | #![deny(unsafe_op_in_unsafe_fn)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:19:5
+ |
+LL | unsf();
+ | ^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:27:13
+ |
+LL | let y = *x;
+ | ^^ dereference of raw pointer
+ |
+ = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/wrapping-unsafe-block-sugg.rs:25:1
+ |
+LL | pub unsafe fn bar(x: *const i32) -> i32 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:30:9
+ |
+LL | y + *x
+ | ^^ dereference of raw pointer
+ |
+ = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+
+error: use of mutable static is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:38:13
+ |
+LL | let y = BAZ;
+ | ^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/wrapping-unsafe-block-sugg.rs:36:1
+ |
+LL | pub unsafe fn baz() -> i32 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of mutable static is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:41:9
+ |
+LL | y + BAZ
+ | ^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:46:36
+ |
+LL | macro_rules! unsafe_macro { () => (unsf()) }
+ | ^^^^^^ call to unsafe function
+...
+LL | unsafe_macro!();
+ | --------------- in this macro invocation
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+note: an unsafe function restricts its caller, but its body is safe by default
+ --> $DIR/wrapping-unsafe-block-sugg.rs:56:1
+ |
+LL | pub unsafe fn unsafe_in_macro() {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+ --> $DIR/wrapping-unsafe-block-sugg.rs:46:36
+ |
+LL | macro_rules! unsafe_macro { () => (unsf()) }
+ | ^^^^^^ call to unsafe function
+...
+LL | unsafe_macro!();
+ | --------------- in this macro invocation
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+ = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 8 previous errors
+
diff --git a/tests/ui/unsized/maybe-bounds-where.rs b/tests/ui/unsized/maybe-bounds-where.rs
index d7af0c424..7e82a3eb4 100644
--- a/tests/ui/unsized/maybe-bounds-where.rs
+++ b/tests/ui/unsized/maybe-bounds-where.rs
@@ -11,11 +11,11 @@ trait Trait<'a> {}
struct S4<T>(T) where for<'a> T: ?Trait<'a>;
//~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared
-//~| WARN default bound relaxed for a type parameter
+//~| WARN relaxing a default bound only does something for `?Sized`
struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
//~^ ERROR type parameter has more than one relaxed default bound
-//~| WARN default bound relaxed for a type parameter
+//~| WARN relaxing a default bound only does something for `?Sized`
impl<T> S1<T> {
fn f() where T: ?Sized {}
diff --git a/tests/ui/unsized/maybe-bounds-where.stderr b/tests/ui/unsized/maybe-bounds-where.stderr
index 39bc1b88e..683bd387b 100644
--- a/tests/ui/unsized/maybe-bounds-where.stderr
+++ b/tests/ui/unsized/maybe-bounds-where.stderr
@@ -28,23 +28,23 @@ error: `?Trait` bounds are only permitted at the point where a type parameter is
LL | fn f() where T: ?Sized {}
| ^^^^^^
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/maybe-bounds-where.rs:12:11
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/maybe-bounds-where.rs:12:34
|
LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
- | ^
+ | ^^^^^^^^^^
error[E0203]: type parameter has more than one relaxed default bound, only one is supported
- --> $DIR/maybe-bounds-where.rs:16:11
+ --> $DIR/maybe-bounds-where.rs:16:33
|
LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
- | ^
+ | ^^^^^^^^^^^^^^^ ^^^^^^
-warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
- --> $DIR/maybe-bounds-where.rs:16:11
+warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
+ --> $DIR/maybe-bounds-where.rs:16:33
|
LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
- | ^
+ | ^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors; 2 warnings emitted
diff --git a/tests/ui/unsized/unsize-coerce-multiple-adt-params.rs b/tests/ui/unsized/unsize-coerce-multiple-adt-params.rs
new file mode 100644
index 000000000..eba341ff2
--- /dev/null
+++ b/tests/ui/unsized/unsize-coerce-multiple-adt-params.rs
@@ -0,0 +1,29 @@
+// check-pass
+
+struct Foo<T, U>
+where
+ (T, U): Trait,
+{
+ f: <(T, U) as Trait>::Assoc,
+}
+
+trait Trait {
+ type Assoc: ?Sized;
+}
+
+struct Count<const N: usize>;
+
+impl<const N: usize> Trait for (i32, Count<N>) {
+ type Assoc = [(); N];
+}
+
+impl<'a> Trait for (u32, ()) {
+ type Assoc = [()];
+}
+
+// Test that we can unsize several trait params in creative ways.
+fn unsize<const N: usize>(x: &Foo<i32, Count<N>>) -> &Foo<u32, ()> {
+ x
+}
+
+fn main() {}
diff --git a/tests/ui/unsized/unsized-trait-impl-self-type.rs b/tests/ui/unsized/unsized-trait-impl-self-type.rs
index df571a833..603c0a221 100644
--- a/tests/ui/unsized/unsized-trait-impl-self-type.rs
+++ b/tests/ui/unsized/unsized-trait-impl-self-type.rs
@@ -9,6 +9,7 @@ struct S5<Y>(Y);
impl<X: ?Sized> T3<X> for S5<X> {
//~^ ERROR the size for values of type
+ //~| ERROR not all trait items implemented
}
fn main() { }
diff --git a/tests/ui/unsized/unsized-trait-impl-self-type.stderr b/tests/ui/unsized/unsized-trait-impl-self-type.stderr
index 4955d463f..5bc8dc590 100644
--- a/tests/ui/unsized/unsized-trait-impl-self-type.stderr
+++ b/tests/ui/unsized/unsized-trait-impl-self-type.stderr
@@ -24,6 +24,16 @@ LL - impl<X: ?Sized> T3<X> for S5<X> {
LL + impl<X> T3<X> for S5<X> {
|
-error: aborting due to previous error
+error[E0046]: not all trait items implemented, missing: `foo`
+ --> $DIR/unsized-trait-impl-self-type.rs:10:1
+ |
+LL | fn foo(&self, z: &Z);
+ | --------------------- `foo` from trait
+...
+LL | impl<X: ?Sized> T3<X> for S5<X> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0046, E0277.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/unsized/unsized-trait-impl-trait-arg.rs b/tests/ui/unsized/unsized-trait-impl-trait-arg.rs
index 96e7e371f..e7602b175 100644
--- a/tests/ui/unsized/unsized-trait-impl-trait-arg.rs
+++ b/tests/ui/unsized/unsized-trait-impl-trait-arg.rs
@@ -7,6 +7,7 @@ trait T2<Z> {
struct S4<Y: ?Sized>(Box<Y>);
impl<X: ?Sized> T2<X> for S4<X> {
//~^ ERROR the size for values of type
+ //~| ERROR not all trait items implemented
}
fn main() { }
diff --git a/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr b/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
index 8761c293a..e9353d2bb 100644
--- a/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
+++ b/tests/ui/unsized/unsized-trait-impl-trait-arg.stderr
@@ -21,6 +21,16 @@ help: consider relaxing the implicit `Sized` restriction
LL | trait T2<Z: ?Sized> {
| ++++++++
-error: aborting due to previous error
+error[E0046]: not all trait items implemented, missing: `foo`
+ --> $DIR/unsized-trait-impl-trait-arg.rs:8:1
+ |
+LL | fn foo(&self, z: Z);
+ | -------------------- `foo` from trait
+...
+LL | impl<X: ?Sized> T2<X> for S4<X> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0046, E0277.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/unsized/unsized7.rs b/tests/ui/unsized/unsized7.rs
index 422a78481..63e015c28 100644
--- a/tests/ui/unsized/unsized7.rs
+++ b/tests/ui/unsized/unsized7.rs
@@ -11,6 +11,7 @@ trait T1<Z: T> {
struct S3<Y: ?Sized>(Box<Y>);
impl<X: ?Sized + T> T1<X> for S3<X> {
//~^ ERROR the size for values of type
+ //~| ERROR not all trait items implemented
}
fn main() { }
diff --git a/tests/ui/unsized/unsized7.stderr b/tests/ui/unsized/unsized7.stderr
index c313a2724..2edde1596 100644
--- a/tests/ui/unsized/unsized7.stderr
+++ b/tests/ui/unsized/unsized7.stderr
@@ -21,6 +21,16 @@ help: consider relaxing the implicit `Sized` restriction
LL | trait T1<Z: T + ?Sized> {
| ++++++++
-error: aborting due to previous error
+error[E0046]: not all trait items implemented, missing: `dummy`
+ --> $DIR/unsized7.rs:12:1
+ |
+LL | fn dummy(&self) -> Z;
+ | --------------------- `dummy` from trait
+...
+LL | impl<X: ?Sized + T> T1<X> for S3<X> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `dummy` in implementation
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0046, E0277.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/use/use-super-global-path.stderr b/tests/ui/use/use-super-global-path.stderr
index 7014a12e9..00d172f47 100644
--- a/tests/ui/use/use-super-global-path.stderr
+++ b/tests/ui/use/use-super-global-path.stderr
@@ -9,6 +9,8 @@ error[E0433]: failed to resolve: global paths cannot start with `super`
|
LL | use ::super::{S, Z};
| ^^^^^ global paths cannot start with `super`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0433]: failed to resolve: global paths cannot start with `super`
--> $DIR/use-super-global-path.rs:11:15
diff --git a/tests/ui/weird-exprs.rs b/tests/ui/weird-exprs.rs
index 892b28135..6d40d6377 100644
--- a/tests/ui/weird-exprs.rs
+++ b/tests/ui/weird-exprs.rs
@@ -1,6 +1,6 @@
// run-pass
-#![feature(generators)]
+#![feature(coroutines)]
#![allow(non_camel_case_types)]
#![allow(dead_code)]
diff --git a/tests/ui/wf/hir-wf-check-erase-regions.rs b/tests/ui/wf/hir-wf-check-erase-regions.rs
index 3855f2c35..2820d5f6d 100644
--- a/tests/ui/wf/hir-wf-check-erase-regions.rs
+++ b/tests/ui/wf/hir-wf-check-erase-regions.rs
@@ -5,6 +5,7 @@ pub struct Table<T, const N: usize>([Option<T>; N]);
impl<'a, T, const N: usize> IntoIterator for &'a Table<T, N> {
type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; //~ ERROR `&'a T` is not an iterator
+ //~^ ERROR `&'a T` is not an iterator
type Item = &'a T;
fn into_iter(self) -> Self::IntoIter { //~ ERROR `&'a T` is not an iterator
diff --git a/tests/ui/wf/hir-wf-check-erase-regions.stderr b/tests/ui/wf/hir-wf-check-erase-regions.stderr
index 2843983c7..eb0a8f8f6 100644
--- a/tests/ui/wf/hir-wf-check-erase-regions.stderr
+++ b/tests/ui/wf/hir-wf-check-erase-regions.stderr
@@ -11,7 +11,7 @@ note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
error[E0277]: `&'a T` is not an iterator
- --> $DIR/hir-wf-check-erase-regions.rs:10:27
+ --> $DIR/hir-wf-check-erase-regions.rs:11:27
|
LL | fn into_iter(self) -> Self::IntoIter {
| ^^^^^^^^^^^^^^ `&'a T` is not an iterator
@@ -22,6 +22,18 @@ LL | fn into_iter(self) -> Self::IntoIter {
note: required by a bound in `Flatten`
--> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
-error: aborting due to 2 previous errors
+error[E0277]: `&'a T` is not an iterator
+ --> $DIR/hir-wf-check-erase-regions.rs:7:21
+ |
+LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
+ |
+ = help: the trait `Iterator` is not implemented for `&'a T`
+ = help: the trait `Iterator` is implemented for `&mut I`
+ = note: required for `Flatten<std::slice::Iter<'a, T>>` to implement `Iterator`
+note: required by a bound in `std::iter::IntoIterator::IntoIter`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/wf/issue-110157.rs b/tests/ui/wf/issue-110157.rs
index 43a8ce72f..07e2c5d58 100644
--- a/tests/ui/wf/issue-110157.rs
+++ b/tests/ui/wf/issue-110157.rs
@@ -2,6 +2,7 @@ struct NeedsDropTypes<'tcx, F>(std::marker::PhantomData<&'tcx F>);
impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
//~^ ERROR type annotations needed
+//~| ERROR not all trait items implemented
where
F: Fn(&Missing) -> Result<I, ()>,
//~^ ERROR cannot find type `Missing` in this scope
diff --git a/tests/ui/wf/issue-110157.stderr b/tests/ui/wf/issue-110157.stderr
index 91d801e94..16bd34a6d 100644
--- a/tests/ui/wf/issue-110157.stderr
+++ b/tests/ui/wf/issue-110157.stderr
@@ -1,11 +1,11 @@
error[E0412]: cannot find type `Missing` in this scope
- --> $DIR/issue-110157.rs:6:12
+ --> $DIR/issue-110157.rs:7:12
|
LL | F: Fn(&Missing) -> Result<I, ()>,
| ^^^^^^^ not found in this scope
error[E0412]: cannot find type `Missing` in this scope
- --> $DIR/issue-110157.rs:8:24
+ --> $DIR/issue-110157.rs:9:24
|
LL | I: Iterator<Item = Missing>,
| ^^^^^^^ not found in this scope
@@ -26,7 +26,22 @@ LL | impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
LL | I: Iterator<Item = Missing>,
| ------------------------ unsatisfied trait bound introduced here
-error: aborting due to 3 previous errors
+error[E0046]: not all trait items implemented, missing: `Item`, `next`
+ --> $DIR/issue-110157.rs:3:1
+ |
+LL | / impl<'tcx, F, I> Iterator for NeedsDropTypes<'tcx, F>
+LL | |
+LL | |
+LL | | where
+LL | | F: Fn(&Missing) -> Result<I, ()>,
+LL | |
+LL | | I: Iterator<Item = Missing>,
+ | |________________________________^ missing `Item`, `next` in implementation
+ |
+ = help: implement the missing item: `type Item = /* Type */;`
+ = help: implement the missing item: `fn next(&mut self) -> Option<<Self as Iterator>::Item> { todo!() }`
+
+error: aborting due to 4 previous errors
-Some errors have detailed explanations: E0283, E0412.
-For more information about an error, try `rustc --explain E0283`.
+Some errors have detailed explanations: E0046, E0283, E0412.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/wf/unnormalized-projection-guides-inference.rs b/tests/ui/wf/unnormalized-projection-guides-inference.rs
new file mode 100644
index 000000000..ca2d6c2e8
--- /dev/null
+++ b/tests/ui/wf/unnormalized-projection-guides-inference.rs
@@ -0,0 +1,24 @@
+// The WF requirements of the *unnormalized* form of type annotations
+// can guide inference.
+// check-pass
+
+pub trait EqualTo {
+ type Ty;
+}
+impl<X> EqualTo for X {
+ type Ty = X;
+}
+
+trait MyTrait<U: EqualTo<Ty = Self>> {
+ type Out;
+}
+impl<T, U: EqualTo<Ty = T>> MyTrait<U> for T {
+ type Out = ();
+}
+
+fn main() {
+ let _: <_ as MyTrait<u8>>::Out;
+ // We shoud be able to infer a value for the inference variable above.
+ // The WF of the unnormalized projection requires `u8: EqualTo<Ty = _>`,
+ // which is sufficient to guide inference.
+}
diff --git a/tests/ui/wf/wf-const-type.rs b/tests/ui/wf/wf-const-type.rs
index df79aa267..64b0d9c8d 100644
--- a/tests/ui/wf/wf-const-type.rs
+++ b/tests/ui/wf/wf-const-type.rs
@@ -9,6 +9,7 @@ struct NotCopy;
const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
//~^ ERROR E0277
+//~| ERROR E0277
fn main() { }
diff --git a/tests/ui/wf/wf-const-type.stderr b/tests/ui/wf/wf-const-type.stderr
index 617969720..039e90770 100644
--- a/tests/ui/wf/wf-const-type.stderr
+++ b/tests/ui/wf/wf-const-type.stderr
@@ -16,6 +16,24 @@ LL + #[derive(Copy)]
LL | struct NotCopy;
|
-error: aborting due to previous error
+error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
+ --> $DIR/wf-const-type.rs:10:50
+ |
+LL | const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
+ | ^^^^ the trait `Copy` is not implemented for `NotCopy`
+ |
+ = note: required for `Option<NotCopy>` to implement `Copy`
+note: required by a bound in `IsCopy`
+ --> $DIR/wf-const-type.rs:7:17
+ |
+LL | struct IsCopy<T:Copy> { t: T }
+ | ^^^^ required by this bound in `IsCopy`
+help: consider annotating `NotCopy` with `#[derive(Copy)]`
+ |
+LL + #[derive(Copy)]
+LL | struct NotCopy;
+ |
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr b/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
index 40a25c7df..85f507336 100644
--- a/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
+++ b/tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr
@@ -11,6 +11,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `Box<S>` to `Box<dyn Trait>`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -26,6 +27,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `Box<S>` to `Box<(dyn Trait + 'static)>`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -41,6 +43,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `Box<S>` to `Box<dyn Trait>`
error: aborting due to 3 previous errors
diff --git a/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr b/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
index e2c71df2f..a2a196316 100644
--- a/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
+++ b/tests/ui/wf/wf-convert-unsafe-trait-obj.stderr
@@ -11,6 +11,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `&S` to `&dyn Trait`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -26,6 +27,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `&S` to `&dyn Trait`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -41,6 +43,7 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: only type `S` implements the trait, consider using it directly instead
= note: required for the cast from `&S` to `&dyn Trait`
error: aborting due to 3 previous errors
diff --git a/tests/ui/wf/wf-fn-where-clause.stderr b/tests/ui/wf/wf-fn-where-clause.stderr
index 2aec641e7..cd6c051fe 100644
--- a/tests/ui/wf/wf-fn-where-clause.stderr
+++ b/tests/ui/wf/wf-fn-where-clause.stderr
@@ -14,6 +14,15 @@ help: consider further restricting type parameter `U`
LL | fn foo<T,U>() where T: ExtraCopy<U>, U: std::marker::Copy
| ++++++++++++++++++++++
+error[E0038]: the trait `Copy` cannot be made into an object
+ --> $DIR/wf-fn-where-clause.rs:12:16
+ |
+LL | fn bar() where Vec<dyn Copy>:, {}
+ | ^^^^^^^^^^^^^ `Copy` cannot be made into an object
+ |
+ = note: the trait cannot be made into an object because it requires `Self: Sized`
+ = note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+
error[E0277]: the size for values of type `(dyn Copy + 'static)` cannot be known at compilation time
--> $DIR/wf-fn-where-clause.rs:12:16
|
@@ -34,15 +43,6 @@ LL | struct Vec<T> {
LL | t: T,
| - ...if indirection were used here: `Box<T>`
-error[E0038]: the trait `Copy` cannot be made into an object
- --> $DIR/wf-fn-where-clause.rs:12:16
- |
-LL | fn bar() where Vec<dyn Copy>:, {}
- | ^^^^^^^^^^^^^ `Copy` cannot be made into an object
- |
- = note: the trait cannot be made into an object because it requires `Self: Sized`
- = note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
-
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0038, E0277.
diff --git a/tests/ui/wf/wf-impl-associated-type-region.stderr b/tests/ui/wf/wf-impl-associated-type-region.stderr
index b9d4857a3..e6fb81247 100644
--- a/tests/ui/wf/wf-impl-associated-type-region.stderr
+++ b/tests/ui/wf/wf-impl-associated-type-region.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-impl-associated-type-region.rs:10:16
|
+LL | impl<'a, T> Foo<'a> for T {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Bar = &'a T;
| ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Foo<'a> for T {
| ++++
diff --git a/tests/ui/wf/wf-in-fn-type-static.stderr b/tests/ui/wf/wf-in-fn-type-static.stderr
index 73fbb9ca6..45ad9fba0 100644
--- a/tests/ui/wf/wf-in-fn-type-static.stderr
+++ b/tests/ui/wf/wf-in-fn-type-static.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-in-fn-type-static.rs:13:8
|
LL | x: fn() -> &'static T
- | ^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+ | ^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the reference type `&'static T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Foo<T: 'static> {
| +++++++++
@@ -13,9 +16,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-in-fn-type-static.rs:18:8
|
LL | x: fn(&'static T)
- | ^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+ | ^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the reference type `&'static T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Bar<T: 'static> {
| +++++++++
diff --git a/tests/ui/wf/wf-in-obj-type-static.stderr b/tests/ui/wf/wf-in-obj-type-static.stderr
index c3ad42dd5..4b9b18916 100644
--- a/tests/ui/wf/wf-in-obj-type-static.stderr
+++ b/tests/ui/wf/wf-in-obj-type-static.stderr
@@ -2,9 +2,12 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-in-obj-type-static.rs:14:8
|
LL | x: dyn Object<&'static T>
- | ^^^^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | the parameter type `T` must be valid for the static lifetime...
+ | ...so that the reference type `&'static T` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | struct Foo<T: 'static> {
| +++++++++
diff --git a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
index 4d4d8b2ab..e0cf42fd1 100644
--- a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
+++ b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
@@ -1,10 +1,12 @@
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:16
|
+LL | impl<'a, T> Trait<'a, T> for usize {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = &'a fn(T);
| ^^^^^^^^^ ...so that the reference type `&'a fn(T)` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for usize {
| ++++
@@ -12,10 +14,12 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:16
|
+LL | impl<'a, T> Trait<'a, T> for u32 {
+ | -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
LL | type Out = &'a dyn Baz<T>;
| ^^^^^^^^^^^^^^ ...so that the reference type `&'a (dyn Baz<T> + 'a)` does not outlive the data it points at
|
-help: consider adding an explicit lifetime bound...
+help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
| ++++
diff --git a/tests/ui/wf/wf-static-type.rs b/tests/ui/wf/wf-static-type.rs
index 1c35e1daf..f454fe30e 100644
--- a/tests/ui/wf/wf-static-type.rs
+++ b/tests/ui/wf/wf-static-type.rs
@@ -9,6 +9,7 @@ struct NotCopy;
static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
//~^ ERROR E0277
+//~| ERROR E0277
fn main() { }
diff --git a/tests/ui/wf/wf-static-type.stderr b/tests/ui/wf/wf-static-type.stderr
index bb5a57834..65dae2601 100644
--- a/tests/ui/wf/wf-static-type.stderr
+++ b/tests/ui/wf/wf-static-type.stderr
@@ -16,6 +16,24 @@ LL + #[derive(Copy)]
LL | struct NotCopy;
|
-error: aborting due to previous error
+error[E0277]: the trait bound `NotCopy: Copy` is not satisfied
+ --> $DIR/wf-static-type.rs:10:51
+ |
+LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
+ | ^^^^ the trait `Copy` is not implemented for `NotCopy`
+ |
+ = note: required for `Option<NotCopy>` to implement `Copy`
+note: required by a bound in `IsCopy`
+ --> $DIR/wf-static-type.rs:7:17
+ |
+LL | struct IsCopy<T:Copy> { t: T }
+ | ^^^^ required by this bound in `IsCopy`
+help: consider annotating `NotCopy` with `#[derive(Copy)]`
+ |
+LL + #[derive(Copy)]
+LL | struct NotCopy;
+ |
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/wf/wf-trait-associated-type-region.stderr b/tests/ui/wf/wf-trait-associated-type-region.stderr
index 6e2cc8aba..ca7aeb55b 100644
--- a/tests/ui/wf/wf-trait-associated-type-region.stderr
+++ b/tests/ui/wf/wf-trait-associated-type-region.stderr
@@ -1,11 +1,16 @@
error[E0309]: the associated type `<Self as SomeTrait<'a>>::Type1` may not live long enough
--> $DIR/wf-trait-associated-type-region.rs:9:18
|
+LL | trait SomeTrait<'a> {
+ | -- the associated type `<Self as SomeTrait<'a>>::Type1` must be valid for the lifetime `'a` as defined here...
+LL | type Type1;
LL | type Type2 = &'a Self::Type1;
- | ^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^ ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at
|
- = help: consider adding an explicit lifetime bound `<Self as SomeTrait<'a>>::Type1: 'a`...
- = note: ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at
+help: consider adding an explicit lifetime bound
+ |
+LL | type Type2 = &'a Self::Type1 where <Self as SomeTrait<'a>>::Type1: 'a;
+ | ++++++++++++++++++++++++++++++++++++++++
error: aborting due to previous error
diff --git a/tests/ui/wf/wf-unsafe-trait-obj-match.stderr b/tests/ui/wf/wf-unsafe-trait-obj-match.stderr
index 66504e440..a0279774a 100644
--- a/tests/ui/wf/wf-unsafe-trait-obj-match.stderr
+++ b/tests/ui/wf/wf-unsafe-trait-obj-match.stderr
@@ -11,6 +11,10 @@ LL | | }
|
= note: expected reference `&S`
found reference `&R`
+help: consider using a semicolon here, but this will discard any values in the match arms
+ |
+LL | };
+ | +
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-unsafe-trait-obj-match.rs:26:21
@@ -25,6 +29,9 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Trait` for this new enum and using it instead:
+ S
+ R
= note: required for the cast from `&S` to `&dyn Trait`
error[E0038]: the trait `Trait` cannot be made into an object
@@ -44,6 +51,9 @@ LL | trait Trait: Sized {}
| ----- ^^^^^ ...because it requires `Self: Sized`
| |
| this trait cannot be made into an object...
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Trait` for this new enum and using it instead:
+ S
+ R
= note: required for the cast from `&R` to `&dyn Trait`
error: aborting due to 3 previous errors