Skip to content

Commit 8fe7865

Browse files
committed
Remove FromResidual param default
1 parent 4056082 commit 8fe7865

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

compiler/rustc_middle/src/mir/interpret/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ impl<'tcx, T> ops::Residual<T> for InterpResult<'tcx, convert::Infallible> {
817817
type TryType = InterpResult<'tcx, T>;
818818
}
819819

820-
impl<'tcx, T> ops::FromResidual for InterpResult<'tcx, T> {
820+
impl<'tcx, T> ops::FromResidual<InterpResult<'tcx, convert::Infallible>> for InterpResult<'tcx, T> {
821821
#[inline]
822822
#[track_caller]
823823
fn from_residual(residual: InterpResult<'tcx, convert::Infallible>) -> Self {

library/core/src/ops/try_trait.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ use crate::ops::ControlFlow;
129129
#[doc(alias = "?")]
130130
#[lang = "Try"]
131131
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
132-
pub const trait Try: [const] FromResidual {
132+
pub const trait Try: [const] FromResidual<Self::Residual> {
133133
/// The type of the value produced by `?` when *not* short-circuiting.
134134
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
135135
type Output;
@@ -306,7 +306,7 @@ pub const trait Try: [const] FromResidual {
306306
#[rustc_diagnostic_item = "FromResidual"]
307307
#[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")]
308308
#[rustc_const_unstable(feature = "const_try", issue = "74935")]
309-
pub const trait FromResidual<R = <Self as Try>::Residual> {
309+
pub const trait FromResidual<R> {
310310
/// Constructs the type from a compatible `Residual` type.
311311
///
312312
/// This should be implemented consistently with the `branch` method such
@@ -416,7 +416,7 @@ impl<T> Try for NeverShortCircuit<T> {
416416
}
417417
}
418418

419-
impl<T> FromResidual for NeverShortCircuit<T> {
419+
impl<T> FromResidual<NeverShortCircuitResidual> for NeverShortCircuit<T> {
420420
#[inline]
421421
fn from_residual(never: NeverShortCircuitResidual) -> Self {
422422
match never {}

tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use std::ops::FromResidual;
55

6-
impl<T> const FromResidual for T {
6+
impl<T> const FromResidual<T> for T {
77
//~^ ERROR type parameter `T` must be used as the type parameter for some local type
88
fn from_residual(t: T) -> _ {
99
//~^ ERROR the placeholder `_` is not allowed

tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
22
--> $DIR/ice-119717-constant-lifetime.rs:6:6
33
|
4-
LL | impl<T> const FromResidual for T {
4+
LL | impl<T> const FromResidual<T> for T {
55
| ^ type parameter `T` must be used as the type parameter for some local type
66
|
77
= note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local

tests/ui/traits/const-traits/trait-default-body-stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl const Try for T {
3131

3232
#[stable(feature = "foo", since = "1.0")]
3333
#[rustc_const_unstable(feature = "const_t_try", issue = "none")]
34-
impl const FromResidual for T {
34+
impl const FromResidual<T> for T {
3535
fn from_residual(t: T) -> T {
3636
t
3737
}

0 commit comments

Comments
 (0)