mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 13:23:25 +00:00
Fix a bug where enum variants were not considered properly in type ns resolution
They should be considered just as well as in value ns, for example for struct literals.
This commit is contained in:
parent
248bd511ae
commit
044c831f7f
3 changed files with 81 additions and 29 deletions
|
|
@ -600,6 +600,25 @@ pub mod __private {
|
|||
//- /bar.rs crate:bar deps:foo edition:2018
|
||||
fn bar() {
|
||||
_ = foo::__private::Result::<(), ()>::Ok;
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enum_variant_type_ns() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
enum KvnDeserializerErr<I> {
|
||||
UnexpectedKeyword { found: I, expected: I },
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
let _x: KvnDeserializerErr<()> =
|
||||
KvnDeserializerErr::<()>::UnexpectedKeyword { found: (), expected: () };
|
||||
let _x: KvnDeserializerErr<()> =
|
||||
KvnDeserializerErr::<()>::UnexpectedKeyword::<()> { found: (), expected: () };
|
||||
// ^^^^^^ 💡 error: you can specify generic arguments on either the enum or the variant, but not both
|
||||
}
|
||||
"#,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue