Skip to content
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

The failure from Unwrapping an "Err" does not tell you what error it was #13379

Closed
wackywendell opened this issue Apr 7, 2014 · 0 comments · Fixed by #13479
Closed

The failure from Unwrapping an "Err" does not tell you what error it was #13379

wackywendell opened this issue Apr 7, 2014 · 0 comments · Fixed by #13479

Comments

@wackywendell
Copy link
Contributor

Right now, if you call result.unwrap() for a variable result that is an Err, the program fails but does not tell you what was in the Err. For example:

fn main() {
    let test_err : Result<(), ~str> = Err(~"no reason whatsoever.");
    let _ = test_err.unwrap();
}

Output:
task '<main>' failed at 'called Result::unwrap()on anErr value', /build/rust-git/src/rust/src/libstd/result.rs:187

It would be convenient if failing on a Result<T, E : Show> also displayed the error it was failing on, so, for example, you could call let value = result.unwrap() in the main function of a program and know that it would tell you not only if an error occurred but also what that error was.

sfackler added a commit to sfackler/rust that referenced this issue Apr 14, 2014
`foo.ok().unwrap()` and `foo.err().unwrap()` are the fallbacks for types
that aren't `Show`.

Closes rust-lang#13379
bors added a commit that referenced this issue Apr 14, 2014
`foo.ok().unwrap()` and `foo.err().unwrap()` are the fallbacks for types
that aren't `Show`.

Closes #13379
compiler-errors pushed a commit to compiler-errors/rust that referenced this issue Oct 26, 2022
…re-pt2, r=Veykril

Migrate assists to format args captures, part 2

Continuation of rust-lang#13379

Migrates:

- `generate_constant`
- `generate_default_from_enum_variant`
- `generate_default_from_new`
- `generate_delegate_methods`
- `generate_deref`
- `generate_documentation_template`
- `generate_enum_is_method`
- `generate_enum_projection_method`
- `generate_from_impl_for_enum`
- `generate_function`
- `generate_getter`
- `generate_impl`
- `generate_new`
- `generate_setter`
notriddle pushed a commit to notriddle/rust that referenced this issue Nov 10, 2022
…apture, r=Veykril

internal: Migrate `ide_assists::utils` and `ide_assists::handlers` to use format arg captures (part 1)

This not only serves as making future migration to mutable syntax trees easier, it also finds out what needs to be migrated in the first place.

~~Aside from the first commit, subsequent commits are structured to only deal with one file/handler at a time.~~

This is the first of 3 PRs, migrating:

Utils:

- `gen_trait_fn_body`
- `render_snippet`
- `ReferenceConversion`
  - `convert_type`
  - `getter`

Handlers:

- `add_explicit_type`
- `add_return_type`
- `add_turbo_fish`
- `apply_demorgan`
- `auto_import`
- `convert_comment_block`
- `convert_integer_literal`
- `convert_into_to_from`
- `convert_iter_for_each_to_for`
- `convert_let_else_to_match`
- `convert_tuple_struct_to_named_struct`
- `convert_two_arm_bool_match_to_matches_macro`
- `destructure_tuple_binding`
- `extract_function`
- `extract_module`
- `extract_struct_from_enum_variant`
- `extract_type_alias`
- `extract_variable`
- `fix_visibility`
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 24, 2024
…ment, r=dswij

Fix doc for `while_let_loop`

Fix doc for `while_let_loop`

changelog: none
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 a pull request may close this issue.

1 participant