@@ -207,7 +207,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
207
207
let custom_note = report_on_unimplemented ( infcx, & trait_ref. 0 ,
208
208
obligation. cause . span ) ;
209
209
if let Some ( s) = custom_note {
210
- infcx. tcx . sess . span_note ( obligation. cause . span , & s) ;
210
+ infcx. tcx . sess . fileline_note ( obligation. cause . span , & s) ;
211
211
}
212
212
note_obligation_cause ( infcx, obligation) ;
213
213
}
@@ -305,29 +305,29 @@ pub fn report_object_safety_error<'tcx>(tcx: &ty::ctxt<'tcx>,
305
305
for violation in object_safety_violations ( tcx, trait_def_id) {
306
306
match violation {
307
307
ObjectSafetyViolation :: SizedSelf => {
308
- tcx. sess . span_note (
308
+ tcx. sess . fileline_note (
309
309
span,
310
310
"the trait cannot require that `Self : Sized`" ) ;
311
311
}
312
312
313
313
ObjectSafetyViolation :: SupertraitSelf => {
314
- tcx. sess . span_note (
314
+ tcx. sess . fileline_note (
315
315
span,
316
316
"the trait cannot use `Self` as a type parameter \
317
317
in the supertrait listing") ;
318
318
}
319
319
320
320
ObjectSafetyViolation :: Method ( method,
321
321
MethodViolationCode :: StaticMethod ) => {
322
- tcx. sess . span_note (
322
+ tcx. sess . fileline_note (
323
323
span,
324
324
& format ! ( "method `{}` has no receiver" ,
325
325
method. name) ) ;
326
326
}
327
327
328
328
ObjectSafetyViolation :: Method ( method,
329
329
MethodViolationCode :: ReferencesSelf ) => {
330
- tcx. sess . span_note (
330
+ tcx. sess . fileline_note (
331
331
span,
332
332
& format ! ( "method `{}` references the `Self` type \
333
333
in its arguments or return type",
@@ -336,7 +336,7 @@ pub fn report_object_safety_error<'tcx>(tcx: &ty::ctxt<'tcx>,
336
336
337
337
ObjectSafetyViolation :: Method ( method,
338
338
MethodViolationCode :: Generic ) => {
339
- tcx. sess . span_note (
339
+ tcx. sess . fileline_note (
340
340
span,
341
341
& format ! ( "method `{}` has generic type parameters" ,
342
342
method. name) ) ;
@@ -458,111 +458,117 @@ fn note_obligation_cause_code<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
458
458
note_obligation_cause_code ( infcx, predicate, cause_span, subcode) ;
459
459
}
460
460
ObligationCauseCode :: SliceOrArrayElem => {
461
- tcx. sess . span_note (
461
+ tcx. sess . fileline_note (
462
462
cause_span,
463
463
& format ! ( "slice and array elements must have `Sized` type" ) ) ;
464
464
}
465
465
ObligationCauseCode :: ProjectionWf ( data) => {
466
- tcx. sess . span_note (
466
+ tcx. sess . fileline_note (
467
467
cause_span,
468
468
& format ! ( "required so that the projection `{}` is well-formed" ,
469
469
data) ) ;
470
470
}
471
471
ObligationCauseCode :: ReferenceOutlivesReferent ( ref_ty) => {
472
- tcx. sess . span_note (
472
+ tcx. sess . fileline_note (
473
473
cause_span,
474
474
& format ! ( "required so that reference `{}` does not outlive its referent" ,
475
475
ref_ty) ) ;
476
476
}
477
477
ObligationCauseCode :: ItemObligation ( item_def_id) => {
478
478
let item_name = tcx. item_path_str ( item_def_id) ;
479
- tcx. sess . span_note (
479
+ tcx. sess . fileline_note (
480
480
cause_span,
481
481
& format ! ( "required by `{}`" , item_name) ) ;
482
482
}
483
483
ObligationCauseCode :: ObjectCastObligation ( object_ty) => {
484
- tcx. sess . span_note (
484
+ tcx. sess . fileline_note (
485
485
cause_span,
486
486
& format ! (
487
487
"required for the cast to the object type `{}`" ,
488
488
infcx. ty_to_string( object_ty) ) ) ;
489
489
}
490
490
ObligationCauseCode :: RepeatVec => {
491
- tcx. sess . span_note (
491
+ tcx. sess . fileline_note (
492
492
cause_span,
493
493
"the `Copy` trait is required because the \
494
494
repeated element will be copied") ;
495
495
}
496
496
ObligationCauseCode :: VariableType ( _) => {
497
- tcx. sess . span_note (
497
+ tcx. sess . fileline_note (
498
498
cause_span,
499
499
"all local variables must have a statically known size" ) ;
500
500
}
501
501
ObligationCauseCode :: ReturnType => {
502
- tcx. sess . span_note (
502
+ tcx. sess . fileline_note (
503
503
cause_span,
504
504
"the return type of a function must have a \
505
505
statically known size") ;
506
506
}
507
507
ObligationCauseCode :: AssignmentLhsSized => {
508
- tcx. sess . span_note (
508
+ tcx. sess . fileline_note (
509
509
cause_span,
510
510
"the left-hand-side of an assignment must have a statically known size" ) ;
511
511
}
512
512
ObligationCauseCode :: StructInitializerSized => {
513
- tcx. sess . span_note (
513
+ tcx. sess . fileline_note (
514
514
cause_span,
515
515
"structs must have a statically known size to be initialized" ) ;
516
516
}
517
- ObligationCauseCode :: ClosureCapture ( var_id, closure_span , builtin_bound) => {
517
+ ObligationCauseCode :: ClosureCapture ( var_id, _ , builtin_bound) => {
518
518
let def_id = tcx. lang_items . from_builtin_kind ( builtin_bound) . unwrap ( ) ;
519
519
let trait_name = tcx. item_path_str ( def_id) ;
520
520
let name = tcx. local_var_name_str ( var_id) ;
521
- span_note ! ( tcx. sess, closure_span,
522
- "the closure that captures `{}` requires that all captured variables \
523
- implement the trait `{}`",
524
- name,
525
- trait_name) ;
521
+ tcx. sess . fileline_note (
522
+ cause_span,
523
+ & format ! ( "the closure that captures `{}` requires that all captured variables \
524
+ implement the trait `{}`",
525
+ name,
526
+ trait_name) ) ;
526
527
}
527
528
ObligationCauseCode :: FieldSized => {
528
- span_note ! ( tcx. sess, cause_span,
529
- "only the last field of a struct or enum variant \
530
- may have a dynamically sized type")
529
+ tcx. sess . fileline_note (
530
+ cause_span,
531
+ "only the last field of a struct or enum variant \
532
+ may have a dynamically sized type") ;
531
533
}
532
534
ObligationCauseCode :: SharedStatic => {
533
- span_note ! ( tcx. sess, cause_span,
534
- "shared static variables must have a type that implements `Sync`" ) ;
535
+ tcx. sess . fileline_note (
536
+ cause_span,
537
+ "shared static variables must have a type that implements `Sync`" ) ;
535
538
}
536
539
ObligationCauseCode :: BuiltinDerivedObligation ( ref data) => {
537
540
let parent_trait_ref = infcx. resolve_type_vars_if_possible ( & data. parent_trait_ref ) ;
538
- span_note ! ( tcx. sess, cause_span,
539
- "required because it appears within the type `{}`" ,
540
- parent_trait_ref. 0 . self_ty( ) ) ;
541
+ tcx. sess . fileline_note (
542
+ cause_span,
543
+ & format ! ( "required because it appears within the type `{}`" ,
544
+ parent_trait_ref. 0 . self_ty( ) ) ) ;
541
545
let parent_predicate = parent_trait_ref. to_predicate ( ) ;
542
546
note_obligation_cause_code ( infcx, & parent_predicate, cause_span, & * data. parent_code ) ;
543
547
}
544
548
ObligationCauseCode :: ImplDerivedObligation ( ref data) => {
545
549
let parent_trait_ref = infcx. resolve_type_vars_if_possible ( & data. parent_trait_ref ) ;
546
- span_note ! ( tcx. sess, cause_span,
547
- "required because of the requirements on the impl of `{}` for `{}`" ,
548
- parent_trait_ref,
549
- parent_trait_ref. 0 . self_ty( ) ) ;
550
+ tcx. sess . fileline_note (
551
+ cause_span,
552
+ & format ! ( "required because of the requirements on the impl of `{}` for `{}`" ,
553
+ parent_trait_ref,
554
+ parent_trait_ref. 0 . self_ty( ) ) ) ;
550
555
let parent_predicate = parent_trait_ref. to_predicate ( ) ;
551
556
note_obligation_cause_code ( infcx, & parent_predicate, cause_span, & * data. parent_code ) ;
552
557
}
553
558
ObligationCauseCode :: CompareImplMethodObligation => {
554
- span_note ! ( tcx. sess, cause_span,
555
- "the requirement `{}` appears on the impl method \
556
- but not on the corresponding trait method",
557
- predicate) ;
559
+ tcx. sess . fileline_note (
560
+ cause_span,
561
+ & format ! ( "the requirement `{}` appears on the impl method \
562
+ but not on the corresponding trait method",
563
+ predicate) ) ;
558
564
}
559
565
}
560
566
}
561
567
562
- pub fn suggest_new_overflow_limit ( tcx : & ty:: ctxt , span : Span ) {
568
+ fn suggest_new_overflow_limit ( tcx : & ty:: ctxt , span : Span ) {
563
569
let current_limit = tcx. sess . recursion_limit . get ( ) ;
564
570
let suggested_limit = current_limit * 2 ;
565
- tcx. sess . span_note (
571
+ tcx. sess . fileline_note (
566
572
span,
567
573
& format ! (
568
574
"consider adding a `#![recursion_limit=\" {}\" ]` attribute to your crate" ,
0 commit comments