1
Fork 0
rust/compiler/rustc_builtin_macros/src
Matthias Krüger 55b76f4720
Rollup merge of #125987 - estebank:issue-122622, r=Nadrieril
When `derive`ing, account for HRTB on `BareFn` fields

When given

```rust
trait SomeTrait {
    type SomeType<'a>;
}

#[derive(Clone)]
struct Foo<T: SomeTrait> {
    x: for<'a> fn(T::SomeType<'a>)
}
```

expand to

```rust
impl<T: ::core::clone::Clone + SomeTrait> ::core::clone::Clone for Foo<T>
    where for<'a> T::SomeType<'a>: ::core::clone::Clone {
    #[inline]
    fn clone(&self) -> Foo<T> {
        Foo { x: ::core::clone::Clone::clone(&self.x) }
    }
}
```

instead of the previous invalid

```
impl<T: ::core::clone::Clone + SomeTrait> ::core::clone::Clone for Foo<T>
    where T::SomeType<'a>: ::core::clone::Clone {
    #[inline]
    fn clone(&self) -> Foo<T> {
        Foo { x: ::core::clone::Clone::clone(&self.x) }
    }
}
```

Fix #122622.

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-06-06 04:17:26 +02:00
..
assert Convert some token_joint_hidden calls to token_joint. 2024-05-23 06:03:17 +10:00
deriving When deriveing, account for HRTB on BareFn fields 2024-06-04 20:46:03 +00:00
format_foreign Use as_deref in compiler (but only where it makes sense) 2022-11-16 21:58:58 +00:00
alloc_error_handler.rs Rename Unsafe to Safety 2024-05-17 18:33:37 -03:00
asm.rs Rename buffer_lint_with_diagnostic to buffer_lint 2024-05-21 20:16:39 +00:00
assert.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
cfg.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
cfg_accessible.rs compiler: fix few needless_pass_by_ref_mut clippy lints 2024-03-28 12:04:00 +03:00
cfg_eval.rs Remove stream_to_parser. 2024-06-05 10:37:59 +10:00
cmdline_attrs.rs Make top-level rustc_parse functions fallible. 2024-06-05 10:38:03 +10:00
compile_error.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
concat.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
concat_bytes.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
concat_idents.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
derive.rs Introduce DeriveResolution. 2024-04-26 07:55:21 +10:00
edition_panic.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
env.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
errors.rs Rollup merge of #124391 - nnethercote:builtin_macros-cleanups, r=fee1-dead 2024-04-26 19:25:55 -04:00
format.rs Generate lint diagnostic message from BuiltinLintDiag 2024-05-21 20:16:39 +00:00
format_foreign.rs Fix println! ICE when parsing percent prefix number 2024-05-18 01:05:56 +00:00
global_allocator.rs Rename Unsafe to Safety 2024-05-17 18:33:37 -03:00
lib.rs Remove extern crate tracing from numerous crates. 2024-04-30 16:47:49 +10:00
log_syntax.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
pattern_type.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
proc_macro_harness.rs Rename consuming chaining methods on DiagnosticBuilder. 2024-01-10 07:40:00 +11:00
source_util.rs Make top-level rustc_parse functions fallible. 2024-06-05 10:38:03 +10:00
standard_library_imports.rs Rename all ParseSess variables/fields/lifetimes as psess. 2024-03-05 08:11:45 +11:00
test.rs Rename Unsafe to Safety 2024-05-17 18:33:37 -03:00
test_harness.rs Rename buffer_lint_with_diagnostic to buffer_lint 2024-05-21 20:16:39 +00:00
trace_macros.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
util.rs Rename buffer_lint_with_diagnostic to buffer_lint 2024-05-21 20:16:39 +00:00