Skip to content

Commit 6c8251d

Browse files
committed
resolve where clauses in types in impls
1 parent 8785e34 commit 6c8251d

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

src/librustc_resolve/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,15 +2525,15 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
25252525

25262526
visit::walk_impl_item(this, impl_item);
25272527
}
2528-
ImplItemKind::Type(ref ty) => {
2528+
ImplItemKind::Type(..) => {
25292529
// If this is a trait impl, ensure the type
25302530
// exists in trait
25312531
this.check_trait_item(impl_item.ident,
25322532
TypeNS,
25332533
impl_item.span,
25342534
|n, s| TypeNotMemberOfTrait(n, s));
25352535

2536-
this.visit_ty(ty);
2536+
visit::walk_impl_item(this, impl_item);
25372537
}
25382538
ImplItemKind::Existential(ref bounds) => {
25392539
// If this is a trait impl, ensure the type

src/librustc_typeck/astconv.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use std::slice;
3030
use require_c_abi_if_variadic;
3131
use util::common::ErrorReported;
3232
use util::nodemap::{FxHashSet, FxHashMap};
33-
use errors::{FatalError, DiagnosticId};
33+
use errors::DiagnosticId;
3434
use lint;
3535

3636
use std::iter;
@@ -693,9 +693,6 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
693693
match path.def {
694694
Def::Trait(trait_def_id) => trait_def_id,
695695
Def::TraitAlias(alias_def_id) => alias_def_id,
696-
Def::Err => {
697-
FatalError.raise();
698-
}
699696
_ => unreachable!(),
700697
}
701698
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Regression test for #47206: ensure that impls which have where
12+
// clauses don't silently fail.
13+
//
14+
// compile-pass
15+
16+
#![feature(generic_associated_types)]
17+
//~^ WARNING the feature `generic_associated_types` is incomplete
18+
19+
trait Foo {
20+
type Out;
21+
}
22+
23+
impl<T> Foo for Box<T> {
24+
type Out where T: Clone = T;
25+
}
26+
27+
fn main() {}

0 commit comments

Comments
 (0)