Skip to content

Commit acb0ecc

Browse files
committed
rust-analyzer: use in-tree pattern_analysis crate
1 parent 19469cb commit acb0ecc

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ impl<'db> MatchCheckCtx<'db> {
307307
&Str(void) => match void {},
308308
Wildcard | NonExhaustive | Hidden | PrivateUninhabited => PatKind::Wild,
309309
Never => PatKind::Never,
310-
Missing | F32Range(..) | F64Range(..) | Opaque(..) | Or => {
310+
Missing | F16Range(..) | F32Range(..) | F64Range(..) | F128Range(..) | Opaque(..)
311+
| Or => {
311312
never!("can't convert to pattern: {:?}", pat.ctor());
312313
PatKind::Wild
313314
}
@@ -356,8 +357,9 @@ impl<'db> PatCx for MatchCheckCtx<'db> {
356357
},
357358
Ref => 1,
358359
Slice(..) => unimplemented!(),
359-
Never | Bool(..) | IntRange(..) | F32Range(..) | F64Range(..) | Str(..)
360-
| Opaque(..) | NonExhaustive | PrivateUninhabited | Hidden | Missing | Wildcard => 0,
360+
Never | Bool(..) | IntRange(..) | F16Range(..) | F32Range(..) | F64Range(..)
361+
| F128Range(..) | Str(..) | Opaque(..) | NonExhaustive | PrivateUninhabited
362+
| Hidden | Missing | Wildcard => 0,
361363
Or => {
362364
never!("The `Or` constructor doesn't have a fixed arity");
363365
0
@@ -419,8 +421,9 @@ impl<'db> PatCx for MatchCheckCtx<'db> {
419421
}
420422
},
421423
Slice(_) => unreachable!("Found a `Slice` constructor in match checking"),
422-
Never | Bool(..) | IntRange(..) | F32Range(..) | F64Range(..) | Str(..)
423-
| Opaque(..) | NonExhaustive | PrivateUninhabited | Hidden | Missing | Wildcard => {
424+
Never | Bool(..) | IntRange(..) | F16Range(..) | F32Range(..) | F64Range(..)
425+
| F128Range(..) | Str(..) | Opaque(..) | NonExhaustive | PrivateUninhabited
426+
| Hidden | Missing | Wildcard => {
424427
smallvec![]
425428
}
426429
Or => {

src/tools/rust-analyzer/crates/hir-ty/src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ extern crate rustc_abi;
1515
#[cfg(not(feature = "in-rust-tree"))]
1616
extern crate ra_ap_rustc_abi as rustc_abi;
1717

18-
// Use the crates.io version unconditionally until the API settles enough that we can switch to
19-
// using the in-tree one.
18+
#[cfg(feature = "in-rust-tree")]
19+
extern crate rustc_pattern_analysis;
20+
21+
#[cfg(not(feature = "in-rust-tree"))]
2022
extern crate ra_ap_rustc_pattern_analysis as rustc_pattern_analysis;
2123

2224
mod builder;

0 commit comments

Comments
 (0)