]> git.lizzy.rs Git - rust.git/commitdiff
Use more targetted span for error label
authorEsteban Küber <esteban@kuber.com.ar>
Sun, 22 Mar 2020 23:09:42 +0000 (16:09 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Sun, 22 Mar 2020 23:09:42 +0000 (16:09 -0700)
12 files changed:
src/librustc_typeck/check/method/suggest.rs
src/test/ui/associated-const/associated-const-ambiguity-report.stderr
src/test/ui/associated-const/associated-const-private-impl.stderr
src/test/ui/error-codes/E0034.stderr
src/test/ui/issues/issue-21202.stderr
src/test/ui/issues/issue-53498.stderr
src/test/ui/methods/method-ambig-two-traits-from-impls2.stderr
src/test/ui/privacy/privacy1.stderr
src/test/ui/privacy/restricted/test.stderr
src/test/ui/static/static-method-privacy.stderr
src/test/ui/traits/trait-item-privacy.stderr
src/test/ui/xc-private-method.stderr

index f46c43c78dbc599ecc85b9de7fc35405a2cdf81c..68996f5aaf973c68aaa4e6c3c3a3aea357347f3e 100644 (file)
@@ -758,11 +758,11 @@ trait bound{s}",
             MethodError::Ambiguity(sources) => {
                 let mut err = struct_span_err!(
                     self.sess(),
-                    span,
+                    item_name.span,
                     E0034,
                     "multiple applicable items in scope"
                 );
-                err.span_label(span, format!("multiple `{}` found", item_name));
+                err.span_label(item_name.span, format!("multiple `{}` found", item_name));
 
                 report_candidates(span, &mut err, sources, sugg_span);
                 err.emit();
@@ -772,13 +772,13 @@ trait bound{s}",
                 let kind = kind.descr(def_id);
                 let mut err = struct_span_err!(
                     self.tcx.sess,
-                    span,
+                    item_name.span,
                     E0624,
                     "{} `{}` is private",
                     kind,
                     item_name
                 );
-                err.span_label(span, &format!("private {}", kind));
+                err.span_label(item_name.span, &format!("private {}", kind));
                 self.suggest_valid_traits(&mut err, out_of_scope_traits);
                 err.emit();
             }
index 92a8d19021a2c2610564b027dba837792301a229..c5e32afbbce400f9bc44a8dc878f1adb902dd83f 100644 (file)
@@ -1,8 +1,8 @@
 error[E0034]: multiple applicable items in scope
-  --> $DIR/associated-const-ambiguity-report.rs:17:16
+  --> $DIR/associated-const-ambiguity-report.rs:17:23
    |
 LL | const X: i32 = <i32>::ID;
-   |                ^^^^^^^^^ multiple `ID` found
+   |                       ^^ multiple `ID` found
    |
 note: candidate #1 is defined in an impl of the trait `Foo` for the type `i32`
   --> $DIR/associated-const-ambiguity-report.rs:10:5
index 305f41433acb6369f1798f5e740fef5cb2eed655..1b9d7ac7e6c3f2e0d6e5247ca84e8b7bf09ee7b8 100644 (file)
@@ -1,8 +1,8 @@
 error[E0624]: associated constant `ID` is private
-  --> $DIR/associated-const-private-impl.rs:13:19
+  --> $DIR/associated-const-private-impl.rs:13:30
    |
 LL |     assert_eq!(1, bar1::Foo::ID);
-   |                   ^^^^^^^^^^^^^ private associated constant
+   |                              ^^ private associated constant
 
 error: aborting due to previous error
 
index 6db2ef5051d83ab0c32f3ee0734c11a9f5d790b5..7977e529a11a6c140a94b503899af83ff4003dd3 100644 (file)
@@ -1,8 +1,8 @@
 error[E0034]: multiple applicable items in scope
-  --> $DIR/E0034.rs:20:5
+  --> $DIR/E0034.rs:20:11
    |
 LL |     Test::foo()
-   |     ^^^^^^^^^ multiple `foo` found
+   |           ^^^ multiple `foo` found
    |
 note: candidate #1 is defined in an impl of the trait `Trait1` for the type `Test`
   --> $DIR/E0034.rs:12:5
index 421ed0a5a9389f9a6304c0d10e5c459261e7ea1c..9b3b7a72e049eb617948574afc1b56569c564a70 100644 (file)
@@ -1,8 +1,8 @@
 error[E0624]: associated function `foo` is private
-  --> $DIR/issue-21202.rs:10:9
+  --> $DIR/issue-21202.rs:10:14
    |
 LL |         Foo::foo(&f);
-   |         ^^^^^^^^ private associated function
+   |              ^^^ private associated function
 
 error: aborting due to previous error
 
index 973e6c12aa151480c747759cc8f1ea78df3fbe3b..3c0f7f2b55026e6eda83f5b5be03b040d8e69884 100644 (file)
@@ -1,8 +1,8 @@
 error[E0624]: associated function `foo` is private
-  --> $DIR/issue-53498.rs:16:5
+  --> $DIR/issue-53498.rs:16:27
    |
 LL |     test::Foo::<test::B>::foo();
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ private associated function
+   |                           ^^^ private associated function
 
 error: aborting due to previous error
 
index 44f85071505d2c33b594b151b4266ebbe5db083c..249464108875c5b96218435586524d45903fd08d 100644 (file)
@@ -1,8 +1,8 @@
 error[E0034]: multiple applicable items in scope
-  --> $DIR/method-ambig-two-traits-from-impls2.rs:15:5
+  --> $DIR/method-ambig-two-traits-from-impls2.rs:15:9
    |
 LL |     AB::foo();
-   |     ^^^^^^^ multiple `foo` found
+   |         ^^^ multiple `foo` found
    |
 note: candidate #1 is defined in an impl of the trait `A` for the type `AB`
   --> $DIR/method-ambig-two-traits-from-impls2.rs:7:5
index fee6f8d5639f52cfa3565b03e9cad844439c2ed0..65c10a7bca75deba5dc98673354130e2d2d1f361 100644 (file)
@@ -155,28 +155,28 @@ LL |     trait B {
    |     ^^^^^^^
 
 error[E0624]: associated function `bar` is private
-  --> $DIR/privacy1.rs:77:9
+  --> $DIR/privacy1.rs:77:23
    |
 LL |         self::baz::A::bar();
-   |         ^^^^^^^^^^^^^^^^^ private associated function
+   |                       ^^^ private associated function
 
 error[E0624]: associated function `bar` is private
-  --> $DIR/privacy1.rs:95:5
+  --> $DIR/privacy1.rs:95:13
    |
 LL |     bar::A::bar();
-   |     ^^^^^^^^^^^ private associated function
+   |             ^^^ private associated function
 
 error[E0624]: associated function `bar` is private
-  --> $DIR/privacy1.rs:102:9
+  --> $DIR/privacy1.rs:102:19
    |
 LL |         ::bar::A::bar();
-   |         ^^^^^^^^^^^^^ private associated function
+   |                   ^^^ private associated function
 
 error[E0624]: associated function `bar` is private
-  --> $DIR/privacy1.rs:105:9
+  --> $DIR/privacy1.rs:105:24
    |
 LL |         ::bar::baz::A::bar();
-   |         ^^^^^^^^^^^^^^^^^^ private associated function
+   |                        ^^^ private associated function
 
 error[E0624]: associated function `bar2` is private
   --> $DIR/privacy1.rs:108:23
index 5bcccc6d69c4b288c327fc109a39aefad5910855..40512a34bd95991cc0b5d9e3cdd6e74d63082ca2 100644 (file)
@@ -59,10 +59,10 @@ LL |     S::default().f();
    |                  ^ private associated function
 
 error[E0624]: associated function `g` is private
-  --> $DIR/test.rs:33:5
+  --> $DIR/test.rs:33:8
    |
 LL |     S::g();
-   |     ^^^^ private associated function
+   |        ^ private associated function
 
 error[E0616]: field `y` of struct `pub_restricted::Universe` is private
   --> $DIR/test.rs:42:15
index bc35b4067a810b801c9fec5cb72198edfc508322..569608780def99ee4f066f3a31c38009dc97fa1d 100644 (file)
@@ -1,8 +1,8 @@
 error[E0624]: associated function `new` is private
-  --> $DIR/static-method-privacy.rs:9:13
+  --> $DIR/static-method-privacy.rs:9:19
    |
 LL |     let _ = a::S::new();
-   |             ^^^^^^^^^ private associated function
+   |                   ^^^ private associated function
 
 error: aborting due to previous error
 
index f8ffc949b067e080111588697423aa570c2d9038..7fd5c11fcf09049992102ec9a4f31d5750ae6175 100644 (file)
@@ -74,10 +74,10 @@ LL | use method::B;
    |
 
 error[E0624]: associated function `a` is private
-  --> $DIR/trait-item-privacy.rs:84:5
+  --> $DIR/trait-item-privacy.rs:84:8
    |
 LL |     C::a(&S);
-   |     ^^^^ private associated function
+   |        ^ private associated function
 
 error[E0599]: no associated item named `A` found for struct `S` in the current scope
   --> $DIR/trait-item-privacy.rs:97:8
@@ -111,10 +111,10 @@ LL | use assoc_const::B;
    |
 
 error[E0624]: associated constant `A` is private
-  --> $DIR/trait-item-privacy.rs:101:5
+  --> $DIR/trait-item-privacy.rs:101:8
    |
 LL |     C::A;
-   |     ^^^^ private associated constant
+   |        ^ private associated constant
 
 error[E0038]: the trait `assoc_const::C` cannot be made into an object
   --> $DIR/trait-item-privacy.rs:101:5
index 902998cf0c110493552bc3e439ca5a705623b8f1..8b7e43ccc04e90e4f566ede7d44dbebd68e9da48 100644 (file)
@@ -1,14 +1,14 @@
 error[E0624]: associated function `static_meth_struct` is private
-  --> $DIR/xc-private-method.rs:6:13
+  --> $DIR/xc-private-method.rs:6:44
    |
 LL |     let _ = xc_private_method_lib::Struct::static_meth_struct();
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private associated function
+   |                                            ^^^^^^^^^^^^^^^^^^ private associated function
 
 error[E0624]: associated function `static_meth_enum` is private
-  --> $DIR/xc-private-method.rs:9:13
+  --> $DIR/xc-private-method.rs:9:42
    |
 LL |     let _ = xc_private_method_lib::Enum::static_meth_enum();
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ private associated function
+   |                                          ^^^^^^^^^^^^^^^^ private associated function
 
 error: aborting due to 2 previous errors