rust/compiler/rustc_middle/src
bors 4e1f5d90bc Auto merge of #123468 - compiler-errors:precise-capturing, r=oli-obk
Implement syntax for `impl Trait` to specify its captures explicitly (`feature(precise_capturing)`)

Implements `impl use<'a, 'b, T, U> Sized` syntax that allows users to explicitly list the captured parameters for an opaque, rather than inferring it from the opaque's bounds (or capturing *all* lifetimes under 2024-edition capture rules). This allows us to exclude some implicit captures, so this syntax may be used as a migration strategy for changes due to #117587.

We represent this list of captured params as `PreciseCapturingArg` in AST and HIR, resolving them between `rustc_resolve` and `resolve_bound_vars`. Later on, we validate that the opaques only capture the parameters in this list.

We artificially limit the feature to *require* mentioning all type and const parameters, since we don't currently have support for non-lifetime bivariant generics. This can be relaxed in the future.

We also may need to limit this to require naming *all* lifetime parameters for RPITIT, since GATs have no variance. I have to investigate this. This can also be relaxed in the future.

r? `@oli-obk`

Tracking issue:

- https://github.com/rust-lang/rust/issues/123432
2024-04-16 11:22:35 +00:00
..
dep_graph Use a dyn Debug trait object instead of a closure. 2024-03-27 10:59:18 +00:00
hir Auto merge of #123468 - compiler-errors:precise-capturing, r=oli-obk 2024-04-16 11:22:35 +00:00
hooks Make def_path_hash_to_def_id a hook 2024-03-27 08:20:06 +00:00
infer nits 2024-04-15 16:52:51 -04:00
middle Auto merge of #122972 - beetrees:use-align-type, r=fee1-dead 2024-04-01 03:16:45 +00:00
mir Rollup merge of #123934 - WaffleLapkin:graph-mini-refactor, r=fmease 2024-04-15 16:56:18 +01:00
query Just use type_dependent_def_id to figure out what the method is for an expr 2024-04-15 17:14:59 -04:00
thir Implement mut ref/mut ref mut 2024-03-27 09:53:23 -04:00
traits Stop using PolyTraitRef for closure/coroutine predicates already instantiated w placeholders 2024-04-15 10:32:21 -04:00
ty Rollup merge of #123603 - compiler-errors:no-intrinsic, r=estebank 2024-04-16 01:12:37 +02:00
util remove some ancient debug output, looks unused? 2024-04-13 11:30:48 +03:00
arena.rs Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
error.rs Rename DiagnosticMessage as DiagMessage. 2024-03-05 12:14:49 +11:00
lib.rs step cfgs 2024-03-20 08:49:13 -04:00
lint.rs Guard decorate on when not to skip instead 2024-03-17 15:07:22 +00:00
macros.rs Remove unnecessary braces from span_bug 2024-03-21 11:24:24 -04:00
metadata.rs rustc_metadata: Remove Span from ModChild 2023-04-18 17:25:04 +03:00
tests.rs Remove outdated references to librustc_middle. 2024-01-05 16:34:52 +00:00
thir.rs Rollup merge of #123401 - Zalathar:assert-size-aarch64, r=fmease 2024-04-03 20:17:06 -04:00
values.rs make Representability::Infinite carry ErrorGuaranteed 2024-03-14 20:52:13 +01:00