Skip to content
Permalink
Browse files

Reword E0392 slightly

Make it clearer that a type or lifetime argument not being used can be
fixed by referencing it in a struct's fields, not just using `PhathomData`.
  • Loading branch information...
estebank committed Sep 30, 2019
1 parent 18f00b9 commit 5cbe6aa6ca1612344b1ac19ec473b585e00ad022
@@ -999,11 +999,16 @@ fn report_bivariance(tcx: TyCtxt<'_>, span: Span, param_name: ast::Name) {

let suggested_marker_id = tcx.lang_items().phantom_data();
// Help is available only in presence of lang items.
if let Some(def_id) = suggested_marker_id {
err.help(&format!("consider removing `{}` or using a marker such as `{}`",
param_name,
tcx.def_path_str(def_id)));
}
let msg = if let Some(def_id) = suggested_marker_id {
format!(
"consider removing `{}`, refering to it in a field or using a marker such as `{}`",
param_name,
tcx.def_path_str(def_id),
)
} else {
format!( "consider removing `{}` or refering to it in a field", param_name)
};
err.help(&msg);
err.emit();
}

@@ -18,7 +18,7 @@ error[E0392]: parameter `T` is never used
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ unused parameter
|
= help: consider removing `T` or using a marker such as `std::marker::PhantomData`
= help: consider removing `T`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 2 previous errors

@@ -4,7 +4,7 @@ error[E0392]: parameter `T` is never used
LL | enum Foo<T> { Bar }
| ^ unused parameter
|
= help: consider removing `T` or using a marker such as `std::marker::PhantomData`
= help: consider removing `T`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to previous error

@@ -14,7 +14,7 @@ error[E0392]: parameter `T` is never used
LL | enum Bar<T> { What }
| ^ unused parameter
|
= help: consider removing `T` or using a marker such as `std::marker::PhantomData`
= help: consider removing `T`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 2 previous errors

@@ -4,7 +4,7 @@ error[E0392]: parameter `T` is never used
LL | struct Foo<T> where T: Copy;
| ^ unused parameter
|
= help: consider removing `T` or using a marker such as `std::marker::PhantomData`
= help: consider removing `T`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to previous error

@@ -4,7 +4,7 @@ error[E0392]: parameter `T` is never used
LL | struct NoData<T>;
| ^ unused parameter
|
= help: consider removing `T` or using a marker such as `std::marker::PhantomData`
= help: consider removing `T`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo`
--> $DIR/issue-20413.rs:8:1
@@ -4,15 +4,15 @@ error[E0392]: parameter `'a` is never used
LL | struct Foo<'a, A> {}
| ^^ unused parameter
|
= help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
= help: consider removing `'a`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error[E0392]: parameter `A` is never used
--> $DIR/issue-36299.rs:1:16
|
LL | struct Foo<'a, A> {}
| ^ unused parameter
|
= help: consider removing `A` or using a marker such as `std::marker::PhantomData`
= help: consider removing `A`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 2 previous errors

@@ -16,7 +16,7 @@ error[E0392]: parameter `Self` is never used
LL | struct Foo<Self>(Self);
| ^^^^ unused parameter
|
= help: consider removing `Self` or using a marker such as `std::marker::PhantomData`
= help: consider removing `Self`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 3 previous errors

@@ -20,7 +20,7 @@ error[E0392]: parameter `T` is never used
LL | struct Foo<T: ?Hash> { }
| ^ unused parameter
|
= help: consider removing `T` or using a marker such as `std::marker::PhantomData`
= help: consider removing `T`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 2 previous errors

@@ -27,7 +27,7 @@ error[E0392]: parameter `'c` is never used
LL | struct Foo<'a,'b,'c> {
| ^^ unused parameter
|
= help: consider removing `'c` or using a marker such as `std::marker::PhantomData`
= help: consider removing `'c`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 3 previous errors

@@ -76,7 +76,7 @@ error[E0392]: parameter `'Self` is never used
LL | struct Bar<'Self>;
| ^^^^^ unused parameter
|
= help: consider removing `'Self` or using a marker such as `std::marker::PhantomData`
= help: consider removing `'Self`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 12 previous errors

@@ -4,15 +4,15 @@ error[E0392]: parameter `'a` is never used
LL | struct Bivariant<'a>;
| ^^ unused parameter
|
= help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
= help: consider removing `'a`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error[E0392]: parameter `'d` is never used
--> $DIR/variance-regions-unused-direct.rs:7:19
|
LL | struct Struct<'a, 'd> {
| ^^ unused parameter
|
= help: consider removing `'d` or using a marker such as `std::marker::PhantomData`
= help: consider removing `'d`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 2 previous errors

@@ -4,15 +4,15 @@ error[E0392]: parameter `'a` is never used
LL | enum Foo<'a> {
| ^^ unused parameter
|
= help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
= help: consider removing `'a`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error[E0392]: parameter `'a` is never used
--> $DIR/variance-regions-unused-indirect.rs:7:10
|
LL | enum Bar<'a> {
| ^^ unused parameter
|
= help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
= help: consider removing `'a`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 2 previous errors

@@ -4,15 +4,15 @@ error[E0392]: parameter `'a` is never used
LL | struct SomeStruct<'a> { x: u32 }
| ^^ unused parameter
|
= help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
= help: consider removing `'a`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error[E0392]: parameter `'a` is never used
--> $DIR/variance-unused-region-param.rs:4:15
|
LL | enum SomeEnum<'a> { Nothing }
| ^^ unused parameter
|
= help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
= help: consider removing `'a`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 2 previous errors

@@ -4,23 +4,23 @@ error[E0392]: parameter `A` is never used
LL | struct SomeStruct<A> { x: u32 }
| ^ unused parameter
|
= help: consider removing `A` or using a marker such as `std::marker::PhantomData`
= help: consider removing `A`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error[E0392]: parameter `A` is never used
--> $DIR/variance-unused-type-param.rs:9:15
|
LL | enum SomeEnum<A> { Nothing }
| ^ unused parameter
|
= help: consider removing `A` or using a marker such as `std::marker::PhantomData`
= help: consider removing `A`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error[E0392]: parameter `T` is never used
--> $DIR/variance-unused-type-param.rs:13:15
|
LL | enum ListCell<T> {
| ^ unused parameter
|
= help: consider removing `T` or using a marker such as `std::marker::PhantomData`
= help: consider removing `T`, refering to it in a field or using a marker such as `std::marker::PhantomData`

error: aborting due to 3 previous errors

0 comments on commit 5cbe6aa

Please sign in to comment.
You can’t perform that action at this time.