Skip to content

Commit e4999da

Browse files
committed
---
yaml --- r: 187629 b: refs/heads/tmp c: ad3e748 h: refs/heads/master i: 187627: 3dff9bf v: v3
1 parent 6e4fa92 commit e4999da

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
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: 839a9de8d385a082b571a88ff5a7f0c620afed1c
37+
refs/heads/tmp: ad3e748128dc52d55820acc07aa034f61f90006d
3838
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ impl<'cx, 'tcx,'v> visit::Visitor<'v> for OrphanChecker<'cx, 'tcx> {
9696
}
9797
}
9898
}
99+
ast::ItemDefTrait(_, ref ast_trait_ref) => {
100+
// "Trait" impl
101+
debug!("coherence2::orphan check: default trait impl {}", item.repr(self.tcx));
102+
let trait_ref = ty::node_id_to_trait_ref(self.tcx, ast_trait_ref.ref_id);
103+
if trait_ref.def_id.krate != ast::LOCAL_CRATE {
104+
span_err!(self.tcx.sess, item.span, E0316,
105+
"cannot create default implementations for traits outside the \
106+
crate they're defined in; define a new trait instead.");
107+
}
108+
}
99109
_ => {
100110
// Not an impl
101111
}

branches/tmp/src/librustc_typeck/diagnostics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ register_diagnostics! {
171171
E0247, // found module name used as a type
172172
E0248, // found value name used as a type
173173
E0249, // expected constant expr for array length
174-
E0250 // expected constant expr for array length
174+
E0250, // expected constant expr for array length
175+
E0316 // can't create default impls for traits outside their crates
175176
}
176177

177178
__build_diagnostic_array! { DIAGNOSTICS }

0 commit comments

Comments
 (0)