-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pattern types MVP #107606
Pattern types MVP #107606
Changes from all commits
846b80e
e3dd737
d220902
f8c08a3
a9c203d
b055a05
50d50ab
8f37d1f
925e0b6
7bdd60c
ff28254
bd41537
e05cbfe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,9 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>( | |
ty::Alias(..) | ty::Param(_) | ty::Placeholder(_) | ty::Infer(_) => { | ||
throw_inval!(TooGeneric) | ||
} | ||
ty::Pat(..) => { | ||
unimplemented!("pattern types need to calculate pattern from their pattern") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My confusion about this error message remains.^^ Who's asking for a pattern to be computed from anything here? We just want a variant count! What does it even mean to compute a pattern from a pattern? Seems trivial, just use the identity function... |
||
} | ||
ty::Bound(_, _) => bug!("bound ty during ctfe"), | ||
ty::Bool | ||
| ty::Char | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -124,3 +124,8 @@ hir_analysis_linkage_type = | |||||||||||||||||
hir_analysis_auto_deref_reached_recursion_limit = reached the recursion limit while auto-dereferencing `{$ty}` | ||||||||||||||||||
.label = deref recursion limit reached | ||||||||||||||||||
.help = consider increasing the recursion limit by adding a `#![recursion_limit = "{$suggested_limit}"]` attribute to your crate (`{$crate_name}`) | ||||||||||||||||||
|
||||||||||||||||||
hir_analysis_pattern_type_wild_pat = "wildcard patterns are not permitted for pattern types" | ||||||||||||||||||
.label = "this type is the same as the inner type without a pattern" | ||||||||||||||||||
|
||||||||||||||||||
hir_analysis_pattern_type_non_const_range = "range patterns must have constant range start and end" | ||||||||||||||||||
Comment on lines
+128
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -256,7 +256,7 @@ pub struct InferArg { | |||||
} | ||||||
|
||||||
impl InferArg { | ||||||
pub fn to_ty(&self) -> Ty<'_> { | ||||||
pub fn to_ty(&self) -> Ty<'static> { | ||||||
Ty { kind: TyKind::Infer, span: self.span, hir_id: self.hir_id } | ||||||
} | ||||||
} | ||||||
|
@@ -2682,6 +2682,8 @@ pub enum TyKind<'hir> { | |||||
Infer, | ||||||
/// Placeholder for a type that has failed to be defined. | ||||||
Err, | ||||||
/// Pattern types (`u32 as 1..`) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not |
||||||
Pat(&'hir Ty<'hir>, &'hir Pat<'hir>), | ||||||
} | ||||||
|
||||||
#[derive(Debug, HashStable_Generic)] | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is supposed to be "is" or "as", but it seems like "is" is used everywhere else