Skip to content

Result::or : avoid over-specializing the type #22817

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
merged 1 commit into from
Feb 28, 2015

Conversation

codyps
Copy link
Contributor

@codyps codyps commented Feb 25, 2015

Changes .or() so that it can return a Result with a different E type
than the one it is called on.

Essentially:

fn or(self, res: Result<T, E>) -> Result<T, E>

becomes

fn or<F>(self, res: Result<T, F>) -> Result<T, F>

This brings or in line with the existing and & or_else

This is a
[breaking-change]
Due to some code needing additional type annotations.

Changes .or() so that it can return a Result with a different E type
than the one it is called on.

Essentially:

    fn or(self, res: Result<T, E>) -> Result<T, E>

becomes

    fn or<F>(self, res: Result<T, F>) -> Result<T, F>

This brings `or` in line with the existing `and` and `or_else` member
types.

This is a
[breaking-change]
Due to some code needing additional type annotations.
@rust-highfive
Copy link
Contributor

r? @huonw

(rust_highfive has picked a reviewer for you, use r? to override)

@huonw
Copy link
Member

huonw commented Feb 25, 2015

@bors r+ 07dc

@huonw
Copy link
Member

huonw commented Feb 25, 2015

@bors rollup

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Feb 26, 2015
Changes .or() so that it can return a Result with a different E type
than the one it is called on.

Essentially:

    fn or(self, res: Result<T, E>) -> Result<T, E>

becomes

    fn or<F>(self, res: Result<T, F>) -> Result<T, F>

This brings `or` in line with the existing `and` & `or_else`

This is a
[breaking-change]
Due to some code needing additional type annotations.
Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 27, 2015
 Changes .or() so that it can return a Result with a different E type
than the one it is called on.

Essentially:

    fn or(self, res: Result<T, E>) -> Result<T, E>

becomes

    fn or<F>(self, res: Result<T, F>) -> Result<T, F>

This brings `or` in line with the existing `and` & `or_else`

This is a
[breaking-change]
Due to some code needing additional type annotations.
@bors bors merged commit 07dc8d6 into rust-lang:master Feb 28, 2015
@codyps codyps deleted the result-or-type branch February 28, 2015 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants