rust/compiler/rustc_borrowck/src
Matthias Krüger 40c972e335
Rollup merge of #122733 - oli-obk:error_prop, r=compiler-errors
Strip placeholders from hidden types before remapping generic parameter

When remapping generic parameters in the hidden type to the generic parameters of the definition of the opaque, we assume that placeholders cannot exist. Instead of just patching that site, I decided to handle it earlier, directly in `infer_opaque_types`, where we are already doing all the careful lifetime handling.

fixes #122694

the reason that ICE now occurred was that we stopped treating `operation` as being in the defining scope, so the TAIT became part of the hidden type of the `async fn`'s opaque type instead of just bailing out as ambiguos

I think

```rust
use std::future::Future;

mod foo {
    type FutNothing<'a> = impl 'a + Future<Output = ()>;
    //~^ ERROR: unconstrained opaque type
}

async fn operation(_: &mut ()) -> () {
    //~^ ERROR: concrete type differs from previous
    call(operation).await
    //~^ ERROR: concrete type differs from previous
}

async fn call<F>(_f: F)
where
    for<'any> F: FnMut(&'any mut ()) -> foo::FutNothing<'any>,
{
    //~^ ERROR: expected generic lifetime parameter, found `'any`
}
```

would have already had the same ICE before https://github.com/rust-lang/rust/pull/121796
2024-03-21 17:46:49 +01:00
..
constraints Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
diagnostics Split item bounds and item super predicates 2024-03-20 13:00:34 -04:00
polonius Implement asm goto in MIR and MIR lowering 2024-02-24 18:50:09 +00:00
region_infer Strip placeholders from hidden types before remapping generic parameter in the hidden type to the generic parameters of the definition of the opaque 2024-03-21 08:17:12 +00:00
type_check Only split by-ref/by-move futures for async closures 2024-03-19 16:59:23 -04:00
util Move some utils out of rustc_const_eval 2023-04-16 12:05:54 +02:00
borrow_set.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
borrowck_errors.rs Rename DiagnosticBuilder as Diag. 2024-02-28 08:55:35 +11:00
consumers.rs Make DefiningAnchor::Bind only store the opaque types that may be constrained, instead of the current infcx root item. 2024-03-11 17:19:37 +00:00
dataflow.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
def_use.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
facts.rs Move trait into attr so it's greppable 2024-02-16 15:07:37 +00:00
lib.rs Auto merge of #122055 - compiler-errors:stabilize-atb, r=oli-obk 2024-03-19 00:04:09 +00:00
location.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
member_constraints.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
nll.rs Avoid a span_delayed_bug in compute_regions. 2024-02-27 16:40:13 +11:00
path_utils.rs remove a bunch of dead parameters in fn 2024-02-12 09:51:35 +08:00
place_ext.rs Move trait into attr so it's greppable 2024-02-16 15:07:37 +00:00
places_conflict.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
prefixes.rs cleanup prefixes iterator 2024-03-13 12:34:58 -07:00
renumber.rs Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
session_diagnostics.rs Prevent opaque types being instantiated twice with different regions within the same function 2024-03-18 10:26:10 +00:00
universal_regions.rs Rename DiagnosticBuilder as Diag. 2024-02-28 08:55:35 +11:00
used_muts.rs Bump indexmap 2024-02-13 21:03:34 +00:00