Rollup merge of #81738 - camelid:misc-small-diag-cleanup, r=lcnr
Miscellaneous small diagnostics cleanup
This commit is contained in:
commit
96e843ce6a
16 changed files with 20 additions and 20 deletions
|
@ -117,7 +117,7 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
|
||||||
{
|
{
|
||||||
err.span_help(
|
err.span_help(
|
||||||
tcx.def_span(def.did),
|
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 {
|
} else {
|
||||||
err.span_help(
|
err.span_help(
|
||||||
|
|
|
@ -1780,7 +1780,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
multispan.push_span_label(
|
multispan.push_span_label(
|
||||||
sp,
|
sp,
|
||||||
format!(
|
format!(
|
||||||
"...if indirection was used here: `Box<{}>`",
|
"...if indirection were used here: `Box<{}>`",
|
||||||
param.name.ident(),
|
param.name.ident(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
// This is currently not possible to trigger because E0038 takes precedence, but
|
// 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.
|
// leave it in for completeness in case anything changes in an earlier stage.
|
||||||
err.note(&format!(
|
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,
|
trait_obj,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -838,7 +838,7 @@ fn missing_items_err(
|
||||||
// Obtain the level of indentation ending in `sugg_sp`.
|
// Obtain the level of indentation ending in `sugg_sp`.
|
||||||
let indentation = tcx.sess.source_map().span_to_margin(sugg_sp).unwrap_or(0);
|
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.
|
// 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 {
|
for trait_item in missing_items {
|
||||||
let snippet = suggestion_signature(&trait_item, tcx);
|
let snippet = suggestion_signature(&trait_item, tcx);
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: unconstrained generic constant
|
||||||
LL | let _ = const_evaluatable_lib::test1::<T>();
|
LL | let _ = const_evaluatable_lib::test1::<T>();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
help: try adding a `where` bound using this expression: where [u8; std::mem::size_of::<T>() - 1]: Sized
|
help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::<T>() - 1]: Sized`
|
||||||
--> $DIR/auxiliary/const_evaluatable_lib.rs:6:10
|
--> $DIR/auxiliary/const_evaluatable_lib.rs:6:10
|
||||||
|
|
|
|
||||||
LL | [u8; std::mem::size_of::<T>() - 1]: Sized,
|
LL | [u8; std::mem::size_of::<T>() - 1]: Sized,
|
||||||
|
@ -16,7 +16,7 @@ error: unconstrained generic constant
|
||||||
LL | let _ = const_evaluatable_lib::test1::<T>();
|
LL | let _ = const_evaluatable_lib::test1::<T>();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
help: try adding a `where` bound using this expression: where [u8; std::mem::size_of::<T>() - 1]: Sized
|
help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::<T>() - 1]: Sized`
|
||||||
--> $DIR/auxiliary/const_evaluatable_lib.rs:4:27
|
--> $DIR/auxiliary/const_evaluatable_lib.rs:4:27
|
||||||
|
|
|
|
||||||
LL | pub fn test1<T>() -> [u8; std::mem::size_of::<T>() - 1]
|
LL | pub fn test1<T>() -> [u8; std::mem::size_of::<T>() - 1]
|
||||||
|
@ -28,7 +28,7 @@ error: unconstrained generic constant
|
||||||
LL | let _ = const_evaluatable_lib::test1::<T>();
|
LL | let _ = const_evaluatable_lib::test1::<T>();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
help: try adding a `where` bound using this expression: where [u8; std::mem::size_of::<T>() - 1]: Sized
|
help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::<T>() - 1]: Sized`
|
||||||
--> $DIR/auxiliary/const_evaluatable_lib.rs:6:10
|
--> $DIR/auxiliary/const_evaluatable_lib.rs:6:10
|
||||||
|
|
|
|
||||||
LL | [u8; std::mem::size_of::<T>() - 1]: Sized,
|
LL | [u8; std::mem::size_of::<T>() - 1]: Sized,
|
||||||
|
@ -40,7 +40,7 @@ error: unconstrained generic constant
|
||||||
LL | let _ = const_evaluatable_lib::test1::<T>();
|
LL | let _ = const_evaluatable_lib::test1::<T>();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
help: try adding a `where` bound using this expression: where [u8; std::mem::size_of::<T>() - 1]: Sized
|
help: try adding a `where` bound using this expression: `where [u8; std::mem::size_of::<T>() - 1]: Sized`
|
||||||
--> $DIR/auxiliary/const_evaluatable_lib.rs:4:27
|
--> $DIR/auxiliary/const_evaluatable_lib.rs:4:27
|
||||||
|
|
|
|
||||||
LL | pub fn test1<T>() -> [u8; std::mem::size_of::<T>() - 1]
|
LL | pub fn test1<T>() -> [u8; std::mem::size_of::<T>() - 1]
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: unconstrained generic constant
|
||||||
LL | [0; size_of::<Foo<T>>()]
|
LL | [0; size_of::<Foo<T>>()]
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
help: try adding a `where` bound using this expression: where [u8; size_of::<Foo<T>>()]: Sized
|
help: try adding a `where` bound using this expression: `where [u8; size_of::<Foo<T>>()]: Sized`
|
||||||
--> $DIR/different-fn.rs:10:9
|
--> $DIR/different-fn.rs:10:9
|
||||||
|
|
|
|
||||||
LL | [0; size_of::<Foo<T>>()]
|
LL | [0; size_of::<Foo<T>>()]
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: unconstrained generic constant
|
||||||
LL | b: [f32; complex_maths::<T>(N)],
|
LL | b: [f32; complex_maths::<T>(N)],
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
help: try adding a `where` bound using this expression: where [u8; complex_maths::<T>(N)]: Sized
|
help: try adding a `where` bound using this expression: `where [u8; complex_maths::<T>(N)]: Sized`
|
||||||
--> $DIR/needs_where_clause.rs:11:12
|
--> $DIR/needs_where_clause.rs:11:12
|
||||||
|
|
|
|
||||||
LL | b: [f32; complex_maths::<T>(N)],
|
LL | b: [f32; complex_maths::<T>(N)],
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: unconstrained generic constant
|
||||||
LL | b: [f32; complex_maths(N)],
|
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
|
--> $DIR/no_where_clause.rs:10:12
|
||||||
|
|
|
|
||||||
LL | b: [f32; complex_maths(N)],
|
LL | b: [f32; complex_maths(N)],
|
||||||
|
|
|
@ -14,7 +14,7 @@ help: you could relax the implicit `Sized` bound on `T` if it were used through
|
||||||
LL | enum Option<T> {
|
LL | enum Option<T> {
|
||||||
| ^ this could be changed to `T: ?Sized`...
|
| ^ this could be changed to `T: ?Sized`...
|
||||||
LL | Some(T),
|
LL | Some(T),
|
||||||
| - ...if indirection was used here: `Box<T>`
|
| - ...if indirection were used here: `Box<T>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ help: you could relax the implicit `Sized` bound on `T` if it were used through
|
||||||
LL | struct Vec<T> {
|
LL | struct Vec<T> {
|
||||||
| ^ this could be changed to `T: ?Sized`...
|
| ^ this could be changed to `T: ?Sized`...
|
||||||
LL | t: T,
|
LL | t: T,
|
||||||
| - ...if indirection was used here: `Box<T>`
|
| - ...if indirection were used here: `Box<T>`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -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
|
--> $DIR/adt-param-with-implicit-sized-bound.rs:18:10
|
||||||
|
|
|
|
||||||
LL | struct X<T>(T);
|
LL | struct X<T>(T);
|
||||||
| ^ - ...if indirection was used here: `Box<T>`
|
| ^ - ...if indirection were used here: `Box<T>`
|
||||||
| |
|
| |
|
||||||
| this could be changed to `T: ?Sized`...
|
| 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<T>{
|
LL | struct Struct3<T>{
|
||||||
| ^ this could be changed to `T: ?Sized`...
|
| ^ this could be changed to `T: ?Sized`...
|
||||||
LL | _t: T,
|
LL | _t: T,
|
||||||
| - ...if indirection was used here: `Box<T>`
|
| - ...if indirection were used here: `Box<T>`
|
||||||
help: consider further restricting `Self`
|
help: consider further restricting `Self`
|
||||||
|
|
|
|
||||||
LL | fn func3() -> Struct3<Self> where Self: Sized;
|
LL | fn func3() -> Struct3<Self> where Self: Sized;
|
||||||
|
|
|
@ -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
|
--> $DIR/unsized-enum.rs:4:10
|
||||||
|
|
|
|
||||||
LL | enum Foo<U> { FooSome(U), FooNone }
|
LL | enum Foo<U> { FooSome(U), FooNone }
|
||||||
| ^ - ...if indirection was used here: `Box<U>`
|
| ^ - ...if indirection were used here: `Box<U>`
|
||||||
| |
|
| |
|
||||||
| this could be changed to `U: ?Sized`...
|
| this could be changed to `U: ?Sized`...
|
||||||
|
|
||||||
|
|
|
@ -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
|
--> $DIR/unsized-inherent-impl-self-type.rs:5:11
|
||||||
|
|
|
|
||||||
LL | struct S5<Y>(Y);
|
LL | struct S5<Y>(Y);
|
||||||
| ^ - ...if indirection was used here: `Box<Y>`
|
| ^ - ...if indirection were used here: `Box<Y>`
|
||||||
| |
|
| |
|
||||||
| this could be changed to `Y: ?Sized`...
|
| this could be changed to `Y: ?Sized`...
|
||||||
|
|
||||||
|
|
|
@ -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
|
--> $DIR/unsized-struct.rs:4:12
|
||||||
|
|
|
|
||||||
LL | struct Foo<T> { data: T }
|
LL | struct Foo<T> { data: T }
|
||||||
| ^ - ...if indirection was used here: `Box<T>`
|
| ^ - ...if indirection were used here: `Box<T>`
|
||||||
| |
|
| |
|
||||||
| this could be changed to `T: ?Sized`...
|
| this could be changed to `T: ?Sized`...
|
||||||
|
|
||||||
|
|
|
@ -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
|
--> $DIR/unsized-trait-impl-self-type.rs:8:11
|
||||||
|
|
|
|
||||||
LL | struct S5<Y>(Y);
|
LL | struct S5<Y>(Y);
|
||||||
| ^ - ...if indirection was used here: `Box<Y>`
|
| ^ - ...if indirection were used here: `Box<Y>`
|
||||||
| |
|
| |
|
||||||
| this could be changed to `Y: ?Sized`...
|
| this could be changed to `Y: ?Sized`...
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ help: you could relax the implicit `Sized` bound on `T` if it were used through
|
||||||
LL | struct Vec<T> {
|
LL | struct Vec<T> {
|
||||||
| ^ this could be changed to `T: ?Sized`...
|
| ^ this could be changed to `T: ?Sized`...
|
||||||
LL | t: T,
|
LL | t: T,
|
||||||
| - ...if indirection was used here: `Box<T>`
|
| - ...if indirection were used here: `Box<T>`
|
||||||
|
|
||||||
error[E0038]: the trait `Copy` cannot be made into an object
|
error[E0038]: the trait `Copy` cannot be made into an object
|
||||||
--> $DIR/wf-fn-where-clause.rs:12:16
|
--> $DIR/wf-fn-where-clause.rs:12:16
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue