Skip to content

Commit 6d1100f

Browse files
In-linecompiler-errors
authored andcommitted
Add failing test
1 parent c32dcbb commit 6d1100f

File tree

6 files changed

+69
-0
lines changed

6 files changed

+69
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![crate_type = "lib"]
2+
3+
extern crate core;
4+
5+
pub mod __private {
6+
#[doc(hidden)]
7+
pub use core::option::Option::{self, None, Some};
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![crate_type = "lib"]
2+
3+
extern crate core;
4+
5+
#[doc(hidden)]
6+
pub mod __private {
7+
pub use core::option::Option::{self, None, Some};
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// aux-build:hidden-child.rs
2+
3+
// FIXME(compiler-errors): This currently suggests the wrong thing.
4+
// UI test exists to track the problem.
5+
6+
extern crate hidden_child;
7+
8+
fn main() {
9+
let x: Option<i32> = 1i32; //~ ERROR mismatched types
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/hidden-child.rs:9:26
3+
|
4+
LL | let x: Option<i32> = 1i32;
5+
| ----------- ^^^^ expected enum `Option`, found `i32`
6+
| |
7+
| expected due to this
8+
|
9+
= note: expected enum `Option<i32>`
10+
found type `i32`
11+
help: try wrapping the expression in `hidden_child::__private::Some`
12+
|
13+
LL | let x: Option<i32> = hidden_child::__private::Some(1i32);
14+
| ++++++++++++++++++++++++++++++ +
15+
16+
error: aborting due to previous error
17+
18+
For more information about this error, try `rustc --explain E0308`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// aux-build:hidden-parent.rs
2+
3+
extern crate hidden_parent;
4+
5+
fn main() {
6+
let x: Option<i32> = 1i32; //~ ERROR mismatched types
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/hidden-parent.rs:6:26
3+
|
4+
LL | let x: Option<i32> = 1i32;
5+
| ----------- ^^^^ expected enum `Option`, found `i32`
6+
| |
7+
| expected due to this
8+
|
9+
= note: expected enum `Option<i32>`
10+
found type `i32`
11+
help: try wrapping the expression in `hidden_parent::__private::Some`
12+
|
13+
LL | let x: Option<i32> = hidden_parent::__private::Some(1i32);
14+
| +++++++++++++++++++++++++++++++ +
15+
16+
error: aborting due to previous error
17+
18+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)