Skip to content

Conversation

@coolcatcoder
Copy link

@coolcatcoder coolcatcoder commented Jan 17, 2026

This is for #146922.

It allows checking if a TypeId implements a trait.

(I've never used git from the terminal before, so that was a fun challenge. I hope I did everything correctly.)
(I haven't added any tests yet, I'll do that soon.)
(Zulip.)

@rustbot
Copy link
Collaborator

rustbot commented Jan 17, 2026

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

The reflection data structures are tied exactly to the implementation
in the compiler. Make sure to also adjust rustc_const_eval/src/const_eval/type_info.rs

cc @oli-obk

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. labels Jan 17, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 17, 2026

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@coolcatcoder
Copy link
Author

Also, because this pull request is pretty much just copying and pasting from vtable_for's implementation, should we de-duplicate the code by putting the implementation in one location that both intrinsics can call?

@rust-log-analyzer

This comment has been minimized.

@xonx4l
Copy link
Contributor

xonx4l commented Jan 17, 2026

Also, because this pull request is pretty much just copying and pasting from vtable_for's implementation, should we de-duplicate the code by putting the implementation in one location that both intrinsics can call?

Sure , This way it's easier to maintain.

@rustbot
Copy link
Collaborator

rustbot commented Jan 17, 2026

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@SpriteOvO SpriteOvO added the F-type_info #![feature(type_info)] label Jan 17, 2026
@rustbot

This comment was marked as outdated.

@rustbot rustbot added O-unix Operating system: Unix-like T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jan 17, 2026
@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 17, 2026
@coolcatcoder

This comment was marked as off-topic.

@coolcatcoder

This comment was marked as off-topic.

@coolcatcoder

This comment was marked as off-topic.

@coolcatcoder

This comment was marked as off-topic.

@SpriteOvO

This comment was marked as off-topic.

@coolcatcoder

This comment was marked as off-topic.

@SpriteOvO SpriteOvO force-pushed the type_id_implements_trait branch from f603826 to 2f97f63 Compare January 17, 2026 11:13
@rustbot rustbot removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits PR has merge commits, merge with caution. labels Jan 17, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@SpriteOvO
Copy link
Member

Since #151239 has been merged, this PR is no longer blocked.

@rustbot label -S-blocked

@rustbot rustbot removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Jan 28, 2026
@coolcatcoder coolcatcoder force-pushed the type_id_implements_trait branch from 820765b to f2ee714 Compare January 28, 2026 22:41
@rustbot rustbot added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Jan 28, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2026

⚠️ Warning ⚠️

@rust-log-analyzer

This comment has been minimized.

@coolcatcoder
Copy link
Author

I think I managed to fix my latest failed rebase.
(Rebasing is really difficult... but I'm slowly but surely learning how to do it properly.)

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job pr-check-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
REPOSITORY                                   TAG       IMAGE ID       CREATED      SIZE
ghcr.io/dependabot/dependabot-updater-core   latest    354d02aa29ac   9 days ago   783MB
=> Removing docker images...
Deleted Images:
untagged: ghcr.io/dependabot/dependabot-updater-core:latest
untagged: ghcr.io/dependabot/dependabot-updater-core@sha256:596da3f22bcbdff2c96fd7126001278022c834c1621c5efa2ad1a7794590636c
deleted: sha256:354d02aa29acf525570c732b6e006ecf138de6d63ca525d552eb4b24880ddc6c
deleted: sha256:8b7af0e426bc2cbeeacfd96b8354d3b80016991520977197e62090e47abaede8
deleted: sha256:cadf11ef1de7fdd5eab563757942353684047f09b212dc99d6ed48e8acf34d62
deleted: sha256:569b0caf9d5285db44ccd2629a3470139eea755be423a33a54d8a24cb3926bfa
deleted: sha256:f9dc5feb048d8f9fd43137e3998f59e9acfbd76c47a4e14984d109654119e282
---
[RUSTC-TIMING] object test:false 9.443
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:51:1
   |
51 | windows_targets::link!("kernel32.dll" "system" fn lstrlenW(lpstring : PCWSTR) -> i32);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:50:1
   |
50 | windows_targets::link!("kernel32.dll" "system" fn WideCharToMultiByte(codepage : u32, dwflags : u32, lpwidecharstr : PCWSTR, cchwide...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:49:1
   |
49 | windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObjectEx(hhandle : HANDLE, dwmilliseconds : u32, balertable : BOOL) -...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:48:1
   |
48 | windows_targets::link!("kernel32.dll" "system" fn UnmapViewOfFile(lpbaseaddress : MEMORY_MAPPED_VIEW_ADDRESS) -> BOOL);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:39:1
   |
39 | windows_targets::link!("kernel32.dll" "system" fn RtlCaptureContext(contextrecord : *mut CONTEXT));
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:38:1
   |
38 | windows_targets::link!("kernel32.dll" "system" fn ReleaseMutex(hmutex : HANDLE) -> BOOL);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:37:1
   |
37 | windows_targets::link!("kernel32.dll" "system" fn Module32NextW(hsnapshot : HANDLE, lpme : *mut MODULEENTRY32W) -> BOOL);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:36:1
   |
36 | windows_targets::link!("kernel32.dll" "system" fn Module32FirstW(hsnapshot : HANDLE, lpme : *mut MODULEENTRY32W) -> BOOL);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:35:1
   |
35 | windows_targets::link!("kernel32.dll" "system" fn MapViewOfFile(hfilemappingobject : HANDLE, dwdesiredaccess : FILE_MAP, dwfileoffse...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:34:1
   |
34 | windows_targets::link!("kernel32.dll" "system" fn LoadLibraryA(lplibfilename : PCSTR) -> HMODULE);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:33:1
   |
33 | windows_targets::link!("kernel32.dll" "system" fn GetProcAddress(hmodule : HMODULE, lpprocname : PCSTR) -> FARPROC);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:32:1
   |
32 | windows_targets::link!("kernel32.dll" "system" fn GetCurrentThread() -> HANDLE);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:31:1
   |
31 | windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcessId() -> u32);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:30:1
   |
30 | windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcess() -> HANDLE);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:29:1
   |
29 | windows_targets::link!("kernel32.dll" "system" fn CreateToolhelp32Snapshot(dwflags : CREATE_TOOLHELP_SNAPSHOT_FLAGS, th32processid :...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:28:1
   |
28 | windows_targets::link!("kernel32.dll" "system" fn CreateMutexA(lpmutexattributes : *const SECURITY_ATTRIBUTES, binitialowner : BOOL,...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:27:1
   |
27 | windows_targets::link!("kernel32.dll" "system" fn CreateFileMappingA(hfile : HANDLE, lpfilemappingattributes : *const SECURITY_ATTRI...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:26:1
   |
26 | windows_targets::link!("kernel32.dll" "system" fn CloseHandle(hobject : HANDLE) -> BOOL);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:25:1
   |
25 | windows_targets::link!("dbghelp.dll" "system" fn SymSetSearchPathW(hprocess : HANDLE, searchpatha : PCWSTR) -> BOOL);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:24:1
   |
24 | windows_targets::link!("dbghelp.dll" "system" fn SymSetOptions(symoptions : u32) -> u32);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:23:1
   |
23 | windows_targets::link!("dbghelp.dll" "system" fn SymQueryInlineTrace(hprocess : HANDLE, startaddress : u64, startcontext : u32, star...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:22:1
   |
22 | windows_targets::link!("dbghelp.dll" "system" fn SymInitializeW(hprocess : HANDLE, usersearchpath : PCWSTR, finvadeprocess : BOOL) -...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:21:1
   |
21 | windows_targets::link!("dbghelp.dll" "system" fn SymGetSearchPathW(hprocess : HANDLE, searchpatha : PWSTR, searchpathlength : u32) -...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:20:1
   |
20 | windows_targets::link!("dbghelp.dll" "system" fn SymGetOptions() -> u32);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:19:1
   |
19 | windows_targets::link!("dbghelp.dll" "system" fn SymGetModuleBase64(hprocess : HANDLE, qwaddr : u64) -> u64);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:18:1
   |
18 | windows_targets::link!("dbghelp.dll" "system" fn SymGetLineFromInlineContextW(hprocess : HANDLE, dwaddr : u64, inlinecontext : u32, ...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:17:1
   |
17 | windows_targets::link!("dbghelp.dll" "system" fn SymGetLineFromAddrW64(hprocess : HANDLE, dwaddr : u64, pdwdisplacement : *mut u32, ...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:16:1
   |
16 | windows_targets::link!("dbghelp.dll" "system" fn SymFunctionTableAccess64(hprocess : HANDLE, addrbase : u64) -> *mut core::ffi::c_vo...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:15:1
   |
15 | windows_targets::link!("dbghelp.dll" "system" fn SymFromInlineContextW(hprocess : HANDLE, address : u64, inlinecontext : u32, displa...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:14:1
   |
14 | windows_targets::link!("dbghelp.dll" "system" fn SymFromAddrW(hprocess : HANDLE, address : u64, displacement : *mut u64, symbol : *m...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:13:1
   |
13 | windows_targets::link!("dbghelp.dll" "system" fn SymAddrIncludeInlineTrace(hprocess : HANDLE, address : u64) -> u32);
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:12:1
   |
12 | windows_targets::link!("dbghelp.dll" "system" fn StackWalkEx(machinetype : u32, hprocess : HANDLE, hthread : HANDLE, stackframe : *m...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:11:1
   |
11 | windows_targets::link!("dbghelp.dll" "system" fn StackWalk64(machinetype : u32, hprocess : HANDLE, hthread : HANDLE, stackframe : *m...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `windows_targets`
  --> library/std/src/../../backtrace/src/windows_sys.rs:10:1
   |
10 | windows_targets::link!("dbghelp.dll" "system" fn EnumerateLoadedModulesW64(hprocess : HANDLE, enumloadedmodulescallback : PENUMLOADE...
   | ^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `windows_targets`

error[E0425]: cannot find function, tuple struct or tuple variant `GetCurrentProcess` in this scope
   --> library/std/src/../../backtrace/src/backtrace/win32.rs:100:19
    |
100 |     let process = GetCurrentProcess();
---

error[E0425]: cannot find function, tuple struct or tuple variant `CloseHandle` in this scope
  --> library/std/src/../../backtrace/src/symbolize/gimli/libs_windows.rs:41:9
   |
41 |         CloseHandle(snap);
   |         ^^^^^^^^^^^ not found in this scope
   |
help: consider importing this function through its public re-export
   |
 1 + use crate::sys::c::CloseHandle;
---
...
142 |         fn SymSetSearchPathW(
    |            ^^^^^^^^^^^^^^^^^ not found in `super::windows_sys`

error[E0425]: cannot find value `EnumerateLoadedModulesW64` in module `super::windows_sys`
   --> library/std/src/../../backtrace/src/dbghelp.rs:146:12
    |
 44 |             $($name: usize,)*
    |               ----- due to this macro variable
...
---
...
166 |         fn SymGetModuleBase64(
    |            ^^^^^^^^^^^^^^^^^^ not found in `super::windows_sys`

error[E0425]: cannot find value `SymFromAddrW` in module `super::windows_sys`
   --> library/std/src/../../backtrace/src/dbghelp.rs:170:12
    |
 44 |             $($name: usize,)*
    |               ----- due to this macro variable
...
170 |         fn SymFromAddrW(
    |            ^^^^^^^^^^^^ not found in `super::windows_sys`

error[E0425]: cannot find value `SymGetLineFromAddrW64` in module `super::windows_sys`
   --> library/std/src/../../backtrace/src/dbghelp.rs:176:12
    |
 44 |             $($name: usize,)*
    |               ----- due to this macro variable
...
---

error[E0425]: cannot find function, tuple struct or tuple variant `GetProcAddress` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:102:21
    |
 35 | / macro_rules! dbghelp {
 36 | |     (extern "system" {
 37 | |         $(fn $name:ident($($arg:ident: $argty:ty),*) -> $ret: ty;)*
 38 | |     }) => (
...   |
102 | |                     GetProcAddress(self.dll, symbol.as_ptr()).map(|address|address as usize)
    | |                     ^^^^^^^^^^^^^^ not found in this scope
...   |
126 | | }
    | |_- in this expansion of `dbghelp!`
127 |
128 | / dbghelp! {
129 | |     extern "system" {
130 | |         fn SymGetOptions() -> u32;
131 | |         fn SymSetOptions(options: u32) -> u32;
...   |
223 | | }
    | |_- in this macro invocation
    |
help: consider importing this function through its public re-export
---

error[E0425]: cannot find function, tuple struct or tuple variant `GetCurrentProcess` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:354:38
    |
354 |         (*dbghelp).SymInitializeW()?(GetCurrentProcess(), ptr::null_mut(), TRUE);
    |                                      ^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing this function through its public re-export
    |
 25 + use crate::sys::c::GetCurrentProcess;
---
    |
 25 + use crate::sys::c::GetCurrentProcess;
    |

error[E0425]: cannot find function `lstrlenW` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:375:23
    |
375 |             let len = lstrlenW(search_path_buf.as_mut_ptr());
    |                       ^^^^^^^^ not found in this scope
    |
help: consider importing this function through its public re-export
    |
 25 + use crate::sys::c::lstrlenW;
    |

error[E0425]: cannot find function, tuple struct or tuple variant `GetCurrentProcess` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:389:13
    |
---

error[E0425]: cannot find function, tuple struct or tuple variant `GetCurrentProcess` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:397:41
    |
397 |         (*dbghelp).SymSetSearchPathW()?(GetCurrentProcess(), new_search_path.as_ptr());
    |                                         ^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: consider importing this function through its public re-export
    |
 25 + use crate::sys::c::GetCurrentProcess;
    |

error[E0425]: cannot find function `lstrlenW` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:454:31
    |
454 |     let len: usize = unsafe { lstrlenW(module_name).try_into().unwrap() };
    |                               ^^^^^^^^ not found in this scope
    |
help: consider importing this function through its public re-export
    |
 25 + use crate::sys::c::lstrlenW;
    |

error[E0425]: cannot find function, tuple struct or tuple variant `RtlCaptureContext` in this scope
   --> library/std/src/../../backtrace/src/backtrace/win32.rs:104:5
    |
104 |     RtlCaptureContext(&mut context.0);
    |     ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `CreateFileMappingA` in this scope
  --> library/std/src/../../backtrace/src/symbolize/gimli/mmap_windows.rs:22:27
   |
---
   |
33 |             let ptr = MapViewOfFile(
   |                       ^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `UnmapViewOfFile` in this scope
  --> library/std/src/../../backtrace/src/symbolize/gimli/mmap_windows.rs:63:21
   |
63 |             let r = UnmapViewOfFile(MEMORY_MAPPED_VIEW_ADDRESS { Value: self.ptr });
   |                     ^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `CreateToolhelp32Snapshot` in this scope
  --> library/std/src/../../backtrace/src/symbolize/gimli/libs_windows.rs:21:20
   |
21 |         let snap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0);
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `Module32FirstW` in this scope
  --> library/std/src/../../backtrace/src/symbolize/gimli/libs_windows.rs:29:12
   |
29 |         if Module32FirstW(snap, &mut me) == TRUE {
   |            ^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `Module32NextW` in this scope
  --> library/std/src/../../backtrace/src/symbolize/gimli/libs_windows.rs:35:20
   |
35 |                 if Module32NextW(snap, &mut me) != TRUE {
   |                    ^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `LoadLibraryA` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:67:32
    |
 35 | / macro_rules! dbghelp {
 36 | |     (extern "system" {
 37 | |         $(fn $name:ident($($arg:ident: $argty:ty),*) -> $ret: ty;)*
 38 | |     }) => (
...   |
 67 | |                     self.dll = LoadLibraryA(lib.as_ptr());
    | |                                ^^^^^^^^^^^^ not found in this scope
...   |
126 | | }
    | |_- in this expansion of `dbghelp!`
127 |
128 | / dbghelp! {
129 | |     extern "system" {
130 | |         fn SymGetOptions() -> u32;
131 | |         fn SymSetOptions(options: u32) -> u32;
...   |
223 | | }
    | |_- in this macro invocation

error[E0425]: cannot find function, tuple struct or tuple variant `CreateMutexA` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:294:20
    |
294 |             lock = CreateMutexA(ptr::null_mut(), FALSE, name.as_ptr());
    |                    ^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `WaitForSingleObjectEx` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:305:17
    |
305 |         let r = WaitForSingleObjectEx(lock, INFINITE, FALSE);
    |                 ^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `ReleaseMutex` in this scope
   --> library/std/src/../../backtrace/src/dbghelp.rs:483:21
    |

@9SonSteroids
Copy link

Is there some way we could support #144361 in userland with this?
It would require has_trait to expose the vtable for that TypeId's implementation of the trait, then the fat pointer could be created.

@coolcatcoder
Copy link
Author

coolcatcoder commented Jan 29, 2026

Is there some way we could support #144361 in userland with this? It would require has_trait to expose the vtable for that TypeId's implementation of the trait, then the fat pointer could be created.

That is a fun idea. Having some way of getting from a TypeId (and its corresponding value) to a dyn trait would be very useful.
It would also allow us to iterate across a struct's fields (discovered via reflection) as dyn traits.
I'll play around with that idea locally.

@coolcatcoder
Copy link
Author

I know I need to update the 32 bit dump, but I'm not sure how.
If required I could try get the test running on my gps, but I'm hopeful there is an easier way.

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

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-type_info #![feature(type_info)] 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants