Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] update to rustc_private 2023-06-10 #4

Closed
wants to merge 1 commit into from

Conversation

jyn514
Copy link

@jyn514 jyn514 commented Jun 30, 2023

current errors:

 1  error[E0432]: unresolved import `rustc_hir::def_id::DefIndexAddressSpace`
  --> src/print.rs:8:52
 2  error[E0603]: module `rmeta` is private
  --> src/driver.rs:5:21
  --> /home/jyn/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_metadata/src/lib.rs:36:1
 3  error[E0603]: module `rmeta` is private
  --> src/print.rs:9:21
  --> /home/jyn/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_metadata/src/lib.rs:36:1
 4  error[E0599]: no method named `crate_data_as_rc_any` found for struct `TyCtxt<'tcx>` in the current scope
   --> src/driver.rs:88:26
 5  error[E0618]: expected function, found `impl for<'b> FnOnce(&'b CrateMetadata)`
   --> src/driver.rs:89:5
 6  error[E0599]: no function or associated item named `from_array_index` found for struct `DefIndex` in the current scope
    --> src/print.rs:312:31

some of these are just because CrateMetadata is private now and its methods are on TyCtxt, but some of them are real - DefIndex has no public constructors anymore and CrateRoot is private to rustc_metadata.

current errors:
```
 1  error[E0432]: unresolved import `rustc_hir::def_id::DefIndexAddressSpace`
  --> src/print.rs:8:52
 2  error[E0603]: module `rmeta` is private
  --> src/driver.rs:5:21
  --> /home/jyn/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_metadata/src/lib.rs:36:1
 3  error[E0603]: module `rmeta` is private
  --> src/print.rs:9:21
  --> /home/jyn/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_metadata/src/lib.rs:36:1
 4  error[E0599]: no method named `crate_data_as_rc_any` found for struct `TyCtxt<'tcx>` in the current scope
   --> src/driver.rs:88:26
 5  error[E0618]: expected function, found `impl for<'b> FnOnce(&'b CrateMetadata)`
   --> src/driver.rs:89:5
 6  error[E0599]: no function or associated item named `from_array_index` found for struct `DefIndex` in the current scope
    --> src/print.rs:312:31
```

some of these are just because `CrateMetadata` is private now and its methods are on TyCtxt, but some of them are real - `DefIndex` has no public constructors anymore and `CrateRoot` is private to `rustc_metadata`.
@jyn514
Copy link
Author

jyn514 commented Jun 30, 2023

i wonder if it makes sense to upstream this to rust-lang/rust as a -Z flag so it stays up to date automatically? then we don't have to worry about things being made private because we can just print them directly from rustc_metadata

@bjorn3
Copy link
Owner

bjorn3 commented Jun 30, 2023

We have a tiny bit of rlib/rust dylib metadata printing code in rustc already behind -Zls. That only lists some basic things in the crate root and the dependencies though. I agree it would be nice to have this project merged into rustc.

$ rustc +nightly -Zls $(rustc +nightly --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-*.rlib
Crate info:
name std-75b9617f92376d41
hash a73f30f7a70203db7d299ba343cdd9c4 stable_crate_id StableCrateId(12114942931081239636)
proc_macro false
=External Dependencies=
1 core-91facdcc9286d01d hash c2fa8d164749227d92a20d0f6849f9c4 host_hash None kind Explicit public
2 compiler_builtins-86f479762cd41464 hash 8fdfdfa465c6b70b32d5ec3b0e5631b5 host_hash None kind Explicit public
3 rustc_std_workspace_core-c8fdd0d8f03b0225 hash 9c13e6a96870e55ebf6db16a637446c8 host_hash None kind Explicit public
4 alloc-7c042ecce9932705 hash defaf503e9b40dc1a3d8bac702eb799d host_hash None kind Explicit public
5 libc-ae318380f963b832 hash 70daa53b94b42e1b28954e286af182de host_hash None kind Explicit public
6 unwind-c941e8f182e10925 hash b02e67483517dde39fc761e2bd7f199c host_hash None kind Explicit public
7 cfg_if-c7fab2ff20d1f2cd hash bc9725f4ee0450033d638d41d4d1c1ee host_hash None kind Explicit public
8 miniz_oxide-0804a6feb3ed38ea hash ff0c3b92b3991d6d7d699961d8c4b18a host_hash None kind Explicit private
9 adler-6772c722dc231412 hash abafc337f69a661c33aa56dd206bf7f6 host_hash None kind Explicit public
10 hashbrown-0a8aa27d5bf1bc44 hash d7f68add7a8de56fb35d0abcc5526b66 host_hash None kind Explicit private
11 rustc_std_workspace_alloc-d75813e4f4f6bafa hash aaf5f3f23e382088ae4d7c5bd142247d host_hash None kind Explicit public
12 std_detect-c6b390a5b2a049a2 hash 50ad83a105965c53db23d70b53eed296 host_hash None kind Explicit private
13 rustc_demangle-1c48511ebb1a200e hash 9b65aefdc185dccdc746271de9b27907 host_hash None kind Explicit private
14 addr2line-b7fbc62efa77abb9 hash 1432fe50d3f028c9884254a5884441d9 host_hash None kind Explicit private
15 gimli-102731a77dbccbc8 hash 5b30965ebc2e1e1c9e873bf8a7e6af50 host_hash None kind Explicit public
16 object-943c5a031ea59756 hash 913dbca21679542784ee2adbceb2a386 host_hash None kind Explicit private
17 memchr-52b0294e28e85f0c hash 07b15c67199f7f040201364e29d1d3a2 host_hash None kind Explicit public
18 panic_unwind-9c9c1db573a7335d hash 08a6f3330c91e20d3238845695a2d101 host_hash None kind Implicit private

@jyn514
Copy link
Author

jyn514 commented Aug 21, 2023

i'm not going to work on this further (nor on making -Zls more useful).

@jyn514 jyn514 closed this Aug 21, 2023
@bjorn3
Copy link
Owner

bjorn3 commented Sep 10, 2023

Opened rust-lang/rust#115735 for adding some things to -Zls. Not a MIR viewer though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants