Skip to content

Commit 4811850

Browse files
committed
---
yaml --- r: 187641 b: refs/heads/tmp c: 0be1e43 h: refs/heads/master i: 187639: 6e4b6b8 v: v3
1 parent 9ed4280 commit 4811850

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 522d09dfecbeca1595f25ac58c6d0178bbd21d7d
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: 40fffc9e3fe1664240683a2e86f2d14827417ef5
37+
refs/heads/tmp: 0be1e430cf8762095178cb8c94a17f1bab32a191
3838
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/tmp/src/librustc_typeck/coherence/orphan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'cx, 'tcx,'v> visit::Visitor<'v> for OrphanChecker<'cx, 'tcx> {
101101
debug!("coherence2::orphan check: default trait impl {}", item.repr(self.tcx));
102102
let trait_ref = ty::node_id_to_trait_ref(self.tcx, ast_trait_ref.ref_id);
103103
if trait_ref.def_id.krate != ast::LOCAL_CRATE {
104-
span_err!(self.tcx.sess, item.span, E0316,
104+
span_err!(self.tcx.sess, item.span, E0318,
105105
"cannot create default implementations for traits outside the \
106106
crate they're defined in; define a new trait instead.");
107107
}

branches/tmp/src/librustc_typeck/coherence/overlap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl<'cx, 'tcx,'v> visit::Visitor<'v> for OverlapChecker<'cx, 'tcx> {
141141
ty::ty_struct(..) | ty::ty_enum(..) => {},
142142
_ => {
143143
let impl_def_id = ast_util::local_def(item.id);
144-
span_err!(self.tcx.sess, self.span_of_impl(impl_def_id), E0317,
144+
span_err!(self.tcx.sess, self.span_of_impl(impl_def_id), E0319,
145145
"implementations for traits providing default \
146146
implementations are only allowed on structs and enums");
147147

branches/tmp/src/librustc_typeck/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ register_diagnostics! {
172172
E0248, // found value name used as a type
173173
E0249, // expected constant expr for array length
174174
E0250, // expected constant expr for array length
175-
E0316, // can't create default impls for traits outside their crates
176-
E0317
175+
E0318, // can't create default impls for traits outside their crates
176+
E0319 // trait impls for defaulted traits allowed just for structs/enums
177177
}
178178

179179
__build_diagnostic_array! { DIAGNOSTICS }
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2015 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+
// Test that when a `..` impl applies, we also check that any
12+
// supertrait conditions are met.
13+
14+
#![feature(optin_builtin_traits)]
15+
16+
trait NotImplemented { }
17+
18+
trait MyTrait : NotImplemented {}
19+
20+
impl MyTrait for .. {}
21+
22+
fn foo<T:MyTrait>() { bar::<T>() }
23+
24+
fn bar<T:NotImplemented>() { }
25+
26+
fn main() {
27+
foo::<i32>(); //~ ERROR XXX
28+
bar::<i32>(); //~ ERROR XXX
29+
}

0 commit comments

Comments
 (0)