Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Address review comments
  • Loading branch information
petrochenkov committed May 28, 2016
1 parent cf46820 commit ae999e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/librustc/hir/mod.rs
Expand Up @@ -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)`.
Expand Down
7 changes: 1 addition & 6 deletions src/librustc/middle/expr_use_visitor.rs
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/libsyntax/ast.rs
Expand Up @@ -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)`.
Expand Down

0 comments on commit ae999e9

Please sign in to comment.