about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/alloc_system.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-03 15:43:06 +0000
committerbors <bors@rust-lang.org>2024-06-03 15:43:06 +0000
commiteb5e2449c5a5215927834d67914ce41cccd3f3c9 (patch)
tree176b96364bf630274f1eb3d65db56865d8bbfa48 /compiler/rustc_codegen_gcc/example/alloc_system.rs
parent8768db9912af2dc70651156bb638b09dc2cec630 (diff)
parenta41c44f21c1a6fd96eb8d68fbdb298610443cff5 (diff)
downloadrust-eb5e2449c5a5215927834d67914ce41cccd3f3c9.tar.gz
rust-eb5e2449c5a5215927834d67914ce41cccd3f3c9.zip
Auto merge of #125864 - compiler-errors:opt-in-error-reporting, r=lcnr
Opt-in to `FulfillmentError` generation to avoid doing extra work in the new solver

In the new solver, we do additional trait solving in order to generate fulfillment errors, because all we have is the root obligation. This is problematic because there are many cases where we don't need the full error information, and instead are just calling `ObligationCtxt::select_all_or_error` to probe whether a predicate holds or not. This is also problematic because we use `ObligationCtxt`s within the error reporting machinery itself, and so we can definitely cause stack overflows:

https://github.com/rust-lang/rust/blob/a94483a5f2bae907bc898fc7a8d9cc87db47b693/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs#L75-L84

So instead, make `TraitEngine` and `ObligationCtxt` generic over `E: FulfillmentErrorLike<'tcx>`, and introduce a new `ScrubbedTraitError` which only stores whether the failure was due to a "true error" or an ambiguity. Then, introduce `ObligationCtxt::new_with_diagnostics` for the callsites that actually inspect their `FulfillmentError`s.

r? `@lcnr`

Number-wise, there are:
```
     39 ObligationCtxt::new
     32 ObligationCtxt::new_with_diagnostics
      1 ObligationCtxt::new_generic
```
calls to each `ObligationCtxt` constructor, which suggests that there are indeed a lot of callsites that don't care about diagnostics.
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/alloc_system.rs')
0 files changed, 0 insertions, 0 deletions