Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest minimal subset features in incomplete_features lint #77925

Merged
merged 1 commit into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2288,12 +2288,20 @@ impl EarlyLintPass for IncompleteFeatures {
n, n,
));
}
if HAS_MIN_FEATURES.contains(&name) {
builder.help(&format!(
"consider using `min_{}` instead, which is more stable and complete",
name,
));
}
builder.emit();
})
});
}
}

const HAS_MIN_FEATURES: &[Symbol] = &[sym::const_generics, sym::specialization];

declare_lint! {
/// The `invalid_value` lint detects creating a value that is not valid,
/// such as a NULL reference.
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/array-slice-vec/match_arr_unknown_len.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error[E0308]: mismatched types
--> $DIR/match_arr_unknown_len.rs:6:9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(associated_type_defaults, specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0053]: method `make` has an incompatible type for trait
--> $DIR/defaults-specialization.rs:19:18
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/binding/const-param.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error[E0158]: const parameters cannot be referenced in patterns
--> $DIR/const-param.rs:7:9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0391]: cycle detected when building specialization graph of trait `Trait`
--> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:9:1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error: aborting due to previous error; 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/const-generics/issues/issue-56445.full.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error[E0771]: use of non-static lifetime `'a` in const generic
--> $DIR/issue-56445.rs:9:26
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

warning: 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

warning: 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/issue-61336-2.rs:10:5
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/const-generics/issues/issue-61336.full.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/issue-61336.rs:10:5
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/const-generics/issues/issue-61422.full.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/const-generics/issues/issue-61432.full.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/const-generics/issues/issue-61747.full.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error: constant expression depends on a generic parameter
--> $DIR/issue-61747.rs:8:23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error: constant expression depends on a generic parameter
--> $DIR/unify-fixpoint.rs:9:32
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/consts/trait_specialization.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/error-codes/E0520.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0520]: `fly` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/E0520.rs:17:5
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/error-codes/E0730.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error[E0730]: cannot pattern-match on an array without a fixed length
--> $DIR/E0730.rs:6:9
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/error-codes/E0771.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error[E0771]: use of non-static lifetime `'a` in const generic
--> $DIR/E0771.rs:4:41
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/hygiene/generic_params.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(decl_macro, rustc_attrs, const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/hygiene/issue-61574-const-parameters.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/impl-trait/equality-rpass.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/impl-trait/equality.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0308]: mismatched types
--> $DIR/equality.rs:15:5
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/impl-trait/equality2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0308]: mismatched types
--> $DIR/equality2.rs:25:18
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/issues/issue-35376.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/issues/issue-55380.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/issues/issue-59508-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error: aborting due to previous error; 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/parser/assoc-static-semantic-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error: aborting due to 24 previous errors; 1 warning emitted

Expand Down
1 change: 1 addition & 0 deletions src/test/ui/parser/default.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0046]: not all trait items implemented, missing: `foo`
--> $DIR/default.rs:22:1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error: aborting due to 6 previous errors; 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(const_generics, rustc_attrs)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error: item has unused generic parameters
--> $DIR/closures.rs:19:19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(const_generics, rustc_attrs)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error: item has unused generic parameters
--> $DIR/functions.rs:15:8
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/polymorphization/generators.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(const_generics, generators, generator_trait, rustc_attrs)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error: item has unused generic parameters
--> $DIR/generators.rs:36:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

error: aborting due to 5 previous errors; 1 warning emitted

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ LL | #![feature(const_generics)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
= help: consider using `min_const_generics` instead, which is more stable and complete

warning: the feature `let_chains` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/disallowed-positions.rs:22:12
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/specialization/assoc-ty-graph-cycle.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/specialization/cross-crate-defaults.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0277]: the trait bound `str: Clone` is not satisfied
--> $DIR/deafult-associated-type-bound-1.rs:19:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0277]: can't compare `&'static B` with `B`
--> $DIR/deafult-associated-type-bound-2.rs:16:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/deafult-generic-associated-type-bound.rs:4:12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/specialization/defaultimpl/out-of-order.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

1 change: 1 addition & 0 deletions src/test/ui/specialization/defaultimpl/projection.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/specialization-no-default.rs:20:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

warning: 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LL | #![feature(specialization)]
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete

error[E0046]: not all trait items implemented, missing: `foo_two`
--> $DIR/specialization-trait-item-not-implemented.rs:18:1
Expand Down
Loading