1
Fork 0

Downgrade IMPLIED_BOUNDS_ENTAILMENT to warn by default, add it to builtin lint list

This commit is contained in:
Michael Goulet 2022-12-16 19:30:32 +00:00
parent 9c4cf8d9d0
commit c40ededa10
5 changed files with 21 additions and 30 deletions

View file

@ -3311,6 +3311,7 @@ declare_lint_pass! {
FFI_UNWIND_CALLS, FFI_UNWIND_CALLS,
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS, REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS,
NAMED_ARGUMENTS_USED_POSITIONALLY, NAMED_ARGUMENTS_USED_POSITIONALLY,
IMPLIED_BOUNDS_ENTAILMENT,
] ]
} }
@ -4027,15 +4028,15 @@ declare_lint! {
/// ### Explanation /// ### Explanation
/// ///
/// Neither the trait method, which provides no implied bounds about `'s`, nor the impl, /// Neither the trait method, which provides no implied bounds about `'s`, nor the impl,
/// which can't name `'s`, requires the main function to prove that 's: 'static, but the /// requires the main function to prove that 's: 'static, but the impl method is allowed
/// impl method is able to assume that 's: 'static within its own body. /// to assume that `'s: 'static` within its own body.
/// ///
/// This can be used to implement an unsound API if used incorrectly. /// This can be used to implement an unsound API if used incorrectly.
pub IMPLIED_BOUNDS_ENTAILMENT, pub IMPLIED_BOUNDS_ENTAILMENT,
Deny, Warn,
"impl method assumes more implied bounds than its corresponding trait method", "impl method assumes more implied bounds than its corresponding trait method",
@future_incompatible = FutureIncompatibleInfo { @future_incompatible = FutureIncompatibleInfo {
reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>", reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>",
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow, reason: FutureIncompatibilityReason::FutureReleaseError,
}; };
} }

View file

@ -1,3 +1,5 @@
#![deny(implied_bounds_entailment)]
trait Project { trait Project {
type Ty; type Ty;
} }

View file

@ -1,23 +1,16 @@
error: impl method assumes more implied bounds than the corresponding trait method error: impl method assumes more implied bounds than the corresponding trait method
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 --> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:13:5
| |
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572> = note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572>
= note: `#[deny(implied_bounds_entailment)]` on by default note: the lint level is defined here
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:1:9
|
LL | #![deny(implied_bounds_entailment)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error
Future incompatibility report: Future breakage diagnostic:
error: impl method assumes more implied bounds than the corresponding trait method
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5
|
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572>
= note: `#[deny(implied_bounds_entailment)]` on by default

View file

@ -1,3 +1,5 @@
#![deny(implied_bounds_entailment)]
use std::cell::RefCell; use std::cell::RefCell;
pub struct MessageListeners<'a> { pub struct MessageListeners<'a> {

View file

@ -1,23 +1,16 @@
error: impl method assumes more implied bounds than the corresponding trait method error: impl method assumes more implied bounds than the corresponding trait method
--> $DIR/impl-implied-bounds-compatibility.rs:12:5 --> $DIR/impl-implied-bounds-compatibility.rs:14:5
| |
LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572> = note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572>
= note: `#[deny(implied_bounds_entailment)]` on by default note: the lint level is defined here
--> $DIR/impl-implied-bounds-compatibility.rs:1:9
|
LL | #![deny(implied_bounds_entailment)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error
Future incompatibility report: Future breakage diagnostic:
error: impl method assumes more implied bounds than the corresponding trait method
--> $DIR/impl-implied-bounds-compatibility.rs:12:5
|
LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572>
= note: `#[deny(implied_bounds_entailment)]` on by default