about summary refs log tree commit diff
path: root/src/librustc/traits
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-08-24 14:44:43 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-08-31 00:14:23 -0700
commit444bc3ca6607f7bdeb088b34db23c01e056900b1 (patch)
tree343a1c1c7a089fef85c62c8cc7400062b48463cd /src/librustc/traits
parent2d851b33181b1404856cb1d8b20d261adda54ffb (diff)
downloadrust-444bc3ca6607f7bdeb088b34db23c01e056900b1.tar.gz
rust-444bc3ca6607f7bdeb088b34db23c01e056900b1.zip
Use span label instead of note for cause in E0631
Diffstat (limited to 'src/librustc/traits')
-rw-r--r--src/librustc/traits/error_reporting.rs37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index 93742c83be4..aa0fcafbb0e 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -657,19 +657,22 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
                             span,
                             E0277,
                             "{}",
-                            message.unwrap_or_else(||
-                                format!("the trait bound `{}` is not satisfied{}",
-                                        trait_ref.to_predicate(), post_message)
-                            ));
+                            message.unwrap_or_else(|| format!(
+                                "the trait bound `{}` is not satisfied{}",
+                                trait_ref.to_predicate(),
+                                post_message,
+                            )));
 
                         let explanation =
                             if obligation.cause.code == ObligationCauseCode::MainFunctionType {
                                 "consider using `()`, or a `Result`".to_owned()
                             } else {
-                                format!("{}the trait `{}` is not implemented for `{}`",
+                                format!(
+                                    "{}the trait `{}` is not implemented for `{}`",
                                         pre_message,
                                         trait_ref,
-                                        trait_ref.self_ty())
+                                    trait_ref.self_ty(),
+                                )
                             };
 
                         if let Some(ref s) = label {
@@ -1535,17 +1538,23 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
                 err.note("only the last element of a tuple may have a dynamically sized type");
             }
             ObligationCauseCode::ProjectionWf(data) => {
-                err.note(&format!("required so that the projection `{}` is well-formed",
-                                  data));
+                err.note(&format!(
+                    "required so that the projection `{}` is well-formed",
+                    data,
+                ));
             }
             ObligationCauseCode::ReferenceOutlivesReferent(ref_ty) => {
-                err.note(&format!("required so that reference `{}` does not outlive its referent",
-                                  ref_ty));
+                err.note(&format!(
+                    "required so that reference `{}` does not outlive its referent",
+                    ref_ty,
+                ));
             }
             ObligationCauseCode::ObjectTypeBound(object_ty, region) => {
-                err.note(&format!("required so that the lifetime bound of `{}` for `{}` \
-                                   is satisfied",
-                                  region, object_ty));
+                err.note(&format!(
+                    "required so that the lifetime bound of `{}` for `{}` is satisfied",
+                    region,
+                    object_ty,
+                ));
             }
             ObligationCauseCode::ItemObligation(item_def_id) => {
                 let item_name = tcx.def_path_str(item_def_id);
@@ -1553,7 +1562,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
 
                 if let Some(sp) = tcx.hir().span_if_local(item_def_id) {
                     let sp = tcx.sess.source_map().def_span(sp);
-                    err.span_note(sp, &msg);
+                    err.span_label(sp, &msg);
                 } else {
                     err.note(&msg);
                 }