rust/compiler/rustc_ast/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
..
attr Rename ModSep to PathSep 2024-04-04 19:44:04 +02:00
expand Generate better function argument names in global_allocator expansion 2023-08-06 07:36:05 -07:00
util Fix contains_exterior_struct_lit 2024-04-02 19:40:18 -04:00
ast_traits.rs Rename ast::StmtKind::Local into ast::StmtKind::Let 2024-03-14 12:42:04 +01:00
ast.rs Use a path instead of an ident (and stop manually resolving) 2024-04-15 16:45:26 -04:00
entry.rs Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
format.rs get auto traits for parallel rustc 2023-08-02 16:21:45 +08:00
lib.rs step cfgs 2024-03-20 08:49:13 -04:00
mut_visit.rs Use a path instead of an ident (and stop manually resolving) 2024-04-15 16:45:26 -04:00
node_id.rs Replace no_ord_impl with orderable. 2023-11-22 18:38:17 +11:00
ptr.rs rustc_ast: Update P<T> docs to reflect mutable status. 2024-04-03 08:41:03 +00:00
token.rs Rollup merge of #123462 - fmease:rn-mod-sep-to-path-sep, r=nnethercote 2024-04-16 01:12:37 +02:00
tokenstream.rs Check x86_64 size assertions on aarch64, too 2024-04-03 16:53:03 +11:00
visit.rs Use a path instead of an ident (and stop manually resolving) 2024-04-15 16:45:26 -04:00