diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index 89820bb1417..b1ac02d9fed 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 d3b3403ac3e..756281450d7 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 21828006164..34bd332951c 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 dc3e3b4e738..229127e95d9 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 92547ca4796..1beb5315d10 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 00efb610004..8cdc9b57750 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 e991c508c03..945105d1a2d 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 65100909e53..84a65f0d1d2 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 ece714c949c..d4b93eb074c 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 d8046497b98..a3d25832925 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 9450612332c..9437fbe61cc 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 795c7beab0a..3057d4789bd 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 9efebe3aeff..9d8a1c67734 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 e013b8fc69e..6661cf358b3 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 516c750cb34..d1b590d8133 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 988cb2fa548..22598e58bd7 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