Closed
Description
Given the following code:
// run-pass
#![allow(dead_code)]
#![allow(unused_variables)]
#![feature(unsize, coerce_unsized)]
#[repr(packed)]
struct UnalignedPtr<'a, T: ?Sized>
where T: 'a,
{
data: &'a T,
}
fn main() {
impl<'a, T, U> std::ops::CoerceUnsized<UnalignedPtr<'a, U>> for UnalignedPtr<'a, T>
where
T: std::marker::Unsize<U> + ?Sized,
U: ?Sized,
{ }
let arr = [1, 2, 3];
let arr_unaligned: UnalignedPtr<[i32; 3]> = UnalignedPtr { data: &arr };
let arr_unaligned: UnalignedPtr<[i32]> = arr_unaligned;
}
The current output is:
warning: outlives requirements can be inferred
--> src/main.rs:8:11
|
8 | where T: 'a,
| ^^^^^ help: remove this bound
|
= note: requested on the command line with `-W explicit-outlives-requirements`
Rustfix will fail to apply this:
The following errors were reported:
error: expected `{` after struct name, found `,`
--> src/main.rs:8:11
|
8 | where ,
| ^ expected `{` after struct name
error: aborting due to previous error
So we need to extend span to include the where:
as well?
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsDiagnostics: A structured suggestion resulting in incorrect code.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.