Skip to content

Commit d41f21f

Browse files
committedAug 24, 2018
Auto merge of #53460 - JoshBrudnak:master, r=estebank
Fix compile panic on non existent type return Reverted the change 28a76a9#diff-4ed25c00aceb84666fca639cf8101c7cL1069 which was panicking when returning a type that cannot be found in the current scope and added testing for the compile error. For example: ```rust fn addition() -> Wrapper<impl A> {} ``` Where Wrapper is undefined in the scope.
2 parents 727eabd + 264d0a2 commit d41f21f

File tree

3 files changed

+847
-612
lines changed

3 files changed

+847
-612
lines changed
 

‎src/librustc_typeck/collect.rs

Lines changed: 816 additions & 612 deletions
Large diffs are not rendered by default.

‎src/test/ui/issue-53300.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2012-2014 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+
// issue 53300
12+
13+
pub trait A {
14+
fn add(&self, b: i32) -> i32;
15+
}
16+
17+
fn addition() -> Wrapper<impl A> {}
18+
//~^ ERROR cannot find type `Wrapper` in this scope [E0412]
19+
20+
fn main() {
21+
let res = addition();
22+
}

‎src/test/ui/issue-53300.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0412]: cannot find type `Wrapper` in this scope
2+
--> $DIR/issue-53300.rs:17:18
3+
|
4+
LL | fn addition() -> Wrapper<impl A> {}
5+
| ^^^^^^^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)
Please sign in to comment.