cognitive-engineering-lab / rustc_plugin

A framework for writing plugins that integrate with the Rust compiler
MIT License
135 stars 16 forks source link

Guard against race on MIR_BODIES in tests #27

Closed JustusAdam closed 3 months ago

JustusAdam commented 4 months ago

In test cases multiple TyCtxts may be live and assigning the same id's to functions. This can cause a race on the static that persists the MIR bodies.

This PR mitigates this by extending the cache key with the address of the global context, which is unlikely to be assigned twice.