-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Constify Try, From, TryFrom and relevant traits #143768
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
base: master
Are you sure you want to change the base?
Conversation
r? @davidtwco rustbot has assigned @davidtwco. Use |
This comment has been minimized.
This comment has been minimized.
The job Click to see the possible cause of the failure (guessed by this bot)
|
I can reproduce the fail locally but I do not understand why it happens and how it is related to the changes. |
☔ The latest upstream changes (presumably #143888) made this pull request unmergeable. Please resolve the merge conflicts. |
@@ -1,11 +1,11 @@ | |||
// The `?` operator is still not const-evaluatable because it calls `From::from` on the error | |||
// variant. | |||
//@ run-pass |
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.
This should not be run-pass
, it doesn't have anything in its main function. It could be check-pass
, but you'll still need more feature gates to make it compile
where | ||
T: Clone, | ||
T: ~const Clone + ~const Destruct, |
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.
~const Destruct
is a where bound on the clone_from
method
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.
If I put
fn clone_from(&mut self, source: &Self)
where T: ~const Destruct
instead, I get
error[E0276]: impl has stricter requirements than trait
--> library/core/src/option.rs:2161:55
|
2161 | fn clone_from(&mut self, source: &Self) where T: ~const Destruct {
| ^^^^^^^^^^^^^^^ impl has extra requirement `T: [const] Destruct`
|
::: library/core/src/clone.rs:213:5
|
213 | / fn clone_from(&mut self, source: &Self)
214 | | where
215 | | Self: ~const Destruct,
| |______________________________- definition of `clone_from` from trait
@@ -198,7 +198,8 @@ impl Error for TryFromSliceError { | |||
} | |||
|
|||
#[stable(feature = "try_from_slice_error", since = "1.36.0")] | |||
impl From<Infallible> for TryFromSliceError { | |||
#[rustc_const_unstable(feature = "const_trait_impl", issue = "67792")] |
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.
#[rustc_const_unstable(feature = "const_trait_impl", issue = "67792")] | |
#[rustc_const_unstable(feature = "const_try", issue = "74935")] |
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.
Should I put everything in this PR under that feature?
No description provided.