diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index 89820bb1417ebd60600590cb3510a76bc906bee5..b1ac02d9fed5a0175ee2c03c9d95fefbc10c2891 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -117,7 +117,7 @@ enum FailureKind { { err.span_help( tcx.def_span(def.did), - &format!("try adding a `where` bound using this expression: where [u8; {}]: Sized", snippet), + &format!("try adding a `where` bound using this expression: `where [u8; {}]: Sized`", snippet), ); } else { err.span_help( diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index d3b3403ac3e735bb3f978696cfe03672be4d3219..756281450d723a261ed3e394a640481d7996a331 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1780,7 +1780,7 @@ fn suggest_unsized_bound_if_applicable( multispan.push_span_label( sp, format!( - "...if indirection was used here: `Box<{}>`", + "...if indirection were used here: `Box<{}>`", param.name.ident(), ), ); diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 218280061643c5504c16a7dffa56e0274927f758..34bd332951c06ae9a8ac343250cb273d5df8101a 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1103,7 +1103,7 @@ fn suggest_impl_trait( // This is currently not possible to trigger because E0038 takes precedence, but // leave it in for completeness in case anything changes in an earlier stage. err.note(&format!( - "if trait `{}` was object safe, you could return a trait object", + "if trait `{}` were object-safe, you could return a trait object", trait_obj, )); } diff --git a/compiler/rustc_typeck/src/check/mod.rs b/compiler/rustc_typeck/src/check/mod.rs index dc3e3b4e738392b99938667b32ae5cc8dc9eed3b..229127e95d93c95dc486598a69c6382e760f7349 100644 --- a/compiler/rustc_typeck/src/check/mod.rs +++ b/compiler/rustc_typeck/src/check/mod.rs @@ -838,7 +838,7 @@ fn missing_items_err( // Obtain the level of indentation ending in `sugg_sp`. let indentation = tcx.sess.source_map().span_to_margin(sugg_sp).unwrap_or(0); // Make the whitespace that will make the suggestion have the right indentation. - let padding: String = (0..indentation).map(|_| " ").collect(); + let padding: String = std::iter::repeat(" ").take(indentation).collect(); for trait_item in missing_items { let snippet = suggestion_signature(&trait_item, tcx); diff --git a/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr b/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr index 92547ca4796a4304131889cbc305423e1dca5deb..1beb5315d1055615ad0a7c49abd1d801422211b8 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr @@ -4,7 +4,7 @@ error: unconstrained generic constant LL | let _ = const_evaluatable_lib::test1::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: where [u8; std::mem::size_of::() - 1]: Sized +help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::() - 1]: Sized` --> $DIR/auxiliary/const_evaluatable_lib.rs:6:10 | LL | [u8; std::mem::size_of::() - 1]: Sized, @@ -16,7 +16,7 @@ error: unconstrained generic constant LL | let _ = const_evaluatable_lib::test1::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: where [u8; std::mem::size_of::() - 1]: Sized +help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::() - 1]: Sized` --> $DIR/auxiliary/const_evaluatable_lib.rs:4:27 | LL | pub fn test1() -> [u8; std::mem::size_of::() - 1] @@ -28,7 +28,7 @@ error: unconstrained generic constant LL | let _ = const_evaluatable_lib::test1::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: where [u8; std::mem::size_of::() - 1]: Sized +help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::() - 1]: Sized` --> $DIR/auxiliary/const_evaluatable_lib.rs:6:10 | LL | [u8; std::mem::size_of::() - 1]: Sized, @@ -40,7 +40,7 @@ error: unconstrained generic constant LL | let _ = const_evaluatable_lib::test1::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: where [u8; std::mem::size_of::() - 1]: Sized +help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::() - 1]: Sized` --> $DIR/auxiliary/const_evaluatable_lib.rs:4:27 | LL | pub fn test1() -> [u8; std::mem::size_of::() - 1] diff --git a/src/test/ui/const-generics/const_evaluatable_checked/different-fn.stderr b/src/test/ui/const-generics/const_evaluatable_checked/different-fn.stderr index 00efb61000401b3d3a6147b7e17827ab0cfbb09e..8cdc9b57750ee35f1a4c0861fe1173d69856948d 100644 --- a/src/test/ui/const-generics/const_evaluatable_checked/different-fn.stderr +++ b/src/test/ui/const-generics/const_evaluatable_checked/different-fn.stderr @@ -4,7 +4,7 @@ error: unconstrained generic constant LL | [0; size_of::>()] | ^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: where [u8; size_of::>()]: Sized +help: try adding a `where` bound using this expression: `where [u8; size_of::>()]: Sized` --> $DIR/different-fn.rs:10:9 | LL | [0; size_of::>()] diff --git a/src/test/ui/const_evaluatable/needs_where_clause.stderr b/src/test/ui/const_evaluatable/needs_where_clause.stderr index e991c508c03f38aaa4b455381ee7030476c6ed7c..945105d1a2dc6180c1643418f6adcfc16c81be8f 100644 --- a/src/test/ui/const_evaluatable/needs_where_clause.stderr +++ b/src/test/ui/const_evaluatable/needs_where_clause.stderr @@ -4,7 +4,7 @@ error: unconstrained generic constant LL | b: [f32; complex_maths::(N)], | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: where [u8; complex_maths::(N)]: Sized +help: try adding a `where` bound using this expression: `where [u8; complex_maths::(N)]: Sized` --> $DIR/needs_where_clause.rs:11:12 | LL | b: [f32; complex_maths::(N)], diff --git a/src/test/ui/const_evaluatable/no_where_clause.stderr b/src/test/ui/const_evaluatable/no_where_clause.stderr index 65100909e53d508fb33f75dbb2c6e1bc06b0d501..84a65f0d1d29bd8bdcda5a688ddc2cfbc2855ed0 100644 --- a/src/test/ui/const_evaluatable/no_where_clause.stderr +++ b/src/test/ui/const_evaluatable/no_where_clause.stderr @@ -4,7 +4,7 @@ error: unconstrained generic constant LL | b: [f32; complex_maths(N)], | ^^^^^^^^^^^^^^^^^^^^^^^ | -help: try adding a `where` bound using this expression: where [u8; complex_maths(N)]: Sized +help: try adding a `where` bound using this expression: `where [u8; complex_maths(N)]: Sized` --> $DIR/no_where_clause.rs:10:12 | LL | b: [f32; complex_maths(N)], diff --git a/src/test/ui/issues/issue-18919.stderr b/src/test/ui/issues/issue-18919.stderr index ece714c949c19a40e1972a4f99f02afef09efa01..d4b93eb074cfed063bfca773fd53b03cde242c26 100644 --- a/src/test/ui/issues/issue-18919.stderr +++ b/src/test/ui/issues/issue-18919.stderr @@ -14,7 +14,7 @@ help: you could relax the implicit `Sized` bound on `T` if it were used through LL | enum Option { | ^ this could be changed to `T: ?Sized`... LL | Some(T), - | - ...if indirection was used here: `Box` + | - ...if indirection were used here: `Box` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23281.stderr b/src/test/ui/issues/issue-23281.stderr index d8046497b98752a6f65f8ac9293cca559cad0c29..a3d2583292551a18d7d0c852ae66500a5f58cc5d 100644 --- a/src/test/ui/issues/issue-23281.stderr +++ b/src/test/ui/issues/issue-23281.stderr @@ -14,7 +14,7 @@ help: you could relax the implicit `Sized` bound on `T` if it were used through LL | struct Vec { | ^ this could be changed to `T: ?Sized`... LL | t: T, - | - ...if indirection was used here: `Box` + | - ...if indirection were used here: `Box` error: aborting due to previous error diff --git a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr index 9450612332caa1f1fa63b401c048d9d736c49c7e..9437fbe61cc7e94ca92ea364c2b41335908c5af6 100644 --- a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr +++ b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr @@ -13,7 +13,7 @@ help: you could relax the implicit `Sized` bound on `T` if it were used through --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 | LL | struct X(T); - | ^ - ...if indirection was used here: `Box` + | ^ - ...if indirection were used here: `Box` | | | this could be changed to `T: ?Sized`... @@ -68,7 +68,7 @@ help: you could relax the implicit `Sized` bound on `T` if it were used through LL | struct Struct3{ | ^ this could be changed to `T: ?Sized`... LL | _t: T, - | - ...if indirection was used here: `Box` + | - ...if indirection were used here: `Box` help: consider further restricting `Self` | LL | fn func3() -> Struct3 where Self: Sized; diff --git a/src/test/ui/unsized/unsized-enum.stderr b/src/test/ui/unsized/unsized-enum.stderr index 795c7beab0ac64ed5b0a35b8a2eb08dd699d0dcc..3057d4789bd81df00f41fec9f7e23a52c24ddc87 100644 --- a/src/test/ui/unsized/unsized-enum.stderr +++ b/src/test/ui/unsized/unsized-enum.stderr @@ -13,7 +13,7 @@ help: you could relax the implicit `Sized` bound on `U` if it were used through --> $DIR/unsized-enum.rs:4:10 | LL | enum Foo { FooSome(U), FooNone } - | ^ - ...if indirection was used here: `Box` + | ^ - ...if indirection were used here: `Box` | | | this could be changed to `U: ?Sized`... diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr index 9efebe3aeff7016148588634402bf0d7655b7a31..9d8a1c67734a416adaf1c8c26d593581bcf1c4ad 100644 --- a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr @@ -13,7 +13,7 @@ help: you could relax the implicit `Sized` bound on `Y` if it were used through --> $DIR/unsized-inherent-impl-self-type.rs:5:11 | LL | struct S5(Y); - | ^ - ...if indirection was used here: `Box` + | ^ - ...if indirection were used here: `Box` | | | this could be changed to `Y: ?Sized`... diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index e013b8fc69ece473c47b30ad6a5fd70be9c46380..6661cf358b3ab07ff5e94412f70a9ec78b845cf1 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -13,7 +13,7 @@ help: you could relax the implicit `Sized` bound on `T` if it were used through --> $DIR/unsized-struct.rs:4:12 | LL | struct Foo { data: T } - | ^ - ...if indirection was used here: `Box` + | ^ - ...if indirection were used here: `Box` | | | this could be changed to `T: ?Sized`... diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr index 516c750cb342ed7c42bb64663ffd8dfae5429dcc..d1b590d81330707d17f3db9093871def120d267f 100644 --- a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr @@ -13,7 +13,7 @@ help: you could relax the implicit `Sized` bound on `Y` if it were used through --> $DIR/unsized-trait-impl-self-type.rs:8:11 | LL | struct S5(Y); - | ^ - ...if indirection was used here: `Box` + | ^ - ...if indirection were used here: `Box` | | | this could be changed to `Y: ?Sized`... diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 988cb2fa5480c75dbbc3c31e56345cb16f00920f..22598e58bd744647d086f15feb3c3c72e60a60b9 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -28,7 +28,7 @@ help: you could relax the implicit `Sized` bound on `T` if it were used through LL | struct Vec { | ^ this could be changed to `T: ?Sized`... LL | t: T, - | - ...if indirection was used here: `Box` + | - ...if indirection were used here: `Box` error[E0038]: the trait `Copy` cannot be made into an object --> $DIR/wf-fn-where-clause.rs:12:16