concrete_is_opaque
);
- // concrete_is_opaque is 'true' when we're using an existential
- // type without 'revelaing' it. For example, code like this:
+ // concrete_is_opaque is `true` when we're using an existential
+ // type without 'revealing' it. For example, code like this:
//
// existential type Foo: Debug;
// fn foo1() -> Foo { ... }
// fn foo2() -> Foo { foo1() }
//
- // In 'foo2', we're not revealing the type of 'Foo' - we're
+ // In `foo2`, we're not revealing the type of `Foo` - we're
// just treating it as the opaque type.
//
// When this occurs, we do *not* want to try to equate
}
if !opaque_defn.substs.has_local_value() {
+ // We only want to add an entry into `concrete_existential_types`
+ // if we actually found a defining usage of this existential type.
+ // Otherwise, we do nothing - we'll either find a defining usage
+ // in some other location, or we'll end up emitting an error due
+ // to the lack of defining usage
if !skip_add {
let new = ty::ResolvedOpaqueTy {
concrete_type: definition_ty,
+++ /dev/null
-#![feature(existential_type)]
-#![feature(impl_trait_in_bindings)]
-//~^ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
-
-// Ensures that `const` items can constrain an `existential type`.
-
-use std::fmt::Debug;
-
-pub existential type Foo: Debug;
-
-const _FOO: Foo = 5;
-
-fn main() {
-}
+++ /dev/null
-warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
- --> $DIR/existential_type_const.rs:2:12
- |
-LL | #![feature(impl_trait_in_bindings)]
- | ^^^^^^^^^^^^^^^^^^^^^^
-
+++ /dev/null
-#![feature(existential_type)]
-
-// Regression test for issue #61863
-
-pub trait MyTrait {}
-
-#[derive(Debug)]
-pub struct MyStruct {
- v: u64
-}
-
-impl MyTrait for MyStruct {}
-
-pub fn bla() -> TE {
- return MyStruct {v:1}
-}
-
-pub fn bla2() -> TE {
- bla()
-}
-
-
-existential type TE: MyTrait;
-
-fn main() {}
+++ /dev/null
-#![feature(existential_type)]
-
-#![allow(dead_code)]
-
-pub trait MyTrait {}
-
-impl MyTrait for bool {}
-
-struct Blah {
- my_foo: Foo,
- my_u8: u8
-}
-
-impl Blah {
- fn new() -> Blah {
- Blah {
- my_foo: make_foo(),
- my_u8: 12
- }
- }
- fn into_inner(self) -> (Foo, u8) {
- (self.my_foo, self.my_u8)
- }
-}
-
-fn make_foo() -> Foo {
- true
-}
-
-existential type Foo: MyTrait;
-
-fn main() {}
--- /dev/null
+// check-pass
+
+#![feature(existential_type)]
+#![feature(impl_trait_in_bindings)]
+//~^ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
+
+// Ensures that `const` items can constrain an `existential type`.
+
+use std::fmt::Debug;
+
+pub existential type Foo: Debug;
+
+const _FOO: Foo = 5;
+
+fn main() {
+}
--- /dev/null
+warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
+ --> $DIR/existential_type_const.rs:2:12
+ |
+LL | #![feature(impl_trait_in_bindings)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
--- /dev/null
+// check-pass
+
+#![feature(existential_type)]
+
+// Regression test for issue #61863
+
+pub trait MyTrait {}
+
+#[derive(Debug)]
+pub struct MyStruct {
+ v: u64
+}
+
+impl MyTrait for MyStruct {}
+
+pub fn bla() -> TE {
+ return MyStruct {v:1}
+}
+
+pub fn bla2() -> TE {
+ bla()
+}
+
+
+existential type TE: MyTrait;
+
+fn main() {}
--- /dev/null
+// check-pass
+
+#![feature(existential_type)]
+#![allow(dead_code)]
+
+pub trait MyTrait {}
+
+impl MyTrait for bool {}
+
+struct Blah {
+ my_foo: Foo,
+ my_u8: u8
+}
+
+impl Blah {
+ fn new() -> Blah {
+ Blah {
+ my_foo: make_foo(),
+ my_u8: 12
+ }
+ }
+ fn into_inner(self) -> (Foo, u8) {
+ (self.my_foo, self.my_u8)
+ }
+}
+
+fn make_foo() -> Foo {
+ true
+}
+
+existential type Foo: MyTrait;
+
+fn main() {}