Skip to content

Commit 3eb0d7c

Browse files
Rollup merge of rust-lang#90025 - JohnTitor:revert-86011, r=estebank
Revert rust-lang#86011 to fix an incorrect bound check This reverts commit 36a1076, reversing changes made to e1e9319. Fixes rust-lang#89935 r? `@estebank`
2 parents 048d3a9 + 101a81b commit 3eb0d7c

21 files changed

+79
-72
lines changed

compiler/rustc_typeck/src/bounds.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ impl<'tcx> Bounds<'tcx> {
6464
})
6565
});
6666

67-
self.region_bounds
68-
.iter()
69-
.map(|&(region_bound, span)| {
67+
sized_predicate
68+
.into_iter()
69+
.chain(self.region_bounds.iter().map(|&(region_bound, span)| {
7070
(
7171
region_bound
7272
.map_bound(|region_bound| ty::OutlivesPredicate(param_ty, region_bound))
7373
.to_predicate(tcx),
7474
span,
7575
)
76-
})
76+
}))
7777
.chain(self.trait_bounds.iter().map(|&(bound_trait_ref, span, constness)| {
7878
let predicate = bound_trait_ref.with_constness(constness).to_predicate(tcx);
7979
(predicate, span)
@@ -83,7 +83,6 @@ impl<'tcx> Bounds<'tcx> {
8383
.iter()
8484
.map(|&(projection, span)| (projection.to_predicate(tcx), span)),
8585
)
86-
.chain(sized_predicate.into_iter())
8786
.collect()
8887
}
8988
}

src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: required by a bound in `std::hash::Hash::hash`
1111
--> $SRC_DIR/core/src/hash/mod.rs:LL:COL
1212
|
1313
LL | fn hash<H: Hasher>(&self, state: &mut H);
14-
| ^^^^^^ required by this bound in `std::hash::Hash::hash`
14+
| ^ required by this bound in `std::hash::Hash::hash`
1515
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

1717
error: aborting due to previous error

src/test/ui/derives/derives-span-Hash-enum.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: required by a bound in `std::hash::Hash::hash`
1111
--> $SRC_DIR/core/src/hash/mod.rs:LL:COL
1212
|
1313
LL | fn hash<H: Hasher>(&self, state: &mut H);
14-
| ^^^^^^ required by this bound in `std::hash::Hash::hash`
14+
| ^ required by this bound in `std::hash::Hash::hash`
1515
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

1717
error: aborting due to previous error

src/test/ui/derives/derives-span-Hash-struct.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: required by a bound in `std::hash::Hash::hash`
1111
--> $SRC_DIR/core/src/hash/mod.rs:LL:COL
1212
|
1313
LL | fn hash<H: Hasher>(&self, state: &mut H);
14-
| ^^^^^^ required by this bound in `std::hash::Hash::hash`
14+
| ^ required by this bound in `std::hash::Hash::hash`
1515
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

1717
error: aborting due to previous error

src/test/ui/derives/derives-span-Hash-tuple-struct.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: required by a bound in `std::hash::Hash::hash`
1111
--> $SRC_DIR/core/src/hash/mod.rs:LL:COL
1212
|
1313
LL | fn hash<H: Hasher>(&self, state: &mut H);
14-
| ^^^^^^ required by this bound in `std::hash::Hash::hash`
14+
| ^ required by this bound in `std::hash::Hash::hash`
1515
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

1717
error: aborting due to previous error

src/test/ui/generic-associated-types/issue-74816.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
error[E0277]: the size for values of type `Self` cannot be known at compilation time
1+
error[E0277]: the trait bound `Self: Trait1` is not satisfied
22
--> $DIR/issue-74816.rs:9:5
33
|
44
LL | type Associated: Trait1 = Self;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait1` is not implemented for `Self`
66
|
77
note: required by a bound in `Trait2::Associated`
8-
--> $DIR/issue-74816.rs:9:5
8+
--> $DIR/issue-74816.rs:9:22
99
|
1010
LL | type Associated: Trait1 = Self;
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait2::Associated`
11+
| ^^^^^^ required by this bound in `Trait2::Associated`
1212
help: consider further restricting `Self`
1313
|
14-
LL | trait Trait2: Sized {
15-
| +++++++
14+
LL | trait Trait2: Trait1 {
15+
| ++++++++
1616

17-
error[E0277]: the trait bound `Self: Trait1` is not satisfied
17+
error[E0277]: the size for values of type `Self` cannot be known at compilation time
1818
--> $DIR/issue-74816.rs:9:5
1919
|
2020
LL | type Associated: Trait1 = Self;
21-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait1` is not implemented for `Self`
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
2222
|
2323
note: required by a bound in `Trait2::Associated`
24-
--> $DIR/issue-74816.rs:9:22
24+
--> $DIR/issue-74816.rs:9:5
2525
|
2626
LL | type Associated: Trait1 = Self;
27-
| ^^^^^^ required by this bound in `Trait2::Associated`
27+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait2::Associated`
2828
help: consider further restricting `Self`
2929
|
30-
LL | trait Trait2: Trait1 {
31-
| ++++++++
30+
LL | trait Trait2: Sized {
31+
| +++++++
3232

3333
error: aborting due to 2 previous errors
3434

src/test/ui/generic-associated-types/issue-86483.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ LL | for<'a> T: 'a,
2020
| ^^
2121

2222
error[E0311]: the parameter type `T` may not live long enough
23-
--> $DIR/issue-86483.rs:9:19
23+
--> $DIR/issue-86483.rs:9:5
2424
|
2525
LL | pub trait IceIce<T>
2626
| - help: consider adding an explicit lifetime bound...: `T: 'a`
2727
...
2828
LL | type Ice<'v>: IntoIterator<Item = &'v T>;
29-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
3030
|
3131
note: ...that is required by this bound
3232
--> $DIR/issue-86483.rs:7:16

src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ LL | impl Tsized for () {}
66
|
77
= help: the trait `Sized` is not implemented for `[()]`
88
note: required by a bound in `Tsized`
9-
--> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:17:17
9+
--> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:17:14
1010
|
1111
LL | trait Tsized<P: Sized = [Self]> {}
12-
| ^^^^^ required by this bound in `Tsized`
12+
| ^ required by this bound in `Tsized`
1313

1414
error: aborting due to previous error
1515

src/test/ui/issues/issue-16966.stderr

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
error[E0283]: type annotations needed
1+
error[E0282]: type annotations needed
22
--> $DIR/issue-16966.rs:2:5
33
|
44
LL | panic!(std::default::Default::default());
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `M` declared on the function `begin_panic`
66
|
7-
= note: cannot satisfy `_: Any`
8-
note: required by a bound in `begin_panic`
9-
--> $SRC_DIR/std/src/panicking.rs:LL:COL
10-
|
11-
LL | pub fn begin_panic<M: Any + Send>(msg: M) -> ! {
12-
| ^^^ required by this bound in `begin_panic`
137
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
14-
help: consider specifying the type argument in the function call
15-
|
16-
LL | $crate::rt::begin_panic::<M>($msg)
17-
| +++++
188

199
error: aborting due to previous error
2010

21-
For more information about this error, try `rustc --explain E0283`.
11+
For more information about this error, try `rustc --explain E0282`.

src/test/ui/issues/issue-21160.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ note: required by a bound in `std::hash::Hash::hash`
1010
--> $SRC_DIR/core/src/hash/mod.rs:LL:COL
1111
|
1212
LL | fn hash<H: Hasher>(&self, state: &mut H);
13-
| ^^^^^^ required by this bound in `std::hash::Hash::hash`
13+
| ^ required by this bound in `std::hash::Hash::hash`
1414
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
1515

1616
error: aborting due to previous error

src/test/ui/issues/issue-23122-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Next`
1+
error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized`
22
--> $DIR/issue-23122-2.rs:9:17
33
|
44
LL | type Next = <GetNext<T::Next> as Next>::Next;

src/test/ui/issues/issue-54954.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
1212
|
1313
= note: cannot satisfy `_: Tt`
1414
note: required by a bound in `Tt::const_val`
15-
--> $DIR/issue-54954.rs:5:27
15+
--> $DIR/issue-54954.rs:5:24
1616
|
1717
LL | const fn const_val<T: Sized>() -> usize {
18-
| ^^^^^ required by this bound in `Tt::const_val`
18+
| ^ required by this bound in `Tt::const_val`
1919

2020
error: aborting due to 2 previous errors
2121

src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
2020
LL | T::c::<T>();
2121
| ^^^^^^^^^ the trait `Bar` is not implemented for `T`
2222
|
23-
note: required by a bound in `Foo::c`
24-
--> $DIR/trait-where-clause.rs:9:10
23+
note: required by `Foo::c`
24+
--> $DIR/trait-where-clause.rs:9:5
2525
|
2626
LL | fn c<T: ~const Bar>();
27-
| ^ required by this bound in `Foo::c`
27+
| ^^^^^^^^^^^^^^^^^^^^^^
2828
help: consider further restricting this bound
2929
|
3030
LL | const fn test1<T: ~const Foo + Bar + Bar>() {
@@ -52,11 +52,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied
5252
LL | T::c::<T>();
5353
| ^^^^^^^^^ the trait `Bar` is not implemented for `T`
5454
|
55-
note: required by a bound in `Foo::c`
56-
--> $DIR/trait-where-clause.rs:9:10
55+
note: required by `Foo::c`
56+
--> $DIR/trait-where-clause.rs:9:5
5757
|
5858
LL | fn c<T: ~const Bar>();
59-
| ^ required by this bound in `Foo::c`
59+
| ^^^^^^^^^^^^^^^^^^^^^^
6060
help: consider further restricting this bound
6161
|
6262
LL | fn test3<T: Foo + Bar>() {

src/test/ui/suggestions/issue-84973-blacklist.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ LL | f_sized(*ref_cl);
4949
|
5050
= help: the trait `Sized` is not implemented for `dyn Fn()`
5151
note: required by a bound in `f_sized`
52-
--> $DIR/issue-84973-blacklist.rs:9:15
52+
--> $DIR/issue-84973-blacklist.rs:9:12
5353
|
5454
LL | fn f_sized<T: Sized>(t: T) {}
55-
| ^^^^^ required by this bound in `f_sized`
55+
| ^ required by this bound in `f_sized`
5656

5757
error[E0277]: `Rc<{integer}>` cannot be sent between threads safely
5858
--> $DIR/issue-84973-blacklist.rs:27:12

src/test/ui/suggestions/slice-issue-87994.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0277]: `[i32]` is not an iterator
1+
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
22
--> $DIR/slice-issue-87994.rs:3:12
33
|
44
LL | for _ in v[1..] {
@@ -18,7 +18,7 @@ LL | for _ in &v[1..] {
1818
LL | for _ in &mut v[1..] {
1919
| ++++
2020

21-
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
21+
error[E0277]: `[i32]` is not an iterator
2222
--> $DIR/slice-issue-87994.rs:3:12
2323
|
2424
LL | for _ in v[1..] {
@@ -38,7 +38,7 @@ LL | for _ in &v[1..] {
3838
LL | for _ in &mut v[1..] {
3939
| ++++
4040

41-
error[E0277]: `[K]` is not an iterator
41+
error[E0277]: the size for values of type `[K]` cannot be known at compilation time
4242
--> $DIR/slice-issue-87994.rs:11:13
4343
|
4444
LL | for i2 in v2[1..] {
@@ -58,7 +58,7 @@ LL | for i2 in &v2[1..] {
5858
LL | for i2 in &mut v2[1..] {
5959
| ++++
6060

61-
error[E0277]: the size for values of type `[K]` cannot be known at compilation time
61+
error[E0277]: `[K]` is not an iterator
6262
--> $DIR/slice-issue-87994.rs:11:13
6363
|
6464
LL | for i2 in v2[1..] {

src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::fmt::Debug;
55
fn main() {}
66

77
type Two<A, B> = impl Debug;
8-
//~^ ERROR the trait bound `A: Foo` is not satisfied
8+
//~^ ERROR the trait bound `A: Foo` is not satisfied in `(A, B, <A as Foo>::Bar)`
99
//~| ERROR `A` doesn't implement `Debug`
1010
//~| ERROR `B` doesn't implement `Debug`
1111

src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ note: previous use here
1010
LL | fn two<T: Debug + Foo, U: Debug>(t: T, u: U) -> Two<T, U> {
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

13+
error[E0277]: the trait bound `A: Foo` is not satisfied in `(A, B, <A as Foo>::Bar)`
14+
--> $DIR/generic_duplicate_param_use9.rs:7:18
15+
|
16+
LL | type Two<A, B> = impl Debug;
17+
| ^^^^^^^^^^ within `(A, B, <A as Foo>::Bar)`, the trait `Foo` is not implemented for `A`
18+
|
19+
= note: required because it appears within the type `(A, B, <A as Foo>::Bar)`
20+
help: consider restricting type parameter `A`
21+
|
22+
LL | type Two<A: Foo, B> = impl Debug;
23+
| +++++
24+
1325
error[E0277]: `A` doesn't implement `Debug`
1426
--> $DIR/generic_duplicate_param_use9.rs:7:18
1527
|
@@ -34,18 +46,6 @@ help: consider restricting type parameter `B`
3446
LL | type Two<A, B: std::fmt::Debug> = impl Debug;
3547
| +++++++++++++++++
3648

37-
error[E0277]: the trait bound `A: Foo` is not satisfied
38-
--> $DIR/generic_duplicate_param_use9.rs:7:18
39-
|
40-
LL | type Two<A, B> = impl Debug;
41-
| ^^^^^^^^^^ the trait `Foo` is not implemented for `A`
42-
|
43-
= note: required because of the requirements on the impl of `Debug` for `(A, B, <A as Foo>::Bar)`
44-
help: consider restricting type parameter `A`
45-
|
46-
LL | type Two<A: Foo, B> = impl Debug;
47-
| +++++
48-
4949
error: aborting due to 4 previous errors
5050

5151
For more information about this error, try `rustc --explain E0277`.

src/test/ui/typeck/issue-89935.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// check-pass
2+
3+
trait Foo: Baz {}
4+
trait Bar {}
5+
trait Baz: Bar {
6+
fn bar(&self);
7+
}
8+
9+
impl<T: Foo> Bar for T {}
10+
impl<T: Foo> Baz for T {
11+
fn bar(&self) {}
12+
}
13+
14+
fn accept_foo(x: Box<dyn Foo>) {
15+
x.bar();
16+
}
17+
18+
fn main() {}

src/test/ui/unique-object-noncopyable.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ LL | | >(Unique<T>, A);
1919
| |________________- doesn't satisfy `Box<dyn Foo>: Clone`
2020
|
2121
= note: the following trait bounds were not satisfied:
22-
`dyn Foo: Clone`
23-
which is required by `Box<dyn Foo>: Clone`
2422
`dyn Foo: Sized`
2523
which is required by `Box<dyn Foo>: Clone`
24+
`dyn Foo: Clone`
25+
which is required by `Box<dyn Foo>: Clone`
2626

2727
error: aborting due to previous error
2828

src/test/ui/unsized/unsized-bare-typaram.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ LL | fn foo<T: ?Sized>() { bar::<T>() }
77
| this type parameter needs to be `std::marker::Sized`
88
|
99
note: required by a bound in `bar`
10-
--> $DIR/unsized-bare-typaram.rs:1:11
10+
--> $DIR/unsized-bare-typaram.rs:1:8
1111
|
1212
LL | fn bar<T: Sized>() { }
13-
| ^^^^^ required by this bound in `bar`
13+
| ^ required by this bound in `bar`
1414
help: consider removing the `?Sized` bound to make the type parameter `Sized`
1515
|
1616
LL - fn foo<T: ?Sized>() { bar::<T>() }

src/test/ui/unsized/unsized-struct.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ note: required because it appears within the type `Bar<T>`
3838
LL | struct Bar<T: ?Sized> { data: T }
3939
| ^^^
4040
note: required by a bound in `is_sized`
41-
--> $DIR/unsized-struct.rs:1:15
41+
--> $DIR/unsized-struct.rs:1:13
4242
|
4343
LL | fn is_sized<T:Sized>() { }
44-
| ^^^^^ required by this bound in `is_sized`
44+
| ^ required by this bound in `is_sized`
4545
help: consider removing the `?Sized` bound to make the type parameter `Sized`
4646
|
4747
LL - fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }

0 commit comments

Comments
 (0)