diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/compile.rs | 5 | ||||
| -rw-r--r-- | src/bootstrap/test.rs | 8 | ||||
| -rw-r--r-- | src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile | 4 | ||||
| -rwxr-xr-x | src/ci/pgo.sh | 4 | ||||
| -rw-r--r-- | src/doc/rustc/src/SUMMARY.md | 2 | ||||
| -rw-r--r-- | src/doc/rustc/src/platform-support/fuchsia.md | 295 | ||||
| -rw-r--r-- | src/doc/rustc/src/platform-support/unknown-uefi.md | 254 | ||||
| -rw-r--r-- | src/doc/rustc/src/targets/custom.md | 4 | ||||
| -rw-r--r-- | src/etc/htmldocck.py | 1 | ||||
| -rw-r--r-- | src/librustdoc/clean/auto_trait.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/clean/blanket_impl.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 25 | ||||
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 85 | ||||
| -rw-r--r-- | src/librustdoc/clean/types.rs | 28 | ||||
| -rw-r--r-- | src/librustdoc/clean/utils.rs | 3 | ||||
| -rw-r--r-- | src/librustdoc/core.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/doctest.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/fold.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 22 | ||||
| -rw-r--r-- | src/librustdoc/html/templates/page.html | 14 | ||||
| -rw-r--r-- | src/librustdoc/html/templates/print_item.html | 4 | ||||
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 20 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 1 | ||||
| -rw-r--r-- | src/librustdoc/passes/check_doc_test_visibility.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/passes/collect_trait_impls.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/scrape_examples.rs | 3 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/coverage/compiletest-ignore-dir | 3 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/coverage/coverage_tools.mk | 6 | ||||
| -rw-r--r-- | src/test/run-make/coverage-llvmir/Makefile (renamed from src/test/run-make-fulldeps/coverage-llvmir/Makefile) | 2 | ||||
| -rw-r--r-- | src/test/run-make/coverage-llvmir/filecheck.testprog.txt (renamed from src/test/run-make-fulldeps/coverage-llvmir/filecheck.testprog.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-llvmir/testprog.rs (renamed from src/test/run-make-fulldeps/coverage-llvmir/testprog.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/Makefile (renamed from src/test/run-make-fulldeps/coverage-reports/Makefile) | 2 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.abort.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.abort.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.assert.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.assert.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.async.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.async2.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async2.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.closure.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.closure_macro.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure_macro.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.closure_macro_async.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure_macro_async.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.conditions.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.conditions.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.continue.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.continue.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.dead_code.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.dead_code.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.doctest.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.doctest.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.drop_trait.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.drop_trait.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.generator.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.generator.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.generics.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.generics.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.if.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.if_else.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if_else.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.inline-dead.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline-dead.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.inline.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.inner_items.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inner_items.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.issue-83601.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-83601.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.issue-84561.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-84561.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.issue-85461.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-85461.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.issue-93054.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-93054.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.lazy_boolean.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.lazy_boolean.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.loop_break_value.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loop_break_value.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.loops_branches.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loops_branches.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.match_or_pattern.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.match_or_pattern.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.nested_loops.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.nested_loops.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.no_cov_crate.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.no_cov_crate.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.overflow.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.overflow.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.panic_unwind.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.panic_unwind.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.partial_eq.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.partial_eq.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.simple_loop.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_loop.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.simple_match.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_match.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.tight_inf_loop.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.tight_inf_loop.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.try_error_result.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.try_error_result.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.unused.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.unused.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.unused_mod.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.unused_mod.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.uses_crate.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_crate.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_inline_crate.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.while.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.while_early_ret.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while_early_ret.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage-reports/expected_show_coverage.yield.txt (renamed from src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.yield.txt) | 0 | ||||
| -rwxr-xr-x | src/test/run-make/coverage-reports/normalize_paths.py (renamed from src/test/run-make-fulldeps/coverage-reports/normalize_paths.py) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/WARNING_KEEP_NAMES_SHORT.txt (renamed from src/test/run-make-fulldeps/coverage/WARNING_KEEP_NAMES_SHORT.txt) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/abort.rs (renamed from src/test/run-make-fulldeps/coverage/abort.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/assert.rs (renamed from src/test/run-make-fulldeps/coverage/assert.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/async.rs (renamed from src/test/run-make-fulldeps/coverage/async.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/async2.rs (renamed from src/test/run-make-fulldeps/coverage/async2.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/closure.rs (renamed from src/test/run-make-fulldeps/coverage/closure.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/closure_macro.rs (renamed from src/test/run-make-fulldeps/coverage/closure_macro.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/closure_macro_async.rs (renamed from src/test/run-make-fulldeps/coverage/closure_macro_async.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/compiletest-ignore-dir | 3 | ||||
| -rw-r--r-- | src/test/run-make/coverage/conditions.rs (renamed from src/test/run-make-fulldeps/coverage/conditions.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/continue.rs (renamed from src/test/run-make-fulldeps/coverage/continue.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/coverage_tools.mk | 6 | ||||
| -rw-r--r-- | src/test/run-make/coverage/dead_code.rs (renamed from src/test/run-make-fulldeps/coverage/dead_code.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/doctest.rs (renamed from src/test/run-make-fulldeps/coverage/doctest.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/drop_trait.rs (renamed from src/test/run-make-fulldeps/coverage/drop_trait.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/generator.rs (renamed from src/test/run-make-fulldeps/coverage/generator.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/generics.rs (renamed from src/test/run-make-fulldeps/coverage/generics.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/if.rs (renamed from src/test/run-make-fulldeps/coverage/if.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/if_else.rs (renamed from src/test/run-make-fulldeps/coverage/if_else.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/inline-dead.rs (renamed from src/test/run-make-fulldeps/coverage/inline-dead.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/inline.rs (renamed from src/test/run-make-fulldeps/coverage/inline.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/inner_items.rs (renamed from src/test/run-make-fulldeps/coverage/inner_items.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/issue-83601.rs (renamed from src/test/run-make-fulldeps/coverage/issue-83601.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/issue-84561.rs (renamed from src/test/run-make-fulldeps/coverage/issue-84561.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/issue-85461.rs (renamed from src/test/run-make-fulldeps/coverage/issue-85461.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/issue-93054.rs (renamed from src/test/run-make-fulldeps/coverage/issue-93054.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/lazy_boolean.rs (renamed from src/test/run-make-fulldeps/coverage/lazy_boolean.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/lib/doctest_crate.rs (renamed from src/test/run-make-fulldeps/coverage/lib/doctest_crate.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/lib/inline_always_with_dead_code.rs (renamed from src/test/run-make-fulldeps/coverage/lib/inline_always_with_dead_code.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/lib/unused_mod_helper.rs (renamed from src/test/run-make-fulldeps/coverage/lib/unused_mod_helper.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/lib/used_crate.rs (renamed from src/test/run-make-fulldeps/coverage/lib/used_crate.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/lib/used_inline_crate.rs (renamed from src/test/run-make-fulldeps/coverage/lib/used_inline_crate.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/loop_break_value.rs (renamed from src/test/run-make-fulldeps/coverage/loop_break_value.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/loops_branches.rs (renamed from src/test/run-make-fulldeps/coverage/loops_branches.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/match_or_pattern.rs (renamed from src/test/run-make-fulldeps/coverage/match_or_pattern.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/nested_loops.rs (renamed from src/test/run-make-fulldeps/coverage/nested_loops.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/no_cov_crate.rs (renamed from src/test/run-make-fulldeps/coverage/no_cov_crate.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/overflow.rs (renamed from src/test/run-make-fulldeps/coverage/overflow.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/panic_unwind.rs (renamed from src/test/run-make-fulldeps/coverage/panic_unwind.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/partial_eq.rs (renamed from src/test/run-make-fulldeps/coverage/partial_eq.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/simple_loop.rs (renamed from src/test/run-make-fulldeps/coverage/simple_loop.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/simple_match.rs (renamed from src/test/run-make-fulldeps/coverage/simple_match.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/tight_inf_loop.rs (renamed from src/test/run-make-fulldeps/coverage/tight_inf_loop.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/try_error_result.rs (renamed from src/test/run-make-fulldeps/coverage/try_error_result.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/unused.rs (renamed from src/test/run-make-fulldeps/coverage/unused.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/unused_mod.rs (renamed from src/test/run-make-fulldeps/coverage/unused_mod.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/uses_crate.rs (renamed from src/test/run-make-fulldeps/coverage/uses_crate.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/uses_inline_crate.rs (renamed from src/test/run-make-fulldeps/coverage/uses_inline_crate.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/while.rs (renamed from src/test/run-make-fulldeps/coverage/while.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/while_early_ret.rs (renamed from src/test/run-make-fulldeps/coverage/while_early_ret.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/coverage/yield.rs (renamed from src/test/run-make-fulldeps/coverage/yield.rs) | 0 | ||||
| -rw-r--r-- | src/test/run-make/pass-linker-flags-from-dep/Makefile | 10 | ||||
| -rw-r--r-- | src/test/run-make/pass-linker-flags-from-dep/main.rs | 3 | ||||
| -rw-r--r-- | src/test/run-make/pass-linker-flags-from-dep/native_dep_1.rs | 1 | ||||
| -rw-r--r-- | src/test/run-make/pass-linker-flags-from-dep/native_dep_2.rs | 1 | ||||
| -rw-r--r-- | src/test/run-make/pass-linker-flags-from-dep/rust_dep.rs | 9 | ||||
| -rw-r--r-- | src/test/run-make/pass-linker-flags/Makefile | 4 | ||||
| -rw-r--r-- | src/test/run-make/pass-linker-flags/rs.rs | 1 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/z-help.stdout | 1 | ||||
| -rw-r--r-- | src/test/ui/anonymous-higher-ranked-lifetime.stderr | 66 | ||||
| -rw-r--r-- | src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/coercion/issue-53475.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/coercion/issue-53475.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/errors/issue-99572-impl-trait-on-pointer.rs | 25 | ||||
| -rw-r--r-- | src/test/ui/errors/issue-99572-impl-trait-on-pointer.stderr | 31 | ||||
| -rw-r--r-- | src/test/ui/generator/issue-88653.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/generator/issue-88653.stderr | 7 | ||||
| -rw-r--r-- | src/test/ui/generic-associated-types/anonymize-bound-vars.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/generic-associated-types/bugs/issue-88382.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/index-help.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/indexing-requires-a-uint.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/integral-indexing.stderr | 32 | ||||
| -rw-r--r-- | src/test/ui/intrinsics/const-eval-select-bad.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/let-else/let-else-temp-borrowck.rs | 26 | ||||
| -rw-r--r-- | src/test/ui/let-else/let-else-temporary-lifetime.rs | 63 | ||||
| -rw-r--r-- | src/test/ui/manual/manual-link-bad-kind.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/manual/manual-link-bad-kind.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/manual/manual-link-unsupported-kind.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/manual/manual-link-unsupported-kind.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/E0631.stderr | 24 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr | 18 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/fn-variance-1.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/issue-36053-2.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/native-library-link-flags/empty-kind-1.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/native-library-link-flags/empty-kind-1.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/native-library-link-flags/empty-kind-2.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/native-library-link-flags/empty-kind-2.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/native-library-link-flags/link-arg-error.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/native-library-link-flags/link-arg-error.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/native-library-link-flags/link-arg-from-rs.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/native-library-link-flags/link-arg-from-rs.stderr | 16 | ||||
| -rw-r--r-- | src/test/ui/on-unimplemented/slice-index.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/parser/issues/issue-35813-postfix-after-cast.rs | 66 | ||||
| -rw-r--r-- | src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr | 68 | ||||
| -rw-r--r-- | src/test/ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/str/str-idx.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/str/str-mut-idx.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/suggestions/pattern-slice-vec.fixed | 4 | ||||
| -rw-r--r-- | src/test/ui/suggestions/pattern-slice-vec.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/suggestions/pattern-slice-vec.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/suggestions/suggest-dereferencing-index.fixed | 7 | ||||
| -rw-r--r-- | src/test/ui/suggestions/suggest-dereferencing-index.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/suggestions/suggest-dereferencing-index.stderr | 17 | ||||
| -rw-r--r-- | src/test/ui/type/ascription/issue-54516.fixed | 2 | ||||
| -rw-r--r-- | src/test/ui/type/ascription/issue-54516.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/type/ascription/issue-54516.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/type/ascription/issue-60933.fixed | 2 | ||||
| -rw-r--r-- | src/test/ui/type/ascription/issue-60933.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/type/ascription/issue-60933.stderr | 2 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs | 3 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/utils/author.rs | 2 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_utils/src/lib.rs | 2 | ||||
| -rw-r--r-- | src/tools/rustc-workspace-hack/Cargo.toml | 8 |
193 files changed, 1244 insertions, 321 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index aa7cda46bda..dd2b9d59366 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -111,6 +111,11 @@ impl Step for Std { builder.update_submodule(&Path::new("library").join("stdarch")); + // Profiler information requires LLVM's compiler-rt + if builder.config.profiler { + builder.update_submodule(&Path::new("src/llvm-project")); + } + let mut target_deps = builder.ensure(StartupObjects { compiler, target }); let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index fd583da9082..5c8034d53e3 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1384,9 +1384,13 @@ note: if you're sure you want to do this, please open an issue as to why. In the .arg(builder.ensure(tool::JsonDocCk { compiler: json_compiler, target })); } - if mode == "run-make" && suite.ends_with("fulldeps") { + if mode == "run-make" { let rust_demangler = builder - .ensure(tool::RustDemangler { compiler, target, extra_features: Vec::new() }) + .ensure(tool::RustDemangler { + compiler, + target: compiler.host, + extra_features: Vec::new(), + }) .expect("in-tree tool"); cmd.arg("--rust-demangler-path").arg(rust_demangler); } diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile index f262bc3c7d8..b56776df1cb 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile @@ -98,8 +98,8 @@ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/ RUN ./build-clang.sh ENV CC=clang CXX=clang++ -# rustc-perf version from 2022-05-18 -ENV PERF_COMMIT f66cc8f3e04392b0e2fd811f21fd1ece6ebaded3 +# rustc-perf version from 2022-07-22 +ENV PERF_COMMIT 3c253134664fdcba862c539d37f0de18557a9a4c RUN curl -LS -o perf.zip https://github.com/rust-lang/rustc-perf/archive/$PERF_COMMIT.zip && \ unzip perf.zip && \ mv rustc-perf-$PERF_COMMIT rustc-perf && \ diff --git a/src/ci/pgo.sh b/src/ci/pgo.sh index 4773dc09960..b60b7868d06 100755 --- a/src/ci/pgo.sh +++ b/src/ci/pgo.sh @@ -100,8 +100,8 @@ if isLinux; then cp -r /tmp/rustc-perf $RUSTC_PERF chown -R $(whoami): $RUSTC_PERF else - # rustc-perf version from 2022-05-18 - PERF_COMMIT=f66cc8f3e04392b0e2fd811f21fd1ece6ebaded3 + # rustc-perf version from 2022-07-22 + PERF_COMMIT=3c253134664fdcba862c539d37f0de18557a9a4c retry curl -LS -o $PGO_TMP/perf.zip \ https://github.com/rust-lang/rustc-perf/archive/$PERF_COMMIT.zip && \ cd $PGO_TMP && unzip -q perf.zip && \ diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md index f6348b2bddc..d168af60c2d 100644 --- a/src/doc/rustc/src/SUMMARY.md +++ b/src/doc/rustc/src/SUMMARY.md @@ -21,6 +21,7 @@ - [armv6k-nintendo-3ds](platform-support/armv6k-nintendo-3ds.md) - [armv7-unknown-linux-uclibceabi](platform-support/armv7-unknown-linux-uclibceabi.md) - [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md) + - [\*-fuchsia](platform-support/fuchsia.md) - [\*-kmc-solid_\*](platform-support/kmc-solid.md) - [m68k-unknown-linux-gnu](platform-support/m68k-unknown-linux-gnu.md) - [mips64-openwrt-linux-musl](platform-support/mips64-openwrt-linux-musl.md) @@ -28,6 +29,7 @@ - [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md) - [*-pc-windows-gnullvm](platform-support/pc-windows-gnullvm.md) - [*-unknown-openbsd](platform-support/openbsd.md) + - [\*-unknown-uefi](platform-support/unknown-uefi.md) - [wasm64-unknown-unknown](platform-support/wasm64-unknown-unknown.md) - [x86_64-unknown-none](platform-support/x86_64-unknown-none.md) - [Targets](targets/index.md) diff --git a/src/doc/rustc/src/platform-support/fuchsia.md b/src/doc/rustc/src/platform-support/fuchsia.md new file mode 100644 index 00000000000..61bd1b425bc --- /dev/null +++ b/src/doc/rustc/src/platform-support/fuchsia.md @@ -0,0 +1,295 @@ +# `aarch64-fuchsia` and `x86_64-fuchsia` + +**Tier: 2** + +[Fuchsia] is a modern open source operating system that's simple, secure, +updatable, and performant. + +[Fuchsia]: https://fuchsia.dev/ + +## Target maintainers + +The [Fuchsia team]: + +[Fuchsia team]: https://team-api.infra.rust-lang.org/v1/teams/fuchsia.json + +- Tyler Mandry ([@tmandry](https://github.com/tmandry)) +- Dan Johnson ([@computerdruid](https://github.com/computerdruid)) +- David Koloski ([@djkoloski](https://github.com/djkoloski)) +- Andrew Pollack ([@andrewpollack](https://github.com/andrewpollack)) +- Joseph Ryan ([@P1n3appl3](https://github.com/P1n3appl3)) + +As the team evolves over time, the specific members listed here may differ from +the members reported by the API. The API should be considered to be +authoritative if this occurs. Instead of pinging individual members, use +`@rustbot ping fuchsia` to contact the team on GitHub. + +## Requirements + +This target is cross-compiled from a host environment. Development may be done +from the [source tree] or using the Fuchsia SDK. + +[source tree]: https://fuchsia.dev/fuchsia-src/get-started/learn/build + +Fuchsia targets support std and follow the `sysv64` calling convention on +x86_64. Fuchsia binaries use the ELF file format. + +## Building the target + +Before building Rust for Fuchsia, you'll need a clang toolchain that supports +Fuchsia as well. A recent version (14+) of clang should be sufficient to compile +Rust for Fuchsia. + +You'll also need a recent copy of the [Fuchsia SDK], which provides the tools +and binaries required to build and link programs for Fuchsia. + +[Fuchsia SDK]: https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core + +x86-64 and AArch64 Fuchsia targets can be enabled using the following +configuration. + +In `config.toml`, add: + +```toml +[build] +target = ["<host_platform>", "aarch64-fuchsia", "x86_64-fuchsia"] + +[target.x86_64-fuchsia] +llvm-libunwind = "in-tree" + +[target.aarch64-fuchsia] +llvm-libunwind = "in-tree" +``` + +Additionally, the following environment variables must be configured (for +example, using a script like `config-env.sh`): + +```sh +# Configure this environment variable to be the path to the downloaded SDK +export SDK_PATH="<SDK path goes here>" + +export CFLAGS_aarch64_fuchsia="--target=aarch64-fuchsia --sysroot=${SDK_PATH}/arch/arm64/sysroot -I${SDK_PATH}/pkg/fdio/include" +export CXXFLAGS_aarch64_fuchsia="--target=aarch64-fuchsia --sysroot=${SDK_PATH}/arch/arm64/sysroot -I${SDK_PATH}/pkg/fdio/include" +export LDFLAGS_aarch64_fuchsia="--target=aarch64-fuchsia --sysroot=${SDK_PATH}/arch/arm64/sysroot -L${SDK_PATH}/arch/arm64/lib" +export CARGO_TARGET_AARCH64_FUCHSIA_RUSTFLAGS="-C link-arg=--sysroot=${SDK_PATH}/arch/arm64/sysroot -Lnative=${SDK_PATH}/arch/arm64/sysroot/lib -Lnative=${SDK_PATH}/arch/arm64/lib" +export CFLAGS_x86_64_fuchsia="--target=x86_64-fuchsia --sysroot=${SDK_PATH}/arch/x64/sysroot -I${SDK_PATH}/pkg/fdio/include" +export CXXFLAGS_x86_64_fuchsia="--target=x86_64-fuchsia --sysroot=${SDK_PATH}/arch/x64/sysroot -I${SDK_PATH}/pkg/fdio/include" +export LDFLAGS_x86_64_fuchsia="--target=x86_64-fuchsia --sysroot=${SDK_PATH}/arch/x64/sysroot -L${SDK_PATH}/arch/x64/lib" +export CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS="-C link-arg=--sysroot=${SDK_PATH}/arch/x64/sysroot -Lnative=${SDK_PATH}/arch/x64/sysroot/lib -Lnative=${SDK_PATH}/arch/x64/lib" +``` + +These can be run together in a shell environment by executing +`(source config-env.sh && ./x.py install)`. + +## Building Rust programs + +After compiling Rust binaries, you'll need to build a component, package it, and +serve it to a Fuchsia device or emulator. All of this can be done using the +Fuchsia SDK. + +As an example, we'll compile and run this simple program on a Fuchsia emulator: + +**`hello_fuchsia.rs`** +```rust +fn main() { + println!("Hello Fuchsia!"); +} + +#[test] +fn it_works() { + assert_eq!(2 + 2, 4); +} +``` + +Create a new file named `hello_fuchsia.rs` and fill out its contents with that +code. + +### Create a package + +On Fuchsia, a package is the unit of distribution for software. We'll need to +create a new package directory where we will place files like our finished +binary and any data it may need. The working directory will have this layout: + +```txt +hello_fuchsia.rs +hello_fuchsia.cml +package +┣━ bin +┃ ┗━ hello_fuchsia +┣━ meta +┃ ┣━ package +┃ ┗━ hello_fuchsia.cm +┗━ hello_fuchsia.manifest +``` + +Make the `package`, `package/bin`, and `package/meta` directories and create the +following files inside: + +**`package/meta/package`** +```json +{"name":"hello_fuchsia","version":0} +``` + +The `package` file describes our package's name and version number. Every +package must contain one. + +**`package/hello_fuchsia.manifest`** +```txt +bin/hello_fuchsia=package/bin/hello_fuchsia +lib/ld.so.1=<SDK_PATH>/arch/x64/sysroot/dist/lib/ld.so.1 +lib/libfdio.so=<SDK_PATH>/arch/x64/dist/libfdio.so +meta/package=package/meta/package +meta/hello_fuchsia.cm=package/meta/hello_fuchsia.cm +``` + +*Note: Relative manifest paths are resolved starting from the working directory +of `pm`. Make sure to fill out `<SDK_PATH>` with the path to the downloaded +SDK.* + +The `.manifest` file will be used to describe the contents of the package by +relating their location when installed to their location on the file system. You +can use this to make a package pull files from other places, but for this +example we'll just be placing everything in the `package` directory. + +### Compiling a binary + +Using your freshly compiled `rustc`, you can compile a binary for Fuchsia using +the following options: + +* `--target x86_64-fuchsia`/`--target aarch64-fuchsia`: Targets the Fuchsia + platform of your choice +* `-Lnative ${SDK_PATH}/arch/${ARCH}/lib`: Link against Fuchsia libraries from + the SDK +* `-Lnative ${SDK_PATH}/arch/${ARCH}/sysroot/lib`: Link against Fuchsia kernel + libraries from the SDK + +Putting it all together: + +```sh +# Configure these for the Fuchsia target of your choice +TARGET_ARCH="<x86_64-fuchsia|aarch64-fuchsia>" +ARCH="<x64|aarch64>" + +rustc --target ${TARGET_ARCH} -Lnative=${SDK_PATH}/arch/${ARCH}/lib -Lnative=${SDK_PATH}/arch/${ARCH}/sysroot/lib -o package/bin/hello_fuchsia hello_fuchsia.rs +``` + +### Bulding a component + +On Fuchsia, components require a component manifest written in Fuchia's markup +language called CML. The Fuchsia devsite contains an [overview of CML] and a +[reference for the file format]. Here's a basic one that can run our single binary: + +[overview of CML]: https://fuchsia.dev/fuchsia-src/concepts/components/v2/component_manifests +[reference for the file format]: https://fuchsia.dev/reference/cml + +**`hello_fuchsia.cml`** +```txt +{ + include: [ "syslog/client.shard.cml" ], + program: { + runner: "elf", + binary: "bin/hello_fuchsia", + }, +} +``` + +Now we can compile that CML into a component manifest: + +```sh +${SDK_PATH}/tools/${ARCH}/cmc compile hello_fuchsia.cml --includepath ${SDK_PATH}/pkg -o package/meta/hello_fuchsia.cm +``` + +`--includepath` tells the compiler where to look for `include`s from our CML. +In our case, we're only using `syslog/client.shard.cml`. + +### Building and publishing a package + +Next, we'll build our package as defined by our manifest: + +```sh +${SDK_PATH}/tools/${ARCH}/pm -o hello_fuchsia -m package/hello_fuchsia.manifest build -output-package-manifest hello_fuchsia_manifest +``` + +This will produce `hello_fuchsia_manifest` which is a package manifest we can +publish directly to a repository. We can set up that repository with: + +```sh +${SDK_PATH}/tools/${ARCH}/pm newrepo -repo repo +``` + +And then publish our new package to that repository with: + +```sh +${SDK_PATH}/tools/${ARCH}/pm publish -repo repo -lp -f <(echo "hello_fuchsia_manifest") +``` + +Then we can add it to `ffx`'s package server as `hello-fuchsia` using: + +```sh +${SDK_PATH}/tools/${ARCH}/ffx repository add-from-pm repo -r hello-fuchsia +``` + +### Starting the emulator + +Start a Fuchsia emulator in a new terminal using: + +```sh +${SDK_PATH}/tools/${ARCH}/ffx product-bundle get workstation_eng.qemu-${ARCH} +${SDK_PATH}/tools/${ARCH}/ffx emu start workstation_eng.qemu-${ARCH} --headless +``` + +Then, once the emulator has been started: + +```sh +${SDK_PATH}/tools/${ARCH}/ffx target repository register +``` + +And watch the logs from the emulator in a separate terminal: + +```sh +${SDK_PATH}/tools/${ARCH}/ffx log --since now +``` + +Finally, run the component: + +```sh +${SDK_PATH}/tools/${ARCH}/ffx component run fuchsia-pkg://hello-fuchsia/hello_fuchsia#meta/hello_fuchsia.cm +``` + +On reruns of the component, the `--recreate` argument may also need to be +passed. + +## Testing + +### Running unit tests + +Tests can be run in the same way as a regular binary, simply by passing `--test` +to the `rustc` invocation and then repackaging and rerunning. The test harness +will run the applicable unit tests. + +Often when testing, you may want to pass additional command line arguments to +your binary. Additional arguments can be set in the component manifest: + +**`hello_fuchsia.cml`** +```txt +{ + include: [ "syslog/client.shard.cml" ], + program: { + runner: "elf", + binary: "bin/hello_fuchsia", + args: ["it_works"], + }, +} +``` + +This will pass the argument `it_works` to the binary, filtering the tests to +only those tests that match the pattern. There are many more configuration +options available in CML including environment variables. More documentation is +available on the [Fuchsia devsite](https://fuchsia.dev/reference/cml). + +### Running the compiler test suite + +Running the Rust test suite on Fuchsia is [not currently supported], but work is +underway to enable it. + +[not currently supported]: https://fxbug.dev/105393 diff --git a/src/doc/rustc/src/platform-support/unknown-uefi.md b/src/doc/rustc/src/platform-support/unknown-uefi.md new file mode 100644 index 00000000000..8f90d9c7453 --- /dev/null +++ b/src/doc/rustc/src/platform-support/unknown-uefi.md @@ -0,0 +1,254 @@ +# `*-unknown-uefi` + +**Tier: 3** + +Unified Extensible Firmware Interface (UEFI) targets for application, driver, +and core UEFI binaries. + +Available targets: + +- `aarch64-unknown-uefi` +- `i686-unknown-uefi` +- `x86_64-unknown-uefi` + +## Target maintainers + +- David Rheinsberg ([@dvdhrm](https://github.com/dvdhrm)) +- Nicholas Bishop ([@nicholasbishop](https://github.com/nicholasbishop)) + +## Requirements + +All UEFI targets can be used as `no-std` environments via cross-compilation. +Support for `std` is missing, but actively worked on. `alloc` is supported if +an allocator is provided by the user. No host tools are supported. + +The UEFI environment resembles the environment for Microsoft Windows, with some +minor differences. Therefore, cross-compiling for UEFI works with the same +tools as cross-compiling for Windows. The target binaries are PE32+ encoded, +the calling convention is different for each architecture, but matches what +Windows uses (if the architecture is supported by Windows). The special +`efiapi` Rust calling-convention chooses the right ABI for the target platform +(`extern "C"` is incorrect on Intel targets at least). The specification has an +elaborate section on the different supported calling-conventions, if more +details are desired. + +MMX, SSE, and other FP-units are disabled by default, to allow for compilation +of core UEFI code that runs before they are set up. This can be overridden for +individual compilations via rustc command-line flags. Not all firmwares +correctly configure those units, though, so careful inspection is required. + +As native to PE32+, binaries are position-dependent, but can be relocated at +runtime if their desired location is unavailable. The code must be statically +linked. Dynamic linking is not supported. Code is shared via UEFI interfaces, +rather than dynamic linking. Additionally, UEFI forbids running code on +anything but the boot CPU/thread, nor is interrupt-usage allowed (apart from +the timer interrupt). Device drivers are required to use polling methods. + +UEFI uses a single address-space to run all code in. Multiple applications can +be loaded simultaneously and are dispatched via cooperative multitasking on a +single stack. + +By default, the UEFI targets use the `link`-flavor of the LLVM linker `lld` to +link binaries into the final PE32+ file suffixed with `*.efi`. The PE subsystem +is set to `EFI_APPLICATION`, but can be modified by passing `/subsystem:<...>` +to the linker. Similarly, the entry-point is to to `efi_main` but can be +changed via `/entry:<...>`. The panic-strategy is set to `abort`, + +The UEFI specification is available online for free: +[UEFI Specification Directory](https://uefi.org/specifications) + +## Building rust for UEFI targets + +Rust can be built for the UEFI targets by enabling them in the `rustc` build +configuration. Note that you can only build the standard libraries. The +compiler and host tools currently cannot be compiled for UEFI targets. A sample +configuration would be: + +```toml +[build] +build-stage = 1 +target = ["x86_64-unknown-uefi"] +``` + +## Building Rust programs + +Rust does not yet ship pre-compiled artifacts for this target. To compile for +this target, you will either need to build Rust with the target enabled (see +"Building rust for UEFI targets" above), or build your own copy of `core` by +using `build-std`, `cargo-buildx`, or similar. + +A native build with the unstable `build-std`-feature can be achieved via: + +```sh +cargo +nightly build \ + -Zbuild-std=core,compiler_builtins \ + -Zbuild-std-features=compiler-builtins-mem \ + --target x86_64-unknown-uefi +``` + +Alternatively, you can install `cargo-xbuild` via +`cargo install --force cargo-xbuild` and build for the UEFI targets via: + +```sh +cargo \ + +nightly \ + xbuild \ + --target x86_64-unknown-uefi +``` + +## Testing + +UEFI applications can be copied into the ESP on any UEFI system and executed +via the firmware boot menu. The qemu suite allows emulating UEFI systems and +executing UEFI applications as well. See its documentation for details. + +The [uefi-run](https://github.com/Richard-W/uefi-run) rust tool is a simple +wrapper around `qemu` that can spawn UEFI applications in qemu. You can install +it via `cargo install uefi-run` and execute qemu applications as +`uefi-run ./application.efi`. + +## Cross-compilation toolchains and C code + +There are 3 common ways to compile native C code for UEFI targets: + +- Use the official SDK by Intel: + [Tianocore/EDK2](https://github.com/tianocore/edk2). This supports a + multitude of platforms, comes with the full specification transposed into C, + lots of examples and build-system integrations. This is also the only + officially supported platform by Intel, and is used by many major firmware + implementations. Any code compiled via the SDK is compatible to rust binaries + compiled for the UEFI targets. You can link them directly into your rust + binaries, or call into each other via UEFI protocols. +- Use the **GNU-EFI** suite. This approach is used by many UEFI applications + in the Linux/OSS ecosystem. The GCC compiler is used to compile ELF binaries, + and linked with a pre-loader that converts the ELF binary to PE32+ + **at runtime**. You can combine such binaries with the rust UEFI targets only + via UEFI protocols. Linking both into the same executable will fail, since + one is an ELF executable, and one a PE32+. If linking to **GNU-EFI** + executables is desired, you must compile your rust code natively for the same + GNU target as **GNU-EFI** and use their pre-loader. This requires careful + consideration about which calling-convention to use when calling into native + UEFI protocols, or calling into linked **GNU-EFI** code (similar to how these + differences need to be accounted for when writing **GNU-EFI** C code). +- Use native Windows targets. This means compiling your C code for the Windows + platform as if it was the UEFI platform. This works for static libraries, but + needs adjustments when linking into an UEFI executable. You can, however, + link such static libraries seemlessly into rust code compiled for UEFI + targets. Be wary of any includes that are not specifically suitable for UEFI + targets (especially the C standard library includes are not always + compatible). Freestanding compilations are recommended to avoid + incompatibilites. + +## Ecosystem + +The rust language has a long history of supporting UEFI targets. Many crates +have been developed to provide access to UEFI protocols and make UEFI +programming more ergonomic in rust. The following list is a short overview (in +alphabetical ordering): + +- **efi**: *Ergonomic Rust bindings for writing UEFI applications*. Provides + _rustified_ access to UEFI protocols, implements allocators and a safe + environment to write UEFI applications. +- **r-efi**: *UEFI Reference Specification Protocol Constants and Definitions*. + A pure transpose of the UEFI specification into rust. This provides the raw + definitions from the specification, without any extended helpers or + _rustification_. It serves as baseline to implement any more elaborate rust + UEFI layers. +- **uefi-rs**: *Safe and easy-to-use wrapper for building UEFI apps*. An + elaborate library providing safe abstractions for UEFI protocols and + features. It implements allocators and provides an execution environment to + UEFI applications written in rust. +- **uefi-run**: *Run UEFI applications*. A small wrapper around _qemu_ to spawn + UEFI applications in an emulated `x86_64` machine. + +## Example: Freestanding + +The following code is a valid UEFI application returning immediately upon +execution with an exit code of 0. A panic handler is provided. This is executed +by rust on panic. For simplicity, we simply end up in an infinite loop. + +Note that as of rust-1.31.0, all features used here are stabilized. No unstable +features are required, nor do we rely on nightly compilers. However, if you do +not compile rustc for the UEFI targets, you need a nightly compiler to support +the `-Z build-std` flag. + +This example can be compiled as binary crate via `cargo`: + +```sh +cargo +nightly build \ + -Zbuild-std=core,compiler_builtins \ + -Zbuild-std-features=compiler-builtins-mem \ + --target x86_64-unknown-uefi +``` + +```rust,ignore (platform-specific,eh-personality-is-unstable) +#![no_main] +#![no_std] + +#[panic_handler] +fn panic_handler(_info: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[export_name = "efi_main"] +pub extern "C" fn main(_h: *mut core::ffi::c_void, _st: *mut core::ffi::c_void) -> usize { + 0 +} +``` + +## Example: Hello World + +This is an example UEFI application that prints "Hello World!", then waits for +key input before it exits. It serves as base example how to write UEFI +applications without any helper modules other than the standalone UEFI protocol +definitions provided by the `r-efi` crate. + +This extends the "Freestanding" example and builds upon its setup. See there +for instruction how to compile this as binary crate. + +Note that UEFI uses UTF-16 strings. Since rust literals are UTF-8, we have to +use an open-coded, zero-terminated, UTF-16 array as argument to +`output_string()`. Similarly to the panic handler, real applications should +rather use UTF-16 modules. + +```rust,ignore (platform-specific,eh-personality-is-unstable) +#![no_main] +#![no_std] + +use r_efi::efi; + +#[panic_handler] +fn panic_handler(_info: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[export_name = "efi_main"] +pub extern "C" fn main(_h: efi::Handle, st: *mut efi::SystemTable) -> efi::Status { + let s = [ + 0x0048u16, 0x0065u16, 0x006cu16, 0x006cu16, 0x006fu16, // "Hello" + 0x0020u16, // " " + 0x0057u16, 0x006fu16, 0x0072u16, 0x006cu16, 0x0064u16, // "World" + 0x0021u16, // "!" + 0x000au16, // "\n" + 0x0000u16, // NUL + ]; + + // Print "Hello World!". + let r = + unsafe { ((*(*st).con_out).output_string)((*st).con_out, s.as_ptr() as *mut efi::Char16) }; + if r.is_error() { + return r; + } + + // Wait for key input, by waiting on the `wait_for_key` event hook. + let r = unsafe { + let mut x: usize = 0; + ((*(*st).boot_services).wait_for_event)(1, &mut (*(*st).con_in).wait_for_key, &mut x) + }; + if r.is_error() { + return r; + } + + efi::Status::SUCCESS +} +``` diff --git a/src/doc/rustc/src/targets/custom.md b/src/doc/rustc/src/targets/custom.md index 98e113a663b..27ef2f49eee 100644 --- a/src/doc/rustc/src/targets/custom.md +++ b/src/doc/rustc/src/targets/custom.md @@ -5,13 +5,13 @@ If you'd like to build for a target that is not yet supported by `rustc`, you ca are JSON. To see the JSON for the host target, you can run: ```bash -$ rustc +nightly -Z unstable-options --print target-spec-json +rustc +nightly -Z unstable-options --print target-spec-json ``` To see it for a different target, add the `--target` flag: ```bash -$ rustc +nightly -Z unstable-options --target=wasm32-unknown-unknown --print target-spec-json +rustc +nightly -Z unstable-options --target=wasm32-unknown-unknown --print target-spec-json ``` To use a custom target, see the (unstable) [`build-std` feature](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std) of `cargo`. diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index 70b6af717cd..d02ac9d9c0a 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -440,6 +440,7 @@ def check_snapshot(snapshot_name, actual_tree, normalize_to_text): if bless: with open(snapshot_path, 'w') as snapshot_file: + actual_str = actual_str.replace(channel, "{{channel}}") snapshot_file.write(actual_str) else: print('--- expected ---\n') diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index c43fd1ad241..5fe2c9ab4e3 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -117,7 +117,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { attrs: Default::default(), visibility: Inherited, item_id: ItemId::Auto { trait_: trait_def_id, for_: item_def_id }, - kind: Box::new(ImplItem(Impl { + kind: Box::new(ImplItem(Box::new(Impl { unsafety: hir::Unsafety::Normal, generics: new_generics, trait_: Some(trait_ref.clean(self.cx)), @@ -125,7 +125,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { items: Vec::new(), polarity, kind: ImplKind::Auto, - })), + }))), cfg: None, }) } diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index c64c5895079..8aecd9b15e8 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -106,7 +106,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { attrs: Default::default(), visibility: Inherited, item_id: ItemId::Blanket { impl_id: impl_def_id, for_: item_def_id }, - kind: Box::new(ImplItem(Impl { + kind: Box::new(ImplItem(Box::new(Impl { unsafety: hir::Unsafety::Normal, generics: clean_ty_generics( cx, @@ -124,7 +124,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { .collect::<Vec<_>>(), polarity: ty::ImplPolarity::Positive, kind: ImplKind::Blanket(Box::new(clean_middle_ty(trait_ref.0.self_ty(), cx, None))), - })), + }))), cfg: None, }); } diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 4b91f7ba096..55d77a63f61 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -17,7 +17,8 @@ use rustc_span::symbol::{kw, sym, Symbol}; use crate::clean::{ self, clean_fn_decl_from_did_and_sig, clean_middle_field, clean_middle_ty, clean_ty, - clean_ty_generics, utils, Attributes, AttributesExt, Clean, ImplKind, ItemId, Type, Visibility, + clean_ty_generics, clean_visibility, utils, Attributes, AttributesExt, Clean, ImplKind, ItemId, + Type, Visibility, }; use crate::core::DocContext; use crate::formats::item_type::ItemType; @@ -134,7 +135,7 @@ pub(crate) fn try_inline( ); if let Some(import_def_id) = import_def_id { // The visibility needs to reflect the one from the reexport and not from the "source" DefId. - item.visibility = cx.tcx.visibility(import_def_id).clean(cx); + item.visibility = clean_visibility(cx.tcx.visibility(import_def_id)); } ret.push(item); Some(ret) @@ -217,7 +218,7 @@ pub(crate) fn build_external_trait(cx: &mut DocContext<'_>, did: DefId) -> clean clean::Trait { def_id: did, generics, items: trait_items, bounds: supertrait_bounds } } -fn build_external_function<'tcx>(cx: &mut DocContext<'tcx>, did: DefId) -> clean::Function { +fn build_external_function<'tcx>(cx: &mut DocContext<'tcx>, did: DefId) -> Box<clean::Function> { let sig = cx.tcx.fn_sig(did); let predicates = cx.tcx.predicates_of(did); @@ -227,7 +228,7 @@ fn build_external_function<'tcx>(cx: &mut DocContext<'tcx>, did: DefId) -> clean let decl = clean_fn_decl_from_did_and_sig(cx, Some(did), sig); (generics, decl) }); - clean::Function { decl, generics } + Box::new(clean::Function { decl, generics }) } fn build_enum(cx: &mut DocContext<'_>, did: DefId) -> clean::Enum { @@ -259,15 +260,15 @@ fn build_union(cx: &mut DocContext<'_>, did: DefId) -> clean::Union { clean::Union { generics, fields } } -fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> clean::Typedef { +fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> Box<clean::Typedef> { let predicates = cx.tcx.explicit_predicates_of(did); let type_ = clean_middle_ty(cx.tcx.type_of(did), cx, Some(did)); - clean::Typedef { + Box::new(clean::Typedef { type_, generics: clean_ty_generics(cx, cx.tcx.generics_of(did), predicates), item_type: None, - } + }) } /// Builds all inherent implementations of an ADT (struct/union/enum) or Trait item/path/reexport. @@ -492,7 +493,7 @@ pub(crate) fn build_impl( ret.push(clean::Item::from_def_id_and_attrs_and_parts( did, None, - clean::ImplItem(clean::Impl { + clean::ImplItem(Box::new(clean::Impl { unsafety: hir::Unsafety::Normal, generics, trait_, @@ -504,7 +505,7 @@ pub(crate) fn build_impl( } else { ImplKind::Normal }, - }), + })), Box::new(merged_attrs), cx, cfg, @@ -537,7 +538,7 @@ fn build_module( attrs: Box::new(clean::Attributes::default()), item_id: ItemId::Primitive(prim_ty, did.krate), visibility: clean::Public, - kind: box clean::ImportItem(clean::Import::new_simple( + kind: Box::new(clean::ImportItem(clean::Import::new_simple( item.ident.name, clean::ImportSource { path: clean::Path { @@ -553,7 +554,7 @@ fn build_module( did: None, }, true, - )), + ))), cfg: None, }); } else if let Some(i) = try_inline(cx, did, None, res, item.ident.name, None, visited) { @@ -599,7 +600,7 @@ fn build_macro( match CStore::from_tcx(cx.tcx).load_macro_untracked(def_id, cx.sess()) { LoadedMacro::MacroDef(item_def, _) => { if let ast::ItemKind::MacroDef(ref def) = item_def.kind { - let vis = cx.tcx.visibility(import_def_id.unwrap_or(def_id)).clean(cx); + let vis = clean_visibility(cx.tcx.visibility(import_def_id.unwrap_or(def_id))); clean::MacroItem(clean::Macro { source: utils::display_macro_source(cx, name, def, def_id, vis), }) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 2f2fbc9d4ba..10676aca480 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -908,7 +908,7 @@ fn clean_function<'tcx>( sig: &hir::FnSig<'tcx>, generics: &hir::Generics<'tcx>, body_id: hir::BodyId, -) -> Function { +) -> Box<Function> { let (generics, decl) = enter_impl_trait(cx, |cx| { // NOTE: generics must be cleaned before args let generics = generics.clean(cx); @@ -916,7 +916,7 @@ fn clean_function<'tcx>( let decl = clean_fn_decl_with_args(cx, sig.decl, args); (generics, decl) }); - Function { decl, generics } + Box::new(Function { decl, generics }) } fn clean_args_from_types_and_names<'tcx>( @@ -1061,18 +1061,18 @@ impl<'tcx> Clean<'tcx, Item> for hir::TraitItem<'tcx> { let decl = clean_fn_decl_with_args(cx, sig.decl, args); (generics, decl) }); - TyMethodItem(Function { decl, generics }) + TyMethodItem(Box::new(Function { decl, generics })) } hir::TraitItemKind::Type(bounds, Some(default)) => { let generics = enter_impl_trait(cx, |cx| self.generics.clean(cx)); let bounds = bounds.iter().filter_map(|x| x.clean(cx)).collect(); let item_type = clean_middle_ty(hir_ty_to_ty(cx.tcx, default), cx, None); AssocTypeItem( - Typedef { + Box::new(Typedef { type_: clean_ty(default, cx), generics, item_type: Some(item_type), - }, + }), bounds, ) } @@ -1109,7 +1109,7 @@ impl<'tcx> Clean<'tcx, Item> for hir::ImplItem<'tcx> { let generics = self.generics.clean(cx); let item_type = clean_middle_ty(hir_ty_to_ty(cx.tcx, hir_ty), cx, None); AssocTypeItem( - Typedef { type_, generics, item_type: Some(item_type) }, + Box::new(Typedef { type_, generics, item_type: Some(item_type) }), Vec::new(), ) } @@ -1186,9 +1186,9 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem { ty::ImplContainer(_) => Some(self.defaultness), ty::TraitContainer(_) => None, }; - MethodItem(Function { generics, decl }, defaultness) + MethodItem(Box::new(Function { generics, decl }), defaultness) } else { - TyMethodItem(Function { generics, decl }) + TyMethodItem(Box::new(Function { generics, decl })) } } ty::AssocKind::Type => { @@ -1282,7 +1282,7 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem { if self.defaultness.has_value() { AssocTypeItem( - Typedef { + Box::new(Typedef { type_: clean_middle_ty( tcx.type_of(self.def_id), cx, @@ -1291,7 +1291,7 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem { generics, // FIXME: should we obtain the Type from HIR and pass it on here? item_type: None, - }, + }), bounds, ) } else { @@ -1300,11 +1300,11 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem { } else { // FIXME: when could this happen? Associated items in inherent impls? AssocTypeItem( - Typedef { + Box::new(Typedef { type_: clean_middle_ty(tcx.type_of(self.def_id), cx, Some(self.def_id)), generics: Generics { params: Vec::new(), where_predicates: Vec::new() }, item_type: None, - }, + }), Vec::new(), ) } @@ -1812,32 +1812,25 @@ fn is_field_vis_inherited(tcx: TyCtxt<'_>, def_id: DefId) -> bool { } } -impl<'tcx> Clean<'tcx, Visibility> for ty::Visibility { - fn clean(&self, _cx: &mut DocContext<'_>) -> Visibility { - match *self { - ty::Visibility::Public => Visibility::Public, - // NOTE: this is not quite right: `ty` uses `Invisible` to mean 'private', - // while rustdoc really does mean inherited. That means that for enum variants, such as - // `pub enum E { V }`, `V` will be marked as `Public` by `ty`, but as `Inherited` by rustdoc. - // Various parts of clean override `tcx.visibility` explicitly to make sure this distinction is captured. - ty::Visibility::Invisible => Visibility::Inherited, - ty::Visibility::Restricted(module) => Visibility::Restricted(module), - } - } -} - -impl<'tcx> Clean<'tcx, VariantStruct> for rustc_hir::VariantData<'tcx> { - fn clean(&self, cx: &mut DocContext<'tcx>) -> VariantStruct { - VariantStruct { - struct_type: CtorKind::from_hir(self), - fields: self.fields().iter().map(|x| clean_field(x, cx)).collect(), - } +pub(crate) fn clean_visibility(vis: ty::Visibility) -> Visibility { + match vis { + ty::Visibility::Public => Visibility::Public, + // NOTE: this is not quite right: `ty` uses `Invisible` to mean 'private', + // while rustdoc really does mean inherited. That means that for enum variants, such as + // `pub enum E { V }`, `V` will be marked as `Public` by `ty`, but as `Inherited` by rustdoc. + // Various parts of clean override `tcx.visibility` explicitly to make sure this distinction is captured. + ty::Visibility::Invisible => Visibility::Inherited, + ty::Visibility::Restricted(module) => Visibility::Restricted(module), } } -impl<'tcx> Clean<'tcx, Vec<Item>> for hir::VariantData<'tcx> { - fn clean(&self, cx: &mut DocContext<'tcx>) -> Vec<Item> { - self.fields().iter().map(|x| clean_field(x, cx)).collect() +fn clean_variant_data<'tcx>( + variant: &hir::VariantData<'tcx>, + cx: &mut DocContext<'tcx>, +) -> VariantStruct { + VariantStruct { + struct_type: CtorKind::from_hir(variant), + fields: variant.fields().iter().map(|x| clean_field(x, cx)).collect(), } } @@ -1863,8 +1856,10 @@ impl<'tcx> Clean<'tcx, Item> for ty::VariantDef { impl<'tcx> Clean<'tcx, Variant> for hir::VariantData<'tcx> { fn clean(&self, cx: &mut DocContext<'tcx>) -> Variant { match self { - hir::VariantData::Struct(..) => Variant::Struct(self.clean(cx)), - hir::VariantData::Tuple(..) => Variant::Tuple(self.clean(cx)), + hir::VariantData::Struct(..) => Variant::Struct(clean_variant_data(self, cx)), + hir::VariantData::Tuple(..) => { + Variant::Tuple(self.fields().iter().map(|x| clean_field(x, cx)).collect()) + } hir::VariantData::Unit(..) => Variant::CLike, } } @@ -1954,11 +1949,11 @@ fn clean_maybe_renamed_item<'tcx>( ItemKind::TyAlias(hir_ty, generics) => { let rustdoc_ty = clean_ty(hir_ty, cx); let ty = clean_middle_ty(hir_ty_to_ty(cx.tcx, hir_ty), cx, None); - TypedefItem(Typedef { + TypedefItem(Box::new(Typedef { type_: rustdoc_ty, generics: generics.clean(cx), item_type: Some(ty), - }) + })) } ItemKind::Enum(ref def, generics) => EnumItem(Enum { variants: def.variants.iter().map(|v| v.clean(cx)).collect(), @@ -1983,7 +1978,7 @@ fn clean_maybe_renamed_item<'tcx>( clean_fn_or_proc_macro(item, sig, generics, body_id, &mut name, cx) } ItemKind::Macro(ref macro_def, _) => { - let ty_vis = cx.tcx.visibility(def_id).clean(cx); + let ty_vis = clean_visibility(cx.tcx.visibility(def_id)); MacroItem(Macro { source: display_macro_source(cx, name, macro_def, def_id, ty_vis), }) @@ -2046,7 +2041,7 @@ fn clean_impl<'tcx>( _ => None, }); let mut make_item = |trait_: Option<Path>, for_: Type, items: Vec<Item>| { - let kind = ImplItem(Impl { + let kind = ImplItem(Box::new(Impl { unsafety: impl_.unsafety, generics: impl_.generics.clean(cx), trait_, @@ -2058,7 +2053,7 @@ fn clean_impl<'tcx>( } else { ImplKind::Normal }, - }); + })); Item::from_hir_id_and_parts(hir_id, None, kind, cx) }; if let Some(type_alias) = type_alias { @@ -2112,8 +2107,8 @@ fn clean_extern_crate<'tcx>( name: Some(name), attrs: Box::new(attrs.clean(cx)), item_id: crate_def_id.into(), - visibility: ty_vis.clean(cx), - kind: box ExternCrateItem { src: orig_name }, + visibility: clean_visibility(ty_vis), + kind: Box::new(ExternCrateItem { src: orig_name }), cfg: attrs.cfg(cx.tcx, &cx.cache.hidden_cfg), }] } @@ -2248,7 +2243,7 @@ fn clean_maybe_renamed_foreign_item<'tcx>( let decl = clean_fn_decl_with_args(cx, decl, args); (generics, decl) }); - ForeignFunctionItem(Function { decl, generics }) + ForeignFunctionItem(Box::new(Function { decl, generics })) } hir::ForeignItemKind::Static(ty, mutability) => { ForeignStaticItem(Static { type_: clean_ty(ty, cx), mutability, expr: None }) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 83d8ed3fc87..d022ce9696a 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -37,7 +37,7 @@ use crate::clean::cfg::Cfg; use crate::clean::external_path; use crate::clean::inline::{self, print_inlined_const}; use crate::clean::utils::{is_literal_expr, print_const_expr, print_evaluated_const}; -use crate::clean::Clean; +use crate::clean::{clean_visibility, Clean}; use crate::core::DocContext; use crate::formats::cache::Cache; use crate::formats::item_type::ItemType; @@ -430,8 +430,8 @@ impl Item { }; match kind { ItemKind::ModuleItem(Module { span, .. }) => *span, - ItemKind::ImplItem(Impl { kind: ImplKind::Auto, .. }) => Span::dummy(), - ItemKind::ImplItem(Impl { kind: ImplKind::Blanket(_), .. }) => { + ItemKind::ImplItem(box Impl { kind: ImplKind::Auto, .. }) => Span::dummy(), + ItemKind::ImplItem(box Impl { kind: ImplKind::Blanket(_), .. }) => { if let ItemId::Blanket { impl_id, .. } = self.item_id { rustc_span(impl_id, tcx) } else { @@ -499,10 +499,10 @@ impl Item { let visibility = if matches!(&kind, ItemKind::KeywordItem | ItemKind::PrimitiveItem(..)) { Visibility::Public } else { - cx.tcx.visibility(def_id).clean(cx) + clean_visibility(cx.tcx.visibility(def_id)) }; - Item { item_id: def_id.into(), kind: box kind, name, attrs, visibility, cfg } + Item { item_id: def_id.into(), kind: Box::new(kind), name, attrs, visibility, cfg } } /// Finds all `doc` attributes as NameValues and returns their corresponding values, joined @@ -730,25 +730,25 @@ pub(crate) enum ItemKind { StructItem(Struct), UnionItem(Union), EnumItem(Enum), - FunctionItem(Function), + FunctionItem(Box<Function>), ModuleItem(Module), - TypedefItem(Typedef), + TypedefItem(Box<Typedef>), OpaqueTyItem(OpaqueTy), StaticItem(Static), ConstantItem(Constant), TraitItem(Trait), TraitAliasItem(TraitAlias), - ImplItem(Impl), + ImplItem(Box<Impl>), /// A required method in a trait declaration meaning it's only a function signature. - TyMethodItem(Function), + TyMethodItem(Box<Function>), /// A method in a trait impl or a provided method in a trait declaration. /// /// Compared to [TyMethodItem], it also contains a method body. - MethodItem(Function, Option<hir::Defaultness>), + MethodItem(Box<Function>, Option<hir::Defaultness>), StructFieldItem(Type), VariantItem(Variant), /// `fn`s from an extern block - ForeignFunctionItem(Function), + ForeignFunctionItem(Box<Function>), /// `static`s from an extern block ForeignStaticItem(Static), /// `type`s from an extern block @@ -765,12 +765,16 @@ pub(crate) enum ItemKind { /// The bounds may be non-empty if there is a `where` clause. TyAssocTypeItem(Box<Generics>, Vec<GenericBound>), /// An associated type in a trait impl or a provided one in a trait declaration. - AssocTypeItem(Typedef, Vec<GenericBound>), + AssocTypeItem(Box<Typedef>, Vec<GenericBound>), /// An item that has been stripped by a rustdoc pass StrippedItem(Box<ItemKind>), KeywordItem, } +// `ItemKind` is an enum and large variants can bloat up memory usage even for smaller ones +#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] +rustc_data_structures::static_assert_size!(ItemKind, 112); + impl ItemKind { /// Some items contain others such as structs (for their fields) and Enums /// (for their variants). This method returns those contained items. diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 27ecea5cc40..621f70f0da9 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -236,8 +236,7 @@ pub(crate) fn print_const(cx: &DocContext<'_>, n: ty::Const<'_>) -> String { match n.kind() { ty::ConstKind::Unevaluated(ty::Unevaluated { def, substs: _, promoted }) => { let mut s = if let Some(def) = def.as_local() { - let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def.did); - print_const_expr(cx.tcx, cx.tcx.hir().body_owned_by(hir_id)) + print_const_expr(cx.tcx, cx.tcx.hir().body_owned_by(def.did)) } else { inline::print_inlined_const(cx.tcx, def.did) }; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index f46fde7b35a..c48b25aea4a 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -313,7 +313,7 @@ pub(crate) fn create_config( } let hir = tcx.hir(); - let body = hir.body(hir.body_owned_by(hir.local_def_id_to_hir_id(def_id))); + let body = hir.body(hir.body_owned_by(def_id)); debug!("visiting body for {:?}", def_id); EmitIgnoredResolutionErrors::new(tcx).visit_body(body); (rustc_interface::DEFAULT_QUERY_PROVIDERS.typeck)(tcx, def_id) diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 568bad2a382..213f564ce2d 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -740,7 +740,7 @@ fn check_if_attr_is_complete(source: &str, edition: Edition) -> bool { rustc_errors::fallback_fluent_bundle(rustc_errors::DEFAULT_LOCALE_RESOURCES, false); let emitter = EmitterWriter::new( - box io::sink(), + Box::new(io::sink()), None, None, fallback_bundle, @@ -751,7 +751,7 @@ fn check_if_attr_is_complete(source: &str, edition: Edition) -> bool { false, ); - let handler = Handler::with_emitter(false, None, box emitter); + let handler = Handler::with_emitter(false, None, Box::new(emitter)); let sess = ParseSess::with_span_handler(handler, sm); let mut parser = match maybe_new_parser_from_source_str(&sess, filename, source.to_owned()) { diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs index c93897236db..6b7e67e2ce3 100644 --- a/src/librustdoc/fold.rs +++ b/src/librustdoc/fold.rs @@ -2,7 +2,7 @@ use crate::clean::*; pub(crate) fn strip_item(mut item: Item) -> Item { if !matches!(*item.kind, StrippedItem(..)) { - item.kind = box StrippedItem(item.kind); + item.kind = Box::new(StrippedItem(item.kind)); } item } @@ -75,10 +75,10 @@ pub(crate) trait DocFolder: Sized { /// don't override! fn fold_item_recur(&mut self, mut item: Item) -> Item { - item.kind = box match *item.kind { - StrippedItem(box i) => StrippedItem(box self.fold_inner_recur(i)), + item.kind = Box::new(match *item.kind { + StrippedItem(box i) => StrippedItem(Box::new(self.fold_inner_recur(i))), _ => self.fold_inner_recur(*item.kind), - }; + }); item } diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index b9774eb70ea..2b2691e53bb 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -536,7 +536,7 @@ enum ParentStackItem { impl ParentStackItem { fn new(item: &clean::Item) -> Self { match &*item.kind { - clean::ItemKind::ImplItem(clean::Impl { for_, trait_, generics, kind, .. }) => { + clean::ItemKind::ImplItem(box clean::Impl { for_, trait_, generics, kind, .. }) => { ParentStackItem::Impl { for_: for_.clone(), trait_: trait_.clone(), diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 89d372da322..a262c8f7d19 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1160,7 +1160,7 @@ fn render_deref_methods( .items .iter() .find_map(|item| match *item.kind { - clean::AssocTypeItem(ref t, _) => Some(match *t { + clean::AssocTypeItem(box ref t, _) => Some(match *t { clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_), _ => (&t.type_, &t.type_), }), @@ -2054,7 +2054,7 @@ fn sidebar_deref_methods( debug!("found Deref: {:?}", impl_); if let Some((target, real_target)) = impl_.inner_impl().items.iter().find_map(|item| match *item.kind { - clean::AssocTypeItem(ref t, _) => Some(match *t { + clean::AssocTypeItem(box ref t, _) => Some(match *t { clean::Typedef { item_type: Some(ref type_), .. } => (type_, &t.type_), _ => (&t.type_, &t.type_), }), diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 69d66693f75..547d6696a43 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -311,7 +311,7 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: w, "<h2 id=\"{id}\" class=\"small-section-header\">\ <a href=\"#{id}\">{name}</a>\ - </h2>\n{}", + </h2>{}", ITEM_TABLE_OPEN, id = cx.derive_id(my_section.id().to_owned()), name = my_section.name(), @@ -415,10 +415,10 @@ fn item_module(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Item, items: write!( w, "<div class=\"item-left {stab}{add}module-item\">\ - <a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\ - {visibility_emoji}\ - {unsafety_flag}\ - {stab_tags}\ + <a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\ + {visibility_emoji}\ + {unsafety_flag}\ + {stab_tags}\ </div>\ <div class=\"item-right docblock-short\">{docs}</div>", name = myitem.name.unwrap(), @@ -1126,7 +1126,8 @@ fn item_union(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean: write!( w, "<h2 id=\"fields\" class=\"fields small-section-header\">\ - Fields<a href=\"#fields\" class=\"anchor\"></a></h2>" + Fields<a href=\"#fields\" class=\"anchor\"></a>\ + </h2>" ); for (field, ty) in fields { let name = field.name.expect("union field name"); @@ -1238,7 +1239,8 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean:: write!( w, "<h2 id=\"variants\" class=\"variants small-section-header\">\ - Variants{}<a href=\"#variants\" class=\"anchor\"></a></h2>", + Variants{}<a href=\"#variants\" class=\"anchor\"></a>\ + </h2>", document_non_exhaustive_header(it) ); document_non_exhaustive(w, it); @@ -1294,9 +1296,9 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean:: w, "<div class=\"sub-variant-field\">\ <span id=\"{id}\" class=\"variant small-section-header\">\ - <a href=\"#{id}\" class=\"anchor field\"></a>\ - <code>{f}: {t}</code>\ - </span>", + <a href=\"#{id}\" class=\"anchor field\"></a>\ + <code>{f}: {t}</code>\ + </span>", id = id, f = field.name.unwrap(), t = ty.print(cx) diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html index 9a551b68279..8e25f6764a9 100644 --- a/src/librustdoc/html/templates/page.html +++ b/src/librustdoc/html/templates/page.html @@ -82,10 +82,10 @@ {%- else -%} <img class="rust-logo" src="{{static_root_path|safe}}rust-logo{{page.resource_suffix}}.svg" alt="logo"> {#- -#} {%- endif -%} - </div> + </div> {#- -#} </a> {#- -#} - <h2 class="location"></h2> - </nav> + <h2 class="location"></h2> {#- -#} + </nav> {#- -#} <nav class="sidebar"> {#- -#} <a class="sidebar-logo" href="{{page.root_path|safe}}{{krate_with_trailing_slash|safe}}index.html"> {#- -#} <div class="logo-container"> {#- -#} @@ -94,7 +94,7 @@ {%- else -%} <img class="rust-logo" src="{{static_root_path|safe}}rust-logo{{page.resource_suffix}}.svg" alt="logo"> {#- -#} {%- endif -%} - </div> + </div> {#- -#} </a> {#- -#} {{- sidebar|safe -}} </nav> {#- -#} @@ -122,12 +122,12 @@ <div id="help-button" title="help" tabindex="-1"> {#- -#} <button type="button">?</button> {#- -#} </div> {#- -#} - <div id="settings-menu" tabindex="-1"> + <div id="settings-menu" tabindex="-1"> {#- -#} <a href="{{page.root_path|safe}}settings.html" title="settings"> {#- -#} <img width="22" height="22" alt="Change settings" {# -#} src="{{static_root_path|safe}}wheel{{page.resource_suffix}}.svg"> {#- -#} </a> {#- -#} - </div> + </div> {#- -#} </div> {#- -#} </form> {#- -#} </nav> {#- -#} @@ -143,6 +143,6 @@ data-resource-suffix="{{page.resource_suffix}}" {# -#} data-rustdoc-version="{{rustdoc_version}}" {# -#} > {#- -#} - </div> + </div> {#- -#} </body> {#- -#} </html> {#- -#} diff --git a/src/librustdoc/html/templates/print_item.html b/src/librustdoc/html/templates/print_item.html index 62b1b7ca729..c755157d276 100644 --- a/src/librustdoc/html/templates/print_item.html +++ b/src/librustdoc/html/templates/print_item.html @@ -1,4 +1,4 @@ -<div class="main-heading"> +<div class="main-heading"> {#- -#} <h1 class="fqn"> {#- -#} <span class="in-band"> {#- -#} {{-typ-}} @@ -27,4 +27,4 @@ [<span class="inner">−</span>] {#- -#} </a> {#- -#} </span> {#- -#} -</div> +</div> {#- -#} diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 5f3dd570610..716a4c9ea43 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -568,10 +568,10 @@ impl FromWithTcx<clean::Trait> for Trait { } } -impl FromWithTcx<clean::Impl> for Impl { - fn from_tcx(impl_: clean::Impl, tcx: TyCtxt<'_>) -> Self { +impl FromWithTcx<Box<clean::Impl>> for Impl { + fn from_tcx(impl_: Box<clean::Impl>, tcx: TyCtxt<'_>) -> Self { let provided_trait_methods = impl_.provided_trait_methods(tcx); - let clean::Impl { unsafety, generics, trait_, for_, items, polarity, kind } = impl_; + let clean::Impl { unsafety, generics, trait_, for_, items, polarity, kind } = *impl_; // FIXME: should `trait_` be a clean::Path equivalent in JSON? let trait_ = trait_.map(|path| clean::Type::Path { path }.into_tcx(tcx)); // FIXME: use something like ImplKind in JSON? @@ -602,11 +602,11 @@ impl FromWithTcx<clean::Impl> for Impl { } pub(crate) fn from_function( - function: clean::Function, + function: Box<clean::Function>, header: rustc_hir::FnHeader, tcx: TyCtxt<'_>, ) -> Function { - let clean::Function { decl, generics } = function; + let clean::Function { decl, generics } = *function; Function { decl: decl.into_tcx(tcx), generics: generics.into_tcx(tcx), @@ -615,12 +615,12 @@ pub(crate) fn from_function( } pub(crate) fn from_function_method( - function: clean::Function, + function: Box<clean::Function>, has_body: bool, header: rustc_hir::FnHeader, tcx: TyCtxt<'_>, ) -> Method { - let clean::Function { decl, generics } = function; + let clean::Function { decl, generics } = *function; Method { decl: decl.into_tcx(tcx), generics: generics.into_tcx(tcx), @@ -721,9 +721,9 @@ pub(crate) fn from_macro_kind(kind: rustc_span::hygiene::MacroKind) -> MacroKind } } -impl FromWithTcx<clean::Typedef> for Typedef { - fn from_tcx(typedef: clean::Typedef, tcx: TyCtxt<'_>) -> Self { - let clean::Typedef { type_, generics, item_type: _ } = typedef; +impl FromWithTcx<Box<clean::Typedef>> for Typedef { + fn from_tcx(typedef: Box<clean::Typedef>, tcx: TyCtxt<'_>) -> Self { + let clean::Typedef { type_, generics, item_type: _ } = *typedef; Typedef { type_: type_.into_tcx(tcx), generics: generics.into_tcx(tcx) } } } diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 3a96884d45d..0fe720e70cf 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -7,7 +7,6 @@ #![feature(assert_matches)] #![feature(box_patterns)] #![feature(control_flow_enum)] -#![feature(box_syntax)] #![feature(drain_filter)] #![cfg_attr(bootstrap, feature(let_chains))] #![feature(let_else)] diff --git a/src/librustdoc/passes/check_doc_test_visibility.rs b/src/librustdoc/passes/check_doc_test_visibility.rs index e80a94fe749..e86f9083394 100644 --- a/src/librustdoc/passes/check_doc_test_visibility.rs +++ b/src/librustdoc/passes/check_doc_test_visibility.rs @@ -71,7 +71,7 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) - | clean::PrimitiveItem(_) | clean::KeywordItem // check for trait impl - | clean::ImplItem(clean::Impl { trait_: Some(_), .. }) + | clean::ImplItem(box clean::Impl { trait_: Some(_), .. }) ) { return false; diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index 6ea33d763b1..6b699c79014 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -146,7 +146,7 @@ pub(crate) fn collect_trait_impls(mut krate: Crate, cx: &mut DocContext<'_>) -> // scan through included items ahead of time to splice in Deref targets to the "valid" sets for it in new_items_external.iter().chain(new_items_local.iter()) { - if let ImplItem(Impl { ref for_, ref trait_, ref items, .. }) = *it.kind { + if let ImplItem(box Impl { ref for_, ref trait_, ref items, .. }) = *it.kind { if trait_.as_ref().map(|t| t.def_id()) == cx.tcx.lang_items().deref_trait() && cleaner.keep_impl(for_, true) { @@ -187,7 +187,7 @@ pub(crate) fn collect_trait_impls(mut krate: Crate, cx: &mut DocContext<'_>) -> // Filter out external items that are not needed new_items_external.retain(|it| { - if let ImplItem(Impl { ref for_, ref trait_, ref kind, .. }) = *it.kind { + if let ImplItem(box Impl { ref for_, ref trait_, ref kind, .. }) = *it.kind { cleaner.keep_impl( for_, trait_.as_ref().map(|t| t.def_id()) == cx.tcx.lang_items().deref_trait(), diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs index c0fe8b49cfd..fd0b19034a2 100644 --- a/src/librustdoc/scrape_examples.rs +++ b/src/librustdoc/scrape_examples.rs @@ -143,8 +143,7 @@ where // then we need to exit before calling typeck (which will panic). See // test/run-make/rustdoc-scrape-examples-invalid-expr for an example. let hir = tcx.hir(); - let owner = hir.local_def_id_to_hir_id(ex.hir_id.owner); - if hir.maybe_body_owned_by(owner).is_none() { + if hir.maybe_body_owned_by(ex.hir_id.owner).is_none() { return; } diff --git a/src/test/run-make-fulldeps/coverage/compiletest-ignore-dir b/src/test/run-make-fulldeps/coverage/compiletest-ignore-dir deleted file mode 100644 index d1824d189e3..00000000000 --- a/src/test/run-make-fulldeps/coverage/compiletest-ignore-dir +++ /dev/null @@ -1,3 +0,0 @@ -# Directory "coverage" supports the tests at prefix ../coverage-* - -# Use ./x.py [options] test src/test/run-make-fulldeps/coverage to run all related tests. diff --git a/src/test/run-make-fulldeps/coverage/coverage_tools.mk b/src/test/run-make-fulldeps/coverage/coverage_tools.mk deleted file mode 100644 index aa1dc7b91ce..00000000000 --- a/src/test/run-make-fulldeps/coverage/coverage_tools.mk +++ /dev/null @@ -1,6 +0,0 @@ -# Common Makefile include for Rust `run-make-fulldeps/coverage-* tests. Include this -# file with the line: -# -# -include ../coverage/coverage_tools.mk - --include ../tools.mk diff --git a/src/test/run-make-fulldeps/coverage-llvmir/Makefile b/src/test/run-make/coverage-llvmir/Makefile index fbe0a5cb1bb..7be65505332 100644 --- a/src/test/run-make-fulldeps/coverage-llvmir/Makefile +++ b/src/test/run-make/coverage-llvmir/Makefile @@ -6,7 +6,7 @@ # version during testing, with an additional directive at the top of this file # that sets, for example: `min-llvm-version: 12.0` --include ../coverage/coverage_tools.mk +include ../coverage/coverage_tools.mk BASEDIR=../coverage-llvmir diff --git a/src/test/run-make-fulldeps/coverage-llvmir/filecheck.testprog.txt b/src/test/run-make/coverage-llvmir/filecheck.testprog.txt index 7a5f2192277..7a5f2192277 100644 --- a/src/test/run-make-fulldeps/coverage-llvmir/filecheck.testprog.txt +++ b/src/test/run-make/coverage-llvmir/filecheck.testprog.txt diff --git a/src/test/run-make-fulldeps/coverage-llvmir/testprog.rs b/src/test/run-make/coverage-llvmir/testprog.rs index 358c25677ae..358c25677ae 100644 --- a/src/test/run-make-fulldeps/coverage-llvmir/testprog.rs +++ b/src/test/run-make/coverage-llvmir/testprog.rs diff --git a/src/test/run-make-fulldeps/coverage-reports/Makefile b/src/test/run-make/coverage-reports/Makefile index 78723e78e77..4e75672f275 100644 --- a/src/test/run-make-fulldeps/coverage-reports/Makefile +++ b/src/test/run-make/coverage-reports/Makefile @@ -10,7 +10,7 @@ # FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works # properly. Since we only have GCC on the CI ignore the test for now. --include ../coverage/coverage_tools.mk +include ../coverage/coverage_tools.mk BASEDIR=../coverage-reports SOURCEDIR=../coverage diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.abort.txt b/src/test/run-make/coverage-reports/expected_show_coverage.abort.txt index 00f46f42a07..00f46f42a07 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.abort.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.abort.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.assert.txt b/src/test/run-make/coverage-reports/expected_show_coverage.assert.txt index 405688806ea..405688806ea 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.assert.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.assert.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async.txt b/src/test/run-make/coverage-reports/expected_show_coverage.async.txt index 2f69adbd81c..2f69adbd81c 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.async.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async2.txt b/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt index dc06a485a8f..dc06a485a8f 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async2.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure.txt b/src/test/run-make/coverage-reports/expected_show_coverage.closure.txt index 09ad276aa45..09ad276aa45 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.closure.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure_macro.txt b/src/test/run-make/coverage-reports/expected_show_coverage.closure_macro.txt index 87f7014760e..87f7014760e 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure_macro.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.closure_macro.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure_macro_async.txt b/src/test/run-make/coverage-reports/expected_show_coverage.closure_macro_async.txt index 2b5418132c3..2b5418132c3 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.closure_macro_async.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.closure_macro_async.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.conditions.txt b/src/test/run-make/coverage-reports/expected_show_coverage.conditions.txt index 2d8a98a5d0c..2d8a98a5d0c 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.conditions.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.conditions.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.continue.txt b/src/test/run-make/coverage-reports/expected_show_coverage.continue.txt index 1c64ead9f26..1c64ead9f26 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.continue.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.continue.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.dead_code.txt b/src/test/run-make/coverage-reports/expected_show_coverage.dead_code.txt index 09ff14c6f27..09ff14c6f27 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.dead_code.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.dead_code.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.doctest.txt b/src/test/run-make/coverage-reports/expected_show_coverage.doctest.txt index 7ae0e978808..7ae0e978808 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.doctest.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.doctest.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.drop_trait.txt b/src/test/run-make/coverage-reports/expected_show_coverage.drop_trait.txt index fe6a9e93cbf..fe6a9e93cbf 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.drop_trait.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.drop_trait.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.generator.txt b/src/test/run-make/coverage-reports/expected_show_coverage.generator.txt index d70e12e4128..d70e12e4128 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.generator.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.generator.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.generics.txt b/src/test/run-make/coverage-reports/expected_show_coverage.generics.txt index 48983ba4358..48983ba4358 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.generics.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.generics.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if.txt b/src/test/run-make/coverage-reports/expected_show_coverage.if.txt index 0c9eff227ed..0c9eff227ed 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.if.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if_else.txt b/src/test/run-make/coverage-reports/expected_show_coverage.if_else.txt index 4285d318686..4285d318686 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.if_else.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.if_else.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline-dead.txt b/src/test/run-make/coverage-reports/expected_show_coverage.inline-dead.txt index effdef80e8e..effdef80e8e 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline-dead.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.inline-dead.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline.txt b/src/test/run-make/coverage-reports/expected_show_coverage.inline.txt index 6f5d1544fa0..6f5d1544fa0 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.inline.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inner_items.txt b/src/test/run-make/coverage-reports/expected_show_coverage.inner_items.txt index 883254a09ba..883254a09ba 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inner_items.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.inner_items.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-83601.txt b/src/test/run-make/coverage-reports/expected_show_coverage.issue-83601.txt index de32c88b725..de32c88b725 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-83601.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.issue-83601.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-84561.txt b/src/test/run-make/coverage-reports/expected_show_coverage.issue-84561.txt index f24f7c69404..f24f7c69404 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-84561.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.issue-84561.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-85461.txt b/src/test/run-make/coverage-reports/expected_show_coverage.issue-85461.txt index 1aa4a22c33e..1aa4a22c33e 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-85461.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.issue-85461.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-93054.txt b/src/test/run-make/coverage-reports/expected_show_coverage.issue-93054.txt index a1655adedd4..a1655adedd4 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-93054.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.issue-93054.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.lazy_boolean.txt b/src/test/run-make/coverage-reports/expected_show_coverage.lazy_boolean.txt index bd349df2fbc..bd349df2fbc 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.lazy_boolean.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.lazy_boolean.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loop_break_value.txt b/src/test/run-make/coverage-reports/expected_show_coverage.loop_break_value.txt index 022fe4c5962..022fe4c5962 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loop_break_value.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.loop_break_value.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loops_branches.txt b/src/test/run-make/coverage-reports/expected_show_coverage.loops_branches.txt index b7ad79a2484..b7ad79a2484 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.loops_branches.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.loops_branches.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.match_or_pattern.txt b/src/test/run-make/coverage-reports/expected_show_coverage.match_or_pattern.txt index a0fccb24f99..a0fccb24f99 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.match_or_pattern.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.match_or_pattern.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.nested_loops.txt b/src/test/run-make/coverage-reports/expected_show_coverage.nested_loops.txt index 0dbd6bcf313..0dbd6bcf313 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.nested_loops.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.nested_loops.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.no_cov_crate.txt b/src/test/run-make/coverage-reports/expected_show_coverage.no_cov_crate.txt index 83a9204136f..83a9204136f 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.no_cov_crate.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.no_cov_crate.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.overflow.txt b/src/test/run-make/coverage-reports/expected_show_coverage.overflow.txt index 25e822bffd1..25e822bffd1 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.overflow.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.overflow.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.panic_unwind.txt b/src/test/run-make/coverage-reports/expected_show_coverage.panic_unwind.txt index 114507dc9fd..114507dc9fd 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.panic_unwind.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.panic_unwind.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.partial_eq.txt b/src/test/run-make/coverage-reports/expected_show_coverage.partial_eq.txt index fc266653349..fc266653349 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.partial_eq.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.partial_eq.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_loop.txt b/src/test/run-make/coverage-reports/expected_show_coverage.simple_loop.txt index feb83bad674..feb83bad674 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_loop.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.simple_loop.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_match.txt b/src/test/run-make/coverage-reports/expected_show_coverage.simple_match.txt index b9298213111..b9298213111 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.simple_match.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.simple_match.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.tight_inf_loop.txt b/src/test/run-make/coverage-reports/expected_show_coverage.tight_inf_loop.txt index 2d4c57f451a..2d4c57f451a 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.tight_inf_loop.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.tight_inf_loop.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.try_error_result.txt b/src/test/run-make/coverage-reports/expected_show_coverage.try_error_result.txt index 0ad0180b761..0ad0180b761 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.try_error_result.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.try_error_result.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.unused.txt b/src/test/run-make/coverage-reports/expected_show_coverage.unused.txt index 15fcf21c0ef..15fcf21c0ef 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.unused.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.unused.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.unused_mod.txt b/src/test/run-make/coverage-reports/expected_show_coverage.unused_mod.txt index 82d6fccc271..82d6fccc271 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.unused_mod.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.unused_mod.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_crate.txt b/src/test/run-make/coverage-reports/expected_show_coverage.uses_crate.txt index 65eb1008dd8..65eb1008dd8 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_crate.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.uses_crate.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_inline_crate.txt b/src/test/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt index dab31cbf4ac..dab31cbf4ac 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_inline_crate.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while.txt b/src/test/run-make/coverage-reports/expected_show_coverage.while.txt index efa7d083f0c..efa7d083f0c 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.while.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while_early_ret.txt b/src/test/run-make/coverage-reports/expected_show_coverage.while_early_ret.txt index d19afc0de61..d19afc0de61 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.while_early_ret.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.while_early_ret.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.yield.txt b/src/test/run-make/coverage-reports/expected_show_coverage.yield.txt index 60a8d943f1f..60a8d943f1f 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.yield.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.yield.txt diff --git a/src/test/run-make-fulldeps/coverage-reports/normalize_paths.py b/src/test/run-make/coverage-reports/normalize_paths.py index e5777ad2512..e5777ad2512 100755 --- a/src/test/run-make-fulldeps/coverage-reports/normalize_paths.py +++ b/src/test/run-make/coverage-reports/normalize_paths.py diff --git a/src/test/run-make-fulldeps/coverage/WARNING_KEEP_NAMES_SHORT.txt b/src/test/run-make/coverage/WARNING_KEEP_NAMES_SHORT.txt index 6a1403b8a00..6a1403b8a00 100644 --- a/src/test/run-make-fulldeps/coverage/WARNING_KEEP_NAMES_SHORT.txt +++ b/src/test/run-make/coverage/WARNING_KEEP_NAMES_SHORT.txt diff --git a/src/test/run-make-fulldeps/coverage/abort.rs b/src/test/run-make/coverage/abort.rs index 3dac43df8f3..3dac43df8f3 100644 --- a/src/test/run-make-fulldeps/coverage/abort.rs +++ b/src/test/run-make/coverage/abort.rs diff --git a/src/test/run-make-fulldeps/coverage/assert.rs b/src/test/run-make/coverage/assert.rs index c85f2748eb9..c85f2748eb9 100644 --- a/src/test/run-make-fulldeps/coverage/assert.rs +++ b/src/test/run-make/coverage/assert.rs diff --git a/src/test/run-make-fulldeps/coverage/async.rs b/src/test/run-make/coverage/async.rs index a6e38774706..a6e38774706 100644 --- a/src/test/run-make-fulldeps/coverage/async.rs +++ b/src/test/run-make/coverage/async.rs diff --git a/src/test/run-make-fulldeps/coverage/async2.rs b/src/test/run-make/coverage/async2.rs index 959d48ce9db..959d48ce9db 100644 --- a/src/test/run-make-fulldeps/coverage/async2.rs +++ b/src/test/run-make/coverage/async2.rs diff --git a/src/test/run-make-fulldeps/coverage/closure.rs b/src/test/run-make/coverage/closure.rs index 32ec0bcdf8c..32ec0bcdf8c 100644 --- a/src/test/run-make-fulldeps/coverage/closure.rs +++ b/src/test/run-make/coverage/closure.rs diff --git a/src/test/run-make-fulldeps/coverage/closure_macro.rs b/src/test/run-make/coverage/closure_macro.rs index 5e3b00d1ef5..5e3b00d1ef5 100644 --- a/src/test/run-make-fulldeps/coverage/closure_macro.rs +++ b/src/test/run-make/coverage/closure_macro.rs diff --git a/src/test/run-make-fulldeps/coverage/closure_macro_async.rs b/src/test/run-make/coverage/closure_macro_async.rs index e3e89e9c8b3..e3e89e9c8b3 100644 --- a/src/test/run-make-fulldeps/coverage/closure_macro_async.rs +++ b/src/test/run-make/coverage/closure_macro_async.rs diff --git a/src/test/run-make/coverage/compiletest-ignore-dir b/src/test/run-make/coverage/compiletest-ignore-dir new file mode 100644 index 00000000000..b533b272d38 --- /dev/null +++ b/src/test/run-make/coverage/compiletest-ignore-dir @@ -0,0 +1,3 @@ +# Directory "coverage" supports the tests at prefix ../coverage-* + +# Use ./x.py [options] test src/test/run-make/coverage to run all related tests. diff --git a/src/test/run-make-fulldeps/coverage/conditions.rs b/src/test/run-make/coverage/conditions.rs index 057599d1b47..057599d1b47 100644 --- a/src/test/run-make-fulldeps/coverage/conditions.rs +++ b/src/test/run-make/coverage/conditions.rs diff --git a/src/test/run-make-fulldeps/coverage/continue.rs b/src/test/run-make/coverage/continue.rs index 624aa98341b..624aa98341b 100644 --- a/src/test/run-make-fulldeps/coverage/continue.rs +++ b/src/test/run-make/coverage/continue.rs diff --git a/src/test/run-make/coverage/coverage_tools.mk b/src/test/run-make/coverage/coverage_tools.mk new file mode 100644 index 00000000000..0b6bbc33167 --- /dev/null +++ b/src/test/run-make/coverage/coverage_tools.mk @@ -0,0 +1,6 @@ +# Common Makefile include for Rust `run-make/coverage-* tests. Include this +# file with the line: +# +# include ../coverage/coverage_tools.mk + +include ../../run-make-fulldeps/tools.mk diff --git a/src/test/run-make-fulldeps/coverage/dead_code.rs b/src/test/run-make/coverage/dead_code.rs index a1285df0ec6..a1285df0ec6 100644 --- a/src/test/run-make-fulldeps/coverage/dead_code.rs +++ b/src/test/run-make/coverage/dead_code.rs diff --git a/src/test/run-make-fulldeps/coverage/doctest.rs b/src/test/run-make/coverage/doctest.rs index ec04ea57063..ec04ea57063 100644 --- a/src/test/run-make-fulldeps/coverage/doctest.rs +++ b/src/test/run-make/coverage/doctest.rs diff --git a/src/test/run-make-fulldeps/coverage/drop_trait.rs b/src/test/run-make/coverage/drop_trait.rs index d15bfc0f877..d15bfc0f877 100644 --- a/src/test/run-make-fulldeps/coverage/drop_trait.rs +++ b/src/test/run-make/coverage/drop_trait.rs diff --git a/src/test/run-make-fulldeps/coverage/generator.rs b/src/test/run-make/coverage/generator.rs index 4319991021e..4319991021e 100644 --- a/src/test/run-make-fulldeps/coverage/generator.rs +++ b/src/test/run-make/coverage/generator.rs diff --git a/src/test/run-make-fulldeps/coverage/generics.rs b/src/test/run-make/coverage/generics.rs index 18b38868496..18b38868496 100644 --- a/src/test/run-make-fulldeps/coverage/generics.rs +++ b/src/test/run-make/coverage/generics.rs diff --git a/src/test/run-make-fulldeps/coverage/if.rs b/src/test/run-make/coverage/if.rs index 8ad5042ff7b..8ad5042ff7b 100644 --- a/src/test/run-make-fulldeps/coverage/if.rs +++ b/src/test/run-make/coverage/if.rs diff --git a/src/test/run-make-fulldeps/coverage/if_else.rs b/src/test/run-make/coverage/if_else.rs index 3244e1e3afd..3244e1e3afd 100644 --- a/src/test/run-make-fulldeps/coverage/if_else.rs +++ b/src/test/run-make/coverage/if_else.rs diff --git a/src/test/run-make-fulldeps/coverage/inline-dead.rs b/src/test/run-make/coverage/inline-dead.rs index 854fa062967..854fa062967 100644 --- a/src/test/run-make-fulldeps/coverage/inline-dead.rs +++ b/src/test/run-make/coverage/inline-dead.rs diff --git a/src/test/run-make-fulldeps/coverage/inline.rs b/src/test/run-make/coverage/inline.rs index 9cfab9ddbad..9cfab9ddbad 100644 --- a/src/test/run-make-fulldeps/coverage/inline.rs +++ b/src/test/run-make/coverage/inline.rs diff --git a/src/test/run-make-fulldeps/coverage/inner_items.rs b/src/test/run-make/coverage/inner_items.rs index bcb62b3031c..bcb62b3031c 100644 --- a/src/test/run-make-fulldeps/coverage/inner_items.rs +++ b/src/test/run-make/coverage/inner_items.rs diff --git a/src/test/run-make-fulldeps/coverage/issue-83601.rs b/src/test/run-make/coverage/issue-83601.rs index 0b72a81947c..0b72a81947c 100644 --- a/src/test/run-make-fulldeps/coverage/issue-83601.rs +++ b/src/test/run-make/coverage/issue-83601.rs diff --git a/src/test/run-make-fulldeps/coverage/issue-84561.rs b/src/test/run-make/coverage/issue-84561.rs index b39a289c45e..b39a289c45e 100644 --- a/src/test/run-make-fulldeps/coverage/issue-84561.rs +++ b/src/test/run-make/coverage/issue-84561.rs diff --git a/src/test/run-make-fulldeps/coverage/issue-85461.rs b/src/test/run-make/coverage/issue-85461.rs index a1b9ebb1ed3..a1b9ebb1ed3 100644 --- a/src/test/run-make-fulldeps/coverage/issue-85461.rs +++ b/src/test/run-make/coverage/issue-85461.rs diff --git a/src/test/run-make-fulldeps/coverage/issue-93054.rs b/src/test/run-make/coverage/issue-93054.rs index c160b3db03f..c160b3db03f 100644 --- a/src/test/run-make-fulldeps/coverage/issue-93054.rs +++ b/src/test/run-make/coverage/issue-93054.rs diff --git a/src/test/run-make-fulldeps/coverage/lazy_boolean.rs b/src/test/run-make/coverage/lazy_boolean.rs index bb6219e851c..bb6219e851c 100644 --- a/src/test/run-make-fulldeps/coverage/lazy_boolean.rs +++ b/src/test/run-make/coverage/lazy_boolean.rs diff --git a/src/test/run-make-fulldeps/coverage/lib/doctest_crate.rs b/src/test/run-make/coverage/lib/doctest_crate.rs index c3210146d69..c3210146d69 100644 --- a/src/test/run-make-fulldeps/coverage/lib/doctest_crate.rs +++ b/src/test/run-make/coverage/lib/doctest_crate.rs diff --git a/src/test/run-make-fulldeps/coverage/lib/inline_always_with_dead_code.rs b/src/test/run-make/coverage/lib/inline_always_with_dead_code.rs index 2b21dee6ccf..2b21dee6ccf 100644 --- a/src/test/run-make-fulldeps/coverage/lib/inline_always_with_dead_code.rs +++ b/src/test/run-make/coverage/lib/inline_always_with_dead_code.rs diff --git a/src/test/run-make-fulldeps/coverage/lib/unused_mod_helper.rs b/src/test/run-make/coverage/lib/unused_mod_helper.rs index ae1cc1531ed..ae1cc1531ed 100644 --- a/src/test/run-make-fulldeps/coverage/lib/unused_mod_helper.rs +++ b/src/test/run-make/coverage/lib/unused_mod_helper.rs diff --git a/src/test/run-make-fulldeps/coverage/lib/used_crate.rs b/src/test/run-make/coverage/lib/used_crate.rs index 8b8b1f7f351..8b8b1f7f351 100644 --- a/src/test/run-make-fulldeps/coverage/lib/used_crate.rs +++ b/src/test/run-make/coverage/lib/used_crate.rs diff --git a/src/test/run-make-fulldeps/coverage/lib/used_inline_crate.rs b/src/test/run-make/coverage/lib/used_inline_crate.rs index 4a052756d4e..4a052756d4e 100644 --- a/src/test/run-make-fulldeps/coverage/lib/used_inline_crate.rs +++ b/src/test/run-make/coverage/lib/used_inline_crate.rs diff --git a/src/test/run-make-fulldeps/coverage/loop_break_value.rs b/src/test/run-make/coverage/loop_break_value.rs index dbc4fad7a23..dbc4fad7a23 100644 --- a/src/test/run-make-fulldeps/coverage/loop_break_value.rs +++ b/src/test/run-make/coverage/loop_break_value.rs diff --git a/src/test/run-make-fulldeps/coverage/loops_branches.rs b/src/test/run-make/coverage/loops_branches.rs index 7116ce47f4b..7116ce47f4b 100644 --- a/src/test/run-make-fulldeps/coverage/loops_branches.rs +++ b/src/test/run-make/coverage/loops_branches.rs diff --git a/src/test/run-make-fulldeps/coverage/match_or_pattern.rs b/src/test/run-make/coverage/match_or_pattern.rs index 4c6a8a9b703..4c6a8a9b703 100644 --- a/src/test/run-make-fulldeps/coverage/match_or_pattern.rs +++ b/src/test/run-make/coverage/match_or_pattern.rs diff --git a/src/test/run-make-fulldeps/coverage/nested_loops.rs b/src/test/run-make/coverage/nested_loops.rs index 4c7c7842796..4c7c7842796 100644 --- a/src/test/run-make-fulldeps/coverage/nested_loops.rs +++ b/src/test/run-make/coverage/nested_loops.rs diff --git a/src/test/run-make-fulldeps/coverage/no_cov_crate.rs b/src/test/run-make/coverage/no_cov_crate.rs index 0bfbdda2cab..0bfbdda2cab 100644 --- a/src/test/run-make-fulldeps/coverage/no_cov_crate.rs +++ b/src/test/run-make/coverage/no_cov_crate.rs diff --git a/src/test/run-make-fulldeps/coverage/overflow.rs b/src/test/run-make/coverage/overflow.rs index e537b0e95c3..e537b0e95c3 100644 --- a/src/test/run-make-fulldeps/coverage/overflow.rs +++ b/src/test/run-make/coverage/overflow.rs diff --git a/src/test/run-make-fulldeps/coverage/panic_unwind.rs b/src/test/run-make/coverage/panic_unwind.rs index 03128c2cce6..03128c2cce6 100644 --- a/src/test/run-make-fulldeps/coverage/panic_unwind.rs +++ b/src/test/run-make/coverage/panic_unwind.rs diff --git a/src/test/run-make-fulldeps/coverage/partial_eq.rs b/src/test/run-make/coverage/partial_eq.rs index 4ceaba9b111..4ceaba9b111 100644 --- a/src/test/run-make-fulldeps/coverage/partial_eq.rs +++ b/src/test/run-make/coverage/partial_eq.rs diff --git a/src/test/run-make-fulldeps/coverage/simple_loop.rs b/src/test/run-make/coverage/simple_loop.rs index 6f7f23475b8..6f7f23475b8 100644 --- a/src/test/run-make-fulldeps/coverage/simple_loop.rs +++ b/src/test/run-make/coverage/simple_loop.rs diff --git a/src/test/run-make-fulldeps/coverage/simple_match.rs b/src/test/run-make/coverage/simple_match.rs index be99e59a826..be99e59a826 100644 --- a/src/test/run-make-fulldeps/coverage/simple_match.rs +++ b/src/test/run-make/coverage/simple_match.rs diff --git a/src/test/run-make-fulldeps/coverage/tight_inf_loop.rs b/src/test/run-make/coverage/tight_inf_loop.rs index cef99027aaa..cef99027aaa 100644 --- a/src/test/run-make-fulldeps/coverage/tight_inf_loop.rs +++ b/src/test/run-make/coverage/tight_inf_loop.rs diff --git a/src/test/run-make-fulldeps/coverage/try_error_result.rs b/src/test/run-make/coverage/try_error_result.rs index cd0acf72302..cd0acf72302 100644 --- a/src/test/run-make-fulldeps/coverage/try_error_result.rs +++ b/src/test/run-make/coverage/try_error_result.rs diff --git a/src/test/run-make-fulldeps/coverage/unused.rs b/src/test/run-make/coverage/unused.rs index fb6113eb01c..fb6113eb01c 100644 --- a/src/test/run-make-fulldeps/coverage/unused.rs +++ b/src/test/run-make/coverage/unused.rs diff --git a/src/test/run-make-fulldeps/coverage/unused_mod.rs b/src/test/run-make/coverage/unused_mod.rs index 679b4e53188..679b4e53188 100644 --- a/src/test/run-make-fulldeps/coverage/unused_mod.rs +++ b/src/test/run-make/coverage/unused_mod.rs diff --git a/src/test/run-make-fulldeps/coverage/uses_crate.rs b/src/test/run-make/coverage/uses_crate.rs index 20cb05fe5b0..20cb05fe5b0 100644 --- a/src/test/run-make-fulldeps/coverage/uses_crate.rs +++ b/src/test/run-make/coverage/uses_crate.rs diff --git a/src/test/run-make-fulldeps/coverage/uses_inline_crate.rs b/src/test/run-make/coverage/uses_inline_crate.rs index a7fe8532be3..a7fe8532be3 100644 --- a/src/test/run-make-fulldeps/coverage/uses_inline_crate.rs +++ b/src/test/run-make/coverage/uses_inline_crate.rs diff --git a/src/test/run-make-fulldeps/coverage/while.rs b/src/test/run-make/coverage/while.rs index 781b90b3566..781b90b3566 100644 --- a/src/test/run-make-fulldeps/coverage/while.rs +++ b/src/test/run-make/coverage/while.rs diff --git a/src/test/run-make-fulldeps/coverage/while_early_ret.rs b/src/test/run-make/coverage/while_early_ret.rs index 1fcea9c85c4..1fcea9c85c4 100644 --- a/src/test/run-make-fulldeps/coverage/while_early_ret.rs +++ b/src/test/run-make/coverage/while_early_ret.rs diff --git a/src/test/run-make-fulldeps/coverage/yield.rs b/src/test/run-make/coverage/yield.rs index ff7616656ff..ff7616656ff 100644 --- a/src/test/run-make-fulldeps/coverage/yield.rs +++ b/src/test/run-make/coverage/yield.rs diff --git a/src/test/run-make/pass-linker-flags-from-dep/Makefile b/src/test/run-make/pass-linker-flags-from-dep/Makefile new file mode 100644 index 00000000000..365216b4c35 --- /dev/null +++ b/src/test/run-make/pass-linker-flags-from-dep/Makefile @@ -0,0 +1,10 @@ +-include ../../run-make-fulldeps/tools.mk + +all: + # Build deps + $(RUSTC) native_dep_1.rs --crate-type=staticlib + $(RUSTC) native_dep_2.rs --crate-type=staticlib + $(RUSTC) rust_dep.rs -l static:-bundle=native_dep_1 -l link-arg=some_flag -l static:-bundle=native_dep_2 --crate-type=lib -Z unstable-options + + # Check sequence of linker args + $(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep.rlib --crate-type=bin --print link-args | $(CGREP) -e 'native_dep_1.*some_flag.*native_dep_2' diff --git a/src/test/run-make/pass-linker-flags-from-dep/main.rs b/src/test/run-make/pass-linker-flags-from-dep/main.rs new file mode 100644 index 00000000000..40952fb22b1 --- /dev/null +++ b/src/test/run-make/pass-linker-flags-from-dep/main.rs @@ -0,0 +1,3 @@ +fn main() { + lib::f(); +} diff --git a/src/test/run-make/pass-linker-flags-from-dep/native_dep_1.rs b/src/test/run-make/pass-linker-flags-from-dep/native_dep_1.rs new file mode 100644 index 00000000000..fdb2d9ca68e --- /dev/null +++ b/src/test/run-make/pass-linker-flags-from-dep/native_dep_1.rs @@ -0,0 +1 @@ +pub fn f1() {} diff --git a/src/test/run-make/pass-linker-flags-from-dep/native_dep_2.rs b/src/test/run-make/pass-linker-flags-from-dep/native_dep_2.rs new file mode 100644 index 00000000000..f788b771184 --- /dev/null +++ b/src/test/run-make/pass-linker-flags-from-dep/native_dep_2.rs @@ -0,0 +1 @@ +pub fn f2() {} diff --git a/src/test/run-make/pass-linker-flags-from-dep/rust_dep.rs b/src/test/run-make/pass-linker-flags-from-dep/rust_dep.rs new file mode 100644 index 00000000000..7f5df113934 --- /dev/null +++ b/src/test/run-make/pass-linker-flags-from-dep/rust_dep.rs @@ -0,0 +1,9 @@ +extern "C" { + pub fn foo(); +} + +pub fn f() { + unsafe { + foo(); + } +} diff --git a/src/test/run-make/pass-linker-flags/Makefile b/src/test/run-make/pass-linker-flags/Makefile new file mode 100644 index 00000000000..02b1e2179e1 --- /dev/null +++ b/src/test/run-make/pass-linker-flags/Makefile @@ -0,0 +1,4 @@ +-include ../../run-make-fulldeps/tools.mk + +all: + $(RUSTC) rs.rs -Z unstable-options -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3' diff --git a/src/test/run-make/pass-linker-flags/rs.rs b/src/test/run-make/pass-linker-flags/rs.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/src/test/run-make/pass-linker-flags/rs.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/src/test/rustdoc-ui/z-help.stdout b/src/test/rustdoc-ui/z-help.stdout index 780c0032b6d..c8e5cac0594 100644 --- a/src/test/rustdoc-ui/z-help.stdout +++ b/src/test/rustdoc-ui/z-help.stdout @@ -114,6 +114,7 @@ -Z print-mono-items=val -- print the result of the monomorphization collection pass -Z print-type-sizes=val -- print layout information for each type encountered (default: no) -Z proc-macro-backtrace=val -- show backtraces for panics during proc-macro execution (default: no) + -Z proc-macro-execution-strategy=val -- how to run proc-macro code (default: same-thread) -Z profile=val -- insert profiling code (default: no) -Z profile-closures=val -- profile size of closures -Z profile-emit=val -- file path to emit profiling data at runtime when using 'profile' (default based on relative source path) diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index c7fb85c8f82..1a0a5fdf4eb 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -2,10 +2,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:2:5 | LL | f1(|_: (), _: ()| {}); - | ^^ -------------- found signature of `fn((), ()) -> _` + | ^^ -------------- found signature defined here | | - | expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _` + | expected due to this | + = note: expected closure signature `for<'r, 's> fn(&'r (), &'s ()) -> _` + found closure signature `fn((), ()) -> _` note: required by a bound in `f1` --> $DIR/anonymous-higher-ranked-lifetime.rs:16:25 | @@ -16,10 +18,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:3:5 | LL | f2(|_: (), _: ()| {}); - | ^^ -------------- found signature of `fn((), ()) -> _` + | ^^ -------------- found signature defined here | | - | expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _` + | expected due to this | + = note: expected closure signature `for<'a, 'r> fn(&'a (), &'r ()) -> _` + found closure signature `fn((), ()) -> _` note: required by a bound in `f2` --> $DIR/anonymous-higher-ranked-lifetime.rs:17:25 | @@ -30,10 +34,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 | LL | f3(|_: (), _: ()| {}); - | ^^ -------------- found signature of `fn((), ()) -> _` + | ^^ -------------- found signature defined here | | - | expected signature of `for<'r> fn(&(), &'r ()) -> _` + | expected due to this | + = note: expected closure signature `for<'r> fn(&(), &'r ()) -> _` + found closure signature `fn((), ()) -> _` note: required by a bound in `f3` --> $DIR/anonymous-higher-ranked-lifetime.rs:18:29 | @@ -44,10 +50,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:5:5 | LL | f4(|_: (), _: ()| {}); - | ^^ -------------- found signature of `fn((), ()) -> _` + | ^^ -------------- found signature defined here | | - | expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _` + | expected due to this | + = note: expected closure signature `for<'r, 's> fn(&'s (), &'r ()) -> _` + found closure signature `fn((), ()) -> _` note: required by a bound in `f4` --> $DIR/anonymous-higher-ranked-lifetime.rs:19:25 | @@ -58,10 +66,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 | LL | f5(|_: (), _: ()| {}); - | ^^ -------------- found signature of `fn((), ()) -> _` + | ^^ -------------- found signature defined here | | - | expected signature of `for<'r> fn(&'r (), &'r ()) -> _` + | expected due to this | + = note: expected closure signature `for<'r> fn(&'r (), &'r ()) -> _` + found closure signature `fn((), ()) -> _` note: required by a bound in `f5` --> $DIR/anonymous-higher-ranked-lifetime.rs:20:25 | @@ -72,10 +82,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:7:5 | LL | g1(|_: (), _: ()| {}); - | ^^ -------------- found signature of `fn((), ()) -> _` + | ^^ -------------- found signature defined here | | - | expected signature of `for<'r> fn(&'r (), Box<(dyn for<'s> Fn(&'s ()) + 'static)>) -> _` + | expected due to this | + = note: expected closure signature `for<'r> fn(&'r (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>) -> _` + found closure signature `fn((), ()) -> _` note: required by a bound in `g1` --> $DIR/anonymous-higher-ranked-lifetime.rs:23:25 | @@ -86,10 +98,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 | LL | g2(|_: (), _: ()| {}); - | ^^ -------------- found signature of `fn((), ()) -> _` + | ^^ -------------- found signature defined here | | - | expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _` + | expected due to this | + = note: expected closure signature `for<'r> fn(&'r (), for<'r> fn(&'r ())) -> _` + found closure signature `fn((), ()) -> _` note: required by a bound in `g2` --> $DIR/anonymous-higher-ranked-lifetime.rs:24:25 | @@ -100,10 +114,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:9:5 | LL | g3(|_: (), _: ()| {}); - | ^^ -------------- found signature of `fn((), ()) -> _` + | ^^ -------------- found signature defined here | | - | expected signature of `for<'s> fn(&'s (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>) -> _` + | expected due to this | + = note: expected closure signature `for<'s> fn(&'s (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>) -> _` + found closure signature `fn((), ()) -> _` note: required by a bound in `g3` --> $DIR/anonymous-higher-ranked-lifetime.rs:25:25 | @@ -114,10 +130,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 | LL | g4(|_: (), _: ()| {}); - | ^^ -------------- found signature of `fn((), ()) -> _` + | ^^ -------------- found signature defined here | | - | expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` + | expected due to this | + = note: expected closure signature `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` + found closure signature `fn((), ()) -> _` note: required by a bound in `g4` --> $DIR/anonymous-higher-ranked-lifetime.rs:26:25 | @@ -128,10 +146,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:11:5 | LL | h1(|_: (), _: (), _: (), _: ()| {}); - | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` + | ^^ ---------------------------- found signature defined here | | - | expected signature of `for<'r, 's> fn(&'r (), Box<(dyn for<'t0> Fn(&'t0 ()) + 'static)>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _` + | expected due to this | + = note: expected closure signature `for<'r, 's> fn(&'r (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>, &'s (), for<'r, 's> fn(&'r (), &'s ())) -> _` + found closure signature `fn((), (), (), ()) -> _` note: required by a bound in `h1` --> $DIR/anonymous-higher-ranked-lifetime.rs:29:25 | @@ -142,10 +162,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 | LL | h2(|_: (), _: (), _: (), _: ()| {}); - | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` + | ^^ ---------------------------- found signature defined here | | - | expected signature of `for<'r, 't0> fn(&'r (), Box<(dyn for<'s> Fn(&'s ()) + 'static)>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _` + | expected due to this | + = note: expected closure signature `for<'t0, 'r> fn(&'r (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>, &'t0 (), for<'r, 's> fn(&'r (), &'s ())) -> _` + found closure signature `fn((), (), (), ()) -> _` note: required by a bound in `h2` --> $DIR/anonymous-higher-ranked-lifetime.rs:30:25 | diff --git a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr index ba4c9b63381..8dccf929b2b 100644 --- a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr +++ b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr @@ -2,10 +2,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/expect-infer-var-appearing-twice.rs:14:5 | LL | with_closure(|x: u32, y: i32| { - | ^^^^^^^^^^^^ ---------------- found signature of `fn(u32, i32) -> _` + | ^^^^^^^^^^^^ ---------------- found signature defined here | | - | expected signature of `fn(_, _) -> _` + | expected due to this | + = note: expected closure signature `fn(_, _) -> _` + found closure signature `fn(u32, i32) -> _` note: required by a bound in `with_closure` --> $DIR/expect-infer-var-appearing-twice.rs:2:14 | diff --git a/src/test/ui/coercion/issue-53475.rs b/src/test/ui/coercion/issue-53475.rs new file mode 100644 index 00000000000..3770c024fb9 --- /dev/null +++ b/src/test/ui/coercion/issue-53475.rs @@ -0,0 +1,13 @@ +#![feature(coerce_unsized)] + +use std::any::Any; +use std::ops::CoerceUnsized; + +struct Foo<T> { + data: Box<T>, +} + +impl<T> CoerceUnsized<Foo<dyn Any>> for Foo<T> {} +//~^ ERROR the parameter type `T` may not live long enough + +fn main() {} diff --git a/src/test/ui/coercion/issue-53475.stderr b/src/test/ui/coercion/issue-53475.stderr new file mode 100644 index 00000000000..522c50dca95 --- /dev/null +++ b/src/test/ui/coercion/issue-53475.stderr @@ -0,0 +1,14 @@ +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 + | +help: consider adding an explicit lifetime bound... + | +LL | impl<T: 'static> CoerceUnsized<Foo<dyn Any>> for Foo<T> {} + | +++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/errors/issue-99572-impl-trait-on-pointer.rs b/src/test/ui/errors/issue-99572-impl-trait-on-pointer.rs new file mode 100644 index 00000000000..272c6bd3fb7 --- /dev/null +++ b/src/test/ui/errors/issue-99572-impl-trait-on-pointer.rs @@ -0,0 +1,25 @@ +// Emit additional suggestion to correct the trait implementation +// on a pointer +use std::{fmt, marker}; + +struct LocalType; + +impl fmt::Display for *mut LocalType { +//~^ ERROR only traits defined in the current crate can be implemented for arbitrary types +//~| NOTE impl doesn't use only types from inside the current crate +//~| NOTE `*mut LocalType` is not defined in the current crate because raw pointers are always foreign +//~| NOTE define and implement a trait or new type instead +//~| HELP consider introducing a new wrapper type + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "This not compile") + } +} + +impl<T> marker::Copy for *mut T { +//~^ ERROR only traits defined in the current crate can be implemented for arbitrary types +//~| NOTE impl doesn't use only types from inside the current crate +//~| NOTE `*mut T` is not defined in the current crate because raw pointers are always foreign +//~| NOTE define and implement a trait or new type instead +} + +fn main() {} diff --git a/src/test/ui/errors/issue-99572-impl-trait-on-pointer.stderr b/src/test/ui/errors/issue-99572-impl-trait-on-pointer.stderr new file mode 100644 index 00000000000..78d7a47deaa --- /dev/null +++ b/src/test/ui/errors/issue-99572-impl-trait-on-pointer.stderr @@ -0,0 +1,31 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/issue-99572-impl-trait-on-pointer.rs:7:1 + | +LL | impl fmt::Display for *mut LocalType { + | ^^^^^^^^^^^^^^^^^^^^^^-------------- + | | | + | | `*mut LocalType` is not defined in the current crate because raw pointers are always foreign + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead +help: consider introducing a new wrapper type + | +LL + struct WrapperType(*mut LocalType); +LL + +LL ~ impl fmt::Display for WrapperType { + | + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/issue-99572-impl-trait-on-pointer.rs:18:1 + | +LL | impl<T> marker::Copy for *mut T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^------ + | | | + | | `*mut T` is not defined in the current crate because raw pointers are always foreign + | impl doesn't use only types from inside the current crate + | + = note: define and implement a trait or new type instead + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/generator/issue-88653.rs b/src/test/ui/generator/issue-88653.rs index caa452060b1..1d9377bcef4 100644 --- a/src/test/ui/generator/issue-88653.rs +++ b/src/test/ui/generator/issue-88653.rs @@ -7,10 +7,12 @@ use std::ops::Generator; fn foo(bar: bool) -> impl Generator<(bool,)> { //~^ ERROR: type mismatch in generator arguments [E0631] - //~| NOTE: expected signature of `fn((bool,)) -> _` + //~| NOTE: expected due to this + //~| NOTE: expected generator signature `fn((bool,)) -> _` + //~| NOTE: in this expansion of desugaring of `impl Trait` //~| NOTE: in this expansion of desugaring of `impl Trait` |bar| { - //~^ NOTE: found signature of `fn(bool) -> _` + //~^ NOTE: found signature defined here if bar { yield bar; } diff --git a/src/test/ui/generator/issue-88653.stderr b/src/test/ui/generator/issue-88653.stderr index 5bd8ad129fe..b742c6e2f1c 100644 --- a/src/test/ui/generator/issue-88653.stderr +++ b/src/test/ui/generator/issue-88653.stderr @@ -2,10 +2,13 @@ error[E0631]: type mismatch in generator arguments --> $DIR/issue-88653.rs:8:22 | LL | fn foo(bar: bool) -> impl Generator<(bool,)> { - | ^^^^^^^^^^^^^^^^^^^^^^^ expected signature of `fn((bool,)) -> _` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected due to this ... LL | |bar| { - | ----- found signature of `fn(bool) -> _` + | ----- found signature defined here + | + = note: expected generator signature `fn((bool,)) -> _` + found generator signature `fn(bool) -> _` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/anonymize-bound-vars.rs b/src/test/ui/generic-associated-types/anonymize-bound-vars.rs new file mode 100644 index 00000000000..1ec9c69989a --- /dev/null +++ b/src/test/ui/generic-associated-types/anonymize-bound-vars.rs @@ -0,0 +1,14 @@ +// check-pass +// +// regression test for #98702 +#![feature(generic_associated_types)] + +trait Foo { + type Assoc<T>; +} + +impl Foo for () { + type Assoc<T> = [T; 2*2]; +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.stderr b/src/test/ui/generic-associated-types/bugs/issue-88382.stderr index ce196dcbd86..7210895b79b 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88382.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-88382.stderr @@ -2,13 +2,15 @@ error[E0631]: type mismatch in function arguments --> $DIR/issue-88382.rs:28:40 | LL | do_something(SomeImplementation(), test); - | ------------ ^^^^ expected signature of `for<'r> fn(&'r mut std::iter::Empty<usize>) -> _` + | ------------ ^^^^ expected due to this | | | required by a bound introduced by this call ... LL | fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {} - | ------------------------------------------------- found signature of `for<'r, 'a> fn(&'r mut <_ as Iterable>::Iterator<'a>) -> _` + | ------------------------------------------------- found signature defined here | + = note: expected function signature `for<'r> fn(&'r mut std::iter::Empty<usize>) -> _` + found function signature `for<'a, 'r> fn(&'r mut <_ as Iterable>::Iterator<'a>) -> _` note: required by a bound in `do_something` --> $DIR/issue-88382.rs:22:48 | diff --git a/src/test/ui/index-help.stderr b/src/test/ui/index-help.stderr index 7f51a48111b..b36f4dab829 100644 --- a/src/test/ui/index-help.stderr +++ b/src/test/ui/index-help.stderr @@ -1,8 +1,8 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `i32` - --> $DIR/index-help.rs:3:5 + --> $DIR/index-help.rs:3:7 | LL | x[0i32]; - | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^^ 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` diff --git a/src/test/ui/indexing-requires-a-uint.stderr b/src/test/ui/indexing-requires-a-uint.stderr index 0a24855a6a7..fbff20f8dee 100644 --- a/src/test/ui/indexing-requires-a-uint.stderr +++ b/src/test/ui/indexing-requires-a-uint.stderr @@ -1,8 +1,8 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `u8` - --> $DIR/indexing-requires-a-uint.rs:6:5 + --> $DIR/indexing-requires-a-uint.rs:6:9 | LL | [0][0u8]; - | ^^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^ 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` diff --git a/src/test/ui/integral-indexing.stderr b/src/test/ui/integral-indexing.stderr index be3398552dc..3f9094d124e 100644 --- a/src/test/ui/integral-indexing.stderr +++ b/src/test/ui/integral-indexing.stderr @@ -1,78 +1,78 @@ error[E0277]: the type `[isize]` cannot be indexed by `u8` - --> $DIR/integral-indexing.rs:6:5 + --> $DIR/integral-indexing.rs:6:7 | LL | v[3u8]; - | ^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^ 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` = note: required because of the requirements on the impl of `Index<u8>` for `Vec<isize>` error[E0277]: the type `[isize]` cannot be indexed by `i8` - --> $DIR/integral-indexing.rs:7:5 + --> $DIR/integral-indexing.rs:7:7 | LL | v[3i8]; - | ^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^ 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` = note: required because of the requirements on the impl of `Index<i8>` for `Vec<isize>` error[E0277]: the type `[isize]` cannot be indexed by `u32` - --> $DIR/integral-indexing.rs:8:5 + --> $DIR/integral-indexing.rs:8:7 | LL | v[3u32]; - | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^^ 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` = note: required because of the requirements on the impl of `Index<u32>` for `Vec<isize>` error[E0277]: the type `[isize]` cannot be indexed by `i32` - --> $DIR/integral-indexing.rs:9:5 + --> $DIR/integral-indexing.rs:9:7 | LL | v[3i32]; - | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^^ 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` = note: required because of the requirements on the impl of `Index<i32>` for `Vec<isize>` error[E0277]: the type `[u8]` cannot be indexed by `u8` - --> $DIR/integral-indexing.rs:12:5 + --> $DIR/integral-indexing.rs:12:18 | LL | s.as_bytes()[3u8]; - | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^ 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` = note: required because of the requirements on the impl of `Index<u8>` for `[u8]` error[E0277]: the type `[u8]` cannot be indexed by `i8` - --> $DIR/integral-indexing.rs:13:5 + --> $DIR/integral-indexing.rs:13:18 | LL | s.as_bytes()[3i8]; - | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^ 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` = note: required because of the requirements on the impl of `Index<i8>` for `[u8]` error[E0277]: the type `[u8]` cannot be indexed by `u32` - --> $DIR/integral-indexing.rs:14:5 + --> $DIR/integral-indexing.rs:14:18 | LL | s.as_bytes()[3u32]; - | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^^ 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` = note: required because of the requirements on the impl of `Index<u32>` for `[u8]` error[E0277]: the type `[u8]` cannot be indexed by `i32` - --> $DIR/integral-indexing.rs:15:5 + --> $DIR/integral-indexing.rs:15:18 | LL | s.as_bytes()[3i32]; - | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^^ 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` diff --git a/src/test/ui/intrinsics/const-eval-select-bad.stderr b/src/test/ui/intrinsics/const-eval-select-bad.stderr index d65818234ef..89dba12c818 100644 --- a/src/test/ui/intrinsics/const-eval-select-bad.stderr +++ b/src/test/ui/intrinsics/const-eval-select-bad.stderr @@ -67,13 +67,15 @@ error[E0631]: type mismatch in function arguments --> $DIR/const-eval-select-bad.rs:34:32 | LL | const fn foo(n: i32) -> i32 { - | --------------------------- found signature of `fn(i32) -> _` + | --------------------------- found signature defined here ... LL | const_eval_select((true,), foo, baz); - | ----------------- ^^^ expected signature of `fn(bool) -> _` + | ----------------- ^^^ expected due to this | | | required by a bound introduced by this call | + = note: expected function signature `fn(bool) -> _` + found function signature `fn(i32) -> _` note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL | diff --git a/src/test/ui/let-else/let-else-temp-borrowck.rs b/src/test/ui/let-else/let-else-temp-borrowck.rs new file mode 100644 index 00000000000..3910d35e776 --- /dev/null +++ b/src/test/ui/let-else/let-else-temp-borrowck.rs @@ -0,0 +1,26 @@ +// run-pass +// +// from issue #93951, where borrowck complained the temporary that `foo(&x)` was stored in was to +// be dropped sometime after `x` was. It then suggested adding a semicolon that was already there. + +#![feature(let_else)] +use std::fmt::Debug; + +fn foo<'a>(x: &'a str) -> Result<impl Debug + 'a, ()> { + Ok(x) +} + +fn let_else() { + let x = String::from("Hey"); + let Ok(_) = foo(&x) else { return }; +} + +fn if_let() { + let x = String::from("Hey"); + let _ = if let Ok(s) = foo(&x) { s } else { return }; +} + +fn main() { + let_else(); + if_let(); +} diff --git a/src/test/ui/let-else/let-else-temporary-lifetime.rs b/src/test/ui/let-else/let-else-temporary-lifetime.rs index 624c2ea37a7..9c86901b97f 100644 --- a/src/test/ui/let-else/let-else-temporary-lifetime.rs +++ b/src/test/ui/let-else/let-else-temporary-lifetime.rs @@ -1,6 +1,8 @@ // run-pass #![feature(let_else)] +use std::fmt::Display; +use std::rc::Rc; use std::sync::atomic::{AtomicU8, Ordering}; static TRACKER: AtomicU8 = AtomicU8::new(0); @@ -17,9 +19,70 @@ impl Drop for Droppy { } } +fn foo<'a>(x: &'a str) -> Result<impl Display + 'a, ()> { + Ok(x) +} + fn main() { assert_eq!(TRACKER.load(Ordering::Acquire), 0); let 0 = Droppy::default().inner else { return }; assert_eq!(TRACKER.load(Ordering::Acquire), 1); println!("Should have dropped 👆"); + + { + // cf. https://github.com/rust-lang/rust/pull/99518#issuecomment-1191520030 + struct Foo<'a>(&'a mut u32); + + impl<'a> Drop for Foo<'a> { + fn drop(&mut self) { + *self.0 = 0; + } + } + let mut foo = 0; + let Foo(0) = Foo(&mut foo) else { + *&mut foo = 1; + todo!() + }; + } + { + let x = String::from("Hey"); + + let Ok(s) = foo(&x) else { panic!() }; + assert_eq!(s.to_string(), x); + } + { + // test let-else drops temps after statement + let rc = Rc::new(0); + let 0 = *rc.clone() else { unreachable!() }; + Rc::try_unwrap(rc).unwrap(); + } + { + let mut rc = Rc::new(0); + let mut i = 0; + loop { + if i > 3 { + break; + } + let 1 = *rc.clone() else { + if let Ok(v) = Rc::try_unwrap(rc) { + rc = Rc::new(v); + } else { + panic!() + } + i += 1; + continue + }; + } + } + { + // test let-else drops temps before else block + // NOTE: this test has to be the last block in the `main` + // body. + let rc = Rc::new(0); + let 1 = *rc.clone() else { + Rc::try_unwrap(rc).unwrap(); + return; + }; + unreachable!(); + } } diff --git a/src/test/ui/manual/manual-link-bad-kind.rs b/src/test/ui/manual/manual-link-bad-kind.rs index d1609338db6..c50a6c034b5 100644 --- a/src/test/ui/manual/manual-link-bad-kind.rs +++ b/src/test/ui/manual/manual-link-bad-kind.rs @@ -1,5 +1,5 @@ // compile-flags:-l bar=foo -// error-pattern: unknown library kind `bar`, expected one of: static, dylib, framework +// error-pattern: unknown library kind `bar`, expected one of: static, dylib, framework, link-arg fn main() { } diff --git a/src/test/ui/manual/manual-link-bad-kind.stderr b/src/test/ui/manual/manual-link-bad-kind.stderr index 86146956699..647c4c61e02 100644 --- a/src/test/ui/manual/manual-link-bad-kind.stderr +++ b/src/test/ui/manual/manual-link-bad-kind.stderr @@ -1,2 +1,2 @@ -error: unknown library kind `bar`, expected one of: static, dylib, framework +error: unknown library kind `bar`, expected one of: static, dylib, framework, link-arg diff --git a/src/test/ui/manual/manual-link-unsupported-kind.rs b/src/test/ui/manual/manual-link-unsupported-kind.rs index 7a40186d504..b8ec575a455 100644 --- a/src/test/ui/manual/manual-link-unsupported-kind.rs +++ b/src/test/ui/manual/manual-link-unsupported-kind.rs @@ -1,5 +1,5 @@ // compile-flags:-l raw-dylib=foo -// error-pattern: unknown library kind `raw-dylib`, expected one of: static, dylib, framework +// error-pattern: unknown library kind `raw-dylib`, expected one of: static, dylib, framework, link-arg fn main() { } diff --git a/src/test/ui/manual/manual-link-unsupported-kind.stderr b/src/test/ui/manual/manual-link-unsupported-kind.stderr index 4965c0af5f2..ae4a1ec9a95 100644 --- a/src/test/ui/manual/manual-link-unsupported-kind.stderr +++ b/src/test/ui/manual/manual-link-unsupported-kind.stderr @@ -1,2 +1,2 @@ -error: unknown library kind `raw-dylib`, expected one of: static, dylib, framework +error: unknown library kind `raw-dylib`, expected one of: static, dylib, framework, link-arg diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index 1f2e169c681..4d673d45559 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -2,10 +2,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:7:5 | LL | foo(|_: isize| {}); - | ^^^ ---------- found signature of `fn(isize) -> _` + | ^^^ ---------- found signature defined here | | - | expected signature of `fn(usize) -> _` + | expected due to this | + = note: expected closure signature `fn(usize) -> _` + found closure signature `fn(isize) -> _` note: required by a bound in `foo` --> $DIR/E0631.rs:3:11 | @@ -16,10 +18,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:8:5 | LL | bar(|_: isize| {}); - | ^^^ ---------- found signature of `fn(isize) -> _` + | ^^^ ---------- found signature defined here | | - | expected signature of `fn(usize) -> _` + | expected due to this | + = note: expected closure signature `fn(usize) -> _` + found closure signature `fn(isize) -> _` note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | @@ -30,13 +34,15 @@ error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:9:9 | LL | fn f(_: u64) {} - | ------------ found signature of `fn(u64) -> _` + | ------------ found signature defined here ... LL | foo(f); - | --- ^ expected signature of `fn(usize) -> _` + | --- ^ expected due to this | | | required by a bound introduced by this call | + = note: expected function signature `fn(usize) -> _` + found function signature `fn(u64) -> _` note: required by a bound in `foo` --> $DIR/E0631.rs:3:11 | @@ -47,13 +53,15 @@ error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:10:9 | LL | fn f(_: u64) {} - | ------------ found signature of `fn(u64) -> _` + | ------------ found signature defined here ... LL | bar(f); - | --- ^ expected signature of `fn(usize) -> _` + | --- ^ expected due to this | | | required by a bound introduced by this call | + = note: expected function signature `fn(usize) -> _` + found function signature `fn(u64) -> _` note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index d9578f6c8dc..71469bfec2d 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -2,10 +2,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:3:14 | LL | a.iter().map(|_: (u32, u32)| 45); - | ^^^ --------------- found signature of `fn((u32, u32)) -> _` + | ^^^ --------------- found signature defined here | | - | expected signature of `fn(&(u32, u32)) -> _` + | expected due to this | + = note: expected closure signature `fn(&(u32, u32)) -> _` + found closure signature `fn((u32, u32)) -> _` note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | @@ -16,10 +18,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:4:14 | LL | a.iter().map(|_: &(u16, u16)| 45); - | ^^^ ---------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _` + | ^^^ ---------------- found signature defined here | | - | expected signature of `fn(&(u32, u32)) -> _` + | expected due to this | + = note: expected closure signature `fn(&(u32, u32)) -> _` + found closure signature `for<'r> fn(&'r (u16, u16)) -> _` note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | @@ -30,10 +34,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:5:14 | LL | a.iter().map(|_: (u16, u16)| 45); - | ^^^ --------------- found signature of `fn((u16, u16)) -> _` + | ^^^ --------------- found signature defined here | | - | expected signature of `fn(&(u32, u32)) -> _` + | expected due to this | + = note: expected closure signature `fn(&(u32, u32)) -> _` + found closure signature `fn((u16, u16)) -> _` note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr index ce1dde94b5d..eec6d83fe22 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.stderr +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -2,13 +2,15 @@ error[E0631]: type mismatch in function arguments --> $DIR/fn-variance-1.rs:11:15 | LL | fn takes_mut(x: &mut isize) { } - | --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _` + | --------------------------- found signature defined here ... LL | apply(&3, takes_mut); - | ----- ^^^^^^^^^ expected signature of `fn(&{integer}) -> _` + | ----- ^^^^^^^^^ expected due to this | | | required by a bound introduced by this call | + = note: expected function signature `fn(&{integer}) -> _` + found function signature `for<'r> fn(&'r mut isize) -> _` note: required by a bound in `apply` --> $DIR/fn-variance-1.rs:5:37 | @@ -19,13 +21,15 @@ error[E0631]: type mismatch in function arguments --> $DIR/fn-variance-1.rs:15:19 | LL | fn takes_imm(x: &isize) { } - | ----------------------- found signature of `for<'r> fn(&'r isize) -> _` + | ----------------------- found signature defined here ... LL | apply(&mut 3, takes_imm); - | ----- ^^^^^^^^^ expected signature of `fn(&mut {integer}) -> _` + | ----- ^^^^^^^^^ expected due to this | | | required by a bound introduced by this call | + = note: expected function signature `fn(&mut {integer}) -> _` + found function signature `for<'r> fn(&'r isize) -> _` note: required by a bound in `apply` --> $DIR/fn-variance-1.rs:5:37 | diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr index 9d1ea70f8a4..b11ea97d160 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.stderr +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -2,10 +2,12 @@ error[E0631]: type mismatch in closure arguments --> $DIR/issue-36053-2.rs:7:32 | LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); - | ^^^^^^ --------- found signature of `for<'r> fn(&'r str) -> _` + | ^^^^^^ --------- found signature defined here | | - | expected signature of `for<'r> fn(&'r &str) -> _` + | expected due to this | + = note: expected closure signature `for<'r> fn(&'r &str) -> _` + found closure signature `for<'r> fn(&'r str) -> _` note: required by a bound in `filter` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs index 44ec28f53cc..8dbe3472ea8 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs @@ -2,20 +2,21 @@ use std::ops::FnMut; -fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f } +fn to_fn_mut<A, F: FnMut<A>>(f: F) -> F { f } -fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize { -//~^ NOTE required by this bound in `call_it` -//~| NOTE required by a bound in `call_it` +fn call_it<F: FnMut(isize, isize) -> isize>(y: isize, mut f: F) -> isize { + //~^ NOTE required by this bound in `call_it` + //~| NOTE required by a bound in `call_it` f(2, y) } pub fn main() { let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); - //~^ NOTE found signature of `fn(usize, isize) -> _` + //~^ NOTE found signature defined here let z = call_it(3, f); //~^ ERROR type mismatch - //~| NOTE expected signature of `fn(isize, isize) -> _` + //~| NOTE expected due to this + //~| NOTE expected closure signature `fn(isize, _) -> _` //~| NOTE required by a bound introduced by this call println!("{}", z); } diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index f9ef5bc4e39..54b22006527 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -2,18 +2,20 @@ error[E0631]: type mismatch in closure arguments --> $DIR/unboxed-closures-vtable-mismatch.rs:16:24 | LL | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); - | ----------------------------- found signature of `fn(usize, isize) -> _` + | ----------------------------- found signature defined here LL | LL | let z = call_it(3, f); - | ------- ^ expected signature of `fn(isize, isize) -> _` + | ------- ^ expected due to this | | | required by a bound introduced by this call | + = note: expected closure signature `fn(isize, _) -> _` + found closure signature `fn(usize, _) -> _` note: required by a bound in `call_it` - --> $DIR/unboxed-closures-vtable-mismatch.rs:7:14 + --> $DIR/unboxed-closures-vtable-mismatch.rs:7:15 | -LL | fn call_it<F:FnMut(isize,isize)->isize>(y: isize, mut f: F) -> isize { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it` +LL | fn call_it<F: FnMut(isize, isize) -> isize>(y: isize, mut f: F) -> isize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it` error: aborting due to previous error diff --git a/src/test/ui/native-library-link-flags/empty-kind-1.rs b/src/test/ui/native-library-link-flags/empty-kind-1.rs index 086d8cff957..18937856d20 100644 --- a/src/test/ui/native-library-link-flags/empty-kind-1.rs +++ b/src/test/ui/native-library-link-flags/empty-kind-1.rs @@ -1,6 +1,6 @@ // Unspecified kind should fail with an error // compile-flags: -l =mylib -// error-pattern: unknown library kind ``, expected one of: static, dylib, framework +// error-pattern: unknown library kind ``, expected one of: static, dylib, framework, link-arg fn main() {} diff --git a/src/test/ui/native-library-link-flags/empty-kind-1.stderr b/src/test/ui/native-library-link-flags/empty-kind-1.stderr index 37846c0b06f..3e5b0549339 100644 --- a/src/test/ui/native-library-link-flags/empty-kind-1.stderr +++ b/src/test/ui/native-library-link-flags/empty-kind-1.stderr @@ -1,2 +1,2 @@ -error: unknown library kind ``, expected one of: static, dylib, framework +error: unknown library kind ``, expected one of: static, dylib, framework, link-arg diff --git a/src/test/ui/native-library-link-flags/empty-kind-2.rs b/src/test/ui/native-library-link-flags/empty-kind-2.rs index 45ec8ec85e3..851eb63fcd8 100644 --- a/src/test/ui/native-library-link-flags/empty-kind-2.rs +++ b/src/test/ui/native-library-link-flags/empty-kind-2.rs @@ -1,6 +1,6 @@ // Unspecified kind should fail with an error // compile-flags: -l :+bundle=mylib -// error-pattern: unknown library kind ``, expected one of: static, dylib, framework +// error-pattern: unknown library kind ``, expected one of: static, dylib, framework, link-arg fn main() {} diff --git a/src/test/ui/native-library-link-flags/empty-kind-2.stderr b/src/test/ui/native-library-link-flags/empty-kind-2.stderr index 37846c0b06f..3e5b0549339 100644 --- a/src/test/ui/native-library-link-flags/empty-kind-2.stderr +++ b/src/test/ui/native-library-link-flags/empty-kind-2.stderr @@ -1,2 +1,2 @@ -error: unknown library kind ``, expected one of: static, dylib, framework +error: unknown library kind ``, expected one of: static, dylib, framework, link-arg diff --git a/src/test/ui/native-library-link-flags/link-arg-error.rs b/src/test/ui/native-library-link-flags/link-arg-error.rs new file mode 100644 index 00000000000..e041650d024 --- /dev/null +++ b/src/test/ui/native-library-link-flags/link-arg-error.rs @@ -0,0 +1,4 @@ +// compile-flags: -l link-arg:+bundle=arg -Z unstable-options +// error-pattern: linking modifier `bundle` is only compatible with `static` linking kind + +fn main() {} diff --git a/src/test/ui/native-library-link-flags/link-arg-error.stderr b/src/test/ui/native-library-link-flags/link-arg-error.stderr new file mode 100644 index 00000000000..e1d01e14152 --- /dev/null +++ b/src/test/ui/native-library-link-flags/link-arg-error.stderr @@ -0,0 +1,2 @@ +error: linking modifier `bundle` is only compatible with `static` linking kind + diff --git a/src/test/ui/native-library-link-flags/link-arg-from-rs.rs b/src/test/ui/native-library-link-flags/link-arg-from-rs.rs new file mode 100644 index 00000000000..075e4d9e79e --- /dev/null +++ b/src/test/ui/native-library-link-flags/link-arg-from-rs.rs @@ -0,0 +1,8 @@ +// link-arg is not supposed to be usable in #[link] attributes + +// compile-flags: +// error-pattern: error[E0458]: unknown link kind `link-arg`, expected one of: static, dylib, framework, raw-dylib + +#[link(kind = "link-arg")] +extern "C" {} +pub fn main() {} diff --git a/src/test/ui/native-library-link-flags/link-arg-from-rs.stderr b/src/test/ui/native-library-link-flags/link-arg-from-rs.stderr new file mode 100644 index 00000000000..69a7825c0b1 --- /dev/null +++ b/src/test/ui/native-library-link-flags/link-arg-from-rs.stderr @@ -0,0 +1,16 @@ +error[E0458]: unknown link kind `link-arg`, expected one of: static, dylib, framework, raw-dylib + --> $DIR/link-arg-from-rs.rs:6:15 + | +LL | #[link(kind = "link-arg")] + | ^^^^^^^^^^ unknown link kind + +error[E0459]: `#[link]` attribute requires a `name = "string"` argument + --> $DIR/link-arg-from-rs.rs:6:1 + | +LL | #[link(kind = "link-arg")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0458, E0459. +For more information about an error, try `rustc --explain E0458`. diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr index ae7d2e1d823..72f67a68515 100644 --- a/src/test/ui/on-unimplemented/slice-index.stderr +++ b/src/test/ui/on-unimplemented/slice-index.stderr @@ -1,18 +1,18 @@ error[E0277]: the type `[i32]` cannot be indexed by `i32` - --> $DIR/slice-index.rs:8:5 + --> $DIR/slice-index.rs:8:7 | LL | x[1i32]; - | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^^ 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` = note: required because of the requirements on the impl of `Index<i32>` for `[i32]` error[E0277]: the type `[i32]` cannot be indexed by `RangeTo<i32>` - --> $DIR/slice-index.rs:9:5 + --> $DIR/slice-index.rs:9:7 | LL | x[..1i32]; - | ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` + | ^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[i32]>` is not implemented for `RangeTo<i32>` = help: the following other types implement trait `SliceIndex<T>`: diff --git a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.rs b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.rs index 23f245a5168..7bd4b3a165c 100644 --- a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.rs +++ b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.rs @@ -8,16 +8,16 @@ use std::pin::Pin; // errors and parse such that further code gives useful errors. pub fn index_after_as_cast() { vec![1, 2, 3] as Vec<i32>[0]; - //~^ ERROR: casts cannot be followed by indexing + //~^ ERROR: cast cannot be followed by indexing vec![1, 2, 3]: Vec<i32>[0]; - //~^ ERROR: casts cannot be followed by indexing + //~^ ERROR: type ascription cannot be followed by indexing } pub fn index_after_cast_to_index() { (&[0]) as &[i32][0]; - //~^ ERROR: casts cannot be followed by indexing + //~^ ERROR: cast cannot be followed by indexing (&[0i32]): &[i32; 1][0]; - //~^ ERROR: casts cannot be followed by indexing + //~^ ERROR: type ascription cannot be followed by indexing } pub fn cast_after_cast() { @@ -37,89 +37,89 @@ pub fn cast_after_cast() { pub fn cast_cast_method_call() { let _ = 0i32: i32: i32.count_ones(); - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: type ascription cannot be followed by a method call let _ = 0 as i32: i32.count_ones(); - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: type ascription cannot be followed by a method call let _ = 0i32: i32 as i32.count_ones(); - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: cast cannot be followed by a method call let _ = 0 as i32 as i32.count_ones(); - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: cast cannot be followed by a method call let _ = 0i32: i32: i32 as u32 as i32.count_ones(); - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: cast cannot be followed by a method call let _ = 0i32: i32.count_ones(): u32; - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: type ascription cannot be followed by a method call let _ = 0 as i32.count_ones(): u32; - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: cast cannot be followed by a method call let _ = 0i32: i32.count_ones() as u32; - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: type ascription cannot be followed by a method call let _ = 0 as i32.count_ones() as u32; - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: cast cannot be followed by a method call let _ = 0i32: i32: i32.count_ones() as u32 as i32; - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: type ascription cannot be followed by a method call } pub fn multiline_error() { let _ = 0 as i32 .count_ones(); - //~^^^ ERROR: casts cannot be followed by a method call + //~^^^ ERROR: cast cannot be followed by a method call } // this tests that the precedence for `!x as Y.Z` is still what we expect pub fn precedence() { let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0]; - //~^ ERROR: casts cannot be followed by indexing + //~^ ERROR: cast cannot be followed by indexing } pub fn method_calls() { 0 as i32.max(0); - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: cast cannot be followed by a method call 0: i32.max(0); - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: type ascription cannot be followed by a method call } pub fn complex() { let _ = format!( "{} and {}", if true { 33 } else { 44 } as i32.max(0), - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: cast cannot be followed by a method call if true { 33 } else { 44 }: i32.max(0) - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: type ascription cannot be followed by a method call ); } pub fn in_condition() { if 5u64 as i32.max(0) == 0 { - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: cast cannot be followed by a method call } if 5u64: u64.max(0) == 0 { - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: type ascription cannot be followed by a method call } } pub fn inside_block() { let _ = if true { 5u64 as u32.max(0) == 0 - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: cast cannot be followed by a method call } else { false }; let _ = if true { 5u64: u64.max(0) == 0 - //~^ ERROR: casts cannot be followed by a method call + //~^ ERROR: type ascription cannot be followed by a method call } else { false }; } static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]); -//~^ ERROR: casts cannot be followed by indexing +//~^ ERROR: cast cannot be followed by indexing static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); -//~^ ERROR: casts cannot be followed by indexing +//~^ ERROR: type ascription cannot be followed by indexing pub fn cast_then_try() -> Result<u64,u64> { Err(0u64) as Result<u64,u64>?; - //~^ ERROR: casts cannot be followed by `?` + //~^ ERROR: cast cannot be followed by `?` Err(0u64): Result<u64,u64>?; - //~^ ERROR: casts cannot be followed by `?` + //~^ ERROR: type ascription cannot be followed by `?` Ok(1) } @@ -143,17 +143,17 @@ pub fn cast_to_fn_should_work() { pub fn parens_after_cast_error() { let drop_ptr = drop as fn(u8); drop as fn(u8)(0); - //~^ ERROR: casts cannot be followed by a function call + //~^ ERROR: cast cannot be followed by a function call drop_ptr: fn(u8)(0); - //~^ ERROR: casts cannot be followed by a function call + //~^ ERROR: type ascription cannot be followed by a function call } pub async fn cast_then_await() { Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await; - //~^ ERROR: casts cannot be followed by `.await` + //~^ ERROR: cast cannot be followed by `.await` Box::pin(noop()): Pin<Box<_>>.await; - //~^ ERROR: casts cannot be followed by `.await` + //~^ ERROR: type ascription cannot be followed by `.await` } pub async fn noop() {} @@ -167,5 +167,5 @@ pub fn struct_field() { Foo::default() as Foo.bar; //~^ ERROR: cannot be followed by a field access Foo::default(): Foo.bar; - //~^ ERROR: cannot be followed by a field access + //~^ ERROR: type ascription cannot be followed by a field access } diff --git a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr index 4cf273d8be5..0c328bde285 100644 --- a/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr +++ b/src/test/ui/parser/issues/issue-35813-postfix-after-cast.stderr @@ -1,4 +1,4 @@ -error: casts cannot be followed by indexing +error: cast cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:10:5 | LL | vec![1, 2, 3] as Vec<i32>[0]; @@ -9,7 +9,7 @@ help: try surrounding the expression in parentheses LL | (vec![1, 2, 3] as Vec<i32>)[0]; | + + -error: casts cannot be followed by indexing +error: type ascription cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:12:5 | LL | vec![1, 2, 3]: Vec<i32>[0]; @@ -25,7 +25,7 @@ LL - vec![1, 2, 3]: Vec<i32>[0]; LL + vec![1, 2, 3][0]; | -error: casts cannot be followed by indexing +error: cast cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:17:5 | LL | (&[0]) as &[i32][0]; @@ -36,7 +36,7 @@ help: try surrounding the expression in parentheses LL | ((&[0]) as &[i32])[0]; | + + -error: casts cannot be followed by indexing +error: type ascription cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:19:5 | LL | (&[0i32]): &[i32; 1][0]; @@ -52,7 +52,7 @@ LL - (&[0i32]): &[i32; 1][0]; LL + (&[0i32])[0]; | -error: casts cannot be followed by a method call +error: type ascription cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:39:13 | LL | let _ = 0i32: i32: i32.count_ones(); @@ -68,7 +68,7 @@ LL - let _ = 0i32: i32: i32.count_ones(); LL + let _ = 0i32: i32.count_ones(); | -error: casts cannot be followed by a method call +error: type ascription cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:41:13 | LL | let _ = 0 as i32: i32.count_ones(); @@ -84,7 +84,7 @@ LL - let _ = 0 as i32: i32.count_ones(); LL + let _ = 0 as i32.count_ones(); | -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:43:13 | LL | let _ = 0i32: i32 as i32.count_ones(); @@ -95,7 +95,7 @@ help: try surrounding the expression in parentheses LL | let _ = (0i32: i32 as i32).count_ones(); | + + -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:45:13 | LL | let _ = 0 as i32 as i32.count_ones(); @@ -106,7 +106,7 @@ help: try surrounding the expression in parentheses LL | let _ = (0 as i32 as i32).count_ones(); | + + -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:47:13 | LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones(); @@ -117,7 +117,7 @@ help: try surrounding the expression in parentheses LL | let _ = (0i32: i32: i32 as u32 as i32).count_ones(); | + + -error: casts cannot be followed by a method call +error: type ascription cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:49:13 | LL | let _ = 0i32: i32.count_ones(): u32; @@ -133,7 +133,7 @@ LL - let _ = 0i32: i32.count_ones(): u32; LL + let _ = 0i32.count_ones(): u32; | -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:51:13 | LL | let _ = 0 as i32.count_ones(): u32; @@ -144,7 +144,7 @@ help: try surrounding the expression in parentheses LL | let _ = (0 as i32).count_ones(): u32; | + + -error: casts cannot be followed by a method call +error: type ascription cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:53:13 | LL | let _ = 0i32: i32.count_ones() as u32; @@ -160,7 +160,7 @@ LL - let _ = 0i32: i32.count_ones() as u32; LL + let _ = 0i32.count_ones() as u32; | -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:55:13 | LL | let _ = 0 as i32.count_ones() as u32; @@ -171,7 +171,7 @@ help: try surrounding the expression in parentheses LL | let _ = (0 as i32).count_ones() as u32; | + + -error: casts cannot be followed by a method call +error: type ascription cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:57:13 | LL | let _ = 0i32: i32: i32.count_ones() as u32 as i32; @@ -187,7 +187,7 @@ LL - let _ = 0i32: i32: i32.count_ones() as u32 as i32; LL + let _ = 0i32: i32.count_ones() as u32 as i32; | -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:62:13 | LL | let _ = 0 @@ -201,7 +201,7 @@ LL ~ let _ = (0 LL ~ as i32) | -error: casts cannot be followed by indexing +error: cast cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:70:18 | LL | let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0]; @@ -212,7 +212,7 @@ help: try surrounding the expression in parentheses LL | let x: i32 = (&vec![1, 2, 3] as &Vec<i32>)[0]; | + + -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:75:5 | LL | 0 as i32.max(0); @@ -223,7 +223,7 @@ help: try surrounding the expression in parentheses LL | (0 as i32).max(0); | + + -error: casts cannot be followed by a method call +error: type ascription cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:77:5 | LL | 0: i32.max(0); @@ -239,7 +239,7 @@ LL - 0: i32.max(0); LL + 0.max(0); | -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:92:8 | LL | if 5u64 as i32.max(0) == 0 { @@ -250,7 +250,7 @@ help: try surrounding the expression in parentheses LL | if (5u64 as i32).max(0) == 0 { | + + -error: casts cannot be followed by a method call +error: type ascription cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:95:8 | LL | if 5u64: u64.max(0) == 0 { @@ -266,7 +266,7 @@ LL - if 5u64: u64.max(0) == 0 { LL + if 5u64.max(0) == 0 { | -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:102:9 | LL | 5u64 as u32.max(0) == 0 @@ -277,7 +277,7 @@ help: try surrounding the expression in parentheses LL | (5u64 as u32).max(0) == 0 | + + -error: casts cannot be followed by a method call +error: type ascription cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:106:9 | LL | 5u64: u64.max(0) == 0 @@ -293,7 +293,7 @@ LL - 5u64: u64.max(0) == 0 LL + 5u64.max(0) == 0 | -error: casts cannot be followed by indexing +error: cast cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:111:24 | LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]); @@ -304,7 +304,7 @@ help: try surrounding the expression in parentheses LL | static bar: &[i32] = &((&[1,2,3] as &[i32])[0..1]); | + + -error: casts cannot be followed by indexing +error: type ascription cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:114:25 | LL | static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); @@ -320,7 +320,7 @@ LL - static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); LL + static bar2: &[i32] = &(&[1i32,2,3][0..1]); | -error: casts cannot be followed by `?` +error: cast cannot be followed by `?` --> $DIR/issue-35813-postfix-after-cast.rs:119:5 | LL | Err(0u64) as Result<u64,u64>?; @@ -331,7 +331,7 @@ help: try surrounding the expression in parentheses LL | (Err(0u64) as Result<u64,u64>)?; | + + -error: casts cannot be followed by `?` +error: type ascription cannot be followed by `?` --> $DIR/issue-35813-postfix-after-cast.rs:121:5 | LL | Err(0u64): Result<u64,u64>?; @@ -347,7 +347,7 @@ LL - Err(0u64): Result<u64,u64>?; LL + Err(0u64)?; | -error: casts cannot be followed by a function call +error: cast cannot be followed by a function call --> $DIR/issue-35813-postfix-after-cast.rs:145:5 | LL | drop as fn(u8)(0); @@ -358,7 +358,7 @@ help: try surrounding the expression in parentheses LL | (drop as fn(u8))(0); | + + -error: casts cannot be followed by a function call +error: type ascription cannot be followed by a function call --> $DIR/issue-35813-postfix-after-cast.rs:147:5 | LL | drop_ptr: fn(u8)(0); @@ -374,7 +374,7 @@ LL - drop_ptr: fn(u8)(0); LL + drop_ptr(0); | -error: casts cannot be followed by `.await` +error: cast cannot be followed by `.await` --> $DIR/issue-35813-postfix-after-cast.rs:152:5 | LL | Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await; @@ -385,7 +385,7 @@ help: try surrounding the expression in parentheses LL | (Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>).await; | + + -error: casts cannot be followed by `.await` +error: type ascription cannot be followed by `.await` --> $DIR/issue-35813-postfix-after-cast.rs:155:5 | LL | Box::pin(noop()): Pin<Box<_>>.await; @@ -401,7 +401,7 @@ LL - Box::pin(noop()): Pin<Box<_>>.await; LL + Box::pin(noop()).await; | -error: casts cannot be followed by a field access +error: cast cannot be followed by a field access --> $DIR/issue-35813-postfix-after-cast.rs:167:5 | LL | Foo::default() as Foo.bar; @@ -412,7 +412,7 @@ help: try surrounding the expression in parentheses LL | (Foo::default() as Foo).bar; | + + -error: casts cannot be followed by a field access +error: type ascription cannot be followed by a field access --> $DIR/issue-35813-postfix-after-cast.rs:169:5 | LL | Foo::default(): Foo.bar; @@ -428,7 +428,7 @@ LL - Foo::default(): Foo.bar; LL + Foo::default().bar; | -error: casts cannot be followed by a method call +error: cast cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:84:9 | LL | if true { 33 } else { 44 } as i32.max(0), @@ -439,7 +439,7 @@ help: try surrounding the expression in parentheses LL | (if true { 33 } else { 44 } as i32).max(0), | + + -error: casts cannot be followed by a method call +error: type ascription cannot be followed by a method call --> $DIR/issue-35813-postfix-after-cast.rs:86:9 | LL | if true { 33 } else { 44 }: i32.max(0) diff --git a/src/test/ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs b/src/test/ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs new file mode 100644 index 00000000000..033dcdfc08d --- /dev/null +++ b/src/test/ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs @@ -0,0 +1,9 @@ +// check-pass + +#![feature(target_feature_11)] + +struct S<T>(T) +where + [T; (|| {}, 1).1]: Copy; + +fn main() {} diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index 45450788b9c..9079a18d6a6 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -1,8 +1,8 @@ error[E0277]: the type `str` cannot be indexed by `{integer}` - --> $DIR/str-idx.rs:3:17 + --> $DIR/str-idx.rs:3:19 | LL | let _: u8 = s[4]; - | ^^^^ string indices are ranges of `usize` + | ^ string indices are ranges of `usize` | = help: the trait `SliceIndex<str>` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` @@ -47,10 +47,10 @@ LL | pub const unsafe fn get_unchecked<I: ~const SliceIndex<str>>(&self, i: | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked` error[E0277]: the type `str` cannot be indexed by `char` - --> $DIR/str-idx.rs:6:17 + --> $DIR/str-idx.rs:6:19 | LL | let _: u8 = s['c']; - | ^^^^^^ string indices are ranges of `usize` + | ^^^ string indices are ranges of `usize` | = help: the trait `SliceIndex<str>` is not implemented for `char` = note: required because of the requirements on the impl of `Index<char>` for `str` diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index 9ae08563027..2d062e56a9b 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -25,10 +25,10 @@ LL | s[1..2] = bot(); = note: the left-hand-side of an assignment must have a statically known size error[E0277]: the type `str` cannot be indexed by `usize` - --> $DIR/str-mut-idx.rs:7:5 + --> $DIR/str-mut-idx.rs:7:7 | LL | s[1usize] = bot(); - | ^^^^^^^^^ string indices are ranges of `usize` + | ^^^^^^ 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` @@ -71,10 +71,10 @@ LL | pub const unsafe fn get_unchecked_mut<I: ~const SliceIndex<str>>( | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked_mut` error[E0277]: the type `str` cannot be indexed by `char` - --> $DIR/str-mut-idx.rs:13:5 + --> $DIR/str-mut-idx.rs:13:7 | LL | s['c']; - | ^^^^^^ string indices are ranges of `usize` + | ^^^ string indices are ranges of `usize` | = help: the trait `SliceIndex<str>` is not implemented for `char` = note: required because of the requirements on the impl of `Index<char>` for `str` diff --git a/src/test/ui/suggestions/pattern-slice-vec.fixed b/src/test/ui/suggestions/pattern-slice-vec.fixed index 447337c39c4..f8144641f3c 100644 --- a/src/test/ui/suggestions/pattern-slice-vec.fixed +++ b/src/test/ui/suggestions/pattern-slice-vec.fixed @@ -24,4 +24,8 @@ fn main() { //~^ ERROR: expected an array or slice _ => {} } + + let [..] = vec![1, 2, 3][..]; + //~^ ERROR: expected an array or slice + //~| HELP: consider slicing here } diff --git a/src/test/ui/suggestions/pattern-slice-vec.rs b/src/test/ui/suggestions/pattern-slice-vec.rs index 1153ca026bb..444687c8578 100644 --- a/src/test/ui/suggestions/pattern-slice-vec.rs +++ b/src/test/ui/suggestions/pattern-slice-vec.rs @@ -24,4 +24,8 @@ fn main() { //~^ ERROR: expected an array or slice _ => {} } + + let [..] = vec![1, 2, 3]; + //~^ ERROR: expected an array or slice + //~| HELP: consider slicing here } diff --git a/src/test/ui/suggestions/pattern-slice-vec.stderr b/src/test/ui/suggestions/pattern-slice-vec.stderr index 403a816ba11..f69e7de971a 100644 --- a/src/test/ui/suggestions/pattern-slice-vec.stderr +++ b/src/test/ui/suggestions/pattern-slice-vec.stderr @@ -31,6 +31,14 @@ LL | LL | [5] => {} | ^^^ pattern cannot match with input type `Vec<_>` -error: aborting due to 4 previous errors +error[E0529]: expected an array or slice, found `Vec<{integer}>` + --> $DIR/pattern-slice-vec.rs:28:9 + | +LL | let [..] = vec![1, 2, 3]; + | ^^^^ ------------- help: consider slicing here: `vec![1, 2, 3][..]` + | | + | pattern cannot match with input type `Vec<{integer}>` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0529`. diff --git a/src/test/ui/suggestions/suggest-dereferencing-index.fixed b/src/test/ui/suggestions/suggest-dereferencing-index.fixed new file mode 100644 index 00000000000..dd4ae4eb14c --- /dev/null +++ b/src/test/ui/suggestions/suggest-dereferencing-index.fixed @@ -0,0 +1,7 @@ +// run-rustfix +#![allow(unused_variables)] + +fn main() { + let i: &usize = &1; + let one_item_please: i32 = [1, 2, 3][*i]; //~ ERROR the type `[{integer}]` cannot be indexed by `&usize` +} diff --git a/src/test/ui/suggestions/suggest-dereferencing-index.rs b/src/test/ui/suggestions/suggest-dereferencing-index.rs new file mode 100644 index 00000000000..82ebacc49f2 --- /dev/null +++ b/src/test/ui/suggestions/suggest-dereferencing-index.rs @@ -0,0 +1,7 @@ +// run-rustfix +#![allow(unused_variables)] + +fn main() { + let i: &usize = &1; + let one_item_please: i32 = [1, 2, 3][i]; //~ ERROR the type `[{integer}]` cannot be indexed by `&usize` +} diff --git a/src/test/ui/suggestions/suggest-dereferencing-index.stderr b/src/test/ui/suggestions/suggest-dereferencing-index.stderr new file mode 100644 index 00000000000..c8b87af7bd8 --- /dev/null +++ b/src/test/ui/suggestions/suggest-dereferencing-index.stderr @@ -0,0 +1,17 @@ +error[E0277]: the type `[{integer}]` cannot be indexed by `&usize` + --> $DIR/suggest-dereferencing-index.rs:6:42 + | +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` + = note: required because of the requirements on the impl of `Index<&usize>` for `[{integer}]` +help: dereference this index + | +LL | let one_item_please: i32 = [1, 2, 3][*i]; + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/type/ascription/issue-54516.fixed b/src/test/ui/type/ascription/issue-54516.fixed index 181637b97bb..f78268894da 100644 --- a/src/test/ui/type/ascription/issue-54516.fixed +++ b/src/test/ui/type/ascription/issue-54516.fixed @@ -3,5 +3,5 @@ use std::collections::BTreeMap; fn main() { println!("{}", std::mem::size_of::<BTreeMap<u32, u32>>()); - //~^ ERROR casts cannot be followed by a function call + //~^ ERROR type ascription cannot be followed by a function call } diff --git a/src/test/ui/type/ascription/issue-54516.rs b/src/test/ui/type/ascription/issue-54516.rs index f09ddd487d8..1f34e6943ba 100644 --- a/src/test/ui/type/ascription/issue-54516.rs +++ b/src/test/ui/type/ascription/issue-54516.rs @@ -3,5 +3,5 @@ use std::collections::BTreeMap; fn main() { println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>()); - //~^ ERROR casts cannot be followed by a function call + //~^ ERROR type ascription cannot be followed by a function call } diff --git a/src/test/ui/type/ascription/issue-54516.stderr b/src/test/ui/type/ascription/issue-54516.stderr index 2c7ff6bdc48..1ab9093e584 100644 --- a/src/test/ui/type/ascription/issue-54516.stderr +++ b/src/test/ui/type/ascription/issue-54516.stderr @@ -1,4 +1,4 @@ -error: casts cannot be followed by a function call +error: type ascription cannot be followed by a function call --> $DIR/issue-54516.rs:5:20 | LL | println!("{}", std::mem:size_of::<BTreeMap<u32, u32>>()); diff --git a/src/test/ui/type/ascription/issue-60933.fixed b/src/test/ui/type/ascription/issue-60933.fixed index ac9f6a07031..3e8be3875b3 100644 --- a/src/test/ui/type/ascription/issue-60933.fixed +++ b/src/test/ui/type/ascription/issue-60933.fixed @@ -1,5 +1,5 @@ // run-rustfix fn main() { let _: usize = std::mem::size_of::<u32>(); - //~^ ERROR casts cannot be followed by a function call + //~^ ERROR type ascription cannot be followed by a function call } diff --git a/src/test/ui/type/ascription/issue-60933.rs b/src/test/ui/type/ascription/issue-60933.rs index cb093735efa..2a4ad7bdc4e 100644 --- a/src/test/ui/type/ascription/issue-60933.rs +++ b/src/test/ui/type/ascription/issue-60933.rs @@ -1,5 +1,5 @@ // run-rustfix fn main() { let _: usize = std::mem:size_of::<u32>(); - //~^ ERROR casts cannot be followed by a function call + //~^ ERROR type ascription cannot be followed by a function call } diff --git a/src/test/ui/type/ascription/issue-60933.stderr b/src/test/ui/type/ascription/issue-60933.stderr index 5c35de88e14..0b7f8edf624 100644 --- a/src/test/ui/type/ascription/issue-60933.stderr +++ b/src/test/ui/type/ascription/issue-60933.stderr @@ -1,4 +1,4 @@ -error: casts cannot be followed by a function call +error: type ascription cannot be followed by a function call --> $DIR/issue-60933.rs:3:20 | LL | let _: usize = std::mem:size_of::<u32>(); diff --git a/src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs b/src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs index 18ded291915..9c3375bf35e 100644 --- a/src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs +++ b/src/tools/clippy/clippy_lints/src/methods/suspicious_map.rs @@ -12,7 +12,8 @@ pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, count_recv: &hi if_chain! { if is_trait_method(cx, count_recv, sym::Iterator); let closure = expr_or_init(cx, map_arg); - if let Some(body_id) = cx.tcx.hir().maybe_body_owned_by(closure.hir_id); + if let Some(def_id) = cx.tcx.hir().opt_local_def_id(closure.hir_id); + if let Some(body_id) = cx.tcx.hir().maybe_body_owned_by(def_id); let closure_body = cx.tcx.hir().body(body_id); if !cx.typeck_results().expr_ty(&closure_body.value).is_unit(); then { diff --git a/src/tools/clippy/clippy_lints/src/utils/author.rs b/src/tools/clippy/clippy_lints/src/utils/author.rs index bbb04c9945a..c0726868f77 100644 --- a/src/tools/clippy/clippy_lints/src/utils/author.rs +++ b/src/tools/clippy/clippy_lints/src/utils/author.rs @@ -138,7 +138,7 @@ impl<'tcx> LateLintPass<'tcx> for Author { fn check_item(cx: &LateContext<'_>, hir_id: HirId) { let hir = cx.tcx.hir(); - if let Some(body_id) = hir.maybe_body_owned_by(hir_id) { + if let Some(body_id) = hir.maybe_body_owned_by(hir_id.expect_owner()) { check_node(cx, hir_id, |v| { v.expr(&v.bind("expr", &hir.body(body_id).value)); }); diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 34a1cdaf1d5..50bb008098d 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -1353,7 +1353,7 @@ pub fn is_integer_const(cx: &LateContext<'_>, e: &Expr<'_>, value: u128) -> bool if is_integer_literal(e, value) { return true; } - let enclosing_body = cx.tcx.hir().local_def_id(cx.tcx.hir().enclosing_body_owner(e.hir_id)); + let enclosing_body = cx.tcx.hir().enclosing_body_owner(e.hir_id); if let Some((Constant::Int(v), _)) = constant(cx, cx.tcx.typeck(enclosing_body), e) { return value == v; } diff --git a/src/tools/rustc-workspace-hack/Cargo.toml b/src/tools/rustc-workspace-hack/Cargo.toml index 22c2d28d9f6..00281bf8f01 100644 --- a/src/tools/rustc-workspace-hack/Cargo.toml +++ b/src/tools/rustc-workspace-hack/Cargo.toml @@ -71,7 +71,7 @@ features = [ ] [dependencies] -bstr = { version = "0.2.13", features = ["default"] } +bstr = { version = "0.2.17", features = ["default"] } byteorder = { version = "1", features = ['default', 'std'] } clap = { version = "3.1.1", features = ["derive", "clap_derive"]} curl-sys = { version = "0.4.13", features = ["http2", "libnghttp2-sys"], optional = true } @@ -79,8 +79,12 @@ crossbeam-utils = { version = "0.8.0", features = ["nightly"] } libc = { version = "0.2.79", features = ["align"] } # Ensure default features of libz-sys, which are disabled in some scenarios. libz-sys = { version = "1.1.2" } + +# looks like the only user of deprecated `use_std` feature is `combine`, so this +# can be removed if/when https://github.com/Marwes/combine/pull/348 be merged and released. +memchr = { version = "2.5", features = ["std", "use_std"] } # same for regex -regex = { version = "1.5.5" } +regex = { version = "1.5.6" } proc-macro2 = { version = "1", features = ["default"] } quote = { version = "1", features = ["default"] } rand_core_0_5 = { package = "rand_core", version = "0.5.1", features = ["getrandom", "alloc", "std"] } |
