Skip to content

Move trait prototype - #161457

Draft
zannabianca1997 wants to merge 6 commits into
rust-lang:mainfrom
zannabianca1997:move-trait
Draft

Move trait prototype#161457
zannabianca1997 wants to merge 6 commits into
rust-lang:mainfrom
zannabianca1997:move-trait

Conversation

@zannabianca1997

@zannabianca1997 zannabianca1997 commented Aug 21, 2026

Copy link
Copy Markdown

Finishing the work started by @nia-e in #156018 :

Add a barebones implementation for Move (#149607), pending some diagnostics changes & tests.

TODO

  • next solver currently errors when not enabling feature(move_trait)
  • change printing of trait objects to not show Move
  • change printing of opaque types to not show Move
  • also make sure rustdoc handles move correctly
  • valuable to look into why diesel regresses

r? lcnr

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Aug 21, 2026
@rustbot

rustbot commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @lcnr (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions for more information.

@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr mentioned this pull request Aug 21, 2026
3 tasks
@lcnr lcnr changed the title Move trait prototype Move trait prototype Aug 21, 2026
@zannabianca1997

Copy link
Copy Markdown
Author

A quick ./x.py test tests/ui locally to have a baseline

test result: FAILED. 9 passed; 206 failed; 21862 ignored; 0 measured; 0 filtered out; finished in 1.14s

Oh wow that got done with A LOT of tests
@zannabianca1997

Copy link
Copy Markdown
Author
test result: FAILED. 21801 passed; 32 failed; 244 ignored; 0 measured; 0 filtered out; finished in 168.70s

wow that were a lot of them. looks like the next batch is a bunch of fn that now has fn() + Move

@rust-log-analyzer

This comment has been minimized.

@zannabianca1997

Copy link
Copy Markdown
Author

looking at the errors, there is also a bunch of (dyn + 'static) printing.

Those are all checks going around the trait_alias feature, that created before empty trait object and now creates what are effectively dyn Move, that are being misprinted.

That sure raises a question - can we handle them now? ummm - putting this aside in favour of lower hanging fruits

This is one of the two options, the other being break ABI. I suspect we
can do it, Rust not having a stable one (?)
@zannabianca1997

Copy link
Copy Markdown
Author

@lcnr this last one (520bc2f)

it's better to break the ABI and accept all aymbol mangling containing Move or we have to decide a way to mangle ?Move? I know rust has no stable abi but to put it in all symbols seems a bit too much

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-gcc-core-tests failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling rand_xorshift v0.4.0
[RUSTC-TIMING] rand_core test:false 0.331
[RUSTC-TIMING] rand_xorshift test:false 0.194
[RUSTC-TIMING] rand test:false 0.646
error[E0080]: evaluation panicked: assertion failed: TypeId::of::<Garlic>().trait_info_of::<dyn Blah>().is_some()
    --> library/coretests/tests/mem/trait_info_of.rs:18:9
     |
  18 |         assert!(TypeId::of::<Garlic>().trait_info_of::<dyn Blah>().is_some());
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |         |
     |         evaluation of `mem::trait_info_of::test_implements_trait::{constant#0}` failed here
     |         in this macro invocation
     |
    ::: library/core/src/macros/mod.rs:1738:5
     |
1738 |     macro_rules! assert {
     |     ------------------- in this expansion of `assert!`

note: erroneous constant encountered
  --> library/coretests/tests/mem/trait_info_of.rs:17:5
   |
17 | /     const {
18 | |         assert!(TypeId::of::<Garlic>().trait_info_of::<dyn Blah>().is_some());
19 | |         assert!(TypeId::of::<Garlic>().trait_info_of::<dyn Blah + Send>().is_some());
20 | |         assert!(TypeId::of::<*const Box<Garlic>>().trait_info_of::<dyn Sync>().is_none());
21 | |         assert!(TypeId::of::<u8>().trait_info_of_trait_type_id(TypeId::of::<dyn Blah>()).is_none());
22 | |     }
   | |_____^

error[E0080]: evaluation panicked: called `Option::unwrap()` on a `None` value
  --> library/coretests/tests/mem/trait_info_of.rs:43:13
   |
43 | /             TypeId::of::<Garlic>()
44 | |             .trait_info_of_trait_type_id(TypeId::of::<dyn Blah>())
45 | |             .unwrap()
   | |_____________________^ evaluation of `mem::trait_info_of::test_dyn_creation::{constant#1}` failed here

note: erroneous constant encountered
  --> library/coretests/tests/mem/trait_info_of.rs:42:9
   |
42 | /         const {
43 | |             TypeId::of::<Garlic>()
44 | |             .trait_info_of_trait_type_id(TypeId::of::<dyn Blah>())
45 | |             .unwrap()
46 | |         }.get_vtable(),
   | |_________^

[RUSTC-TIMING] corebenches test:true 55.869
[RUSTC-TIMING] coretests test:true 62.663
rustc exited with signal: 6 (SIGABRT) (core dumped)
error: could not compile `coretests` (test "coretests") due to 2 previous errors

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name coretests --edition=2024 library/coretests/tests/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 --warn=unexpected_cfgs --check-cfg 'cfg(target_has_reliable_f16)' --check-cfg 'cfg(target_has_reliable_f16_math)' --check-cfg 'cfg(target_has_reliable_f128)' --check-cfg 'cfg(target_has_reliable_f128_math)' -Cembed-bitcode=yes -Zunstable-options -Cforce-frame-pointers=non-leaf -C overflow-checks=on --test --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=c627e5cfc765553f -C extra-filename=-b9e20869992ba8b8 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/coretests/b9e20869992ba8b8/out --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/coretests/8f29888f1cdfcd7b/out -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/rand/9ef107f21862446d/out -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/rand_core/5f10a21fc93cb74a/out -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/rand_xorshift/7f8f09963ff821c9/out -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/dist/build/coretests/b9e20869992ba8b8/out --extern coretests=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/coretests/8f29888f1cdfcd7b/out/libcoretests-8f29888f1cdfcd7b.rlib --extern coretests=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/coretests/8f29888f1cdfcd7b/out/libcoretests-8f29888f1cdfcd7b.rmeta --extern rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/rand/9ef107f21862446d/out/librand-9ef107f21862446d.rlib --extern rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/rand/9ef107f21862446d/out/librand-9ef107f21862446d.rmeta --extern rand_xorshift=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/rand_xorshift/7f8f09963ff821c9/out/librand_xorshift-7f8f09963ff821c9.rlib --extern rand_xorshift=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/rand_xorshift/7f8f09963ff821c9/out/librand_xorshift-7f8f09963ff821c9.rmeta -Zannotate-moves '--check-cfg=cfg(feature,values(any()))' -Zunstable-options -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Cpanic=abort -Zpanic-abort-tests -Z binary-dep-depinfo` (exit status: 254)
Bootstrap failed while executing `--stage 1 test library/coretests`
Currently active steps:
test::Crate { build_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, mode: Std, crates: ["coretests"] } at src/bootstrap/src/core/build_steps/test.rs:3518
Build completed unsuccessfully in 0:12:39
  local time: Sat Aug 22 18:26:50 UTC 2026

Important

For more information how to resolve CI failures of this job, visit this link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants