diff options
| author | Gary Guo <gary@garyguo.net> | 2026-10-06 17:29:32 +0200 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2026-10-07 12:52:27 +0200 |
| commit | da2b9009d445efb826a9eb535c4d62129fee6b35 (patch) | |
| tree | 88069d11a11a8f6ed404cacbbc7a2a4f8e8004e4 /tools/lib/python | |
| parent | 70ff1ccded06372e80acb5a67b710c3e979e3f4b (diff) | |
| download | linux-next-da2b9009d445efb826a9eb535c4d62129fee6b35.tar.gz linux-next-da2b9009d445efb826a9eb535c4d62129fee6b35.zip | |
rust: pin-init: internal: init: set span location of guards
Set the span location of the guards to point to the identifier. The
generated diagnostic is still not ideal, as ideally it points the place
where the identifier is used rather than the identifier name in
initializer, but is still an improvement to status quo.
Before the change:
error[E0505]: cannot move out of value because it is borrowed
--> tests/ui/compile-fail/init/accessor_lifetime.rs:8:13
|
8 | let _ = init!(Foo {
| _____________^
9 | | x: 0,
10 | | _: {
11 | | let _: &'static usize = x;
| | -------------- type annotation requires that borrow lasts for `'static`
12 | | },
13 | | });
| | ^
| | |
| |______move out of value occurs here
| borrow of value occurs here
After the change:
error[E0505]: cannot move out of value because it is borrowed
--> tests/ui/compile-fail/init/accessor_lifetime.rs:9:9
|
9 | x: 0,
| ^
| |
| move out of value occurs here
| borrow of value occurs here
10 | _: {
11 | let _: &'static usize = x;
| -------------- type annotation requires that borrow lasts for `'static`
Acked-by: Benno Lossin <lossin@kernel.org>
Link: https://patch.msgid.link/20261006-dev-selfref-dep-v1-2-da716f740d6d@garyguo.net
Signed-off-by: Gary Guo <gary@garyguo.net>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
