Skip to content

Commit 039e098

Browse files
committed
unconstrained-none
1 parent f39b034 commit 039e098

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

tests/ui/type-inference/type-inference-none-in-generic-ref.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
struct S<'a, T:'a> {
2-
o: &'a Option<T>
1+
//! Checks that compiler prevent from using a reference
2+
//! to an unconstrained `None` in generic context
3+
4+
struct S<'a, T: 'a> {
5+
o: &'a Option<T>,
36
}
47

58
fn main() {

tests/ui/type-inference/type-inference-unconstrained-none.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Issue #5062
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/5062>.
22
33
fn main() {
44
None; //~ ERROR type annotations needed [E0282]

tests/ui/type-inference/type-inference-unconstrained-none.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0282]: type annotations needed
2-
--> $DIR/unconstrained-none.rs:4:5
2+
--> $DIR/type-inference-unconstrained-none.rs:4:5
33
|
44
LL | None;
55
| ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`

0 commit comments

Comments
 (0)