Skip to content

Commit 29caa4a

Browse files
committed
---
yaml --- r: 192959 b: refs/heads/beta c: ad3e748 h: refs/heads/master i: 192957: 2769b1f 192955: 90b6328 192951: 5818286 192943: 9aaccab 192927: f72795b 192895: c9afc3c v: v3
1 parent f910dd4 commit 29caa4a

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
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 839a9de8d385a082b571a88ff5a7f0c620afed1c
34+
refs/heads/beta: ad3e748128dc52d55820acc07aa034f61f90006d
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/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/beta/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)