-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug
Description
// from src/tools/miri/tests/pass/issues/issue-23261.rs
// Matching on a DST struct should not trigger an LLVM assertion.
struct Foo<T: ?Sized> {
a: i32,
inner: T,
}
trait Get {
fn get(&self) -> i32;
}
impl Get for i32 {
fn get(&self) -> i32 {
*self
}
}
fn main() {
// boom
let foo: &Foo<[u8]> = &Foo { a: 32, inner: [1, 2, 3] };
// boom
let foo: &Foo<dyn Get> = &Foo { a: 32, inner: 32 };
}edition 2015
ra reports a type mismatch here which rustc doesnt:
rust-analyzer diagnostics .
processing crate: bar, module: /tmp/bar/src/main.rs
Diagnostic { code: RustcHardError("E0308"), message: "expected &Foo<[u8]>, found &Foo<[i32; 3]>", range: FileRange { file_id: FileId(11), range: 336..368 }, severity: Error, unused: false, experimental: true, fixes: None, main_node: None }
Diagnostic { code: RustcHardError("E0308"), message: "expected &Foo<dyn Get>, found &Foo<i32>", range: FileRange { file_id: FileId(11), range: 411..436 }, severity: Error, unused: false, experimental: true, fixes: None, main_node: None }
diagnostic scan complete
Error: diagnostic error detected
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug