Skip to content

Commit 38c2a73

Browse files
committed
Testing and fixes
1 parent 1c023b3 commit 38c2a73

File tree

6 files changed

+19
-46
lines changed

6 files changed

+19
-46
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,6 @@ impl<'a> Parser<'a> {
12951295
let (name, node, generics) = if self.eat_keyword(keywords::Type) {
12961296
let (generics, TyParam {ident, bounds, default, ..}) =
12971297
self.parse_trait_item_assoc_ty(vec![])?;
1298-
self.expect(&token::Semi)?;
12991298
(ident, TraitItemKind::Type(bounds, default), generics)
13001299
} else if self.is_const_item() {
13011300
self.expect_keyword(keywords::Const)?;
@@ -4464,6 +4463,7 @@ impl<'a> Parser<'a> {
44644463
} else {
44654464
None
44664465
};
4466+
self.expect(&token::Semi)?;
44674467

44684468
Ok((generics, TyParam {
44694469
attrs: preceding_attrs.into(),

src/test/compile-fail/feature-gate-generic_associated_types.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@
1010

1111
use std::ops::Deref;
1212

13-
trait PointerFamily {
13+
trait PointerFamily<U> {
1414
type Pointer<T>: Deref<Target = T>;
15+
type Pointer2<T>: Deref<Target = T> where T: Clone, U: Clone;
16+
}
17+
18+
struct Foo;
19+
impl PointerFamily<u32> for Foo {
20+
type Pointer<usize> = Box<usize>;
21+
type Pointer2<u32> = Box<u32>;
1522
}
1623

1724
fn main() {}

src/test/ui/rfc1598-generic-associated-types/generic_associated_types_equals.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/test/ui/rfc1598-generic-associated-types/generic_associated_types_equals.stderr

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs

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

11-
// compile-flags: -Zparse-only
11+
// compile-flags: -Z parse-only
1212

1313
#![feature(generic_associated_types)]
1414

1515
impl<T> Baz for T where T: Foo {
16+
//FIXME(sunjay): This should parse successfully
1617
type Quux<'a> = <T as Foo>::Bar<'a, 'static>;
1718
}
1819

src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs

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

11-
// compile-flags: -Zparse-only
11+
// compile-flags: -Z parse-only
1212

1313
#![feature(generic_associated_types)]
1414

15+
use std::ops::Deref;
16+
1517
trait Foo {
1618
type Bar<'a>;
1719
type Bar<'a, 'b>;
@@ -20,6 +22,11 @@ trait Foo {
2022
type Bar<'a, 'b, T, U>;
2123
type Bar<'a, 'b, T, U,>;
2224
type Bar<'a, 'b, T: Debug, U,>;
25+
type Bar<'a, 'b, T: Debug, U,>: Debug;
26+
type Bar<'a, 'b, T: Debug, U,>: Deref<Target = T> + Into<U>;
27+
type Bar<'a, 'b, T: Debug, U,> where T: Deref<Target = U>, U: Into<T>;
28+
type Bar<'a, 'b, T: Debug, U,>: Deref<Target = T> + Into<U>
29+
where T: Deref<Target = U>, U: Into<T>;
2330
}
2431

2532
fn main() {}

0 commit comments

Comments
 (0)