Address review comments
This commit is contained in:
parent
cf46820694
commit
ae999e9c8f
@ -540,8 +540,10 @@ pub enum PatKind {
|
||||
/// Such pattern can be resolved to a unit struct/variant or a constant.
|
||||
Path(Path),
|
||||
|
||||
/// A path pattern written in qualified form, i.e. `<T as Trait>::CONST` or `<T>::CONST`.
|
||||
/// Such patterns can only refer to associated constants at the moment.
|
||||
/// An associated const named using the qualified path `<T>::CONST` or
|
||||
/// `<T as Trait>::CONST`. Associated consts from inherent impls can be
|
||||
/// referred to as simply `T::CONST`, in which case they will end up as
|
||||
/// PatKind::Path, and the resolver will have to sort that out.
|
||||
QPath(QSelf, Path),
|
||||
|
||||
/// A tuple pattern `(a, b)`.
|
||||
|
@ -1043,11 +1043,6 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
|
||||
PatKind::Struct(..) | PatKind::TupleStruct(..) |
|
||||
PatKind::Path(..) | PatKind::QPath(..) => {
|
||||
match def_map.get(&pat.id).map(|d| d.full_def()) {
|
||||
None => {
|
||||
// no definition found: pat is not a
|
||||
// struct or enum pattern.
|
||||
}
|
||||
|
||||
Some(Def::Variant(enum_did, variant_did)) => {
|
||||
let downcast_cmt =
|
||||
if tcx.lookup_adt_def(enum_did).is_univariant() {
|
||||
@ -1083,7 +1078,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
|
||||
// `matched_pat` call.
|
||||
}
|
||||
|
||||
Some(def) => {
|
||||
def => {
|
||||
// An enum type should never be in a pattern.
|
||||
// Remaining cases are e.g. Def::Fn, to
|
||||
// which identifiers within patterns
|
||||
|
@ -635,8 +635,10 @@ pub enum PatKind {
|
||||
/// Such pattern can be resolved to a unit struct/variant or a constant.
|
||||
Path(Path),
|
||||
|
||||
/// A path pattern written in qualified form, i.e. `<T as Trait>::CONST` or `<T>::CONST`.
|
||||
/// Such patterns can only refer to associated constants at the moment.
|
||||
/// An associated const named using the qualified path `<T>::CONST` or
|
||||
/// `<T as Trait>::CONST`. Associated consts from inherent impls can be
|
||||
/// referred to as simply `T::CONST`, in which case they will end up as
|
||||
/// PatKind::Path, and the resolver will have to sort that out.
|
||||
QPath(QSelf, Path),
|
||||
|
||||
/// A tuple pattern `(a, b)`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user