@@ -66,7 +66,7 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
66
66
fn check_item ( & self , item : & hir:: Item ) {
67
67
let def_id = self . tcx . map . local_def_id ( item. id ) ;
68
68
match item. node {
69
- hir:: ItemImpl ( _, _, _, None , _ , _) => {
69
+ hir:: ItemImpl ( _, _, _, None , ref ty , _) => {
70
70
// For inherent impls, self type must be a nominal type
71
71
// defined in this crate.
72
72
debug ! ( "coherence2::orphan check: inherent impl {}" ,
@@ -209,11 +209,11 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
209
209
return ;
210
210
}
211
211
_ => {
212
- struct_span_err ! ( self . tcx. sess, item . span, E0118 ,
212
+ struct_span_err ! ( self . tcx. sess, ty . span, E0118 ,
213
213
"no base type found for inherent implementation" )
214
- . span_help ( item . span ,
215
- "either implement a trait on it or create a newtype to wrap it \
216
- instead")
214
+ . span_label ( ty . span , & format ! ( "impl requires a base type" ) )
215
+ . note ( & format ! ( "either implement a trait on it or create a newtype \
216
+ to wrap it instead") )
217
217
. emit ( ) ;
218
218
return ;
219
219
}
@@ -228,12 +228,14 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
228
228
match traits:: orphan_check ( self . tcx , def_id) {
229
229
Ok ( ( ) ) => { }
230
230
Err ( traits:: OrphanCheckErr :: NoLocalInputType ) => {
231
- span_err ! (
231
+ struct_span_err ! (
232
232
self . tcx. sess, item. span, E0117 ,
233
- "the impl does not reference any \
234
- types defined in this crate; \
235
- only traits defined in the current crate can be \
236
- implemented for arbitrary types") ;
233
+ "only traits defined in the current crate can be \
234
+ implemented for arbitrary types")
235
+ . span_label ( item. span , & format ! ( "impl doesn't use types inside crate" ) )
236
+ . note ( & format ! ( "the impl does not reference any \
237
+ types defined in this crate") )
238
+ . emit ( ) ;
237
239
return ;
238
240
}
239
241
Err ( traits:: OrphanCheckErr :: UncoveredTy ( param_ty) ) => {
0 commit comments