diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-13 18:25:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-13 18:25:46 +0200 |
| commit | b0e323549a50620010afe20496aea2a4975511fb (patch) | |
| tree | 2aad73091caafd284552fe4fde491f491d0fa27f /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp | |
| parent | c5e0f9ae42f62ae45e64f51ad4a36736a4d4f17c (diff) | |
| parent | bde1f4dd57abd8e86dd7d7b325640558c4437d1f (diff) | |
| download | rust-b0e323549a50620010afe20496aea2a4975511fb.tar.gz rust-b0e323549a50620010afe20496aea2a4975511fb.zip | |
Rollup merge of #130299 - vetleras:add_set_dcx, r=compiler-errors
Add set_dcx to ParseSess After [this](https://github.com/rust-lang/rust/pull/126623) PR was merged, it is no longer possible to inject one's own `Emitter` in the way [described in the Compiler Development Guide](https://rustc-dev-guide.rust-lang.org/rustc-driver-getting-diagnostics.html). The reason is that the `dcx` field in `ParseSess` is no longer public, so it is not possible to update the `dcx` field with a `DiagCtxt` that contains one's own `Emitter` in the `psess_created` callback in `rustc_interface::Config`. The only way I have found to insert my own `DiagCtxt` is by creating an entirely new `ParseSess` and replacing the old one. This is not a good solution as the original `ParseSess` contains fields I would like to keep. (In my case the problem is that I lose the `cfg` and `check-cfg` fields of the original.) The solution proposed in this PR is to add a `set_dcx` method to `ParseSess`. Per my limited understanding of the rustc codebase this should be fine as `set_dcx` requires a mutable reference to `ParseSess`, which is as far as I know only available in the `psess_created` callback (outside of `rustc_interface::run_compiler`). If this PR is accepted, I will create a new PR to update the aforementioned example in the Compiler Development Guide.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
