-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Make IMPLIED_BOUNDS_ENTAILMENT
into a hard error from a lint
#117984
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
Merged
bors
merged 2 commits into
rust-lang:master
from
compiler-errors:implied-bounds-entailment
Dec 16, 2023
+95
−299
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 20 additions & 23 deletions
43
tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
error: impl method assumes more implied bounds than the corresponding trait method | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:13:31 | ||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 's in generic type due to conflicting requirements | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 | ||
| | ||
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this type to make the impl signature compatible: `()` | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= 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: the lint level is defined here | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:1:9 | ||
| | ||
LL | #![deny(implied_bounds_entailment)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 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:13:31 | ||
note: first, the lifetime cannot outlive the lifetime `'s` as defined here... | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:12 | ||
| | ||
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this type to make the impl signature compatible: `()` | ||
| ^^ | ||
note: ...so that the method type is compatible with trait | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 | ||
| | ||
= 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: the lint level is defined here | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:1:9 | ||
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: expected `fn(&'s _, ()) -> &'static _` | ||
found `fn(&_, ()) -> &'static _` | ||
= note: but, the lifetime must be valid for the static lifetime... | ||
note: ...so that the reference type `&'static &()` does not outlive the data it points at | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 | ||
| | ||
LL | #![deny(implied_bounds_entailment)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0495`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 23 additions & 22 deletions
45
tests/ui/implied-bounds/impl-implied-bounds-compatibility.stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
error: impl method assumes more implied bounds than the corresponding trait method | ||
--> $DIR/impl-implied-bounds-compatibility.rs:14:35 | ||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'b in generic type due to conflicting requirements | ||
--> $DIR/impl-implied-bounds-compatibility.rs:12:5 | ||
| | ||
LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this type to make the impl signature compatible: `&'b 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: the lint level is defined here | ||
--> $DIR/impl-implied-bounds-compatibility.rs:1:9 | ||
note: first, the lifetime cannot outlive the lifetime `'c` as defined here... | ||
--> $DIR/impl-implied-bounds-compatibility.rs:12:5 | ||
| | ||
LL | #![deny(implied_bounds_entailment)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 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:14:35 | ||
LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...so that the method type is compatible with trait | ||
--> $DIR/impl-implied-bounds-compatibility.rs:12:5 | ||
| | ||
LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this type to make the impl signature compatible: `&'b MessageListeners<'b>` | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: expected `fn(&'c MessageListeners<'_>) -> &'c MessageListeners<'c>` | ||
found `fn(&MessageListeners<'_>) -> &'a MessageListeners<'_>` | ||
note: but, the lifetime must be valid for the lifetime `'a` as defined here... | ||
--> $DIR/impl-implied-bounds-compatibility.rs:11:6 | ||
| | ||
= 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: the lint level is defined here | ||
--> $DIR/impl-implied-bounds-compatibility.rs:1:9 | ||
LL | impl<'a> MessageListenersInterface for MessageListeners<'a> { | ||
| ^^ | ||
note: ...so that the reference type `&'a MessageListeners<'_>` does not outlive the data it points at | ||
--> $DIR/impl-implied-bounds-compatibility.rs:12:5 | ||
| | ||
LL | #![deny(implied_bounds_entailment)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0495`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
Future incompatibility report: Future breakage diagnostic: | ||
warning: impl method assumes more implied bounds than the corresponding trait method | ||
--> $DIR/resolve-re-error-ice.rs:17:16 | ||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements | ||
--> $DIR/resolve-re-error-ice.rs:12:5 | ||
| | ||
LL | fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> { | ||
| ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this type to make the impl signature compatible: `Subject<'_, std::collections::hash_map::Keys<'_, K, V>, (), R>` | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= 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: the lint level is defined here | ||
--> $DIR/resolve-re-error-ice.rs:4:10 | ||
note: first, the lifetime cannot outlive the anonymous lifetime defined here... | ||
--> $DIR/resolve-re-error-ice.rs:5:16 | ||
| | ||
LL | #![allow(implied_bounds_entailment)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | fn key_set(&self) -> Subject<Keys<K, V>, (), R>; | ||
| ^^^^^ | ||
note: ...so that the method type is compatible with trait | ||
--> $DIR/resolve-re-error-ice.rs:12:5 | ||
| | ||
LL | fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: expected `fn(&Subject<'_, _, _, _>) -> Subject<'_, std::collections::hash_map::Keys<'_, _, _>, _, _>` | ||
found `fn(&Subject<'_, _, _, _>) -> Subject<'a, std::collections::hash_map::Keys<'_, _, _>, _, _>` | ||
note: but, the lifetime must be valid for the lifetime `'a` as defined here... | ||
--> $DIR/resolve-re-error-ice.rs:10:6 | ||
| | ||
LL | impl<'a, K, V, R> MapAssertion<'a, K, V, R> for Subject<'a, HashMap<K, V>, (), R> | ||
| ^^ | ||
note: ...so that the type `std::collections::hash_map::Keys<'_, K, V>` will meet its required lifetime bounds... | ||
--> $DIR/resolve-re-error-ice.rs:12:5 | ||
| | ||
LL | fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...that is required by this bound | ||
--> $DIR/resolve-re-error-ice.rs:8:29 | ||
| | ||
LL | struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0495`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't
tainted_by_errors
always beNone
, given that we return in caseselect_all_or_error
failed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk, astconv might taint the infcx or something. I didn't want to unwrap here, avoids an unnecessary ICE for no cost.