Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: --test

#![feature(termination_trait_test)]

use std::num::ParseIntError;

#[test]
fn can_parse_zero_as_f32() -> Result<f32, ParseIntError> { //~ ERROR
"0".parse()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error[E0277]: `main` has invalid return type `std::result::Result<f32, std::num::ParseIntError>`
--> $DIR/termination-trait-test-wrong-type.rs:18:1
|
LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseIntError> { //~ ERROR
LL | | "0".parse()
LL | | }
| |_^ `main` can only return types that implement `std::process::Termination`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, that message is a bit off, isn't it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, the span stinks =)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but let's add it anyway and file a follow-up bug

|
= help: the trait `std::process::Termination` is not implemented for `std::result::Result<f32, std::num::ParseIntError>`
= note: required by `__test::test::assert_test_result`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.