Skip to content

Commit c40eded

Browse files
Downgrade IMPLIED_BOUNDS_ENTAILMENT to warn by default, add it to builtin lint list
1 parent 9c4cf8d commit c40eded

5 files changed

+21
-30
lines changed

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3311,6 +3311,7 @@ declare_lint_pass! {
33113311
FFI_UNWIND_CALLS,
33123312
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS,
33133313
NAMED_ARGUMENTS_USED_POSITIONALLY,
3314+
IMPLIED_BOUNDS_ENTAILMENT,
33143315
]
33153316
}
33163317

@@ -4027,15 +4028,15 @@ declare_lint! {
40274028
/// ### Explanation
40284029
///
40294030
/// Neither the trait method, which provides no implied bounds about `'s`, nor the impl,
4030-
/// which can't name `'s`, requires the main function to prove that 's: 'static, but the
4031-
/// impl method is able to assume that 's: 'static within its own body.
4031+
/// requires the main function to prove that 's: 'static, but the impl method is allowed
4032+
/// to assume that `'s: 'static` within its own body.
40324033
///
40334034
/// This can be used to implement an unsound API if used incorrectly.
40344035
pub IMPLIED_BOUNDS_ENTAILMENT,
4035-
Deny,
4036+
Warn,
40364037
"impl method assumes more implied bounds than its corresponding trait method",
40374038
@future_incompatible = FutureIncompatibleInfo {
40384039
reference: "issue #105572 <https://github.com/rust-lang/rust/issues/105572>",
4039-
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
4040+
reason: FutureIncompatibilityReason::FutureReleaseError,
40404041
};
40414042
}

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

Lines changed: 2 additions & 0 deletions
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
}
Lines changed: 6 additions & 13 deletions
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

Lines changed: 2 additions & 0 deletions
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> {
Lines changed: 6 additions & 13 deletions
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)