Skip to content

Commit fcbbf45

Browse files
committed
---
yaml --- r: 187207 b: refs/heads/try c: ad3e748 h: refs/heads/master i: 187205: 887a9fd 187203: 32a3cf7 187199: 00aba5a v: v3
1 parent d4385b5 commit fcbbf45

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
@@ -2,7 +2,7 @@
22
refs/heads/master: b4c965ee803a4521d8b4575f634e036f93e408f3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: 839a9de8d385a082b571a88ff5a7f0c620afed1c
5+
refs/heads/try: ad3e748128dc52d55820acc07aa034f61f90006d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

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