Auto merge of #53460 - JoshBrudnak:master, r=estebank
Fix compile panic on non existent type return
Reverted the change 28a76a9000 (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.
This commit is contained in:
commit
d41f21f11a
File diff suppressed because it is too large
Load Diff
22
src/test/ui/issue-53300.rs
Normal file
22
src/test/ui/issue-53300.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2012-2014 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.
|
||||
|
||||
// issue 53300
|
||||
|
||||
pub trait A {
|
||||
fn add(&self, b: i32) -> i32;
|
||||
}
|
||||
|
||||
fn addition() -> Wrapper<impl A> {}
|
||||
//~^ ERROR cannot find type `Wrapper` in this scope [E0412]
|
||||
|
||||
fn main() {
|
||||
let res = addition();
|
||||
}
|
9
src/test/ui/issue-53300.stderr
Normal file
9
src/test/ui/issue-53300.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
error[E0412]: cannot find type `Wrapper` in this scope
|
||||
--> $DIR/issue-53300.rs:17:18
|
||||
|
|
||||
LL | fn addition() -> Wrapper<impl A> {}
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
Loading…
Reference in New Issue
Block a user