Skip to content

Commit 6d1debc

Browse files
committed
---
yaml --- r: 274103 b: refs/heads/stable c: d6c9aa8 h: refs/heads/master i: 274101: 9dc6359 274099: e5cf945 274095: 4a13285
1 parent a366b22 commit 6d1debc

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: ceaaa1bc3388e9a198af198729a6a8821ce54ffb
32+
refs/heads/stable: d6c9aa89018e24540ba017c7c77b12fe12fb233d
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc_resolve/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2752,7 +2752,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
27522752
};
27532753
if let Some(path_res) = resolution {
27542754
match path_res.base_def {
2755-
DefVariant(..) | DefStruct(..) | DefConst(..) => {
2755+
DefStruct(..) if path_res.depth == 0 => {
2756+
self.record_def(pattern.id, path_res);
2757+
}
2758+
DefVariant(..) | DefConst(..) => {
27562759
self.record_def(pattern.id, path_res);
27572760
}
27582761
DefStatic(..) => {

branches/stable/src/test/run-pass/associated-const-match-patterns.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// aux-build:empty-struct.rs
12+
1113
#![feature(associated_consts)]
1214

15+
extern crate empty_struct;
16+
use empty_struct::XEmpty2 as XFoo;
17+
1318
struct Foo;
14-
type FooWorkaround = Foo;
1519

1620
enum Bar {
1721
Var1,
@@ -31,6 +35,10 @@ impl HasBar for Foo {
3135
const THEBAR: Bar = Bar::Var1;
3236
}
3337

38+
impl HasBar for XFoo {
39+
const THEBAR: Bar = Bar::Var1;
40+
}
41+
3442
fn main() {
3543
// Inherent impl
3644
assert!(match Bar::Var2 {
@@ -43,7 +51,7 @@ fn main() {
4351
});
4452
// Trait impl
4553
assert!(match Bar::Var1 {
46-
FooWorkaround::THEBAR => true,
54+
Foo::THEBAR => true,
4755
_ => false,
4856
});
4957
assert!(match Bar::Var1 {
@@ -54,4 +62,16 @@ fn main() {
5462
<Foo as HasBar>::THEBAR => true,
5563
_ => false,
5664
});
65+
assert!(match Bar::Var1 {
66+
XFoo::THEBAR => true,
67+
_ => false,
68+
});
69+
assert!(match Bar::Var1 {
70+
<XFoo>::THEBAR => true,
71+
_ => false,
72+
});
73+
assert!(match Bar::Var1 {
74+
<XFoo as HasBar>::THEBAR => true,
75+
_ => false,
76+
});
5777
}

0 commit comments

Comments
 (0)