8000 Add UI tests · rust-lang/rust@e30d92b · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e30d92b

Browse files
huntiepnikomatsakis
authored andcommitted
Add UI tests
1 parent 28996db commit e30d92b

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(try_trait)]
12+
13+
fn main() {}
14+
15+
fn foo() -> Result<u32, ()> {
16+
let x: Option<u32> = None;
17+
x?;
18+
Ok(22)
19+
}
20+
21+
fn bar() -> u32 {
22+
let x: Option<u32> = None;
23+
x?;
24+
22
25+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0277]: the trait bound `(): std::convert::From<std::option::NoneError>` is not satisfied
2+
--> $DIR/try-on-option.rs:17:5
3+
|
4+
17 | x?;
5+
| ^^ the trait `std::convert::From<std::option::NoneError>` is not implemented for `()`
6+
|
7+
= note: required by `std::convert::From::from`
8+
9+
error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
10+
--> $DIR/try-on-option.rs:23:5
11+
|
12+
23 | x?;
13+
| --
14+
| |
15+
| cannot use the `?` operator in a function that returns `u32`
16+
| in 52EB this macro invocation
17+
|
18+
= help: the trait `std::ops::Try` is not implemented for `u32`
19+
= note: required by `std::ops::Try::from_error`
20+
21+
error: aborting due to 2 previous errors
22+

0 commit comments

Comments
 (0)
0