let item_name = tcx.def_path_str(item_def_id);
let msg = format!("required by this bound in `{}`", item_name);
if let Some(ident) = tcx.opt_item_name(item_def_id) {
- let sm = self.tcx.sess.source_map();
+ let sm = tcx.sess.source_map();
let same_line =
match (sm.lookup_line(ident.span.hi()), sm.lookup_line(span.lo())) {
(Ok(l), Ok(r)) => l.line == r.line,
_ => true,
};
if !ident.span.overlaps(span) && !same_line {
- err.span_label(ident.span, "");
+ err.span_label(ident.span, "required by a bound in this");
}
}
if span != DUMMY_SP {
--> $DIR/bad-bounds-on-assoc-in-trait.rs:31:6
|
LL | trait Case1 {
- | -----
+ | ----- required by a bound in this
...
LL | Debug
| ----- required by this bound in `Case1`
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
LL | trait Case1 {
- | -----
+ | ----- required by a bound in this
LL | type C: Clone + Iterator<Item:
LL | Send + Iterator<Item:
| ---- required by this bound in `Case1`
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
LL | trait Case1 {
- | -----
+ | ----- required by a bound in this
...
LL | > + Sync>;
| ---- required by this bound in `Case1`
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
LL | trait Case1 {
- | -----
+ | ----- required by a bound in this
...
LL | Debug
| ----- required by this bound in `Case1`
--> $DIR/associated-types-eq-hr.rs:82:5
|
LL | fn foo<T>()
- | ---
+ | --- required by a bound in this
LL | where T : for<'x> TheTrait<&'x isize, A = &'x isize>
| ------------- required by this bound in `foo`
...
--> $DIR/associated-types-eq-hr.rs:86:5
|
LL | fn bar<T>()
- | ---
+ | --- required by a bound in this
LL | where T : for<'x> TheTrait<&'x isize, A = &'x usize>
| ------------- required by this bound in `bar`
...
--> $DIR/associated-types-eq-hr.rs:91:17
|
LL | fn tuple_one<T>()
- | ---------
+ | --------- required by a bound in this
LL | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>
| ---------------------------------------------------------- required by this bound in `tuple_one`
...
--> $DIR/associated-types-eq-hr.rs:91:5
|
LL | fn tuple_one<T>()
- | ---------
+ | --------- required by a bound in this
LL | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>
| ------------- required by this bound in `tuple_one`
...
--> $DIR/associated-types-eq-hr.rs:97:17
|
LL | fn tuple_two<T>()
- | ---------
+ | --------- required by a bound in this
LL | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>
| ---------------------------------------------------------- required by this bound in `tuple_two`
...
--> $DIR/associated-types-eq-hr.rs:97:5
|
LL | fn tuple_two<T>()
- | ---------
+ | --------- required by a bound in this
LL | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>
| ------------- required by this bound in `tuple_two`
...
--> $DIR/associated-types-eq-hr.rs:107:18
|
LL | fn tuple_four<T>()
- | ----------
+ | ---------- required by a bound in this
LL | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize)>
| ------------------------------------------- required by this bound in `tuple_four`
...
--> $DIR/defaults-unsound-62211-1.rs:41:9
|
LL | trait UncheckedCopy: Sized {
- | -------------
+ | ------------- required by a bound in this
...
LL | + Display = Self;
| ------- required by this bound in `UncheckedCopy`
--> $DIR/defaults-unsound-62211-1.rs:41:9
|
LL | trait UncheckedCopy: Sized {
- | -------------
+ | ------------- required by a bound in this
...
LL | + Deref<Target = str>
| ------------------- required by this bound in `UncheckedCopy`
--> $DIR/defaults-unsound-62211-1.rs:41:9
|
LL | trait UncheckedCopy: Sized {
- | -------------
+ | ------------- required by a bound in this
...
LL | + AddAssign<&'static str>
| ----------------------- required by this bound in `UncheckedCopy`
--> $DIR/defaults-unsound-62211-1.rs:41:9
|
LL | trait UncheckedCopy: Sized {
- | -------------
+ | ------------- required by a bound in this
...
LL | type Output: Copy
| ---- required by this bound in `UncheckedCopy`
--> $DIR/defaults-unsound-62211-2.rs:41:9
|
LL | trait UncheckedCopy: Sized {
- | -------------
+ | ------------- required by a bound in this
...
LL | + Display = Self;
| ------- required by this bound in `UncheckedCopy`
--> $DIR/defaults-unsound-62211-2.rs:41:9
|
LL | trait UncheckedCopy: Sized {
- | -------------
+ | ------------- required by a bound in this
...
LL | + Deref<Target = str>
| ------------------- required by this bound in `UncheckedCopy`
--> $DIR/defaults-unsound-62211-2.rs:41:9
|
LL | trait UncheckedCopy: Sized {
- | -------------
+ | ------------- required by a bound in this
...
LL | + AddAssign<&'static str>
| ----------------------- required by this bound in `UncheckedCopy`
--> $DIR/defaults-unsound-62211-2.rs:41:9
|
LL | trait UncheckedCopy: Sized {
- | -------------
+ | ------------- required by a bound in this
...
LL | type Output: Copy
| ---- required by this bound in `UncheckedCopy`
--> $DIR/higher-ranked-projection.rs:25:5
|
LL | fn foo<U, T>(_t: T)
- | ---
+ | --- required by a bound in this
LL | where for<'a> &'a T: Mirror<Image=U>
| ------- required by this bound in `foo`
...
--> $DIR/issue-43924.rs:10:6
|
LL | trait Foo<T: Default + ToString> {
- | ---
+ | --- required by a bound in this
LL | type Out: Default + ToString + ?Sized = dyn ToString;
| ------- required by this bound in `Foo`
...
--> $DIR/issue-43924.rs:11:6
|
LL | trait Foo<T: Default + ToString> {
- | ---
+ | --- required by a bound in this
LL | type Out: Default + ToString + ?Sized = dyn ToString;
| ------- required by this bound in `Foo`
...
--> $DIR/issue-65774-1.rs:16:6
|
LL | trait MPU {
- | ---
+ | --- required by a bound in this
LL | type MpuConfig: MyDisplay = T;
| --------- required by this bound in `MPU`
...
--> $DIR/issue-65774-2.rs:16:6
|
LL | trait MPU {
- | ---
+ | --- required by a bound in this
LL | type MpuConfig: MyDisplay = T;
| --------- required by this bound in `MPU`
...
--> $DIR/point-at-type-on-obligation-failure-2.rs:8:18
|
LL | trait Foo {
- | ---
+ | --- required by a bound in this
LL | type Assoc: Bar;
| --- required by this bound in `Foo`
...
--> $DIR/expect-fn-supply-fn.rs:30:5
|
LL | fn with_closure_expecting_fn_with_free_region<F>(_: F)
- | ------------------------------------------
+ | ------------------------------------------ required by a bound in this
LL | where F: for<'a> FnOnce(fn(&'a u32), &i32)
| ------------------------- required by this bound in `with_closure_expecting_fn_with_free_region`
...
--> $DIR/expect-fn-supply-fn.rs:37:5
|
LL | fn with_closure_expecting_fn_with_bound_region<F>(_: F)
- | -------------------------------------------
+ | ------------------------------------------- required by a bound in this
LL | where F: FnOnce(fn(&u32), &i32)
| ---------------------- required by this bound in `with_closure_expecting_fn_with_bound_region`
...
--> $DIR/expect-fn-supply-fn.rs:46:5
|
LL | fn with_closure_expecting_fn_with_bound_region<F>(_: F)
- | -------------------------------------------
+ | ------------------------------------------- required by a bound in this
LL | where F: FnOnce(fn(&u32), &i32)
| ---------------------- required by this bound in `with_closure_expecting_fn_with_bound_region`
...
--> $DIR/expect-fn-supply-fn.rs:30:5
|
LL | fn with_closure_expecting_fn_with_free_region<F>(_: F)
- | ------------------------------------------
+ | ------------------------------------------ required by a bound in this
LL | where F: for<'a> FnOnce(fn(&'a u32), &i32)
| ------------------------- required by this bound in `with_closure_expecting_fn_with_free_region`
...
--> $DIR/expect-fn-supply-fn.rs:37:5
|
LL | fn with_closure_expecting_fn_with_bound_region<F>(_: F)
- | -------------------------------------------
+ | ------------------------------------------- required by a bound in this
LL | where F: FnOnce(fn(&u32), &i32)
| ---------------------- required by this bound in `with_closure_expecting_fn_with_bound_region`
...
--> $DIR/expect-fn-supply-fn.rs:46:5
|
LL | fn with_closure_expecting_fn_with_bound_region<F>(_: F)
- | -------------------------------------------
+ | ------------------------------------------- required by a bound in this
LL | where F: FnOnce(fn(&u32), &i32)
| ---------------------- required by this bound in `with_closure_expecting_fn_with_bound_region`
...
--> $DIR/expect-infer-var-appearing-twice.rs:14:5
|
LL | fn with_closure<F, A>(_: F)
- | ------------
+ | ------------ required by a bound in this
LL | where F: FnOnce(A, A)
| ------------ required by this bound in `with_closure`
...
--> $DIR/generator-yielding-or-returning-itself.rs:15:5
|
LL | pub fn want_cyclic_generator_return<T>(_: T)
- | ----------------------------
+ | ---------------------------- required by a bound in this
LL | where T: Generator<Yield = (), Return = T>
| ---------- required by this bound in `want_cyclic_generator_return`
...
--> $DIR/generator-yielding-or-returning-itself.rs:28:5
|
LL | pub fn want_cyclic_generator_yield<T>(_: T)
- | ---------------------------
+ | --------------------------- required by a bound in this
LL | where T: Generator<Yield = T, Return = ()>
| --------- required by this bound in `want_cyclic_generator_yield`
...
--> $DIR/issue-62326-parameter-out-of-range.rs:7:20
|
LL | trait Iterator {
- | --------
+ | -------- required by a bound in this
LL | type Item<'a>: 'a;
| ^^ required by this bound in `Iterator`
--> $DIR/iterable.rs:19:30
|
LL | trait Iterable {
- | --------
+ | -------- required by a bound in this
LL | type Item<'a> where Self: 'a;
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a;
| --------------------- required by this bound in `Iterable`
--> $DIR/iterable.rs:31:30
|
LL | trait Iterable {
- | --------
+ | -------- required by a bound in this
LL | type Item<'a> where Self: 'a;
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a;
| --------------------- required by this bound in `Iterable`
--> $DIR/hrtb-conflate-regions.rs:27:22
|
LL | fn want_foo2<T>()
- | ---------
+ | --------- required by a bound in this
LL | where T : for<'a,'b> Foo<(&'a isize, &'b isize)>
| -------------------------------------- required by this bound in `want_foo2`
...
--> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:11
|
LL | fn foo<T>()
- | ---
+ | --- required by a bound in this
LL | where
LL | T: Trait<for<'b> fn(&'b u32)>,
| -------------------------- required by this bound in `foo`
--> $DIR/hrtb-exists-forall-trait-covariant.rs:36:11
|
LL | fn foo<T>()
- | ---
+ | --- required by a bound in this
LL | where
LL | T: Trait<for<'b> fn(fn(&'b u32))>,
| ------------------------------ required by this bound in `foo`
--> $DIR/hrtb-exists-forall-trait-invariant.rs:28:11
|
LL | fn foo<T>()
- | ---
+ | --- required by a bound in this
LL | where
LL | T: Trait<for<'b> fn(Cell<&'b u32>)>,
| -------------------------------- required by this bound in `foo`
--> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:26
|
LL | fn want_bar_for_any_ccx<B>(b: &B)
- | --------------------
+ | -------------------- required by a bound in this
LL | where B : for<'ccx> Bar<'ccx>
| ------------------- required by this bound in `want_bar_for_any_ccx`
...
| ^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F`
...
LL | fn want_foo_for_any_tcx<F>(f: &F)
- | --------------------
+ | -------------------- required by a bound in this
LL | where F : for<'tcx> Foo<'tcx>
| ------------------- required by this bound in `want_foo_for_any_tcx`
|
| ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
...
LL | fn want_bar_for_any_ccx<B>(b: &B)
- | --------------------
+ | -------------------- required by a bound in this
LL | where B : for<'ccx> Bar<'ccx>
| ------------------- required by this bound in `want_bar_for_any_ccx`
|
--> $DIR/hrtb-just-for-static.rs:24:17
|
LL | fn want_hrtb<T>()
- | ---------
+ | --------- required by a bound in this
LL | where T : for<'a> Foo<&'a isize>
| ---------------------- required by this bound in `want_hrtb`
...
--> $DIR/hrtb-just-for-static.rs:30:17
|
LL | fn want_hrtb<T>()
- | ---------
+ | --------- required by a bound in this
LL | where T : for<'a> Foo<&'a isize>
| ---------------------- required by this bound in `want_hrtb`
...
--> $DIR/issue-24204.rs:14:12
|
LL | trait Trait: Sized {
- | -----
+ | ----- required by a bound in this
LL | type A: MultiDispatch<Self::B, O = Self>;
| -------- required by this bound in `Trait`
...
--> $DIR/issue-43623.rs:14:5
|
LL | pub fn break_me<T, F>(f: F)
- | --------
+ | -------- required by a bound in this
LL | where T: for<'b> Trait<'b>,
LL | F: for<'b> FnMut(<T as Trait<'b>>::Assoc) {
| -------------------------------------- required by this bound in `break_me`
--> $DIR/issue-43623.rs:14:5
|
LL | pub fn break_me<T, F>(f: F)
- | --------
+ | -------- required by a bound in this
LL | where T: for<'b> Trait<'b>,
LL | F: for<'b> FnMut(<T as Trait<'b>>::Assoc) {
| ------------------------------ required by this bound in `break_me`
| -------- takes 1 argument
...
LL | fn foo<F>(f: F)
- | ---
+ | --- required by a bound in this
LL | where
LL | F: Fn(),
| ---- required by this bound in `foo`
--> $DIR/issue-60218.rs:18:5
|
LL | pub fn trigger_error<I, F>(iterable: I, functor: F)
- | -------------
+ | ------------- required by a bound in this
...
LL | for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo,
| --- required by this bound in `trigger_error`
--> $DIR/issue-60283.rs:14:13
|
LL | pub fn foo<T, F>(_: T, _: F)
- | ---
+ | --- required by a bound in this
LL | where T: for<'a> Trait<'a>,
LL | F: for<'a> FnMut(<T as Trait<'a>>::Item) {}
| ------------------------------------- required by this bound in `foo`
--> $DIR/issue-60283.rs:14:5
|
LL | pub fn foo<T, F>(_: T, _: F)
- | ---
+ | --- required by a bound in this
LL | where T: for<'a> Trait<'a>,
LL | F: for<'a> FnMut(<T as Trait<'a>>::Item) {}
| ----------------------------- required by this bound in `foo`
--> $DIR/issue-65673.rs:9:16
|
LL | trait WithType {
- | --------
+ | -------- required by a bound in this
LL | type Ctx;
| --------- required by this bound in `WithType`
...
--> $DIR/missing-assoc-type-bound-restriction.rs:17:19
|
LL | trait Parent {
- | ------
+ | ------ required by a bound in this
LL | type Ty;
LL | type Assoc: Child<Self::Ty>;
| --------------- required by this bound in `Parent`
--> $DIR/missing-assoc-type-bound-restriction.rs:20:18
|
LL | trait Parent {
- | ------
+ | ------ required by a bound in this
LL | type Ty;
LL | type Assoc: Child<Self::Ty>;
| --------------- required by this bound in `Parent`
--> $DIR/missing-assoc-type-bound-restriction.rs:20:5
|
LL | trait Parent {
- | ------
+ | ------ required by a bound in this
LL | type Ty;
LL | type Assoc: Child<Self::Ty>;
| --------------- required by this bound in `Parent`
--> $DIR/cycle-cache-err-60010.rs:31:20
|
LL | trait Database {
- | --------
+ | -------- required by a bound in this
LL | type Storage;
| ------------- required by this bound in `Database`
...
--> $DIR/where-for-self-2.rs:21:5
|
LL | fn foo<T>(x: &T)
- | ---
+ | --- required by a bound in this
LL | where for<'a> &'a T: Bar
| --- required by this bound in `foo`
...