Skip to content

Commit 70d081e

Browse files
Downgrade IMPLIED_BOUNDS_ENTAILMENT to warn by default, add it to builtin lint list
1 parent 600b027 commit 70d081e

5 files changed

+21
-30
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -3270,6 +3270,7 @@ declare_lint_pass! {
32703270
FFI_UNWIND_CALLS,
32713271
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS,
32723272
NAMED_ARGUMENTS_USED_POSITIONALLY,
3273+
IMPLIED_BOUNDS_ENTAILMENT,
32733274
]
32743275
}
32753276

@@ -3986,15 +3987,15 @@ declare_lint! {
39863987
/// ### Explanation
39873988
///
39883989
/// Neither the trait method, which provides no implied bounds about `'s`, nor the impl,
3989-
/// which can't name `'s`, requires the main function to prove that 's: 'static, but the
3990-
/// impl method is able to assume that 's: 'static within its own body.
3990+
/// requires the main function to prove that 's: 'static, but the impl method is allowed
3991+
/// to assume that `'s: 'static` within its own body.
39913992
///
39923993
/// This can be used to implement an unsound API if used incorrectly.
39933994
pub IMPLIED_BOUNDS_ENTAILMENT,
3994-
Deny,
3995+
Warn,
39953996
"impl method assumes more implied bounds than its corresponding trait method",
39963997
@future_incompatible = FutureIncompatibleInfo {
39973998
reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>",
3998-
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
3999+
reason: FutureIncompatibilityReason::FutureReleaseError,
39994000
};
40004001
}

src/test/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(implied_bounds_entailment)]
2+
13
trait Project {
24
type Ty;
35
}
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
error: impl method assumes more implied bounds than the corresponding trait method
2-
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5
2+
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:13:5
33
|
44
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
88
= note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572>
9-
= note: `#[deny(implied_bounds_entailment)]` on by default
9+
note: the lint level is defined here
10+
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:1:9
11+
|
12+
LL | #![deny(implied_bounds_entailment)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1014

1115
error: aborting due to previous error
1216

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

src/test/ui/implied-bounds/impl-implied-bounds-compatibility.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(implied_bounds_entailment)]
2+
13
use std::cell::RefCell;
24

35
pub struct MessageListeners<'a> {
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
error: impl method assumes more implied bounds than the corresponding trait method
2-
--> $DIR/impl-implied-bounds-compatibility.rs:12:5
2+
--> $DIR/impl-implied-bounds-compatibility.rs:14:5
33
|
44
LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
88
= note: for more information, see issue #105572 <https://github.com/rust-lang/rust/issues/105572>
9-
= note: `#[deny(implied_bounds_entailment)]` on by default
9+
note: the lint level is defined here
10+
--> $DIR/impl-implied-bounds-compatibility.rs:1:9
11+
|
12+
LL | #![deny(implied_bounds_entailment)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1014

1115
error: aborting due to previous error
1216

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

0 commit comments

Comments
 (0)