Skip to content

Commit d445c12

Browse files
committed
TEST see if these were introducing a lot of evaluation churn
1 parent bed395e commit d445c12

30 files changed

+59
-69
lines changed

compiler/rustc_trait_selection/src/traits/wf.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -710,12 +710,12 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
710710

711711
iter::zip(iter::zip(predicates.predicates, predicates.spans), origins.into_iter().rev())
712712
.map(|((pred, span), origin_def_id)| {
713-
let code = match pred.kind().skip_binder() {
713+
let code = match () {// pred.kind().skip_binder() {
714714
_ if span.is_dummy() => traits::MiscObligation,
715-
ty::PredicateKind::Trait(ty::TraitPredicate {
716-
implicit: ty::ImplicitBound::Yes,
717-
..
718-
}) => traits::ImplicitSizedObligation(origin_def_id, span),
715+
// ty::PredicateKind::Trait(ty::TraitPredicate {
716+
// implicit: ty::ImplicitBound::Yes,
717+
// ..
718+
// }) => traits::ImplicitSizedObligation(origin_def_id, span),
719719
_ => traits::BindingObligation(origin_def_id, span),
720720
};
721721
let cause = self.cause(code);

compiler/rustc_typeck/src/check/compare_method.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,16 +1378,17 @@ pub fn check_type_bounds<'tcx>(
13781378

13791379
let impl_ty_hir_id = tcx.hir().local_def_id_to_hir_id(impl_ty.def_id.expect_local());
13801380
let normalize_cause = traits::ObligationCause::misc(impl_ty_span, impl_ty_hir_id);
1381-
let mk_cause = |bound, span: Span| {
1381+
// let mk_cause = |bound, span: Span| {
1382+
let mk_cause = |span: Span| {
13821383
ObligationCause::new(
13831384
impl_ty_span,
13841385
impl_ty_hir_id,
1385-
match bound {
1386+
match () {
13861387
_ if span.is_dummy() => traits::MiscObligation,
1387-
ty::PredicateKind::Trait(ty::TraitPredicate {
1388-
implicit: ty::ImplicitBound::Yes,
1389-
..
1390-
}) => traits::ImplicitSizedObligation(trait_ty.def_id, span),
1388+
// ty::PredicateKind::Trait(ty::TraitPredicate {
1389+
// implicit: ty::ImplicitBound::Yes,
1390+
// ..
1391+
// }) => traits::ImplicitSizedObligation(trait_ty.def_id, span),
13911392
_ => ObligationCauseCode::BindingObligation(trait_ty.def_id, span),
13921393
},
13931394
)
@@ -1402,7 +1403,8 @@ pub fn check_type_bounds<'tcx>(
14021403
debug!("check_type_bounds: concrete_ty_bound = {:?}", concrete_ty_bound);
14031404

14041405
traits::Obligation::new(
1405-
mk_cause(bound.kind().skip_binder(), span),
1406+
// mk_cause(bound.kind().skip_binder(), span),
1407+
mk_cause(span),
14061408
param_env,
14071409
concrete_ty_bound,
14081410
)

src/test/ui/associated-types/defaults-wf.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type Ty = Vec<[u8]>;
55
| ^^^^^^^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `[u8]`
8-
note: type parameters have an implicit `Sized` obligation
8+
note: required by a bound in `Vec`
99
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
1010
|
1111
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {

src/test/ui/associated-types/issue-20005.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
44
LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
55
| ^^^^^^^^^^ doesn't have a size known at compile-time
66
|
7-
note: type parameters have an implicit `Sized` obligation
7+
note: required by a bound in `From`
88
--> $DIR/issue-20005.rs:1:12
99
|
1010
LL | trait From<Src> {

src/test/ui/associated-types/issue-63593.stderr

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
44
LL | type This = Self;
55
| ^^^^ doesn't have a size known at compile-time
66
|
7-
note: associated types have an implicit `Sized` obligation
7+
note: required by a bound in `MyTrait::This`
88
--> $DIR/issue-63593.rs:9:5
99
|
1010
LL | type This = Self;
11-
| ^^^^^^^^^^^^^^^^^ required by associated type `MyTrait::This`
11+
| ^^^^^^^^^^^^^^^^^ required by this bound in `MyTrait::This`
1212
help: consider further restricting `Self`
1313
|
1414
LL | trait MyTrait: Sized {
1515
| +++++++
16-
help: consider relaxing the `Sized` obligation
17-
|
18-
LL | type This: ?Sized = Self;
19-
| ++++++++
2016

2117
error: aborting due to previous error
2218

src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
44
LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> {}
55
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
66
|
7-
note: type parameters have an implicit `Sized` obligation
7+
note: required by a bound in `Add`
88
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
99
|
1010
LL | pub trait Add<Rhs = Self> {

src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ LL | let dst = Inline::<dyn Debug>::new(0);
5656
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
5757
|
5858
= help: the trait `Sized` is not implemented for `dyn Debug`
59-
note: type parameters have an implicit `Sized` obligation
59+
note: required by a bound in `Inline`
6060
--> $DIR/issue-80742.rs:12:15
6161
|
6262
LL | struct Inline<T>

src/test/ui/dst/dst-sized-trait-param.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | impl Foo<[isize]> for usize { }
55
| ^^^^^^^^^^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `[isize]`
8-
note: type parameters have an implicit `Sized` obligation
8+
note: required by a bound in `Foo`
99
--> $DIR/dst-sized-trait-param.rs:5:11
1010
|
1111
LL | trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized

src/test/ui/generator/sized-yield.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LL | Pin::new(&mut gen).resume(());
1818
| ^^^^^^ doesn't have a size known at compile-time
1919
|
2020
= help: the trait `Sized` is not implemented for `str`
21-
note: type parameters have an implicit `Sized` obligation
21+
note: required by a bound in `GeneratorState`
2222
--> $SRC_DIR/core/src/ops/generator.rs:LL:COL
2323
|
2424
LL | pub enum GeneratorState<Y, R> {

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,15 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
2020
LL | type Associated: Trait1 = Self;
2121
| ^^^^ doesn't have a size known at compile-time
2222
|
23-
note: associated types have an implicit `Sized` obligation
23+
note: required by a bound in `Trait2::Associated`
2424
--> $DIR/issue-74816.rs:9:5
2525
|
2626
LL | type Associated: Trait1 = Self;
27-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by associated type `Trait2::Associated`
27+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait2::Associated`
2828
help: consider further restricting `Self`
2929
|
3030
LL | trait Trait2: Sized {
3131
| +++++++
32-
help: consider relaxing the `Sized` obligation
33-
|
34-
LL | type Associated: Trait1 + ?Sized = Self;
35-
| ++++++++
3632

3733
error: aborting due to 2 previous errors
3834

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ LL | impl<'self> Serializable<str> for &'self str {
5555
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
5656
|
5757
= help: the trait `Sized` is not implemented for `str`
58-
note: type parameters have an implicit `Sized` obligation
58+
note: required by a bound in `Serializable`
5959
--> $DIR/issue-10412.rs:1:27
6060
|
6161
LL | trait Serializable<'self, T> {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn ho_func(f: Option<FuncType>) {
55
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `dyn for<'r> Fn(&'r isize) -> isize`
8-
note: type parameters have an implicit `Sized` obligation
8+
note: required by a bound in `Option`
99
--> $DIR/issue-18919.rs:7:13
1010
|
1111
LL | enum Option<T> {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn iceman(c: Vec<[i32]>) {}
55
| ^^^^^^^^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `[i32]`
8-
note: type parameters have an implicit `Sized` obligation
8+
note: required by a bound in `Vec`
99
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
1010
|
1111
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | pub fn function(funs: Vec<dyn Fn() -> ()>) {}
55
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `(dyn Fn() + 'static)`
8-
note: type parameters have an implicit `Sized` obligation
8+
note: required by a bound in `Vec`
99
--> $DIR/issue-23281.rs:8:12
1010
|
1111
LL | struct Vec<T> {

src/test/ui/recursion/issue-26548-recursion-via-normalize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trait Mirror {
1+
trait Mirror { //~ NOTE required by a bound in this
22
type It: ?Sized;
33
}
44
impl<T: ?Sized> Mirror for T {
@@ -7,7 +7,7 @@ impl<T: ?Sized> Mirror for T {
77
struct S(Option<<S as Mirror>::It>);
88
//~^ ERROR overflow evaluating the requirement `S: Sized`
99
//~| NOTE required because it appears within the type `S`
10-
//~| NOTE type parameters have an implicit `Sized` obligation
10+
//~| NOTE required by a bound in `Option`
1111

1212
fn main() {
1313
let _s = S(None);

src/test/ui/recursion/issue-26548-recursion-via-normalize.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ note: required because it appears within the type `S`
99
|
1010
LL | struct S(Option<<S as Mirror>::It>);
1111
| ^
12-
note: type parameters have an implicit `Sized` obligation
12+
note: required by a bound in `Option`
1313
--> $SRC_DIR/core/src/option.rs:LL:COL
1414
|
1515
LL | pub enum Option<T> {

src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
44
LL | fn func1() -> Struct1<Self>;
55
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
66
|
7-
note: type parameters have an implicit `Sized` obligation
7+
note: required by a bound in `Struct1`
88
--> $DIR/adt-param-with-implicit-sized-bound.rs:8:16
99
|
1010
LL | struct Struct1<T>{
@@ -24,7 +24,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
2424
LL | fn func2<'a>() -> Struct2<'a, Self>;
2525
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
2626
|
27-
note: type parameters have an implicit `Sized` obligation
27+
note: required by a bound in `Struct2`
2828
--> $DIR/adt-param-with-implicit-sized-bound.rs:11:20
2929
|
3030
LL | struct Struct2<'a, T>{
@@ -44,7 +44,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
4444
LL | fn func3() -> Struct3<Self>;
4545
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
4646
|
47-
note: type parameters have an implicit `Sized` obligation
47+
note: required by a bound in `Struct3`
4848
--> $DIR/adt-param-with-implicit-sized-bound.rs:14:16
4949
|
5050
LL | struct Struct3<T>{
@@ -67,7 +67,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
6767
LL | fn func4() -> Struct4<Self>;
6868
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
6969
|
70-
note: type parameters have an implicit `Sized` obligation
70+
note: required by a bound in `Struct4`
7171
--> $DIR/adt-param-with-implicit-sized-bound.rs:20:16
7272
|
7373
LL | struct Struct4<T>{
@@ -89,7 +89,7 @@ LL | struct Struct5<T: ?Sized>{
8989
LL | _t: X<T>,
9090
| ^^^^ doesn't have a size known at compile-time
9191
|
92-
note: type parameters have an implicit `Sized` obligation
92+
note: required by a bound in `X`
9393
--> $DIR/adt-param-with-implicit-sized-bound.rs:18:10
9494
|
9595
LL | struct X<T>(T);

src/test/ui/suggestions/issue-85943-no-suggest-unsized-indirection-in-where-clause.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | struct B(A<[u8]>);
55
| ^^^^^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `[u8]`
8-
note: type parameters have an implicit `Sized` obligation
8+
note: required by a bound in `A`
99
--> $DIR/issue-85943-no-suggest-unsized-indirection-in-where-clause.rs:4:10
1010
|
1111
LL | struct A<T>(T) where T: Send;

src/test/ui/trait-bounds/unsized-bound.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | impl<A, B> Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {}
77
| this type parameter needs to be `std::marker::Sized`
88
|
99
= note: required because it appears within the type `(A, B)`
10-
note: type parameters have an implicit `Sized` obligation
10+
note: required by a bound in `Trait`
1111
--> $DIR/unsized-bound.rs:1:13
1212
|
1313
LL | trait Trait<A> {}
@@ -46,7 +46,7 @@ LL | impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Size
4646
| this type parameter needs to be `std::marker::Sized`
4747
|
4848
= note: required because it appears within the type `(A, B, C)`
49-
note: type parameters have an implicit `Sized` obligation
49+
note: required by a bound in `Trait`
5050
--> $DIR/unsized-bound.rs:1:13
5151
|
5252
LL | trait Trait<A> {}
@@ -100,7 +100,7 @@ LL | impl<A: ?Sized, B: ?Sized> Trait2<(A, B)> for (A, B) {}
100100
| this type parameter needs to be `std::marker::Sized`
101101
|
102102
= note: required because it appears within the type `(A, B)`
103-
note: type parameters have an implicit `Sized` obligation
103+
note: required by a bound in `Trait2`
104104
--> $DIR/unsized-bound.rs:9:14
105105
|
106106
LL | trait Trait2<A> {}
@@ -138,7 +138,7 @@ LL | impl<A> Trait3<A> for A where A: ?Sized {}
138138
| |
139139
| this type parameter needs to be `std::marker::Sized`
140140
|
141-
note: type parameters have an implicit `Sized` obligation
141+
note: required by a bound in `Trait3`
142142
--> $DIR/unsized-bound.rs:13:14
143143
|
144144
LL | trait Trait3<A> {}
@@ -161,7 +161,7 @@ LL | impl<A: ?Sized> Trait4<A> for A {}
161161
| |
162162
| this type parameter needs to be `std::marker::Sized`
163163
|
164-
note: type parameters have an implicit `Sized` obligation
164+
note: required by a bound in `Trait4`
165165
--> $DIR/unsized-bound.rs:16:14
166166
|
167167
LL | trait Trait4<A> {}
@@ -184,7 +184,7 @@ LL | impl<X, Y> Trait5<X, Y> for X where X: ?Sized {}
184184
| |
185185
| this type parameter needs to be `std::marker::Sized`
186186
|
187-
note: type parameters have an implicit `Sized` obligation
187+
note: required by a bound in `Trait5`
188188
--> $DIR/unsized-bound.rs:19:14
189189
|
190190
LL | trait Trait5<A, B> {}
@@ -207,7 +207,7 @@ LL | impl<X: ?Sized, Y> Trait6<X, Y> for X {}
207207
| |
208208
| this type parameter needs to be `std::marker::Sized`
209209
|
210-
note: type parameters have an implicit `Sized` obligation
210+
note: required by a bound in `Trait6`
211211
--> $DIR/unsized-bound.rs:22:14
212212
|
213213
LL | trait Trait6<A, B> {}
@@ -230,7 +230,7 @@ LL | impl<X, Y> Trait7<X, Y> for X where Y: ?Sized {}
230230
| |
231231
| this type parameter needs to be `std::marker::Sized`
232232
|
233-
note: type parameters have an implicit `Sized` obligation
233+
note: required by a bound in `Trait7`
234234
--> $DIR/unsized-bound.rs:25:17
235235
|
236236
LL | trait Trait7<A, B> {}
@@ -253,7 +253,7 @@ LL | impl<X, Y: ?Sized> Trait8<X, Y> for X {}
253253
| |
254254
| this type parameter needs to be `std::marker::Sized`
255255
|
256-
note: type parameters have an implicit `Sized` obligation
256+
note: required by a bound in `Trait8`
257257
--> $DIR/unsized-bound.rs:28:17
258258
|
259259
LL | trait Trait8<A, B> {}

src/test/ui/traits/bad-sized.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new();
1616
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
1717
|
1818
= help: the trait `Sized` is not implemented for `dyn Trait`
19-
note: type parameters have an implicit `Sized` obligation
19+
note: required by a bound in `Vec`
2020
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
2121
|
2222
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
@@ -42,7 +42,7 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new();
4242
| ^^^ doesn't have a size known at compile-time
4343
|
4444
= help: the trait `Sized` is not implemented for `dyn Trait`
45-
note: type parameters have an implicit `Sized` obligation
45+
note: required by a bound in `Vec`
4646
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
4747
|
4848
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {

src/test/ui/traits/issue-65673.stderr

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@ LL | type Ctx = dyn Alias<T>;
55
| ^^^^^^^^^^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `Sized` is not implemented for `(dyn Trait + 'static)`
8-
note: associated types have an implicit `Sized` obligation
8+
note: required by a bound in `WithType::Ctx`
99
--> $DIR/issue-65673.rs:4:5
1010
|
1111
LL | type Ctx;
12-
| ^^^^^^^^^ required by associated type `WithType::Ctx`
13-
help: consider relaxing the `Sized` obligation
14-
|
15-
LL | type Ctx: ?Sized;
16-
| ++++++++
12+
| ^^^^^^^^^ required by this bound in `WithType::Ctx`
1713

1814
error: aborting due to previous error
1915

src/test/ui/traits/mutual-recursion-issue-75860.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | iso(left, right)
66
|
77
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`mutual_recursion_issue_75860`)
88
= note: required because it appears within the type `Option<Option<_>>`
9-
note: type parameters have an implicit `Sized` obligation
9+
note: required by a bound in `Option`
1010
--> $SRC_DIR/core/src/option.rs:LL:COL
1111
|
1212
LL | pub enum Option<T> {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
66
| |
77
| this type parameter needs to be `std::marker::Sized`
88
|
9-
note: type parameters have an implicit `Sized` obligation
9+
note: required by a bound in `Foo`
1010
--> $DIR/unsized-enum.rs:4:10
1111
|
1212
LL | enum Foo<U> { FooSome(U), FooNone }

0 commit comments

Comments
 (0)