Skip to content

Commit 53db8a8

Browse files
committed
Rename TryCore to Bubble
1 parent 0b12d0d commit 53db8a8

24 files changed

+84
-84
lines changed

library/core/src/iter/traits/iterator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,8 +2460,8 @@ pub trait Iterator {
24602460
}
24612461

24622462
match self.try_fold((), check(f)) {
2463-
ControlFlow::Continue(()) => ops::TryCore::continue_with(None),
2464-
ControlFlow::Break(Ok(x)) => ops::TryCore::continue_with(Some(x)),
2463+
ControlFlow::Continue(()) => ops::Bubble::continue_with(None),
2464+
ControlFlow::Break(Ok(x)) => ops::Bubble::continue_with(Some(x)),
24652465
ControlFlow::Break(Err(h)) => Try::from_holder(h),
24662466
}
24672467
}

library/core/src/ops/control_flow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<B, C> ops::Try2015 for ControlFlow<B, C> {
8484
}
8585

8686
#[unstable(feature = "try_trait_v2", issue = "42327")]
87-
impl<B, C> ops::TryCore for ControlFlow<B, C> {
87+
impl<B, C> ops::Bubble for ControlFlow<B, C> {
8888
//type Continue = C;
8989
type Ok = C;
9090
type Holder = ControlFlow<B, !>;

library/core/src/ops/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub use self::range::{Bound, RangeBounds, RangeInclusive, RangeToInclusive};
185185
pub use self::r#try::Try2015;
186186

187187
#[unstable(feature = "try_trait_v2", issue = "42327")]
188-
pub use self::r#try::{BreakHolder, Try2021, TryCore};
188+
pub use self::r#try::{BreakHolder, Try2021, Bubble};
189189

190190
#[cfg(bootstrap)]
191191
#[unstable(feature = "try_trait_v2", issue = "42327")]

library/core/src/ops/try.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,19 @@ pub trait Try2015 {
7373
all(from_method = "continue_with", from_desugaring = "QuestionMark"),
7474
message = "the `?` operator can only be used in {ItemContext} \
7575
that returns `Result` or `Option` \
76-
(or another type that implements `{TryCore}`)",
76+
(or another type that implements `{Bubble}`)",
7777
label = "cannot use the `?` operator in {ItemContext} that returns `{Self}`",
7878
enclosing_scope = "this function should return `Result` or `Option` to accept `?`"
7979
),
8080
on(
8181
all(from_method = "branch", from_desugaring = "QuestionMark"),
8282
message = "the `?` operator can only be applied to values \
83-
that implement `{TryCore}`",
83+
that implement `{Bubble}`",
8484
label = "the `?` operator cannot be applied to type `{Self}`"
8585
)
8686
)]
8787
#[unstable(feature = "try_trait_v2", issue = "42327")]
88-
pub trait TryCore {
88+
pub trait Bubble {
8989
/// The type of the value consumed or produced when not short-circuiting.
9090
#[unstable(feature = "try_trait_v2", issue = "42327")]
9191
// Temporarily using `Ok` still so I don't need to change the bounds in the library
@@ -119,8 +119,8 @@ pub trait TryCore {
119119
Self: Try2021,
120120
Self::Holder: BreakHolder<T>,
121121
{
122-
match TryCore::branch(self) {
123-
ControlFlow::Continue(c) => TryCore::continue_with(f(c)),
122+
match Bubble::branch(self) {
123+
ControlFlow::Continue(c) => Bubble::continue_with(f(c)),
124124
//ControlFlow::Break(h) => BreakHolder::<T>::expand(h),
125125
ControlFlow::Break(h) => Try2021::from_holder(h),
126126
}
@@ -157,7 +157,7 @@ pub trait BreakHolder<T>: Sized {
157157
enclosing_scope = "this function should return `Result` or `Option` to accept `?`"
158158
))]
159159
#[unstable(feature = "try_trait_v2", issue = "42327")]
160-
pub trait Try2021<T = <Self as TryCore>::Holder>: TryCore
160+
pub trait Try2021<T = <Self as Bubble>::Holder>: Bubble
161161
where
162162
T: BreakHolder<Self::Ok>,
163163
{

library/core/src/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ impl<T> ops::Try2015 for Option<T> {
17241724
}
17251725

17261726
#[unstable(feature = "try_trait_v2", issue = "42327")]
1727-
impl<T> ops::TryCore for Option<T> {
1727+
impl<T> ops::Bubble for Option<T> {
17281728
//type Continue = T;
17291729
type Ok = T;
17301730
type Holder = Option<!>;

library/core/src/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ impl<T, E> ops::Try2015 for Result<T, E> {
16121612
}
16131613

16141614
#[unstable(feature = "try_trait_v2", issue = "42327")]
1615-
impl<T, E> ops::TryCore for Result<T, E> {
1615+
impl<T, E> ops::Bubble for Result<T, E> {
16161616
//type Continue = T;
16171617
type Ok = T;
16181618
type Holder = Result<!, E>;

library/core/src/task/poll.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ impl<T, E> ops::Try2015 for Poll<Result<T, E>> {
153153
}
154154

155155
#[unstable(feature = "try_trait_v2", issue = "42327")]
156-
impl<T, E> ops::TryCore for Poll<Result<T, E>> {
156+
impl<T, E> ops::Bubble for Poll<Result<T, E>> {
157157
//type Continue = Poll<T>;
158158
type Ok = Poll<T>;
159159
//type Holder = PollResultHolder<E>;
160-
type Holder = <Result<T, E> as ops::TryCore>::Holder;
160+
type Holder = <Result<T, E> as ops::Bubble>::Holder;
161161

162162
#[inline]
163163
fn continue_with(c: Self::Ok) -> Self {
@@ -231,11 +231,11 @@ impl<T, E> ops::Try2015 for Poll<Option<Result<T, E>>> {
231231
}
232232

233233
#[unstable(feature = "try_trait_v2", issue = "42327")]
234-
impl<T, E> ops::TryCore for Poll<Option<Result<T, E>>> {
234+
impl<T, E> ops::Bubble for Poll<Option<Result<T, E>>> {
235235
//type Continue = Poll<Option<T>>;
236236
type Ok = Poll<Option<T>>;
237237
//type Holder = PollOptionResultHolder<E>;
238-
type Holder = <Result<T, E> as ops::TryCore>::Holder;
238+
type Holder = <Result<T, E> as ops::Bubble>::Holder;
239239

240240
#[inline]
241241
fn continue_with(c: Self::Ok) -> Self {

src/test/ui/async-await/issue-61076.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ async fn foo() -> Result<(), ()> {
3939
}
4040

4141
async fn bar() -> Result<(), ()> {
42-
foo()?; //~ ERROR the `?` operator can only be applied to values that implement `TryCore`
42+
foo()?; //~ ERROR the `?` operator can only be applied to values that implement `Bubble`
4343
//~^ NOTE the `?` operator cannot be applied to type `impl Future`
44-
//~| HELP the trait `TryCore` is not implemented for `impl Future`
44+
//~| HELP the trait `Bubble` is not implemented for `impl Future`
4545
//~| NOTE required by `branch`
4646
//~| NOTE in this expansion of desugaring of operator `?`
4747
//~| NOTE in this expansion of desugaring of operator `?`
@@ -60,9 +60,9 @@ async fn tuple() -> Tuple {
6060

6161
async fn baz() -> Result<(), ()> {
6262
let t = T;
63-
t?; //~ ERROR the `?` operator can only be applied to values that implement `TryCore`
63+
t?; //~ ERROR the `?` operator can only be applied to values that implement `Bubble`
6464
//~^ NOTE the `?` operator cannot be applied to type `T`
65-
//~| HELP the trait `TryCore` is not implemented for `T`
65+
//~| HELP the trait `Bubble` is not implemented for `T`
6666
//~| NOTE required by `branch`
6767
//~| NOTE in this expansion of desugaring of operator `?`
6868
//~| NOTE in this expansion of desugaring of operator `?`

src/test/ui/async-await/issue-61076.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
error[E0277]: the `?` operator can only be applied to values that implement `TryCore`
1+
error[E0277]: the `?` operator can only be applied to values that implement `Bubble`
22
--> $DIR/issue-61076.rs:42:5
33
|
44
LL | foo()?;
55
| ^^^^^^ the `?` operator cannot be applied to type `impl Future`
66
|
7-
= help: the trait `TryCore` is not implemented for `impl Future`
7+
= help: the trait `Bubble` is not implemented for `impl Future`
88
= note: required by `branch`
99

10-
error[E0277]: the `?` operator can only be applied to values that implement `TryCore`
10+
error[E0277]: the `?` operator can only be applied to values that implement `Bubble`
1111
--> $DIR/issue-61076.rs:63:5
1212
|
1313
LL | t?;
1414
| ^^ the `?` operator cannot be applied to type `T`
1515
|
16-
= help: the trait `TryCore` is not implemented for `T`
16+
= help: the trait `Bubble` is not implemented for `T`
1717
= note: required by `branch`
1818

1919
error[E0609]: no field `0` on type `impl Future`

src/test/ui/async-await/try-on-option-in-async.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `Try2021`)
1+
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `Try`)
22
--> $DIR/try-on-option-in-async.rs:8:9
33
|
44
LL | async {
@@ -10,10 +10,10 @@ LL | | 22
1010
LL | | }
1111
| |_____- this function should return `Result` or `Option` to accept `?`
1212
|
13-
= help: the trait `Try2021<Option<!>>` is not implemented for `{integer}`
13+
= help: the trait `Try<Option<!>>` is not implemented for `{integer}`
1414
= note: required by `from_holder`
1515

16-
error[E0277]: the `?` operator can only be used in an async closure that returns `Result` or `Option` (or another type that implements `Try2021`)
16+
error[E0277]: the `?` operator can only be used in an async closure that returns `Result` or `Option` (or another type that implements `Try`)
1717
--> $DIR/try-on-option-in-async.rs:17:9
1818
|
1919
LL | let async_closure = async || {
@@ -25,10 +25,10 @@ LL | | 22_u32
2525
LL | | };
2626
| |_____- this function should return `Result` or `Option` to accept `?`
2727
|
28-
= help: the trait `Try2021<Option<!>>` is not implemented for `u32`
28+
= help: the trait `Try<Option<!>>` is not implemented for `u32`
2929
= note: required by `from_holder`
3030

31-
error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `Try2021`)
31+
error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `Try`)
3232
--> $DIR/try-on-option-in-async.rs:26:5
3333
|
3434
LL | async fn an_async_function() -> u32 {
@@ -40,7 +40,7 @@ LL | | 22
4040
LL | | }
4141
| |_- this function should return `Result` or `Option` to accept `?`
4242
|
43-
= help: the trait `Try2021<Option<!>>` is not implemented for `u32`
43+
= help: the trait `Try<Option<!>>` is not implemented for `u32`
4444
= note: required by `from_holder`
4545

4646
error: aborting due to 3 previous errors

src/test/ui/issues/issue-32709.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): From<{integer}>` is not satisfied
44
LL | Err(5)?;
55
| ^^^^^^^ the trait `From<{integer}>` is not implemented for `()`
66
|
7-
= note: required because of the requirements on the impl of `Try<std::result::Result<!, {integer}>>` for `std::result::Result<i32, ()>`
7+
= note: required because of the requirements on the impl of `Try2021<std::result::Result<!, {integer}>>` for `std::result::Result<i32, ()>`
88
= note: required by `from_holder`
99

1010
error: aborting due to previous error

src/test/ui/question-mark-type-infer.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0283]: type annotations needed
44
LL | l.iter().map(f).collect()?
55
| ^^^^^^^ cannot infer type
66
|
7-
= note: cannot satisfy `_: TryCore`
7+
= note: cannot satisfy `_: Bubble`
88
= note: required by `branch`
99
help: consider specifying the type argument in the method call
1010
|

src/test/ui/rfc-2497-if-let-chains/disallowed-positions.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ fn nested_within_if_expr() {
4040

4141
fn _check_try_binds_tighter() -> Result<(), ()> {
4242
if let 0 = 0? {}
43-
//~^ ERROR the `?` operator can only be applied to values that implement `TryCore`
43+
//~^ ERROR the `?` operator can only be applied to values that implement `Bubble`
4444
Ok(())
4545
}
4646
if (let 0 = 0)? {} //~ ERROR `let` expressions are not supported here
47-
//~^ ERROR the `?` operator can only be applied to values that implement `TryCore`
47+
//~^ ERROR the `?` operator can only be applied to values that implement `Bubble`
4848
//~| ERROR the `?` operator can only be used in a function that returns `Result`
4949

5050
if true || let 0 = 0 {} //~ ERROR `let` expressions are not supported here
@@ -104,11 +104,11 @@ fn nested_within_while_expr() {
104104

105105
fn _check_try_binds_tighter() -> Result<(), ()> {
106106
while let 0 = 0? {}
107-
//~^ ERROR the `?` operator can only be applied to values that implement `TryCore`
107+
//~^ ERROR the `?` operator can only be applied to values that implement `Bubble`
108108
Ok(())
109109
}
110110
while (let 0 = 0)? {} //~ ERROR `let` expressions are not supported here
111-
//~^ ERROR the `?` operator can only be applied to values that implement `TryCore`
111+
//~^ ERROR the `?` operator can only be applied to values that implement `Bubble`
112112
//~| ERROR the `?` operator can only be used in a function that returns `Result`
113113

114114
while true || let 0 = 0 {} //~ ERROR `let` expressions are not supported here
@@ -177,12 +177,12 @@ fn outside_if_and_while_expr() {
177177

178178
fn _check_try_binds_tighter() -> Result<(), ()> {
179179
let 0 = 0?;
180-
//~^ ERROR the `?` operator can only be applied to values that implement `TryCore`
180+
//~^ ERROR the `?` operator can only be applied to values that implement `Bubble`
181181
Ok(())
182182
}
183183
(let 0 = 0)?; //~ ERROR `let` expressions are not supported here
184184
//~^ ERROR the `?` operator can only be used in a function that returns `Result`
185-
//~| ERROR the `?` operator can only be applied to values that implement `TryCore`
185+
//~| ERROR the `?` operator can only be applied to values that implement `Bubble`
186186

187187
true || let 0 = 0; //~ ERROR `let` expressions are not supported here
188188
(true || let 0 = 0); //~ ERROR `let` expressions are not supported here

src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -551,13 +551,13 @@ error[E0600]: cannot apply unary operator `-` to type `bool`
551551
LL | if -let 0 = 0 {}
552552
| ^^^^^^^^^^ cannot apply unary operator `-`
553553

554-
error[E0277]: the `?` operator can only be applied to values that implement `TryCore`
554+
error[E0277]: the `?` operator can only be applied to values that implement `Bubble`
555555
--> $DIR/disallowed-positions.rs:46:8
556556
|
557557
LL | if (let 0 = 0)? {}
558558
| ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
559559
|
560-
= help: the trait `TryCore` is not implemented for `bool`
560+
= help: the trait `Bubble` is not implemented for `bool`
561561
= note: required by `branch`
562562

563563
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `Try2021`)
@@ -709,13 +709,13 @@ LL | if let Range { start: true, end } = t..&&false {}
709709
= note: expected type `bool`
710710
found struct `std::ops::Range<bool>`
711711

712-
error[E0277]: the `?` operator can only be applied to values that implement `TryCore`
712+
error[E0277]: the `?` operator can only be applied to values that implement `Bubble`
713713
--> $DIR/disallowed-positions.rs:42:20
714714
|
715715
LL | if let 0 = 0? {}
716716
| ^^ the `?` operator cannot be applied to type `{integer}`
717717
|
718-
= help: the trait `TryCore` is not implemented for `{integer}`
718+
= help: the trait `Bubble` is not implemented for `{integer}`
719719
= note: required by `branch`
720720

721721
error[E0308]: mismatched types
@@ -739,13 +739,13 @@ error[E0600]: cannot apply unary operator `-` to type `bool`
739739
LL | while -let 0 = 0 {}
740740
| ^^^^^^^^^^ cannot apply unary operator `-`
741741

742-
error[E0277]: the `?` operator can only be applied to values that implement `TryCore`
742+
error[E0277]: the `?` operator can only be applied to values that implement `Bubble`
743743
--> $DIR/disallowed-positions.rs:110:11
744744
|
745745
LL | while (let 0 = 0)? {}
746746
| ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
747747
|
748-
= help: the trait `TryCore` is not implemented for `bool`
748+
= help: the trait `Bubble` is not implemented for `bool`
749749
= note: required by `branch`
750750

751751
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `Try2021`)
@@ -897,13 +897,13 @@ LL | while let Range { start: true, end } = t..&&false {}
897897
= note: expected type `bool`
898898
found struct `std::ops::Range<bool>`
899899

900-
error[E0277]: the `?` operator can only be applied to values that implement `TryCore`
900+
error[E0277]: the `?` operator can only be applied to values that implement `Bubble`
901901
--> $DIR/disallowed-positions.rs:106:23
902902
|
903903
LL | while let 0 = 0? {}
904904
| ^^ the `?` operator cannot be applied to type `{integer}`
905905
|
906-
= help: the trait `TryCore` is not implemented for `{integer}`
906+
= help: the trait `Bubble` is not implemented for `{integer}`
907907
= note: required by `branch`
908908

909909
error[E0614]: type `bool` cannot be dereferenced
@@ -918,13 +918,13 @@ error[E0600]: cannot apply unary operator `-` to type `bool`
918918
LL | -let 0 = 0;
919919
| ^^^^^^^^^^ cannot apply unary operator `-`
920920

921-
error[E0277]: the `?` operator can only be applied to values that implement `TryCore`
921+
error[E0277]: the `?` operator can only be applied to values that implement `Bubble`
922922
--> $DIR/disallowed-positions.rs:183:5
923923
|
924924
LL | (let 0 = 0)?;
925925
| ^^^^^^^^^^^^ the `?` operator cannot be applied to type `bool`
926926
|
927-
= help: the trait `TryCore` is not implemented for `bool`
927+
= help: the trait `Bubble` is not implemented for `bool`
928928
= note: required by `branch`
929929

930930
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `Try2021`)
@@ -965,13 +965,13 @@ LL | fn outside_if_and_while_expr() {
965965
LL | &let 0 = 0
966966
| ^^^^^^^^^^ expected `()`, found `&bool`
967967

968-
error[E0277]: the `?` operator can only be applied to values that implement `TryCore`
968+
error[E0277]: the `?` operator can only be applied to values that implement `Bubble`
969969
--> $DIR/disallowed-positions.rs:179:17
970970
|
971971
LL | let 0 = 0?;
972972
| ^^ the `?` operator cannot be applied to type `{integer}`
973973
|
974-
= help: the trait `TryCore` is not implemented for `{integer}`
974+
= help: the trait `Bubble` is not implemented for `{integer}`
975975
= note: required by `branch`
976976

977977
error: aborting due to 104 previous errors; 2 warnings emitted

src/test/ui/suggestions/issue-72766.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0277]: the `?` operator can only be applied to values that implement `TryCore`
1+
error[E0277]: the `?` operator can only be applied to values that implement `Bubble`
22
--> $DIR/issue-72766.rs:14:5
33
|
44
LL | SadGirl {}.call()?;
55
| ^^^^^^^^^^^^^^^^^^ the `?` operator cannot be applied to type `impl Future`
66
|
7-
= help: the trait `TryCore` is not implemented for `impl Future`
7+
= help: the trait `Bubble` is not implemented for `impl Future`
88
= note: required by `branch`
99

1010
error: aborting due to previous error

src/test/ui/try-block/try-block-bad-type.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ pub fn main() {
1515
let res: Result<i32, i32> = try { }; //~ ERROR type mismatch
1616

1717
let res: () = try { };
18-
//~^ ERROR the trait bound `(): TryCore` is not satisfied
19-
//~| ERROR the trait bound `(): TryCore` is not satisfied
18+
//~^ ERROR the trait bound `(): Bubble` is not satisfied
19+
//~| ERROR the trait bound `(): Bubble` is not satisfied
2020

21-
let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: TryCore` is not satisfied
21+
let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: Bubble` is not satisfied
2222
}

0 commit comments

Comments
 (0)