rust/tests/ui-fulldeps
bors 7120fdac7a Auto merge of #126963 - runtimeverification:smir_serde_derive, r=celinval
Add basic Serde serialization capabilities to Stable MIR

This PR adds basic Serde serialization capabilities to Stable MIR. It is intentionally minimal (just wrapping all stable MIR types with a Serde `derive`), so that any important design decisions can be discussed before going further. A simple test is included with this PR to validate that JSON can actually be emitted.

## Notes

When I wrapped the Stable MIR error types in `compiler/stable_mir/src/error.rs`, it caused test failures (though I'm not sure why) so I backed those out.

## Future Work

So, this PR will support serializing basic stable MIR, but it _does not_ support serializing interned values beneath `Ty`s and `AllocId`s, etc... My current thinking about how to handle this is as follows:

1.  Add new `visited_X` fields to the `Tables` struct for each interned category of interest.

2.  As serialization is occuring, serialize interned values as usual _and_ also record the interned value we referenced in `visited_X`.

    (Possibly) In addition, if an interned value recursively references other interned values, record those interned values as well.

3.  Teach the stable MIR `Context` how to access the `visited_X` values and expose them with wrappers in `stable_mir/src/lib.rs` to users (e.g. to serialize and/or further analyze them).

### Pros

This approach does not commit to any specific serialization format regarding interned values or other more complex cases, which avoids us locking into any behaviors that may not be desired long-term.

### Cons

The user will need to manually handle serializing interned values.

### Alternatives

1.  We can directly provide access to the underlying `Tables` maps for interned values; the disadvantage of this approach is that it either requires extra processing for users to filter out to only use the values that they need _or_ users may serialize extra values that they don't need. The advantage is that the implementation is even simpler. The other pros/cons are similar to the above.

2.  We can directly serialize interned values by expanding them in-place. The pro is that this may make some basic inputs easier to consume. However, the cons are that there will need to be special provisions for dealing with cyclical values on both the producer and consumer _and_ global values will possibly need to be de-duplicated on the consumer side.
2024-07-25 20:27:51 +00:00
..
auxiliary Port tests/run-make-fulldeps/obtain-borrowck to ui-fulldeps 2024-06-07 00:41:31 +10:00
codegen-backend Port tests/run-make-fulldeps/hotplug_codegen_backend to ui-fulldeps 2024-06-07 22:28:00 +10:00
fluent-messages Always use a colon in //@ normalize-*: headers 2024-07-11 12:23:44 +10:00
internal-lints Add internal lint for detecting non-glob imports of rustc_type_ir::inherent 2024-07-18 13:03:26 +02:00
mod_dir_simple [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
session-diagnostic Do not use question as label 2024-07-24 21:03:27 +00:00
stable-mir Auto merge of #126963 - runtimeverification:smir_serde_derive, r=celinval 2024-07-25 20:27:51 +00:00
compiler-calls.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
deriving-global.rs Improve dead code analysis 2024-07-04 22:05:00 +08:00
deriving-hygiene.rs Improve dead code analysis 2024-07-04 22:05:00 +08:00
dropck_tarena_sound_drop.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
dropck-tarena-cycle-checked.rs Remove ignore-stage1 that was added when changing error count msg 2024-01-06 12:53:06 +01:00
dropck-tarena-cycle-checked.stderr Remove ignore-stage1 that was added when changing error count msg 2024-01-06 12:53:06 +01:00
dropck-tarena-unsound-drop.rs Remove ignore-stage1 that was added when changing error count msg 2024-01-06 12:53:06 +01:00
dropck-tarena-unsound-drop.stderr Remove ignore-stage1 that was added when changing error count msg 2024-01-06 12:53:06 +01:00
empty-struct-braces-derive.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
hash-stable-is-unstable.rs Run some ui-fulldeps tests on stage 1 again 2024-03-03 18:41:25 +01:00
hash-stable-is-unstable.stderr Run some ui-fulldeps tests on stage 1 again 2024-03-03 18:41:25 +01:00
lint-pass-macros.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
missing-rustc-driver-error.rs Always use a colon in //@ normalize-*: headers 2024-07-11 12:23:44 +10:00
missing-rustc-driver-error.stderr Don't depend on crate names in tests/ui-fulldeps/missing-rustc-driver-error.rs 2023-07-11 22:30:28 -05:00
mod_dir_path_canonicalized.rs Make top-level rustc_parse functions fallible. 2024-06-05 10:38:03 +10:00
obtain-borrowck.rs Port tests/run-make-fulldeps/obtain-borrowck to ui-fulldeps 2024-06-07 00:41:31 +10:00
obtain-borrowck.run.stdout Port tests/run-make-fulldeps/obtain-borrowck to ui-fulldeps 2024-06-07 00:41:31 +10:00
pathless-extern-unstable.rs Run some ui-fulldeps tests on stage 1 again 2024-03-03 18:41:25 +01:00
pathless-extern-unstable.stderr Run some ui-fulldeps tests on stage 1 again 2024-03-03 18:41:25 +01:00
pprust-expr-roundtrip.rs Always pass the visitor as the first argument to walk* functions 2024-07-22 14:01:24 +00:00
regions-mock-tcx.rs Use the rustc_private libc less in tests 2024-04-15 08:54:11 -04:00
run-compiler-twice.rs Move codegen_and_build_linker from Queries to Linker 2024-07-01 11:00:49 +00:00
rustc_encodable_hygiene.rs [AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00