rust/tests
bors 35d55b34bf Auto merge of #145807 - zachs18:only-consider-auto-traits-empty, r=compiler-errors
When determining if a trait has no entries for the purposes of omitting vptrs from subtrait vtables, consider its transitive supertraits' entries, instead of just its own entries.

When determining if a non-first supertrait vptr can be omitted from a subtrait vtable, check if the supertrait or any of its (transitive) supertraits have methods, instead of only checking if the supertrait itself has methods.

This fixes the soundness issue where a vptr would be omitted for a supertrait with no methods but that itself had a supertrait with methods, while still optimizing the case where the supertrait is "truly" empty (it has no own vtable entries, and none of its (transitive) supertraits have any own vtable entries).

Fixes <https://github.com/rust-lang/rust/issues/145752>

-----

Old description:

~~Treat all non-auto traits as non-empty (possibly having methods) for purposes of determining if we need to emit a vptr for a non-direct supertrait (and for new "sibling" entries after a direct or non-direct supertrait).~~

This fixes (I believe) the soundness issue, ~~but regresses vtable sizes and possibly upcasting perf in some cases when using trait hierarchies with empty non-auto traits (see `tests/ui/traits/vtable/multiple-markers.stderr`) since we use vptrs in some cases where we could re-use the vtable.~~

Fixes <https://github.com/rust-lang/rust/issues/145752>

Re-opens (not anymore) <https://github.com/rust-lang/rust/issues/114942>

Should not affect <https://github.com/rust-lang/rust/issues/131813> (i.e. the soundness issue is still fixed, ~~though the relevant vtables in the `trait Evil` example will be larger now~~)

cc implementation history <https://github.com/rust-lang/rust/pull/131864> <https://github.com/rust-lang/rust/pull/113856>

-----

~~It should be possible to check if a trait has any methods from itself *or* supertraits (instead of just from itself), but to fix the immediate soundness issue, just assume any non-auto trait could have methods. A more optimistic check can be implemented later (or if someone does it soon it could just supercede this PR 😄).~~ Done in latest push

`@rustbot` label A-dyn-trait F-trait_upcasting
2025-08-28 16:49:32 +00:00
..
assembly-llvm Rollup merge of #145382 - winstonallo:reg-struct-return-asm-test, r=tgross35 2025-08-27 21:51:52 -04:00
auxiliary Set NumRegisterParameters LLVM module flag to N when -Zregparm=N is 2025-08-13 17:37:30 +02:00
codegen-llvm Use captures(address) instead of captures(none) for indirect args 2025-08-26 16:16:23 +02:00
codegen-units Auto merge of #142893 - Mark-Simulacrum:no-const-collect, r=oli-obk 2025-06-27 12:57:05 +00:00
coverage coverage: Remove all unstable support for MC/DC instrumentation 2025-08-06 22:38:52 +10:00
coverage-run-rustdoc
crashes Changes to the uitests 2025-08-27 20:25:18 +02:00
debuginfo Rollup merge of #145745 - heiher:ignore-basic-stepping, r=lqd 2025-08-22 22:00:58 -04:00
incremental Bless incremental tests. 2025-07-13 13:50:01 +00:00
mir-opt Use -Zmir-opt-level=0 in tests for MIR building 2025-08-26 23:42:38 -04:00
pretty Update autodiff tests for the new intrinsics impl 2025-08-14 18:33:43 +00:00
run-make Update tests/run-make/rustdoc-default-output/ output 2025-08-23 12:15:37 +02:00
rustdoc Auto merge of #137229 - GuillaumeGomez:expand-macro, r=lolbinarycat 2025-08-24 19:46:17 +00:00
rustdoc-gui Auto merge of #137229 - GuillaumeGomez:expand-macro, r=lolbinarycat 2025-08-24 19:46:17 +00:00
rustdoc-js rustdoc: add tests for raw pointers in type-based search 2025-08-21 17:50:12 -05:00
rustdoc-js-std tests/rustdoc-js-std/parser-errors.js: remove syntax that is now valid 2025-08-21 20:50:33 -05:00
rustdoc-json rustdoc-json: Move #[macro_export] from Other to it's own variant 2025-07-30 19:57:32 +00:00
rustdoc-ui Rollup merge of #145535 - lolbinarycat:rustdoc-invalid_html_tags-svg-145529, r=GuillaumeGomez 2025-08-26 14:19:16 +10:00
ui Auto merge of #145807 - zachs18:only-consider-auto-traits-empty, r=compiler-errors 2025-08-28 16:49:32 +00:00
ui-fulldeps On E0277, point at type that doesn't implement bound 2025-08-22 17:55:15 +00:00
COMPILER_TESTS.md