Auto merge of #53588 - tristanburgess:52985_diagnostics_no_concrete_type_behind_existential_type, r=oli-obk
52985 diagnostics no concrete type behind existential type
@oli-obk FYI. See below for new cycle error generated.
```rust
error[E0391]: cycle detected when processing `Foo`
--> /dev/staging/existential_type_no_concrete_type_nouse_potential.rs:3:1
|
3 | existential type Foo: Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires processing `bar`...
--> /dev/staging/existential_type_no_concrete_type_nouse_potential.rs:6:23
|
6 | fn bar(x: Foo) -> Foo {
| _______________________^
7 | | x
8 | | }
| |_^
= note: ...which again requires processing `Foo`, completing the cycle
error: aborting due to previous error
For more information about this error, try `rustc --explain E0391`.
```
This commit is contained in:
commit
5ce5e08606
4 changed files with 95 additions and 66 deletions
31
src/test/ui/existential_types/nested_existential_types.rs
Normal file
31
src/test/ui/existential_types/nested_existential_types.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2018 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.
|
||||
|
||||
#![feature(existential_type)]
|
||||
// compile-pass
|
||||
mod my_mod {
|
||||
use std::fmt::Debug;
|
||||
|
||||
pub existential type Foo: Debug;
|
||||
pub existential type Foot: Debug;
|
||||
|
||||
pub fn get_foo() -> Foo {
|
||||
5i32
|
||||
}
|
||||
|
||||
pub fn get_foot() -> Foot {
|
||||
get_foo()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _: my_mod::Foot = my_mod::get_foot();
|
||||
}
|
||||
|
||||
|
|
@ -1,10 +1,15 @@
|
|||
error[E0391]: cycle detected when normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: Foo }`
|
||||
error[E0391]: cycle detected when processing `Foo`
|
||||
--> $DIR/no_inferrable_concrete_type.rs:16:1
|
||||
|
|
||||
LL | existential type Foo: Copy; //~ cycle detected
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: ...which again requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: Foo }`, completing the cycle
|
||||
note: ...which requires processing `bar`...
|
||||
--> $DIR/no_inferrable_concrete_type.rs:19:23
|
||||
|
|
||||
LL | fn bar(x: Foo) -> Foo { x }
|
||||
| ^^^^^
|
||||
= note: ...which again requires processing `Foo`, completing the cycle
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue